From d7e102fac8524641a36f82442e0b69275908f765 Mon Sep 17 00:00:00 2001 From: Alexander Parlato Date: Wed, 8 Oct 2025 14:32:40 -1000 Subject: [PATCH] kinda gross but functional --- dist/bundle.css | 2 +- dist/bundle.js | 8 ++--- dist/bundle.js.map | 2 +- src/components/CustomJsUi.svelte | 61 ++++++++++++++++++++------------ src/components/Map.svelte | 2 -- 5 files changed, 45 insertions(+), 30 deletions(-) diff --git a/dist/bundle.css b/dist/bundle.css index 9c70a3a..b92a5c4 100644 --- a/dist/bundle.css +++ b/dist/bundle.css @@ -1,6 +1,6 @@ -.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}}.maplibregl-ctrl button:not(:disabled):active{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23333' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%2333b5e5' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} .mapboxgl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.mapboxgl-canvas{left:0;position:absolute;top:0}.mapboxgl-map:-webkit-full-screen{height:100%;width:100%}.mapboxgl-canary{background-color:salmon}.mapboxgl-canvas-container.mapboxgl-interactive,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer{cursor:pointer}.mapboxgl-canvas-container.mapboxgl-interactive:active,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active{cursor:grabbing}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas{touch-action:pan-x pan-y}.mapboxgl-canvas-container.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:pinch-zoom}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:none}.mapboxgl-ctrl-bottom,.mapboxgl-ctrl-bottom-left,.mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-left,.mapboxgl-ctrl-right,.mapboxgl-ctrl-top,.mapboxgl-ctrl-top-left,.mapboxgl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.mapboxgl-ctrl-top-left{left:0;top:0}.mapboxgl-ctrl-top{left:50%;top:0;transform:translateX(-50%)}.mapboxgl-ctrl-top-right{right:0;top:0}.mapboxgl-ctrl-right{right:0;top:50%;transform:translateY(-50%)}.mapboxgl-ctrl-bottom-right{bottom:0;right:0}.mapboxgl-ctrl-bottom{bottom:0;left:50%;transform:translateX(-50%)}.mapboxgl-ctrl-bottom-left{bottom:0;left:0}.mapboxgl-ctrl-left{left:0;top:50%;transform:translateY(-50%)}.mapboxgl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.mapboxgl-ctrl-top-left .mapboxgl-ctrl{float:left;margin:10px 0 0 10px}.mapboxgl-ctrl-top .mapboxgl-ctrl{float:left;margin:10px 0}.mapboxgl-ctrl-top-right .mapboxgl-ctrl{float:right;margin:10px 10px 0 0}.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl,.mapboxgl-ctrl-right .mapboxgl-ctrl{float:right;margin:0 10px 10px 0}.mapboxgl-ctrl-bottom .mapboxgl-ctrl{float:left;margin:10px 0}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl,.mapboxgl-ctrl-left .mapboxgl-ctrl{float:left;margin:0 0 10px 10px}.mapboxgl-ctrl-group{background:#fff;border-radius:4px}.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.mapboxgl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;overflow:hidden;padding:0;width:29px}.mapboxgl-ctrl-group button+button{border-top:1px solid #ddd}.mapboxgl-ctrl button .mapboxgl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.mapboxgl-ctrl-icon{background-color:transparent}.mapboxgl-ctrl-group button+button{border-top:1px solid ButtonText}}.mapboxgl-ctrl-attrib-button:focus,.mapboxgl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl button:disabled{cursor:not-allowed}.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon{opacity:.25}.mapboxgl-ctrl-group button:first-child{border-radius:4px 4px 0 0}.mapboxgl-ctrl-group button:last-child{border-radius:0 0 4px 4px}.mapboxgl-ctrl-group button:only-child{border-radius:inherit}.mapboxgl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.mapboxgl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' 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")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' 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")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' 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")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' 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")}}.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' 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")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' 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")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' 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")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' 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")}}.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23999'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23333'%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 id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%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 id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%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 id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%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 id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%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 id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%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 id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting .mapboxgl-ctrl-icon{animation:mapboxgl-spin 2s linear infinite}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%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 id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23999'%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 id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%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 id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%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 id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%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 id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%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 id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23000'%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 id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23666'%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 id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E")}}@keyframes mapboxgl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.mapboxgl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='0.3' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='0.9' fill='%23fff'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.mapboxgl-ctrl-logo.mapboxgl-compact{width:23px}@media (-ms-high-contrast:active){a.mapboxgl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='1' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='1' fill='%23fff'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.mapboxgl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='1' stroke='%23fff' stroke-width='3' fill='%23fff'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='1' fill='%23000'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E")}}.mapboxgl-ctrl.mapboxgl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.mapboxgl-ctrl-attrib.mapboxgl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.mapboxgl-ctrl-attrib.mapboxgl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner{display:none}.mapboxgl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-top-left .mapboxgl-ctrl-attrib-button{left:0}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-inner{display:block}.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.mapboxgl-ctrl-bottom-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;right:0}.mapboxgl-ctrl-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{right:0}.mapboxgl-ctrl-top-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{right:0;top:0}.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{left:0;top:0}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;left:0}.mapboxgl-ctrl-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{left:0}}@media screen and (-ms-high-contrast:active){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%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")}}.mapboxgl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.mapboxgl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.mapboxgl-ctrl-attrib .mapbox-improve-map{font-weight:700;margin-left:2px}.mapboxgl-attrib-empty{display:none}.mapboxgl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px;white-space:nowrap}.mapboxgl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.mapboxgl-popup-anchor-top,.mapboxgl-popup-anchor-top-left,.mapboxgl-popup-anchor-top-right{flex-direction:column}.mapboxgl-popup-anchor-bottom,.mapboxgl-popup-anchor-bottom-left,.mapboxgl-popup-anchor-bottom-right{flex-direction:column-reverse}.mapboxgl-popup-anchor-left{flex-direction:row}.mapboxgl-popup-anchor-right{flex-direction:row-reverse}.mapboxgl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.mapboxgl-popup-anchor-top .mapboxgl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.mapboxgl-popup-anchor-left .mapboxgl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.mapboxgl-popup-anchor-right .mapboxgl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.mapboxgl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.mapboxgl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.mapboxgl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:10px 10px 15px;pointer-events:auto;position:relative}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content{border-top-left-radius:0}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content{border-top-right-radius:0}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content{border-bottom-left-radius:0}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content{border-bottom-right-radius:0}.mapboxgl-popup-track-pointer{display:none}.mapboxgl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.mapboxgl-map:hover .mapboxgl-popup-track-pointer{display:flex}.mapboxgl-map:active .mapboxgl-popup-track-pointer{display:none}.mapboxgl-marker{left:0;opacity:1;position:absolute;top:0;transition:opacity .2s;will-change:transform}.mapboxgl-user-location-dot,.mapboxgl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.mapboxgl-user-location-dot:before{animation:mapboxgl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.mapboxgl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading{height:0;width:0}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after,.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-bottom:7.5px solid #4aa1eb;content:"";position:absolute}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-left:7.5px solid transparent;transform:translateY(-28px) skewY(-20deg)}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after{border-right:7.5px solid transparent;transform:translate(7.5px,-28px) skewY(20deg)}@keyframes mapboxgl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.mapboxgl-user-location-dot-stale{background-color:#aaa}.mapboxgl-user-location-dot-stale:after{display:none}.mapboxgl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.mapboxgl-crosshair,.mapboxgl-crosshair .mapboxgl-interactive,.mapboxgl-crosshair .mapboxgl-interactive:active{cursor:crosshair}.mapboxgl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}@media print{.mapbox-improve-map{display:none}}.mapboxgl-scroll-zoom-blocker,.mapboxgl-touch-pan-blocker{align-items:center;background:rgba(0,0,0,.7);color:#fff;display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;height:100%;justify-content:center;left:0;opacity:0;pointer-events:none;position:absolute;text-align:center;top:0;transition:opacity .75s ease-in-out;transition-delay:1s;width:100%}.mapboxgl-scroll-zoom-blocker-show,.mapboxgl-touch-pan-blocker-show{opacity:1;transition:opacity .1s ease-in-out}.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page,.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page .mapboxgl-canvas{touch-action:pan-x pan-y} .maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}}.maplibregl-ctrl button:not(:disabled):active{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23333' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%2333b5e5' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} +.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}}.maplibregl-ctrl button:not(:disabled):active{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23333' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%2333b5e5' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} .mapboxgl-ctrl-group:not(:empty), .maplibregl-ctrl-group:not(:empty) { box-shadow: 0 0 6px 2px rgb(0 0 0 / 8%); } diff --git a/dist/bundle.js b/dist/bundle.js index 2889d77..4bc27ee 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -1,5 +1,5 @@ function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}))})),Object.freeze(e)}function t(){}function i(e,t){for(const i in t)e[i]=t[i];return e}function r(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(r)}function s(e){return"function"==typeof e}function a(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function l(e,i,r){e.$$.on_destroy.push(function(e,...i){if(null==e)return t;const r=e.subscribe(...i);return r.unsubscribe?()=>r.unsubscribe():r}(i,r))}function c(e,t,i,r){if(e){const n=u(e,t,i,r);return e[0](n)}}function u(e,t,r,n){return e[1]&&n?i(r.ctx.slice(),e[1](n(t))):r.ctx}function h(e,t,i,r){if(e[2]&&r){const n=e[2](r(i));if(void 0===t.dirty)return n;if("object"==typeof n){const e=[],i=Math.max(t.dirty.length,n.length);for(let r=0;r32){const t=[],i=e.ctx.length/32;for(let e=0;ee.removeEventListener(t,i,r)}function E(e,t,i){null==i?e.removeAttribute(t):e.getAttribute(t)!==i&&e.setAttribute(t,i)}function M(e){return""===e?null:+e}function I(e,t){t=""+t,e.data!==t&&(e.data=t)}function P(e,t){e.value=null==t?"":t}function F(e,t,i,r){null==i?e.style.removeProperty(t):e.style.setProperty(t,i,r?"important":"")}function k(e,t,i){for(let i=0;i{const n=e.$$.callbacks[t];if(n){const o=function(e,t,{bubbles:i=!1,cancelable:r=!1}={}){const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,i,r,t),n}(t,i,{cancelable:r});return n.slice().forEach((t=>{t.call(e,o)})),!o.defaultPrevented}return!0}}function G(e,t){const i=e.$$.callbacks[t.type];i&&i.slice().forEach((e=>e.call(this,t)))}const $=[],Z=[];let q=[];const K=[],W=Promise.resolve();let X=!1;function Y(){X||(X=!0,W.then(ie))}function J(e){q.push(e)}const ee=new Set;let te=0;function ie(){if(0!==te)return;const e=R;do{try{for(;te<$.length;){const e=$[te];te++,N(e),re(e.$$)}}catch(e){throw $.length=0,te=0,e}for(N(null),$.length=0,te=0;Z.length;)Z.pop()();for(let e=0;e{ne.delete(e),r&&(i&&e.d(1),r())})),e.o(t)}else r&&r()}function ue(e,t){const i={},r={},n={$$scope:1};let o=e.length;for(;o--;){const s=e[o],a=t[o];if(a){for(const e in s)e in a||(r[e]=1);for(const e in a)n[e]||(i[e]=a[e],n[e]=1);e[o]=a}else for(const e in s)n[e]=1}for(const e in r)e in i||(i[e]=void 0);return i}function he(e){return"object"==typeof e&&null!==e?e:{}}function de(e){e&&e.c()}function pe(e,t,i,n){const{fragment:a,after_update:l}=e.$$;a&&a.m(t,i),n||J((()=>{const t=e.$$.on_mount.map(r).filter(s);e.$$.on_destroy?e.$$.on_destroy.push(...t):o(t),e.$$.on_mount=[]})),l.forEach(J)}function fe(e,t){const i=e.$$;null!==i.fragment&&(!function(e){const t=[],i=[];q.forEach((r=>-1===e.indexOf(r)?t.push(r):i.push(r))),i.forEach((e=>e())),q=t}(i.after_update),o(i.on_destroy),i.fragment&&i.fragment.d(t),i.on_destroy=i.fragment=null,i.ctx=[])}function Ae(e,i,r,s,a,l,c,u=[-1]){const h=R;N(e);const d=e.$$={fragment:null,ctx:[],props:l,update:t,not_equal:a,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(i.context||(h?h.$$.context:[])),callbacks:n(),dirty:u,skip_bound:!1,root:i.target||h.$$.root};c&&c(d.root);let p=!1;if(d.ctx=r?r(e,i.props||{},((t,i,...r)=>{const n=r.length?r[0]:i;return d.ctx&&a(d.ctx[t],d.ctx[t]=n)&&(!d.skip_bound&&d.bound[t]&&d.bound[t](n),p&&function(e,t){-1===e.$$.dirty[0]&&($.push(e),Y(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const e=r.indexOf(i);-1!==e&&r.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}var ge="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ye(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})})),t}var ve={exports:{}};ve.exports=function(){var e,t,i;function r(r,n){if(e)if(t){var o="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk); self.onerror = null;",s={};e(s),i=n(s),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else t=n;else e=n}r(["exports"],(function(e){function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i,r={},n={};function o(){if(i)return n;i=1,Object.defineProperty(n,"__esModule",{value:!0}),n.setMatrixArrayType=function(e){n.ARRAY_TYPE=t=e},n.toRadian=function(e){return e*o},n.equals=function(t,i){return Math.abs(t-i)<=e*Math.max(1,Math.abs(t),Math.abs(i))},n.RANDOM=n.ARRAY_TYPE=n.EPSILON=void 0;var e=1e-6;n.EPSILON=e;var t="undefined"!=typeof Float32Array?Float32Array:Array;n.ARRAY_TYPE=t;var r=Math.random;n.RANDOM=r;var o=Math.PI/180;return Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),n}var s,a={};function l(){if(s)return a;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}s=1,Object.defineProperty(a,"__esModule",{value:!0}),a.create=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},a.clone=function(e){var i=new t.ARRAY_TYPE(4);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i},a.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},a.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},a.fromValues=function(e,i,r,n){var o=new t.ARRAY_TYPE(4);return o[0]=e,o[1]=i,o[2]=r,o[3]=n,o},a.set=function(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e},a.transpose=function(e,t){if(e===t){var i=t[1];e[1]=t[2],e[2]=i}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e},a.invert=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i*o-n*r;return s?(e[0]=o*(s=1/s),e[1]=-r*s,e[2]=-n*s,e[3]=i*s,e):null},a.adjoint=function(e,t){var i=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=i,e},a.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},a.multiply=r,a.rotate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l+o*a,e[1]=n*l+s*a,e[2]=r*-a+o*l,e[3]=n*-a+s*l,e},a.scale=function(e,t,i){var r=t[1],n=t[2],o=t[3],s=i[0],a=i[1];return e[0]=t[0]*s,e[1]=r*s,e[2]=n*a,e[3]=o*a,e},a.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=-i,e[3]=r,e},a.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e},a.str=function(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},a.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},a.LDU=function(e,t,i,r){return e[2]=r[2]/r[0],i[0]=r[0],i[1]=r[1],i[3]=r[3]-e[2]*i[1],[e,t,i]},a.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e},a.subtract=n,a.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},a.equals=function(e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=i[0],l=i[1],c=i[2],u=i[3];return Math.abs(r-a)<=t.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-l)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-c)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(s-u)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(u))},a.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e},a.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e},a.sub=a.mul=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var r=i(void 0);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}(o());function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function r(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=i[0],l=i[1],c=i[2],u=i[3];return e[0]=r*a+o*l,e[1]=n*a+s*l,e[2]=r*c+o*u,e[3]=n*c+s*u,e}function n(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}return a.mul=r,a.sub=n,a}var c,u={};function h(){if(c)return u;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}c=1,Object.defineProperty(u,"__esModule",{value:!0}),u.create=function(){var e=new t.ARRAY_TYPE(6);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[4]=0,e[5]=0),e[0]=1,e[3]=1,e},u.clone=function(e){var i=new t.ARRAY_TYPE(6);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i},u.copy=function(e,t){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},u.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},u.fromValues=function(e,i,r,n,o,s){var a=new t.ARRAY_TYPE(6);return a[0]=e,a[1]=i,a[2]=r,a[3]=n,a[4]=o,a[5]=s,a},u.set=function(e,t,i,r,n,o,s){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s,e},u.invert=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=i*o-r*n;return l?(e[0]=o*(l=1/l),e[1]=-r*l,e[2]=-n*l,e[3]=i*l,e[4]=(n*a-o*s)*l,e[5]=(r*s-i*a)*l,e):null},u.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},u.multiply=r,u.rotate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=Math.sin(i),u=Math.cos(i);return e[0]=r*u+o*c,e[1]=n*u+s*c,e[2]=r*-c+o*u,e[3]=n*-c+s*u,e[4]=a,e[5]=l,e},u.scale=function(e,t,i){var r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=i[0],c=i[1];return e[0]=t[0]*l,e[1]=r*l,e[2]=n*c,e[3]=o*c,e[4]=s,e[5]=a,e},u.translate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=i[0],u=i[1];return e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=r*c+o*u+a,e[5]=n*c+s*u+l,e},u.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=-i,e[3]=r,e[4]=0,e[5]=0,e},u.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e},u.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e},u.str=function(e){return"mat2d("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},u.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],1)},u.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e},u.subtract=n,u.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e},u.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e},u.exactEquals=function(e,t){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]},u.equals=function(e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=i[0],u=i[1],h=i[2],d=i[3],p=i[4],f=i[5];return Math.abs(r-c)<=t.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(n-u)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(o-h)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-d)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))&&Math.abs(a-p)<=t.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(l-f)<=t.EPSILON*Math.max(1,Math.abs(l),Math.abs(f))},u.sub=u.mul=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var r=i(void 0);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}(o());function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function r(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=i[0],u=i[1],h=i[2],d=i[3],p=i[4],f=i[5];return e[0]=r*c+o*u,e[1]=n*c+s*u,e[2]=r*h+o*d,e[3]=n*h+s*d,e[4]=r*p+o*f+a,e[5]=n*p+s*f+l,e}function n(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e}return u.mul=r,u.sub=n,u}var d,p={};function f(){if(d)return p;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}d=1,Object.defineProperty(p,"__esModule",{value:!0}),p.create=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},p.fromMat4=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},p.clone=function(e){var i=new t.ARRAY_TYPE(9);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i},p.copy=function(e,t){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},p.fromValues=function(e,i,r,n,o,s,a,l,c){var u=new t.ARRAY_TYPE(9);return u[0]=e,u[1]=i,u[2]=r,u[3]=n,u[4]=o,u[5]=s,u[6]=a,u[7]=l,u[8]=c,u},p.set=function(e,t,i,r,n,o,s,a,l,c){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e[8]=c,e},p.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},p.transpose=function(e,t){if(e===t){var i=t[1],r=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},p.invert=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*s-a*c,d=-u*o+a*l,p=c*o-s*l,f=i*h+r*d+n*p;return f?(e[0]=h*(f=1/f),e[1]=(-u*r+n*c)*f,e[2]=(a*r-n*s)*f,e[3]=d*f,e[4]=(u*i-n*l)*f,e[5]=(-a*i+n*o)*f,e[6]=p*f,e[7]=(-c*i+r*l)*f,e[8]=(s*i-r*o)*f,e):null},p.adjoint=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8];return e[0]=s*u-a*c,e[1]=n*c-r*u,e[2]=r*a-n*s,e[3]=a*l-o*u,e[4]=i*u-n*l,e[5]=n*o-i*a,e[6]=o*c-s*l,e[7]=r*l-i*c,e[8]=i*s-r*o,e},p.determinant=function(e){var t=e[3],i=e[4],r=e[5],n=e[6],o=e[7],s=e[8];return e[0]*(s*i-r*o)+e[1]*(-s*t+r*n)+e[2]*(o*t-i*n)},p.multiply=r,p.translate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=i[0],p=i[1];return e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=d*r+p*s+c,e[7]=d*n+p*a+u,e[8]=d*o+p*l+h,e},p.rotate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=Math.sin(i),p=Math.cos(i);return e[0]=p*r+d*s,e[1]=p*n+d*a,e[2]=p*o+d*l,e[3]=p*s-d*r,e[4]=p*a-d*n,e[5]=p*l-d*o,e[6]=c,e[7]=u,e[8]=h,e},p.scale=function(e,t,i){var r=i[0],n=i[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},p.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},p.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},p.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},p.fromMat2d=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},p.fromQuat=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i+i,a=r+r,l=n+n,c=i*s,u=r*s,h=r*a,d=n*s,p=n*a,f=n*l,A=o*s,m=o*a,g=o*l;return e[0]=1-h-f,e[3]=u-g,e[6]=d+m,e[1]=u+g,e[4]=1-c-f,e[7]=p-A,e[2]=d-m,e[5]=p+A,e[8]=1-c-h,e},p.normalFromMat4=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],A=t[13],m=t[14],g=t[15],_=i*a-r*s,y=i*l-n*s,v=i*c-o*s,x=r*l-n*a,b=r*c-o*a,w=n*c-o*l,T=u*A-h*f,B=u*m-d*f,C=u*g-p*f,S=h*m-d*A,E=h*g-p*A,M=d*g-p*m,I=_*M-y*E+v*S+x*C-b*B+w*T;return I?(e[0]=(a*M-l*E+c*S)*(I=1/I),e[1]=(l*C-s*M-c*B)*I,e[2]=(s*E-a*C+c*T)*I,e[3]=(n*E-r*M-o*S)*I,e[4]=(i*M-n*C+o*B)*I,e[5]=(r*C-i*E-o*T)*I,e[6]=(A*w-m*b+g*x)*I,e[7]=(m*v-f*w-g*y)*I,e[8]=(f*b-A*v+g*_)*I,e):null},p.projection=function(e,t,i){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/i,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},p.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},p.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},p.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e},p.subtract=n,p.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e},p.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e},p.exactEquals=function(e,t){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]},p.equals=function(e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=i[0],p=i[1],f=i[2],A=i[3],m=i[4],g=i[5],_=i[6],y=i[7],v=i[8];return Math.abs(r-d)<=t.EPSILON*Math.max(1,Math.abs(r),Math.abs(d))&&Math.abs(n-p)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(o-f)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(s-A)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(a-m)<=t.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(l-g)<=t.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(c-_)<=t.EPSILON*Math.max(1,Math.abs(c),Math.abs(_))&&Math.abs(u-y)<=t.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(h-v)<=t.EPSILON*Math.max(1,Math.abs(h),Math.abs(v))},p.sub=p.mul=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var r=i(void 0);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}(o());function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function r(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=i[0],p=i[1],f=i[2],A=i[3],m=i[4],g=i[5],_=i[6],y=i[7],v=i[8];return e[0]=d*r+p*s+f*c,e[1]=d*n+p*a+f*u,e[2]=d*o+p*l+f*h,e[3]=A*r+m*s+g*c,e[4]=A*n+m*a+g*u,e[5]=A*o+m*l+g*h,e[6]=_*r+y*s+v*c,e[7]=_*n+y*a+v*u,e[8]=_*o+y*l+v*h,e}function n(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e}return p.mul=r,p.sub=n,p}var A,m={};function g(){if(A)return m;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}A=1,Object.defineProperty(m,"__esModule",{value:!0}),m.create=function(){var e=new t.ARRAY_TYPE(16);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},m.clone=function(e){var i=new t.ARRAY_TYPE(16);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},m.copy=function(e,t){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},m.fromValues=function(e,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m){var g=new t.ARRAY_TYPE(16);return g[0]=e,g[1]=i,g[2]=r,g[3]=n,g[4]=o,g[5]=s,g[6]=a,g[7]=l,g[8]=c,g[9]=u,g[10]=h,g[11]=d,g[12]=p,g[13]=f,g[14]=A,g[15]=m,g},m.set=function(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=h,e[11]=d,e[12]=p,e[13]=f,e[14]=A,e[15]=m,e},m.identity=r,m.transpose=function(e,t){if(e===t){var i=t[1],r=t[2],n=t[3],o=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=o,e[11]=t[14],e[12]=n,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},m.invert=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],A=t[13],m=t[14],g=t[15],_=i*a-r*s,y=i*l-n*s,v=i*c-o*s,x=r*l-n*a,b=r*c-o*a,w=n*c-o*l,T=u*A-h*f,B=u*m-d*f,C=u*g-p*f,S=h*m-d*A,E=h*g-p*A,M=d*g-p*m,I=_*M-y*E+v*S+x*C-b*B+w*T;return I?(e[0]=(a*M-l*E+c*S)*(I=1/I),e[1]=(n*E-r*M-o*S)*I,e[2]=(A*w-m*b+g*x)*I,e[3]=(d*b-h*w-p*x)*I,e[4]=(l*C-s*M-c*B)*I,e[5]=(i*M-n*C+o*B)*I,e[6]=(m*v-f*w-g*y)*I,e[7]=(u*w-d*v+p*y)*I,e[8]=(s*E-a*C+c*T)*I,e[9]=(r*C-i*E-o*T)*I,e[10]=(f*b-A*v+g*_)*I,e[11]=(h*v-u*b-p*_)*I,e[12]=(a*B-s*S-l*T)*I,e[13]=(i*S-r*B+n*T)*I,e[14]=(A*y-f*x-m*_)*I,e[15]=(u*x-h*y+d*_)*I,e):null},m.adjoint=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],A=t[13],m=t[14],g=t[15];return e[0]=a*(d*g-p*m)-h*(l*g-c*m)+A*(l*p-c*d),e[1]=-(r*(d*g-p*m)-h*(n*g-o*m)+A*(n*p-o*d)),e[2]=r*(l*g-c*m)-a*(n*g-o*m)+A*(n*c-o*l),e[3]=-(r*(l*p-c*d)-a*(n*p-o*d)+h*(n*c-o*l)),e[4]=-(s*(d*g-p*m)-u*(l*g-c*m)+f*(l*p-c*d)),e[5]=i*(d*g-p*m)-u*(n*g-o*m)+f*(n*p-o*d),e[6]=-(i*(l*g-c*m)-s*(n*g-o*m)+f*(n*c-o*l)),e[7]=i*(l*p-c*d)-s*(n*p-o*d)+u*(n*c-o*l),e[8]=s*(h*g-p*A)-u*(a*g-c*A)+f*(a*p-c*h),e[9]=-(i*(h*g-p*A)-u*(r*g-o*A)+f*(r*p-o*h)),e[10]=i*(a*g-c*A)-s*(r*g-o*A)+f*(r*c-o*a),e[11]=-(i*(a*p-c*h)-s*(r*p-o*h)+u*(r*c-o*a)),e[12]=-(s*(h*m-d*A)-u*(a*m-l*A)+f*(a*d-l*h)),e[13]=i*(h*m-d*A)-u*(r*m-n*A)+f*(r*d-n*h),e[14]=-(i*(a*m-l*A)-s*(r*m-n*A)+f*(r*l-n*a)),e[15]=i*(a*d-l*h)-s*(r*d-n*h)+u*(r*l-n*a),e},m.determinant=function(e){var t=e[0],i=e[1],r=e[2],n=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],A=e[14],m=e[15];return(t*s-i*o)*(h*m-d*A)-(t*a-r*o)*(u*m-d*f)+(t*l-n*o)*(u*A-h*f)+(i*a-r*s)*(c*m-d*p)-(i*l-n*s)*(c*A-h*p)+(r*l-n*a)*(c*f-u*p)},m.multiply=n,m.translate=function(e,t,i){var r,n,o,s,a,l,c,u,h,d,p,f,A=i[0],m=i[1],g=i[2];return t===e?(e[12]=t[0]*A+t[4]*m+t[8]*g+t[12],e[13]=t[1]*A+t[5]*m+t[9]*g+t[13],e[14]=t[2]*A+t[6]*m+t[10]*g+t[14],e[15]=t[3]*A+t[7]*m+t[11]*g+t[15]):(n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=r*A+a*m+h*g+t[12],e[13]=n*A+l*m+d*g+t[13],e[14]=o*A+c*m+p*g+t[14],e[15]=s*A+u*m+f*g+t[15]),e},m.scale=function(e,t,i){var r=i[0],n=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},m.rotate=function(e,i,r,n){var o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S,E,M=n[0],I=n[1],P=n[2],L=Math.hypot(M,I,P);return L0?(r[0]=2*(c*l+d*n+u*a-h*o)/p,r[1]=2*(u*l+d*o+h*n-c*a)/p,r[2]=2*(h*l+d*a+c*o-u*n)/p):(r[0]=2*(c*l+d*n+u*a-h*o),r[1]=2*(u*l+d*o+h*n-c*a),r[2]=2*(h*l+d*a+c*o-u*n)),s(e,i,r),e},m.getTranslation=function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},m.getScaling=a,m.getRotation=function(e,i){var r=new t.ARRAY_TYPE(3);a(r,i);var n=1/r[0],o=1/r[1],s=1/r[2],l=i[0]*n,c=i[1]*o,u=i[2]*s,h=i[4]*n,d=i[5]*o,p=i[6]*s,f=i[8]*n,A=i[9]*o,m=i[10]*s,g=l+d+m,_=0;return g>0?(_=2*Math.sqrt(g+1),e[3]=.25*_,e[0]=(p-A)/_,e[1]=(f-u)/_,e[2]=(c-h)/_):l>d&&l>m?(_=2*Math.sqrt(1+l-d-m),e[3]=(p-A)/_,e[0]=.25*_,e[1]=(c+h)/_,e[2]=(f+u)/_):d>m?(_=2*Math.sqrt(1+d-l-m),e[3]=(f-u)/_,e[0]=(c+h)/_,e[1]=.25*_,e[2]=(p+A)/_):(_=2*Math.sqrt(1+m-l-d),e[3]=(c-h)/_,e[0]=(f+u)/_,e[1]=(p+A)/_,e[2]=.25*_),e},m.fromRotationTranslationScale=function(e,t,i,r){var n=t[0],o=t[1],s=t[2],a=t[3],l=n+n,c=o+o,u=s+s,h=n*l,d=n*c,p=n*u,f=o*c,A=o*u,m=s*u,g=a*l,_=a*c,y=a*u,v=r[0],x=r[1],b=r[2];return e[0]=(1-(f+m))*v,e[1]=(d+y)*v,e[2]=(p-_)*v,e[3]=0,e[4]=(d-y)*x,e[5]=(1-(h+m))*x,e[6]=(A+g)*x,e[7]=0,e[8]=(p+_)*b,e[9]=(A-g)*b,e[10]=(1-(h+f))*b,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e},m.fromRotationTranslationScaleOrigin=function(e,t,i,r,n){var o=t[0],s=t[1],a=t[2],l=t[3],c=o+o,u=s+s,h=a+a,d=o*c,p=o*u,f=o*h,A=s*u,m=s*h,g=a*h,_=l*c,y=l*u,v=l*h,x=r[0],b=r[1],w=r[2],T=n[0],B=n[1],C=n[2],S=(1-(A+g))*x,E=(p+v)*x,M=(f-y)*x,I=(p-v)*b,P=(1-(d+g))*b,L=(m+_)*b,F=(f+y)*w,k=(m-_)*w,z=(1-(d+A))*w;return e[0]=S,e[1]=E,e[2]=M,e[3]=0,e[4]=I,e[5]=P,e[6]=L,e[7]=0,e[8]=F,e[9]=k,e[10]=z,e[11]=0,e[12]=i[0]+T-(S*T+I*B+F*C),e[13]=i[1]+B-(E*T+P*B+k*C),e[14]=i[2]+C-(M*T+L*B+z*C),e[15]=1,e},m.fromQuat=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i+i,a=r+r,l=n+n,c=i*s,u=r*s,h=r*a,d=n*s,p=n*a,f=n*l,A=o*s,m=o*a,g=o*l;return e[0]=1-h-f,e[1]=u+g,e[2]=d-m,e[3]=0,e[4]=u-g,e[5]=1-c-f,e[6]=p+A,e[7]=0,e[8]=d+m,e[9]=p-A,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},m.frustum=function(e,t,i,r,n,o,s){var a=1/(i-t),l=1/(n-r),c=1/(o-s);return e[0]=2*o*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*o*l,e[6]=0,e[7]=0,e[8]=(i+t)*a,e[9]=(n+r)*l,e[10]=(s+o)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*c,e[15]=0,e},m.perspectiveNO=l,m.perspectiveZO=function(e,t,i,r,n){var o,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=n*(o=1/(r-n)),e[14]=n*r*o):(e[10]=-1,e[14]=-r),e},m.perspectiveFromFieldOfView=function(e,t,i,r){var n=Math.tan(t.upDegrees*Math.PI/180),o=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+a),c=2/(n+o);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-(s-a)*l*.5,e[9]=(n-o)*c*.5,e[10]=r/(i-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*i/(i-r),e[15]=0,e},m.orthoNO=c,m.orthoZO=function(e,t,i,r,n,o,s){var a=1/(t-i),l=1/(r-n),c=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+i)*a,e[13]=(n+r)*l,e[14]=o*c,e[15]=1,e},m.lookAt=function(e,i,n,o){var s,a,l,c,u,h,d,p,f,A,m=i[0],g=i[1],_=i[2],y=o[0],v=o[1],x=o[2],b=n[0],w=n[1],T=n[2];return Math.abs(m-b)0&&(u*=p=1/Math.sqrt(p),h*=p,d*=p);var f=l*d-c*h,A=c*u-a*d,m=a*h-l*u;return(p=f*f+A*A+m*m)>0&&(f*=p=1/Math.sqrt(p),A*=p,m*=p),e[0]=f,e[1]=A,e[2]=m,e[3]=0,e[4]=h*m-d*A,e[5]=d*f-u*m,e[6]=u*A-h*f,e[7]=0,e[8]=u,e[9]=h,e[10]=d,e[11]=0,e[12]=n,e[13]=o,e[14]=s,e[15]=1,e},m.str=function(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},m.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},m.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e[9]=t[9]+i[9],e[10]=t[10]+i[10],e[11]=t[11]+i[11],e[12]=t[12]+i[12],e[13]=t[13]+i[13],e[14]=t[14]+i[14],e[15]=t[15]+i[15],e},m.subtract=u,m.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12]*i,e[13]=t[13]*i,e[14]=t[14]*i,e[15]=t[15]*i,e},m.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e[9]=t[9]+i[9]*r,e[10]=t[10]+i[10]*r,e[11]=t[11]+i[11]*r,e[12]=t[12]+i[12]*r,e[13]=t[13]+i[13]*r,e[14]=t[14]+i[14]*r,e[15]=t[15]+i[15]*r,e},m.exactEquals=function(e,t){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]},m.equals=function(e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=e[9],p=e[10],f=e[11],A=e[12],m=e[13],g=e[14],_=e[15],y=i[0],v=i[1],x=i[2],b=i[3],w=i[4],T=i[5],B=i[6],C=i[7],S=i[8],E=i[9],M=i[10],I=i[11],P=i[12],L=i[13],F=i[14],k=i[15];return Math.abs(r-y)<=t.EPSILON*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(n-v)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(o-x)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(x))&&Math.abs(s-b)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(a-w)<=t.EPSILON*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(l-T)<=t.EPSILON*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(c-B)<=t.EPSILON*Math.max(1,Math.abs(c),Math.abs(B))&&Math.abs(u-C)<=t.EPSILON*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(h-S)<=t.EPSILON*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(d-E)<=t.EPSILON*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-M)<=t.EPSILON*Math.max(1,Math.abs(p),Math.abs(M))&&Math.abs(f-I)<=t.EPSILON*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(A-P)<=t.EPSILON*Math.max(1,Math.abs(A),Math.abs(P))&&Math.abs(m-L)<=t.EPSILON*Math.max(1,Math.abs(m),Math.abs(L))&&Math.abs(g-F)<=t.EPSILON*Math.max(1,Math.abs(g),Math.abs(F))&&Math.abs(_-k)<=t.EPSILON*Math.max(1,Math.abs(_),Math.abs(k))},m.sub=m.mul=m.ortho=m.perspective=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var r=i(void 0);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}(o());function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function r(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function n(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],A=t[12],m=t[13],g=t[14],_=t[15],y=i[0],v=i[1],x=i[2],b=i[3];return e[0]=y*r+v*a+x*h+b*A,e[1]=y*n+v*l+x*d+b*m,e[2]=y*o+v*c+x*p+b*g,e[3]=y*s+v*u+x*f+b*_,e[4]=(y=i[4])*r+(v=i[5])*a+(x=i[6])*h+(b=i[7])*A,e[5]=y*n+v*l+x*d+b*m,e[6]=y*o+v*c+x*p+b*g,e[7]=y*s+v*u+x*f+b*_,e[8]=(y=i[8])*r+(v=i[9])*a+(x=i[10])*h+(b=i[11])*A,e[9]=y*n+v*l+x*d+b*m,e[10]=y*o+v*c+x*p+b*g,e[11]=y*s+v*u+x*f+b*_,e[12]=(y=i[12])*r+(v=i[13])*a+(x=i[14])*h+(b=i[15])*A,e[13]=y*n+v*l+x*d+b*m,e[14]=y*o+v*c+x*p+b*g,e[15]=y*s+v*u+x*f+b*_,e}function s(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=r+r,l=n+n,c=o+o,u=r*a,h=r*l,d=r*c,p=n*l,f=n*c,A=o*c,m=s*a,g=s*l,_=s*c;return e[0]=1-(p+A),e[1]=h+_,e[2]=d-g,e[3]=0,e[4]=h-_,e[5]=1-(u+A),e[6]=f+m,e[7]=0,e[8]=d+g,e[9]=f-m,e[10]=1-(u+p),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function a(e,t){var i=t[4],r=t[5],n=t[6],o=t[8],s=t[9],a=t[10];return e[0]=Math.hypot(t[0],t[1],t[2]),e[1]=Math.hypot(i,r,n),e[2]=Math.hypot(o,s,a),e}function l(e,t,i,r,n){var o,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+r)*(o=1/(r-n)),e[14]=2*n*r*o):(e[10]=-1,e[14]=-2*r),e}function c(e,t,i,r,n,o,s){var a=1/(t-i),l=1/(r-n),c=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*a,e[13]=(n+r)*l,e[14]=(s+o)*c,e[15]=1,e}function u(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e[9]=t[9]-i[9],e[10]=t[10]-i[10],e[11]=t[11]-i[11],e[12]=t[12]-i[12],e[13]=t[13]-i[13],e[14]=t[14]-i[14],e[15]=t[15]-i[15],e}return m.perspective=l,m.ortho=c,m.mul=n,m.sub=u,m}var _,y={},v={};function x(){if(_)return v;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}_=1,Object.defineProperty(v,"__esModule",{value:!0}),v.create=r,v.clone=function(e){var i=new t.ARRAY_TYPE(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i},v.length=n,v.fromValues=function(e,i,r){var n=new t.ARRAY_TYPE(3);return n[0]=e,n[1]=i,n[2]=r,n},v.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},v.set=function(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e},v.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e},v.subtract=s,v.multiply=a,v.divide=l,v.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},v.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},v.min=function(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e},v.max=function(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e},v.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},v.scale=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e},v.scaleAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e},v.distance=c,v.squaredDistance=u,v.squaredLength=h,v.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},v.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},v.normalize=function(e,t){var i=t[0],r=t[1],n=t[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e},v.dot=d,v.cross=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[0],a=i[1],l=i[2];return e[0]=n*l-o*a,e[1]=o*s-r*l,e[2]=r*a-n*s,e},v.lerp=function(e,t,i,r){var n=t[0],o=t[1],s=t[2];return e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e[2]=s+r*(i[2]-s),e},v.hermite=function(e,t,i,r,n,o){var s=o*o,a=s*(2*o-3)+1,l=s*(o-2)+o,c=s*(o-1),u=s*(3-2*o);return e[0]=t[0]*a+i[0]*l+r[0]*c+n[0]*u,e[1]=t[1]*a+i[1]*l+r[1]*c+n[1]*u,e[2]=t[2]*a+i[2]*l+r[2]*c+n[2]*u,e},v.bezier=function(e,t,i,r,n,o){var s=1-o,a=s*s,l=o*o,c=a*s,u=3*o*a,h=3*l*s,d=l*o;return e[0]=t[0]*c+i[0]*u+r[0]*h+n[0]*d,e[1]=t[1]*c+i[1]*u+r[1]*h+n[1]*d,e[2]=t[2]*c+i[2]*u+r[2]*h+n[2]*d,e},v.random=function(e,i){i=i||1;var r=2*t.RANDOM()*Math.PI,n=2*t.RANDOM()-1,o=Math.sqrt(1-n*n)*i;return e[0]=Math.cos(r)*o,e[1]=Math.sin(r)*o,e[2]=n*i,e},v.transformMat4=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[3]*r+i[7]*n+i[11]*o+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/(s=s||1),e[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/s,e[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/s,e},v.transformMat3=function(e,t,i){var r=t[0],n=t[1],o=t[2];return e[0]=r*i[0]+n*i[3]+o*i[6],e[1]=r*i[1]+n*i[4]+o*i[7],e[2]=r*i[2]+n*i[5]+o*i[8],e},v.transformQuat=function(e,t,i){var r=i[0],n=i[1],o=i[2],s=t[0],a=t[1],l=t[2],c=n*l-o*a,u=o*s-r*l,h=r*a-n*s,d=n*h-o*u,p=o*c-r*h,f=r*u-n*c,A=2*i[3];return u*=A,h*=A,p*=2,f*=2,e[0]=s+(c*=A)+(d*=2),e[1]=a+u+p,e[2]=l+h+f,e},v.rotateX=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[0],o[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),o[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},v.rotateY=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),o[1]=n[1],o[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},v.rotateZ=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),o[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),o[2]=n[2],e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},v.angle=function(e,t){var i=e[0],r=e[1],n=e[2],o=t[0],s=t[1],a=t[2],l=Math.sqrt(i*i+r*r+n*n)*Math.sqrt(o*o+s*s+a*a),c=l&&d(e,t)/l;return Math.acos(Math.min(Math.max(c,-1),1))},v.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e},v.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},v.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},v.equals=function(e,i){var r=e[0],n=e[1],o=e[2],s=i[0],a=i[1],l=i[2];return Math.abs(r-s)<=t.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-a)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(o-l)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(l))},v.forEach=v.sqrLen=v.len=v.sqrDist=v.dist=v.div=v.mul=v.sub=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var r=i(void 0);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}(o());function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function r(){var e=new t.ARRAY_TYPE(3);return t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function n(e){return Math.hypot(e[0],e[1],e[2])}function s(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function a(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function l(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e}function c(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])}function u(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}function h(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r}function d(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}v.sub=s,v.mul=a,v.div=l,v.dist=c,v.sqrDist=u,v.len=n,v.sqrLen=h;var p,f=(p=r(),function(e,t,i,r,n,o){var s,a;for(t||(t=3),i||(i=0),a=r?Math.min(r*t+i,e.length):e.length,s=i;s0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=r*s,e[2]=n*s,e[3]=o*s,e},T.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},T.cross=function(e,t,i,r){var n=i[0]*r[1]-i[1]*r[0],o=i[0]*r[2]-i[2]*r[0],s=i[0]*r[3]-i[3]*r[0],a=i[1]*r[2]-i[2]*r[1],l=i[1]*r[3]-i[3]*r[1],c=i[2]*r[3]-i[3]*r[2],u=t[0],h=t[1],d=t[2],p=t[3];return e[0]=h*c-d*l+p*a,e[1]=-u*c+d*s-p*o,e[2]=u*l-h*s+p*n,e[3]=-u*a+h*o-d*n,e},T.lerp=function(e,t,i,r){var n=t[0],o=t[1],s=t[2],a=t[3];return e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e[2]=s+r*(i[2]-s),e[3]=a+r*(i[3]-a),e},T.random=function(e,i){var r,n,o,s,a,l;i=i||1;do{a=(r=2*t.RANDOM()-1)*r+(n=2*t.RANDOM()-1)*n}while(a>=1);do{l=(o=2*t.RANDOM()-1)*o+(s=2*t.RANDOM()-1)*s}while(l>=1);var c=Math.sqrt((1-a)/l);return e[0]=i*r,e[1]=i*n,e[2]=i*o*c,e[3]=i*s*c,e},T.transformMat4=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*s,e[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*s,e[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*s,e[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*s,e},T.transformQuat=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[0],a=i[1],l=i[2],c=i[3],u=c*r+a*o-l*n,h=c*n+l*r-s*o,d=c*o+s*n-a*r,p=-s*r-a*n-l*o;return e[0]=u*c+p*-s+h*-l-d*-a,e[1]=h*c+p*-a+d*-s-u*-l,e[2]=d*c+p*-l+u*-a-h*-s,e[3]=t[3],e},T.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},T.str=function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},T.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},T.equals=function(e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=i[0],l=i[1],c=i[2],u=i[3];return Math.abs(r-a)<=t.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-l)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-c)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(s-u)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(u))},T.forEach=T.sqrLen=T.len=T.sqrDist=T.dist=T.div=T.mul=T.sub=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var r=i(void 0);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}(o());function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function r(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function n(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function s(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function a(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e[3]=t[3]/i[3],e}function l(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2],t[3]-e[3])}function c(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2],o=t[3]-e[3];return i*i+r*r+n*n+o*o}function u(e){return Math.hypot(e[0],e[1],e[2],e[3])}function h(e){var t=e[0],i=e[1],r=e[2],n=e[3];return t*t+i*i+r*r+n*n}T.sub=n,T.mul=s,T.div=a,T.dist=l,T.sqrDist=c,T.len=u,T.sqrLen=h;var d,p=(d=r(),function(e,t,i,r,n,o){var s,a;for(t||(t=4),i||(i=0),a=r?Math.min(r*t+i,e.length):e.length,s=i;st.EPSILON?(e[0]=i[0]/n,e[1]=i[1]/n,e[2]=i[2]/n):(e[0]=1,e[1]=0,e[2]=0),r},y.getAngle=function(e,t){var i=g(e,t);return Math.acos(2*i*i-1)},y.multiply=u,y.rotateX=function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l+s*a,e[1]=n*l+o*a,e[2]=o*l-n*a,e[3]=s*l-r*a,e},y.rotateY=function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l-o*a,e[1]=n*l+s*a,e[2]=o*l+r*a,e[3]=s*l-n*a,e},y.rotateZ=function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*a,e[1]=n*l-r*a,e[2]=o*l+s*a,e[3]=s*l-o*a,e},y.calculateW=function(e,t){var i=t[0],r=t[1],n=t[2];return e[0]=i,e[1]=r,e[2]=n,e[3]=Math.sqrt(Math.abs(1-i*i-r*r-n*n)),e},y.exp=h,y.ln=d,y.pow=function(e,t,i){return d(e,t),m(e,e,i),h(e,e),e},y.slerp=p,y.random=function(e){var i=t.RANDOM(),r=t.RANDOM(),n=t.RANDOM(),o=Math.sqrt(1-i),s=Math.sqrt(i);return e[0]=o*Math.sin(2*Math.PI*r),e[1]=o*Math.cos(2*Math.PI*r),e[2]=s*Math.sin(2*Math.PI*n),e[3]=s*Math.cos(2*Math.PI*n),e},y.invert=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i*i+r*r+n*n+o*o,a=s?1/s:0;return e[0]=-i*a,e[1]=-r*a,e[2]=-n*a,e[3]=o*a,e},y.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},y.fromMat3=A,y.fromEuler=function(e,t,i,r){var n=.5*Math.PI/180;t*=n,i*=n,r*=n;var o=Math.sin(t),s=Math.cos(t),a=Math.sin(i),l=Math.cos(i),c=Math.sin(r),u=Math.cos(r);return e[0]=o*l*u-s*a*c,e[1]=s*a*u+o*l*c,e[2]=s*l*c-o*a*u,e[3]=s*l*u+o*a*c,e},y.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},y.setAxes=y.sqlerp=y.rotationTo=y.equals=y.exactEquals=y.normalize=y.sqrLen=y.squaredLength=y.len=y.length=y.lerp=y.dot=y.scale=y.mul=y.add=y.set=y.copy=y.fromValues=y.clone=void 0;var t=a(o()),i=a(f()),r=a(x()),n=a(B());function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(s=function(e){return e?i:t})(e)}function a(t,i){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var r=s(i);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var l=o?Object.getOwnPropertyDescriptor(t,a):null;l&&(l.get||l.set)?Object.defineProperty(n,a,l):n[a]=t[a]}return n.default=t,r&&r.set(t,n),n}function l(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function c(e,t,i){i*=.5;var r=Math.sin(i);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function u(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=i[0],l=i[1],c=i[2],u=i[3];return e[0]=r*u+s*a+n*c-o*l,e[1]=n*u+s*l+o*a-r*c,e[2]=o*u+s*c+r*l-n*a,e[3]=s*u-r*a-n*l-o*c,e}function h(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=Math.sqrt(i*i+r*r+n*n),a=Math.exp(o),l=s>0?a*Math.sin(s)/s:0;return e[0]=i*l,e[1]=r*l,e[2]=n*l,e[3]=a*Math.cos(s),e}function d(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=Math.sqrt(i*i+r*r+n*n),a=s>0?Math.atan2(s,o)/s:0;return e[0]=i*a,e[1]=r*a,e[2]=n*a,e[3]=.5*Math.log(i*i+r*r+n*n+o*o),e}function p(e,i,r,n){var o,s,a,l,c,u=i[0],h=i[1],d=i[2],p=i[3],f=r[0],A=r[1],m=r[2],g=r[3];return(s=u*f+h*A+d*m+p*g)<0&&(s=-s,f=-f,A=-A,m=-m,g=-g),1-s>t.EPSILON?(o=Math.acos(s),a=Math.sin(o),l=Math.sin((1-n)*o)/a,c=Math.sin(n*o)/a):(l=1-n,c=n),e[0]=l*u+c*f,e[1]=l*h+c*A,e[2]=l*d+c*m,e[3]=l*p+c*g,e}function A(e,t){var i,r=t[0]+t[4]+t[8];if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,e[0]=(t[5]-t[7])*(i=.5/i),e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[3*n+n]&&(n=2);var o=(n+1)%3,s=(n+2)%3;i=Math.sqrt(t[3*n+n]-t[3*o+o]-t[3*s+s]+1),e[n]=.5*i,e[3]=(t[3*o+s]-t[3*s+o])*(i=.5/i),e[o]=(t[3*o+n]+t[3*n+o])*i,e[s]=(t[3*s+n]+t[3*n+s])*i}return e}y.clone=n.clone,y.fromValues=n.fromValues,y.copy=n.copy,y.set=n.set,y.add=n.add,y.mul=u;var m=n.scale;y.scale=m;var g=n.dot;y.dot=g,y.lerp=n.lerp;var _=n.length;y.length=_,y.len=_;var v=n.squaredLength;y.squaredLength=v,y.sqrLen=v;var b=n.normalize;y.normalize=b,y.exactEquals=n.exactEquals,y.equals=n.equals;var T,C,S,E=(T=r.create(),C=r.fromValues(1,0,0),S=r.fromValues(0,1,0),function(e,t,i){var n=r.dot(t,i);return n<-.999999?(r.cross(T,C,t),r.len(T)<1e-6&&r.cross(T,S,t),r.normalize(T,T),c(e,T,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(r.cross(T,t,i),e[0]=T[0],e[1]=T[1],e[2]=T[2],e[3]=1+n,b(e,e))});y.rotationTo=E;var M,I,P=(M=l(),I=l(),function(e,t,i,r,n,o){return p(M,t,n,o),p(I,i,r,o),p(e,M,I,2*o*(1-o)),e});y.sqlerp=P;var L,F=(L=i.create(),function(e,t,i,r){return L[0]=i[0],L[3]=i[1],L[6]=i[2],L[1]=r[0],L[4]=r[1],L[7]=r[2],L[2]=-t[0],L[5]=-t[1],L[8]=-t[2],b(e,A(e,L))});return y.setAxes=F,y}var S,E={};function M(){if(S)return E;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}S=1,Object.defineProperty(E,"__esModule",{value:!0}),E.create=function(){var e=new t.ARRAY_TYPE(8);return t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0),e[3]=1,e},E.clone=function(e){var i=new t.ARRAY_TYPE(8);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i},E.fromValues=function(e,i,r,n,o,s,a,l){var c=new t.ARRAY_TYPE(8);return c[0]=e,c[1]=i,c[2]=r,c[3]=n,c[4]=o,c[5]=s,c[6]=a,c[7]=l,c},E.fromRotationTranslationValues=function(e,i,r,n,o,s,a){var l=new t.ARRAY_TYPE(8);l[0]=e,l[1]=i,l[2]=r,l[3]=n;var c=.5*o,u=.5*s,h=.5*a;return l[4]=c*n+u*r-h*i,l[5]=u*n+h*e-c*r,l[6]=h*n+c*i-u*e,l[7]=-c*e-u*i-h*r,l},E.fromRotationTranslation=a,E.fromTranslation=function(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=.5*t[0],e[5]=.5*t[1],e[6]=.5*t[2],e[7]=0,e},E.fromRotation=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},E.fromMat4=function(e,n){var o=i.create();r.getRotation(o,n);var s=new t.ARRAY_TYPE(3);return r.getTranslation(s,n),a(e,o,s),e},E.copy=l,E.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},E.set=function(e,t,i,r,n,o,s,a,l){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e},E.getDual=function(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e},E.setDual=function(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e},E.getTranslation=function(e,t){var i=t[4],r=t[5],n=t[6],o=t[7],s=-t[0],a=-t[1],l=-t[2],c=t[3];return e[0]=2*(i*c+o*s+r*l-n*a),e[1]=2*(r*c+o*a+n*s-i*l),e[2]=2*(n*c+o*l+i*a-r*s),e},E.translate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=.5*i[0],l=.5*i[1],c=.5*i[2],u=t[4],h=t[5],d=t[6],p=t[7];return e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=s*a+n*c-o*l+u,e[5]=s*l+o*a-r*c+h,e[6]=s*c+r*l-n*a+d,e[7]=-r*a-n*l-o*c+p,e},E.rotateX=function(e,t,r){var n=-t[0],o=-t[1],s=-t[2],a=t[3],l=t[4],c=t[5],u=t[6],h=t[7],d=l*a+h*n+c*s-u*o,p=c*a+h*o+u*n-l*s,f=u*a+h*s+l*o-c*n,A=h*a-l*n-c*o-u*s;return i.rotateX(e,t,r),e[4]=d*(a=e[3])+A*(n=e[0])+p*(s=e[2])-f*(o=e[1]),e[5]=p*a+A*o+f*n-d*s,e[6]=f*a+A*s+d*o-p*n,e[7]=A*a-d*n-p*o-f*s,e},E.rotateY=function(e,t,r){var n=-t[0],o=-t[1],s=-t[2],a=t[3],l=t[4],c=t[5],u=t[6],h=t[7],d=l*a+h*n+c*s-u*o,p=c*a+h*o+u*n-l*s,f=u*a+h*s+l*o-c*n,A=h*a-l*n-c*o-u*s;return i.rotateY(e,t,r),e[4]=d*(a=e[3])+A*(n=e[0])+p*(s=e[2])-f*(o=e[1]),e[5]=p*a+A*o+f*n-d*s,e[6]=f*a+A*s+d*o-p*n,e[7]=A*a-d*n-p*o-f*s,e},E.rotateZ=function(e,t,r){var n=-t[0],o=-t[1],s=-t[2],a=t[3],l=t[4],c=t[5],u=t[6],h=t[7],d=l*a+h*n+c*s-u*o,p=c*a+h*o+u*n-l*s,f=u*a+h*s+l*o-c*n,A=h*a-l*n-c*o-u*s;return i.rotateZ(e,t,r),e[4]=d*(a=e[3])+A*(n=e[0])+p*(s=e[2])-f*(o=e[1]),e[5]=p*a+A*o+f*n-d*s,e[6]=f*a+A*s+d*o-p*n,e[7]=A*a-d*n-p*o-f*s,e},E.rotateByQuatAppend=function(e,t,i){var r=i[0],n=i[1],o=i[2],s=i[3],a=t[0],l=t[1],c=t[2],u=t[3];return e[0]=a*s+u*r+l*o-c*n,e[1]=l*s+u*n+c*r-a*o,e[2]=c*s+u*o+a*n-l*r,e[3]=u*s-a*r-l*n-c*o,e[4]=(a=t[4])*s+(u=t[7])*r+(l=t[5])*o-(c=t[6])*n,e[5]=l*s+u*n+c*r-a*o,e[6]=c*s+u*o+a*n-l*r,e[7]=u*s-a*r-l*n-c*o,e},E.rotateByQuatPrepend=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=i[0],l=i[1],c=i[2],u=i[3];return e[0]=r*u+s*a+n*c-o*l,e[1]=n*u+s*l+o*a-r*c,e[2]=o*u+s*c+r*l-n*a,e[3]=s*u-r*a-n*l-o*c,e[4]=r*(u=i[7])+s*(a=i[4])+n*(c=i[6])-o*(l=i[5]),e[5]=n*u+s*l+o*a-r*c,e[6]=o*u+s*c+r*l-n*a,e[7]=s*u-r*a-n*l-o*c,e},E.rotateAroundAxis=function(e,i,r,n){if(Math.abs(n)0){i=Math.sqrt(i);var r=t[0]/i,n=t[1]/i,o=t[2]/i,s=t[3]/i,a=t[4],l=t[5],c=t[6],u=t[7],h=r*a+n*l+o*c+s*u;e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=(a-r*h)/i,e[5]=(l-n*h)/i,e[6]=(c-o*h)/i,e[7]=(u-s*h)/i}return e},E.str=function(e){return"quat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+")"},E.exactEquals=function(e,t){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.equals=function(e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=i[0],d=i[1],p=i[2],f=i[3],A=i[4],m=i[5],g=i[6],_=i[7];return Math.abs(r-h)<=t.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(n-d)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(o-p)<=t.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-f)<=t.EPSILON*Math.max(1,Math.abs(s),Math.abs(f))&&Math.abs(a-A)<=t.EPSILON*Math.max(1,Math.abs(a),Math.abs(A))&&Math.abs(l-m)<=t.EPSILON*Math.max(1,Math.abs(l),Math.abs(m))&&Math.abs(c-g)<=t.EPSILON*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(u-_)<=t.EPSILON*Math.max(1,Math.abs(u),Math.abs(_))},E.sqrLen=E.squaredLength=E.len=E.length=E.dot=E.mul=E.setReal=E.getReal=void 0;var t=s(o()),i=s(C()),r=s(g());function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(n=function(e){return e?i:t})(e)}function s(t,i){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var r=n(i);if(r&&r.has(t))return r.get(t);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if("default"!==a&&Object.prototype.hasOwnProperty.call(t,a)){var l=s?Object.getOwnPropertyDescriptor(t,a):null;l&&(l.get||l.set)?Object.defineProperty(o,a,l):o[a]=t[a]}return o.default=t,r&&r.set(t,o),o}function a(e,t,i){var r=.5*i[0],n=.5*i[1],o=.5*i[2],s=t[0],a=t[1],l=t[2],c=t[3];return e[0]=s,e[1]=a,e[2]=l,e[3]=c,e[4]=r*c+n*l-o*a,e[5]=n*c+o*s-r*l,e[6]=o*c+r*a-n*s,e[7]=-r*s-n*a-o*l,e}function l(e,t){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}function c(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=i[4],l=i[5],c=i[6],u=i[7],h=t[4],d=t[5],p=t[6],f=t[7],A=i[0],m=i[1],g=i[2],_=i[3];return e[0]=r*_+s*A+n*g-o*m,e[1]=n*_+s*m+o*A-r*g,e[2]=o*_+s*g+r*m-n*A,e[3]=s*_-r*A-n*m-o*g,e[4]=r*u+s*a+n*c-o*l+h*_+f*A+d*g-p*m,e[5]=n*u+s*l+o*a-r*c+d*_+f*m+p*A-h*g,e[6]=o*u+s*c+r*l-n*a+p*_+f*g+h*m-d*A,e[7]=s*u-r*a-n*l-o*c+f*_-h*A-d*m-p*g,e}E.getReal=i.copy,E.setReal=i.copy,E.mul=c;var u=i.dot;E.dot=u;var h=i.length;E.length=h,E.len=h;var d=i.squaredLength;return E.squaredLength=d,E.sqrLen=d,E}var I,P,L={};function F(){if(I)return L;function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}I=1,Object.defineProperty(L,"__esModule",{value:!0}),L.create=r,L.clone=function(e){var i=new t.ARRAY_TYPE(2);return i[0]=e[0],i[1]=e[1],i},L.fromValues=function(e,i){var r=new t.ARRAY_TYPE(2);return r[0]=e,r[1]=i,r},L.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e},L.set=function(e,t,i){return e[0]=t,e[1]=i,e},L.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e},L.subtract=n,L.multiply=s,L.divide=a,L.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},L.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},L.min=function(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e},L.max=function(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e},L.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e},L.scale=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},L.scaleAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e},L.distance=l,L.squaredDistance=c,L.length=u,L.squaredLength=h,L.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e},L.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},L.normalize=function(e,t){var i=t[0],r=t[1],n=i*i+r*r;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e},L.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},L.cross=function(e,t,i){var r=t[0]*i[1]-t[1]*i[0];return e[0]=e[1]=0,e[2]=r,e},L.lerp=function(e,t,i,r){var n=t[0],o=t[1];return e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e},L.random=function(e,i){i=i||1;var r=2*t.RANDOM()*Math.PI;return e[0]=Math.cos(r)*i,e[1]=Math.sin(r)*i,e},L.transformMat2=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n,e[1]=i[1]*r+i[3]*n,e},L.transformMat2d=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n+i[4],e[1]=i[1]*r+i[3]*n+i[5],e},L.transformMat3=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[3]*n+i[6],e[1]=i[1]*r+i[4]*n+i[7],e},L.transformMat4=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e},L.rotate=function(e,t,i,r){var n=t[0]-i[0],o=t[1]-i[1],s=Math.sin(r),a=Math.cos(r);return e[0]=n*a-o*s+i[0],e[1]=n*s+o*a+i[1],e},L.angle=function(e,t){var i=e[0],r=e[1],n=t[0],o=t[1],s=Math.sqrt(i*i+r*r)*Math.sqrt(n*n+o*o);return Math.acos(Math.min(Math.max(s&&(i*n+r*o)/s,-1),1))},L.zero=function(e){return e[0]=0,e[1]=0,e},L.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},L.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]},L.equals=function(e,i){var r=e[0],n=e[1],o=i[0],s=i[1];return Math.abs(r-o)<=t.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=t.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))},L.forEach=L.sqrLen=L.sqrDist=L.dist=L.div=L.mul=L.sub=L.len=void 0;var t=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var r=i(void 0);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=o?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}(o());function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function r(){var e=new t.ARRAY_TYPE(2);return t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0),e}function n(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function s(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e}function a(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e}function l(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}function c(e,t){var i=t[0]-e[0],r=t[1]-e[1];return i*i+r*r}function u(e){return Math.hypot(e[0],e[1])}function h(e){var t=e[0],i=e[1];return t*t+i*i}L.len=u,L.sub=n,L.mul=s,L.div=a,L.dist=l,L.sqrDist=c,L.sqrLen=h;var d,p=(d=r(),function(e,t,i,r,n,o){var s,a;for(t||(t=2),i||(i=0),a=r?Math.min(r*t+i,e.length):e.length,s=i;s1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},z}(),Q=t(N);function j(){if(O)return D;function e(e,t){this.x=e,this.y=t}return O=1,D=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},D}var V=t(j());function H(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function X(e,t,i,r){const n=new Q(e,t,i,r);return function(e){return n.solve(e)}}const Y=X(.25,.1,.25,1);function J(e,t,i){return Math.min(i,Math.max(t,e))}function ee(e,t,i){return(i=J((i-e)/(t-e),0,1))*i*(3-2*i)}function te(e,t,i){const r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function ie(e,t,i){if(!e.length)return i(null,[]);let r=e.length;const n=new Array(e.length);let o=null;e.forEach(((e,s)=>{t(e,((e,t)=>{e&&(o=e),n[s]=t,0==--r&&i(o,n)}))}))}function re(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let ne=1;function oe(){return ne++}function se(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function ae(e,t){e.forEach((e=>{t[e]&&(t[e]=t[e].bind(t))}))}function le(e,t,i){const r={};for(const i in e)r[i]=t.call(this,e[i],i,e);return r}function ce(e,t,i){const r={};for(const i in e)t.call(this,e[i],i,e)&&(r[i]=e[i]);return r}function ue(e){return Array.isArray(e)?e.map(ue):"object"==typeof e&&e?le(e,ue):e}const he={};function de(e){he[e]||("undefined"!=typeof console&&console.warn(e),he[e]=!0)}function pe(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function fe(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,i,r,n)=>{const o=r||n;return t[i]=!o||o.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let _e=null;function ye(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}function ve(e,t,i,r){for(;t>1;e[n]>1;e[n]<=r?t=n+1:i=n}return t}function be(e){return e>0?1/(1.001-e):1+e}function we(e){return e>0?1-1/(1.001-e):-e}const Te={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Te.API_URL)return null;try{const e=new URL(Te.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Be(e){return Te.API_URL_REGEX.test(e)}function Ce(e){return Te.API_SPRITE_REGEX.test(e)}let Se,Ee,Me,Ie,Pe,Le;function Fe(){return null==Se&&(Se=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),Se}const ke={now:()=>void 0!==Ie?Ie:performance.now(),setNow(e){Ie=e},restoreNow(){Ie=void 0},frame(e){const t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:i,height:r}=e;Pe||(Pe=document.createElement("canvas"));const n=Pe.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return(i>Pe.width||r>Pe.height)&&(Pe.width=i,Pe.height=r),n.clearRect(-t,-t,i+2*t,r+2*t),n.drawImage(e,0,0,i,r),n.getImageData(-t,-t,i+2*t,r+2*t)},resolveURL:e=>(Ee||(Ee=document.createElement("a")),Ee.href=e,Ee.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==Me&&(Me=window.matchMedia("(prefers-reduced-motion: reduce)")),Me.matches)},hasCanvasFingerprintNoise(){if(void 0!==Le)return Le;if(!Fe())return Le=!1,!1;const e=new OffscreenCanvas(85,1),t=e.getContext("2d",{willReadFrequently:!0});let i=0;for(let r=0;r0?`?${o}`:""}`}const De="mapbox-tiles";let Oe=500,Ue=50;const Ne=["language","worldview","jobid"];let Qe,je;function Ve(){try{return caches}catch(e){}}function He(){const e=Ve();e&&null==Qe&&(Qe=e.open(De))}let Ge=1/0;const $e={supported:!1,testSupport:function(e){!Ke&&qe&&(We?Ye(e):Ze=e)}};let Ze,qe,Ke=!1,We=!1;const Xe="undefined"!=typeof self?self:{};function Ye(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,qe),e.isContextLost())return;$e.supported=!0}catch(e){}e.deleteTexture(t),Ke=!0}Xe.document&&(qe=Xe.document.createElement("img"),qe.onload=function(){Ze&&Ye(Ze),Ze=null,We=!0},qe.onerror=function(){Ke=!0,Ze=null},qe.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Je={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(Je);class et extends Error{constructor(e,t,i){401===t&&Be(i)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=i}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const tt=me()?()=>self.worker&&self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,it=function(e,t){if(!(/^file:/.test(i=e.url)||/^file:/.test(tt())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(e,t){const i=new AbortController,r=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:tt(),referrerPolicy:e.referrerPolicy,signal:i.signal});let n=!1,o=!1;const s=(a=r.url).indexOf("sku=")>0&&Be(a);var a;"json"===e.type&&r.headers.set("Accept","application/json");const l=(i,n,a)=>{if(o)return;if(i&&"SecurityError"!==i.message&&de(i.toString()),n&&a)return c(n);const l=Date.now();fetch(r).then((i=>{if(i.ok){const e=s?i.clone():null;return c(i,e,l)}return t(new et(i.statusText,i.status,e.url))})).catch((i=>{"AbortError"!==i.name&&t(new Error(`${i.message} ${e.url}`))}))},c=(i,s,a)=>{("arrayBuffer"===e.type?i.arrayBuffer():"json"===e.type?i.json():i.text()).then((e=>{o||(s&&a&&function(e,t,i){if(He(),null==Qe)return;const r=ge(t.headers.get("Cache-Control")||"");if(r["no-store"])return;const n={status:t.status,statusText:t.statusText,headers:new Headers};t.headers.forEach(((e,t)=>n.headers.set(t,e))),r["max-age"]&&n.headers.set("Expires",new Date(i+1e3*r["max-age"]).toUTCString());const o=n.headers.get("Expires");if(!o)return;if(new Date(o).getTime()-i<42e4)return;let s=Re(e.url,{persistentParams:Ne});if(206===t.status){const t=e.headers.get("Range");if(!t)return;n.status=200,s=ze(s,{range:t})}!function(e,t){if(void 0===je)try{new Response(new ReadableStream),je=!0}catch(e){je=!1}je?t(e.body):e.blob().then(t)}(t,(e=>{const i=new Response(200!==(r=t.status)&&404!==r&&[101,103,204,205,304].includes(r)?null:e,n);var r;He(),null!=Qe&&Qe.then((e=>e.put(s,i))).catch((e=>de(e.message)))}))}(r,s,a),n=!0,t(null,e,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((e=>{o||t(new Error(e.message))}))};return s?function(e,t){if(He(),null==Qe)return t(null);Qe.then((i=>{let r=Re(e.url,{persistentParams:Ne});const n=e.headers.get("Range");n&&(r=ze(r,{range:n})),i.match(r).then((e=>{const n=function(e){if(!e)return!1;const t=new Date(e.headers.get("Expires")||0),i=ge(e.headers.get("Cache-Control")||"");return t>Date.now()&&!i["no-cache"]}(e);i.delete(r),n&&i.put(r,e.clone()),t(null,e,n)})).catch(t)})).catch(t)}(r,l):l(null,null),{cancel:()=>{o=!0,n||i.abort()}}}(e,t);if(me()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var i;return function(e,t){const i=new XMLHttpRequest;i.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(i.responseType="arraybuffer");for(const t in e.headers)i.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===e.credentials,i.onerror=()=>{t(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let r=i.response;if("json"===e.type)try{r=JSON.parse(i.response)}catch(e){return t(e)}t(null,r,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else t(new et(i.statusText,i.status,e.url))},i.send(e.body),{cancel:()=>i.abort()}}(e,t)},rt=function(e,t){return it(re(e,{type:"arrayBuffer"}),t)};function nt(e){const t=document.createElement("a");return t.href=e,t.protocol===location.protocol&&t.host===location.host}const ot="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let st,at;st=[],at=0;const lt=function(e,t){if($e.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),at>=Te.MAX_PARALLEL_IMAGE_REQUESTS){const i={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return st.push(i),i}at++;let i=!1;const r=()=>{if(!i)for(i=!0,at--;st.length&&at{r(),e?t(e):i&&(self.createImageBitmap?function(e,t){const i=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(i).then((e=>{t(null,e)})).catch((e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(i,((e,i)=>t(e,i,n,o))):function(e,t){const i=new Image;i.onload=()=>{t(null,i),URL.revokeObjectURL(i.src),i.onload=null,requestAnimationFrame((()=>{i.src=ot}))},i.onerror=()=>t(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 r=new Blob([new Uint8Array(e)],{type:"image/png"});i.src=e.byteLength?URL.createObjectURL(r):ot}(i,((e,i)=>t(e,i,n,o))))}));return{cancel:()=>{n.cancel(),r()}}};var ct,ut,ht,dt={exports:{}},pt={exports:{}},ft={exports:{}},At=function(){if(ht)return dt.exports;ht=1;var e=(ct||(ct=1,pt.exports=function(e,t){var i,r,n,o,s,a,l,c;for(r=e.length-(i=3&e.length),n=t,s=3432918353,a=461845907,c=0;c>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),pt.exports),t=(ut||(ut=1,ft.exports=function(e,t){for(var i,r=e.length,n=t^r,o=0;r>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),ft.exports);return dt.exports=e,dt.exports.murmur3=e,dt.exports.murmur2=t,dt.exports}(),mt=t(At);class gt{constructor(e,...t){re(this,t[0]||{}),this.type=e}}class _t extends gt{constructor(e,t={}){super("error",re({error:e},t))}}function yt(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function vt(e,t,i){if(i&&i[e]){const r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class xt{on(e,t){return this._listeners=this._listeners||{},yt(e,t,this._listeners),this}off(e,t){return vt(e,t,this._listeners),vt(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},yt(e,t,this._oneTimeListeners),this):new Promise((t=>{this.once(e,t)}))}fire(e,t){const i="string"==typeof e?new gt(e,t):e,r=i.type;if(this.listens(r)){i.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const t of e)t.call(this,i);const t=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of t)vt(r,e,this._oneTimeListeners),e.call(this,i);const n=this._eventedParent;n&&(re(i,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(i))}else i instanceof _t&&console.error(i.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}class bt{constructor(e){"string"==typeof e?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new bt(e)}static toString(e){return e.iconsetId?`${e.name}${e.iconsetId}`:e.name}static parse(e){const[t,i]=e.split("");return new bt({name:t,iconsetId:i})}static isEqual(e,t){return e.name===t.name&&e.iconsetId===t.iconsetId}toString(){return bt.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var wt,Tt={},Bt=function(){if(wt)return Tt;wt=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function i(e){return t("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function r(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function n(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{Tt.parseCSSColor=function(o){var s,a=o.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(s=parseInt(a.substr(1),16))>=0&&s<=4095?[(3840&s)>>4|(3840&s)>>8,240&s|(240&s)>>4,15&s|(15&s)<<4,1]:null:7===a.length&&(s=parseInt(a.substr(1),16))>=0&&s<=16777215?[(16711680&s)>>16,(65280&s)>>8,255&s,1]:null;var l=a.indexOf("("),c=a.indexOf(")");if(-1!==l&&c+1===a.length){var u=a.substr(0,l),h=a.substr(l+1,c-(l+1)).split(","),d=1;switch(u){case"rgba":if(4!==h.length)return null;d=r(h.pop());case"rgb":return 3!==h.length?null:[i(h[0]),i(h[1]),i(h[2]),d];case"hsla":if(4!==h.length)return null;d=r(h.pop());case"hsl":if(3!==h.length)return null;var p=(parseFloat(h[0])%360+360)%360/360,f=r(h[1]),A=r(h[2]),m=A<=.5?A*(f+1):A+f-A*f,g=2*A-m;return[t(255*n(g,m,p+1/3)),t(255*n(g,m,p)),t(255*n(g,m,p-1/3)),d];default:return null}}return null}}catch(e){}return Tt}();class Ct{constructor(e,t,i,r=1){this.r=e,this.g=t,this.b=i,this.a=r}static parse(e){if(!e)return;if(e instanceof Ct)return e;if("string"!=typeof e)return;const t=Bt.parseCSSColor(e);return t?new Ct(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]):void 0}toStringPremultipliedAlpha(){const[e,t,i,r]=0===this.a?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(i)},${r})`}toString(){const[e,t,i,r]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*t)},${Math.round(255*i)},${r})`}toRenderColor(e){const{r:t,g:i,b:r,a:n}=this;return new St(e,t,i,r,n)}clone(){return new Ct(this.r,this.g,this.b,this.a)}}class St{constructor(e,t,i,r,n){if(e){const o=e.image.height,s=o*o;t=0===n?0:t/n*(o-1),i=0===n?0:i/n*(o-1),r=0===n?0:r/n*(o-1);const a=Math.floor(t),l=Math.floor(i),c=Math.floor(r),u=Math.ceil(t),h=Math.ceil(i),d=Math.ceil(r),p=t-a,f=i-l,A=r-c,m=e.image.data,g=4*(a+l*s+c*o),_=4*(a+l*s+d*o),y=4*(a+h*s+c*o),v=4*(a+h*s+d*o),x=4*(u+l*s+c*o),b=4*(u+l*s+d*o),w=4*(u+h*s+c*o),T=4*(u+h*s+d*o);if(g<0||T>=m.length)throw new Error("out of range");this.r=Et(Et(Et(m[g],m[_],A),Et(m[y],m[v],A),f),Et(Et(m[x],m[b],A),Et(m[w],m[T],A),f),p)/255*n,this.g=Et(Et(Et(m[g+1],m[_+1],A),Et(m[y+1],m[v+1],A),f),Et(Et(m[x+1],m[b+1],A),Et(m[w+1],m[T+1],A),f),p)/255*n,this.b=Et(Et(Et(m[g+2],m[_+2],A),Et(m[y+2],m[v+2],A),f),Et(Et(m[x+2],m[b+2],A),Et(m[w+2],m[T+2],A),f),p)/255*n,this.a=n}else this.r=t,this.g=i,this.b=r,this.a=n}toArray(){const{r:e,g:t,b:i,a:r}=this;return 0===r?[0,0,0,0]:[255*e/r,255*t/r,255*i/r,r]}toHslaArray(){if(0===this.a)return[0,0,0,0];const{r:e,g:t,b:i,a:r}=this,n=Math.min(Math.max(e/r,0),1),o=Math.min(Math.max(t/r,0),1),s=Math.min(Math.max(i/r,0),1),a=Math.min(n,o,s),l=Math.max(n,o,s),c=(a+l)/2;if(a===l)return[0,0,100*c,r];const u=l-a,h=c>.5?u/(2-l-a):u/(l+a);let d=0;return l===n?d=(o-s)/u+(oEt(e,t[r],i)))}function It(e){return e*e*e*e*e}Ct.black=new Ct(0,0,0,1),Ct.white=new Ct(1,1,1,1),Ct.transparent=new Ct(0,0,0,0),Ct.red=new Ct(1,0,0,1),Ct.blue=new Ct(0,0,1,1);var Pt=Object.freeze({__proto__:null,array:Mt,color:function(e,t,i){return new Ct(Et(e.r,t.r,i),Et(e.g,t.g,i),Et(e.b,t.b,i),Et(e.a,t.a,i))},easeIn:It,number:Et});function Lt(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}class Ft extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class kt{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new kt(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const zt={kind:"null"},Rt={kind:"number"},Dt={kind:"string"},Ot={kind:"boolean"},Ut={kind:"color"},Nt={kind:"object"},Qt={kind:"value"},jt={kind:"collator"},Vt={kind:"formatted"},Ht={kind:"resolvedImage"};function Gt(e,t){return{kind:"array",itemType:e,N:t}}function $t(e){if("array"===e.kind){const t=$t(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Zt=[zt,Rt,Dt,Ot,Ut,Vt,Nt,Gt(Qt),Ht];function qt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!qt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Zt)if(!qt(e,t))return null}return`Expected ${$t(e)} but found ${$t(t)} instead.`}function Kt(e,t){return t.some((t=>t.kind===e.kind))}function Wt(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}class Xt{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Yt{constructor(e,t,i,r,n){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n}}class Jt{constructor(e){this.sections=e}static fromString(e){return new Jt([new Yt(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||!!e.image&&e.image.hasPrimary()))}static factory(e){return e instanceof Jt?e:Jt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){const i=t.image.getPrimary().id.toString();e.push(["image",i]);continue}e.push(t.text);const i={};t.fontStack&&(i["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(i["font-scale"]=t.scale),t.textColor&&(i["text-color"]=["rgba"].concat(t.textColor.toRenderColor(null).toArray())),e.push(i)}return e}}class ei{constructor(e,t={}){if(this.id=bt.from(e),this.options=Object.assign({},t),t.transform){const{a:e,b:i,c:r,d:n,e:o,f:s}=t.transform;this.options.transform=new DOMMatrix([e,i,r,n,o,s])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:e,b:t,c:i,d:r,e:n,f:o}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:t,c:i,d:r,e:n,f:o}})}static parse(e){let t,i,r,n;try{({name:t,iconsetId:i,params:r,transform:n}=JSON.parse(e)||{})}catch(e){return null}if(!t)return null;const{a:o,b:s,c:a,d:l,e:c,f:u}=n||{};return new ei({name:t,iconsetId:i},{params:r,transform:new DOMMatrix([o,s,a,l,c,u])})}scaleSelf(e){return this.options.transform.scaleSelf(e),this}}class ti{constructor(e,t,i,r,n=!1){this.primaryId=bt.from(e),this.primaryOptions=t,i&&(this.secondaryId=bt.from(i)),this.secondaryOptions=r,this.available=n}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new ei(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new ei(this.secondaryId,this.secondaryOptions):null}static from(e){return"string"==typeof e?ti.build({name:e}):e}static build(e,t,i,r){return!e||"object"==typeof e&&!("name"in e)?null:new ti(e,i,t,r)}}function ii(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ri(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Ct)return!0;if(e instanceof Xt)return!0;if(e instanceof Jt)return!0;if(e instanceof ti)return!0;if(Array.isArray(e)){for(const t of e)if(!ri(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!ri(e[t]))return!1;return!0}return!1}function ni(e){if(null===e)return zt;if("string"==typeof e)return Dt;if("boolean"==typeof e)return Ot;if("number"==typeof e)return Rt;if(e instanceof Ct)return Ut;if(e instanceof Xt)return jt;if(e instanceof Jt)return Vt;if(e instanceof ti)return Ht;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=ni(t);if(i){if(i===e)continue;i=Qt;break}i=e}return Gt(i||Qt,t)}return Nt}function oi(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Ct?e.toStringPremultipliedAlpha():e instanceof Jt||e instanceof ti?e.toString():JSON.stringify(e)}class si{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ri(e[1]))return t.error("invalid value");const i=e[1];let r=ni(i);const n=t.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new si(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Ct?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof Jt?this.value.serialize():this.value}}class ai{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const li={string:Dt,number:Rt,boolean:Ot,object:Nt};class ci{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in li)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=li[i],r++}else n=Qt;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],r++}i=Gt(n,o)}else i=li[n];const o=[];for(;re.outputDefined()))}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);const r=e.N;("number"==typeof r||this.args.length>1)&&t.push(r)}}return t.concat(this.args.map((e=>e.serialize())))}}class ui{constructor(e){this.type=Vt,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parseObjectValue(o["font-scale"],i,"font-scale",Rt),!e))return null;let s=null;if(o["text-font"]&&(s=t.parseObjectValue(o["text-font"],i,"text-font",Gt(Dt)),!s))return null;let a=null;if(o["text-color"]&&(a=t.parseObjectValue(o["text-color"],i,"text-color",Ut),!a))return null;const l=r[r.length-1];l.scale=e,l.font=s,l.textColor=a}else{const o=t.parse(e[i],i,Qt);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null})}}return new ui(r)}evaluate(e){return new Jt(this.sections.map((t=>{const i=t.content.evaluate(e);return ni(i)===Ht?new Yt("",i,null,null,null):new Yt(oi(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const i={};t.scale&&(i["font-scale"]=t.scale.serialize()),t.font&&(i["text-font"]=t.font.serialize()),t.textColor&&(i["text-color"]=t.textColor.serialize()),e.push(i)}return e}}class hi{constructor(e,t,i,r){this._imageWarnHistory={},this.type=Ht,this.namePrimary=e,this.nameSecondary=t,i&&(this.paramsPrimary=i.params,this.iconsetIdPrimary=i.iconset?i.iconset.id:void 0),r&&(this.paramsSecondary=r.params,this.iconsetIdSecondary=r.iconset?r.iconset.id:void 0)}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");let i=1;const r=[];function n(){if(ibt.isEqual(e,t))),r.available){const t=r.getSecondary()?r.getSecondary().id:null;t&&(r.available=e.availableImages.some((e=>bt.isEqual(e,t))))}}return r}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const t in this.paramsPrimary)this.paramsPrimary[t]&&e(this.paramsPrimary[t]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const t in this.paramsSecondary)this.paramsSecondary[t]&&e(this.paramsSecondary[t])}outputDefined(){return!1}serializeOptions(e,t){const i={};if(t&&(i.iconset={id:t}),e){i.params={};for(const t in e)e[t]&&(i.params[t]=e[t].serialize())}return Object.keys(i).length>0?i:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const t=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);t&&e.push(t)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const t=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);t&&e.push(t)}return e}}function di(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}const pi={"to-boolean":Ot,"to-color":Ut,"to-number":Rt,"to-string":Dt};class fi{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0],r=[];let n=zt;if("to-array"===i){if(!Array.isArray(e[1]))return null;const i=e[1].length;if(t.expectedType){if("array"!==t.expectedType.kind)return t.error(`Expected ${t.expectedType.kind} but found array.`);n=Gt(t.expectedType.itemType,i)}else{if(!(i>0&&ri(e[1][0])))return null;n=Gt(ni(e[1][0]),i)}for(let o=0;o4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:ii(t[0],t[1],t[2],t[3]),!i))return new Ct(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new ai(i||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new ai(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?Jt.fromString(oi(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?ti.build(oi(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map((t=>t.evaluate(e))):oi(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new ui([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new hi(this.args[0]).serialize();const e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild((t=>{e.push(t.serialize())})),e}}const Ai=["Unknown","Point","LineString","Polygon"];class mi{constructor(e,t){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ai[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||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:i,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*t-e[0])+this.featureDistanceData.bearing[1]*(r*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=Ct.parse(e)),t}getConfig(e){return this.options?this.options.get(e):null}}class gi{constructor(e,t,i,r,n){this.name=e,this.type=t,this._evaluate=i,this.args=r,this._overloadIndex=n}evaluate(e){if(!this._evaluate){const e=gi.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((e=>e.serialize())))}static parse(e,t){const i=e[0],r=gi.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=[];let a=null,l=-1;for(const[r,c]of o){if(Array.isArray(r)&&r.length!==e.length-1)continue;s.push(r),l++,a=new Dr(t.registry,t.path,null,t.scope,void 0,t._scope,t.options);const o=[];let u=!1;for(let t=1;te))).map(_i).join(" | "),r=[];for(let i=1;ii;){if(r-i>600){const o=r-i+1,s=t-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);vi(e,t,Math.max(i,Math.floor(t-s*l/o+c)),Math.min(r,Math.floor(t+(o-s)*l/o+c)),n)}const o=e[t];let s=i,a=r;for(xi(e,i,t),n(e[r],o)>0&&xi(e,i,r);s0;)a--}0===n(e[i],o)?xi(e,i,a):(a++,xi(e,a,r)),a<=t&&(i=a+1),t<=a&&(r=a-1)}}function xi(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function bi(e,t){return et?1:0}function wi(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Ci(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],s=e[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function Si(e,t,i=!1){let r=!1;for(let a=0,l=t.length;a(n=e)[1]!=(s=u)[1]>n[1]&&n[0]<(s[0]-o[0])*(n[1]-o[1])/(s[1]-o[1])+o[0]&&(r=!r)}}var n,o,s;return r}function Ei(e,t,i,r){const n=r[0]-i[0],o=r[1]-i[1],s=(e[0]-i[0])*o-n*(e[1]-i[1]),a=(t[0]-i[0])*o-n*(t[1]-i[1]);return s>0&&a<0||s<0&&a>0}function Mi(e,t,i,r){return 0!=(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!Ei(e,t,i,r)||!Ei(i,r,e,t));var n,o}const Ii=8192;function Pi(e,t){const i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*Ii),Math.round(r*n*Ii)]}function Li(e,t){for(let i=0;ii[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}Ti(t,e)}function Ui(e,t,i,r){const n=Math.pow(2,r.z)*Ii,o=[r.x*Ii,r.y*Ii],s=[];if(!e)return s;for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];Oi(r,t,i,n),s.push(r)}return s}function Ni(e,t,i,r){const n=Math.pow(2,r.z)*Ii,o=[r.x*Ii,r.y*Ii],s=[];if(!e)return s;for(const i of e){const e=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];Ti(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=n/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of s)for(const r of e)Oi(r,t,i,n)}var a;return s}class Qi{constructor(e,t){this.type=Ot,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ri(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;et)return qi(n,o,(t-(i-s))/s)}return e[e.length-1]}pointToSegmentDistance(e,t,i){let[r,n]=t,o=Ki(i[0]-r)*this.kx,s=(i[1]-n)*this.ky;if(0!==o||0!==s){const t=(Ki(e[0]-r)*this.kx*o+(e[1]-n)*this.ky*s)/(o*o+s*s);t>1?(r=i[0],n=i[1]):t>0&&(r+=o/this.kx*t,n+=s/this.ky*t)}return o=Ki(e[0]-r)*this.kx,s=(e[1]-n)*this.ky,Math.sqrt(o*o+s*s)}pointOnLine(e,t){let i=1/0,r=e[0][0],n=e[0][1],o=0,s=0;for(let a=0;a1?(l=e[a+1][0],c=e[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=Ki(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;pn.index||r.index===n.index&&r.t>n.t){const e=r;r=n,n=e}const o=[r.point],s=r.index+1,a=n.index;!Zi(i[s],o[0])&&s<=a&&o.push(i[s]);for(let e=s+1;e<=a;e++)o.push(i[e]);return Zi(i[a],n.point)||o.push(n.point),o}lineSliceAlong(e,t,i){let r=0;const n=[];for(let o=0;oe&&0===n.length&&n.push(qi(s,a,(e-(r-l))/l)),r>=t)return n.push(qi(s,a,(t-(r-l))/l)),n;r>e&&n.push(a)}return n}bufferPoint(e,t){const i=t/this.ky,r=t/this.kx;return[e[0]-r,e[1]-i,e[0]+r,e[1]+i]}bufferBBox(e,t){const i=t/this.ky,r=t/this.kx;return[e[0]-r,e[1]-i,e[2]+r,e[3]+i]}insideBBox(e,t){return Ki(e[0]-t[0])>=0&&Ki(e[0]-t[2])<=0&&e[1]>=t[1]&&e[1]<=t[3]}}function Zi(e,t){return e[0]===t[0]&&e[1]===t[1]}function qi(e,t,i){const r=Ki(t[0]-e[0]);return[e[0]+r*i,e[1]+(t[1]-e[1])*i]}function Ki(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class Wi{constructor(e=[],t=(e,t)=>et?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e=0)break;t[e]=t[r],e=r}t[e]=n}}var Xi=8192;function Yi(e,t){return t.dist-e.dist}const Ji=100,er=50;function tr(e){const t=[1/0,1/0,-1/0,-1/0];if(t.length!==e.length)return!1;for(let i=0;i=e[0]&&e[1]e[1])return[null,null];const i=ir(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}{if(1===i)return[e,null];const t=Math.floor(i/2)-1;return[[e[0],e[0]+t],[e[0]+t+1,e[1]]]}}function or(e,t){const i=[1/0,1/0,-1/0,-1/0];if(!rr(t,e.length))return i;for(let r=t[0];r<=t[1];++r)Ti(i,e[r]);return i}function sr(e){const t=[1/0,1/0,-1/0,-1/0];for(let i=0;it[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]=r)return r;if(Bi(n,o)){if(yr(e,t))return 0}else if(yr(t,e))return 0;let s=r;for(const r of e)for(let e=0,n=r.length,o=n-1;e=o)continue;const c=n.range1;if(ir(c)<=a){if(!rr(c,e.length))return NaN;if(t){const t=_r(e,c,i,r);if(0===(o=Math.min(o,t)))return o}else for(let t=c[0];t<=c[1];++t){const n=gr(e[t],i,r);if(0===(o=Math.min(o,n)))return o}}else{const i=nr(c,t);if(null!==i[0]){const t=ar(or(e,i[0]),l,r);t=s)continue;const u=o.range1,h=o.range2;if(ir(u)<=l&&ir(h)<=c){if(!rr(u,e.length)||!rr(h,i.length))return NaN;if(t&&r?s=Math.min(s,Ar(e,u,i,h,n)):t||r?t&&!r?s=Math.min(s,pr(i,h,e,u,n)):!t&&r&&(s=Math.min(s,pr(e,u,i,h,n))):s=Math.min(s,mr(e,u,i,h,n)),0===s)return s}else{const o=nr(u,t),l=nr(h,r);xr(a,s,n,e,i,o[0],l[0]),xr(a,s,n,e,i,o[0],l[1]),xr(a,s,n,e,i,o[1],l[0]),xr(a,s,n,e,i,o[1],l[1])}}return s}function Tr(e,t,i,r,n=1/0){let o=n;const s=or(e,[0,e.length-1]);for(const n of i)if(!(o!==1/0&&ar(s,or(n,[0,n.length-1]),r)>=o)&&(o=Math.min(o,wr(e,t,n,!0,r,o)),0===o))return o;return o}function Br(e,t,i,r,n=1/0){let o=n;const s=or(e,[0,e.length-1]);for(const n of i){if(o!==1/0&&ar(s,sr(n),r)>=o)continue;const i=br(e,t,n,r,o);if(isNaN(i))return i;if(0===(o=Math.min(o,i)))return o}return o}function Cr(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class Sr{constructor(e,t){this.type=Rt,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(ri(e[1])){const t=e[1];if("FeatureCollection"===t.type){for(let e=0;ei&&(e=i),e}class Ir{constructor(e,t,i){this.type=e,this.key=t,this.scope=i}static parse(e,t){let i=t.expectedType;if(null==i&&(i=Qt),e.length<2||e.length>3)return t.error("Invalid number of arguments for 'config' expression.");const r=t.parse(e[1],1);if(!(r instanceof si))return t.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){const n=t.parse(e[2],2);return n instanceof si?new Ir(i,oi(r.value),oi(n.value)):t.error("Scope of 'config' expression must be a string literal.")}return new Ir(i,oi(r.value))}evaluate(e){const t=[this.key,this.scope,e.scope].filter(Boolean).join(""),i=e.getConfig(t);if(!i)return null;const{type:r,value:n,values:o,minValue:s,maxValue:a,stepValue:l}=i,c=i.default.evaluate(e);let u=c;if(n){const t=e.scope;e.scope=(t||"").split("").slice(1).join(""),u=n.evaluate(e),e.scope=t}return r&&(u=Er(r,u)),void 0===u||void 0===s&&void 0===a&&void 0===l||("number"==typeof u?u=Mr(u,s,a,l):Array.isArray(u)&&(u=u.map((e=>"number"==typeof e?Mr(e,s,a,l):e)))),void 0!==n&&void 0!==u&&o&&!o.includes(u)&&(u=c,r&&(u=Er(r,u))),(r&&r!==this.type||void 0!==u&&ni(u)!==this.type)&&(u=Er(this.type.kind,u)),u}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.key),e}}function Pr(e){if(e instanceof gi){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Qi)return!1;if(e instanceof Sr)return!1;let t=!0;return e.eachChild((e=>{t&&!Pr(e)&&(t=!1)})),t}function Lr(e){if(e instanceof gi&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!Lr(e)&&(t=!1)})),t}function Fr(e){if(e instanceof Ir)return new Set([e.key]);let t=new Set;return e.eachChild((e=>{t=new Set([...t,...Fr(e)])})),t}function kr(e,t){if(e instanceof gi&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!kr(e,t)&&(i=!1)})),i}class zr{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new zr(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Rr{constructor(e,t=[],i,r=new kt,n=[],o,s){this.registry=e,this.path=t,this.key=t.map((e=>"string"==typeof e?`['${e}']`:`[${e}]`)).join(""),this.scope=r,this.errors=n,this.expectedType=i,this._scope=o,this.options=s}parse(e,t,i,r,n={}){return t||i?this.concat(t,null,i,r)._parse(e,n):this._parse(e,n)}parseObjectValue(e,t,i,r,n,o={}){return this.concat(t,i,r,n)._parse(e,o)}_parse(e,t){function i(e,t,i){return"assert"===i?new ci(t,[e]):"coerce"===i?new fi(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r="string"==typeof e[0]?this.registry[e[0]]:void 0;if(r){let n=r.parse(e,this);if(!n)return null;if(this.expectedType){const e=this.expectedType,r=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==r.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(e,r))return null}else n=i(n,e,t.typeAnnotation||"coerce");else n=i(n,e,t.typeAnnotation||"assert")}if(!(n instanceof si)&&"resolvedImage"!==n.type.kind&&Or(n)){const t=new mi(this._scope,this.options);try{n=new si(n.type,n.evaluate(t))}catch(e){return this.error(e.message),null}}return n}return fi.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i,r){let n="number"==typeof e?this.path.concat(e):this.path;n="string"==typeof t?n.concat(t):n;const o=r?this.scope.concat(r):this.scope;return new Rr(this.registry,n,i||null,o,this.errors,this._scope,this.options)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new Ft(i,e))}checkSubtype(e,t){const i=qt(e,t);return i&&this.error(i),i}}var Dr=Rr;function Or(e){if(e instanceof zr)return Or(e.boundExpression);if(e instanceof gi&&"error"===e.name)return!1;if(e instanceof yi)return!1;if(e instanceof Qi)return!1;if(e instanceof Sr)return!1;if(e instanceof Ir)return!1;const t=e instanceof fi||e instanceof ci;let i=!0;return e.eachChild((e=>{i=t?i&&Or(e):i&&e instanceof si})),!!i&&Pr(e)&&kr(e,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Ur(e,t){const i=e.length-1;let r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=e[a],n=e[a+1],r<=t){if(a===i||tt))throw new ai("Input is not a number.");s=a-1}return 0}class Nr{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,Rt);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new Nr(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[Ur(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){const e=["step",this.input.serialize()];for(let t=0;t0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}const Qr=.95047,jr=1.08883,Vr=4/29,Hr=6/29,Gr=3*Hr*Hr,$r=Hr*Hr*Hr,Zr=Math.PI/180,qr=180/Math.PI;function Kr(e){return e>$r?Math.pow(e,1/3):e/Gr+Vr}function Wr(e){return e>Hr?e*e*e:Gr*(e-Vr)}function Xr(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Yr(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Jr(e){const t=Yr(e.r),i=Yr(e.g),r=Yr(e.b),n=Kr((.4124564*t+.3575761*i+.1804375*r)/Qr),o=Kr((.2126729*t+.7151522*i+.072175*r)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-Kr((.0193339*t+.119192*i+.9503041*r)/jr)),alpha:e.a}}function en(e){let t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*Wr(t),i=Qr*Wr(i),r=jr*Wr(r),new Ct(Xr(3.2404542*i-1.5371385*t-.4985314*r),Xr(-.969266*i+1.8760108*t+.041556*r),Xr(.0556434*i-.2040259*t+1.0572252*r),e.alpha)}function tn(e,t,i){const r=t-e;return e+i*(r>180||r<-180?r-360*Math.round(r/360):r)}const rn={forward:Jr,reverse:en,interpolate:function(e,t,i){return{l:Et(e.l,t.l,i),a:Et(e.a,t.a,i),b:Et(e.b,t.b,i),alpha:Et(e.alpha,t.alpha,i)}}},nn={forward:function(e){const{l:t,a:i,b:r}=Jr(e),n=Math.atan2(r,i)*qr;return{h:n<0?n+360:n,c:Math.sqrt(i*i+r*r),l:t,alpha:e.a}},reverse:function(e){const t=e.h*Zr,i=e.c;return en({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:tn(e.h,t.h,i),c:Et(e.c,t.c,i),l:Et(e.l,t.l,i),alpha:Et(e.alpha,t.alpha,i)}}};var on=Object.freeze({__proto__:null,hcl:nn,lab:rn});class sn{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=an(t,e.base,i,r);else if("linear"===e.name)n=an(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new Q(o[0],o[1],o[2],o[3]).solve(an(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,Rt),!n)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=Ut:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(r,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new sn(a,i,r,n,s):t.error(`Type ${$t(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=Ur(t,r),s=sn.interpolationFactor(this.interpolation,r,t[o],t[o+1]),a=i[o].evaluate(e),l=i[o+1].evaluate(e);return"interpolate"===this.operator?Pt[this.type.kind.toLowerCase()](a,l,s):"interpolate-hcl"===this.operator?nn.reverse(nn.interpolate(nn.forward(a),nn.forward(l),s)):rn.reverse(rn.interpolate(rn.forward(a),rn.forward(l),s))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const t=[this.operator,e,this.input.serialize()];for(let e=0;eqt(r,e.type)));return new ln(o?Qt:i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args){if(r++,i=n.evaluate(e),i&&i instanceof ti&&!i.available&&(t||(t=i),i=null,r===this.args.length))return t;if(null!==i)break}return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=["coalesce"];return this.eachChild((t=>{e.push(t.serialize())})),e}}class cn{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let r=1;r=i.length)throw new ai(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new ai(`Array index must be an integer, but found ${t} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class hn{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Rt),r=t.parse(e[2],2,Gt(t.expectedType||Qt));return i&&r?new hn(r.type.itemType,i,r):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new ai(`Array index out of bounds: ${t} < 0.`);if(t>i.length-1)throw new ai(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t===Math.floor(t))return i[t];const r=Math.floor(t),n=Math.ceil(t),o=i[r],s=i[n];if("number"!=typeof o||"number"!=typeof s)throw new ai(`Cannot interpolate between non-number values at index ${t}.`);const a=t-r;return o*(1-a)+s*a}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class dn{constructor(e,t){this.type=Ot,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Qt),r=t.parse(e[2],2,Qt);return i&&r?Kt(i.type,[Ot,Dt,Rt,zt,Qt])?new dn(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${$t(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(null==i)return!1;if(!Wt(t,["boolean","string","number","null"]))throw new ai(`Expected first argument to be of type boolean, string, number or null, but found ${$t(ni(t))} instead.`);if(!Wt(i,["string","array"]))throw new ai(`Expected second argument to be of type array or string, but found ${$t(ni(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class pn{constructor(e,t,i){this.type=Rt,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Qt),r=t.parse(e[2],2,Qt);if(!i||!r)return null;if(!Kt(i.type,[Ot,Dt,Rt,zt,Qt]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${$t(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Rt);return n?new pn(i,r,n):null}return new pn(i,r)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Wt(t,["boolean","string","number","null"]))throw new ai(`Expected first argument to be of type boolean, string, number or null, but found ${$t(ni(t))} instead.`);if(!Wt(i,["string","array"]))throw new ai(`Expected second argument to be of type array or string, but found ${$t(ni(i))} instead.`);if(this.fromIndex){const r=this.fromIndex.evaluate(e);return i.indexOf(t,r)}return i.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class fn{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let s=2;sNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,ni(e)))return null}else i=ni(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(l,s,r);if(!u)return null;r=r||u.type,o.push(u)}const s=t.parse(e[1],1,Qt);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,r);return a?"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new fn(i,r,s,n,o,a):null}evaluate(e){const t=this.input.evaluate(e);return(ni(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),i=[],r={};for(const e of t){const t=r[this.cases[e]];void 0===t?(r[this.cases[e]]=i.length,i.push([this.cases[e],[e]])):i[t][1].push(e)}const n=e=>"number"===this.inputType.kind?Number(e):e;for(const[t,r]of i)e.push(1===r.length?n(r[0]):r.map(n)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}class An{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const r=[];for(let n=1;nt.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild((t=>{e.push(t.serialize())})),e}}class mn{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Qt),r=t.parse(e[2],2,Rt);if(!i||!r)return null;if(!Kt(i.type,[Gt(Qt),Dt,Qt]))return t.error(`Expected first argument to be of type array or string, but found ${$t(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Rt);return n?new mn(i.type,i,r,n):null}return new mn(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!Wt(t,["string","array"]))throw new ai(`Expected first argument to be of type array or string, but found ${$t(ni(t))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(e);return t.slice(i,r)}return t.slice(i)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function gn(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function _n(e,t,i,r){return 0===r.compare(t,i)}function yn(e,t,i){const r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=Ot,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,Qt);if(!o)return null;if(!gn(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${$t(o.type)}'.`);let s=t.parse(e[2],2,Qt);if(!s)return null;if(!gn(i,s.type))return t.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 t.error(`Cannot compare types '${$t(o.type)}' and '${$t(s.type)}'.`);r&&("value"===o.type.kind&&"value"!==s.type.kind?o=new ci(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new ci(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,jt),!a)return null}return new n(o,s,a)}evaluate(n){const o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=ni(o),i=ni(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new ai(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=ni(o),i=ni(s);if("string"!==e.kind||"string"!==i.kind)return t(n,o,s)}return this.collator?i(n,o,s,this.collator.evaluate(n)):t(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild((e=>{t.push(e.serialize())})),t}}}const vn=yn("==",(function(e,t,i){return t===i}),_n),xn=yn("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!_n(0,t,i,r)})),bn=yn("<",(function(e,t,i){return t",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),Tn=yn("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),Bn=yn(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0}));class Cn{constructor(e,t,i,r,n,o){this.type=Dt,this.number=e,this.locale=t,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Rt);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parseObjectValue(r.locale,2,"locale",Dt),!n))return null;let o=null;if(r.currency&&(o=t.parseObjectValue(r.currency,2,"currency",Dt),!o))return null;let s=null;if(r.unit&&(s=t.parseObjectValue(r.unit,2,"unit",Dt),!s))return null;let a=null;if(r["min-fraction-digits"]&&(a=t.parseObjectValue(r["min-fraction-digits"],2,"min-fraction-digits",Rt),!a))return null;let l=null;return r["max-fraction-digits"]&&(l=t.parseObjectValue(r["max-fraction-digits"],2,"max-fraction-digits",Rt),!l)?null:new Cn(i,n,o,s,a,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Sn{constructor(e){this.type=Rt,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${$t(i.type)} instead.`):new Sn(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new ai(`Expected value to be of type string or array, but found ${$t(ni(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild((t=>{e.push(t.serialize())})),e}}function En(e){return function(){e=1831565813+(e|=0)|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}const Mn={"==":vn,"!=":xn,">":wn,"<":bn,">=":Bn,"<=":Tn,array:ci,at:un,"at-interpolated":hn,boolean:ci,case:An,coalesce:ln,collator:yi,format:ui,image:hi,in:dn,"index-of":pn,interpolate:sn,"interpolate-hcl":sn,"interpolate-lab":sn,length:Sn,let:cn,literal:si,match:fn,number:ci,"number-format":Cn,object:ci,slice:mn,step:Nr,string:ci,"to-boolean":fi,"to-color":fi,"to-number":fi,"to-string":fi,var:zr,within:Qi,distance:Sr,config:Ir};function In(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,s=ii(t,i,r,o);if(s)throw new ai(s);return new Ct(t/255*o,i/255*o,r/255*o,o)}function Pn(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,s=function(e,t,i,r){return"number"==typeof e&&e>=0&&e<=360?"number"==typeof t&&t>=0&&t<=100&&"number"==typeof i&&i>=0&&i<=100?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid hsla value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'h' must be between 0 and 360.`}(t,i,r,o);if(s)throw new ai(s);const a=`hsla(${t}, ${i}%, ${r}%, ${o})`,l=Ct.parse(a);if(!l)throw new ai(`Failed to parse HSLA color: ${a}`);return l}function Ln(e,t){return e in t}function Fn(e,t){const i=t[e];return void 0===i?null:i}function kn(e){return{type:e}}function zn(e){return{result:"success",value:e}}function Rn(e){return{result:"error",value:e}}function Dn(e,t){return!!e&&!!e.parameters&&e.parameters.indexOf(t)>-1}function On(e){return"data-driven"===e["property-type"]}function Un(e){return Dn(e.expression,"measure-light")}function Nn(e){return Dn(e.expression,"zoom")}function Qn(e){return!!e.expression&&e.expression.interpolated}function jn(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Vn(e){return e}function Hn(e,t){const i="color"===t.type,r=e.stops&&"object"==typeof e.stops[0][0],n=r||!(r||void 0!==e.property),o=e.type||(Qn(t)?"exponential":"interval");if(i&&((e=Lt({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],Ct.parse(e[1])]))),e.default=Ct.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!on[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let s,a,l;if("exponential"===o)s=qn;else if("interval"===o)s=Zn;else if("categorical"===o){s=$n,a=Object.create(null);for(const t of e.stops)a[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=Kn}if(r){const i={},r=[];for(let t=0;te[0])),evaluate:({zoom:i},r)=>qn({stops:n,base:e.base},t,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:sn.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:i})=>s(e,t,i,a,l)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[e.property]:void 0;return void 0===n?Gn(e.default,t.default):s(e,t,n,a,l)}}}function Gn(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function $n(e,t,i,r,n){return Gn(typeof i===n?r[i]:void 0,e.default,t.default)}function Zn(e,t,i){if("number"!==di(i))return Gn(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const n=Ur(e.stops.map((e=>e[0])),i);return e.stops[n][1]}function qn(e,t,i){const r=void 0!==e.base?e.base:1;if("number"!==di(i))return Gn(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const o=Ur(e.stops.map((e=>e[0])),i),s=function(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[o][0],e.stops[o+1][0]),a=e.stops[o][1],l=e.stops[o+1][1];let c=Pt[t.type]||Vn;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=on[e.colorSpace];c=(e,i)=>t.reverse(t.interpolate(t.forward(e),t.forward(i),s))}return"function"==typeof a.evaluate?{evaluate(...e){const t=a.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==i)return c(t,i,s)}}:c(a,l,s)}function Kn(e,t,i){return"color"===t.type?i=Ct.parse(i):"formatted"===t.type?i=Jt.fromString(i.toString()):"resolvedImage"===t.type?i=ti.build(i.toString()):di(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),Gn(i,e.default,t.default)}gi.register(Mn,{error:[{kind:"error"},[Dt],(e,[t])=>{throw new ai(t.evaluate(e))}],typeof:[Dt,[Qt],(e,[t])=>$t(ni(t.evaluate(e)))],"to-rgba":[Gt(Rt,4),[Ut],(e,[t])=>t.evaluate(e).toRenderColor(null).toArray()],"to-hsla":[Gt(Rt,4),[Ut],(e,[t])=>t.evaluate(e).toRenderColor(null).toHslaArray()],rgb:[Ut,[Rt,Rt,Rt],In],rgba:[Ut,[Rt,Rt,Rt,Rt],In],hsl:[Ut,[Rt,Rt,Rt],Pn],hsla:[Ut,[Rt,Rt,Rt,Rt],Pn],has:{type:Ot,overloads:[[[Dt],(e,[t])=>Ln(t.evaluate(e),e.properties())],[[Dt,Nt],(e,[t,i])=>Ln(t.evaluate(e),i.evaluate(e))]]},get:{type:Qt,overloads:[[[Dt],(e,[t])=>Fn(t.evaluate(e),e.properties())],[[Dt,Nt],(e,[t,i])=>Fn(t.evaluate(e),i.evaluate(e))]]},"feature-state":[Qt,[Dt],(e,[t])=>Fn(t.evaluate(e),e.featureState||{})],properties:[Nt,[],e=>e.properties()],"geometry-type":[Dt,[],e=>e.geometryType()],id:[Qt,[],e=>e.id()],zoom:[Rt,[],e=>e.globals.zoom],pitch:[Rt,[],e=>e.globals.pitch||0],"distance-from-center":[Rt,[],e=>e.distanceFromCenter()],"measure-light":[Rt,[Dt],(e,[t])=>e.measureLight(t.evaluate(e))],"heatmap-density":[Rt,[],e=>e.globals.heatmapDensity||0],"line-progress":[Rt,[],e=>e.globals.lineProgress||0],"raster-value":[Rt,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[Rt,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[Rt,[],e=>e.globals.skyRadialProgress||0],accumulated:[Qt,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Rt,kn(Rt),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[Rt,kn(Rt),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:Rt,overloads:[[[Rt,Rt],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[Rt],(e,[t])=>-t.evaluate(e)]]},"/":[Rt,[Rt,Rt],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[Rt,[Rt,Rt],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[Rt,[],()=>Math.LN2],pi:[Rt,[],()=>Math.PI],e:[Rt,[],()=>Math.E],"^":[Rt,[Rt,Rt],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[Rt,[Rt],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Rt,[Rt],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Rt,[Rt],(e,[t])=>Math.log(t.evaluate(e))],log2:[Rt,[Rt],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Rt,[Rt],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Rt,[Rt],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Rt,[Rt],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Rt,[Rt],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Rt,[Rt],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Rt,[Rt],(e,[t])=>Math.atan(t.evaluate(e))],min:[Rt,kn(Rt),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[Rt,kn(Rt),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[Rt,[Rt],(e,[t])=>Math.abs(t.evaluate(e))],round:[Rt,[Rt],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[Rt,[Rt],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Rt,[Rt],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[Ot,[Dt,Qt],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[Ot,[Qt],(e,[t])=>e.id()===t.value],"filter-type-==":[Ot,[Dt],(e,[t])=>e.geometryType()===t.value],"filter-<":[Ot,[Dt,Qt],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r{const i=e.id(),r=t.value;return typeof i==typeof r&&i":[Ot,[Dt,Qt],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[Ot,[Qt],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[Ot,[Dt,Qt],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[Ot,[Qt],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[Ot,[Dt,Qt],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[Ot,[Qt],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[Ot,[Qt],(e,[t])=>t.value in e.properties()],"filter-has-id":[Ot,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[Ot,[Gt(Dt)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[Ot,[Gt(Qt)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[Ot,[Dt,Gt(Qt)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[Ot,[Dt,Gt(Qt)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:Ot,overloads:[[[Ot,Ot],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[kn(Ot),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:Ot,overloads:[[[Ot,Ot],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[kn(Ot),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[Ot,[Ot],(e,[t])=>!t.evaluate(e)],"is-supported-script":[Ot,[Dt],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[Dt,[Dt],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Dt,[Dt],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Dt,kn(Qt),(e,t)=>t.map((t=>oi(t.evaluate(e)))).join("")],"resolved-locale":[Dt,[jt],(e,[t])=>t.evaluate(e).resolvedLocale()],random:[Rt,[Rt,Rt,Qt],(e,t)=>{const[i,r,n]=t.map((t=>t.evaluate(e)));if(i>r)return i;if(i===r)return i;let o;if("string"==typeof n)o=function(e){let t=0;if(0===e.length)return t;for(let i=0;iJSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function Xn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Mn}function Yn(e,t,i,r){const n=new Dr(Mn,[],t?function(e){const t={color:Ut,string:Dt,number:Rt,enum:Dt,boolean:Ot,formatted:Vt,resolvedImage:Ht};return"array"===e.type?Gt(t[e.value]||Qt,e.length):t[e.type]}(t):void 0,void 0,void 0,i,r),o=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return o?zn(new Wn(o,t,i,r)):Rn(n.errors)}class Jn{constructor(e,t,i,r){this.kind=e,this._styleExpression=t,this.isLightConstant=i,this.isLineProgressConstant=r,this.isStateDependent="constant"!==e&&!Lr(t.expression),this.configDependencies=Fr(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}}class eo{constructor(e,t,i,r,n,o){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Lr(t.expression),this.isLightConstant=n,this.isLineProgressConstant=o,this.configDependencies=Fr(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?sn.interpolationFactor(this.interpolationType,e,t,i):0}}function to(e,t,i,r){if("error"===(e=Yn(e,t,i,r)).result)return e;const n=e.value.expression,o=Pr(n);if(!o&&!On(t))return Rn([new Ft("","data expressions not supported")]);const s=kr(n,["zoom","pitch","distance-from-center"]);if(!s&&!Nn(t))return Rn([new Ft("","zoom expressions not supported")]);const a=kr(n,["measure-light"]);if(!a&&!Un(t))return Rn([new Ft("","measure-light expression not supported")]);const l=kr(n,["line-progress"]);if(!l&&!function(e){return Dn(e.expression,"line-progress")}(t))return Rn([new Ft("","line-progress expression not supported")]);const c=t.expression&&t.expression.relaxZoomRestriction,u=ro(n);return u||s||c?u instanceof Ft?Rn([u]):u instanceof sn&&!Qn(t)?Rn([new Ft("",'"interpolate" expressions cannot be used with this property')]):zn(u?new eo(o&&l?"camera":"composite",e.value,u.labels,u instanceof sn?u.interpolation:void 0,a,l):new Jn(o&&l?"constant":"source",e.value,a,l)):Rn([new Ft("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class io{constructor(e,t){this._parameters=e,this._specification=t,Lt(this,Hn(this._parameters,this._specification))}static deserialize(e){return new io(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ro(e){let t=null;if(e instanceof cn)t=ro(e.result);else if(e instanceof ln){for(const i of e.args)if(t=ro(i),t)break}else(e instanceof Nr||e instanceof sn)&&e.input instanceof gi&&"zoom"===e.input.name&&(t=e);return t instanceof Ft||e.eachChild((e=>{const i=ro(e);i instanceof Ft?t=i:t&&i&&t!==i&&(t=new Ft("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}var no,oo,so=function(){if(oo)return no;oo=1,no=t;var e=3;function t(t,i,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],this.d=(i=o[1])+2*(r=o[2]);for(var s=0;s=u[p+0]&&r>=u[p+1])?(s[d]=!0,o.push(c[d])):s[d]=!1}}},t.prototype._forEachCell=function(e,t,i,r,n,o,s,a){for(var l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(i),h=this._convertToCellCoord(r),d=l;d<=u;d++)for(var p=c;p<=h;p++){var f=this.d*p+d;if((!a||a(this._convertFromCellCoord(d),this._convertFromCellCoord(p),this._convertFromCellCoord(d+1),this._convertFromCellCoord(p+1)))&&n.call(this,e,t,i,r,f,o,s,a))return}},t.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},t.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},t.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,i=e+this.cells.length+1+1,r=0,n=0;n=0||(n[i]=po(e[i],t)));e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}throw new Error("can't serialize object of type "+typeof e)}function fo(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||uo(e)||ho(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(fo);if("object"==typeof e){const t=e.$name||"Object";if("Map"===t){const t=e.entries||[],i=new Map;for(let e=0;ee>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519,Osage:e=>e>=66736&&e<=66815,"CJK Unified Ideographs Extension B":e=>e>=131072&&e<=173791};function mo(e){for(const t of e)if(yo(t.charCodeAt(0)))return!0;return!1}function go(e){for(const t of e)if(!_o(t.charCodeAt(0)))return!1;return!0}function _o(e){return!(Ao.Arabic(e)||Ao["Arabic Supplement"](e)||Ao["Arabic Extended-A"](e)||Ao["Arabic Presentation Forms-A"](e)||Ao["Arabic Presentation Forms-B"](e))}function yo(e){return!(746!==e&&747!==e&&(e<4352||!(Ao["Bopomofo Extended"](e)||Ao.Bopomofo(e)||Ao["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||Ao["CJK Compatibility Ideographs"](e)||Ao["CJK Compatibility"](e)||Ao["CJK Radicals Supplement"](e)||Ao["CJK Strokes"](e)||!(!Ao["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Ao["CJK Unified Ideographs Extension A"](e)||Ao["CJK Unified Ideographs"](e)||Ao["Enclosed CJK Letters and Months"](e)||Ao["Hangul Compatibility Jamo"](e)||Ao["Hangul Jamo Extended-A"](e)||Ao["Hangul Jamo Extended-B"](e)||Ao["Hangul Jamo"](e)||Ao["Hangul Syllables"](e)||Ao.Hiragana(e)||Ao["Ideographic Description Characters"](e)||Ao.Kanbun(e)||Ao["Kangxi Radicals"](e)||Ao["Katakana Phonetic Extensions"](e)||Ao.Katakana(e)&&12540!==e||!(!Ao["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!Ao["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||Ao["Unified Canadian Aboriginal Syllabics"](e)||Ao["Unified Canadian Aboriginal Syllabics Extended"](e)||Ao["Vertical Forms"](e)||Ao["Yijing Hexagram Symbols"](e)||Ao["Yi Syllables"](e)||Ao["Yi Radicals"](e))))}function vo(e){return!(yo(e)||function(e){return!!(Ao["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||Ao["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||Ao["Letterlike Symbols"](e)||Ao["Number Forms"](e)||Ao["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ao["Control Pictures"](e)&&9251!==e||Ao["Optical Character Recognition"](e)||Ao["Enclosed Alphanumerics"](e)||Ao["Geometric Shapes"](e)||Ao["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ao["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ao["CJK Symbols and Punctuation"](e)||Ao.Katakana(e)||Ao["Private Use Area"](e)||Ao["CJK Compatibility Forms"](e)||Ao["Small Form Variants"](e)||Ao["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function xo(e){return Ao.Arabic(e)||Ao["Arabic Supplement"](e)||Ao["Arabic Extended-A"](e)||Ao["Arabic Presentation Forms-A"](e)||Ao["Arabic Presentation Forms-B"](e)}function bo(e){return e>=1424&&e<=2303||Ao["Arabic Presentation Forms-A"](e)||Ao["Arabic Presentation Forms-B"](e)}function wo(e,t){return!(!t&&bo(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Ao.Khmer(e))}function To(e){for(const t of e)if(bo(t.charCodeAt(0)))return!0;return!1}const Bo="deferred",Co="loading",So="loaded";let Eo=null,Mo="unavailable",Io=null;const Po=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(Mo="error"),Eo&&Eo(e)};function Lo(){Fo.fire(new gt("pluginStateChange",{pluginStatus:Mo,pluginURL:Io}))}const Fo=new xt,ko=function(){return Mo},zo=function(){if(Mo!==Bo||!Io)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Mo=Co,Lo(),Io&&rt({url:Io},(e=>{e?Po(e):(Mo=So,Lo())}))},Ro={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Mo===So||null!=Ro.applyArabicShaping,isLoading:()=>Mo===Co,setState(e){Mo=e.pluginStatus,Io=e.pluginURL},isParsed:()=>null!=Ro.applyArabicShaping&&null!=Ro.processBidirectionalText&&null!=Ro.processStyledBidirectionalText,getPluginURL:()=>Io};class Do{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(e,t){for(const i of e)if(!wo(i.charCodeAt(0),t))return!1;return!0}(e,Ro.isLoaded())}}class Oo{constructor(e,t,i,r){this.property=e,this.value=t,this.expression=function(e,t,i,r){if(jn(e))return new io(e,t);if(Xn(e)||Array.isArray(e)&&e.length>0){const n=to(e,t,i,r);if("error"===n.result)throw new Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return n.value}{let i=e;return"string"==typeof e&&"color"===t.type&&(i=Ct.parse(e)),{kind:"constant",configDependencies:new Set,evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification,i,r)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class Uo{constructor(e,t,i){this.property=e,this.value=new Oo(e,void 0,t,i)}transitioned(e,t){return new Qo(this.property,this.value,t,re({},e.transition,this.transition),e.now)}untransitioned(){return new Qo(this.property,this.value,null,{},0)}}class No{constructor(e,t,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=i,this.configDependencies=new Set}getValue(e){return ue(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Uo(this._values[e].property,this._scope,this._options)),this._values[e].value=new Oo(this._values[e].property,null===t?void 0:ue(t),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,t){t&&(this._options=t);const i=this._properties.properties;if(e)for(const t in e){const r=e[t];if(t.endsWith("-transition")){const e=t.slice(0,-11);i[e]&&this.setTransition(e,r)}else i.hasOwnProperty(t)&&this.setValue(t,r)}}getTransition(e){return ue(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Uo(this._values[e].property)),this._values[e].transition=ue(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const r=this.getTransition(t);void 0!==r&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){const i=new jo(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){const e=new jo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Qo{constructor(e,t,i,r,n){const o=r.delay||0,s=r.duration||0;n=n||0,this.property=e,this.value=t,this.begin=n+o,this.end=this.begin+s,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"center-thinning":{"type":"number","property-type":"data-constant","default":0.4,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","property-type":"data-constant","default":0.71,"minimum":0,"maximum":5,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"center-thinning":{"type":"number","property-type":"data-constant","default":0.57,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","property-type":"data-constant","default":0.7,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","experimental":true,"property-type":"data-constant","expression":{}},"buildingFeaturesetId":{"type":"string","experimental":true,"property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","experimental":true,"private":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","transition":true,"experimental":true,"private":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"flat","property-type":"data-constant"},"fill-extrusion-base-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"terrain","property-type":"data-constant"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]},"experimental":true,"property-type":"data-constant"},"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"*"}}}');function Xo(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Yo(e){if(Array.isArray(e))return e.map(Yo);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=Yo(e[i]);return t}return Xo(e)}function Jo(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Jo(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function es(e,t="",i=null,r="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Jo(e)||(e=as(e));const n=e;let o=!0;try{o=function(e){if(!rs(e))return e;let t=Yo(e);return is(t),t=ts(t),t}(n)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(n,null,2)}\n `)}let s=null,a=null;if("background"!==r&&"sky"!==r&&"slot"!==r){a=Wo[`filter_${r}`];const e=Yn(o,a,t,i);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));s=(t,i,r)=>e.value.evaluate(t,i,{},r)}let l=null,c=null;if(o!==n){const e=Yn(n,a,t,i);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));l=(t,i,r,n,o)=>e.value.evaluate(t,i,{},r,void 0,void 0,n,o),c=!Pr(e.value.expression)}return{filter:s,dynamicFilter:l||void 0,needGeometry:ss(o),needFeature:!!c}}function ts(e){if(!Array.isArray(e))return e;const t=function(e){if(ns.has(e[0]))for(let t=1;tts(e)))}function is(e){let t=!1;const i=[];if("case"===e[0]){for(let r=1;r",">=","<","<=","to-boolean"]);function os(e,t){return et?1:0}function ss(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t"===t||"<="===t||">="===t?ls(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(as))):"all"===t?["all"].concat(e.slice(1).map(as)):"none"===t?["all"].concat(e.slice(1).map(as).map(hs)):"in"===t?cs(e[1],e.slice(2)):"!in"===t?hs(cs(e[1],e.slice(2))):"has"===t?us(e[1]):"!has"!==t||hs(us(e[1]));var i}function ls(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function cs(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(os)]]:["filter-in-small",e,["literal",t]]}}function us(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function hs(e){return["!",e]}const ds="";function ps(e,t){return t?`${e}${ds}${t}`:e}const fs="-transition",As=new Set(["fill","line","background","hillshade","raster"]);class ms extends xt{constructor(e,t,i,r,n){if(super(),this.id=e.id,this.fqid=ps(this.id,i),this.type=e.type,this.scope=i,this.lut=r,this.options=n,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,"custom"!==e.type){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const t=Yn(this.filter,Wo[`filter_${e.type}`]);"error"!==t.result&&(this.configDependencies=new Set([...this.configDependencies,...t.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),t.layout&&(this._unevaluatedLayout=new Vo(t.layout,this.scope,n),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),t.paint){this._transitionablePaint=new No(t.paint,this.scope,n);for(const t in e.paint)this.setPaintProperty(t,e.paint[t]);for(const t in e.layout)this.setLayoutProperty(t,e.layout[t]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Go(t.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&As.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){if("custom"===this.type&&"visibility"===e)return void(this.visibility=t);const i=this._unevaluatedLayout;i._properties.properties[e]&&(i.setValue(e,t),this.configDependencies=new Set([...this.configDependencies,...i.configDependencies]),"visibility"===e&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(fs)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t){const i=this._transitionablePaint,r=i._properties.properties;if(e.endsWith(fs)){const n=e.slice(0,-11);return r[n]&&i.setTransition(n,t||void 0),!1}if(!r[e])return!1;const n=i._values[e],o=n.value.isDataDriven(),s=n.value;i.setValue(e,t),this.configDependencies=new Set([...this.configDependencies,...i.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const a=i._values[e].value,l=a.isDataDriven(),c=e.endsWith("pattern")||"line-dasharray"===e;return l||o||c||this._handleOverridablePaintPropertyUpdate(e,s,a)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,i){return null}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){return ce({id:this.id,type:this.type,slot:this.slot,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()},((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}is3D(e){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Ho&&On(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=es(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,t,i,r,n,o,s,a,l){}}const gs={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class _s{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ys{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function vs(e,t=1){let i=0,r=0;return{members:e.map((e=>{const n=gs[e.type].BYTES_PER_ELEMENT,o=i=xs(i,Math.max(t,n)),s=e.components||1;return r=Math.max(r,n),i+=n*s,{name:e.name,type:e.type,components:s,offset:o}})),size:xs(i,Math.max(r,t)),alignment:t}}function xs(e,t){return Math.ceil(e/t)*t}class bs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}bs.prototype.bytesPerElement=4,co(bs,"StructArrayLayout2i4");class ws extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}ws.prototype.bytesPerElement=6,co(ws,"StructArrayLayout3i6");class Ts extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,e}}Ts.prototype.bytesPerElement=8,co(Ts,"StructArrayLayout4i8");class Bs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Bs.prototype.bytesPerElement=4,co(Bs,"StructArrayLayout1f4");class Cs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e,o=2*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.float32[o+1]=r,e}}Cs.prototype.bytesPerElement=8,co(Cs,"StructArrayLayout2i1f8");class Ss extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}Ss.prototype.bytesPerElement=8,co(Ss,"StructArrayLayout3i8");class Es extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=5*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,e}}Es.prototype.bytesPerElement=10,co(Es,"StructArrayLayout5i10");class Ms extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=6*e,c=12*e,u=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[c+4]=r,this.uint8[c+5]=n,this.uint8[c+6]=o,this.uint8[c+7]=s,this.float32[u+2]=a,e}}Ms.prototype.bytesPerElement=12,co(Ms,"StructArrayLayout2i4ub1f12");class Is extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}Is.prototype.bytesPerElement=12,co(Is,"StructArrayLayout3f12");class Ps extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=6*e,a=3*e;return this.uint16[s+0]=t,this.uint16[s+1]=i,this.uint16[s+2]=r,this.uint16[s+3]=n,this.float32[a+2]=o,e}}Ps.prototype.bytesPerElement=12,co(Ps,"StructArrayLayout4ui1f12");class Ls extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=r,this.uint16[o+3]=n,e}}Ls.prototype.bytesPerElement=8,co(Ls,"StructArrayLayout4ui8");class Fs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,e}}Fs.prototype.bytesPerElement=12,co(Fs,"StructArrayLayout6i12");class ks extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,o,s,a,l,c,u,h)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=s,this.uint16[p+6]=a,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}ks.prototype.bytesPerElement=24,co(ks,"StructArrayLayout4i4ui4i24");class zs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=10*e,l=5*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,e}}zs.prototype.bytesPerElement=20,co(zs,"StructArrayLayout3i3f20");class Rs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,e}}Rs.prototype.bytesPerElement=16,co(Rs,"StructArrayLayout4f16");class Ds extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Ds.prototype.bytesPerElement=4,co(Ds,"StructArrayLayout1ul4");class Os extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}Os.prototype.bytesPerElement=4,co(Os,"StructArrayLayout2ui4");class Us extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,r,n,o,s,a,l,c,u,h,d)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d,p){const f=20*e,A=10*e;return this.int16[f+0]=t,this.int16[f+1]=i,this.int16[f+2]=r,this.int16[f+3]=n,this.int16[f+4]=o,this.float32[A+3]=s,this.float32[A+4]=a,this.float32[A+5]=l,this.float32[A+6]=c,this.int16[f+14]=u,this.uint32[A+8]=h,this.uint16[f+18]=d,this.uint16[f+19]=p,e}}Us.prototype.bytesPerElement=40,co(Us,"StructArrayLayout5i4f1i1ul2ui40");class Ns extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=r,this.int16[l+4]=n,this.int16[l+5]=o,this.int16[l+6]=s,this.int16[l+7]=a,e}}Ns.prototype.bytesPerElement=16,co(Ns,"StructArrayLayout3i2i2i16");class Qs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=4*e,a=8*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[a+6]=n,this.int16[a+7]=o,e}}Qs.prototype.bytesPerElement=16,co(Qs,"StructArrayLayout2f1f2i16");class js extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=20*e,l=5*e;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,e}}js.prototype.bytesPerElement=20,co(js,"StructArrayLayout2ub4f20");class Vs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}Vs.prototype.bytesPerElement=6,co(Vs,"StructArrayLayout3ui6");class Hs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v){const x=this.length;return this.resize(x+1),this.emplace(x,e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x){const b=30*e,w=15*e,T=60*e;return this.int16[b+0]=t,this.int16[b+1]=i,this.int16[b+2]=r,this.float32[w+2]=n,this.float32[w+3]=o,this.uint16[b+8]=s,this.uint16[b+9]=a,this.uint32[w+5]=l,this.uint32[w+6]=c,this.uint32[w+7]=u,this.uint16[b+16]=h,this.uint16[b+17]=d,this.uint16[b+18]=p,this.float32[w+10]=f,this.float32[w+11]=A,this.uint8[T+48]=m,this.uint8[T+49]=g,this.uint8[T+50]=_,this.uint32[w+13]=y,this.int16[b+28]=v,this.uint8[T+58]=x,e}}Hs.prototype.bytesPerElement=60,co(Hs,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Gs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S,E,M,I,P,L){const F=this.length;return this.resize(F+1),this.emplace(F,e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S,E,M,I,P,L)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S,E,M,I,P,L,F){const k=20*e,z=40*e,R=80*e;return this.float32[k+0]=t,this.float32[k+1]=i,this.int16[z+4]=r,this.int16[z+5]=n,this.int16[z+6]=o,this.int16[z+7]=s,this.int16[z+8]=a,this.int16[z+9]=l,this.int16[z+10]=c,this.int16[z+11]=u,this.int16[z+12]=h,this.uint16[z+13]=d,this.uint16[z+14]=p,this.uint16[z+15]=f,this.uint16[z+16]=A,this.uint16[z+17]=m,this.uint16[z+18]=g,this.uint16[z+19]=_,this.uint16[z+20]=y,this.uint16[z+21]=v,this.uint16[z+22]=x,this.uint16[z+23]=b,this.uint16[z+24]=w,this.uint16[z+25]=T,this.uint16[z+26]=B,this.uint16[z+27]=C,this.uint32[k+14]=S,this.float32[k+15]=E,this.float32[k+16]=M,this.float32[k+17]=I,this.float32[k+18]=P,this.uint8[R+76]=L,this.uint16[z+39]=F,e}}Gs.prototype.bytesPerElement=80,co(Gs,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class $s extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=5*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.float32[s+3]=n,this.float32[s+4]=o,e}}$s.prototype.bytesPerElement=20,co($s,"StructArrayLayout5f20");class Zs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=7*e;return this.float32[l+0]=t,this.float32[l+1]=i,this.float32[l+2]=r,this.float32[l+3]=n,this.float32[l+4]=o,this.float32[l+5]=s,this.float32[l+6]=a,e}}Zs.prototype.bytesPerElement=28,co(Zs,"StructArrayLayout7f28");class qs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,i,r,n,o,s,a,l,c,u)}emplace(e,t,i,r,n,o,s,a,l,c,u,h){const d=11*e;return this.float32[d+0]=t,this.float32[d+1]=i,this.float32[d+2]=r,this.float32[d+3]=n,this.float32[d+4]=o,this.float32[d+5]=s,this.float32[d+6]=a,this.float32[d+7]=l,this.float32[d+8]=c,this.float32[d+9]=u,this.float32[d+10]=h,e}}qs.prototype.bytesPerElement=44,co(qs,"StructArrayLayout11f44");class Ks extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,r,n,o,s,a,l)}emplace(e,t,i,r,n,o,s,a,l,c){const u=9*e;return this.float32[u+0]=t,this.float32[u+1]=i,this.float32[u+2]=r,this.float32[u+3]=n,this.float32[u+4]=o,this.float32[u+5]=s,this.float32[u+6]=a,this.float32[u+7]=l,this.float32[u+8]=c,e}}Ks.prototype.bytesPerElement=36,co(Ks,"StructArrayLayout9f36");class Ws extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}Ws.prototype.bytesPerElement=8,co(Ws,"StructArrayLayout2f8");class Xs extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=6*e;return this.uint32[3*e+0]=t,this.uint16[o+2]=i,this.uint16[o+3]=r,this.uint16[o+4]=n,e}}Xs.prototype.bytesPerElement=12,co(Xs,"StructArrayLayout1ul3ui12");class Ys extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Ys.prototype.bytesPerElement=2,co(Ys,"StructArrayLayout1ui2");class Js extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A){const m=this.length;return this.resize(m+1),this.emplace(m,e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m){const g=16*e;return this.float32[g+0]=t,this.float32[g+1]=i,this.float32[g+2]=r,this.float32[g+3]=n,this.float32[g+4]=o,this.float32[g+5]=s,this.float32[g+6]=a,this.float32[g+7]=l,this.float32[g+8]=c,this.float32[g+9]=u,this.float32[g+10]=h,this.float32[g+11]=d,this.float32[g+12]=p,this.float32[g+13]=f,this.float32[g+14]=A,this.float32[g+15]=m,e}}Js.prototype.bytesPerElement=64,co(Js,"StructArrayLayout16f64");class ea extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=10*e,c=5*e;return this.uint16[l+0]=t,this.uint16[l+1]=i,this.uint16[l+2]=r,this.uint16[l+3]=n,this.float32[c+2]=o,this.float32[c+3]=s,this.float32[c+4]=a,e}}ea.prototype.bytesPerElement=20,co(ea,"StructArrayLayout4ui3f20");class ta extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}ta.prototype.bytesPerElement=2,co(ta,"StructArrayLayout1i2");class ia extends ys{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}ia.prototype.bytesPerElement=1,co(ia,"StructArrayLayout1ub1");class ra extends _s{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}ra.prototype.size=40;class na extends Us{get(e){return new ra(this,e)}}co(na,"CollisionBoxArray");class oa extends _s{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}oa.prototype.size=60;class sa extends Hs{get(e){return new oa(this,e)}}co(sa,"PlacedSymbolArray");class aa extends _s{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}aa.prototype.size=80;class la extends Gs{get(e){return new aa(this,e)}}co(la,"SymbolInstanceArray");class ca extends Bs{getoffsetX(e){return this.float32[1*e+0]}}co(ca,"GlyphOffsetArray");class ua extends bs{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}co(ua,"SymbolLineVertexArray");class ha extends _s{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}ha.prototype.size=12;class da extends Xs{get(e){return new ha(this,e)}}co(da,"FeatureIndexArray");class pa extends Os{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}co(pa,"FillExtrusionCentroidArray");class fa extends _s{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}fa.prototype.size=6;class Aa extends ws{get(e){return new fa(this,e)}}co(Aa,"FillExtrusionWallArray");const ma=vs([{name:"a_pos",components:2,type:"Int16"}],4),ga=vs([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class _a{constructor(e=[]){this.segments=e}_prepareSegment(e,t,i,r){let n=this.segments[this.segments.length-1];return e>_a.MAX_VERTEX_ARRAY_LENGTH&&de(`Max vertices per segment is ${_a.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!n||n.vertexLength+e>_a.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r)&&(n={vertexOffset:t,primitiveOffset:i,vertexLength:0,primitiveLength:0},void 0!==r&&(n.sortKey=r),this.segments.push(n)),n}prepareSegment(e,t,i,r){return this._prepareSegment(e,t.length,i.length,r)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,r){return new _a([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function ya(e,t){return 256*(e=J(Math.floor(e),0,255))+J(Math.floor(t),0,255)}_a.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,co(_a,"SegmentVector");const va=vs([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),xa=vs([{name:"a_dash",components:4,type:"Uint16"}]);class ba{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(wa(e)),this.positions.push(t,i,r)}eachPosition(e,t){const i=wa(e);let r=0,n=this.ids.length-1;for(;r>1;this.ids[e]>=i?n=e:r=e+1}for(;this.ids[r]===i;)t(this.positions[3*r],this.positions[3*r+1],this.positions[3*r+2]),r++}static serialize(e,t){const i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return Ta(i,r,0,i.length-1),t&&(t.add(i.buffer),t.add(r.buffer)),{ids:i,positions:r}}static deserialize(e){const t=new ba;let i;t.ids=e.ids,t.positions=e.positions;for(const e of t.ids)e!==i&&t.uniqueIds.push(e),i=e;return t.indexed=!0,t}}function wa(e){const t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:mt(String(e))}function Ta(e,t,i,r){for(;i>1];let o=i-1,s=r+1;for(;;){do{o++}while(e[o]n);if(o>=s)break;Ba(e,o,s),Ba(t,3*o,3*s),Ba(t,3*o+1,3*s+1),Ba(t,3*o+2,3*s+2)}s-i`u_${e}`)),this.type=i,this.context=r}setUniform(e,t,i,r,n){const o=r.constantOr(this.value);t.set(e,n,o instanceof Ct?o.toRenderColor(this.lutExpression&&"none"===this.lutExpression.value?null:this.context.lut):o)}getBinding(e,t){return"color"===this.type?new La(e):new Ea(e)}}class Na{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,t,i,r,n){const o="u_pattern"===n||"u_dash"===n?this.pattern:"u_pixel_ratio"===n?this.pixelRatio:null;o&&t.set(e,n,o)}getBinding(e,t){return"u_pattern"===t||"u_dash"===t?new Pa(e):new Ea(e)}}class Qa{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,n,o,s){const a=this.paintVertexArray.length,l="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new Do(0,{brightness:o}),t,{},n,r,s):"constant"===this.expression.kind&&this.expression.value,c=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new Do(0,{brightness:o}),t,{},n,r,s):this.lutExpression.value);this.paintVertexArray.resize(e),this._setPaintValue(a,e,l,c?null:this.context.lut)}updatePaintArray(e,t,i,r,n,o,s){const a="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:s},i,r,void 0,n):"constant"===this.expression.kind&&this.expression.value,l=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new Do(0,{brightness:s}),i,r,void 0,n):this.lutExpression.value);this._setPaintValue(e,t,a,l?null:this.context.lut)}_setPaintValue(e,t,i,r){if("color"===this.type){const n=Oa(i.toRenderColor(r));for(let i=e;i`u_${e}_t`)),this.type=i,this.useIntegerZoom=r,this.context=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,t,i,r,n,o,s){const a=this.expression.evaluate(new Do(this.context.zoom,{brightness:o}),t,{},n,r,s),l=this.expression.evaluate(new Do(this.context.zoom+1,{brightness:o}),t,{},n,r,s),c=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new Do(0,{brightness:o}),t,{},n,r,s):this.lutExpression.value),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,a,l,c?null:this.context.lut)}updatePaintArray(e,t,i,r,n,o,s){const a=this.expression.evaluate({zoom:this.context.zoom,brightness:s},i,r,void 0,n),l=this.expression.evaluate({zoom:this.context.zoom+1,brightness:s},i,r,void 0,n),c=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new Do(0,{brightness:s}),i,r,void 0,n):this.lutExpression.value);this._setPaintValue(e,t,a,l,c?null:this.context.lut)}_setPaintValue(e,t,i,r,n){if("color"===this.type){const r=Oa(i.toRenderColor(n)),o=Oa(i.toRenderColor(n));for(let i=e;i!0){this.binders={},this._buffers=[],this.context=t;const r=[];for(const n in e.paint._values){const o=e.paint.get(n);if(n.endsWith("-use-theme"))continue;if(!i(n))continue;if(!(o instanceof Ho&&On(o.property.specification)))continue;const s=Za(n,e.type),a=o.value,l=o.property.specification.type,c=!!o.property.useIntegerZoom,u="line-dasharray"===n||n.endsWith("pattern"),h=e.paint.get(`${n}-use-theme`),d="line-dasharray"===n&&"constant"!==e.layout.get("line-cap").value.kind||h&&"constant"!==h.value.kind;if("constant"!==a.kind||d)if("source"===a.kind||d||u){const t=Wa(n,l,"source");this.binders[n]=u?new Va(a,s,l,t,e.id):new Qa(a,s,l,t),r.push(`/a_${n}`)}else{const e=Wa(n,l,"composite");this.binders[n]=new ja(a,s,l,c,t,e),r.push(`/z_${n}`)}else this.binders[n]=u?new Na(a.value,s):new Ua(a.value,s,l,t),r.push(`/u_${n}`);h&&(this.binders[n].lutExpression=h.value)}this.cacheKey=r.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Qa||t instanceof ja?t.maxValue:0}populatePaintArrays(e,t,i,r,n,o,s){for(const a in this.binders){const l=this.binders[a];l.context=this.context,(l instanceof Qa||l instanceof ja||l instanceof Va)&&l.populatePaintArray(e,t,i,r,n,o,s)}}setConstantPatternPositions(e){for(const t in this.binders){const i=this.binders[t];i instanceof Na&&i.setConstantPatternPositions(e)}}updatePaintArrays(e,t,i,r,n,o,s,a,l){let c=!1;const u=Object.keys(e),h=0!==u.length&&!a,d=h?u:t.uniqueIds;this.context.lut=n.lut;for(const a in this.binders){const u=this.binders[a];if(u.context=this.context,(u instanceof Qa||u instanceof ja||u instanceof Va)&&u.expression&&u.expression.kind&&"constant"!==u.expression.kind&&(!0===u.expression.isStateDependent||!1===u.expression.isLightConstant)){const p=n.paint.get(a);u.expression=p.value;for(const i of d){const n=e[i.toString()];t.eachPosition(i,((e,t,i)=>{const a=r.feature(e);u.updatePaintArray(t,i,a,n,o,s,l)}))}if(!h)for(const t of i.uniqueIds){const n=e[t.toString()];i.eachPosition(t,((e,t,i)=>{const a=r.feature(e);u.updatePaintArray(t,i,a,n,o,s,l)}))}c=!0}}return c}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof Ua||i instanceof Na)&&e.push(...i.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof Qa||i instanceof ja||i instanceof Va)for(let t=0;t!0){this.programConfigurations={};for(const r of e)this.programConfigurations[r.id]=new Ha(r,t,i);this.needsUpload=!1,this._featureMap=new ba,this._featureMapWithoutIds=new ba,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,t,i,r,n,o,s,a){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,r,n,o,s,a);void 0!==t.id?this._featureMap.add(t.id,i,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,i,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r,n,o,s){for(const a of i)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,a,r,n,o,s||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const $a={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function Za(e,t){return $a[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const qa={"line-pattern":{source:Ps,composite:Ps},"fill-pattern":{source:Ps,composite:Ps},"fill-extrusion-pattern":{source:Ps,composite:Ps},"line-dasharray":{source:Ls,composite:Ls}},Ka={color:{source:Ws,composite:Rs},number:{source:Bs,composite:Ws}};function Wa(e,t,i){const r=qa[e];return r&&r[i]||Ka[t][i]}co(Ua,"ConstantBinder"),co(Na,"PatternConstantBinder"),co(Qa,"SourceExpressionBinder"),co(Va,"PatternCompositeBinder"),co(ja,"CompositeExpressionBinder"),co(Ha,"ProgramConfiguration",{omit:["_buffers"]}),co(Ga,"ProgramConfigurationSet");const Xa=Xi/Math.PI/2,Ya=5,Ja=6,el=16383,tl=64,il=[tl,32,16],rl=-Xa,nl=Xa;function ol(e,t,i,r=Xa){return i=Z(i),[e*Math.sin(i)*r,-t*r,e*Math.cos(i)*r]}function sl(e,t,i){return ol(Math.cos(Z(e)),Math.sin(Z(e)),t,i)}const al=6371008.8,ll=2*Math.PI*al;class cl{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new cl(te(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return al*Math.acos(Math.min(n,1))}toBounds(e=0){const t=360*e/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new ul({lng:this.lng-i,lat:this.lat-t},{lng:this.lng+i,lat:this.lat+t})}toEcef(e){return sl(this.lat,this.lng,Xa+e*Xa/al)}static convert(e){if(e instanceof cl)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new cl(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new cl(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class ul{constructor(e,t){if(e)if(t)this.setSouthWest(e).setNorthEast(t);else if(4===e.length){const t=e;this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]])}else{const t=e;this.setSouthWest(t[0]).setNorthEast(t[1])}}setNorthEast(e){return this._ne=e instanceof cl?new cl(e.lng,e.lat):cl.convert(e),this}setSouthWest(e){return this._sw=e instanceof cl?new cl(e.lng,e.lat):cl.convert(e),this}extend(e){const t=this._sw,i=this._ne;let r,n;if(e instanceof cl)r=e,n=e;else{if(!(e instanceof ul))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(ul.convert(e)):this.extend(cl.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(cl.convert(e)):this;if(r=e._sw,n=e._ne,!r||!n)return this}return t||i?(t.lng=Math.min(r.lng,t.lng),t.lat=Math.min(r.lat,t.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)):(this._sw=new cl(r.lng,r.lat),this._ne=new cl(n.lng,n.lat)),this}getCenter(){return new cl((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 cl(this.getWest(),this.getNorth())}getSouthEast(){return new cl(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:t,lat:i}=cl.convert(e);let r=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&r}static convert(e){if(e)return e instanceof ul?e:new ul(e)}}const hl=0,dl=25.5;function pl(e){return ll*Math.cos(e*Math.PI/180)}function fl(e){return(180+e)/360}function Al(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function ml(e,t){return e/pl(t)}function gl(e){return 360*e-180}function _l(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function yl(e,t){return e*pl(_l(t))}const vl=85.051129;function xl(e){return Math.cos(Z(J(e,-vl,vl)))}function bl(e,t){const i=J(t,hl,dl),r=Math.pow(2,i);return xl(e)*ll/(512*r)}function wl(e){return 1/Math.cos(e*Math.PI/180)}function Tl(e,t=0){const i=Math.exp(Math.PI*(1-(e.y+t/Xi)/(1<=l?(Cl(e,t,i,c,u,o,h,a,l),Cl(e,c,u,r,n,h,s,a,l)):e.push(s)}function Sl(e,t,i){let r=e[0],n=r.x,o=r.y;t(r);const s=[r];for(let a=1;ae.x+1||re.y+1)&&de("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function Fl(e,t,i){const r=e.loadGeometry(),n=e.extent,o=Xi/n;if(t&&i&&i.projection.isReprojectedInTileSpace){const o=1<{const i=gl((t.x+e.x/n)/o),r=_l((t.y+e.y/n)/o),u=c.project(i,r);e.x=(u.x*s-a)*n,e.y=(u.y*s-l)*n};for(let t=0;t=n||i.y<0||i.y>=n||(u(i),e.push(i));r[t]=e}}for(const e of r)for(const t of e)Ll(t,o);return r}function kl(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Fl(e):[]}}function zl(e,t,i,r,n){e.emplaceBack(2*t+(r+1)/2,2*i+(n+1)/2)}function Rl(e,t,i){const r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}class Dl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new bs,this.indexArray=new Vs,this.segments=new _a,this.programConfigurations=new Ga(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}updateFootprints(e,t){}populate(e,t,i,r){const n=this.layers[0],o=[];let s=null;"circle"===n.type&&(s=n.layout.get("circle-sort-key"));for(const{feature:t,id:n,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=kl(t,e);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),c,i))continue;const u=s?s.evaluate(c,{},i):void 0,h={id:n,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:Fl(t,i,r),patterns:{},sortKey:u};o.push(h)}s&&o.sort(((e,t)=>e.sortKey-t.sortKey));let a=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new Fs,a=r.projection);for(const r of o){const{geometry:n,index:o,sourceLayerIndex:s}=r,l=e[o].feature;this.addFeature(r,n,o,t.availableImages,i,a,t.brightness),t.featureIndex.insert(l,n,o,s,this.index)}}update(e,t,i,r,n,o,s){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ma.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,ga.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,t,i,r,n,o,s){for(const i of t)for(const t of i){const i=t.x,r=t.y;if(i<0||i>=Xi||r<0||r>=Xi)continue;if(o){const e=o.projectTilePoint(i,r,n),t=o.upVector(n,i,r),s=this.globeExtVertexArray;Rl(s,e,t),Rl(s,e,t),Rl(s,e,t),Rl(s,e,t)}const s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=s.vertexLength;zl(this.layoutVertexArray,i,r,-1,-1),zl(this.layoutVertexArray,i,r,1,-1),zl(this.layoutVertexArray,i,r,1,1),zl(this.layoutVertexArray,i,r,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+2,a+3),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r,n,s)}}function Ol(e,t){for(let i=0;i1){if(jl(e,t))return!0;for(let r=0;r1?i:i.sub(t)._mult(n)._add(t))}function $l(e,t){let i,r,n,o=!1;for(let s=0;st.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function Zl(e,t){let i=!1;for(let r=0,n=e.length-1;rt.y!=s.y>t.y&&t.x<(s.x-o.x)*(t.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function ql(e,t,i,r,n){for(const o of e)if(t<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;const o=[new V(t,i),new V(t,n),new V(r,n),new V(r,i)];if(e.length>2)for(const t of o)if(Zl(e,t))return!0;for(let t=0;tn.x&&t.x>n.x||e.yn.y&&t.y>n.y)return!1;const o=pe(e,t,i[0]);return o!==pe(e,t,i[1])||o!==pe(e,t,i[2])||o!==pe(e,t,i[3])}function Wl(e,t,i,r,n,o){let s=t.y-e.y,a=e.x-t.x;if(o=o||0){const e=s*s+a*a;if(0===e)return!0;const t=Math.sqrt(e);s/=t,a/=t}return!((i.x-e.x)*s+(i.y-e.y)*a-o<0||(r.x-e.x)*s+(r.y-e.y)*a-o<0||(n.x-e.x)*s+(n.y-e.y)*a-o<0)}function Xl(e,t,i,r,n,o,s){return!(Wl(e,t,r,n,o,s)||Wl(t,i,r,n,o,s)||Wl(i,e,r,n,o,s)||Wl(r,n,e,t,i,s)||Wl(n,o,e,t,i,s)||Wl(o,r,e,t,i,s))}function Yl(e,t,i){const r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Jl(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ec(e,t,i,r,n){if(!t[0]&&!t[1])return e;const o=V.convert(t)._mult(n);"viewport"===i&&o._rotate(-r);const s=[];for(let t=0;t0;o--)r=1<this.canonical.z?new cc(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new cc(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return uc(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const i=this.canonical.z-e;return uc(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new cc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new cc(t,this.wrap,t,i,r),new cc(t,this.wrap,t,i+1,r),new cc(t,this.wrap,t,i,r+1),new cc(t,this.wrap,t,i+1,r+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.y{let t=e.canonical.x-1,i=e.wrap;return t<0&&(t=(1<{let t=e.canonical.x+1,i=e.wrap;return t===1<new cc(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<new cc(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<=0;if(0===o)return 0;o!==t.length&&(i=!1)}return i?2:1}function xc(e,t){for(const i of e.projections){const r=yc(t,e.points[0],i.axis);if(i.projection[1]r[1])return 0}return 1}function bc(e,t){let i=0;const r=[0,0,0,0];for(let n=0;n=0&&i++;return i}class wc{constructor(e,t){this.points=e||new Array(8).fill([0,0,0]),this.planes=t||new Array(6).fill([0,0,0,0]),this.bounds=Tc.fromPoints(this.points),this.projections=[],this.frustumEdges=[U.vec3.sub([],this.points[2],this.points[3]),U.vec3.sub([],this.points[0],this.points[3]),U.vec3.sub([],this.points[4],this.points[0]),U.vec3.sub([],this.points[5],this.points[1]),U.vec3.sub([],this.points[6],this.points[2]),U.vec3.sub([],this.points[7],this.points[3])];for(const e of this.frustumEdges){const t=[0,-e[2],e[1]],i=[e[2],0,-e[0]];this.projections.push({axis:t,projection:yc(this.points,this.points[0],t)}),this.projections.push({axis:i,projection:yc(this.points,this.points[0],i)})}}static fromInvProjectionMatrix(e,t,i,r){const n=Math.pow(2,i),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((i=>{const o=U.vec4.transformMat4([],i,e),s=1/o[3]/t*n;return U.vec4.mul(o,o,[s,s,r?1/o[3]:s,s])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const t=U.vec3.sub([],o[e[0]],o[e[1]]),i=U.vec3.sub([],o[e[2]],o[e[1]]),r=U.vec3.normalize([],U.vec3.cross([],t,i)),n=-U.vec3.dot(r,o[e[1]]);return r.concat(n)})),a=[];for(let e=0;es[1]||s[0]>o[1])return 0}return 1}containsPoint(e){for(const t of this.planes){const i=t[3];if(U.vec3.dot([t[0],t[1],t[2]],e)+i<0)return!1}return!0}}class Tc{static fromPoints(e){const t=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(const r of e)U.vec3.min(t,t,r),U.vec3.max(i,i,r);return new Tc(t,i)}static fromTileIdAndHeight(e,t,i){const r=1<e.max[t]||e.min[t]>this.max[t])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t])}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}function Bc(e){return e*Xa/al}co(Tc,"Aabb");const Cc=[new Tc([rl,rl,rl],[nl,nl,nl]),new Tc([rl,rl,rl],[0,0,nl]),new Tc([0,rl,rl],[nl,0,nl]),new Tc([rl,0,rl],[0,nl,nl]),new Tc([0,0,rl],[nl,nl,nl])];function Sc(e,t,i,r=!0){const n=U.vec3.scale([],e._camera.position,e.worldSize),o=[t,i,1,1];U.vec4.transformMat4(o,o,e.pixelMatrixInverse),U.vec4.scale(o,o,1/o[3]);const s=U.vec3.sub([],o,n),a=U.vec3.normalize([],s),l=e.globeMatrix,c=[l[12],l[13],l[14]],u=U.vec3.sub([],c,n),h=U.vec3.length(u),d=U.vec3.normalize([],u),p=e.worldSize/(2*Math.PI),f=U.vec3.dot(d,a),A=Math.asin(p/h);if(A1?null:function(e,t,i,r){const n=Math.sin(i);return e*(Math.sin((1-r)*i)/n)+t*(Math.sin(r*i)/n)}(e.a[t],e.b[t],e.angle,J(i,0,1))+e.center[t]}function Ic(e){if(e.z<=1)return Cc[e.z+2*e.y+e.x];const t=zc(kc(e));return Tc.fromPoints(t)}function Pc(e,t,i){return U.vec3.scale(e,e,1-i),U.vec3.scaleAndAdd(e,e,t,i)}function Lc(e,t,i){for(const r of e)U.vec3.transformMat4(r,r,t),U.vec3.scale(r,r,i)}function Fc(e,t,i,r){const n=t/e.worldSize,o=e.globeMatrix;if(i.z<=1){const e=Ic(i).getCorners();return Lc(e,o,n),Tc.fromPoints(e)}const s=kc(i,r),a=zc(s,Xa+Bc(e._tileCoverLift));Lc(a,o,n);const l=Number.MAX_VALUE,c=[-l,-l,-l],u=[l,l,l];if(s.contains(e.center)){for(const e of a)U.vec3.min(u,u,e),U.vec3.max(c,c,e);c[2]=0;const t=e.point,i=[t.x*n,t.y*n,0];return U.vec3.min(u,u,i),U.vec3.max(c,c,i),new Tc(u,c)}if(e._tileCoverLift>0){for(const e of a)U.vec3.min(u,u,e),U.vec3.max(c,c,e);return new Tc(u,c)}const h=[o[12]*n,o[13]*n,o[14]*n],d=s.getCenter(),p=J(e.center.lat,-vl,vl),f=J(d.lat,-vl,vl),A=fl(e.center.lng),m=Al(p);let g=A-fl(d.lng);const _=m-Al(f);g>.5?g-=1:g<-.5&&(g+=1);let y=0;if(Math.abs(g)>Math.abs(_))y=g>=0?1:3;else{y=_>=0?0:2;const e=[o[4]*n,o[5]*n,o[6]*n],t=-Math.sin(Z(_>=0?s.getSouth():s.getNorth()))*Xa;U.vec3.scaleAndAdd(h,h,e,t)}const v=a[y],x=a[(y+1)%4],b=new Ec(v,x,h),w=[Mc(b,0)||v[0],Mc(b,1)||v[1],Mc(b,2)||v[2]],T=Hc(e.zoom);if(T>0){const r=function({x:e,y:t,z:i},r,n,o,s){const a=1/(1<.5?d=-1:p<-.5&&(d=1),l=((l+d)*r-(o*=r))*n+o,c=((c+d)*r-o)*n+o,u=(u*r-(s*=r))*n+s,h=(h*r-s)*n+s,[[l,h,0],[c,h,0],[c,u,0],[l,u,0]]}(i,t,e._pixelsPerMercatorPixel,A,m);for(let e=0;eMath.PI/2*1.01}const Zc=Z(85),qc=Math.cos(Zc),Kc=Math.sin(Zc),Wc=U.mat4.create(),Xc=e=>{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t};function Yc(e,t,i,r,n,o,s,a,l){if(o&&e.queryGeometry.isAboveHorizon)return!1;o&&(l*=e.pixelToTileUnitsFactor);const c=e.tileID.canonical,u=i.projection.upVectorScale(c,i.center.lat,i.worldSize).metersToTile;for(const h of t)for(const t of h){const h=t.add(a),d=n&&i.elevation?i.elevation.exaggeration()*n.getElevationAt(h.x,h.y,!0):0,p=i.projection.projectTilePoint(h.x,h.y,c);if(d>0){const e=i.projection.upVector(c,h.x,h.y);p.x+=e[0]*u*d,p.y+=e[1]*u*d,p.z+=e[2]*u*d}const f=o?h:Jc(p.x,p.y,p.z,r),A=o?e.tilespaceRays.map((e=>iu(e,d))):e.queryGeometry.screenGeometry,m=U.vec4.transformMat4([],[p.x,p.y,p.z,1],r);if(!s&&o?l*=m[3]/i.cameraToCenterDistance:s&&!o&&(l*=i.cameraToCenterDistance/m[3]),o){const e=_l((t.y/Xi+c.y)/(1<e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const l=e.data,c=t.data,u=4===o&&a;for(let a=0;a{t[e.evaluationKey]=o;const s=e.expression.evaluate(t);s&&(n.data[i+r+0]=Math.floor(255*s.r/s.a),n.data[i+r+1]=Math.floor(255*s.g/s.a),n.data[i+r+2]=Math.floor(255*s.b/s.a),n.data[i+r+3]=Math.floor(255*s.a))};if(e.clips)for(let t=0,n=0;t80*i){a=1/0,l=1/0;let t=-1/0,r=-1/0;for(let o=i;ot&&(t=i),n>r&&(r=n)}c=Math.max(t-a,r-l),c=0!==c?32767/c:0}return bu(o,s,i,a,l,c,0),s}function vu(e,t,i,r,n){let o;if(n===function(e,t,i,r){let n=0;for(let o=t,s=i-r;o0)for(let n=t;n=t;n-=r)o=Qu(n/r|0,e[n],e[n+1],o);return o&&zu(o,o.next)&&(ju(o),o=o.next),o}function xu(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!zu(r,r.next)&&0!==ku(r.prev,r,r.next))r=r.next;else{if(ju(r),r=t=r.prev,r===r.next)break;i=!0}}while(i||r!==t);return t}function bu(e,t,i,r,n,o,s){if(!e)return;!s&&o&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=Iu(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let o=null;for(t=0;n;){t++;let s=n,a=0;for(let e=0;e0||l>0&&s;)0!==a&&(0===l||!s||n.z<=s.z)?(r=n,n=n.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=s}o.nextZ=null,i*=2}while(t>1)}(n)}(e,r,n,o);let a=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?Tu(e,r,n,o):wu(e))t.push(l.i,e.i,c.i),ju(e),e=c.next,a=c.next;else if((e=c)===a){s?1===s?bu(e=Bu(xu(e),t),t,i,r,n,o,2):2===s&&Cu(e,t,i,r,n,o):bu(xu(e),t,i,r,n,o,1);break}}}function wu(e){const t=e.prev,i=e,r=e.next;if(ku(t,i,r)>=0)return!1;const n=t.x,o=i.x,s=r.x,a=t.y,l=i.y,c=r.y,u=no?n>s?n:s:o>s?o:s,p=a>l?a>c?a:c:l>c?l:c;let f=r.next;for(;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&Lu(n,a,o,l,s,c,f.x,f.y)&&ku(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Tu(e,t,i,r){const n=e.prev,o=e,s=e.next;if(ku(n,o,s)>=0)return!1;const a=n.x,l=o.x,c=s.x,u=n.y,h=o.y,d=s.y,p=al?a>c?a:c:l>c?l:c,m=u>h?u>d?u:d:h>d?h:d,g=Iu(p,f,t,i,r),_=Iu(A,m,t,i,r);let y=e.prevZ,v=e.nextZ;for(;y&&y.z>=g&&v&&v.z<=_;){if(y.x>=p&&y.x<=A&&y.y>=f&&y.y<=m&&y!==n&&y!==s&&Lu(a,u,l,h,c,d,y.x,y.y)&&ku(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,v.x>=p&&v.x<=A&&v.y>=f&&v.y<=m&&v!==n&&v!==s&&Lu(a,u,l,h,c,d,v.x,v.y)&&ku(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;y&&y.z>=g;){if(y.x>=p&&y.x<=A&&y.y>=f&&y.y<=m&&y!==n&&y!==s&&Lu(a,u,l,h,c,d,y.x,y.y)&&ku(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;v&&v.z<=_;){if(v.x>=p&&v.x<=A&&v.y>=f&&v.y<=m&&v!==n&&v!==s&&Lu(a,u,l,h,c,d,v.x,v.y)&&ku(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Bu(e,t){let i=e;do{const r=i.prev,n=i.next.next;!zu(r,n)&&Ru(r,i,i.next,n)&&Uu(r,n)&&Uu(n,r)&&(t.push(r.i,i.i,n.i),ju(i),ju(i.next),i=e=n),i=i.next}while(i!==e);return xu(i)}function Cu(e,t,i,r,n,o){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&Fu(s,e)){let a=Nu(s,e);return s=xu(s,s.next),a=xu(a,a.next),bu(s,t,i,r,n,o,0),void bu(a,t,i,r,n,o,0)}e=e.next}s=s.next}while(s!==e)}function Su(e,t){return e.x-t.x}function Eu(e,t){const i=function(e,t){let i=t;const r=e.x,n=e.y;let o,s=-1/0;do{if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const e=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>s&&(s=e,o=i.x=i.x&&i.x>=l&&r!==i.x&&Lu(no.x||i.x===o.x&&Mu(o,i)))&&(o=i,u=t)}i=i.next}while(i!==a);return o}(e,t);if(!i)return t;const r=Nu(i,e);return xu(r,r.next),xu(i,i.next)}function Mu(e,t){return ku(e.prev,e,t.prev)<0&&ku(t.next,e,e.next)<0}function Iu(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Pu(e){let t=e,i=e;do{(t.x=(e-s)*(o-a)&&(e-s)*(r-a)>=(i-s)*(t-a)&&(i-s)*(o-a)>=(n-s)*(r-a)}function Fu(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&Ru(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(Uu(e,t)&&Uu(t,e)&&function(e,t){let i=e,r=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(ku(e.prev,e,t.prev)||ku(e,t.prev,t))||zu(e,t)&&ku(e.prev,e,e.next)>0&&ku(t.prev,t,t.next)>0)}function ku(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function zu(e,t){return e.x===t.x&&e.y===t.y}function Ru(e,t,i,r){const n=Ou(ku(e,t,i)),o=Ou(ku(e,t,r)),s=Ou(ku(i,r,e)),a=Ou(ku(i,r,t));return n!==o&&s!==a||!(0!==n||!Du(e,i,t))||!(0!==o||!Du(e,r,t))||!(0!==s||!Du(i,e,r))||!(0!==a||!Du(i,t,r))}function Du(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function Ou(e){return e>0?1:e<0?-1:0}function Uu(e,t){return ku(e.prev,e,e.next)<0?ku(e,t,e.next)>=0&&ku(e,e.prev,t)>=0:ku(e,t,e.prev)<0||ku(e,e.next,t)<0}function Nu(e,t){const i=Vu(e.i,e.x,e.y),r=Vu(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function Qu(e,t,i,r){const n=Vu(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ju(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Vu(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Hu(e,t){const i=e.length;if(i<=1)return[e];const r=[];let n,o;for(let t=0;t1)for(let e=0;e>3}if(o--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(i&&l.push(i),i=[]),i.push(new e(s,a));else{if(7!==n)throw new Error("unknown command "+n);i&&i.push(i[0].clone())}}return i&&l.push(i),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;e.pos>3}if(r--,1===i||2===i)(n+=e.readSVarint())a&&(a=n),(o+=e.readSVarint())c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[s,l,a,c]},t.prototype.toGeoJSON=function(e,i,n){var o,s,a=this.extent*Math.pow(2,n),l=this.extent*e,c=this.extent*i,u=this.loadGeometry(),h=t.types[this.type];function d(e){for(var t=0;t>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}return Xu=t,t.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 i=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,i,this.extent,this._keys,this._values)},Xu}function oh(){return th||(th=1,ih.VectorTile=function(){if(eh)return Ju;eh=1;var e=nh();function t(t,i,r){if(3===t){var n=new e(r,r.readVarint()+r.pos);n.length&&(i[n.name]=n)}}return Ju=function(e,i){this.layers=e.readFields(t,{},i)},Ju}(),ih.VectorTileFeature=rh(),ih.VectorTileLayer=nh()),ih}var sh=oh();const ah="3d_elevation_id",lh="level";class ch{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(e,t){return this._valid&&e(t(this._geometry)),this}require(e,t,i){return this.get(e,!0,t,i)}optional(e,t,i){return this.get(e,!1,t,i)}success(){return this._valid}get(e,t,i,r){const n=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&void 0!==n?i(r?r(n):n):t&&(this._valid=!1),this}}class uh{constructor(e,t){this.featureFunc=e,this.vertexFunc=t}parseFeature(e,t,i){return this.featureFunc(e,t,i)}parseVertex(e,t,i){return this.vertexFunc(e,t,i)}}const hh=new uh(((e,t,i)=>e.reset(t).require(ah,(e=>{i.id=e})).optional("fixed_height_relative",(e=>{i.constantHeight=e}),ph.decodeRelativeHeight).geometry((e=>{i.bounds=e}),ph.computeBounds).success()),((e,t,i)=>e.reset(t).require(ah,(e=>{i.id=e})).require("elevation_idx",(e=>{i.idx=e})).require("extent",(e=>{i.extent=e})).require("height_relative",(e=>{i.height=e}),ph.decodeRelativeHeight).geometry((e=>{i.position=e}),ph.getPoint).success())),dh=new uh(((e,t,i)=>e.reset(t).require(ah,(e=>{i.id=e})).optional("fixed_height",(e=>{i.constantHeight=e}),ph.decodeMetricHeight).geometry((e=>{i.bounds=e}),ph.computeBounds).success()),((e,t,i)=>e.reset(t).require(ah,(e=>{i.id=e})).require("elevation_idx",(e=>{i.idx=e})).require("extent",(e=>{i.extent=e})).require("height",(e=>{i.height=e}),ph.decodeMetricHeight).geometry((e=>{i.position=e}),ph.getPoint).success()));class ph{static computeBounds(e){const t=new V(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new V(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const r of e[0])t.x>r.x&&(t.x=r.x),t.y>r.y&&(t.y=r.y),i.xe.a(1-i)*e+i*t)(this.vertices[this.edges[i].a].height,this.vertices[this.edges[i].b].height,r)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(0===this.edges.length)return;let t=0,i=Number.POSITIVE_INFINITY,r=0;const n=U.vec2.fromValues(e.x,e.y);for(let e=0;e0?U.vec2.dot(A,f)/m:0,_=J(g,0,1),y=Math.abs((g-_)*this.edgeProps[e].len),v=U.vec2.subtract(U.vec2.create(),n,l),x=y+Math.abs(U.vec2.dot(v,U.vec2.fromValues(s[1],-s[0])));x=0;--t){const i=this.edges[t].a,r=this.edges[t].b,{position:n,height:o,extent:s}=this.vertices[i],{position:a,height:l,extent:c}=this.vertices[r],u=this.vertexProps[i].dir,h=this.vertexProps[r].dir,d=U.vec3.fromValues(n[0]/e,n[1]/e,o),p=U.vec3.fromValues(a[0]/e,a[1]/e,l),f=U.vec3.fromValues(u[1],-u[0],0);U.vec3.scale(f,f,s);const A=U.vec3.fromValues(h[1],-h[0],0);if(U.vec3.scale(A,A,c),this.distSqLines(U.vec3.fromValues(d[0]+.5*f[0],d[1]+.5*f[1],d[2]+.5*f[2]),U.vec3.fromValues(p[0]-.5*A[0],p[1]-.5*A[1],p[2]-.5*A[2]),U.vec3.fromValues(d[0]-.5*f[0],d[1]-.5*f[1],d[2]-.5*f[2]),U.vec3.fromValues(p[0]+.5*A[0],p[1]+.5*A[1],p[2]+.5*A[2]))<=.05*.05)continue;const m=this.vertices.length,g=U.vec2.add(U.vec2.create(),n,a);this.vertices.push({position:U.vec2.scale(g,g,.5),height:.5*(o+l),extent:.5*(s+c)});const _=U.vec2.add(U.vec2.create(),u,h);this.vertexProps.push({dir:U.vec2.normalize(_,_)}),this.edges.splice(t,1),this.edgeProps.splice(t,1),this.edges.push({a:i,b:m}),this.edges.push({a:m,b:r});const y=U.vec2.subtract(U.vec2.create(),this.vertices[m].position,n),v=U.vec2.length(y),x={vec:y,dir:U.vec2.scale(U.vec2.create(),y,1/v),len:v};this.edgeProps.push(x),this.edgeProps.push(x)}}distSqLines(e,t,i,r){const n=U.vec3.subtract(U.vec3.create(),t,e),o=U.vec3.subtract(U.vec3.create(),r,i),s=U.vec3.subtract(U.vec3.create(),e,i),a=U.vec3.dot(n,n),l=U.vec3.dot(n,o),c=U.vec3.dot(n,s),u=U.vec3.dot(o,o),h=U.vec3.dot(o,s),d=a*u-l*l;if(0===d){const t=U.vec3.dot(s,o)/U.vec3.dot(o,o),n=U.vec3.lerp(U.vec3.create(),i,r,t);return U.vec3.squaredDistance(n,e)}const p=(l*h-c*u)/d,f=(a*h-l*c)/d,A=U.vec3.lerp(U.vec3.create(),e,t,p),m=U.vec3.lerp(U.vec3.create(),i,r,f);return U.vec3.squaredDistance(A,m)}}class Ah{constructor(e,t){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(t)||(this.zScale=Math.pow(2,t.z-e.z),this.xOffset=(e.x*this.zScale-t.x)*Xi,this.yOffset=(e.y*this.zScale-t.y)*Xi)}constantElevation(e,t){if(null!=e.constantHeight)return this.computeBiasedHeight(e.constantHeight,t)}pointElevation(e,t,i){const r=this.constantElevation(t,i);return null!=r?r:(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(t.pointElevation(e),i))}computeBiasedHeight(e,t){return t<=0?e:e+t*ee(0,t,e>=0?e:Math.abs(.5*e))}}co(fh,"ElevationFeature");class mh{constructor(){this.polygons=new Map}add(e,...t){this.polygons.has(e)?this.polygons.get(e).push(...t):this.polygons.set(e,t)}merge(e){for(const[t,i]of e.polygons)this.add(t,...i)}}class gh{constructor(){this.portals=[]}static evaluate(e){if(0===e.length)return new gh;let t=[];for(const i of e)t.push(...i.portals);if(0===t.length)return new gh;const i=(e,t)=>e<=0&&t<=0||e>=Xi&&t>=Xi;for(const e of t){const t=e.va,r=e.vb;(i(t.x,r.x)||i(t.y,r.y))&&(e.type="border")}const r=t.filter((e=>"unevaluated"!==e.type)),n=t.filter((e=>"unevaluated"===e.type));if(0===n.length)return new gh;n.sort(((e,t)=>e.hash===t.hash?e.isTunnel===t.isTunnel?0:e.isTunnel?-1:1:e.hashe.hashU.vec3.fromValues(e.coord.x,e.coord.y,e.height)))),[r,n,o,s]=i;this.addTriangles([r,n,o,o,s,r])}getBits(e){return this.view.setFloat32(0,e),BigInt(this.view.getUint32(0))}getVec3Bits(e){return this.getBits(e[0])<<64n|this.getBits(e[1])<<32n|this.getBits(e[2])}}class yh{constructor(e){this.unevaluatedPortals=new gh,this.portalPolygons=new mh,this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Cs,this.vertexNormals=new Ss,this.indexArray=new Vs,this.tileToMeters=Tl(e)}addVertices(e,t){const i=this.unevalVertices.length;for(let i=0;i=n.min.x&&l.x<=n.max.x&&l.y>=n.min.y&&l.y<=n.max.y||c.x>=n.min.x&&c.x<=n.max.x&&c.y>=n.min.y&&c.y<=n.max.y||Kl(l,c,o)))continue;if(this.isOnBorder(l.x,c.x)||this.isOnBorder(l.y,c.y))continue;const u=yh.computeEdgeHash(this.unevalVertices[i],this.unevalVertices[a]);let h,d=this.vertexHashLookup.get(yh.computePosHash(l));null!=d?h=d.next:(d=this.vertexHashLookup.get(yh.computePosHash(c)),h=null!=d?d.prev:u),this.unevalEdges.push({polygonIdx:e,a:i,b:a,hash:u,portalHash:h,isTunnel:r,type:"unevaluated"})}}addPortalCandidates(e,t,i,r,n){if(0===t.length)return;this.portalPolygons.add(e,{geometry:t,zLevel:n});const o=t[0];this.vertexHashLookup.clear();let s=yh.computeEdgeHash(o[o.length-2],o[o.length-1]);for(let t=0;t({vertexOffset:0,primitiveOffset:this.indexArray.length}),i=e=>{e.primitiveLength=this.indexArray.length-e.primitiveOffset},r=new _h(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const n=t(),o=t(),s=t(),a=(e,t)=>{e.sort(((e,i)=>e.type===t&&i.type!==t?-1:e.type!==t&&i.type===t?1:0));const i=e.findIndex((e=>e.type!==t));return i>=0?i:e.length};let l=0;this.unevalEdges.length>0&&(l=a(this.unevalEdges,"none"),this.constructBridgeStructures(r,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},this.tileToMeters));const c=t();if(this.unevalEdges.length>0){const e=this.unevalEdges.splice(l),t=a(e,"tunnel")+l;this.unevalEdges.push(...e),this.constructTunnelStructures(r,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},{min:l,max:t})}i(s),r.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),i(c),r.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),i(o),r.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),i(n),this.maskSegments=_a.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.depthSegments=_a.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength),this.renderableSegments=_a.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.shadowCasterSegments=_a.simpleSegment(0,n.primitiveOffset,0,n.primitiveLength)}upload(e){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,gu.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,_u.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableSegments.destroy(),this.shadowCasterSegments.destroy())}computeVertexConnections(e,t,i,r){const n=new Map;for(let o=i;o0&&(a.to=s),e[r]>0&&(l.from=r)}return n}constructBridgeStructures(e,t,i,r,n,o){const s=this.computeVertexConnections(i,r,n.min,n.max),a=1/o,l=.5*a,c=e=>U.vec3.fromValues(t[e].x,t[e].y,i[e]*a),u=e=>{const t=s.get(e),i=t.from,r=t.to;if(!i||!r)return;const n=c(i),o=c(e),a=c(r),l=U.vec3.fromValues(0,0,0);if(!U.vec3.exactEquals(n,o)){const e=U.vec3.sub(U.vec3.create(),o,n);U.vec3.add(l,l,U.vec3.normalize(e,e))}if(!U.vec3.exactEquals(a,o)){const e=U.vec3.sub(U.vec3.create(),a,o);U.vec3.add(l,l,U.vec3.normalize(e,e))}const u=U.vec3.len(l);return u>0?U.vec3.scale(l,l,1/u):void 0};for(let s=n.min;se>=t));if(null==c)continue;const h=c[0],d=c[1],p=U.vec3.fromValues(h.coord.x,h.coord.y,a*h.height),f=U.vec3.fromValues(d.coord.x,d.coord.y,a*d.height);if(U.vec3.exactEquals(p,f))continue;const A=U.vec3.sub(U.vec3.create(),f,p);U.vec3.normalize(A,A);const m=e=>U.vec3.normalize(e,e),g=u(n.a)||A,_=u(n.b)||A,y=m(U.vec3.fromValues(g[1],-g[0],0)),v=m(U.vec3.fromValues(_[1],-_[0],0)),x=m(U.vec3.cross(U.vec3.create(),y,g)),b=m(U.vec3.cross(U.vec3.create(),v,_)),w=U.vec3.create(),T=[U.vec3.add(U.vec3.create(),p,U.vec3.scale(w,U.vec3.sub(w,y,x),l)),U.vec3.add(U.vec3.create(),p,U.vec3.scale(w,U.vec3.add(w,y,x),l)),U.vec3.add(U.vec3.create(),p,U.vec3.scale(w,x,l)),p],B=[U.vec3.add(U.vec3.create(),f,U.vec3.scale(w,U.vec3.sub(w,v,b),l)),U.vec3.add(U.vec3.create(),f,U.vec3.scale(w,U.vec3.add(w,v,b),l)),U.vec3.add(U.vec3.create(),f,U.vec3.scale(w,b,l)),f],[C,S]=e.addVertices(y,o,T[0],T[1]),[E,M]=e.addVertices(v,o,B[0],B[1]);e.addTriangles([C,S,E,S,M,E]);const[I,P]=e.addVertices(x,o,T[1],T[2]),[L,F]=e.addVertices(b,o,B[1],B[2]);e.addTriangles([I,P,L,P,F,L]);const[k,z]=e.addVertices(U.vec3.negate(y,y),o,T[2],T[3]),[R,D]=e.addVertices(U.vec3.negate(v,v),o,B[2],B[3]);e.addTriangles([k,z,R,z,D,R])}}constructTunnelStructures(e,t,i,r,n,o){const s=e=>U.vec3.normalize(e,e);for(let o=n.min;oe<=t));if(null==n)continue;const[a,l]=n,c=s(U.vec3.fromValues(l.coord.y-a.coord.y,-(l.coord.x-a.coord.x),0));e.addQuad([a,l,{coord:l.coord,height:r[o].isTunnel?-.1:0},{coord:a.coord,height:r[o].isTunnel?-.1:0}],c)}for(let n=o.min;ne.hash===t.hash?t.polygonIdx-e.polygonIdx:t.hash>e.hash?1:-1));let i=0,r=0,n=0,o=t[i].polygonIdx;do{r++,(r===t.length||t[i].hash!==t[r].hash)&&((1==r-i||t[r-1].polygonIdx!==o)&&(ne.hasho.hash?i++:o.hash>n.portalHash?r++:(n.type=o.type,i++)}}}isOnBorder(e,t){return e<=0&&t<=0||e>=Xi&&t>=Xi}static computeEdgeHash(e,t){return(e.y===t.y&&e.x>t.x||e.y>t.y)&&([e,t]=[t,e]),BigInt(yh.computePosHash(e))<<32n|BigInt(yh.computePosHash(t))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}class vh{constructor(e,t){this.layoutVertexArray=new bs,this.indexArray=new Vs,this.lineIndexArray=new Os,this.triangleSegments=new _a,this.lineSegments=new _a,this.programConfigurations=new Ga(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,t&&(this.elevatedLayoutVertexArray=new Bs)}update(e,t,i,r,n,o,s){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Au.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,mu.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,t,i,r,n,o){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,t,i,r,n,o)}}class xh{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.bufferData=new vh(e,!1),this.elevationBufferData=new vh(e,!0),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference")}updateFootprints(e,t){}populate(e,t,i,r){this.hasPattern=Zu("fill",this.layers,this.pixelRatio,t);const n=this.layers[0].layout.get("fill-sort-key"),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=kl(s,e);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),u,i))continue;const h=n?n.evaluate(u,{},i,t.availableImages):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:Fl(s,i,r),patterns:{},sortKey:h};o.push(d)}n&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:s}=r;if(this.hasPattern){const e=qu("fill",this.layers,r,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,{},t.availableImages,t.brightness,t.elevationFeatures);t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,t,i,r,n,o,s){this.bufferData.update(e,t,i,r,n,o,s),this.elevationBufferData.update(e,t,i,r,n,o,s)}addFeatures(e,t,i,r,n,o){for(const n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i,r,o,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,t,i,r,n,o=[],s,a){const l=Hu(t,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(e,l,r,i,a):this.addGeometry(l,this.bufferData),this.bufferData.populatePaintArrays(e,i,n,o,r,s),this.elevationBufferData.populatePaintArrays(e,i,n,o,r,s)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e){this.elevatedStructures&&this.elevatedStructures.construct(e)}addElevatedRoadFeature(e,t,i,r,n){const o=new Array,s=this.getElevationFeature(e,n);if(s){o.push({polygons:t,elevationFeature:s,elevationTileID:i});for(const t of o)if(t.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new yh(t.elevationTileID));const i=t.elevationFeature.isTunnel();let r=0;e.properties.hasOwnProperty(lh)&&(r=+e.properties[lh]);for(const e of t.polygons)this.elevatedStructures.addPortalCandidates(t.elevationFeature.id,e,i,t.elevationFeature,r)}const n=new Ah(i,t.elevationTileID);this.addElevatedGeometry(t.polygons,n,t.elevationFeature,"hd-road-base"===this.elevationMode?0:.05,r)}}else this.addGeometry(t,this.bufferData)}addElevatedGeometry(e,t,i,r,n){const o={elevation:i,elevationSampler:t,bias:r,index:n},[s,a]=this.addGeometry(e,this.elevationBufferData,o);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:s,max:a}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,s),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,a))}addGeometry(e,t,i){let r=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,o=null;i&&(o=i.elevationSampler.constantElevation(i.elevation,i.bias),null!=o&&(r=o,n=o));const s=(e,s,a)=>{if(null!=i)if(s.push(e),null!=o)t.elevatedLayoutVertexArray.emplaceBack(o),a.push(o);else{const o=i.elevationSampler.pointElevation(e,i.elevation,i.bias);t.elevatedLayoutVertexArray.emplaceBack(o),a.push(o),r=Math.min(r,o),n=Math.max(n,o)}};for(const r of e){let e=0;for(const t of r)e+=t.length;const n=t.triangleSegments.prepareSegment(e,t.layoutVertexArray,t.indexArray),o=n.vertexLength,a=[],l=[],c=[],u=[],h=[],d=t.layoutVertexArray.length;for(const e of r){if(0===e.length)continue;e!==r[0]&&l.push(a.length/2);const n=t.lineSegments.prepareSegment(e.length,t.layoutVertexArray,t.lineIndexArray),o=n.vertexLength;i&&h.push(t.layoutVertexArray.length-d),s(e[0],c,u),t.layoutVertexArray.emplaceBack(e[0].x,e[0].y),t.lineIndexArray.emplaceBack(o+e.length-1,o),a.push(e[0].x),a.push(e[0].y);for(let i=1;i0){for(let o=0;oe.id===i)):void 0}}let bh,wh,Th,Bh;co(xh,"FillBucket",{omit:["layers","patternFeatures"]}),co(vh,"FillBufferData"),co(yh,"ElevatedStructures");class Ch{constructor(e,t,i,r){if(this.triangleCount=t.length/3,this.min=new V(0,0),this.max=new V(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;const[n,o]=[e[0].clone(),e[0].clone()];for(let t=1;te.cellIdx-t.cellIdx||e.triIdx-t.triIdx));let c=0;for(;cthis.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const i=Sh(e.x-this.min.x,this.xScale,this.cellsX),r=Sh(e.y-this.min.y,this.yScale,this.cellsY),n=this.cells[r*this.cellsX+i];if(n){this._lazyInitLookup();for(let e=0;ethis.max.x||this.min.x>t.x)return;if(e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const r=Sh(e.x-this.min.x,this.xScale,this.cellsX),n=Sh(t.x-this.min.x,this.xScale,this.cellsX),o=Sh(e.y-this.min.y,this.yScale,this.cellsY),s=Sh(t.y-this.min.y,this.yScale,this.cellsY);for(let e=o;e<=s;e++)for(let t=r;t<=n;t++){const r=this.cells[e*this.cellsX+t];if(r)for(let e=0;ee.fqid)),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.footprints=[]}updateFootprints(e,t){for(const i of this.footprints)t.push({footprint:i,id:e})}populate(e,t,i,r){const n=[];for(const{feature:t,id:o,index:s,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=kl(t,e);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),l,i))continue;const c={id:o,properties:t.properties,type:t.type,sourceLayerIndex:a,index:s,geometry:e?l.geometry:Fl(t,i,r),patterns:{}};n.push(c)}for(const r of n){const{geometry:n,index:o,sourceLayerIndex:s}=r;this.addFeature(r,n,o,i,{},t.availableImages,t.brightness),t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,t,i,r,n,o,s){}destroy(){}addFeature(e,t,i,r,n,o=[],s){for(const e of Hu(t,2)){const t=[],i=[],r=[],n=new V(1/0,1/0),o=new V(-1/0,-1/0);for(const s of e)if(0!==s.length){s!==e[0]&&r.push(i.length/2);for(let e=0;e{e.push(new V(o,i+(o-t)/(r-t)*(n-i)))}:(e,t,i,r,n,o)=>{e.push(new V(t+(o-i)/(n-i)*(r-t),o))};for(const s of e){const e=[];for(const n of s){if(n.length<=2)continue;const s=[];for(let e=0;et&&o(s,a,l,c,u,t):h>i?d=t&&o(s,a,l,c,u,t),d>i&&h<=i&&o(s,a,l,c,u,i)}let a=n[n.length-1];const l=0===r?a.x:a.y;l>=t&&l<=i&&s.push(a),s.length&&(a=s[s.length-1],s[0].x===a.x&&s[0].y===a.y||s.push(s[0]),e.push(s))}e.length&&n.push(e)}return n}function Uh(e,t,i,r){const n="x"===i?"y":"x",o=(r-e[i])/(t[i]-e[i]);e[n]=e[n]+(t[n]-e[n])*o,e[i]=r,e.hasOwnProperty("z")&&(e.z=Et(e.z,t.z,o)),e.hasOwnProperty("w")&&(e.w=Et(e.w,t.w,o))}function Nh(e,t,i,r){const n=i,o=r;for(const i of["x","y"]){let r=e,s=t;r[i]>=s[i]&&(r=t,s=e),r[i]n&&Uh(r,s,i,n),r[i]o&&Uh(s,r,i,o)}}const Qh=Number.MAX_SAFE_INTEGER;function jh(e,t,i,r){return e.ordert===e))}(r,e.clipScope)}function Vh(e,t){return e.x-t.x||e.y-t.y}function Hh(e,t){return 0===Vh(e.min,t.min)&&0===Vh(e.max,t.max)}function Gh(e,t){return!(e.min.x>t.max.x||e.max.xt.max.y||e.max.ynew V((e.x+o.x*Xi)*a-s.x*Xi,(e.y+o.y*Xi)*a-s.y*Xi)))}return Kh(i,n,e.indices,0,e.indices.length,0,0)}function Xh(e,t,i,r){const n=Math.pow(2,r.z-i.z);return new V((e+i.x*Xi)*n-r.x*Xi,(t+i.y*Xi)*n-r.y*Xi)}function Yh(e,t){const i=[];t.grid.queryPoint(e,i);const r=t.indices,n=t.vertices;for(let t=0;t0&&(r.length>1&&i.push(r),r=[])}return r.length>1&&i.push(r),i}const td=sh.VectorTileFeature.types,id=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],rd=["fill-extrusion-flood-light-ground-radius"],nd=Math.pow(2,13),od=Math.pow(2,15)-1,sd=new V(0,1),ad=2147483648;function ld(e,t,i,r,n,o,s,a){e.emplaceBack((t<<1)+s,(i<<1)+o,(Math.floor(r*nd)<<1)+n,Math.round(a))}function cd(e,t,i){e.emplaceBack(t.x*Xi,t.y*Xi,i?1:0)}function ud(e,t,i,r,n,o){e.emplaceBack(t.x,t.y,(i.x<<1)+r,(i.y<<1)+n,o)}function hd(e,t,i){const r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}class dd{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class pd{constructor(){this.centroidXY=new V(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new V(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new V(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new V(this.max.x-this.min.x,this.max.y-this.min.y)}}class fd{constructor(){this.acc=new V(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y)}appendEdge(e,t,i){this.accCount++,this.acc._add(t);let r=!!this.borders;t.xe.max.x&&(e.max.x=t.x,r=!0),t.ye.max.y&&(e.max.y=t.y,r=!0),((0===t.x||t.x===Xi)&&t.x===i.x)!=((0===t.y||t.y===Xi)&&t.y===i.y)&&this.processBorderOverlap(t,i),r&&this.checkBorderIntersection(t,i)}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,Et(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>Xi!=e.x>Xi&&this.addBorderIntersection(1,Et(t.y,e.y,(Xi-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Et(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>Xi!=e.y>Xi&&this.addBorderIntersection(3,Et(t.x,e.x,(Xi-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const i=this.borders[e];ti[1]&&(i[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{const i=0===e.y?2:3;this.addBorderIntersection(i,t.x),this.addBorderIntersection(i,e.x)}}centroid(){return 0===this.accCount?new V(0,0):new V(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce(((e,t)=>e+ +(t[0]!==Number.MAX_VALUE)),0):0}}function Ad(e,t){const i=e.add(t)._unit(),r=J(e.x*i.x+e.y*i.y,-1,1);var n,o,s;return s=Math.acos(r),Math.min(4,Math.max(-4,Math.tan(s)))/4*od*((n=e).x*(o=t).y-n.y*o.x<0?-1:1)}const md=[e=>e.x<0,e=>e.x>Xi,e=>e.y<0,e=>e.y>Xi];function gd(e,t,i,r){const n=[4];if(0===r)return n;i._mult(r);const o=e.sub(i),s=t.sub(i),a=[e,t,o,s];for(let e=0;e<4;e++)for(const t of a)if(md[e](t)){n.push(e);break}return n}class _d{constructor(e){this.vertexArray=new Es,this.indexArray=new Vs,this.programConfigurations=new Ga(e.layers,{zoom:e.zoom,lut:e.lut},(e=>rd.includes(e))),this._segments=new _a,this.hiddenByLandmarkVertexArray=new ia,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new _a}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,t,i,r=!1){const n=e.length;if(n>2){let o=Math.max(0,this._segments.get().length-1);const s=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[o].length);let a;o!==this._segments.get().length-1&&(o++,this._segmentToGroundQuads[o]=[],this._segmentToRegionTriCounts[o]=[0,0,0,0,0]);{const t=e[0],i=e[1];a=Ad(t.sub(e[n-1])._perp()._unit(),i.sub(t)._perp()._unit())}for(let l=0;le.region-t.region));for(let i=0;ie+t),0);let o=0;for(let e=0;e<=4;e++){const t=n[e];if(0!==t){let i=this.regionSegments[e];i||(i=this.regionSegments[e]=new _a);const n={vertexOffset:r.vertexOffset,primitiveOffset:r.primitiveOffset+o,vertexLength:r.vertexLength,primitiveLength:t};i.get().push(n)}o+=t}for(let e=0;e0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Fh.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy()}}}}class yd{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Vs,this.footprintVertices=new bs,this.footprintSegments=[],this.layoutVertexArray=new Ts,this.centroidVertexArray=new pa,this.wallVertexArray=new Aa,this.indexArray=new Vs,this.programConfigurations=new Ga(e.layers,{zoom:e.zoom,lut:e.lut},(e=>id.includes(e))),this.segments=new _a,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.groundEffect=new _d(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,t){}populate(e,t,i,r){this.features=[],this.hasPattern=Zu("fill-extrusion",this.layers,this.pixelRatio,t),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Tl(i),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1);for(const{feature:n,id:o,index:s,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=kl(n,e);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),l,i))continue;const c={id:o,sourceLayerIndex:a,index:s,geometry:e?l.geometry:Fl(n,i,r),properties:n.properties,type:n.type,patterns:{}},u=this.layoutVertexArray.length,h="Polygon"===td[c.type];if(this.hasPattern)this.features.push(qu("fill-extrusion",this.layers,c,this.zoom,this.pixelRatio,t));else if(this.wallMode)for(const e of c.geometry)for(const n of ed(e,h))this.addFeature(c,[n],s,i,{},t.availableImages,r,t.brightness);else this.addFeature(c,c.geometry,s,i,{},t.availableImages,r,t.brightness);t.featureIndex.insert(n,c.geometry,s,a,this.index,u)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,t,i,r,n,o){for(const e of this.features){const s="Polygon"===td[e.type],{geometry:a}=e;if(this.wallMode)for(const l of a)for(const a of ed(l,s))this.addFeature(e,[a],e.index,t,i,r,n,o);else this.addFeature(e,a,e.index,t,i,r,n,o)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,t,i,r,n,o,s){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s),this.groundEffect.update(e,t,n,i,r,o,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,zh),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,Lh.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,kh.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Ph.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,r,n,o,s,a){const l=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,c=[new V(0,0),new V(Xi,Xi)],u=s.projection,h="globe"===u.name,d=this.wallMode||"Polygon"===td[e.type],p=new fd;p.centroidDataIndex=this.centroidData.length;const f=new pd,A=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},r)<=0,m=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},r);let g;if(f.height=m,f.vertexArrayOffset=this.layoutVertexArray.length,f.groundVertexArrayOffset=this.groundEffect.vertexArray.length,h&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Fs),this.wallMode){if(h)return void de("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==t.length)return;g=function(e){const t=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,i=function(e){let t=0;const i=e.length;for(let r=0;r=0}(e);i||(e=e.reverse());const r={geometry:[],joinNormals:[],indices:[]},n=[],o=[],s=[];let a=e.length;for(;a>=2&&e[a-1].equals(e[a-2]);)a--;if(a<(t?3:2))return r;let l,c,u,h,d,p=0;for(;p0;let g="miter";const _=2;"miter"===g&&A>_&&(g="bevel"),"bevel"===g&&(A>100&&(g="flipbevel"),A<_&&(g="miter"));const y=(e,t,i,r)=>{const a=new V(e.x,e.y),l=new V(e.x,e.y);a.x+=t.x*r,a.y+=t.y*r,l.x-=t.x*Math.max(i,1),l.y-=t.y*Math.max(i,1),s.push(t),n.push(a),o.push(l)};if("miter"===g)r._mult(A),y(l,r,0,0);else if("flipbevel"===g)r=d.mult(-1),y(l,r,0,0),y(l,r.mult(-1),0,0);else{const e=-Math.sqrt(A*A-1),t=m?e:0,i=m?0:e;c&&y(l,h,t,i),u&&y(l,d,t,i)}}r.geometry=[...n,...o.reverse(),n[0]],r.joinNormals=[...s,...s.reverse(),s[s.length-1]];const f=r.geometry.length-1;for(let e=0;ee<(t.length-1)/2||e===t.length-1,y=this.wallMode?[t]:Hu(t,500);for(let e=y.length-1;e>=0;e--){const t=y[e];(0===t.length||(v=t[0]).every((e=>e.x<=0))||v.every((e=>e.x>=Xi))||v.every((e=>e.y<=0))||v.every((e=>e.y>=Xi)))&&y.splice(e,1)}var v;let x;if(h)x=Ed(y,c,r);else{x=[];for(const e of y)x.push({polygon:e,bounds:c})}const b=d?this.edgeRadius:0,w=b>0&&this.zoom<17,T=(e,t)=>{if(0===e.length)return!1;const i=e[e.length-1];return t.x===i.x&&t.y===i.y};for(const{polygon:e,bounds:t}of x){let i=0,n=0;for(const t of e)d&&!t[0].equals(t[t.length-1])&&t.push(t[0]),n+=d?t.length-1:t.length;const o=this.segments.prepareSegment((d?5:4)*n,this.layoutVertexArray,this.indexArray);f.footprintSegIdx<0&&(f.footprintSegIdx=this.footprintSegments.length),f.polygonSegIdx<0&&(f.polygonSegIdx=this.polygonSegments.length);const s={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},a=new dd;if(a.vertexOffset=this.footprintVertices.length,a.indexOffset=3*this.footprintIndices.length,a.ringIndices=[],d){const n=[],s=[];i=o.vertexLength;for(let i=0;i4&&Bd(s[s.length-2],s[0],s[1]),c=b?xd(s[s.length-2],s[0],s[1],b):0;const m=[];let y,v,x;v=s[1].sub(s[0])._perp()._unit();let w=!0;for(let e=1,n=0;e0?1:0,M=l.dist(d);if(n+M>32768&&(n=0),b){x=B.sub(d)._perp()._unit();let e=bd(l,d,B,vd(v,x),b);isNaN(e)&&(e=0);const t=d.sub(l)._unit();l=l.add(t.mult(c))._round(),d=d.add(t.mult(-e))._round(),c=e,v=x,A&&this.zoom>=17&&(T(m,l)||m.push(l),T(m,d)||m.push(d))}const I=o.vertexLength,P=s.length>4&&Bd(l,d,B);let L=Cd(n,a,w);if(ld(this.layoutVertexArray,l.x,l.y,S,E,0,0,L),ld(this.layoutVertexArray,l.x,l.y,S,E,0,1,L),this.wallMode){const t=_(e-1,s),i=g.joinNormals[e-1];cd(this.wallVertexArray,i,t),cd(this.wallVertexArray,i,t)}if(n+=M,L=Cd(n,P,!w),a=P,ld(this.layoutVertexArray,d.x,d.y,S,E,0,0,L),ld(this.layoutVertexArray,d.x,d.y,S,E,0,1,L),this.wallMode){const t=_(e,s),i=g.joinNormals[e];cd(this.wallVertexArray,i,t),cd(this.wallVertexArray,i,t)}if(o.vertexLength+=4,this.indexArray.emplaceBack(I+0,I+1,I+2),this.indexArray.emplaceBack(I+1,I+3,I+2),o.primitiveLength+=2,b){const r=i+(1===e?s.length-2:e-2),n=1===e?i:r+1;if(this.indexArray.emplaceBack(I+1,r,I+3),this.indexArray.emplaceBack(r,n,I+3),o.primitiveLength+=2,void 0===y&&(y=I),!wd(B,s[e],t)){const t=e===s.length-1?y:o.vertexLength;this.indexArray.emplaceBack(I+2,I+3,t),this.indexArray.emplaceBack(I+3,t+1,t),this.indexArray.emplaceBack(I+3,n,t+1),o.primitiveLength+=3}w=!w}if(h){const e=this.layoutVertexExtArray,t=u.projectTilePoint(l.x,l.y,r),i=u.projectTilePoint(d.x,d.y,r),n=u.upVector(r,l.x,l.y),o=u.upVector(r,d.x,d.y);hd(e,t,n),hd(e,t,n),hd(e,i,o),hd(e,i,o)}}d&&(i+=s.length-1),A&&b&&this.zoom>=17&&(0!==m.length&&T(m,m[0])&&m.pop(),this.groundEffect.addData(m,t,l,b>0))}this.footprintSegments.push(a),s.triangleCount=this.indexArray.length-s.triangleArrayOffset,this.polygonSegments.push(s),++f.footprintSegLen,++f.polygonSegLen}if(f.vertexCount=this.layoutVertexArray.length-f.vertexArrayOffset,f.groundVertexCount=this.groundEffect.vertexArray.length-f.groundVertexArrayOffset,0!==f.vertexCount){if(f.centroidXY=p.borders?sd:this.encodeCentroid(p,f),this.centroidData.push(f),p.borders){this.featuresOnBorder.push(p);const e=this.featuresOnBorder.length-1;for(let t=0;tthis.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[i].borders[e][0]))}splitToSubtiles(){const e=[];for(let t=0;tXi),n=2*r+(+(i.min.x+i.max.x>Xi)^r);for(let r=0;re.triangleSegmentIdx===t.triangleSegmentIdx?e.subtile-t.subtile:e.triangleSegmentIdx-t.triangleSegmentIdx));let i=0,r=0,n=0;for(const t of e){if(t.triangleSegmentIdx!==i)break;n++}const o=e.length;for(;r!==e.length;){i=e[r].triangleSegmentIdx;let s=0,a=r,l=r;for(let t=a;t0&&this.triangleSubSegments.push({segment:u,min:o,max:c}),a=l;for(let t=a;t[e[0]*(1-i[0])+t[0]*i[0],e[1]*(1-i[1])+t[1]*i[1]],d=[],p=[];for(const e of this.triangleSubSegments){d[0]=e.min.x/Xi,d[1]=e.min.y/Xi,p[0]=e.max.x/Xi,p[1]=e.max.y/Xi;const t=h(c,u,d),s=h(c,u,p);if(0===new Tc([t[0],t[1],n],[s[0],s[1],o]).intersectsPrecise(i)){l&&(r.segments.push(l),l=void 0);continue}const a=e.segment;l&&l.vertexOffset!==a.vertexOffset&&(r.segments.push(l),l=void 0),l?(l.vertexLength+=a.vertexLength,l.primitiveLength+=a.primitiveLength):l={vertexOffset:a.vertexOffset,primitiveLength:a.primitiveLength,vertexLength:a.vertexLength,primitiveOffset:a.primitiveOffset,sortKey:void 0,vaos:{}}}return l&&r.segments.push(l),r}encodeCentroid(e,t){const i=e.centroid(),r=t.span(),n=Math.min(7,Math.round(r.x*this.tileToMeter/10)),o=Math.min(7,Math.round(r.y*this.tileToMeter/10));return new V(J(i.x,1,Xi-1)<<3|n,J(i.y,1,Xi-1)<<3|o)}encodeBorderCentroid(e){if(!e.borders)return new V(0,0);const t=e.borders,i=Number.MAX_VALUE;if(t[0][0]!==i||t[1][0]!==i){const e=t[0][0]!==i?0:1;return new V(6|(t[0][0]!==i?0:65528),(t[e][0]+t[e][1])/2<<3|6)}{const e=t[2][0]!==i?2:3;return new V((t[e][0]+t[e][1])/2<<3|6,6|(t[2][0]!==i?0:65528))}}showCentroid(e){const t=this.centroidData[e.centroidDataIndex];t.flags&=ad,t.centroidXY.x=0,t.centroidXY.y=0,this.writeCentroidToBuffer(t)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,i=e.vertexCount+e.vertexArrayOffset,r=e.flags&ad?sd:e.centroidXY,n=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==r.y||n!==r.x){for(let e=t;ei.max.x||i.min.x>t.max.x||t.min.y>i.max.y||i.min.y>t.max.y))for(let o=0;ot!=l>t&&e<(this.footprintVertices.int16[2*(a+o.vertexOffset)+0]-i)*(t-s)/(l-s)+i&&(r=!r)}s=i}}return r}getHeightAtTileCoord(e,t){let i=Number.NEGATIVE_INFINITY,r=!0;const n=4*(e+Xi)*Xi+(t+Xi);if(this.partLookup.hasOwnProperty(n)){const e=this.partLookup[n];return e?{height:e.height,hidden:!!(e.flags&ad)}:void 0}for(const o of this.centroidData)e>o.max.x||o.min.x>e||t>o.max.y||o.min.y>t||this.footprintContainsPoint(e,t,o)&&o&&o.height>i&&(i=o.height,this.partLookup[n]=o,r=!!(o.flags&ad));if(i!==Number.NEGATIVE_INFINITY)return{height:i,hidden:r};this.partLookup[n]=void 0}}function vd(e,t){const i=e.add(t)._unit();return e.x*i.x+e.y*i.y}function xd(e,t,i,r){const n=t.sub(e)._perp()._unit(),o=i.sub(t)._perp()._unit();return bd(e,t,i,vd(n,o),r)}function bd(e,t,i,r,n){const o=Math.sqrt(1-r*r);return Math.min(e.dist(t)/3,t.dist(i)/3,n*o/r)}function wd(e,t,i){return e.xi[1].x&&t.x>i[1].x||e.yi[1].y&&t.y>i[1].y}function Td(e,t){return e.xt[1].x||e.yt[1].y}function Bd(e,t,i){if(e.x<0||e.x>=Xi||t.x<0||t.x>=Xi||i.x<0||i.x>=Xi)return!1;const r=i.sub(t),n=r.perp(),o=e.sub(t);return(r.x*o.x+r.y*o.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y<0}function Cd(e,t,i){const r=t?2|e:-3&e;return i?1|r:-2&r}function Sd(){const e=Math.PI/32,t=Math.tan(e),i=al;return i*Math.sqrt(1+2*t*t)-i}function Ed(e,t,i){const r=1<{for(const i of e)s.push({polygon:i,bounds:t})},l=Math.ceil(Math.log2(i)),c=Math.ceil(Math.log2(r)),u=l-c,h=[];for(let e=0;e0?0:1);for(let e=0;et+1?p.push({polygons:d,bounds:e,depth:t+1}):a(d,e)}if(f.length){const e=[new V(0===i?u:r.x,1===i?u:r.y),s];h.length>t+1?p.push({polygons:f,bounds:e,depth:t+1}):a(f,e)}}return s}(e,t,Math.ceil((o-n)/11.25),Math.ceil((s-a)/11.25),1,((e,t,n)=>{if(0===e)return.5*(t+n);{const e=_l((i.y+t/Xi)/r);return(Al(.5*(_l((i.y+n/Xi)/r)+e))*r-i.y)*Xi}}))}function Md(e,t,i,r,n,o){const s=Math.pow(2,r.z-n.z);for(let a=0;a1&&(s=e[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),u=Math.min(l,c);let h;const d=t/i*(r+1);if(s.isDash){const e=r-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=r-Math.sqrt(u*u+d*d);this.image.data[n+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,t){for(let t=e.length-1;t>=0;--t){const i=e[t],r=e[t+1];i.zeroLength?e.splice(t,1):r&&r.isDash===i.isDash&&(r.left=i.left,e.splice(t,1))}const i=e[0],r=e[e.length-1];i.isDash===r.isDash&&(i.left=r.left-this.width,r.right=i.right+this.width);const n=this.width*this.nextRow;let o=0,s=e[o];for(let i=0;i1&&(s=e[++o]);const r=Math.abs(i-s.left),a=Math.abs(i-s.right),l=Math.min(r,a);this.image.data[n+i]=Math.max(0,Math.min(255,(s.isDash?l:-l)+t+128))}}addDash(e,t){const i=this.getKey(e,t);if(this.positions[i])return this.positions[i];const r="round"===t,n=r?7:0,o=2*n+1;if(this.nextRow+o>this.height)return de("LineAtlas out of space"),null;0===e.length&&e.push(1);let s=0;for(let t=0;te.fqid)),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new Ms,this.layoutVertexArray2=new Is,this.patternVertexArray=new Is,this.indexArray=new Vs,this.programConfigurations=new Ga(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new _a,this.maxLineLength=0,this.zOffsetVertexArray=new Is,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.tessellationStep=e.tessellationStep?e.tessellationStep:Xi/64}updateFootprints(e,t){}populate(e,t,i,r){this.hasPattern=Zu("line",this.layers,this.pixelRatio,t);const n=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Tl(i);const o=this.layers[0].layout.get("line-z-offset"),s=o.isConstant()&&!o.constantOr(0),a=this.layers[0].layout.get("line-elevation-reference");this.hasZOffset="sea"===a||"ground"===a||!s&&"none"===a,this.hasZOffset&&"none"===a&&de(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`);const l=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.hasZOffset&&void 0!==l;const c=[];for(const{feature:t,id:o,index:s,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=kl(t,e);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),l,i))continue;const u=n?n.evaluate(l,{},i):void 0,h={id:o,properties:t.properties,type:t.type,sourceLayerIndex:a,index:s,geometry:e?l.geometry:Fl(t,i,r),patterns:{},sortKey:u};c.push(h)}n&&c.sort(((e,t)=>e.sortKey-t.sortKey));const{lineAtlas:u,featureIndex:h}=t,d=this.addConstantDashes(u);for(const r of c){const{geometry:n,index:o,sourceLayerIndex:s}=r;if(d&&this.addFeatureDashes(r,u),this.hasPattern){const e=qu("line",this.layers,r,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,u.positions,t.availableImages,t.brightness);h.insert(e[o].feature,n,o,s,this.index)}}addConstantDashes(e){let t=!1;for(const i of this.layers){const r=i.paint.get("line-dasharray").value,n=i.layout.get("line-cap").value;if("constant"!==r.kind||"constant"!==n.kind)t=!0;else{const t=n.value,i=r.value;if(!i)continue;e.addDash(i,t)}}return t}addFeatureDashes(e,t){const i=this.zoom;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,o=r.layout.get("line-cap").value;if("constant"===n.kind&&"constant"===o.kind)continue;let s,a;if("constant"===n.kind){if(s=n.value,!s)continue}else s=n.evaluate({zoom:i},e);a="constant"===o.kind?o.value:o.evaluate({zoom:i},e),t.addDash(s,a),e.patterns[r.id]=t.getKey(s,a)}}update(e,t,i,r,n,o,s){this.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s)}addFeatures(e,t,i,r,n,o){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,i,r,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Ud)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,Qd)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Rd.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Dd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,i,r,n,o,s){const a=this.layers[0].layout,l=a.get("line-join").evaluate(e,{}),c=a.get("line-cap").evaluate(e,{}),u=a.get("line-miter-limit"),h=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=a.get("line-z-offset").value;const d=this.layers[0].paint.get("line-width").value;"constant"!==d.kind&&!1===d.isLineProgressConstant&&(this.variableWidthValue=d);for(const i of t)this.addLine(i,e,r,l,c,u,h);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,o,r,s)}addLine(e,t,i,r,n,o,s){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;const a="none"===r;if(this.patternJoinNone=this.hasPattern&&a,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t=2&&e[c-1].equals(e[c-2]);)c--;let u=0;for(;u0,C=this.overscaling<=16?15*Xi/(512*this.overscaling):0;if(i&&"round"===_)if(bo&&(_="bevel"),"bevel"===_&&(b>2&&(_="flipbevel"),b2*C){const t=d.sub(d.sub(p)._mult(C/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,A,0,0,h,g),p=t}this.updateDistance(p,d),v._mult(b),this.addCurrentVertex(d,v,0,0,h,g);const t=d.dist(f);if(t>2*C){const e=d.add(f.sub(d)._mult(C/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,m,0,0,h,g),d=e}}else v._mult(b),this.addCurrentVertex(d,v,0,0,h,g);else if("flipbevel"===_){if(b>100)v=m.mult(-1);else{const e=b*A.add(m).mag()/A.sub(m).mag();v._perp()._mult(e*(B?-1:1))}this.addCurrentVertex(d,v,0,0,h,g),this.addCurrentVertex(d,v.mult(-1),0,0,h,g)}else if("bevel"===_||"fakeround"===_){null!=g&&p&&this.addCurrentVertex(d,A,-1,-1,h,g);const e=d.dist(p)<=2*C&&"bevel"!==_,t=v.mult(B?1:-1);t._mult(b);const i=m.mult(B?-1:1),r=A.mult(B?-1:1),n=this.evaluateLineProgressFeatures(this.distance);if(null==g&&(this.addHalfVertex(d,t.x,t.y,!1,!B,0,h,n),e||this.addHalfVertex(d,t.x+2*r.x,t.y+2*r.y,!1,B,0,h,n)),"fakeround"===_){const e=Math.round(180*w/Math.PI/20);this.addHalfVertex(d,r.x,r.y,!1,B,0,h,n);for(let t=0;t1){this.lineSoFar=e.w;const d=(t.x-e.x)/u,p=(t.y-e.y)/u,f=(t.z-e.z)/u,A=(t.w-e.w)/u;for(let t=1;t=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),a.primitiveLength++),o?this.e2=c:this.e1=c,null!=l&&this.zOffsetVertexArray.emplaceBack(l.zOffset,l.variableWidth,l.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,t){this.prevDistance=this.distance,this.distance+=e.dist(t),this.updateScaledDistance()}}function Zd(e,t,i){return e.xi||e.yi}let qd,Kd;function Wd(e,t,i){return t*(Xi/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}co($d,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Xd=(e,t,i)=>(1-i)*e+i*t;function Yd(e,t){return 1/Wd(e,1,t.tileZoom)}function Jd(e,t,i,r){return e.translatePosMatrix(r||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const ep=e=>{const t=[];tp(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");const i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&t.push("RENDER_LINE_BORDER");const r="none"===e.layout.get("line-join").constantOr("miter"),n=!!e.paint.get("line-pattern").constantOr(1);return r&&n&&t.push("LINE_JOIN_NONE"),t};function tp(e){const t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}let ip;const rp=()=>ip||(ip={layout:qd||(qd=new Ko({"line-cap":new Zo(Wo.layout_line["line-cap"]),"line-join":new Zo(Wo.layout_line["line-join"]),"line-miter-limit":new $o(Wo.layout_line["line-miter-limit"]),"line-round-limit":new $o(Wo.layout_line["line-round-limit"]),"line-sort-key":new Zo(Wo.layout_line["line-sort-key"]),"line-z-offset":new Zo(Wo.layout_line["line-z-offset"]),"line-elevation-reference":new $o(Wo.layout_line["line-elevation-reference"]),"line-cross-slope":new $o(Wo.layout_line["line-cross-slope"]),visibility:new $o(Wo.layout_line.visibility),"line-width-unit":new $o(Wo.layout_line["line-width-unit"])})),paint:Kd||(Kd=new Ko({"line-opacity":new Zo(Wo.paint_line["line-opacity"]),"line-color":new Zo(Wo.paint_line["line-color"]),"line-translate":new $o(Wo.paint_line["line-translate"]),"line-translate-anchor":new $o(Wo.paint_line["line-translate-anchor"]),"line-width":new Zo(Wo.paint_line["line-width"]),"line-gap-width":new Zo(Wo.paint_line["line-gap-width"]),"line-offset":new Zo(Wo.paint_line["line-offset"]),"line-blur":new Zo(Wo.paint_line["line-blur"]),"line-dasharray":new Zo(Wo.paint_line["line-dasharray"]),"line-pattern":new Zo(Wo.paint_line["line-pattern"]),"line-gradient":new qo(Wo.paint_line["line-gradient"]),"line-trim-offset":new $o(Wo.paint_line["line-trim-offset"]),"line-trim-fade-range":new $o(Wo.paint_line["line-trim-fade-range"]),"line-trim-color":new $o(Wo.paint_line["line-trim-color"]),"line-emissive-strength":new $o(Wo.paint_line["line-emissive-strength"]),"line-border-width":new Zo(Wo.paint_line["line-border-width"]),"line-border-color":new Zo(Wo.paint_line["line-border-color"]),"line-occlusion-opacity":new $o(Wo.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"})}))},ip);class np extends Zo{possiblyEvaluate(e,t){return t=new Do(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=re({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}let op;function sp(e,t){return t>0?t+2*e:e}const ap=vs([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),lp=vs([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),cp=vs([{name:"a_projected_pos",components:4,type:"Float32"}],4);vs([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const up=vs([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),hp=vs([{name:"a_texb",components:2,type:"Uint16"}]),dp=vs([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),pp=vs([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);vs([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const fp=vs([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ap=vs([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);vs([{name:"triangle",components:3,type:"Uint16"}]),vs([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"},{type:"Uint8",name:"flipState"}]),vs([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}]),vs([{type:"Float32",name:"offsetX"}]),vs([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var mp=24;const gp=128;function _p(e,t,i,r,n){if("camera"===e.kind)return e.maxSize;if("composite"===e.kind){const r=t.possiblyEvaluate(new Do(e.maxZoom),i).evaluate(n,{},i),o=t.possiblyEvaluate(new Do(e.minZoom),i).evaluate(n,{},i);return Math.max(r,o)}return t.possiblyEvaluate(new Do(r)).evaluate(n,{},i)}function yp(e,t){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Do(e+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:r}=i;let n=0;for(;n{e.text=function(e,t,i){const r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),Ro.applyArabicShaping&&(e=Ro.applyArabicShaping(e)),e}(e.text,t,i)})),e}const Tp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Bp(e){return"︶"===e||"﹈"===e||"︸"===e||"﹄"===e||"﹂"===e||"︾"===e||"︼"===e||"︺"===e||"︘"===e||"﹀"===e||"︐"===e||"︓"===e||"︔"===e||"`"===e||" ̄"===e||"︑"===e||"︒"===e}function Cp(e){return"︵"===e||"﹇"===e||"︷"===e||"﹃"===e||"﹁"===e||"︽"===e||"︻"===e||"︹"===e||"︗"===e||"︿"===e}var Sp,Ep,Mp,Ip={}; -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function Pp(){return Sp||(Sp=1,Ip.read=function(e,t,i,r,n){var o,s,a=8*n-r-1,l=(1<>1,u=-7,h=i?n-1:0,d=i?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},Ip.write=function(e,t,i,r,n,o){var s,a,l,c=8*o-n-1,u=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,A=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*l-1)*Math.pow(2,n),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;e[i+p]=255&a,p+=f,a/=256,n-=8);for(s=s<0;e[i+p]=255&s,p+=f,s/=256,c-=8);e[i+p-f]|=128*A}),Ip}function Lp(){if(Mp)return Ep;Mp=1,Ep=t;var e=Pp();function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var i=4294967296,r=1/i,n="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function o(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function a(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function l(e,t){for(var i=0;i>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos>3,o=this.pos;this.type=7&r,e(n,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=g(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=g(this.buf,this.pos)+g(this.buf,this.pos+4)*i;return this.pos+=8,e},readSFixed64:function(){var e=g(this.buf,this.pos)+y(this.buf,this.pos+4)*i;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return s(e,r,t);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return s(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&n?function(e,t,i){return n.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var r="",n=t;n239?4:l>223?3:l>191?2:1;if(n+u>i)break;1===u?l<128&&(c=l):2===u?128==(192&(o=e[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(s=e[n+2],128==(192&(o=e[n+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(s=e[n+2],a=e[n+3],128==(192&(o=e[n+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,u=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=u}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,i){if(this.type!==t.Bytes)return e.push(this.readVarint(i));var r=o(this);for(e=e||[];this.pos127;);else if(i===t.Bytes)this.pos=this.readVarint()+this.pos;else if(i===t.Fixed32)this.pos+=4;else{if(i!==t.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,o=0;o55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&a(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i=128&&a(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,i,r){this.writeTag(e,t.Bytes),this.writeRawMessage(i,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,l,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,c,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,d,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,u,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,h,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,p,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,A,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,m,t)},writeBytesField:function(e,i){this.writeTag(e,t.Bytes),this.writeBytes(i)},writeFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeSFixed64(i)},writeVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeVarint(i)},writeSVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeSVarint(i)},writeStringField:function(e,i){this.writeTag(e,t.Bytes),this.writeString(i)},writeFloatField:function(e,i){this.writeTag(e,t.Fixed32),this.writeFloat(i)},writeDoubleField:function(e,i){this.writeTag(e,t.Fixed64),this.writeDouble(i)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},Ep}var Fp=t(Lp());const kp=3;function zp(e,t,i){t.glyphs=[],1===e&&i.readMessage(Rp,t)}function Rp(e,t,i){if(3===e){const{id:e,bitmap:r,width:n,height:o,left:s,top:a,advance:l}=i.readMessage(Dp,{});t.glyphs.push({id:e,bitmap:new hu({width:n+2*kp,height:o+2*kp},r),metrics:{width:n,height:o,left:s,top:a,advance:l}})}else 4===e?t.ascender=i.readSVarint():5===e&&(t.descender=i.readSVarint())}function Dp(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}const Op=kp,Up={horizontal:1,vertical:2,horizontalOnly:3};class Np{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,t){const i=new Np;return i.scale=e||1,i.fontStack=t,i}static forImage(e){const t=new Np;return t.image=e,t}}class Qp{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t,i){const r=new Qp;for(let n=0;n=0&&i>=e&&Vp[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const i=new Qp;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Np.forText(e.scale,e.fontStack||t));const i=this.sections.length-1;for(let t=0;t=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function jp(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A=1){const m=Qp.fromFeature(e,n,A);h===Up.vertical&&m.verticalizePunctuation(d);let g=[];const _=function(e,t,i,r,n,o){if(!e)return[];const s=[],a=function(e,t,i,r,n,o){let s=0;for(let i=0;i=0;let c=0;for(let i=0;i0&&o>x&&(x=o)}else{const e=i[a.fontStack];if(!e)continue;e[A]&&(T=e[A]);const r=t[a.fontStack];if(!r)continue;const o=r.glyphs[A];if(!o)continue;if(y=o.metrics,C=8203!==A?mp:0,m){const e=void 0!==r.ascender?Math.abs(r.ascender):0,t=void 0!==r.descender?Math.abs(r.descender):0,i=(e+t)*g;b-i/2;){if(s--,s<0)return!1;a-=e[s].dist(o),o=e[s]}a+=e[s].dist(e[s+1]),s++;const l=[];let c=0;for(;ar;)c-=l.shift().angleDelta;if(c>n)return!1;s++,a+=t.dist(i)}return!0}function rf(e){let t=0;for(let i=0;ic){const u=(c-l)/o,h=Et(r.x,n.x,u),d=Et(r.y,n.y,u),p=new ef(h,d,0,n.angleTo(r),i);return!s||tf(e,p,a,s,t)?p:void 0}l+=o}}function af(e,t,i,r,n,o,s,a,l){const c=nf(r,o,s),u=of(r,n),h=u*s,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h=0&&g=0&&_=0&&d+c<=u){const i=new ef(g,_,0,A,t);r&&!tf(e,i,o,r,n)||p.push(i)}}h+=f}return a||p.length||s||(p=lf(e,h/2,i,r,n,o,s,!0,l)),p}function cf(e,t,i,r,n){const o=[];for(let s=0;s=r&&c.x>=r||(s.x>=r?s=new V(r,s.y+(r-s.x)/(c.x-s.x)*(c.y-s.y))._round():c.x>=r&&(c=new V(r,s.y+(r-s.x)/(c.x-s.x)*(c.y-s.y))._round()),s.y>=n&&c.y>=n||(s.y>=n?s=new V(s.x+(n-s.y)/(c.y-s.y)*(c.x-s.x),n)._round():c.y>=n&&(c=new V(s.x+(n-s.y)/(c.y-s.y)*(c.x-s.x),n)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(c)))))}}return o}function uf(e){let t=0,i=0;for(const r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort(((e,t)=>t.h-e.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,o=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const i=r[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,o=Math.max(o,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===i.w&&t.h===i.h){const t=r.pop();e1?s-1:s,du.copy(r.data,l,{x:0,y:0},{x:a,y:c},r.data,i),du.copy(r.data,l,{x:0,y:h-s},{x:a,y:c-s},{width:u,height:s},i),du.copy(r.data,l,{x:0,y:0},{x:a,y:c+h},{width:u,height:s},i),du.copy(r.data,l,{x:u-s,y:0},{x:a-s,y:c},{width:s,height:h},i),du.copy(r.data,l,{x:0,y:0},{x:a+u,y:c},{width:s,height:h},i),du.copy(r.data,l,{x:u-s,y:h-s},{x:a-s,y:c-s},{width:s,height:s},i),du.copy(r.data,l,{x:0,y:h-s},{x:a+u,y:c-s},{width:s,height:s},i),du.copy(r.data,l,{x:0,y:0},{x:a+u,y:c+h},{width:s,height:s},i),du.copy(r.data,l,{x:u-s,y:0},{x:a-s,y:c+h},{width:s,height:s},i)}this.lut=i,this.image=l,this.iconPositions=r,this.patternPositions=n}addImages(e,t,i,r){for(const[n,o]of e.entries()){const{bin:e,imagePosition:s,imageVariant:a}=pf(n,o,i);t.set(n,s),r.push(e),o.hasRenderCallback&&this.haveRenderCallbacks.push(a.id)}}patchUpdatedImages(e,t,i){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((t=>e.hasImage(t,i))),e.dispatchRenderCallbacks(this.haveRenderCallbacks,i);for(const r of e.getUpdatedImages(i)){for(const n of this.iconPositions.keys()){const o=ei.parse(n);if(bt.isEqual(o.id,r)){const o=e.getImage(r,i);this.patchUpdatedImage(this.iconPositions.get(n),o,t)}}for(const n of this.patternPositions.keys()){const o=ei.parse(n);if(bt.isEqual(o.id,r)){const o=e.getImage(r,i);this.patchUpdatedImage(this.patternPositions.get(n),o,t)}}}}patchUpdatedImage(e,t,i){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[r,n]=e.tl,o=e.sdf;if(this.lut||o){const e={width:t.data.width,height:t.data.height},s=new du(e);du.copy(t.data,s,{x:0,y:0},{x:0,y:0},e,this.lut,o),i.update(s,{position:{x:r,y:n}})}else i.update(t.data,{position:{x:r,y:n}})}}co(df,"ImagePosition"),co(ff,"ImageAtlas");const Af=1e20;function mf(e,t,i,r,n,o,s,a,l){for(let c=t;c-1);l++,o[l]=a,s[l]=c,s[l+1]=Af}for(let a=0,l=0;a{let r=this.entries[e];r||(r=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=r.glyphs[t];if(void 0!==o)return void i(null,{stack:e,id:t,glyph:o});if(o=this._tinySDF(r,e,t),o)return r.glyphs[t]=o,void i(null,{stack:e,id:t,glyph:o});const s=Math.floor(t/256);if(256*s>65535)return de("glyphs > 65535 not supported"),void i(null,{stack:e,id:t,glyph:o});if(r.ranges[s])return void i(null,{stack:e,id:t,glyph:o});let a=r.requests[s];a||(a=r.requests[s]=[],vf.loadGlyphRange(e,s,n,this.requestManager,((e,t)=>{if(t){r.ascender=t.ascender,r.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(r.glyphs[+e]=t.glyphs[+e]);r.ranges[s]=!0}for(const i of a)i(e,t);delete r.requests[s]}))),a.push(((r,n)=>{r?i(r):n&&i(null,{stack:e,id:t,glyph:n.glyphs[t]||null})}))}),((e,t)=>{if(e)i(e);else if(t){const e={};for(const{stack:i,id:r,glyph:n}of t)void 0===e[i]&&(e[i]={}),void 0===e[i].glyphs&&(e[i].glyphs={}),e[i].glyphs[r]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[i].ascender=this.entries[i].ascender,e[i].descender=this.entries[i].descender;i(null,e)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==yf.none&&(this.localGlyphMode===yf.all?!!this.localFontFamily:!!this.localFontFamily&&(Ao["CJK Unified Ideographs"](e)||Ao["Hangul Syllables"](e)||Ao.Hiragana(e)||Ao.Katakana(e)||Ao["CJK Symbols and Punctuation"](e)||Ao["CJK Unified Ideographs Extension A"](e)||Ao["CJK Unified Ideographs Extension B"](e)||Ao.Osage(e)))}_tinySDF(e,t,i){const r=this.localFontFamily;if(!r||!this._doesCharSupportLocalGlyph(i))return;let n=e.tinySDF;if(!n){let i="400";/bold/i.test(t)?i="900":/medium/i.test(t)?i="500":/light/i.test(t)&&(i="200"),n=e.tinySDF=new vf.TinySDF({fontFamily:r,fontWeight:i,fontSize:24*_f,buffer:3*_f,radius:8*_f}),n.fontWeight=i}if(this.localGlyphs[n.fontWeight][i])return this.localGlyphs[n.fontWeight][i];const o=String.fromCodePoint(i),{data:s,width:a,height:l,glyphWidth:c,glyphHeight:u,glyphLeft:h,glyphTop:d,glyphAdvance:p}=n.draw(o);return this.localGlyphs[n.fontWeight][i]={id:i,bitmap:new hu({width:a,height:l},s),metrics:{width:c/_f,height:u/_f,left:h/_f,top:d/_f-27,advance:p/_f,localGlyph:!0}}}}vf.loadGlyphRange=function(e,t,i,r,n){const o=256*t,s=o+255,a=r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",`${o}-${s}`),Je.Glyphs);rt(a,((e,t)=>{if(e)n(e);else if(t){const e={},i=function(e){return new Fp(e).readFields(zp,{})}(t);for(const t of i.glyphs)e[t.id]=t;n(null,{glyphs:e,ascender:i.ascender,descender:i.descender})}}))},vf.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=r,this.radius=i;const a=this.size=e+4*t,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${o} ${e}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,s+Math.ceil(r)),c=a+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return p;const{ctx:f,buffer:A,gridInner:m,gridOuter:g}=this;f.clearRect(A,A,a,l),f.fillText(e,A,A+s);const _=f.getImageData(A,A,a,l);g.fill(Af,0,h),m.fill(0,0,h);for(let e=0;e0?e*e:0,m[r]=e<0?e*e:0}}mf(g,0,0,c,u,c,this.f,this.v,this.z),mf(m,A,A,a,l,c,this.f,this.v,this.z);for(let e=0;e{const d=Cf(r.stretch-_,y,u,e.left*n),p=Sf(r.fixed-b,w,r.stretch,f),m=Cf(o.stretch-v,x,h,e.top*n),g=Sf(o.fixed-T,B,o.stretch,A),C=Cf(l.stretch-_,y,u,e.left*n),S=Sf(l.fixed-b,w,l.stretch,f),E=Cf(c.stretch-v,x,h,e.top*n),M=Sf(c.fixed-T,B,c.stretch,A),I=new V(d,m),P=new V(C,m),L=new V(C,E),F=new V(d,E),k=new V(p/a,g/a),z=new V(S/a,M/a),R=t*Math.PI/180;if(R){const e=Math.sin(R),t=Math.cos(R),i=[t,-e,e,t];I._matMult(i),P._matMult(i),F._matMult(i),L._matMult(i)}const D=r.stretch+r.fixed,O=l.stretch+l.fixed,U=o.stretch+o.fixed,N=c.stretch+c.fixed,Q=e.imageSecondary;return{tl:I,tr:P,bl:F,br:L,texPrimary:{x:s.paddedRect.x+xf+D,y:s.paddedRect.y+xf+U,w:O-D,h:N-U},texSecondary:Q?{x:Q.paddedRect.x+xf+D,y:Q.paddedRect.y+xf+U,w:O-D,h:N-U}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:k,pixelOffsetBR:z,minFontScaleX:w/a/u,minFontScaleY:B/a/h,isSDF:i}};if(r&&(s.stretchX||s.stretchY)){const e=Bf(d,m,f),t=Bf(p,g,A);for(let i=0;io)&&(o=t.x),(!e||t.y>s)&&(s=t.y)}const l=Math.min(o-r,s-n);let c=l/2;const u=new Wi([],If);if(0===l)return new V(r,n);for(let t=r;th.d||!h.d)&&(h=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-h.d<=t||(c=r.h/2,u.push(new Pf(r.p.x-c,r.p.y-c,c,e)),u.push(new Pf(r.p.x+c,r.p.y-c,c,e)),u.push(new Pf(r.p.x-c,r.p.y+c,c,e)),u.push(new Pf(r.p.x+c,r.p.y+c,c,e)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${h.d}`)),h.p}function If(e,t){return t.max-e.max}class Pf{constructor(e,t,i,r){this.p=new V(e,t),this.h=i,this.d=function(e,t){let i=!1,r=1/0;for(let n=0;ne.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(i=!i),r=Math.min(r,Gl(e,n,a))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}}const Lf=Number.POSITIVE_INFINITY,Ff=Math.sqrt(2);function kf(e,[t,i]){let r=0,n=0;if(i===Lf){t<0&&(t=0);const i=t/Ff;switch(e){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-t;break;case"top":n=t-7}switch(e){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=t;break;case"right":r=-t}}else{switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}}return[r,n]}function zf(e,t,i,r,n,o,s,a){if(!e)return;const l=_p(t,i,r,n,o);return e.scaleSelf(l*a*s)}function Rf(e,t,i,r,n,o,s,a){return{iconPrimary:zf(e.getPrimary(),t,i,r,n,o,s,a),iconSecondary:zf(e.getSecondary(),t,i,r,n,o,s,a)}}function Df(e,t,i,r){if(!e)return;const n=t.get(i.toString());if(e.imagePrimary=n,r){const i=t.get(r.toString());e.imageSecondary=i}}function Of(e,t){for(const i in e.horizontal)Uf(e.horizontal[i],t);Uf(e.vertical,t)}function Uf(e,t){if(e)for(const i of e.positionedLines)for(const e of i.positionedGlyphs)if(null!==e.image){const i=e.image.toString();e.rect=t.get(i).paddedRect}}function Nf(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Qf(e,t,i,r,n,o,s,a,l){const c=$f(o.horizontal)||o.vertical,u=i.get("icon-text-fit-padding").evaluate(r,{},n);let h,d=t;return t&&"none"!==l&&(e.allowVerticalPlacement&&o.vertical&&(h=Jp(t,o.vertical,l,u,a,s)),c&&(d=Jp(t,c,l,u,a,s))),{defaultShapedIcon:d,verticallyShapedIcon:h}}function jf(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y){let v=s.textMaxSize.evaluate(t,{},d);void 0===v?v=a*s.textScaleFactor:v*=s.textScaleFactor;const x=e.layers[0].layout,b=$f(i.horizontal)||i.vertical,w="globe"===p.name,T=mp,B=e.tilePixelRatio*v/T,C=(L=e.overscaling,e.zoom>18&&L>2&&(L>>=1),Math.max(Xi/(512*L),1)*x.get("symbol-spacing")),S=x.get("text-padding")*e.tilePixelRatio,E=x.get("icon-padding")*e.tilePixelRatio,M=Z(x.get("text-max-angle")),I="map"===x.get("icon-rotation-alignment")&&"point"!==y,P=C/2;var L;!1===e.hasAnyIconTextFit&&"none"!==m&&(e.hasAnyIconTextFit=!0);const F=t.properties?+t.properties[ah]:null,k=F&&e.elevationFeatureIdToIndex?e.elevationFeatureIdToIndex.get(F):65535,z=(a,l,y)=>{if(l.x<0||l.x>=Xi||l.y<0||l.y>=Xi)return;let v=null;if(w){const{x:e,y:t,z:i}=p.projectTilePoint(l.x,l.y,y);v={anchor:new ef(e,t,i,0,void 0),up:p.upVector(y,l.x,l.y)}}!function(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S,E){const M=e.addToLineVertexArray(t,r);let I,P,L,F,k,z,R,D=0,O=0,U=0,N=0,Q=-1,j=-1;const V={};let H=mt("");const G=i?i.anchor:t,$="none"!==S;let Z=0,q=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[Z,q]=l.layout.get("text-offset").evaluate(v,{},T).map((e=>e*mp)):(Z=l.layout.get("text-radial-offset").evaluate(v,{},T)*mp,q=Lf),e.allowVerticalPlacement&&n.vertical){const e=n.vertical;if(f)z=qf(e),a&&(R=qf(a));else{const i=l.layout.get("text-rotate").evaluate(v,{},T)+90;L=Zf(c,G,t,u,h,d,e,p,i,A),a&&(F=Zf(c,G,t,u,h,d,a,g,i))}}if(o){const r=e.iconSizeData,n=l.layout.get("icon-rotate").evaluate(v,{},T),s=wf(o,n,b,$,x.iconScaleFactor),p=a?wf(a,n,b,$,x.iconScaleFactor):void 0;P=Zf(c,G,t,u,h,d,o,g,n,null),D=4*s.length;let f=null;"source"===r.kind?(f=[gp*l.layout.get("icon-size").evaluate(v,{},T)*x.iconScaleFactor],f[0]>Hf&&de(`${e.layerIds[0]}: Value for "icon-size" is >= ${Vf}. Reduce your "icon-size".`)):"composite"===r.kind&&(f=[gp*x.compositeIconSizes[0].evaluate(v,{},T)*x.iconScaleFactor,gp*x.compositeIconSizes[1].evaluate(v,{},T)*x.iconScaleFactor],(f[0]>Hf||f[1]>Hf)&&de(`${e.layerIds[0]}: Value for "icon-size" is >= ${Vf}. Reduce your "icon-size".`)),e.addSymbols(e.icon,s,f,y,_,v,!1,i,t,M.lineStartIndex,M.lineLength,-1,w,T,B,C),Q=e.icon.placedSymbolArray.length-1,p&&(O=4*p.length,e.addSymbols(e.icon,p,f,y,_,v,Up.vertical,i,t,M.lineStartIndex,M.lineLength,-1,w,T,B,C),j=e.icon.placedSymbolArray.length-1)}for(const r in n.horizontal){const o=n.horizontal[r];I||(H=mt(o.text),f?k=qf(o):I=Zf(c,G,t,u,h,d,o,p,l.layout.get("text-rotate").evaluate(v,{},T),A));const a=1===o.positionedLines.length;if(U+=Gf(e,i,t,o,s,l,f,v,A,M,n.vertical?Up.horizontal:Up.horizontalOnly,a?Object.keys(n.horizontal):[r],V,Q,x,w,T,B),a)break}n.vertical&&(N+=Gf(e,i,t,n.vertical,s,l,f,v,A,M,Up.vertical,["vertical"],V,j,x,w,T,B));let K=-1;const W=(e,t)=>e?Math.max(e,t):t;K=W(k,K),K=W(z,K),K=W(R,K);const X=K>-1?1:0;e.glyphOffsetArray.length>=65535&&de("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==v.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,v.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,G.x,G.y,G.z,V.right>=0?V.right:-1,V.center>=0?V.center:-1,V.left>=0?V.left:-1,V.vertical>=0?V.vertical:-1,Q,j,H,void 0!==I?I:e.collisionBoxArray.length,void 0!==I?I+1:e.collisionBoxArray.length,void 0!==L?L:e.collisionBoxArray.length,void 0!==L?L+1:e.collisionBoxArray.length,void 0!==P?P:e.collisionBoxArray.length,void 0!==P?P+1:e.collisionBoxArray.length,F||e.collisionBoxArray.length,F?F+1:e.collisionBoxArray.length,u,U,N,D,O,X,0,Z,q,K,0,$?1:0,E)}(e,l,v,a,i,r,o,n,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,S,_,c,0,E,I,g,t,s,u,h,d,f,A,m,k)};if("line"===y)for(const n of cf(t.geometry,0,0,Xi,Xi)){const t=af(n,C,M,i.vertical||b,r,T,B,e.overscaling,Xi);for(const i of t)b&&Kf(e,b.text,P,i)||z(n,i,d)}else if("line-center"===y){for(const e of t.geometry)if(e.length>1){const t=sf(e,M,i.vertical||b,r,T,B);t&&z(e,t,d)}}else if("Polygon"===t.type)for(const e of Hu(t.geometry,0)){const t=Mf(e,16);z(e[0],new ef(t.x,t.y,0,0,void 0),d)}else if("LineString"===t.type)for(const e of t.geometry)z(e,new ef(e[0].x,e[0].y,0,0,void 0),d);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)z([t],new ef(t.x,t.y,0,0,void 0),d)}const Vf=255,Hf=Vf*gp;function Gf(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g){const _=function(e,t,i,r,n,o,s,a){const l=[];if(0===t.positionedLines.length)return l;const c=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=function(e){const t=e[0],i=e[1],r=t*i;return r>0?[t,-i]:r<0?[-t,i]:0===t?[i,t]:[i,-t]}(i);let h=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)h-=e.lineOffset;const d=t.positionedLines.length,p=h/d;let f=t.top-i[1];for(let e=0;eHf&&de(`${e.layerIds[0]}: Value for "text-size" is >= ${Vf}. Reduce your "text-size".`)):"composite"===y.kind&&(v=[gp*f.compositeTextSizes[0].evaluate(a,{},m)*f.textScaleFactor,gp*f.compositeTextSizes[1].evaluate(a,{},m)*f.textScaleFactor],(v[0]>Hf||v[1]>Hf)&&de(`${e.layerIds[0]}: Value for "text-size" is >= ${Vf}. Reduce your "text-size".`)),e.addSymbols(e.text,_,v,l,s,a,u,t,i,c.lineStartIndex,c.lineLength,p,A,m,g,!1);for(const t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*_.length}function $f(e){for(const t in e)return e[t];return null}function Zf(e,t,i,r,n,o,s,a,l,c){let u=s.top,h=s.bottom,d=s.left,p=s.right;const f=s.collisionPadding;if(f&&(d-=f[0],u-=f[1],p+=f[2],h+=f[3]),l){const e=new V(d,u),t=new V(p,u),i=new V(d,h),r=new V(p,h),n=Z(l);let o=new V(0,0);c&&(o=new V(c[0],c[1])),e._rotateAround(n,o),t._rotateAround(n,o),i._rotateAround(n,o),r._rotateAround(n,o),d=Math.min(e.x,t.x,i.x,r.x),p=Math.max(e.x,t.x,i.x,r.x),u=Math.min(e.y,t.y,i.y,r.y),h=Math.max(e.y,t.y,i.y,r.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,d,u,p,h,a,r,n,o),e.length-1}function qf(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function Kf(e,t,i,r){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])y&&(v(e,c,r,n,a,l),v(c,i,a,l,o,s))}v(h,d,r,o,n,o),v(d,p,n,o,n,s),v(p,f,n,s,r,s),v(f,h,r,s,r,o),A-=y,m-=y,g+=y,_+=y;const x=1/Math.max(g-A,_-m);return{scale:x,x:A*x,y:m*x,x2:g*x,y2:_*x,projection:t}}function Yf(e,{x:t,y:i},r=0){return new V(((t-r)*e.scale-e.x)*Xi,(i*e.scale-e.y)*Xi)}const Jf=U.mat4.identity(new Float32Array(16));class eA{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new cl(0,0)}projectTilePoint(e,t,i){return{x:e,y:t,z:0}}locationPoint(e,t,i,r=!0){return e._coordinatePoint(e.locationCoordinate(t,i),r)}pixelsPerMeter(e,t){return ml(1,e)*t}pixelSpaceConversion(e,t,i){return 1}farthestPixelDistance(e){return Wf(e,e.pixelsPerMeter)}pointCoordinate(e,t,i,r){const n=e.horizonLineFromTop(!1),o=new V(t,Math.max(n,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(o,r))}pointCoordinate3D(e,t,i){const r=new V(t,i);if(e.elevation)return e.elevation.pointCoordinate(r);{const t=this.pointCoordinate(e,r.x,r.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const i=e.horizonLineFromTop();return t.y0?t<-cA+i&&(t=-cA+i):t>cA-i&&(t=cA-i);const o=n/Math.pow(uA(t),r);let s=o*Math.sin(r*e),a=n-o*Math.cos(r*e);return s=.5*(s/Math.PI+.5),a=.5*(a/Math.PI+.5),{x:s,y:this.southernCenter?a:1-a,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:i,f:r}=this,n=r-t,o=Math.sign(n),s=Math.sign(i)*Math.sqrt(e*e+n*n);let a=Math.atan2(e,Math.abs(n))*o;n*i<0&&(a-=Math.PI*Math.sign(e)*o);const l=J(q(a/i)+this.center[0],-180,180),c=J(q(2*Math.atan(Math.pow(r/s,1/i))-cA),-vl,vl);return new cl(l,this.southernCenter?-c:c)}}class dA extends eA{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:fl(e),y:Al(t),z:0}}unproject(e,t){const i=gl(e),r=_l(t);return new cl(i,r)}}const pA=Z(vl);class fA extends eA{project(e,t){const i=(t=Z(t))*t,r=i*i;return{x:.5*((e=Z(e))*(.8707-.131979*i+r*(r*(.003971*i-.001529*r)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+r*(.028874*i-.044475-.005916*r)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,r=25,n=0,o=i*i;do{o=i*i;const e=o*o;n=(i*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-t)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),i=J(i-n,-pA,pA)}while(Math.abs(n)>1e-6&&--r>0);o=i*i;const s=J(q(e/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),a=q(i);return new cl(s,a)}}const AA=Z(vl);class mA extends eA{project(e,t){t=Z(t),e=Z(e);const i=Math.cos(t),r=2/Math.PI,n=Math.acos(i*Math.cos(e/2)),o=Math.sin(n)/n,s=.5*(e*r+2*i*Math.sin(e/2)/o)||0,a=.5*(t+Math.sin(t)/o)||0;return{x:.5*(s/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}}unproject(e,t){let i=e=(2*e-.5)*Math.PI,r=t=(2*(1-t)-1)*Math.PI,n=25;const o=1e-6;let s=0,a=0;do{const n=Math.cos(r),o=Math.sin(r),l=2*o*n,c=o*o,u=n*n,h=Math.cos(i/2),d=Math.sin(i/2),p=2*h*d,f=d*d,A=1-u*h*h,m=A?1/A:0,g=A?Math.acos(n*h)*Math.sqrt(1/A):0,_=.5*(2*g*n*d+2*i/Math.PI)-e,y=.5*(g*o+r)-t,v=.5*m*(u*f+g*n*h*c)+1/Math.PI,x=m*(p*l/4-g*o*d),b=.125*m*(l*d-g*o*u*p),w=.5*m*(c*h+g*f*n)+.5,T=x*b-w*v;s=(y*x-_*w)/T,a=(_*b-y*v)/T,i=J(i-s,-Math.PI,Math.PI),r=J(r-a,-AA,AA)}while((Math.abs(s)>o||Math.abs(a)>o)&&--n>0);return new cl(q(i),q(r))}}class gA extends eA{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Z(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:i,cosPhi:r}=this;return{x:Z(e)*r*i+.5,y:-Math.sin(Z(t))/r*i+.5,z:0}}unproject(e,t){const{scale:i,cosPhi:r}=this,n=-(t-.5)/i,o=J(q((e-.5)/i)/r,-180,180),s=Math.asin(J(n*r,-1,1)),a=J(q(s),-vl,vl);return new cl(o,a)}}class _A extends dA{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,i){const r=Rc(e,t,i),n=Uc(Ic(i));return U.vec3.transformMat4(r,r,n),{x:r[0],y:r[1],z:r[2]}}locationPoint(e,t,i){const r=sl(t.lat,t.lng),n=U.vec3.normalize([],r),o=i?e._centerAltitude+i:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude,s=ml(1,0)*Xi*o;U.vec3.scaleAndAdd(r,r,n,s);const a=U.mat4.identity(new Float64Array(16));return U.mat4.multiply(a,e.pixelMatrix,e.globeMatrix),U.vec3.transformMat4(r,r,a),new V(r[0],r[1])}pixelsPerMeter(e,t){return ml(1,0)*t}pixelSpaceConversion(e,t,i){const r=ml(1,e)*t,n=Et(ml(1,45)*t,r,i);return this.pixelsPerMeter(e,t)/n}createTileMatrix(e,t,i){const r=Nc(Ic(i.canonical));return U.mat4.multiply(new Float64Array(16),e.globeMatrix,r)}createInversionMatrix(e,t){const{center:i}=e,r=Uc(Ic(t));return U.mat4.rotateY(r,r,Z(i.lng)),U.mat4.rotateX(r,r,Z(i.lat)),U.mat4.scale(r,r,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(r)}pointCoordinate(e,t,i,r){return Sc(e,t,i,!0)||new Bl(0,0)}pointCoordinate3D(e,t,i){const r=this.pointCoordinate(e,t,i,0);return[r.x,r.y,r.z]}isPointAboveHorizon(e,t){return!Sc(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const i=e.cameraToCenterDistance,r=e._centerAltitude*t,n=e._camera,o=e._camera.forward(),s=U.vec3.add([],U.vec3.scale([],o,-i),[0,0,r]),a=e.worldSize/(2*Math.PI),l=[0,0,-a],c=e.width/e.height,u=Math.tan(e.fovAboveCenter),h=U.vec3.scale([],n.up(),u),d=U.vec3.scale([],n.right(),u*c),p=U.vec3.normalize([],U.vec3.add([],U.vec3.add([],o,h),d)),f=[];let A;if(new gc(s,p).closestPointOnSphere(l,a,f)){const t=U.vec3.add([],f,l),i=U.vec3.sub([],t,s);A=Math.cos(e.fovAboveCenter)*U.vec3.length(i)}else{const e=U.vec3.sub([],s,l),t=U.vec3.sub([],l,s);U.vec3.normalize(t,t);const i=U.vec3.length(e)-a;A=Math.sqrt(i*(i+2*a));const r=Math.acos(A/(a+i))-Math.acos(U.vec3.dot(o,t));A*=Math.cos(r)}return 1.01*A}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=Hc(e.zoom);if(i>0){const r=Wf(e,ml(1,e.center.lat)*e.worldSize),n=e.worldSize/(2*Math.PI),o=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Et(t,r+n*(1-Math.cos(o)),Math.pow(i,10))}return t}upVector(e,t,i){return Rc(t,i,e,1)}upVectorScale(e){return{metersToTile:Bc(Dc(Ic(e)))}}}function yA(e){const t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new dA(e);case"equirectangular":return new lA(e);case"naturalEarth":return new fA(e);case"equalEarth":return new aA(e);case"winkelTripel":return new mA(e);case"albers":return i?new gA(e):new tA(e);case"lambertConformalConic":return i?new gA(e):new hA(e);case"globe":return new _A(e)}throw new Error(`Invalid projection name: ${e.name}`)}const vA=sh.VectorTileFeature.types,xA=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function bA(e,t,i,r,n,o,s,a,l,c,u,h,d){const p=a?Math.min(Hf,Math.round(a[0])):0,f=a?Math.min(Hf,Math.round(a[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),o,s,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function wA(e,t,i){e.emplaceBack(t,i)}function TA(e,t,i,r,n,o,s){e.emplaceBack(t,i,r,n,o,s)}function BA(e,t,i,r,n){e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n)}function CA(e){for(const t of e.sections)if(To(t.text))return!0;return!1}class SA{constructor(e){this.layoutVertexArray=new ks,this.indexArray=new Vs,this.programConfigurations=e,this.segments=new _a,this.dynamicLayoutVertexArray=new Rs,this.opacityVertexArray=new Ds,this.placedSymbolArray=new sa,this.iconTransitioningVertexArray=new Os,this.globeExtVertexArray=new zs,this.zOffsetVertexArray=new Bs}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}upload(e,t,i,r,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ap.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,cp.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,xA,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,hp.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,lp.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,up.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}co(SA,"SymbolBuffers");class EA{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new _a,this.collisionVertexArray=new js,this.collisionVertexArrayExt=new Rs}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,dp.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,pp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}co(EA,"CollisionBuffers");class MA{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=U.mat4.identity([]),this.placementViewportMatrix=U.mat4.identity([]);const t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=yp(this.zoom,t["text-size"]),this.iconSizeData=yp(this.zoom,t["icon-size"]);const i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==r.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=i.get("text-writing-mode").map((e=>Up[e])),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new SA(new Ga(this.layers,{zoom:this.zoom,lut:this.lut},(e=>e.startsWith("text")||e.startsWith("symbol")))),this.icon=new SA(new Ga(this.layers,{zoom:this.zoom,lut:this.lut},(e=>e.startsWith("icon")||e.startsWith("symbol")))),this.glyphOffsetArray=new ca,this.lineVertexArray=new ua,this.symbolInstances=new la}calculateGlyphDependencies(e,t,i,r,n){for(const i of e){const e=i.codePointAt(0);if(void 0===e)break;if(t[e]=!0,r&&n&&e<=65535){const e=Tp[i];e&&(t[e.charCodeAt(0)]=!0)}}}updateFootprints(e,t){}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!$h(this.activeReplacements,i)&&(this.activeReplacements=i,!0)}populate(e,t,i,r){const n=this.layers[0],o=n.layout,s="globe"===this.projection.name,a=o.get("text-font"),l=o.get("text-field"),c=o.get("icon-image"),[u,h]=o.get("icon-size-scale-range"),d=J(t.scaleFactor||1,u,h),p=("constant"!==l.value.kind||l.value.value instanceof Jt&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),f="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,A=o.get("symbol-sort-key");if(this.features=[],!p&&!f)return;const m=t.iconDependencies,g=t.glyphDependencies,_=t.availableImages,y=new Do(this.zoom);for(const{feature:t,id:l,index:c,sourceLayerIndex:u}of e){const e=n._featureFilter.needGeometry,h=kl(t,e);if(!n._featureFilter.filter(y,h,i))continue;if(e||(h.geometry=Fl(t,i,r)),s&&1!==t.type&&i.z<=5){const e=h.geometry,t=.98078528056,r=(e,r)=>{const n=Rc(e.x,e.y,i,1),o=Rc(r.x,r.y,i,1);return U.vec3.dot(n,o)=0;for(const i of v.sections)if(i.image){const e=i.image.getPrimary().scaleSelf(this.pixelRatio),t=e.id.toString(),r=m.get(t)||[];r.push(e),m.set(t,r)}else{const r=mo(v.toString()),n=i.fontStack||e,o=g[n]=g[n]||{};this.calculateGlyphDependencies(i.text,o,t,this.allowVerticalPlacement,r)}}}if("line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},r=[];let n=0;function o(t){r.push(e[t]),n++}function s(e,t,n){const o=i[e];return delete i[e],i[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function a(e,i,n){const o=t[i];return delete t[i],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(e,t,i){const r=i?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let c=0;ce.geometry))}(this.features)),"hd-road-markup"===o.get("symbol-elevation-reference")){if(this.elevationType="road",t.elevationFeatures){!this.elevationFeatures&&t.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const e of t.elevationFeatures)this.elevationFeatureIdToIndex.set(e.id,this.elevationFeatures.length),this.elevationFeatures.push(e)}}else o.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,i,r,n,o,s){this.text.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s),this.icon.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s)}updateRoadElevation(){if("road"!==this.elevationType||!this.elevationFeatures)return;if(this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let e=!1;for(let t=0;t{i+=t,i>e.length&&e.resize(i);for(let n=-t;n<0;n++)e.emplace(n+i,r)},t=(e,t,i)=>{r+=t,r>e.length&&e.resize(r);for(let n=-t;n<0;n++)e.emplace(n+r,i)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let i=0,r=0;for(let i=0;i0;if((n>0||o>0)&&(e(this.text.zOffsetVertexArray,n,a),e(this.text.zOffsetVertexArray,o,a)),l){const{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:i}=r;e>=0&&t(this.icon.zOffsetVertexArray,s,a),i>=0&&t(this.icon.zOffsetVertexArray,r.numVerticalIconVertices,a)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=yA(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:e,y:i}of t)this.lineVertexArray.emplaceBack(e,i);return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A){const m=e.indexArray,g=e.layoutVertexArray,_=e.globeExtVertexArray,y=e.segments.prepareSegment(4*t.length,g,m,this.canOverlap?o.sortKey:void 0),v=this.glyphOffsetArray.length,x=y.vertexLength,b=this.allowVerticalPlacement&&s===Up.vertical?Math.PI/2:0,w=o.text&&o.text.sections;for(let r=0;r=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:r),o=vp(this.textSizeData,e,n)/mp;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,t,i){const r=this.icon.placedSymbolArray.get(i),n=vp(this.iconSizeData,e,r);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,t,i,r){e.emplaceBack(t,-i,-i,r),e.emplaceBack(t,i,-i,r),e.emplaceBack(t,i,i,r),e.emplaceBack(t,-i,i,r)}_updateTextDebugCollisionBoxes(e,t,i,r,n,o,s){for(let s=r;s0}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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;tr[e]-r[t]||n[t]-n[e])),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;ethis.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset))}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:i,centerJustifiedTextSymbolIndex:r,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:a}=t;i>=0&&this.addIndicesForPlacedSymbol(this.text,i),r>=0&&r!==i&&this.addIndicesForPlacedSymbol(this.text,r),n>=0&&n!==r&&n!==i&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let IA,PA,LA;co(MA,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),MA.addDynamicAttributes=BA;class FA{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:zt,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}co(FA,"FormatSectionOverride",{omit:["defaultValue"]});const kA=()=>LA||(LA={layout:IA||(IA=new Ko({"symbol-placement":new $o(Wo.layout_symbol["symbol-placement"]),"symbol-spacing":new $o(Wo.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new $o(Wo.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Zo(Wo.layout_symbol["symbol-sort-key"]),"symbol-z-order":new $o(Wo.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new $o(Wo.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new $o(Wo.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new $o(Wo.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new $o(Wo.layout_symbol["icon-ignore-placement"]),"icon-optional":new $o(Wo.layout_symbol["icon-optional"]),"icon-rotation-alignment":new $o(Wo.layout_symbol["icon-rotation-alignment"]),"icon-size":new Zo(Wo.layout_symbol["icon-size"]),"icon-size-scale-range":new $o(Wo.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Zo(Wo.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Zo(Wo.layout_symbol["icon-text-fit-padding"]),"icon-image":new Zo(Wo.layout_symbol["icon-image"]),"icon-rotate":new Zo(Wo.layout_symbol["icon-rotate"]),"icon-padding":new $o(Wo.layout_symbol["icon-padding"]),"icon-keep-upright":new $o(Wo.layout_symbol["icon-keep-upright"]),"icon-offset":new Zo(Wo.layout_symbol["icon-offset"]),"icon-anchor":new Zo(Wo.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new $o(Wo.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new $o(Wo.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new $o(Wo.layout_symbol["text-rotation-alignment"]),"text-field":new Zo(Wo.layout_symbol["text-field"]),"text-font":new Zo(Wo.layout_symbol["text-font"]),"text-size":new Zo(Wo.layout_symbol["text-size"]),"text-size-scale-range":new $o(Wo.layout_symbol["text-size-scale-range"]),"text-max-width":new Zo(Wo.layout_symbol["text-max-width"]),"text-line-height":new Zo(Wo.layout_symbol["text-line-height"]),"text-letter-spacing":new Zo(Wo.layout_symbol["text-letter-spacing"]),"text-justify":new Zo(Wo.layout_symbol["text-justify"]),"text-radial-offset":new Zo(Wo.layout_symbol["text-radial-offset"]),"text-variable-anchor":new $o(Wo.layout_symbol["text-variable-anchor"]),"text-anchor":new Zo(Wo.layout_symbol["text-anchor"]),"text-max-angle":new $o(Wo.layout_symbol["text-max-angle"]),"text-writing-mode":new $o(Wo.layout_symbol["text-writing-mode"]),"text-rotate":new Zo(Wo.layout_symbol["text-rotate"]),"text-padding":new $o(Wo.layout_symbol["text-padding"]),"text-keep-upright":new $o(Wo.layout_symbol["text-keep-upright"]),"text-transform":new Zo(Wo.layout_symbol["text-transform"]),"text-offset":new Zo(Wo.layout_symbol["text-offset"]),"text-allow-overlap":new $o(Wo.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new $o(Wo.layout_symbol["text-ignore-placement"]),"text-optional":new $o(Wo.layout_symbol["text-optional"]),visibility:new $o(Wo.layout_symbol.visibility)})),paint:PA||(PA=new Ko({"icon-opacity":new Zo(Wo.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Zo(Wo.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Zo(Wo.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Zo(Wo.paint_symbol["text-emissive-strength"]),"icon-color":new Zo(Wo.paint_symbol["icon-color"]),"icon-halo-color":new Zo(Wo.paint_symbol["icon-halo-color"]),"icon-halo-width":new Zo(Wo.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Zo(Wo.paint_symbol["icon-halo-blur"]),"icon-translate":new $o(Wo.paint_symbol["icon-translate"]),"icon-translate-anchor":new $o(Wo.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Zo(Wo.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Zo(Wo.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Zo(Wo.paint_symbol["text-occlusion-opacity"]),"text-color":new Zo(Wo.paint_symbol["text-color"],{runtimeType:Ut,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Zo(Wo.paint_symbol["text-halo-color"]),"text-halo-width":new Zo(Wo.paint_symbol["text-halo-width"]),"text-halo-blur":new Zo(Wo.paint_symbol["text-halo-blur"]),"text-translate":new $o(Wo.paint_symbol["text-translate"]),"text-translate-anchor":new $o(Wo.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new $o(Wo.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new $o(Wo.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new $o(Wo.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new $o(Wo.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Zo(Wo.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"})}))},LA);class zA extends ms{constructor(e,t,i,r){super(e,kA(),t,i,r),this._colorAdjustmentMatrix=U.mat4.identity([]),this.hasInitialOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,t){super.recalculate(e,t),"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"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const i=this.layout.get("text-writing-mode");if(i){const e=[];for(const t of i)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,t,i,r){return this._saturation===e&&this._contrast===t&&this._brightnessMin===i&&this._brightnessMax===r||(this._colorAdjustmentMatrix=function(e,t,i,r){e=we(e),t=be(t);const n=U.mat4.create(),o=e/3,s=1-2*o,a=[s,o,o,0,o,s,o,0,o,o,s,0,0,0,0,1],l=.5-.5*t,c=r-i;return U.mat4.multiply(n,[c,0,0,0,0,c,0,0,0,0,c,0,i,i,i,1],[t,0,0,0,0,t,0,0,0,0,t,0,l,l,l,1]),U.mat4.multiply(n,n,a),n}(e,t,i,r),this._saturation=e,this._contrast=t,this._brightnessMin=i,this._brightnessMax=r),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,i,r){const n=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Xn(o.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,((t,i)=>i in e?String(e[i]):""))}(t.properties,n)}createBucket(e){return new MA(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of kA().paint.overridableProperties){if(!zA.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new FA(t),r=new Wn(i,t.property.specification,this.scope,this.options);let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new Jn("source",r):new eo("composite",r,t.value.zoomStops,t.value._interpolationType),this.paint._values[e]=new Ho(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&zA.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),r=kA().paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof Jt)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{n||(t instanceof si&&ni(t.value)===Vt?o(t.value.sections):t instanceof ui?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,t,i){return{config:new Ha(this,{zoom:t,lut:i}),overrideFog:!1}}}let RA,DA,OA,UA;var NA=vs([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function QA(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function jA(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class VA{constructor(e,t,i,r){this.context=e,this.format=i,this.useMipmap=r&&r.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:r&&r.premultiply})}update(e,t){const i=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,r=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:n}=this,{gl:o}=n,{x:s,y:a}=t&&t.position?t.position:{x:0,y:0},l=s+i,c=a+r;!this.size||this.size[0]===l&&this.size[1]===c||(o.bindTexture(o.TEXTURE_2D,null),o.deleteTexture(this.texture),this.texture=o.createTexture(),this.size=null),o.bindTexture(o.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA8&&(!t||!1!==t.premultiply));const u=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&l>0&&c>0){const e=this.useMipmap?Math.floor(Math.log2(Math.max(l,c)))+1:1;o.texStorage2D(o.TEXTURE_2D,e,this.format,l,c),this.size=[l,c]}if(this.size)if(u)o.texSubImage2D(o.TEXTURE_2D,0,s,a,QA(this.format),jA(this.format),e);else{const t=e.data;t&&o.texSubImage2D(o.TEXTURE_2D,0,s,a,i,r,QA(this.format),jA(this.format),t)}this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(e,t,i=!1){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!i?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,i,r){const{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),t!==this.magFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap?e===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,i),this.wrapS=i),r!==this.wrapT&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrapT=r)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class HA{constructor(e,t){this.context=e,this.texture=t}bind(e,t){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_2D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}}function GA(e,t,i,r,n,o,s,a){const l=[e,t,1,i,r,1,n,o,1],c=[s,a,1],u=U.mat3.adjoint([],l),[h,d,p]=U.vec3.transformMat3(c,c,u);return U.mat3.multiply(l,l,[h,0,0,0,d,0,0,0,p])}function $A(e,t,i,r,n,o,s,a){const l=function(e,t,i,r,n,o,s,a){const l=GA(0,0,1,0,1,1,0,1),c=GA(e,t,i,r,n,o,s,a),u=U.mat3.adjoint([],l);return U.mat3.multiply(c,c,u)}(e,t,i,r,n,o,s,a);return[l[2]/l[8]/Xi,l[5]/l[8]/Xi]}function ZA(e){return[e[0],Math.min(Math.max(e[1],-vl),vl)]}class qA extends xt{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(r),this.options=t,this._dirty=!1}load(e,t){if(this._loaded=t||!1,this.fire(new gt("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=lt(this.map._requestManager.transformRequest(this.url,Je.Image),((t,i)=>{this._imageRequest=null,this._loaded=!0,t?this.fire(new _t(t)):i&&(this.image=i instanceof HTMLImageElement?ke.getImageData(i):i,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new HA(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new gt("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof HA||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let t=e[0][1],i=e[0][1];for(const r of e)r[1]>i&&(i=r[1]),r[1]vl?this.onNorthPole=!0:r<-vl&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const t=e.map(Bl.fromLngLat);this.tileID=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);const o=Math.max(r-t,n-i),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),a=Math.pow(2,s);let l=Math.floor((t+r)/2*a);return l>1&&(l-=1),new ac(s,l,Math.floor((i+n)/2*a))}(t),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new gt("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const t=Xf(new ac(0,0,0),this.map.transform.projection),i=[t.projection.project(this.coordinates[0][0],this.coordinates[0][1]),t.projection.project(this.coordinates[1][0],this.coordinates[1][1]),t.projection.project(this.coordinates[2][0],this.coordinates[2][1]),t.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){const t=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[1].x,n=e[2].y-e[1].y,o=e[3].x-e[2].x,s=e[3].y-e[2].y,a=e[0].x-e[3].x,l=e[0].y-e[3].y,c=t*n-r*i,u=r*s-o*n,h=o*l-a*s,d=a*i-t*l;return c>0&&u>0&&h>0&&d>0||c<0&&u<0&&h<0&&d<0}(i))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const r=Xf(this.tileID,this.map.transform.projection),[n,o,s,a]=this.coordinates.map((e=>{const t=r.projection.project(e[0],e[1]);return Yf(r,t)._round()}));this.perspectiveTransform=$A(n.x,n.y,o.x,o.y,s.x,s.y,a.x,a.y);const l=this._boundsArray=new Ts;l.emplaceBack(n.x,n.y,0,0),l.emplaceBack(o.x,o.y,Xi,0),l.emplaceBack(a.x,a.y,0,Xi),l.emplaceBack(s.x,s.y,Xi,Xi),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(l,NA.members),this.boundsSegments=_a.simpleSegment(0,0,4,2);const c=[],u=[ZA((h=this.coordinates)[0]),ZA(h[1]),ZA(h[2]),ZA(h[3])];var h;const[d,p,f,A]=function(e){let t=e[0][0],i=t,r=e[0][1],n=r;for(let o=1;oi&&(i=e[o][0]),e[o][1]n&&(n=e[o][1]);return[t,r,i-t,n-r]}(u);{const r=new Ts,[n,o,s,a]=function(e){let t=e[0].x,i=t,r=e[0].y,n=r;for(let o=1;oi&&(i=e[o].x),e[o].yn&&(n=e[o].y);return[t,r,i-t,n-r]}(i),l=e=>[(e.x-n)/s,(e.y-o)/a],[u,h,m,g]=i.map(l),_=function(e,t,i,r,n,o,s,a){const l=GA(0,0,1,0,1,1,0,1),c=GA(e,t,i,r,n,o,s,a),u=U.mat3.adjoint([],c);return U.mat3.multiply(l,l,u)}(u[0],u[1],h[0],h[1],m[0],m[1],g[0],g[1]);this.elevatedGlobePerspectiveTransform=$A(u[0],u[1],h[0],h[1],m[0],m[1],g[0],g[1]);const y=(e,t)=>{c.push(e.lng);const i=Math.round((e.lng-d)/f*Xi),n=Math.round((e.lat-p)/A*Xi),o=l(t),s=U.vec3.transformMat3([],[o[0],o[1],1],_),a=Math.round(s[0]/s[2]*Xi),u=Math.round(s[1]/s[2]*Xi);r.emplaceBack(i,n,a,u)},v=i[3].x-i[0].x,x=i[3].y-i[0].y,b=i[2].x-i[1].x,w=i[2].y-i[1].y;for(let e=0;e<65;e++){const r=e/64,n=[i[0].x+r*v,i[0].y+r*x],o=[i[1].x+r*b,i[1].y+r*w],s=o[0]-n[0],a=o[1]-n[1];for(let e=0;e<65;e++){const i=e/64,r={x:n[0]+s*i,y:n[1]+a*i,z:0};y(t.projection.unproject(r.x,r.y),r)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(r,NA.members)}{this.maxLongitudeTriangleSize=0;let t=[],i=new Vs;const r=(e,r,n)=>{i.emplaceBack(e,r,n);const o=c[e],s=c[r],a=c[n],l=Math.min(Math.min(o,s),a),u=Math.max(Math.max(o,s),a)-l;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),t.push(l+u/2)};for(let e=0;e<64;e++)for(let t=0;t<64;t++){const i=65*e+t,n=i+1,o=i+65,s=o+1;r(i,o,n),r(n,o,s)}[t,i]=function(e,t){const i=Array.from({length:e.length},((e,t)=>t));i.sort(((t,i)=>e[t]-e[i]));const r=[],n=new Vs;for(let o=0;o{o.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:t.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},a=.51*this.maxLongitudeTriangleSize;if(Math.abs(i[0]-r)<=a){const e=xe(i,0,i.length,r+a);return e===i.length||s(e,ve(i,e+1,i.length,r+360-a)-e),o}r0){const i=function(e,t){const i=t.worldSize,r=ml(1,0)*i*bl(t.center.lat,t.zoom)/Qc(i),n=ml(1,t.center.lat)*i,o=U.mat4.identity([]);return U.mat4.rotateY(o,o,Z(t.center.lng)),U.mat4.rotateX(o,o,Z(t.center.lat)),U.mat4.translate(o,o,[0,0,Xa]),U.mat4.scale(o,o,[r,r,r*n]),U.mat4.translate(o,o,[t.point.x-.5*i,t.point.y-.5*i,0]),U.mat4.multiply(o,o,e),U.mat4.multiply(o,t.globeMatrix,o)}(e,t);return function(e,t,i){const r=(e,t,i)=>{const r=U.vec3.length(e),n=U.vec3.length(t),o=Pc(e,t,i);return U.vec3.scale(o,o,1/U.vec3.length(o)*Et(r,n,i))},n=r([e[0],e[1],e[2]],[t[0],t[1],t[2]],i),o=r([e[4],e[5],e[6]],[t[4],t[5],t[6]],i),s=r([e[8],e[9],e[10]],[t[8],t[9],t[10]],i),a=Pc([e[12],e[13],e[14]],[t[12],t[13],t[14]],i);return[n[0],n[1],n[2],0,o[0],o[1],o[2],0,s[0],s[1],s[2],0,a[0],a[1],a[2],1]}(n,i,r)}return n}function fm(e,t,i,r){const n=Tc.projectAabbCorners(r,i);let o=Number.MAX_VALUE,s=-1;for(let e=0;enew V(n[e][0],n[e][1]);let l;switch(s){case 0:case 6:l=[a(1),a(5),a(4),a(7),a(3),a(2),a(1)];break;case 1:case 7:l=[a(0),a(4),a(5),a(6),a(2),a(3),a(0)];break;case 3:case 5:l=[a(1),a(0),a(4),a(7),a(6),a(2),a(1)];break;default:l=[a(1),a(5),a(6),a(7),a(3),a(0),a(1)]}if(Ol(e,l))return o}const Am=vs([{name:"a_pos_3f",components:3,type:"Float32"}]),mm=vs([{name:"a_color_3f",components:3,type:"Float32"}]),gm=vs([{name:"a_color_4f",components:4,type:"Float32"}]),_m=vs([{name:"a_uv_2f",components:2,type:"Float32"}]),ym=vs([{name:"a_normal_3f",components:3,type:"Float32"}]),vm=vs([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),xm=vs([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),bm={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class wm{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function Tm(e,t){const i=-1===e.indexOf("://");try{return new URL(e,i&&t?"http://example.com":void 0),!0}catch(e){return!1}}class Bm{constructor(e,t){this.feature=e,this.instancedDataOffset=t,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Cm{constructor(){this.instancedDataArray=new Js,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class Sm{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0}updateFootprints(e,t){}populate(e,t,i,r){this.tileToMeter=Tl(i);const n=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:o,id:s,index:a,sourceLayerIndex:l}of e){const e=null!=s?s:o.properties&&o.properties.hasOwnProperty("id")?o.properties.id:void 0,c=kl(o,n);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),c,i))continue;const u={id:e,sourceLayerIndex:l,index:a,geometry:n?c.geometry:Fl(o,i,r),properties:o.properties,type:o.type,patterns:{}},h=this.addFeature(u,u.geometry,c);h&&t.featureIndex.insert(o,u.geometry,a,l,this.index,this.instancesPerModel[h].instancedDataArray.length,Xi/32)}this.lookup=null}update(e,t,i,r){for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t in e)i.idToFeaturesIndex.hasOwnProperty(t)&&(this.evaluate(i.features[i.idToFeaturesIndex[t]],e[t],i,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t of i.features){const r=this.layers[0],n=t.feature,o=this.canonical,s=r.paint.get("model-rotation").evaluate(n,{},o),a=r.paint.get("model-scale").evaluate(n,{},o),l=r.paint.get("model-translation").evaluate(n,{},o);U.vec3.exactEquals(t.rotation,s)&&U.vec3.exactEquals(t.scale,a)&&U.vec3.exactEquals(t.translation,l)||(this.evaluate(t,t.featureStates,i,!0),e=!0)}}return e}updateReplacement(e,t,i,r){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if($h(this.activeReplacements,n))return!1;this.activeReplacements=n;let o=!1;for(const t in this.instancesPerModel){const n=this.instancesPerModel[t],s=n.instancedDataArray;for(const t of n.features){const n=t.instancedDataOffset,a=t.instancedDataCount;for(let t=0;tXi;l=c?l-Xi:l;const u=Math.floor(l),h=s.float32[a+1];let d=!1;for(const t of this.activeReplacements)if(!jh(t,i,bm.Model,r)&&!(t.min.x>u||u>t.max.x||t.min.y>h||h>t.max.y)&&(d=Yh(Xh(u,h,e.canonical,t.footprintTileId.canonical),t.footprint),d))break;s.float32[a]=d?l+Xi:l,o=o||d!==c}}}return o}isEmpty(){for(const e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];i.instancedDataArray.length<0||0===i.instancedDataArray.length||(i.instancedDataBuffer?i.instancedDataBuffer.updateData(i.instancedDataArray):i.instancedDataBuffer=e.createVertexBuffer(i.instancedDataArray,vm.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const e in this.instancesPerModel){const t=this.instancesPerModel[e];0!==t.instancedDataArray.length&&t.instancedDataBuffer&&t.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris)for(const t of this.modelUris)e.removeModel(t,"")}addFeature(e,t,i){const r=this.layers[0],n=r.layout.get("model-id").evaluate(i,{},this.canonical);if(!n)return de(`modelId is not evaluated for layer ${r.id} and it is not going to get rendered.`),n;Tm(n,!1)&&(this.modelUris.includes(n)||this.modelUris.push(n)),this.instancesPerModel[n]||(this.instancesPerModel[n]=new Cm);const o=this.instancesPerModel[n],s=o.instancedDataArray,a=new Bm(i,s.length);for(const e of t)for(const t of e){if(t.x<0||t.x>=Xi||t.y<0||t.y>=Xi)continue;const e=(this.lookupDim-1)/Xi,i=this.lookupDim*(t.y*e|0)+t.x*e|0;if(this.lookup){if(0!==this.lookup[i])continue;this.lookup[i]=1}this.instanceCount++;const r=s.length;s.resize(r+1),o.instancesEvaluatedElevation.push(0),s.float32[16*r]=t.x,s.float32[16*r+1]=t.y}return a.instancedDataCount=o.instancedDataArray.length-a.instancedDataOffset,a.instancedDataCount>0&&(e.id&&(o.idToFeaturesIndex[e.id]=o.features.length),o.features.push(a),this.evaluate(a,{},o,!1)),n}getModelUris(){return this.modelUris}evaluate(e,t,i,r){const n=this.layers[0],o=e.feature,s=this.canonical,a=e.rotation=n.paint.get("model-rotation").evaluate(o,t,s),l=e.scale=n.paint.get("model-scale").evaluate(o,t,s),c=e.translation=n.paint.get("model-translation").evaluate(o,t,s),u=n.paint.get("model-color").evaluate(o,t,s);u.a=n.paint.get("model-color-mix-intensity").evaluate(o,t,s);const h=[];this.maxVerticalOffset10?this.tileToMeter:Tl(s,p)),a[o+4]=c[0],a[o+5]=c[1],a[o+6]=c[2]+l,a[o+7]=h[0],a[o+8]=h[1],a[o+9]=h[2],a[o+10]=h[4],a[o+11]=h[5],a[o+12]=h[6],a[o+13]=h[8],a[o+14]=h[9],a[o+15]=h[10],i.instancesEvaluatedElevation[n]=c[2]}}}let Em,Mm;co(Sm,"ModelBucket",{omit:["layers"]}),co(Cm,"PerModelAttributes"),co(Bm,"ModelFeature");const Im=64,Pm={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Lm(e,t,i,r,n,o,s,a,l,c=!1){const u=i.zoom,h=i.project(r),d=bl(r.lat,u),p=1/d;U.mat4.identity(e),U.mat4.translate(e,e,[h.x+s[0]*p,h.y+s[1]*p,s[2]]);let f=1,A=1;const m=i.worldSize;if(c){if("mercator"===i.projection.name){let e=0;i.elevation&&(e=i.elevation.getAtPointOrZero(new Bl(h.x/m,h.y/m),0));const t=U.vec4.transformMat4([],[h.x,h.y,e,1],i.projMatrix)[3]/i.cameraToCenterDistance;f=t,A=t*bl(i.center.lat,u)}else if("globe"===i.projection.name){const t=pm(e,i),n=U.mat4.multiply([],i.projMatrix,t),o=[0,0,0,1];U.vec4.transformMat4(o,o,n);const s=o[3]/i.cameraToCenterDistance,a=Hc(u),l=i.projection.pixelsPerMeter(r.lat,m)*bl(r.lat,u),c=i.projection.pixelsPerMeter(i.center.lat,m)*bl(i.center.lat,u);f=s/Et(l,xl(i.center.lat),a),A=s*d/l,f*=c,A*=c}}else f=p;U.mat4.scale(e,e,[f,f,A]);const g=[...e],_=t.orientation,y=[];if(hm(y,[_[0]+n[0],_[1]+n[1],_[2]+n[2]],o),U.mat4.multiply(e,g,y),a&&i.elevation){let n=0;const o=[];if(l&&i.elevation){n=function(e,t,i,r,n){const o=t.elevation;if(!o)return 0;const s=Tc.projectAabbCorners(i,r),a=ml(1,n.lat)*t.worldSize,l=function(e,t){const i=[0,0,1],r=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const n of r){const r=e[n.corners[0]],o=e[n.corners[1]],s=e[n.corners[2]],a=[o[0]-r[0],o[1]-r[1],t*(o[2]-r[2])],l=U.vec3.cross(a,a,[s[0]-r[0],s[1]-r[1],t*(s[2]-r[2])]);U.vec3.normalize(l,l),n.dotProductWithUp=U.vec3.dot(l,i)}return r.sort(((e,t)=>e.dotProductWithUp-t.dotProductWithUp)),r[0].corners}(s,a),c=s[l[0]],u=s[l[1]],h=s[l[2]],d=s[l[3]],p=o.getAtPointOrZero(new Bl(c[0]/t.worldSize,c[1]/t.worldSize),0),f=o.getAtPointOrZero(new Bl(u[0]/t.worldSize,u[1]/t.worldSize),0),A=o.getAtPointOrZero(new Bl(h[0]/t.worldSize,h[1]/t.worldSize),0),m=o.getAtPointOrZero(new Bl(d[0]/t.worldSize,d[1]/t.worldSize),0),g=(p+m)/2,_=(f+A)/2;return g>_?f=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function km(e,t,i){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,Am.members,!1,!0),e.normalArray&&(e.normalBuffer=t.createVertexBuffer(e.normalArray,ym.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,_m.members,!1,!0)),e.colorArray&&(e.colorBuffer=t.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?mm:gm).members,!1,!0)),e.featureArray&&(e.pbrBuffer=t.createVertexBuffer(e.featureArray,xm.members,!0)),e.segments=_a.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const r=e.material;r.pbrMetallicRoughness.baseColorTexture&&Fm(r.pbrMetallicRoughness.baseColorTexture,t),r.pbrMetallicRoughness.metallicRoughnessTexture&&Fm(r.pbrMetallicRoughness.metallicRoughnessTexture,t),r.normalTexture&&Fm(r.normalTexture,t),r.occlusionTexture&&Fm(r.occlusionTexture,t,i),r.emissionTexture&&Fm(r.emissionTexture,t)}function zm(e,t,i){if(e.meshes)for(const r of e.meshes)km(r,t,i);if(e.children)for(const r of e.children)zm(r,t,i)}function Rm(e){if(e.meshes)for(const t of e.meshes)t.indexArray.destroy(),t.vertexArray.destroy(),t.colorArray&&t.colorArray.destroy(),t.normalArray&&t.normalArray.destroy(),t.texcoordArray&&t.texcoordArray.destroy(),t.featureArray&&t.featureArray.destroy();if(e.children)for(const t of e.children)Rm(t)}function Dm(e){if(e.meshes)for(const i of e.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((t=i.material).pbrMetallicRoughness.baseColorTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),t.pbrMetallicRoughness.metallicRoughnessTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),t.normalTexture&&t.normalTexture.gfxTexture&&t.normalTexture.gfxTexture.destroy(),t.emissionTexture&&t.emissionTexture.gfxTexture&&t.emissionTexture.gfxTexture.destroy(),t.occlusionTexture&&t.occlusionTexture.gfxTexture&&t.occlusionTexture.gfxTexture.destroy()));var t;if(e.children)for(const t of e.children)Dm(t)}class Om{constructor(e,t,i){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=i}static create(e,t,i){const r=i||e.findDEMTileFor(t);if(!r||!r.dem)return;const n=r.dem,o=r.tileID,s=1<e.fqid)),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.modelTraits|=Pm.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,r&&(this.modelTraits|=Pm.HasMapboxMeshFeatures),n&&(this.modelTraits|=Pm.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=o,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const e of t)this.nodesInfo.push(new Hm(e)),jm(e,s.featureIndexArray.length,s.grid),s.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,s.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,t){for(const i of this.getNodesInfo()){const r=i.node;r.footprint&&t.push({footprint:r.footprint,id:e})}}update(e){const t=0!==Object.keys(e).length;if(t&&!this.stateDependentLayers.length)return;const i=t?this.stateDependentLayers:this.layers;if(!H(e,this.states))for(const t of i)this.evaluate(t,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const t=this.getNodesInfo();for(const i of t){const t=i.node;this.uploaded?this.updatePbrBuffer(t):zm(t,e,!0)}for(const e of t)Rm(e.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let t=!1;if(!e.meshes)return t;for(const i of e.meshes)i.pbrBuffer&&(i.pbrBuffer.updateData(i.featureArray),t=!0);return t}needsReEvaluation(e,t,i){const r=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;if(!this.uploaded||this.dirty||r.name!==this.projection.name||$m(i.paint.get("model-color").value,o)||$m(i.paint.get("model-color-mix-intensity").value,o)||$m(i.paint.get("model-roughness").value,o)||$m(i.paint.get("model-emissive-strength").value,o)||$m(i.paint.get("model-height-based-emissive-strength-multiplier").value,o)){this.projection=r,this.brightness=n;const e=this.getNodesInfo();for(const t of e)t.state=null;return!0}return!1}evaluateScale(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const i=this.getNodesInfo(),r=this.id.canonical;for(const e of i){const i=e.feature;e.evaluatedScale=t.paint.get("model-scale").evaluate(i,{},r)}}evaluate(e,t){const i=this.getNodesInfo();for(const r of i){if(!r.node.meshes)continue;const i=r.feature,n=t&&t[i.id];if(H(n,r.state))continue;r.state=structuredClone(n);const o=r.node.meshes&&r.node.meshes[0].featureData,s=r.evaluatedColor[2],a=r.evaluatedRMEA[2],l=this.id.canonical;if(r.hasTranslucentParts=!1,o){for(let t=0;t=e)continue;const h=Um[c],d=Math.abs(h);d>a&&(s=h,a=d,l=n,u=t)}if(a>.1){const o=1-(e+.5*Math.abs(l*u))/c;let a=t._dem.get(r,i)+s*o;const h=t._dem.get(r+l,i+u),d=t._dem.get(r-l,i-u,!0);(a-h)*(a-d)>0&&(a=(h+d)/2),Um[n]=t._dem.set(r,i,a),Nm[n]=e}}}}}s&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=ke.now())}setFilter(e){this.filter=e?es(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter((e=>this.filter.filter(new Do(this.id.overscaledZ),e.feature,this.id.canonical))):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)Rm(t.node),Dm(t.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped()),r=this.getNodesInfo();for(let e=0;ee.footprint===t.footprint))}}getHeightAtTileCoord(e,t){const i=this.getNodesInfo(),r=[],n=[0,0,0],o=U.mat4.identity([]);for(let s=0;sc.max[0]||t>c.max[1])continue;if(!0===a.node.hidden)return{height:1/0,maxHeight:a.feature.properties.height,hidden:!1,verticalScale:a.evaluatedScale[2]};U.mat4.invert(o,a.node.matrix),n[0]=e,n[1]=t,U.vec3.transformMat4(n,n,o);const u=(n[0]-l.aabb.min[0])/(l.aabb.max[0]-l.aabb.min[0])*Im|0,h=Math.min(63,(n[1]-l.aabb.min[1])/(l.aabb.max[1]-l.aabb.min[1])*Im|0)*Im+Math.min(63,u),d=l.heightmap[h];if(!(d<0&&a.node.footprint)){if(a.hiddenByReplacement)return;return{height:d,maxHeight:a.feature.properties.height,hidden:!1,verticalScale:a.evaluatedScale[2]}}if(a.node.footprint.grid.query(new V(e,t),new V(e,t),r),r.length>0)return{height:void 0,maxHeight:a.feature.properties.height,hidden:a.hiddenByReplacement,verticalScale:a.evaluatedScale[2]}}}}function $m(e,t){return!e.isLightConstant&&t}function Zm(e,t,i,r,n,o,s,a){let l=(61440&t|(61440&t)>>4)>>8,c=(3840&t|(3840&t)>>4)>>4,u=240&t|(240&t)>>4;i[3]>0&&(l=Et(l,255*i[0],i[3]),c=Et(c,255*i[1],i[3]),u=Et(u,255*i[2],i[3]));const h=l<<8|c,d=u<<8|Math.floor(255*r[3]),p=function(e){const t=J(e,0,2);return Math.min(Math.round(.5*t*255),255)}(r[2])<<8|15*r[0]<<4|15*r[1],f=J(n[0],0,1),A=J(n[1],0,1),m=J(n[2],0,1),g=J(n[3],0,1);let _,y,v,x;if(f!==A&&s!==o&&A!==f){const e=s-o;y=1/(e*(A-f)),v=-(o+e*f)/(e*(A-f));const t=J(n[4],-1,1);x=Math.pow(10,t),_=255*m<<8|255*g}else _=65535,y=0,v=1,x=1;if(e.emplaceBack(h,d,p,_,y,v,x),a){const e=a.length;a.clear();for(let t=0;t>16&65535,a=o?t>>16&65535:65535&t,l=(15&a)<8?15&a:0,c=e.evaluatedRMEA[l],u=e.evaluatedColor[l],h=e.emissionHeightBasedParams[l];let d;if(s&&2===l&&r.lights&&(d=new ea,d.resize(10*r.lights.length)),Zm(i.featureArray,n,u,c,h,i.aabb.min[2],i.aabb.max[2],d),d&&s){s=!1;const e=r.meshes[r.lightMeshIndex];e.featureArray=d,e.featureArray._trim()}}i.featureArray._trim(),n++}}function Km(e,t,i,r){const n=1<e.polygon)).flat());const m=p?a:null,[g,_]=function(e,t,i,r,n,o,s,a,l,c,u){return"globe"===e.projection.name?function(e,t,i,r,n,o,s,a,l,c,u){const h=[],d=[],p=e.projection.upVectorScale(u,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],A=[0,0,0,1],m=(e,t,i,r)=>{e[0]=t,e[1]=i,e[2]=r,e[3]=1},g=Sd();i>0&&(i+=g),r+=g;for(const g of t){const t=[],_=[];for(const h of g){const d=h.x+n.x,g=h.y+n.y,y=e.projection.projectTilePoint(d,g,u),v=e.projection.upVector(u,h.x,h.y);let x=i,b=r;if(s){const e=kd(d,g,i,r,s,a,l,c);x+=e.base,b+=e.top}0!==i?m(f,y.x+v[0]*p*x,y.y+v[1]*p*x,y.z+v[2]*p*x):m(f,y.x,y.y,y.z),m(A,y.x+v[0]*p*b,y.y+v[1]*p*b,y.z+v[2]*p*b),U.vec3.transformMat4(f,f,o),U.vec3.transformMat4(A,A,o),t.push(new Rh(f[0],f[1],f[2])),_.push(new Rh(A[0],A[1],A[2]))}h.push(t),d.push(_)}return[h,d]}(e,t,i,r,n,o,s,a,l,c,u):s?function(e,t,i,r,n,o,s,a,l){const c=[],u=[],h=[0,0,0,1];for(const d of e){const e=[],p=[];for(const c of d){const u=c.x+r.x,d=c.y+r.y,f=kd(u,d,t,i,o,s,a,l);h[0]=u,h[1]=d,h[2]=f.base,h[3]=1,U.vec4.transformMat4(h,h,n),h[3]=Math.max(h[3],1e-5);const A=new Rh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=u,h[1]=d,h[2]=f.top,h[3]=1,U.vec4.transformMat4(h,h,n),h[3]=Math.max(h[3],1e-5);const m=new Rh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(A),p.push(m)}c.push(e),u.push(p)}return[c,u]}(t,i,r,n,o,s,a,l,c):function(e,t,i,r,n){const o=[],s=[],a=n[8]*t,l=n[9]*t,c=n[10]*t,u=n[11]*t,h=n[8]*i,d=n[9]*i,p=n[10]*i,f=n[11]*i;for(const t of e){const e=[],i=[];for(const o of t){const t=o.x+r.x,s=o.y+r.y,A=n[0]*t+n[4]*s+n[12],m=n[1]*t+n[5]*s+n[13],g=n[2]*t+n[6]*s+n[14],_=n[3]*t+n[7]*s+n[15],y=A+a,v=m+l,x=g+c,b=Math.max(_+u,1e-5),w=A+h,T=m+d,B=g+p,C=Math.max(_+f,1e-5);e.push(new Rh(y/b,v/b,x/b)),i.push(new Rh(w/C,T/C,B/C))}o.push(e),s.push(i)}return[o,s]}(t,i,r,n,o)}(o,r,h,u,c,s,m,d,f,o.center.lat,e.tileID.canonical),y=e.queryGeometry;return function(e,t,i){let r=1/0;Nl(i,t)&&(r=Fd(i,t[0]));for(let n=0;n{if(op)return op;const e=rp();return op=new np(e.paint.properties["line-width"].specification),op.useIntegerZoom=!0,op})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new $d(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,t,i){const r=ep(this);return{config:new Ha(this,{zoom:t,lut:i}),defines:r,overrideFog:!1}}queryRadius(e){const t=e,i=sp(Yl("line-width",this,t),Yl("line-gap-width",this,t)),r=Yl("line-offset",this,t);return i/2+Math.abs(r)+Jl(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,r,n,o){if(e.queryGeometry.isAboveHorizon)return!1;const s=ec(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),a=e.pixelToTileUnitsFactor/2*sp(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=function(e,t){const i=[],r=new V(0,0);for(let n=0;n=3)for(let t=0;t{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(){this._channel=void 0,this._callback=()=>{}}}class Ym{constructor(){this.tasks={},this.taskQueue=[],ae(["process"],this),this.invoker=new Xm(this.process),this.nextId=0}add(e,t){const i=this.nextId++,r=function({type:e,isSymbolTile:t,zoom:i}){return i=i||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-i:"maybePrepare"===e&&t?400-i:500:200-i:100-i}(t);if(0===r){try{e()}finally{}return null}return this.tasks[i]={fn:e,metadata:t,priority:r,id:i},this.taskQueue.push(i),this.invoker.trigger(),{cancel:()=>{delete this.tasks[i]}}}process(){try{if(this.taskQueue=this.taskQueue.filter((e=>!!this.tasks[e])),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let i=0;i{i&&delete this.callbacks[s],this.target.postMessage({id:s,type:"",targetMapId:r,sourceMapId:this.mapId})}}}receive(e){const t=e.data;if(!t)return;const i=t.id;if(i&&(!t.targetMapId||this.mapId===t.targetMapId))if(""===t.type){const e=this.cancelCallbacks[i];delete this.cancelCallbacks[i],e&&e.cancel()}else if(t.mustQueue||me()){const e=this.callbacks[i],r=this.scheduler.add((()=>this.processTask(i,t)),e&&e.metadata||{type:"message"});r&&(this.cancelCallbacks[i]=r)}else this.processTask(i,t)}processTask(e,t){if(delete this.cancelCallbacks[e],""===t.type){const i=this.callbacks[e];delete this.callbacks[e],i&&(t.error?i(fo(t.error)):i(null,fo(t.data)))}else{const i=new Set,r=t.hasCallback?(t,r)=>{this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:t?po(t):null,data:po(r,i)},i)}:()=>{},n=fo(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,n,r);else if(this.parent.getWorkerSource){const e=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,e[0],n.source,n.scope)[e[1]](n,r)}else r(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var eg={workerUrl:"",workerClass:null,workerParams:void 0};const tg="mapboxgl_preloaded_worker_pool";class ig{constructor(){this.active={}}acquire(e,t=ig.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[tg]}numActive(){return Object.keys(this.active).length}}ig.workerCount=2;class rg{constructor(e,t,i="Worker",r=ig.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=oe();const n=this.workerPool.acquire(this.id,r);for(let e=0;e{this.ready=!0}))}broadcast(e,t,i){ie(this.actors,((i,r)=>{i.send(e,t,r)}),i=i||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((e=>{e.remove()})),this.actors=[],this.workerPool.release(this.id)}}let ng,og;function sg(){return ng||(ng=new ig),ng}rg.Actor=Jm;const ag=new Ct(0,0,0);var lg=(e=>(e[e.PATH_RULE_UNSPECIFIED=0]="PATH_RULE_UNSPECIFIED",e[e.PATH_RULE_NON_ZERO=1]="PATH_RULE_NON_ZERO",e[e.PATH_RULE_EVEN_ODD=2]="PATH_RULE_EVEN_ODD",e))(lg||{}),cg=(e=>(e[e.LINE_CAP_UNSPECIFIED=0]="LINE_CAP_UNSPECIFIED",e[e.LINE_CAP_BUTT=1]="LINE_CAP_BUTT",e[e.LINE_CAP_ROUND=2]="LINE_CAP_ROUND",e[e.LINE_CAP_SQUARE=3]="LINE_CAP_SQUARE",e))(cg||{}),ug=(e=>(e[e.LINE_JOIN_UNSPECIFIED=0]="LINE_JOIN_UNSPECIFIED",e[e.LINE_JOIN_MITER=1]="LINE_JOIN_MITER",e[e.LINE_JOIN_MITER_CLIP=2]="LINE_JOIN_MITER_CLIP",e[e.LINE_JOIN_ROUND=3]="LINE_JOIN_ROUND",e[e.LINE_JOIN_BEVEL=4]="LINE_JOIN_BEVEL",e))(ug||{}),hg=(e=>(e[e.PAINT_ORDER_UNSPECIFIED=0]="PAINT_ORDER_UNSPECIFIED",e[e.PAINT_ORDER_FILL_AND_STROKE=1]="PAINT_ORDER_FILL_AND_STROKE",e[e.PAINT_ORDER_STROKE_AND_FILL=2]="PAINT_ORDER_STROKE_AND_FILL",e))(hg||{}),dg=(e=>(e[e.PATH_COMMAND_UNSPECIFIED=0]="PATH_COMMAND_UNSPECIFIED",e[e.PATH_COMMAND_MOVE=1]="PATH_COMMAND_MOVE",e[e.PATH_COMMAND_LINE=2]="PATH_COMMAND_LINE",e[e.PATH_COMMAND_QUAD=3]="PATH_COMMAND_QUAD",e[e.PATH_COMMAND_CUBIC=4]="PATH_COMMAND_CUBIC",e[e.PATH_COMMAND_CLOSE=5]="PATH_COMMAND_CLOSE",e))(dg||{}),pg=(e=>(e[e.MASK_TYPE_UNSPECIFIED=0]="MASK_TYPE_UNSPECIFIED",e[e.MASK_TYPE_LUMINANCE=1]="MASK_TYPE_LUMINANCE",e[e.MASK_TYPE_ALPHA=2]="MASK_TYPE_ALPHA",e))(pg||{});function fg(e,t,i){1===e&&t.icons.push(function(e,t){return function(e){if(e.usvg_tree.height||(e.usvg_tree.height=e.usvg_tree.width),!e.metadata)return e;const{metadata:t}=e;if(t.content_area){const{content_area:i}=t;null==i.top&&(i.top=i.left),null==i.width&&(i.width=e.usvg_tree.width),null==i.height&&(i.height=i.width)}return t.stretch_x&&t.stretch_x.length&&Ag(t,"x"),t.stretch_y&&t.stretch_y.length&&Ag(t,"y"),e}(e.readFields(mg,{name:void 0},t))}(i,i.readVarint()+i.pos))}function Ag(e,t){const i=[],r=e[`stretch_${t}`];let n=null;for(let e=0;e>16&255)/255,(e>>8&255)/255,(255&e)/255,1)}function Mg(e,t,i){1===e?(t.rgb_color=Eg(i.readVarint()),t.paint="rgb_color"):2===e?(t.linear_gradient_idx=i.readVarint(),t.paint="linear_gradient_idx"):3===e?(t.radial_gradient_idx=i.readVarint(),t.paint="radial_gradient_idx"):5===e?i.readPackedFloat(t.dasharray):6===e?t.dashoffset=i.readFloat():7===e?t.miterlimit=i.readFloat():8===e?t.opacity=i.readVarint():9===e?t.width=i.readFloat():10===e?t.linecap=i.readVarint():11===e&&(t.linejoin=i.readVarint())}function Ig(e,t,i){1===e?t.transform=Tg(i,i.readVarint()+i.pos):2===e?t.spread_method=i.readVarint():3===e?t.stops.push(Pg(i,i.readVarint()+i.pos)):4===e?t.x1=i.readFloat():5===e?t.y1=i.readFloat():6===e?t.x2=i.readFloat():7===e&&(t.y2=i.readFloat())}function Pg(e,t){return e.readFields(Lg,{offset:0,opacity:255,rgb_color:ag},t)}function Lg(e,t,i){1===e?t.offset=i.readFloat():2===e?t.opacity=i.readVarint():3===e&&(t.rgb_color=Eg(i.readVarint()))}function Fg(e,t,i){1===e?t.transform=Tg(i,i.readVarint()+i.pos):2===e?t.spread_method=i.readVarint():3===e?t.stops.push(Pg(i,i.readVarint()+i.pos)):4===e?t.cx=i.readFloat():5===e?t.cy=i.readFloat():6===e?t.r=i.readFloat():7===e?t.fx=i.readFloat():8===e?t.fy=i.readFloat():9===e&&(t.fr=i.readFloat())}function kg(e,t,i){1===e?t.transform=Tg(i,i.readVarint()+i.pos):2===e?t.clip_path_idx=i.readVarint():3===e&&t.children.push(xg(i,i.readVarint()+i.pos))}function zg(e,t,i){1===e?t.left=t.top=i.readFloat():2===e?t.width=t.height=i.readFloat():3===e?t.top=i.readFloat():4===e?t.height=i.readFloat():5===e?t.mask_type=i.readVarint():6===e?t.mask_idx=i.readVarint():7===e&&t.children.push(xg(i,i.readVarint()+i.pos))}class Rg{static calculate(e={},t=[]){const i=new Map,r=new Map;if(0===Object.keys(e).length)return i;t.forEach((e=>{r.set(e.name,e.rgb_color||new Ct(0,0,0))}));for(const[t,n]of Object.entries(e))r.has(t)?i.set(r.get(t).toStringPremultipliedAlpha(),n):console.warn(`Ignoring unknown image variable "${t}"`);return i}}function Dg(e,t=255,i){const r=t/255,n=e.toStringPremultipliedAlpha(),o=i.has(n)?i.get(n).clone():e.clone();return o.a*=r,o.toString()}function Og(e,t){if(!Fe()){const i=document.createElement("canvas");return i.width=e,i.height=t,i}return new OffscreenCanvas(e,t)}function Ug(e,t){const i=Rg.calculate(t.params,e.metadata?e.metadata.variables:[]),r=e.usvg_tree,n=r.width,o=r.height,s=t.transform?t.transform:new DOMMatrix,a=Math.max(1,Math.round(n*s.a)),l=Math.max(1,Math.round(o*s.d)),c=new DOMMatrix([a/n,0,0,l/o,0,0]),u=Og(a,l).getContext("2d");return Ng(u,c,r,r,i),u.getImageData(0,0,a,l)}function Ng(e,t,i,r,n){for(const o of r.children)Qg(e,t,i,o,n)}function Qg(e,t,i,r,n){r.group?(e.save(),function(e,t,i,r,n){const o=null!=r.mask_idx?i.masks[r.mask_idx]:null,s=null!=r.clip_path_idx?i.clip_paths[r.clip_path_idx]:null;if(r.transform&&(t=Wg(r.transform).preMultiplySelf(t)),!function(e,t,i){return 255!==e.opacity||t||i}(r,null!=s,null!=o))return void Ng(e,t,i,r,n);const a=Og(e.canvas.width,e.canvas.height),l=a.getContext("2d");Ng(l,t,i,r,n),s&&qg(l,t,i,s),o&&Kg(l,t,i,o,n),e.globalAlpha=r.opacity/255,e.drawImage(a,0,0)}(e,t,i,r.group,n),e.restore()):r.path&&(e.save(),function(e,t,i,r,n){const o=Xg(r);e.setTransform(t),r.paint_order===hg.PAINT_ORDER_FILL_AND_STROKE?(jg(e,i,r,o,n),Hg(e,i,r,o,n)):(Hg(e,i,r,o,n),jg(e,i,r,o,n))}(e,t,i,r.path,n),e.restore())}function jg(e,t,i,r,n){const o=i.fill;if(!o)return;const s=o.opacity/255;switch(o.paint){case"rgb_color":e.fillStyle=Dg(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":e.fillStyle=Gg(e,t.linear_gradients[o.linear_gradient_idx],s,n);break;case"radial_gradient_idx":e.fillStyle=$g(e,t.radial_gradients[o.radial_gradient_idx],s,n)}e.fill(r,Vg(i))}function Vg(e){return e.rule===lg.PATH_RULE_NON_ZERO?"nonzero":e.rule===lg.PATH_RULE_EVEN_ODD?"evenodd":void 0}function Hg(e,t,i,r,n){const o=i.stroke;if(!o)return;e.lineWidth=o.width,e.miterLimit=o.miterlimit,e.setLineDash(o.dasharray),e.lineDashOffset=o.dashoffset;const s=o.opacity/255;switch(o.paint){case"rgb_color":e.strokeStyle=Dg(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":e.strokeStyle=Gg(e,t.linear_gradients[o.linear_gradient_idx],s,n);break;case"radial_gradient_idx":e.strokeStyle=$g(e,t.radial_gradients[o.radial_gradient_idx],s,n)}switch(o.linejoin){case ug.LINE_JOIN_MITER_CLIP:case ug.LINE_JOIN_MITER:e.lineJoin="miter";break;case ug.LINE_JOIN_ROUND:e.lineJoin="round";break;case ug.LINE_JOIN_BEVEL:e.lineJoin="bevel"}switch(o.linecap){case cg.LINE_CAP_BUTT:e.lineCap="butt";break;case cg.LINE_CAP_ROUND:e.lineCap="round";break;case cg.LINE_CAP_SQUARE:e.lineCap="square"}e.stroke(r)}function Gg(e,t,i,r){if(1===t.stops.length){const e=t.stops[0];return Dg(e.rgb_color,e.opacity*i,r)}const n=Wg(t.transform),{x1:o,y1:s,x2:a,y2:l}=t,c=n.transformPoint(new DOMPoint(o,s)),u=n.transformPoint(new DOMPoint(a,l)),h=e.createLinearGradient(c.x,c.y,u.x,u.y);for(const e of t.stops)h.addColorStop(e.offset,Dg(e.rgb_color,e.opacity*i,r));return h}function $g(e,t,i,r){if(1===t.stops.length){const e=t.stops[0];return Dg(e.rgb_color,e.opacity*i,r)}const n=Wg(t.transform),{fx:o,fy:s,cx:a,cy:l}=t,c=n.transformPoint(new DOMPoint(o,s)),u=n.transformPoint(new DOMPoint(a,l)),h=e.createRadialGradient(c.x,c.y,0,u.x,u.y,t.r*((n.a+n.d)/2));for(const e of t.stops)h.addColorStop(e.offset,Dg(e.rgb_color,e.opacity*i,r));return h}function Zg(e,t,i,r){const n=r.transform?Wg(r.transform).preMultiplySelf(t):t,o=Og(e.canvas.width,e.canvas.height),s=o.getContext("2d");for(const e of r.children)if(e.group)Zg(s,n,i,e.group);else if(e.path){const t=e.path,i=new Path2D;i.addPath(Xg(t),n),s.fill(i,Vg(t))}const a=null!=r.clip_path_idx?i.clip_paths[r.clip_path_idx]:null;a&&qg(s,n,i,a),e.globalCompositeOperation="source-over",e.drawImage(o,0,0)}function qg(e,t,i,r){const n=Og(e.canvas.width,e.canvas.height);Zg(n.getContext("2d"),t,i,r),e.globalCompositeOperation="destination-in",e.drawImage(n,0,0)}function Kg(e,t,i,r,n){if(0===r.children.length)return;const o=null!=r.mask_idx?i.masks[r.mask_idx]:null;o&&Kg(e,t,i,o,n);const s=e.canvas.width,a=e.canvas.height,l=Og(s,a),c=l.getContext("2d"),u=r.width,h=r.height,d=r.left,p=r.top,f=new Path2D,A=new Path2D;A.rect(d,p,u,h),f.addPath(A,t),c.clip(f);for(const e of r.children)Qg(c,t,i,e,n);const m=c.getImageData(0,0,s,a),g=m.data;if(r.mask_type===pg.MASK_TYPE_LUMINANCE)for(let e=0;et[s])return null}else{const a=1/r[s];let l=(e[s]-i[s])*a,c=(t[s]-i[s])*a;if(l>c){const e=l;l=c,c=e}if(l>n&&(n=l),co)return null}return n}function i_(e,t,i,r,n,o,s,a,l,c,u){const h=r-e,d=n-t,p=o-i,f=s-e,A=a-t,m=l-i,g=u[1]*m-u[2]*A,_=u[2]*f-u[0]*m,y=u[0]*A-u[1]*f,v=h*g+d*_+p*y;if(Math.abs(v)<1e-15)return null;const x=1/v,b=c[0]-e,w=c[1]-t,T=c[2]-i,B=(b*g+w*_+T*y)*x;if(B<0||B>1)return null;const C=w*p-T*d,S=T*h-b*p,E=b*d-w*h,M=(u[0]*C+u[1]*S+u[2]*E)*x;return M<0||B+M>1?null:(f*C+A*S+m*E)*x}function r_(e,t,i){return(e-t)/(i-t)}function n_(e,t,i,r,n,o,s,a,l){const c=1<{const o=r?1:0,s=(e+1)*i-o,a=t*i,l=(t+1)*i-o;n[0]=e*i,n[1]=a,n[2]=s,n[3]=l};let s=new e_(r);const a=[];for(let t=0;t=1;r/=2){const e=i[i.length-1];s=new e_(r);for(let t=0;t0;){const{idx:a,t:p,nodex:f,nodey:A,depth:m}=d.pop();if(this.leaves[a]){n_(f,A,m,e,t,i,r,u,h);const a=1<=e[2])return p}continue}let g=0;for(let d=0;d=l[c[i]]&&(c.splice(i,0,d),t=!0);t||(c[g]=d),g++}}for(let e=0;e=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const i=[0,0,0,0],r=h_.getUnpackVector(t);let n=Math.floor((e+r[3])/r[2]);return i[2]=n%256,n=Math.floor(n/256),i[1]=n%256,n=Math.floor(n/256),i[0]=n,i}getPixels(){return new pu({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-t*this.dim,l=-i*this.dim;for(let t=o;t=1;r--){const n=1===r?1:0,o=2===r?1:0;for(let r=0;r>>1^-(1&e[t]);return e}function b_(e,t){switch(t){case"uint32":return e;case"uint16":for(let t=0;t>4|(61440&i)>>8|(240&r)<<4|61440&r,e[t+1]=15&i|(3840&i)>>4|(15&r)<<8|(3840&r)<<4}return e;case"uint8":for(let t=0;t>6|(192&r)>>4|(192&n)>>2|192&o,e[t+1]=(48&i)>>4|(48&r)>>2|48&n|(48&o)<<2,e[t+2]=(12&i)>>2|12&r|(12&n)<<2|(12&o)<<4,e[t+3]=3&i|(3&r)<<2|(3&n)<<4|(3&o)<<6}return e;default:throw new Error(`Invalid pixel format, "${t}"`)}}co(h_,"DEMData"),co(o_,"DemMinMaxQuadTree",{omit:["dem"]});var w_=Uint8Array,T_=Uint16Array,B_=Int32Array,C_=new w_([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),S_=new w_([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),E_=new w_([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),M_=function(e,t){for(var i=new T_(31),r=0;r<31;++r)i[r]=t+=1<>1|(21845&z_)<<1;k_[z_]=((65280&(R_=(61680&(R_=(52428&R_)>>2|(13107&R_)<<2))>>4|(3855&R_)<<4))>>8|(255&R_)<<8)>>1}var D_=function(e,t,i){for(var r=e.length,n=0,o=new T_(t);n>l]=c;return s},O_=new w_(288);for(z_=0;z_<144;++z_)O_[z_]=8;for(z_=144;z_<256;++z_)O_[z_]=9;for(z_=256;z_<280;++z_)O_[z_]=7;for(z_=280;z_<288;++z_)O_[z_]=8;var U_=new w_(32);for(z_=0;z_<32;++z_)U_[z_]=5;var N_=D_(O_,9),Q_=D_(U_,5),j_=function(e){for(var t=e[0],i=1;it&&(t=e[i]);return t},V_=function(e,t,i){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&i},H_=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},G_=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],$_=function(e,t,i){var r=new Error(t||G_[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,$_),!i)throw r;return r},Z_=new w_(0),q_="undefined"!=typeof TextDecoder&&new TextDecoder;try{q_.decode(Z_,{stream:!0})}catch(e){}const K_={gzip_data:"gzip"};class W_ extends Error{constructor(e){super(e),this.name="MRTError"}}const X_={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Y_={uint32:1,uint16:2,uint8:4},J_={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let ey;class ty{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new W_(`Layer '${e}' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),i=new DataView(e);if(13!==t[0])throw new W_("File is not a valid MRT.");return i.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),i=this.getHeaderLength(e);if(t.length= ${i} but got buffer of length ${t.length}`);const r=function(e){return e.readFields(d_,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0)}(new ey(t.subarray(0,i)));if(!isNaN(this.x)&&(this.x!==r.x||this.y!==r.y||this.z!==r.z))throw new W_(`Invalid attempt to parse header ${r.z}/${r.x}/${r.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=r.x,this.y=r.y,this.z=r.z;for(const e of r.layers)this.layers[e.name]=new iy(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],i=this.getLayer(e.layerName);for(let r of e.blockIndices){const n=i.dataIndex[r],o=n.firstByte-e.firstByte,s=n.lastByte-e.firstByte;if(i._blocksInProgress.has(r))continue;const a={layerName:i.name,firstByte:o,lastByte:s,pixelFormat:i.pixelFormat,blockIndex:r,blockShape:[n.bands.length].concat(i.bandShape),buffer:i.buffer,codec:n.codec.codec,filters:n.filters.map((e=>e.filter))};i._blocksInProgress.add(r),t.push(a)}return new ry(t,(()=>{t.forEach((e=>i._blocksInProgress.delete(e.blockIndex)))}),((e,r)=>{if(t.forEach((e=>i._blocksInProgress.delete(e.blockIndex))),e)throw e;r.forEach((e=>{this.getLayer(e.layerName).processDecodedData(e)}))}))}}class iy{constructor({version:e,name:t,units:i,tileSize:r,pixelFormat:n,buffer:o,dataIndex:s},a){if(this.version=e,1!==this.version)throw new W_(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=i,this.tileSize=r,this.buffer=o,this.pixelFormat=X_[n],this.dataIndex=s,this.bandShape=[r+2*o,r+2*o,Y_[this.pixelFormat]],this._decodedBlocks=new Yg(a?a.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return Y_[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map((({bands:e})=>e)).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[i,r]of this.dataIndex.entries()){for(const[n,o]of r.bands.entries())if(o===e)return{bandIndex:t+n,blockIndex:i,blockBandIndex:n};t+=r.bands.length}break;case"number":for(const[i,r]of this.dataIndex.entries()){if(e>=t&&ethis.cacheSize)throw new W_(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:i,blockIndices:r}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:i}=this.getBlockForBand(e);if(t<0)throw new W_(`Band not found: ${JSON.stringify(e)}`);const r=this._decodedBlocks.get(t.toString());if(!r)throw new W_(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const n=this.dataIndex[t],o=this.bandShape.reduce(((e,t)=>e*t),1),s=i*o,a=r.subarray(s,s+o);return{data:a,bytes:new Uint8Array(a.buffer).subarray(a.byteOffset,a.byteOffset+a.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:n.offset,scale:n.scale}}}ty.setPbf=function(e){ey=e};class ry{constructor(e,t,i){this.tasks=e,this._onCancel=t,this._onComplete=i,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}ty.performDecoding=function(e,t){const i=new Uint8Array(e);return Promise.all(t.tasks.map((e=>{const{layerName:t,firstByte:r,lastByte:n,pixelFormat:o,blockShape:s,blockIndex:a,filters:l,codec:c}=e,u=i.subarray(r,n+1),h=new Uint32Array(s[0]*s[1]*s[2]);let d;if("gzip_data"!==c)throw new W_(`Unhandled codec: ${c}`);return d=function(e,t){if(!globalThis.DecompressionStream&&"gzip_data"===t)return Promise.resolve(((o=function(e){31==e[0]&&139==e[1]&&8==e[2]||$_(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[i++]);return i+(2&t)}(n=e))+8>n.length&&$_(6,"invalid gzip data"),function(e,t,i){var r=e.length;if(!r||t.f&&!t.l)return i||new w_(0);var n=!i,o=n||2!=t.i,s=t.i;n&&(i=new w_(3*r));var a,l,c=function(e){var t=i.length;if(e>t){var r=new w_(Math.max(2*t,e));r.set(i),i=r}},u=t.f||0,h=t.p||0,d=t.b||0,p=t.l,f=t.d,A=t.m,m=t.n,g=8*r;do{if(!p){u=V_(e,h,1);var _=V_(e,h+1,3);if(h+=3,!_){var y=e[(I=4+((h+7)/8|0))-4]|e[I-3]<<8,v=I+y;if(v>r){s&&$_(0);break}o&&c(d+y),i.set(e.subarray(I,v),d),t.b=d+=y,t.p=h=8*v,t.f=u;continue}if(1==_)p=N_,f=Q_,A=9,m=5;else if(2==_){var x=V_(e,h,31)+257,b=V_(e,h+10,15)+4,w=x+V_(e,h+5,31)+1;h+=14;for(var T=new w_(w),B=new w_(19),C=0;C>4)<16)T[C++]=I;else{var L=0,F=0;for(16==I?(F=3+V_(e,h,3),h+=2,L=T[C-1]):17==I?(F=3+V_(e,h,7),h+=3):18==I&&(F=11+V_(e,h,127),h+=7);F--;)T[C++]=L}}var k=T.subarray(0,x),z=T.subarray(x);A=j_(k),m=j_(z),p=D_(k,A),f=D_(z,m)}else $_(1);if(h>g){s&&$_(0);break}}o&&c(d+131072);for(var R=(1<>4;if((h+=15&L)>g){s&&$_(0);break}if(L||$_(2),U<256)i[d++]=U;else{if(256==U){O=h,p=null;break}var N=U-254;U>264&&(N=V_(e,h,(1<<(V=C_[C=U-257]))-1)+P_[C],h+=V);var Q=f[H_(e,h)&D],j=Q>>4;if(Q||$_(3),h+=15&Q,z=F_[j],j>3){var V=S_[j];z+=H_(e,h)&(1<g){s&&$_(0);break}o&&c(d+131072);var H=d+N;if(da.length)&&(l=a.length),new w_(a.subarray(0,l))):i.subarray(0,d)}(n.subarray(o,-8),{i:2},new w_(((i=n)[(r=i.length)-4]|i[r-3]<<8|i[r-2]<<16|i[r-1]<<24)>>>0))));var i,r,n,o;const s=K_[t];if(!s)throw new Error(`Unhandled codec: ${t}`);const a=new globalThis.DecompressionStream(s);return new Response(new Blob([e]).stream().pipeThrough(a)).arrayBuffer().then((e=>new Uint8Array(e)))}(u,c).then((e=>(function(e,t){e.readFields(__,t)}(new ey(e),h),new J_[o](h.buffer)))),d.then((e=>{for(let t=l.length-1;t>=0;t--)switch(l[t]){case"delta_filter":v_(e,s);break;case"zigzag_filter":x_(e);break;case"bitshuffle_filter":b_(e,o);break;default:throw new W_(`Unhandled filter "${l[t]}"`)}return{layerName:t,blockIndex:a,data:e}})).catch((e=>{throw e}))})))},co(ry,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),co(ty,"MapboxRasterTile"),co(iy,"MapboxRasterLayer",{omit:["_blocksInProgress"]});let ny,oy,sy,ay,ly,cy=null;function uy(){return me()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:oy||Te.DRACO_URL}function hy(){if(me()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(ay)return ay;const e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if("object"!=typeof WebAssembly)throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return ay=WebAssembly.validate(e)?Te.MESHOPT_SIMD_URL:Te.MESHOPT_URL,ay}const dy={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},py={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},fy={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Ay(e,t,i){const r=i.json.bufferViews.length,n=i.buffers.length;t.bufferView=r,i.json.bufferViews[r]={buffer:n,byteLength:e.byteLength},i.buffers[n]=e}const my="KHR_draco_mesh_compression";function gy(e,t){const i=e.extensions&&e.extensions[my];if(!i)return;const r=new sy.Decoder,n=Ty(t,i.bufferView),o=new sy.Mesh;if(!r.DecodeArrayToMesh(n,n.byteLength,o))throw new Error("Failed to decode Draco mesh");const s=t.json.accessors[e.indices],a=dy[s.componentType],l=s.count*a.BYTES_PER_ELEMENT,c=sy._malloc(l);a===Uint16Array?r.GetTrianglesUInt16Array(o,l,c):r.GetTrianglesUInt32Array(o,l,c),Ay(sy.memory.buffer.slice(c,c+l),s,t),sy._free(c);for(const n of Object.keys(i.attributes)){const s=r.GetAttributeByUniqueId(o,i.attributes[n]),a=t.json.accessors[e.attributes[n]],l=py[a.componentType],c=a.count*fy[a.type]*dy[a.componentType].BYTES_PER_ELEMENT,u=sy._malloc(c);r.GetAttributeDataArrayForAllPoints(o,s,sy[l],c,u),Ay(sy.memory.buffer.slice(u,u+c),a,t),sy._free(u)}r.destroy(),o.destroy(),delete e.extensions[my]}const _y="EXT_meshopt_compression";function yy(e,t){if(!e.extensions||!e.extensions[_y])return;const i=e.extensions[_y],r=new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),n=new Uint8Array(i.count*i.byteStride);ly.decodeGltfBuffer(n,i.count,i.byteStride,r,i.mode,i.filter),e.buffer=t.buffers.length,e.byteOffset=0,t.buffers[e.buffer]=n.buffer,delete e.extensions[_y]}const vy=1179937895,xy=new TextDecoder("utf8");function by(e,t){return new URL(e,t).href}function wy(e,t,i,r){return fetch(by(e.uri,r)).then((e=>e.arrayBuffer())).then((e=>{t.buffers[i]=e}))}function Ty(e,t){const i=e.json.bufferViews[t];return new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function By(e,t,i,r){if(e.uri){const n=by(e.uri,r);return fetch(n).then((e=>e.blob())).then((e=>createImageBitmap(e))).then((e=>{t.images[i]=e}))}if(void 0!==e.bufferView){const r=Ty(t,e.bufferView),n=new Blob([r],{type:e.mimeType});return createImageBitmap(n).then((e=>{t.images[i]=e}))}}function Cy(e,t=0,i){const r={json:null,images:[],buffers:[]};if(new Uint32Array(e,t,1)[0]===vy){const i=new Uint32Array(e,t);let n=2;const o=(i[n++]>>2)-3,s=i[n++]>>2;if(n++,r.json=JSON.parse(xy.decode(i.subarray(n,n+s))),n+=s,n{const e=[],t=a&&a.includes(my),n=a&&a.includes(_y);if(t&&e.push(function(){if(!sy)return null!=ny?ny:(ny=function(e){let t,i=null;function r(){t=new Uint8Array(i.buffer)}function n(){throw new Error("Unexpected Draco error.")}const o={a:{a:n,d:function(e,i,r){return t.copyWithin(e,i,i+r)},c:function(e){const n=t.length,o=Math.max(e>>>0,Math.ceil(1.2*n)),s=Math.ceil((o-n)/65536);try{return i.grow(s),r(),!0}catch(e){return!1}},b:n}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,o):e.then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,o)))).then((e=>{const{Rb:n,Qb:o,P:s,T:a,X:l,Ja:c,La:u,Qa:h,Va:d,Wa:p,eb:f,jb:A,f:m,e:g,yb:_,zb:y,Ab:v,Bb:x,Db:b,Gb:w}=e.instance.exports;i=g;const T=(()=>{let e=0,i=0,r=0,s=0;return a=>{r&&(n(s),n(e),i+=r,r=e=0),e||(i+=128,e=o(i));const l=a.length+7&-8;let c=e;l>=i&&(r=l,c=s=o(l));for(let e=0;e{sy=e,ny=void 0})))}()),n&&e.push(function(){if(ly)return;const e=function(e){let t;const i=WebAssembly.instantiateStreaming(e,{}).then((e=>{t=e.instance,t.exports.__wasm_call_ctors()})),r={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:i,supported:!0,decodeGltfBuffer(e,i,o,s,a,l){!function(e,t,i,r,n,o,s){const a=e.exports.sbrk,l=r+3&-4,c=a(l*n),u=a(o.length),h=new Uint8Array(e.exports.memory.buffer);h.set(o,u);const d=t(c,r,n,u,o.length);if(0===d&&s&&s(c,l,n),i.set(h.subarray(c,c+r*n)),a(c-a(0)),0!==d)throw new Error(`Malformed buffer data: ${d}`)}(t,t.exports[n[a]],e,i,o,s,t.exports[r[l]])}}}(fetch(hy()));return e.ready.then((()=>{ly=e}))}()),o)for(let t=0;t{if(t&&s)for(const{primitives:e}of s)for(const t of e)gy(t,r);if(n&&s&&l)for(const e of l)yy(e,r);return r}))}))}function Sy(e,t){const i=e.json.bufferViews[t.bufferView],r=dy[t.componentType];return new r(e.buffers[i.buffer],(t.byteOffset||0)+(i.byteOffset||0),t.count*(i.byteStride&&i.byteStride!==fy[t.type]*r.BYTES_PER_ELEMENT?i.byteStride/r.BYTES_PER_ELEMENT:fy[t.type]))}function Ey(e,t,i,r){const n=dy[t.componentType],o=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(n),s=e.json.bufferViews[t.bufferView],a=s.byteStride?s.byteStride/n.BYTES_PER_ELEMENT:fy[t.type],l=i.float32,c=l.length/i.capacity;for(let e=0,i=0;e0){for(let n=0;n0){o.texcoordArray=new Ws;const e=t.json.accessors[n.TEXCOORD_0];o.texcoordArray.resize(e.count);const i=Sy(t,e);Ey(t,e,o.texcoordArray,i)}if(void 0!==n._FEATURE_ID_RGBA4444){const e=t.json.accessors[n._FEATURE_ID_RGBA4444];t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression")&&(o.featureData=Sy(t,e))}void 0!==n._FEATURE_RGBA4444&&(o.featureData=new Uint32Array(Sy(t,t.json.accessors[n._FEATURE_RGBA4444]).buffer));const h=e.material;return o.material=function(e,t){const{emissiveFactor:i=[0,0,0],alphaMode:r="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:s,emissiveTexture:a,doubleSided:l}=e,{baseColorFactor:c=[1,1,1,1],metallicFactor:u=1,roughnessFactor:h=1,baseColorTexture:d,metallicRoughnessTexture:p}=e.pbrMetallicRoughness||{},f=s?t[s.index]:void 0;if(s&&s.extensions&&s.extensions.KHR_texture_transform&&f){const e=s.extensions.KHR_texture_transform;f.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Ct(...c),metallicFactor:u,roughnessFactor:h,baseColorTexture:d?t[d.index]:void 0,metallicRoughnessTexture:p?t[p.index]:void 0},doubleSided:l,emissiveFactor:i,alphaMode:r,alphaCutoff:n,normalTexture:o?t[o.index]:void 0,occlusionTexture:f,emissionTexture:a?t[a.index]:void 0,defined:void 0===e.defined}}(void 0!==h?t.json.materials[h]:{defined:!1},i),o}function Iy(e,t,i){const{matrix:r,rotation:n,translation:o,scale:s,mesh:a,extras:l,children:c}=e,u={};if(u.matrix=r||U.mat4.fromRotationTranslationScale([],n||[0,0,0,1],o||[0,0,0],s||[1,1,1]),void 0!==a){u.meshes=i[a];const e=u.anchor=[0,0];for(const t of u.meshes){const{min:i,max:r}=t.aabb;e[0]+=i[0]+r[0],e[1]+=i[1]+r[1]}e[0]=Math.floor(e[0]/u.meshes.length/2),e[1]=Math.floor(e[1]/u.meshes.length/2)}if(l&&(l.id&&(u.id=l.id),l.lights&&(u.lights=function(e){if(!e.length)return[];const t=function(e){const t=atob(e),i=new Uint8Array(t.length);for(let e=0;e1&&r[r.length-1].equals(r[0])&&r.pop();let n=0;for(let e=0;e0&&r.reverse();const o=yu(r.flatMap((e=>[e.x,e.y])),[]);return 0===o.length?null:{vertices:r,indices:o}}function Fy(e,t){const i=[],r=[];let n=0;const o=[];for(const s of e){n=i.length;const e=s.vertexArray.float32,a=s.indexArray.uint16;for(let r=0;r0&&([r[e+1],r[e+2]]=[r[e+2],r[e+1]])}return{vertices:i,indices:r}}function ky(e){const t=function(e,t){const i=[],r=WebGL2RenderingContext;if(e.json.textures)for(const n of e.json.textures){const o={magFilter:r.LINEAR,minFilter:r.NEAREST,wrapS:r.REPEAT,wrapT:r.REPEAT};void 0!==n.sampler&&Object.assign(o,e.json.samplers[n.sampler]),i.push({image:t[n.source],sampler:o,uploaded:!1})}return i}(e,e.images),i=function(e,t){const i=[];for(const r of e.json.meshes){const n=[];for(const i of r.primitives)n.push(My(i,e,t));i.push(n)}return i}(e,t),{scenes:r,scene:n,nodes:o}=e.json,s=r?r[n||0].nodes:o,a=[];for(const t of s)a.push(Iy(o[t],e,i));return function(e,t,i){const r={},n=new Set;for(let o=0;o0){const t=Array.from(n.values()).sort(((e,t)=>e-t));for(let i=t.length-1;i>=0;i--)e.splice(t[i],1)}}(a,s,e.json.nodes),a}function zy(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);const t=e.vertexArray.float32,i=e.aabb.min[0]-1,r=e.aabb.min[1]-1,n=Im/(e.aabb.max[0]-i+2),o=Im/(e.aabb.max[1]-r+2);for(let s=0;se.heightmap[c*Im+l]&&(e.heightmap[c*Im+l]=a)}}function Ry(e,t){const i={};i.indexArray=new Vs,i.indexArray.reserve(4*e.length),i.vertexArray=new Is,i.vertexArray.reserve(10*e.length),i.colorArray=new Rs,i.vertexArray.reserve(10*e.length);let r=0;for(const n of e){const e=Math.min(10,Math.max(4,1.3*n.height))*t,o=[-n.normal[1],n.normal[0],0],s=Math.min(.29,.1*n.width/n.depth),a=n.width-2*n.depth*t*(s+.01),l=U.vec3.scaleAndAdd([],n.pos,o,a/2),c=U.vec3.scaleAndAdd([],n.pos,o,-a/2),u=[l[0],l[1],l[2]+n.height],h=[c[0],c[1],c[2]+n.height],d=U.vec3.scaleAndAdd([],n.normal,o,s);U.vec3.scale(d,d,e);const p=U.vec3.scaleAndAdd([],n.normal,o,-s);U.vec3.scale(p,p,e),U.vec3.add(d,l,d),U.vec3.add(p,c,p),l[2]+=.1,c[2]+=.1,i.vertexArray.emplaceBack(d[0],d[1],d[2]),i.vertexArray.emplaceBack(p[0],p[1],p[2]),i.vertexArray.emplaceBack(l[0],l[1],l[2]),i.vertexArray.emplaceBack(c[0],c[1],c[2]),i.vertexArray.emplaceBack(u[0],u[1],u[2]),i.vertexArray.emplaceBack(h[0],h[1],h[2]),i.vertexArray.emplaceBack(l[0],l[1],l[2]),i.vertexArray.emplaceBack(c[0],c[1],c[2]),i.vertexArray.emplaceBack(d[0],d[1],d[2]),i.vertexArray.emplaceBack(p[0],p[1],p[2]);const f=a/e/2;i.colorArray.emplaceBack(-f-s,-1,f,.8),i.colorArray.emplaceBack(f+s,-1,f,.8),i.colorArray.emplaceBack(-f,0,f,1.3),i.colorArray.emplaceBack(f,0,f,1.3),i.colorArray.emplaceBack(f+s,-.8,f,.7),i.colorArray.emplaceBack(f+s,-.8,f,.7),i.colorArray.emplaceBack(0,0,f,1.3),i.colorArray.emplaceBack(0,0,f,1.3),i.colorArray.emplaceBack(f+s,-1.2,f,.8),i.colorArray.emplaceBack(f+s,-1.2,f,.8),i.indexArray.emplaceBack(6+r,4+r,8+r),i.indexArray.emplaceBack(7+r,9+r,5+r),i.indexArray.emplaceBack(0+r,1+r,2+r),i.indexArray.emplaceBack(1+r,3+r,2+r),r+=10}const n={defined:!0,emissiveFactor:[0,0,0]},o={};return o.baseColorFactor=Ct.white,n.pbrMetallicRoughness=o,i.material=n,i.aabb=new Tc([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}class Dy{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t=0&&r[3]>=0&&l.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new sh.VectorTile(new Fp(this.rawTileData)).layers,this.sourceLayerCoder=new Dy(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t){const{tilespaceGeometry:i,transform:r,tileTransform:n,pixelPosMatrix:o,availableImages:s}=t;this.loadVTLayers(),this.serializedLayersCache.clear();const a=i.bufferedTilespaceBounds,l=this.grid.query(a.min.x,a.min.y,a.max.x,a.max.y,((e,t,r,n)=>ql(i.bufferedTilespaceGeometry,e,t,r,n)));l.sort(jy);let c=null;r.elevation&&l.length>0&&(c=Om.create(r.elevation,this.tileID));const u={};let h;for(let t=0;t(p||(p=Fl(e,this.tileID.canonical,n)),t.queryIntersectsFeature(i,e,s,p,this.z,r,o,c,a))))}return u}loadMatchingFeature(e,t,i,r,n){const{featureIndex:o,bucketIndex:s,sourceLayerIndex:a,layoutVertexArrayOffset:l}=t,c=this.bucketLayerIDs[s],u=i.layers,h=Object.keys(u);if(h.length&&!function(e,t){for(let i=0;i=0)return!0;return!1}(h,c))return;const d=i.sourceCache,p=this.sourceLayerCoder.decode(a),f=this.vtLayers[p].feature(o),A=this.getId(f,p);for(let t=0;t`${e.key}: ${e.message}`)).join(", ")}`);this.promoteIdExpression=e.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new mi),i=this.promoteIdExpression.evaluate({zoom:0},e)}else i=e.properties[r];"boolean"==typeof i&&(i=Number(i))}return i}}function Qy(e,t,i,r,n){return le(e,((e,o)=>{const s=t instanceof Go?t.get(o):null;return s&&s.evaluate?s.evaluate(i,r,n):s}))}function jy(e,t){return t-e}co(Ny,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const Vy=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Hy{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=Vy[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new Hy(s,o,n,e)}constructor(e,t=64,i=Float64Array,r){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=Vy.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Gy(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:s}=this,a=[0,n.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=s){for(let s=h;s<=u;s++){const a=o[2*s],c=o[2*s+1];a>=e&&a<=i&&c>=t&&c<=r&&l.push(n[s])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=i&&f>=t&&f<=r&&l.push(n[d]),(0===c?e<=p:t<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?i>=p:r>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,s=[0,r.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=o){for(let i=h;i<=u;i++)Ky(n[2*i],n[2*i+1],e,t)<=l&&a.push(r[i]);continue}const d=h+u>>1,p=n[2*d],f=n[2*d+1];Ky(p,f,e,t)<=l&&a.push(r[d]),(0===c?e-i<=p:t-i<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?e+i>=p:t+i>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return a}}function Gy(e,t,i,r,n,o){if(n-r<=i)return;const s=r+n>>1;$y(e,t,s,r,n,o),Gy(e,t,i,r,s-1,1-o),Gy(e,t,i,s+1,n,1-o)}function $y(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const s=n-r+1,a=i-r+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);$y(e,t,i,Math.max(r,Math.floor(i-a*c/s+u)),Math.min(n,Math.floor(i+(s-a)*c/s+u)),o)}const s=t[2*i+o];let a=r,l=n;for(Zy(e,t,r,i),t[2*n+o]>s&&Zy(e,t,r,n);as;)l--}t[2*r+o]===s?Zy(e,t,r,l):(l++,Zy(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Zy(e,t,i,r){qy(e,i,r),qy(t,2*i,2*r),qy(t,2*i+1,2*r+1)}function qy(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Ky(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}e.$=gi,e.A=gt,e.B=ei,e.C=ps,e.D=rg,e.E=xt,e.F=2,e.G=df,e.H=uf,e.I=bt,e.J=class extends wm{},e.K=di,e.L=Lt,e.M=Xo,e.N=Qn,e.O=On,e.P=V,e.Q=Nn,e.R=Je,e.S=Xn,e.T=VA,e.U=Yo,e.V=wm,e.W=to,e.X=Yn,e.Y=Lr,e.Z=kr,e._=Pr,e.a=function(e){return Te.API_CDN_URL_REGEX.test(e)},e.a$=kl,e.a0=Bt,e.a1=Jo,e.a2=jn,e.a3=Un,e.a4=function(e){const t=e.value;let i=[];if(!t)return i;const r=di(t);return"string"!==r?(i=i.concat([new wm(e.key,t,`string expected, "${r}" found`)]),i):(Tm(t,!0)||(i=i.concat([new wm(e.key,t,`invalid url "${t}"`)])),i)},e.a5=Wo,e.a6=No,e.a7=Ko,e.a8=$o,e.a9=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return Ae(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Et(e.x,t.x,i),y:Et(e.y,t.y,i),z:Et(e.z,t.z,i),azimuthal:Et(e.azimuthal,t.azimuthal,i),polar:Et(e.polar,t.polar,i)}}},e.aA=function(e,t){const i={};for(let r=0;r{r(e,i)}),t):r(e,i),()=>{}}return n.callbacks.push(r),n.cancel||(n.cancel=i(((i,r)=>{n.result=[i,r];for(const e of n.callbacks)this.scheduler?this.scheduler.add((()=>{e(i,r)}),t):e(i,r);setTimeout((()=>delete this.entries[e]),3e3)}))),()=>{n.result||(n.callbacks=n.callbacks.filter((e=>e!==r)),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}},e.aE=function(e,t,i){const r=JSON.stringify(e.request);return e.data&&(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(t=>{const r=rt(e.request,((e,r,n,o)=>{e?t(e):r&&t(null,{vectorTile:i?void 0:new sh.VectorTile(new Fp(r)),rawData:r,cacheControl:n,expires:o})}));return()=>{r.cancel(),t()}}),t)},e.aF=function(e){Ge++,Ge>Ue&&(e.getActor().send("enforceCacheSizeLimit",Oe),Ge=0)},e.aG=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.aH=cc,e.aI=WA,e.aJ=im,e.aK=qA,e.aL=function(e,t){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){t(null,i)};for(let t=0;t{}}},e.aM=HA,e.aN=function(e){return fetch(e).then((e=>e.arrayBuffer())).then((t=>Cy(t,0,e)))},e.aO=ky,e.aP=class{constructor(e,t,i,r){this.id=e,this.position=null!=t?new cl(t[0],t[1]):new cl(0,0),this.orientation=null!=i?i:[0,0,0],this.nodes=r,this.uploaded=!1,this.aabb=new Tc([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,t){if(U.mat4.multiply(e.matrix,t,e.matrix),e.meshes)for(const t of e.meshes){const i=Tc.applyTransformFast(t.aabb,e.matrix);this.aabb.encapsulate(i)}if(e.children)for(const t of e.children)this._applyTransformations(t,e.matrix)}computeBoundsAndApplyParent(){const e=U.mat4.identity([]);for(const t of this.nodes)this._applyTransformations(t,e)}computeModelMatrix(e,t,i,r,n,o,s=!1){Lm(this.matrix,this,e.transform,this.position,t,i,r,n,o,s)}upload(e){if(!this.uploaded){for(const t of this.nodes)zm(t,e);for(const e of this.nodes)Rm(e);this.uploaded=!0}}destroy(){for(const e of this.nodes)Dm(e)}},e.aQ=ae,e.aR=Xf,e.aS=gl,e.aT=_l,e.aU=Ts,e.aV=Vs,e.aW=oe,e.aX=na,e.aY=MA,e.aZ=function(){Ro.isLoading()||Ro.isLoaded()||"deferred"!==ko()||zo()},e.a_=es,e.aa=Do,e.ab=eo,e.ac=Bl,e.ad=U,e.ae=ee,e.af=Go,e.ag=Hc,e.ah=Et,e.ai=Xi,e.aj=Mt,e.ak=Z,e.al=Ct,e.am=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return function([e,t]){const i=Ae([1,e,t]);return{x:i.x,y:i.y,z:i.z}}(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Et(e.x,t.x,i),y:Et(e.y,t.y,i),z:Et(e.z,t.z,i)}}},e.an=function(e,t,i=0,r=!0){const n=new V(i,i),o=e.sub(n),s=t.add(n),a=[o,new V(s.x,o.y),s,new V(o.x,s.y)];return r&&a.push(o.clone()),a},e.ao=function(e,t){const i=[];for(let r=0;rn&&(r+=(e[i]-n)*(e[i]-n)),t[i]0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!$c(e,new cl(e.center.lat,90)),r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!$c(e,new cl(e.center.lat,-90))]},e.b_=function(e,t){const{scale:i}=e.tileTransform,r=i*Xi/(e.tileSize*Math.pow(2,t.zoom-e.tileID.overscaledZ+e.tileID.canonical.z));return U.mat2.scale(new Float32Array(4),t.inverseAdjustmentMatrix,[r,r])},e.ba=NA,e.bb=function(e,t){const i=Hc(t.zoom);if(0===i)return Ic(e);const r=kc(e),n=zc(r),o=fl(r.getWest())*t.worldSize,s=fl(r.getEast())*t.worldSize,a=Al(r.getNorth())*t.worldSize,l=Al(r.getSouth())*t.worldSize,c=[o,a,0],u=[s,a,0],h=[o,l,0],d=[s,l,0],p=U.mat4.invert([],t.globeMatrix);return U.vec3.transformMat4(c,c,p),U.vec3.transformMat4(u,u,p),U.vec3.transformMat4(h,h,p),U.vec3.transformMat4(d,d,p),n[0]=Pc(n[0],h,i),n[1]=Pc(n[1],d,i),n[2]=Pc(n[2],u,i),n[3]=Pc(n[3],c,i),Tc.fromPoints(n)},e.bc=Uc,e.bd=Rc,e.be=Pc,e.bf=ws,e.bg=fc,e.bh=ty,e.bi=Fp,e.bj=rt,e.bk=function(e,t){const i=[];for(const r in e)r in t||i.push(r);return i},e.bl=ie,e.bm=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.bn=H,e.bo=function(e,t){const{x:i,y:r}=e.point,n=Vc(i,r,e.worldSize/e._pixelsPerMercatorPixel,0,0);return U.mat4.multiply(n,n,Nc(Ic(t)))},e.bp=xp,e.bq=Up,e.br=vp,e.bs=function(e,t,i,r,n){const o=5*t+2;e.float32[o+0]=i,e.float32[o+1]=r,e.float32[o+2]=n},e.bt=BA,e.bu=cf,e.bv=Ol,e.bw=mp,e.bx=jh,e.by=bm,e.bz=Xh,e.c=Ce,e.c$=ep,e.c0=om,e.c1=function(e){const t=om(e,!0);return U.mat2.invert([],[t[0],t[1],t[4],t[5]])},e.c2=_c,e.c3=function(e){const{x:t,y:i}=e.point,{lng:r,lat:n}=e._center;return Vc(t,i,e.worldSize,r,n)},e.c4=q,e.c5=uc,e.c6=Ya,e.c7=function(e){const t=Math.round((e+45+360)%360/90)%4;return K[t]},e.c8=45,e.c9=It,e.cA=La,e.cB=class extends Ca{constructor(e){super(e),this.current=za}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<9;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},e.cC=W,e.cD=function(e,t,i){const r=Hc(i.zoom),n=e.style.map._antialias,o=e.terrain&&e.terrain.exaggeration()>0;return 0===r&&!n&&!o},e.cE=function(e){const t=e.pixelsPerMeter,i=t/ml(1,e.center.lat),r=U.mat4.identity(new Float64Array(16));return U.mat4.translate(r,r,[e.point.x,e.point.y,0]),U.mat4.scale(r,r,[i,i,t]),Float32Array.from(r)},e.cF=kc,e.cG=function(e){const t=vl-5;e=J(e,-t,t)/t*90;const i=Math.pow(Math.abs(Math.sin(Z(e))),3);return Math.round(i*(il.length-1))},e.cH=function(e,t,i,r){const n=t.getNorth(),o=t.getSouth(),s=t.getWest(),a=t.getEast(),l=1<0){const e=180/r;U.mat3.multiply(p,p,[e/c+1,0,0,0,e/u+1,0,-.5*e/h,.5*e/d,1])}return p[2]=l,p[5]=e.x,p[8]=e.y,p},e.cI=Ic,e.cJ=function(e,t,i){const r=U.mat4.identity(new Float64Array(16)),n=(t/(1<1)return!1;const i=t.getSource().maxzoom,r=1<1)return t;const n=r.getSource().maxzoom,o=1<{const o=this.getAtTileOffset(e,n.x,n.y),s=r.upVector(e.canonical,n.x,n.y),a=r.upVectorScale(e.canonical,t,i).metersToTile;return U.vec3.scale(s,s,o*a),s}}getForTilePoints(e,t,i,r){if(this.isUsingMockSource())return!1;const n=Om.create(this,e,r);return!!n&&(t.forEach((e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],i)})),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const i=t.dem.tree,r=t.tileID,n=1<({u_camera_to_center_distance:new Ea(e),u_extrude_scale:new Da(e),u_device_pixel_ratio:new Ea(e),u_matrix:new ka(e),u_inv_rot_matrix:new ka(e),u_merc_center:new Ma(e),u_tile_id:new Ia(e),u_zoom_transition:new Ea(e),u_up_dir:new Ia(e),u_emissive_strength:new Ea(e)}),e.cU=e=>({u_matrix:new ka(e),u_pixels_to_tile_units:new Da(e),u_device_pixel_ratio:new Ea(e),u_width_scale:new Ea(e),u_floor_width_scale:new Ea(e),u_units_to_pixels:new Ma(e),u_dash_image:new Sa(e),u_gradient_image:new Sa(e),u_image_height:new Ea(e),u_texsize:new Ma(e),u_tile_units_to_pixels:new Ea(e),u_alpha_discard_threshold:new Ea(e),u_trim_offset:new Ma(e),u_trim_fade_range:new Ma(e),u_trim_color:new Pa(e),u_emissive_strength:new Ea(e),u_zbias_factor:new Ea(e),u_tile_to_meter:new Ea(e)}),e.cV=e=>({u_matrix:new ka(e),u_texsize:new Ma(e),u_pixels_to_tile_units:new Da(e),u_device_pixel_ratio:new Ea(e),u_width_scale:new Ea(e),u_floor_width_scale:new Ea(e),u_image:new Sa(e),u_units_to_pixels:new Ma(e),u_tile_units_to_pixels:new Ea(e),u_alpha_discard_threshold:new Ea(e),u_trim_offset:new Ma(e),u_trim_fade_range:new Ma(e),u_trim_color:new Pa(e),u_emissive_strength:new Ea(e),u_zbias_factor:new Ea(e),u_tile_to_meter:new Ea(e)}),e.cW=Qs,e.cX=Ap,e.cY=bp,e.cZ=Xc,e.c_=(e,t,i,r,n,o)=>{const s=e.transform,a="globe"===s.projection.name;let l;if("map"===o.paint.get("circle-pitch-alignment"))if(a){const e=jc(s.zoom,t.canonical)*s._pixelsPerMercatorPixel;l=Float32Array.from([e,0,0,e])}else l=s.calculatePixelsToTileUnitsMatrix(i);else l=new Float32Array([s.pixelsToGLUnits[0],0,0,s.pixelsToGLUnits[1]]);const c={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(s.projection),u_matrix:e.translatePosMatrix(t.projMatrix,i,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:ke.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:Wc,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:o.paint.get("circle-emissive-strength")};if(a){c.u_inv_rot_matrix=r,c.u_merc_center=n,c.u_tile_id=[t.canonical.x,t.canonical.y,1<0?Math.acos(i/r)*$:0;let o=0!==e||0!==t?Math.atan2(-t,-e)*$+90:0;return o<0&&(o+=360),[r,o,n]},e.cd=Tl,e.ce=Tc,e.cf=Ae,e.cg=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.ch=function(e,t){return e.readFields(fg,{icons:[]},t)},e.ci=function(e){return e({pluginStatus:Mo,pluginURL:Io}),Fo.on("pluginStateChange",e),e},e.cj=sg,e.ck=vf,e.cl=yf,e.cm=tt,e.cn=Po,e.co=Re,e.cp=mt,e.cq=ue,e.cr=function(e){const t=e.indexOf(ds);return t>=0?e.slice(0,t):e},e.cs=function(e){return e.indexOf(ds)>=0},e.ct=function(e){const t=e.indexOf(ds);return t>=0?e.slice(t+1):""},e.cu=function(e){const t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},e.cv=function(e,t,i,r){return"custom"===e.type?new rm(e,t):new Wm[e.type](e,t,i,r)},e.cw=ce,e.cx=class extends Uy{constructor(e,t){super(e._vectorTileFeature,e._z,e._x,e._y,e.id),e.state&&(this.state=Object.assign({},e.state)),this.target=t.target,this.namespace=t.namespace,t.properties&&(this.properties=t.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=e.source,this.sourceLayer=e.sourceLayer,this.layer=e.layer)}toJSON(){const e=super.toJSON();return e.target=this.target,e.namespace=this.namespace,e}},e.cy=Fo,e.cz=it,e.d=function(e){return Te.API_TILEJSON_REGEX.test(e)},e.d$=Dy,e.d0=ti,e.d1=(e,t,i,r,n,o,s,a)=>{const l=e.transform,c=l.pitch<15?Xd(.07,.7,J((14-l.zoom)/5,0,1)):.07,u="none"===i.paint.get("line-trim-color-use-theme").constantOr("default");return{u_matrix:Jd(e,t,i,r),u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:l.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:n,u_width_scale:o,u_floor_width_scale:s,u_image:0,u_tile_units_to_pixels:Yd(t,l),u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:a,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(u?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:c,u_tile_to_meter:Tl(t.tileID.canonical,0)}},e.d2=(e,t,i,r,n,o,s,a,l)=>{const c=e.transform,u=c.calculatePixelsToTileUnitsMatrix(t),h="none"===i.paint.get("line-trim-color-use-theme").constantOr("default"),d=c.pitch<15?Xd(.07,.7,J((14-c.zoom)/5,0,1)):.07;return{u_matrix:Jd(e,t,i,r),u_pixels_to_tile_units:u,u_device_pixel_ratio:o,u_width_scale:s,u_floor_width_scale:a,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:tp(i)&&t.lineAtlasTexture?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Yd(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:l,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(h?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:d,u_tile_to_meter:Tl(t.tileID.canonical,0)}},e.d3=se,e.d4=fu,e.d5=yl,e.d6=Sd,e.d7=hc,e.d8=yd,e.d9=ad,e.dA=Qh,e.dB=X,e.dC=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},e.dD=Y,e.dE=wl,e.dF=sl,e.dG=function([e,t,i]){const r=Math.hypot(e,t,i),n=Math.atan2(e,i),o=.5*Math.PI-Math.acos(-t/r);return new cl(q(n),q(o))},e.dH=cm,e.dI=function(e){const t=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==_e){const t=e.navigator?e.navigator.userAgent:null;_e=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return _e}(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.dJ=function(e,t){Oe=e,Ue=t},e.dK=$c,e.dL=Gc,e.dM=function(e){const t=[0,0,0],i=U.mat4.identity(new Float64Array(16));return U.mat4.multiply(i,e.pixelMatrix,e.globeMatrix),U.vec3.transformMat4(t,t,i),new V(t[0],t[1])},e.dN=function(e,t,i=!1){if(Mo===Bo||Mo===Co||Mo===So)throw new Error("setRTLTextPlugin cannot be called multiple times.");Io=ke.resolveURL(e),Mo=Bo,Eo=t,Lo(),i||zo()},e.dO=ko,e.dP=function(){sg().acquire(tg)},e.dQ=function(){const e=ng;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(tg),ng=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()"))},e.dR=ig,e.dS=function(e){const t=Ve();if(!t)return;const i=t.delete(De);e&&i.catch(e).then((()=>e()))},e.dT=eg,e.dU=uy,e.dV=function(e){oy=ke.resolveURL(e),cy||(cy=new rg(sg(),new xt)),cy.broadcast("setDracoUrl",oy)},e.dW=hy,e.dX=function(e){ay=ke.resolveURL(e),cy||(cy=new rg(sg(),new xt)),cy.broadcast("setMeshoptUrl",ay)},e.dY=co,e.dZ=hu,e.d_=_f,e.da=450,e.db=7,e.dc=KA,e.dd=vs,e.de=ta,e.df=256,e.dg=Nc,e.dh=Is,e.di=$s,e.dj=Zs,e.dk=function(e,t,i,r,n){return J((e-t)/(i-t)*(n-r)+r,r,n)},e.dl=En,e.dm=bl,e.dn=class{constructor(e,t,i,r){this.context=e,this.format=r,this.size=i,this.texture=e.gl.createTexture();const[n,o,s]=this.size,{gl:a}=e;a.bindTexture(a.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1),a.texImage3D(a.TEXTURE_3D,0,this.format,n,o,s,0,QA(this.format),jA(this.format),t.data)}bind(e,t){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_3D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},e.dp=pm,e.dq=[1,1,1],e.dr=Om,e.ds=Pm,e.dt=Os,e.du=Ws,e.dv=al,e.dw=Ks,e.dx=qs,e.dy=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new V(1/0,1/0),max:new V(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,t=!1){const i=Zh(new V(0,0),new V(Xi,Xi),e),r=[];if(t&&!Gh(i,this._globalClipBounds))return r;for(const t of this._activeRegions){if(t.hiddenByOverlap)continue;if(!Gh(i,t))continue;const n=qh(t.min,t.max,e);r.push({min:n.min,max:n.max,sourceId:this._sourceIds[t.priority],footprint:t.footprint,footprintTileId:t.tileId,order:t.order,clipMask:t.clipMask,clipScope:t.clipScope})}return r}setSources(e){this._setSources(e.map((e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const t=[];for(const i of e.cache.getVisibleCoordinates()){const r=e.cache.getTile(i).buckets[e.layer];r&&r.updateFootprints(i.toUnwrapped(),t)}return t},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope}))))}_addSource(e){const t=e.getFootprints();if(0===t.length)return;const i=e.getOrder(),r=e.getClipMask(),n=e.getClipScope();for(const e of t){if(!e.footprint)continue;const t=Zh(e.footprint.min,e.footprint.max,e.id);this._activeRegions.push({min:t.min,max:t.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:e.id,footprint:e.footprint,order:i,clipMask:r,clipScope:n})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort(((e,t)=>e.priority-t.priority||Vh(e.min,t.min)||Vh(e.max,t.max)||e.order-t.order||e.clipMask-t.clipMask||function(e,t){const i=(e,t)=>e+t;return e.length-t.length||e.reduce(i,"").localeCompare(t.reduce(i,""))}(e.clipScope,t.clipScope)));let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let t=0;for(;!e&&t!==this._activeRegions.length;){const i=this._activeRegions[t],r=this._prevRegions[t];e=i.priority!==r.priority||!Hh(i,r)||i.order!==r.order||i.clipMask!==r.clipMask||!H(i.clipScope,r.clipScope),++t}}if(e){++this._updateTime;for(const e of this._activeRegions)e.order!==Qh&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,e.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,e.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,e.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,e.max.y));const e=e=>{const t=this._activeRegions;if(e>=t.length)return e;const i=t[e].priority;for(;e1){let t=0,i=e(t);for(;t!==i;){let r=t;const n=t;for(;r!==i;){const e=this._activeRegions[r];e.hiddenByOverlap=!1;for(let t=0;t=0;t--)this._addSource(e[t]);this._computeReplacement()}},e.dz=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const e of this._poleSegments)e.destroy();for(const e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,t){const i=new bs,r=new Vs,n=[],o=e+1+2,s=t[0]+1,a=t[0]+1+(1+t.length),l=(e,t,i)=>{let r=e===o-1?e-2:0===e?e:e-1;return r+=i?24575:0,[r,t]};for(let e=0;ee.id-t.id)),r.sort(((e,t)=>e.id-t.id||e.idx-t.idx)),r=r.filter(((e,t,i)=>t===i.findIndex((t=>t.id===e.id&&t.idx===e.idx))));const s=new Array;let a=0;const l=r.length;for(const e of n){if(e.constantHeight){s.push(new fh(e.id,e.bounds,e.constantHeight));continue}for(;a!==l&&r[a].ide*mp))}let x=y?"center":c.get("text-justify").evaluate(s,{},o);const b="point"===_,T=b?c.get("text-max-width").evaluate(s,{},o)*mp:1/0,B=o=>{e.allowVerticalPlacement&&mo(r)&&(A.vertical=jp(m,t,i,n,a,T,h,g,o,f,w,Up.vertical,!0,p,d,l))};if(!y&&v){const e="auto"===x?v.map((e=>Nf(e))):[x];let r=!1;for(let o=0;o=0||!mo(r)){const e=jp(m,t,i,n,a,T,h,g,x,f,w,Up.horizontal,!1,p,d,l);e&&(A.horizontal[x]=e)}B(b?"left":x)}}let T,B,C,S,E,M=!1;if(s.icon&&s.icon.hasPrimary()){const t=Rf(s.icon,e.iconSizeData,u["icon-size"],o,e.zoom,s,l,h.iconScaleFactor);T=t.iconPrimary,B=t.iconSecondary;const i=T.toString(),a=r.get(i);a&&(C=c.get("icon-offset").evaluate(s,{},o),S=c.get("icon-anchor").evaluate(s,{},o),E=c.get("icon-text-fit").evaluate(s,{},o),g=Yp(n.get(i),B?n.get(B.toString()):void 0,C,S),M=a.sdf,void 0===e.sdfIcons?e.sdfIcons=a.sdf:e.sdfIcons!==a.sdf&&de("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(a.pixelRatio!==e.pixelRatio||0!==c.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}x=x||!(!s.icon||!s.icon.hasSecondary());const I=$f(A.horizontal)||A.vertical;e.iconsInText||(e.iconsInText=!!I&&I.iconsInText);const P=p*h.textScaleFactor/mp,{defaultShapedIcon:L,verticallyShapedIcon:F}=Qf(e,g,c,s,o,A,P,C,E);g=L,b.push({feature:s,shapedTextOrientations:A,shapedText:I,shapedIcon:g,iconPrimary:T,iconSecondary:B,iconOffset:C,iconAnchor:S,verticallyShapedIcon:F,layoutTextSize:p,layoutIconSize:f,textOffset:w,isSDFIcon:M,iconTextFit:E})}return{featureData:b,sizes:h,hasAnySecondaryIcon:x,textAlongLine:y,symbolPlacement:_}},e.ea=ff,e.eb=function(e,t,i,r,n,o,s,a,l,c){const{featureData:u,hasAnySecondaryIcon:h,sizes:d,textAlongLine:p,symbolPlacement:f}=t;for(const t of u){const{shapedIcon:i,verticallyShapedIcon:o,feature:u,shapedTextOrientations:A,shapedText:m,layoutTextSize:g,textOffset:_,isSDFIcon:y,iconPrimary:v,iconSecondary:x,iconTextFit:b,iconOffset:w}=t;Df(i,c.iconPositions,v,x),Df(o,c.iconPositions,v,x),Of(A,c.iconPositions),(m||i)&&jf(e,u,A,i,o,l,d,g,0,_,y,r,n,s,a,h,b,w,p,f)}i&&e.generateCollisionDebugBuffers(o,e.collisionBoxArray,d.textScaleFactor)},e.ec=sh,e.ed=h_,e.ee=j,e.ef=oh,e.eg=Lp,e.eh=t,e.ei=function(e){let t=0;if(new Uint32Array(e,0,1)[0]!==vy){const i=new Uint32Array(e,0,7),[,,r,n,o,s]=i;t=i.byteLength+n+o+s+o,(r!==e.byteLength||t>=e.byteLength)&&de("Invalid b3dm header information.")}return Cy(e,t)},e.ej=function(e,t){const i=ky(e);for(const e of i){for(const t of e.meshes)zy(t);e.lights&&(e.lightMeshIndex=e.meshes.length,e.meshes.push(Ry(e.lights,t)))}return i},e.ek=Gm,e.el=Jm,e.em=Ro,e.en=function(e){He(),null!=Qe&&Qe.then((t=>{t.keys().then((i=>{for(let r=0;r"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""))},e.k=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(Number("0x"+t)))))},e.l=re,e.m=$e,e.n=function(e,t){return it(re(e,{type:"json"}),t)},e.o=lt,e.p=function(e,t){return it(re(e,{method:"POST"}),t)},e.q=ke,e.r=du,e.s=function(e){try{const t=self[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}},e.t=Fe,e.u=function(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()},e.v=function(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e.w=de,e.x=function(){return og||(og=new ig),og},e.y=Jg,e.z=_t})),r(["./shared"],(function(e){function t(e){const t=e?e.url.toString():void 0;return t?performance.getEntriesByName(t):[]}function i(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const r of e)t+=`${i(r)},`;return`${t}]`}let t="{";for(const r of Object.keys(e).sort())t+=`${r}:${i(e[r])},`;return`${t}}`}function r(t){let r="";for(const n of e.bm)("model"!==t.type||"minzoom"!==n&&"maxzoom"!==n)&&(r+=`/${i(t[n])}`);return r}class n{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,n,o){this._options=o;for(const i of t)this._layerConfigs[i.id]=i,(this._layers[i.id]=e.cv(i,this.scope,null,this._options)).compileFilter(o),this.keyCache[i.id]&&delete this.keyCache[i.id];for(const e of n)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const s=function(e,t){const n={};for(let o=0;othis._layers[e.id])),i=t[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const o=i.sourceLayer||"_geojsonTileLayer";let s=n[o];s||(s=n[o]=[]),s.push(t)}}}const o=1*e.d_;class s{constructor(t){const i={},r=[];for(const e in t){const n=t[e],s=i[e]={};for(const e in n.glyphs){const t=n.glyphs[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i=t.metrics.localGlyph?o:1,a={x:0,y:0,w:t.bitmap.width+2*i,h:t.bitmap.height+2*i};r.push(a),s[e]=a}}const{w:n,h:s}=e.H(r),a=new e.dZ({width:n||1,height:s||1});for(const r in t){const n=t[r];for(const t in n.glyphs){const s=n.glyphs[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const l=i[r][t],c=s.metrics.localGlyph?o:1;e.dZ.copy(s.bitmap,a,{x:0,y:0},{x:l.x+c,y:l.y+c},s.bitmap)}}this.image=a,this.positions=i}}e.dY(s,"GlyphAtlas");class a{constructor(t){this.tileID=new e.aH(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.lut=t.lut,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.scope=t.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.request&&t.request.collectResourceTiming,this.promoteId=t.promoteId,this.isSymbolTile=t.isSymbolTile,this.tileTransform=e.aR(t.tileID.canonical,t.projection),this.projection=t.projection,this.worldview=t.worldview,this.localizableLayerIds=t.localizableLayerIds,this.brightness=t.brightness,this.extraShadowCaster=!!t.extraShadowCaster,this.tessellationStep=t.tessellationStep,this.scaleFactor=t.scaleFactor}parse(t,i,r,n,o){this.status="parsing",this.data=t,this.collisionBoxArray=new e.aX;const a=new e.d$(Object.keys(t.layers).sort()),c=new e.e0(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h=new e.e1(256,256),d={featureIndex:c,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:h,availableImages:r,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},p=i.familiesBySource[this.source];for(const i in p){const n=t.layers[i];if(!n)continue;let o=!1,s=!1,h=!1;for(const e of p[i])"symbol"===e[0].type?o=!0:s=!0,e[0].is3D()&&"model"!==e[0].type&&(h=!0);if(this.extraShadowCaster&&!h)continue;if(!0===this.isSymbolTile&&!o)continue;if(!1===this.isSymbolTile&&!s)continue;1===n.version&&e.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const f=a.encode(i),A=[];let m=!1;for(let t=0,r=0;t=i.maxzoom||"none"!==i.visibility&&(l(t,this.zoom,d.brightness,r),(u[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:f,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(A,d,this.tileID.canonical,this.tileTransform),c.bucketLayerIDs.push(t.map((t=>e.C(t.id,t.scope))))))}}let f,A,m,g,_,y;h.trim();const v={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},x=()=>{if(f)return this.status="done",o(f);if(this.extraShadowCaster)this.status="done",o(null,{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:d.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(A&&m&&g){const t=new s(A),i=new Map;for(const[t,r]of m.entries()){const{imagePosition:n}=e.e7(t,r,e.e8);i.set(t,n)}const o={};for(const n in u){const s=u[n];s instanceof e.aY&&(l(s.layers,this.zoom,d.brightness,r),o[n]=e.e9(s,A,t.positions,m,i,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio))}const a={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(n,m,_,(()=>{a.iconsPending=!1,b(o,t,a)})),this.rasterizeIfNeeded(n,g,y,(()=>{a.patternsPending=!1,b(o,t,a)}))}},b=(t,i,n,s)=>{if(n.iconsPending||n.patternsPending)return;const a=new e.ea(m,g,this.lut);for(const i in u){const n=u[i];if(i in t)e.eb(n,t[i],this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,m,a);else if(n.hasPattern&&(n instanceof e.b2||n instanceof e.b3||n instanceof e.d8)){l(n.layers,this.zoom,d.brightness,r);const e=Object.fromEntries(a.patternPositions);n.addFeatures(d,this.tileID.canonical,e,r,this.tileTransform,this.brightness)}}this.status="done",o(null,{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:h,imageAtlas:a,brightness:d.brightness})};if(!this.extraShadowCaster){const t=e.e5(d.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(t).length?n.send("getGlyphs",{uid:this.uid,stacks:t,scope:this.scope},((e,t)=>{f||(f=e,A=t,x())}),void 0,!1,v):A={};const i=Array.from(d.iconDependencies.keys()).map((t=>e.I.parse(t)));i.length?n.send("getImages",{images:i,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},((e,t)=>{f||(f=e,m=new Map,_=this.updateImageMapAndGetImageTaskQueue(m,t,d.iconDependencies),x())}),void 0,!1,v):(m=new Map,_=new Map);const r=Array.from(d.patternDependencies.keys()).map((t=>e.I.parse(t)));r.length?n.send("getImages",{images:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},((e,t)=>{f||(f=e,g=new Map,y=this.updateImageMapAndGetImageTaskQueue(g,t,d.patternDependencies),x())}),void 0,!1,v):(g=new Map,y=new Map)}if(d.elevationFeatures&&d.elevationFeatures.length>0){const t=[];for(const i of Object.values(u))if(i instanceof e.b3){const e=i.getUnevaluatedPortalGraph();e&&t.push(e)}const i=e.e6.evaluate(t);for(const t of Object.values(u))t instanceof e.b3&&t.setEvaluatedPortalGraph(i)}x()}rasterizeIfNeeded(e,t,i,r){Array.from(t.values()).some((e=>e.usvg))?this.rasterize(e,t,i,r):r()}updateImageMapAndGetImageTaskQueue(e,t,i){const r=new Map;for(const n of t.keys()){const o=i.get(n)||[];for(const i of o){const n=i.toString(),o=t.get(i.id.toString());o.usvg?r.has(n)||(r.set(n,i),e.set(n,Object.assign({},o))):e.set(n,o)}}return r}rasterize(e,t,i,r){this.rasterizeTask=e.send("rasterizeImages",{scope:this.scope,tasks:i},((e,i)=>{if(!e)for(const[e,r]of i.entries()){const i=Object.assign(t.get(e),{data:r});t.set(e,i)}r()}))}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function l(t,i,r,n){const o=new e.aa(i,{brightness:r});for(const e of t)e.recalculate(o,n)}class c extends e.E{constructor(t,i,r,n,o,s){super(),this.actor=t,this.layerIndex=i,this.availableImages=r,this.loadVectorData=o||e.aE,this.loading={},this.loaded={},this.deduped=new e.aD(t.scheduler),this.isSpriteLoaded=n,this.scheduler=t.scheduler,this.brightness=s}loadTile(i,r){const n=i.uid,o=i&&i.request,s=o&&o.collectResourceTiming,l=this.loading[n]=new a(i);l.abort=this.loadVectorData(i,((a,c)=>{const u=!this.loading[n];if(delete this.loading[n],l.cancelRasterize(),u||a||!c)return l.status="done",u||(this.loaded[n]=l),r(a);const h=c.rawData,d={};c.expires&&(d.expires=c.expires),c.cacheControl&&(d.cacheControl=c.cacheControl),l.vectorTile=c.vectorTile||new e.ec.VectorTile(new e.bi(h));const p=()=>{l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.actor,((i,n)=>{if(i||!n)return r(i);const a={};if(s){const e=t(o);e.length>0&&(a.resourceTiming=JSON.parse(JSON.stringify(e)))}r(null,e.l({rawTileData:h.slice(0)},n,d,a))}))};this.isSpriteLoaded?p():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(p,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):p()})),this.loaded=this.loaded||{},this.loaded[n]=l}))}reloadTile(t,i){const r=this.loaded,n=t.uid;if(r&&r[n]){const o=r[n];o.scaleFactor=t.scaleFactor,o.showCollisionBoxes=t.showCollisionBoxes,o.projection=t.projection,o.brightness=t.brightness,o.tileTransform=e.aR(t.tileID.canonical,t.projection),o.extraShadowCaster=t.extraShadowCaster,o.lut=t.lut;const s=(e,t)=>{const r=o.reloadCallback;r&&(delete o.reloadCallback,o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,r)),i(e,t)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}else i(null,void 0)}abortTile(e,t){const i=e.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t()}}class u{loadTile(t,i){const{uid:r,encoding:n,rawImageData:o,padding:s}=t,a=ImageBitmap&&o instanceof ImageBitmap?this.getImageData(o,s):o;i(null,new e.ed(r,a,n,s<1))}reloadTile(e,t){t(null,null)}abortTile(e,t){t()}removeTile(e,t){t()}getImageData(e,t){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(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}e.bh.setPbf(e.bi);class h{constructor(t){this._mrt=new e.bh(t.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=t.uid,this.tileID=t.tileID,this.source=t.source}parse(t,i){const r=this._mrt;this.status="parsing",this._entireBuffer=t;try{r.parseHeader(t),this._isHeaderLoaded=!0;const n=[];for(const i in r.layers){const o=r.getLayer(i),s=o.getDataRange(o.getBandList()),a=r.createDecodingTask(s),l=t.slice(s.firstByte,s.lastByte+1),c=e.bh.performDecoding(l,a).then((e=>a.complete(null,e))).catch((e=>a.complete(e,null)));n.push(c)}Promise.allSettled(n).then((()=>i(null,r)))}catch(e){i(e)}}}class d{constructor(e){this.actor=e,this.loading={},this.loaded={}}loadTile(t,i){const r=t.uid,n=t.request,o=this.loading[r]=new h(t),{cancel:s}=e.bj(n,((e,t,n,s)=>{const a=!this.loading[r];if(delete this.loading[r],a||e||!t)return o.status="done",a||(this.loaded[r]=o),i(e);o.parse(t,((e,t)=>{if(e||!t)return i(e);i(null,t,n,s)})),this.loaded[r]=o}));o.abort=s}reloadTile(e,t){t(null,void 0)}abortTile(e,t){const i=e.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=e.uid;this.loaded[i]&&delete this.loaded[i],t()}decodeRasterArray({task:t,buffer:i},r){e.bh.performDecoding(i,t).then((e=>r(null,e))).catch((e=>r(e)))}}const p=e.ec.VectorTileFeature.prototype.toGeoJSON;class f{constructor(t){this._feature=t,this.extent=e.ai,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const i of this._feature.geometry)t.push([new e.P(i[0],i[1])]);return t}{const t=[];for(const i of this._feature.geometry){const r=[];for(const t of i)r.push(new e.P(t[0],t[1]));t.push(r)}return t}}toGeoJSON(e,t,i){return p.call(this,e,t,i)}}class A{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.ai,this.length=t.length,this._features=t}feature(e){return new f(this._features[e])}}const m=64/4096,g=128;class _{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],t){for(const i of e){const e=i.id;if(null==e)continue;let r=this.features.get(e);r&&this.updateCache(r,t),i.geometry?(r=v(i),this.updateCache(r,t),this.features.set(e,r)):this.features.delete(e),this.updateCache(r,t)}}updateCache(e,t){for(const{canonical:i,uid:r}of Object.values(t)){const{z:n,x:o,y:s}=i;y(e,Math.pow(2,n),o,s)&&delete t[r]}}getTile(e,t,i){const r=Math.pow(2,e),n=[];for(const e of this.features.values())y(e,r,t,i)&&n.push(T(e,r,t,i));return{features:n}}getFeatures(){return[...this.features.values()]}}function y({minX:e,minY:t,maxX:i,maxY:r},n,o,s){return e<(o+1+m)/n&&t<(s+1+m)/n&&i>(o-m)/n&&r>(s-m)/n}function v(e){const{id:t,geometry:i,properties:r}=e;if(!i)return;if("GeometryCollection"===i.type)throw new Error("GeometryCollection not supported in dynamic mode.");const{type:n,coordinates:o}=i,s={id:t,type:1,geometry:[],tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},a=s.geometry;if("Point"===n)x(o,a,s);else if("MultiPoint"===n)for(const e of o)x(e,a,s);else if("LineString"===n)s.type=2,b(o,a,s);else if("MultiLineString"===n)s.type=2,w(o,a,s);else if("Polygon"===n)s.type=3,w(o,a,s,!0);else{if("MultiPolygon"!==n)throw new Error("Input data is not a valid GeoJSON object.");s.type=3;for(const e of o)w(e,a,s,!0)}return s}function x([t,i],r,n){const o=e.av(t);let s=e.aC(i);s=s<0?0:s>1?1:s,r.push(o,s),n.minX=Math.min(n.minX,o),n.minY=Math.min(n.minY,s),n.maxX=Math.max(n.maxX,o),n.maxY=Math.max(n.maxY,s)}function b(e,t,i,r=!1,n=!1){const o=[];for(const t of e)x(t,o,i);t.push(o),r&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t0===t)for(let t=0,i=e.length;t=a&&d>=a||(u>=a?(h+=Math.round(A*((a-u)/f)),u=a):d>=a&&(p=h+Math.round(A*((a-u)/f)),d=a),h>=a&&p>=a||(h>=a?(u+=Math.round(f*((a-h)/A)),h=a):p>=a&&(d=u+Math.round(f*((a-h)/A)),p=a),l&&u===l[l.length-1][0]&&h===l[l.length-1][1]||(l=[[u,h]],o.push(l)),l.push([d,p])))))}}var C,S,E,M={exports:{}},I=function(){if(E)return M.exports;E=1;var t=e.eg(),i=function(){if(S)return C;S=1;var t=e.ee(),i=e.ef().VectorTileFeature;function r(e,t){this.options=t||{},this.features=e,this.length=e.length}function n(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}return C=r,r.prototype.feature=function(e){return new n(this.features[e],this.options.extent)},n.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var i=0;i>31}function c(e,t){for(var i=e.loadGeometry(),r=e.type,n=0,o=0,s=i.length,c=0;ce},F=Math.fround||(k=new Float32Array(1),e=>(k[0]=+e,k[0]));var k;const z=3,R=5,D=6;class O{constructor(e){this.options=Object.assign(Object.create(L),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let t=0;t=i;e--){const i=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){const e=this.getClusters([i,r,180,o],t),s=this.getClusters([-180,r,n,o],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(Q(i),j(o),Q(n),j(r)),l=s.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+R]>1?U(l,t,this.clusterProps):this.points[l[t+z]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(t*this.stride>=o.length)throw new Error(r);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=n.within(o[t*this.stride],o[t*this.stride+1],s),l=[];for(const t of a){const i=t*this.stride;o[i+4]===e&&l.push(o[i+R]>1?U(o,i,this.clusterProps):this.points[o[i+z]])}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,i){const r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){const r=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/n,c=(i+1+a)/n,u={features:[]};return this._addTileFeatures(r.range((t-a)/n,l,(t+1+a)/n,c),r.data,t,i,n,u),0===t&&this._addTileFeatures(r.range(1-a/n,l,1,c),r.data,n,i,n,u),t===n-1&&this._addTileFeatures(r.range(0,l,a/n,c),r.data,-1,i,n,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,r,n){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?n+o.point_count<=r?n+=o.point_count:n=this._appendLeaves(e,o.cluster_id,i,r,n):n1;let l,c,u;if(a)l=N(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+z]];l=i.properties;const[r,n]=i.geometry.coordinates;c=Q(r),u=j(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(u*n-r))]],tags:l};let d;d=a||this.options.generateId?t[e+z]:this.points[t[e+z]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:r,reduce:n,minPoints:o}=this.options,s=i/(r*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let i=0;it&&(p+=a[i+R])}if(p>d&&p>=o){let e,o=r*d,s=u*d,f=-1;const A=(i/c<<5)+(t+1)+this.points.length;for(const r of h){const l=r*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+R];o+=a[l]*u,s+=a[l+1]*u,a[l+4]=A,n&&(e||(e=this._map(a,i,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(a,l)))}a[i+4]=A,l.push(o/p,s/p,1/0,A,-1,p),n&&l.push(f)}else{for(let e=0;e1)for(const e of h){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+R]>1){const r=this.clusterProps[e[t+D]];return i?Object.assign({},r):r}const r=this.points[e[t+z]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function U(e,t,i){return{type:"Feature",id:e[t+z],properties:N(e,t,i),geometry:{type:"Point",coordinates:[(r=e[t],360*(r-.5)),V(e[t+1])]}};var r}function N(e,t,i){const r=e[t+R],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+D],s=-1===o?{}:Object.assign({},i[o]);return Object.assign(s,{cluster:!0,cluster_id:e[t+z],point_count:r,point_count_abbreviated:n})}function Q(e){return e/360+.5}function j(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function V(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function H(e,t,i,r){let n=r;const o=t+(i-t>>1);let s,a=i-t;const l=e[t],c=e[t+1],u=e[i],h=e[i+1];for(let r=t+3;rn)s=r,n=t;else if(t===n){const e=Math.abs(r-o);er&&(s-t>3&&H(e,t,s,r),e[s+2]=n,i-s>3&&H(e,s,i,r))}function G(e,t,i,r,n,o){let s=n-i,a=o-r;if(0!==s||0!==a){const l=((e-i)*s+(t-r)*a)/(s*s+a*a);l>1?(i=n,r=o):l>0&&(i+=s*l,r+=a*l)}return s=e-i,a=t-r,s*s+a*a}function $(e,t,i,r){const n={id:e??null,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)Z(n,i);else if("Polygon"===t)Z(n,i[0]);else if("MultiLineString"===t)for(const e of i)Z(n,e);else if("MultiPolygon"===t)for(const e of i)Z(n,e[0]);return n}function Z(e,t){for(let i=0;i0&&(s+=r?(n*l-a*o)/2:Math.sqrt(Math.pow(a-n,2)+Math.pow(l-o,2))),n=a,o=l}const a=t.length-3;t[2]=1,H(t,0,a,i),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function X(e,t,i,r){for(let n=0;n1?1:i}function ee(e,t,i,r,n,o,s,a){if(r/=t,o>=(i/=t)&&s=r)return null;const l=[];for(const t of e){const e=t.geometry;let o=t.type;const s=0===n?t.minX:t.minY,c=0===n?t.maxX:t.maxY;if(s>=i&&c=r)continue;let u=[];if("Point"===o||"MultiPoint"===o)te(e,u,i,r,n);else if("LineString"===o)ie(e,u,i,r,n,!1,a.lineMetrics);else if("MultiLineString"===o)ne(e,u,i,r,n,!1);else if("Polygon"===o)ne(e,u,i,r,n,!0);else if("MultiPolygon"===o)for(const t of e){const e=[];ne(t,e,i,r,n,!0),e.length&&u.push(e)}if(u.length){if(a.lineMetrics&&"LineString"===o){for(const e of u)l.push($(t.id,o,e,t.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===u.length?(o="LineString",u=u[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===u.length?"Point":"MultiPoint"),l.push($(t.id,o,u,t.tags))}}return l.length?l:null}function te(e,t,i,r,n){for(let o=0;o=i&&s<=r&&oe(t,e[o],e[o+1],e[o+2])}}function ie(e,t,i,r,n,o,s){let a=re(e);const l=0===n?se:ae;let c,u,h=e.start;for(let d=0;di&&(u=l(a,p,f,m,g,i),s&&(a.start=h+c*u)):_>r?y=i&&(u=l(a,p,f,m,g,i),v=!0),y>r&&_<=r&&(u=l(a,p,f,m,g,r),v=!0),!o&&v&&(s&&(a.end=h+c*u),t.push(a),a=re(e)),s&&(h+=c)}let d=e.length-3;const p=e[d],f=e[d+1],A=0===n?p:f;A>=i&&A<=r&&oe(a,p,f,e[d+2]),d=a.length-3,o&&d>=3&&(a[d]!==a[0]||a[d+1]!==a[1])&&oe(a,a[0],a[1],a[2]),a.length&&t.push(a)}function re(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ne(e,t,i,r,n,o){for(const s of e)ie(s,t,i,r,n,o,!1)}function oe(e,t,i,r){e.push(t,i,r)}function se(e,t,i,r,n,o){const s=(o-t)/(r-t);return oe(e,o,i+(n-i)*s,1),s}function ae(e,t,i,r,n,o){const s=(o-i)/(n-i);return oe(e,t+(r-t)*s,o,1),s}function le(e,t){const i=[];for(let r=0;r0&&t.size<(n?s:r))return void(i.numPoints+=t.length/3);const a=[];for(let e=0;es)&&(i.numSimplified++,a.push(t[e],t[e+1])),i.numPoints++;n&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t0===t)for(let t=0,i=e.length;t24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let r=0;r1&&console.time("creation"),d=this.tiles[h]=de(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==n){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(i!==o>>e||r!==s>>e)continue}}if(d.source=null,0===e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,A=.5+p,m=1+p;let g=null,_=null,y=null,v=null,x=ee(e,u,i-p,i+A,0,d.minX,d.maxX,l),b=ee(e,u,i+f,i+m,0,d.minX,d.maxX,l);e=null,x&&(g=ee(x,u,r-p,r+A,1,d.minY,d.maxY,l),_=ee(x,u,r+f,r+m,1,d.minY,d.maxY,l),x=null),b&&(y=ee(b,u,r-p,r+A,1,d.minY,d.maxY,l),v=ee(b,u,r+f,r+m,1,d.minY,d.maxY,l),b=null),c>1&&console.timeEnd("clipping"),a.push(g||[],t+1,2*i,2*r),a.push(_||[],t+1,2*i,2*r+1),a.push(y||[],t+1,2*i+1,2*r),a.push(v||[],t+1,2*i+1,2*r+1)}}getTile(e,t,i){e=+e,t=+t,i=+i;const r=this.options,{extent:n,debug:o}=r;if(e<0||e>24)return null;const s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);let l,c=e,u=t,h=i;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[ge(c,u,h)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,u,h),console.time("drilling down")),this.splitTile(l.source,c,u,h,e,t,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?ue(this.tiles[a],n):null):null}}function ge(e,t,i){return 32*((1<{if(s||!a)return r(s);if("object"!=typeof a)return r(new Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));{try{if(i.filter){const t=e.X(i.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(", "));a.features=a.features.filter((e=>t.value.evaluate({zoom:0},e)))}i.dynamic?("Feature"===a.type&&(a={type:"FeatureCollection",features:[a]}),i.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(a.features,this.loaded),i.cluster&&(a.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=i.cluster?new O(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;const r={},n={},o={accumulated:null,zoom:0},s={properties:null},a=Object.keys(i);for(const t of a){const[o,s]=i[t],a=e.X(s),l=e.X("string"==typeof o?[o,["accumulated"],["get",t]]:o);r[t]=a.value,n[t]=l.value}return t.map=e=>{s.properties=e;const t={};for(const e of a)t[e]=r[e].evaluate(o,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)o.accumulated=e[t],e[t]=n[t].evaluate(o,s)},t}(i)).load(a.features):i.dynamic?this._dynamicIndex:function(e,t){return new me(e,t)}(a,i.geojsonVtOptions)}catch(e){return r(e)}const s={};if(o){const e=t(n);e&&(s.resourceTiming={},s.resourceTiming[i.source]=JSON.parse(JSON.stringify(e)))}r(null,s)}}))}reloadTile(e,t){const i=this.loaded;return i&&i[e.uid]?e.partial?t(null,void 0):super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,i){if(t.request)e.n(t.request,i);else{if("string"!=typeof t.data)return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return i(null,JSON.parse(t.data))}catch(e){return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class ve{constructor(t,i){this.tileID=new e.aH(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=t.projection,this.brightness=i}parse(t,i,r,n){this.status="parsing";const o=new e.aH(r.tileID.overscaledZ,r.tileID.wrap,r.tileID.canonical.z,r.tileID.canonical.x,r.tileID.canonical.y),s=[],a=i.familiesBySource[r.source],l=new e.e0(o,r.promoteId);return l.bucketLayerIDs=[],l.is3DTile=!0,e.ei(t).then((t=>{if(!t)return n(new Error("Could not parse tile"));const i=e.ej(t,1/e.cd(r.tileID.canonical)),c=t.json.extensionsUsed&&t.json.extensionsUsed.includes("MAPBOX_mesh_features")||t.json.asset.extras&&t.json.asset.extras.MAPBOX_mesh_features,u=t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression"),h=new e.aa(this.zoom,{brightness:this.brightness});for(const t in a)for(const r of a[t]){const t=r[0];l.bucketLayerIDs.push(r.map((t=>e.C(t.id,t.scope)))),t.recalculate(h,[]);const n=new e.ek(r,i,o,c,u,this.brightness,l);c||(n.needsUpload=!0),s.push(n),n.evaluate(t)}this.status="done",n(null,{buckets:s,featureIndex:l,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})})).catch((e=>n(new Error(e.message))))}}class xe{constructor(e,t,i,r,n,o){this.actor=e,this.layerIndex=t,this.availableImages=i,this.brightness=o,this.loading={},this.loaded={}}loadTile(t,i){const r=t.uid,n=this.loading[r]=new ve(t,this.brightness);e.bj(t.request,((e,o)=>{const s=!this.loading[r];return delete this.loading[r],s||e?(n.status="done",s||(this.loaded[r]=n),i(e)):o&&0!==o.byteLength?void n.parse(o,this.layerIndex,t,((e,t)=>{n.status="done",this.loaded=this.loaded||{},this.loaded[r]=n,e||!t?i(e):i(null,t)})):(n.status="done",this.loaded[r]=n,i())}))}reloadTile(e,t){const i=this.loaded,r=e.uid;if(i&&i[r]){const n=i[r];n.projection=e.projection,n.brightness=e.brightness;const o=(i,r)=>{n.reloadCallback&&(delete n.reloadCallback,this.loadTile(e,t)),t(i,r)};"parsing"===n.status?n.reloadCallback=o:"done"===n.status&&this.loadTile(e,t)}}abortTile(e,t){const i=e.uid;this.loading[i]&&delete this.loading[i],t()}removeTile(e,t){const i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t()}}class be{constructor(t){this.self=t,this.actor=new e.el(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.imageRasterizer=new e.y,this.projections={},this.defaultProjection=e.bP({name:"mercator"}),this.workerSourceTypes={vector:c,geojson:ye,"raster-dem":u,"raster-array":d,"batched-model":xe},this.workerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.em.isParsed())throw new Error("RTL text plugin already registered.");e.em.applyArabicShaping=t.applyArabicShaping,e.em.processBidirectionalText=t.processBidirectionalText,e.em.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(e,t,i){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],i()}checkIfReady(e,t,i){i()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,{scope:i,isLoaded:r}){if(this.isSpriteLoaded[t]||(this.isSpriteLoaded[t]={}),this.isSpriteLoaded[t][i]=r,this.workerSources[t]&&this.workerSources[t][i])for(const n in this.workerSources[t][i]){const o=this.workerSources[t][i][n];for(const t in o){const i=o[t];i instanceof c&&(i.isSpriteLoaded=r,i.fire(new e.A("isSpriteLoaded")))}}}setImages(e,{scope:t,images:i},r){if(this.availableImages[e]||(this.availableImages[e]={}),this.availableImages[e][t]=i,this.workerSources[e]&&this.workerSources[e][t]){for(const r in this.workerSources[e][t]){const n=this.workerSources[e][t][r];for(const e in n)n[e].availableImages=i}r()}else r()}setProjection(t,i){this.projections[t]=e.bP(i)}setBrightness(e,t,i){this.brightness=t,i()}setLayers(e,t,i){this.getLayerIndex(e,t.scope).replace(t.layers,t.options),i()}updateLayers(e,t,i){this.getLayerIndex(e,t.scope).update(t.layers,t.removedIds,t.options),i()}loadTile(e,t,i){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).loadTile(t,i)}decodeRasterArray(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).decodeRasterArray(t,i)}reloadTile(e,t,i){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).reloadTile(t,i)}abortTile(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).abortTile(t,i)}removeTile(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).removeTile(t,i)}removeSource(e,t,i){if(!(this.workerSources[e]&&this.workerSources[e][t.scope]&&this.workerSources[e][t.scope][t.type]&&this.workerSources[e][t.scope][t.type][t.source]))return;const r=this.workerSources[e][t.scope][t.type][t.source];delete this.workerSources[e][t.scope][t.type][t.source],void 0!==r.removeSource?r.removeSource(t,i):i()}loadWorkerSource(e,t,i){try{this.self.importScripts(t.url),i()}catch(e){i(e.toString())}}syncRTLPluginState(t,i,r){try{e.em.setState(i);const t=e.em.getPluginURL();if(e.em.isLoaded()&&!e.em.isParsed()&&null!=t){this.self.importScripts(t);const i=e.em.isParsed();r(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),i)}}catch(e){r(e.toString())}}setDracoUrl(e,t){this.dracoUrl=t}getAvailableImages(e,t){this.availableImages[e]||(this.availableImages[e]={});let i=this.availableImages[e][t];return i||(i=[]),i}getLayerIndex(e,t){this.layerIndexes[e]||(this.layerIndexes[e]={});let i=this.layerIndexes[e][t];return i||(i=this.layerIndexes[e][t]=new n,i.scope=t),i}getWorkerSource(e,t,i,r){const n=this.workerSources;return n[e]||(n[e]={}),n[e][r]||(n[e][r]={}),n[e][r][t]||(n[e][r][t]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),n[e][r][t][i]||(n[e][r][t][i]=new this.workerSourceTypes[t]({send:(t,i,r,n,o,s)=>{this.actor.send(t,i,r,e,o,s)},scheduler:this.actor.scheduler},this.getLayerIndex(e,r),this.getAvailableImages(e,r),this.isSpriteLoaded[e][r],void 0,this.brightness)),n[e][r][t][i]}rasterizeImages(e,t,i){const r=new Map;for(const[i,{image:n,imageVariant:o}]of t.tasks.entries()){const s=this.imageRasterizer.rasterize(o,n,t.scope,e);r.set(i,s)}i(void 0,r)}removeRasterizedImages(e,t,i){this.imageRasterizer.removeImagesFromCacheByIds(t.imageIds,t.scope,e),i()}enforceCacheSizeLimit(t,i){e.en(i)}getWorkerPerformanceMetrics(e,t,i){i(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new be(self)),be})),r(["./shared"],(function(e){var t="3.11.1";const i={create:"create",load:"load",fullLoad:"fullLoad"},r={mark(e){performance.mark(e)},measure(e,t,i){performance.measure(e,t,i)}};function n(t){const i=t.name.split("?")[0];return e.a(i)&&i.includes("mapbox-gl.js")?"javascript":e.a(i)&&i.includes("mapbox-gl.css")?"css":e.b(i)?"fontRange":e.c(i)?"sprite":e.i(i)?"style":e.d(i)?"tilejson":"other"}var o,s={},a=function(){if(o)return s;function e(e){return!t(e)}function t(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,i=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(i);try{t=new Worker(r),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(r),e}()?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var i=t.getImageData(0,0,1,1);return i&&i.width===e.width}()?(void 0===i[r=t&&t.failIfMajorPerformanceCaveat]&&(i[r]=function(t){var i,r=function(t){var i=document.createElement("canvas"),r=Object.create(e.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,i.getContext("webgl2",r)}(t);if(!r)return!1;try{i=r.createShader(r.VERTEX_SHADER)}catch(e){return!1}return!(!i||r.isContextLost())&&(r.shaderSource(i,"void main() {}"),r.compileShader(i),!0===r.getShaderParameter(i,r.COMPILE_STATUS))}(r)),i[r]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var r}o=1,s.supported=e,s.notSupportedReason=t;var i={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},s}();function l(e,t,i){const r=document.createElement(e);return null!=t&&(r.className=t),i&&i.appendChild(r),r}function c(e,t,i){const r=document.createElementNS("http://www.w3.org/2000/svg",e);for(const e of Object.keys(t))r.setAttributeNS(null,e,String(t[e]));return i&&i.appendChild(r),r}const u="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,h=u&&void 0!==u.userSelect?"userSelect":"WebkitUserSelect";let d;function p(){u&&h&&(d=u[h],u[h]="none")}function f(){u&&h&&(u[h]=d)}function A(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",A,!0)}function m(){window.addEventListener("click",A,!0),window.setTimeout((()=>{window.removeEventListener("click",A,!0)}),0)}function g(e,t){const i=e.getBoundingClientRect();return v(e,i,t)}function _(e,t){const i=e.getBoundingClientRect(),r=[];for(let n=0;nthis._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(i,r){if(!e.f(i))return i;const n=B(i);return n.params.push(`sdk=js-${t}`),n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeGlyphsURL(t,i){if(!e.f(t))return t;const r=B(t);return r.path=`/fonts/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeModelURL(t,i){if(!e.f(t))return t;const r=B(t);return r.path=`/models/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeSourceURL(t,i,r,n){if(!e.f(t))return t;const o=B(t);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),r&&o.params.push(`language=${r}`),n&&o.params.push(`worldview=${n}`),this._makeAPIURL(o,this._customAccessToken||i)}normalizeIconsetURL(t,i){const r=B(t);return e.f(t)?(r.path=`/styles/v1${r.path}/iconset.pbf`,this._makeAPIURL(r,this._customAccessToken||i)):C(r)}normalizeSpriteURL(t,i,r,n){const o=B(t);return e.f(t)?(o.path=`/styles/v1${o.path}/sprite${i}${r}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${i}${r}`,C(o))}normalizeTileURL(t,i,r){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!e.f(t))return t;const n=B(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${i||r&&"raster"!==n.authority&&512===r?"@2x":""}${e.m.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${e.e.RASTER_URL_PREFIX}${n.path}`:"rasterarrays"===n.authority?n.path=`/${e.e.RASTERARRAYS_URL_PREFIX}${n.path}`:"3dtiles"===n.authority?n.path=`/${e.e.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${e.e.TILE_URL_VERSION}${n.path}`);const o=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||e.e.ACCESS_TOKEN;return e.e.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,o)}canonicalizeTileURL(t,i){const r=B(t);if(!r.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!r.path.match(/\.[\w]+$/))return t;let n="mapbox://";r.path.match(/^\/raster\/v1\//)?n+=`raster/${r.path.replace(`/${e.e.RASTER_URL_PREFIX}/`,"")}`:r.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${r.path.replace(`/${e.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${r.path.replace(`/${e.e.TILE_URL_VERSION}/`,"")}`;let o=r.params;return i&&(o=o.filter((e=>!e.match(/^access_token=/)))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(t,i){const r=!!i&&e.f(i),n=[];for(const i of t.tiles||[])e.h(i)?n.push(this.canonicalizeTileURL(i,r)):n.push(i);return n}_makeAPIURL(t,i){const r="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=B(e.e.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,"http"===t.protocol){const e=t.params.indexOf("secure");e>=0&&t.params.splice(e,1)}if("/"!==n.path&&(t.path=`${n.path}${t.path}`),!e.e.REQUIRE_ACCESS_TOKEN)return C(t);if(i=i||e.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!i)throw new Error(`An API access token is required to use Mapbox GL. ${r}`);if("s"===i[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${r}`)}return t.params=t.params.filter((e=>-1===e.indexOf("access_token"))),t.params.push(`access_token=${i||""}`),C(t)}}const T=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function B(e){const t=e.match(T);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function C(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const S="mapbox.eventData";function E(t){if(!t)return null;const i=t.split(".");if(!i||3!==i.length)return null;try{return JSON.parse(e.j(i[1]))}catch(e){return null}}class M{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const i=E(e.e.ACCESS_TOKEN);let r="";return r=i&&i.u?e.k(i.u):e.e.ACCESS_TOKEN||"",t?`${S}.${t}:${r}`:`${S}:${r}`}fetchEventData(){const t=e.s("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{const e=localStorage.getItem(i);e&&(this.eventData=JSON.parse(e));const t=localStorage.getItem(r);t&&(this.anonId=t)}catch(t){e.w("Unable to read from LocalStorage")}}saveEventData(){const t=e.s("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid"),n=this.anonId;if(t&&n)try{localStorage.setItem(r,n),Object.keys(this.eventData).length>=1&&localStorage.setItem(i,JSON.stringify(this.eventData))}catch(t){e.w("Unable to write to LocalStorage")}}processRequests(e){}postEvent(t,i,r,n){if(!e.e.EVENTS_URL)return;const o=B(e.e.EVENTS_URL);o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(t).toISOString()},a=i?e.l(s,i):s,l={url:C(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=e.p(l,(e=>{this.pendingRequest=null,r(e),this.saveEventData(),this.processRequests(n)}))}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}const I=new class extends M{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(t,i){e.e.EVENTS_URL&&e.e.ACCESS_TOKEN&&Array.isArray(t)&&t.some((t=>e.f(t)||e.h(t)))&&this.queueRequest(Date.now(),i)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const r=E(e.e.ACCESS_TOKEN),n=r?r.u:e.e.ACCESS_TOKEN;let o=n!==this.eventData.tokenU;e.v(this.anonId)||(this.anonId=e.u(),o=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(s),i=(s-this.eventData.lastSuccess)/864e5;o=o||i>=1||i<-1||e.getDate()!==t.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:x,"enabled.telemetry":!1,userId:this.anonId},(e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)}),i):this.processRequests()}},P=I.postTurnstileEvent.bind(I),L=new class extends M{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,i,r,n){this.skuToken=i,this.errorCb=n,e.e.EVENTS_URL&&(r||e.e.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(b)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;const{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),e.v(this.anonId)||(this.anonId=e.u()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:x,skuToken:this.skuToken,userId:this.anonId},(e=>{e?this.errorCb(e):r&&(this.success[r]=!0)}),i))}remove(){this.errorCb=null}},F=L.postMapLoadEvent.bind(L),k=new class extends M{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(t){let i=this.mapInstanceIdMap.get(t);return i||(i=e.u(),this.mapInstanceIdMap.set(t,i)),i}getEventId(e){const t=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,t+1),t}postStyleLoadEvent(t,i){const{map:r,style:n,importedStyles:o}=i;if(!e.e.EVENTS_URL||!t&&!e.e.ACCESS_TOKEN)return;const s=this.getMapInstanceId(r),a={mapInstanceId:s,eventId:this.getEventId(s),style:n};o.length&&(a.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:a},t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:t,payload:i}=this.queue.shift();this.postEvent(t,i,(()=>{}),e)}},z=k.postStyleLoadEvent.bind(k),R=new class extends M{constructor(){super("gljs.performance")}postPerformanceEvent(t,i){e.e.EVENTS_URL&&(t||e.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:i},t)}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:o,performanceData:s}=this.queue.shift(),a=function(r){const o=performance.getEntriesByType("resource"),s=performance.getEntriesByType("mark"),a=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const r of e[i]){const e=`${i}ResolveRangeMin`,n=`${i}ResolveRangeMax`,o=`${i}RequestCount`,s=`${i}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,r.startTime),t[n]=Math.max(t[n]||-1/0,r.responseEnd);const a=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==r.transferSize&&0===r.transferSize&&a(s),a(o)}return t}(function(e,t){const i={};if(e)for(const r of e){const e=t(r);void 0===i[e]&&(i[e]=[]),i[e].push(r)}return i}(o,n)),l=window.devicePixelRatio,c=navigator.connection||navigator.mozConnection||navigator.webkitConnection,u=c?c.effectiveType:void 0,h={counters:[],metadata:[],attributes:[]},d=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const e in a)d(h.counters,e,a[e]);if(r.interactionRange[0]!==1/0&&r.interactionRange[1]!==-1/0&&(d(h.counters,"interactionRangeMin",r.interactionRange[0]),d(h.counters,"interactionRangeMax",r.interactionRange[1])),s)for(const e of Object.keys(i)){const t=i[e],r=s.find((e=>e.name===t));r&&d(h.counters,t,r.startTime)}return d(h.counters,"visibilityHidden",r.visibilityHidden),d(h.attributes,"style",function(t){if(t)for(const i of t){const t=i.name.split("?")[0];if(e.i(t)){const e=t.split("/").slice(-2);if(2===e.length)return`mapbox://styles/${e[0]}/${e[1]}`}}}(o)),d(h.attributes,"terrainEnabled",r.terrainEnabled?"true":"false"),d(h.attributes,"fogEnabled",r.fogEnabled?"true":"false"),d(h.attributes,"projection",r.projection),d(h.attributes,"zoom",r.zoom),d(h.metadata,"devicePixelRatio",l),d(h.metadata,"connectionEffectiveType",u),d(h.metadata,"navigatorUserAgent",navigator.userAgent),d(h.metadata,"screenWidth",window.screen.width),d(h.metadata,"screenHeight",window.screen.height),d(h.metadata,"windowWidth",window.innerWidth),d(h.metadata,"windowHeight",window.innerHeight),d(h.metadata,"mapWidth",r.width/l),d(h.metadata,"mapHeight",r.height/l),d(h.metadata,"webglRenderer",r.renderer),d(h.metadata,"webglVendor",r.vendor),d(h.metadata,"sdkVersion",t),d(h.metadata,"sdkIdentifier","mapbox-gl-js"),h}(s);for(const e of a.metadata);for(const e of a.counters);for(const e of a.attributes);this.postEvent(o,a,(()=>{}),r)}},D=R.postPerformanceEvent.bind(R),O=new class extends M{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,i,r,n){if(!e.e.API_URL||!e.e.SESSION_PATH)return;const o=B(e.e.API_URL+e.e.SESSION_PATH);o.params.push(`sku=${i||""}`),o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);const s={url:C(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=e.g(s,(e=>{this.pendingRequest=null,r(e),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(t,i,r,n){this.skuToken=i,this.errorCb=n,e.e.SESSION_PATH&&e.e.API_URL&&(r||e.e.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(b)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();t&&this.success[t]||this.getSession(i,this.skuToken,(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e)}remove(){this.errorCb=null}},U=O.getSessionAPI.bind(O),N=new Set;function Q(e,t){t?N.add(e):N.delete(e)}class j{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,t){this._updatedSourceCaches[e]=t,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){const t=e.scope;this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._updatedLayers[t].add(e.id),this.setDirty()}removeLayer(e){const t=e.scope;this._removedLayers[t]=this._removedLayers[t]||{},this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._removedLayers[t][e.id]=e,this._updatedLayers[t].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){const e={};for(const t in this._updatedLayers)e[t]=e[t]||{},e[t].updatedIds=Array.from(this._updatedLayers[t].values());for(const t in this._removedLayers)e[t]=e[t]||{},e[t].removedIds=Object.keys(this._removedLayers[t]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(e){return this._updatedImages[e]?Array.from(this._updatedImages[e].values()):[]}updateImage(t,i){this._updatedImages[i]=this._updatedImages[i]||new Set,this._updatedImages[i].add(e.I.toString(t)),this.setDirty()}resetUpdatedImages(e){this._updatedImages[e]&&this._updatedImages[e].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function V(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class H extends e.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,"raster"!==t&&e.t()&&(this.imageRasterizerDispatcher=new e.D(e.x(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new e.r({width:1,height:1}))}removeScope(e){this.loaded.delete(e),this.imageProviders.delete(e),this.images.delete(e),this.updatedImages.delete(e),this.callbackDispatchedThisFrame.delete(e),this.patterns.delete(e),this.atlasImage.delete(e);const t=this.atlasTexture.get(e);t&&(t.destroy(),this.atlasTexture.delete(e))}addImageProvider(e,t){this.imageProviders.has(t)||this.imageProviders.set(t,new Map),this.imageProviders.get(t).set(e.id,e)}removeImageProvider(e,t){this.imageProviders.has(t)&&this.imageProviders.get(t).delete(e)}getPendingImageProviders(){const e=[];for(const t of this.imageProviders.values())for(const i of t.values())i.hasPendingRequests()&&e.push(i);return e}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new e.y),this._imageRasterizer}isLoaded(){for(const e of this.loaded.keys())if(!this.loaded.get(e))return!1;return!0}setLoaded(e,t){if(this.loaded.get(t)!==e&&(this.loaded.set(t,e),e)){for(const{ids:e,callback:i}of this.requestors)this._notify(e,t,i);this.requestors=[]}}hasImage(e,t){return!!this.getImage(e,t)}getImage(e,t){return this.images.get(t).get(e.toString())}addImage(e,t,i){this._validate(e,i)&&this.images.get(t).set(e.toString(),i)}_validate(t,i){let r=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new e.z(new Error(`Image "${t.name}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let i=0;for(const r of e){if(r[0]e.I.from(t)))}getImages(e,t,i){const r=[],n=[],o=this.imageProviders.get(t);for(const i of e){if(!i.iconsetId){r.push(i);continue}const e=o.get(i.iconsetId);e&&(this.getImage(i,t)?n.push(i):e.addPendingRequest(i))}if(0===r.length)return void this._notify(n,t,i);let s=!0;const a=!!this.loaded.get(t),l=this.images.get(t);if(!a)for(const e of r)l.has(e.toString())||(s=!1);a||s?this._notify(r,t,i):this.requestors.push({ids:r,scope:t,callback:i})}rasterizeImages({scope:e,tasks:t},i){const r=new Map;for(const[i,n]of t.entries()){const t=this.getImage(n.id,e);t&&r.set(i,{image:t,imageVariant:n})}this._rasterizeImages(e,r,i)}_rasterizeImages(t,i,r){if(e.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImages",{tasks:i,scope:t},r);else{const e=new Map;for(const[r,{image:n,imageVariant:o}]of i.entries())e.set(r,this.imageRasterizer.rasterize(o,n,t,0));r(void 0,e)}}getUpdatedImages(e){return this.updatedImages.get(e)||new Set}_notify(t,i,r){const n=this.images.get(i),o=new Map;for(const i of t){const t=n.get(i.toString());if(!t){if(i.iconsetId)continue;e.w(`Image "${i.name}" 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.`),this.fire(new e.A("styleimagemissing",{id:i.name}));continue}const r={data:t.usvg?null:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,usvg:t.usvg,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)};t.usvg&&Object.assign(r,{width:t.icon.usvg_tree.width,height:t.icon.usvg_tree.height}),o.set(e.I.toString(i),r)}r(null,o)}getPixelSize(e){const{width:t,height:i}=this.atlasImage.get(e);return{width:t,height:i}}getPattern(t,i,r){const n=t.toString(),o=this.patterns.get(i),s=o.get(n),a=this.getImage(t,i);if(!a)return null;if(s){if(s.position.version===a.version)return s.position;s.position.version=a.version}else{if(a.usvg&&!a.data){const o=this.getPatternInFlightId(n,i);if(this.patternsInFlight.has(o))return null;this.patternsInFlight.add(o);const s=new e.B(t).scaleSelf(e.q.devicePixelRatio),l=new Map([[s.toString(),{image:a,imageVariant:s}]]);return this._rasterizeImages(i,l,((e,t)=>this.storePatternImage(s,i,a,r,t))),null}this.storePattern(t,i,a)}return this._updatePatternAtlas(i,r),o.get(n).position}getPatternInFlightId(t,i){return e.C(t,i)}hasPatternsInFlight(){return 0!==this.patternsInFlight.size}storePatternImage(e,t,i,r,n){const o=e.toString(),s=n?n.get(o):void 0;s&&(i.data=s,this.storePattern(e.id,t,i),this._updatePatternAtlas(t,r),this.patternsInFlight.delete(this.getPatternInFlightId(e.id.toString(),t)))}storePattern(t,i,r){const n={w:r.data.width+2*e.F,h:r.data.height+2*e.F,x:0,y:0},o=new e.G(n,r,e.F);this.patterns.get(i).set(t.toString(),{bin:n,position:o})}bind(t,i){const r=t.gl;let n=this.atlasTexture.get(i);n?this.dirty&&(n.update(this.atlasImage.get(i)),this.dirty=!1):(n=new e.T(t,this.atlasImage.get(i),r.RGBA8),this.atlasTexture.set(i,n)),n.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(t,i){const r=this.patterns.get(t),n=Array.from(r.values()).map((({bin:e})=>e)),{w:o,h:s}=e.H(n),a=this.atlasImage.get(t);a.resize({width:o||1,height:s||1});const l=this.images.get(t);for(const[t,{bin:n,position:o}]of r.entries()){let r=o.padding;const s=n.x+r,c=n.y+r,u=l.get(t).data,h=u.width,d=u.height;r=r>1?r-1:r,e.r.copy(u,a,{x:0,y:0},{x:s,y:c},{width:h,height:d},i),e.r.copy(u,a,{x:0,y:d-r},{x:s,y:c-r},{width:h,height:r},i),e.r.copy(u,a,{x:0,y:0},{x:s,y:c+d},{width:h,height:r},i),e.r.copy(u,a,{x:h-r,y:0},{x:s-r,y:c},{width:r,height:d},i),e.r.copy(u,a,{x:0,y:0},{x:s+h,y:c},{width:r,height:d},i),e.r.copy(u,a,{x:h-r,y:d-r},{x:s-r,y:c-r},{width:r,height:r},i),e.r.copy(u,a,{x:0,y:d-r},{x:s+h,y:c-r},{width:r,height:r},i),e.r.copy(u,a,{x:0,y:0},{x:s+h,y:c+d},{width:r,height:r},i),e.r.copy(u,a,{x:h-r,y:0},{x:s-r,y:c+d},{width:r,height:r},i)}this.dirty=!0}beginFrame(){for(const e of this.images.keys())this.callbackDispatchedThisFrame.set(e,new Set)}dispatchRenderCallbacks(e,t){const i=this.images.get(t);for(const r of e){if(this.callbackDispatchedThisFrame.get(t).has(r.toString()))continue;this.callbackDispatchedThisFrame.get(t).add(r.toString());const e=i.get(r.toString());V(e)&&this.updateImage(r,t,e)}}}function G(t){const i=t.key,r=t.value,n=t.valueSpec||{},o=t.objectElementValidators||{},s=t.style,a=t.styleSpec;let l=[];const c=e.K(r);if("object"!==c)return[new e.V(i,r,`object expected, ${c} found`)];for(const t in r){const c=t.split(".")[0];let u;o[c]?u=o[c]:n[c]?u=pe:o["*"]?u=o["*"]:n["*"]&&(u=pe),u?l=l.concat(u({key:(i?`${i}.`:i)+t,value:r[t],valueSpec:n[c]||n["*"],style:s,styleSpec:a,object:r,objectKey:t},r)):l.push(new e.J(i,r[t],`unknown property "${t}"`))}for(const t in n)o[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&l.push(new e.V(i,r,`missing required property "${t}"`));return l}function $(t){const i=t.value,r=t.valueSpec,n=t.style,o=t.styleSpec,s=t.key,a=t.arrayElementValidator||pe;if("array"!==e.K(i))return[new e.V(s,i,`array expected, ${e.K(i)} found`)];if(r.length&&i.length!==r.length)return[new e.V(s,i,`array length ${r.length} expected, length ${i.length} found`)];if(r["min-length"]&&i.lengtho)return[new e.V(i,r,`${r} is greater than the maximum value ${o}`)]}return[]}function q(t){const i=t.valueSpec,r=e.M(t.value.type);let n,o,s,a={};const l="categorical"!==r&&void 0===t.value.property,c=!l,u="array"===e.K(t.value.stops)&&"array"===e.K(t.value.stops[0])&&"object"===e.K(t.value.stops[0][0]),h=G({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new e.V(t.key,t.value,'identity function may not have a "stops" property')];let i=[];const n=t.value;return i=i.concat($({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:d})),"array"===e.K(n)&&0===n.length&&i.push(new e.V(t.key,n,"array must have at least one stop")),i},default:function(e){return pe({key:e.key,value:e.value,valueSpec:i,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===r&&l&&h.push(new e.V(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||h.push(new e.V(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!e.N(t.valueSpec)&&h.push(new e.V(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(c&&!e.O(t.valueSpec)?h.push(new e.V(t.key,t.value,"property functions not supported")):l&&!e.Q(t.valueSpec)&&h.push(new e.V(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||h.push(new e.V(t.key,t.value,'"property" property is required')),h;function d(t){let r=[];const n=t.value,l=t.key;if("array"!==e.K(n))return[new e.V(l,n,`array expected, ${e.K(n)} found`)];if(2!==n.length)return[new e.V(l,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==e.K(n[0]))return[new e.V(l,n,`object expected, ${e.K(n[0])} found`)];if(void 0===n[0].zoom)return[new e.V(l,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new e.V(l,n,"object stop key must have value")];const i=e.M(n[0].zoom);if("number"!=typeof i)return[new e.V(l,n[0].zoom,"stop zoom values must be numbers")];if(s&&s>i)return[new e.V(l,n[0].zoom,"stop zoom values must appear in ascending order")];i!==s&&(s=i,o=void 0,a={}),r=r.concat(G({key:`${l}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Z,value:p}}))}else r=r.concat(p({key:`${l}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return e.S(e.U(n[1]))?r.concat([new e.V(`${l}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(pe({key:`${l}[1]`,value:n[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const l=e.K(t.value),c=e.M(t.value),u=null!==t.value?t.value:s;if(n){if(l!==n)return[new e.V(t.key,u,`${l} stop domain type must match previous stop domain type ${n}`)]}else n=l;if("number"!==l&&"string"!==l&&"boolean"!==l&&"number"!=typeof c&&"string"!=typeof c&&"boolean"!=typeof c)return[new e.V(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==l&&"categorical"!==r){let n=`number expected, ${l} found`;return e.O(i)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e.V(t.key,u,n)]}return"categorical"!==r||"number"!==l||"number"==typeof c&&isFinite(c)&&Math.floor(c)===c?"categorical"!==r&&"number"===l&&"number"==typeof c&&"number"==typeof o&&void 0!==o&&cnew e.V(`${t.key}${i.key}`,t.value,i.message)));const r=i.value.expression||i.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new e.V(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&&!e.Y(r))return[new e.V(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return W(r,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!e.Z(r,["zoom","feature-state"]))return[new e.V(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!e._(r))return[new e.V(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function W(t,i){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(i.valueSpec&&i.valueSpec.expression)for(const e of i.valueSpec.expression.parameters)r.delete(e);if(0===r.size)return[];const n=[];return t instanceof e.$&&r.has(t.name)?[new e.V(i.key,i.value,`["${t.name}"] expression is not supported in a filter for a ${i.object.type} layer with id: ${i.object.id}`)]:(t.eachChild((e=>{n.push(...W(e,i))})),n)}function X(t){const i=t.key,r=t.value,n=t.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(e.M(r))&&o.push(new e.V(i,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(e.M(r))&&o.push(new e.V(i,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),o}function Y(t){return e.a1(e.U(t.value))?K(e.L({},t,{expressionContext:"filter",valueSpec:t.styleSpec[`filter_${t.layerType||"fill"}`]})):J(t)}function J(t){const i=t.value,r=t.key;if("array"!==e.K(i))return[new e.V(r,i,`array expected, ${e.K(i)} found`)];const n=t.styleSpec;let o,s=[];if(i.length<1)return[new e.V(r,i,"filter array must have at least 1 element")];switch(s=s.concat(X({key:`${r}[0]`,value:i[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),e.M(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===e.M(i[1])&&s.push(new e.V(r,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":3!==i.length&&s.push(new e.V(r,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(o=e.K(i[1]),"string"!==o&&s.push(new e.V(`${r}[1]`,i[1],`string expected, ${o} found`)));for(let a=2;a{t in r&&i.push(new e.V(n,r[t],`"${t}" is prohibited for ref layers`))})),o.layers.forEach((i=>{e.M(i.id)===l&&(t=i)})),t?t.ref?i.push(new e.V(n,r.ref,"ref cannot reference another ref layer")):a=e.M(t.type):"string"==typeof l&&i.push(new e.V(n,r.ref,`ref layer "${l}" not found`))}else if("background"!==a&&"sky"!==a&&"slot"!==a)if(r.source){const t=o.sources&&o.sources[r.source],s=t&&e.M(t.type);t?"vector"===s&&"raster"===a?i.push(new e.V(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==a?i.push(new e.V(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?i.push(new e.V(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==s||["raster","raster-particle"].includes(a)?"line"!==a||!r.paint||!r.paint["line-gradient"]&&!r.paint["line-trim-offset"]||"geojson"===s&&t.lineMetrics?"raster-particle"===a&&"raster-array"!==s&&i.push(new e.V(n,r.source,`layer "${r.id}" requires a 'raster-array' source.`)):i.push(new e.V(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):i.push(new e.V(n,r.source,"raster-array source can only be used with layer type 'raster'.")):i.push(new e.V(n,r,`layer "${r.id}" must specify a "source-layer"`)):i.push(new e.V(n,r.source,`source "${r.source}" not found`))}else i.push(new e.V(n,r,'missing required property "source"'));return i=i.concat(G({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>pe({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:t=>Y(e.L({layerType:a},t)),layout:t=>G({layer:r,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>ie(e.L({layerType:a},t))}}),paint:t=>G({layer:r,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>te(e.L({layerType:a,layer:r},t))}})}})),i}function ne(t){const i=t.value,r=t.key,n=e.K(i);return"string"!==n?[new e.V(r,i,`string expected, ${n} found`)]:[]}const oe={promoteId:function t({key:i,value:r}){if("string"===e.K(r))return ne({key:i,value:r});if(Array.isArray(r)){const t=[],n=e.U(r),o=e.X(n);return"error"===o.result&&o.value.forEach((r=>{t.push(new e.V(`${i}${r.key}`,null,`${r.message}`))})),e.Z(o.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||t.push(new e.V(`${i}`,null,"promoteId expression should be only feature dependent")),t}{const e=[];for(const n in r)e.push(...t({key:`${i}.${n}`,value:r[n]}));return e}}};function se(t){const i=t.value,r=t.key,n=t.styleSpec,o=t.style;if(!i.type)return[new e.V(r,i,'"type" is required')];const s=e.M(i.type);let a=[];switch(["vector","raster","raster-dem","raster-array"].includes(s)&&(i.url||i.tiles||a.push(new e.J(r,i,'Either "url" or "tiles" is required.'))),s){case"vector":case"raster":case"raster-dem":case"raster-array":return a=a.concat(G({key:r,value:i,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:oe})),a;case"geojson":if(a=G({key:r,value:i,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:oe}),i.cluster)for(const e in i.clusterProperties){const[t,n]=i.clusterProperties[e],o="string"==typeof t?[t,["accumulated"],["get",e]]:t;a.push(...K({key:`${r}.${e}.map`,value:n,expressionContext:"cluster-map"})),a.push(...K({key:`${r}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return G({key:r,value:i,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return G({key:r,value:i,valueSpec:n.source_image,style:o,styleSpec:n});case"canvas":return[new e.V(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return X({key:`${r}.type`,value:i.type,valueSpec:{values:ae(n)},style:o,styleSpec:n})}}function ae(e){return e.source.reduce(((t,i)=>{const r=e[i];return"enum"===r.type.type&&(t=t.concat(Object.keys(r.type.values))),t}),[])}function le(t){const i=t.value,r=t.styleSpec,n=r.light,o=t.style;let s=[];const a=e.K(i);if(void 0===i)return s;if("object"!==a)return s=s.concat([new e.V("light",i,`object expected, ${a} found`)]),s;for(const t in i){const a=t.match(/^(.*)-transition$/),l=t.match(/^(.*)-use-theme$/);s=s.concat(l&&n[l[1]]?pe({key:t,value:i[t],valueSpec:{type:"string"},style:o,styleSpec:r}):a&&n[a[1]]&&n[a[1]].transition?pe({key:t,value:i[t],valueSpec:r.transition,style:o,styleSpec:r}):n[t]?pe({key:t,value:i[t],valueSpec:n[t],style:o,styleSpec:r}):[new e.V(t,i[t],`unknown property "${t}"`)])}return s}function ce(t){const i=t.value;let r=[];if(!i)return r;const n=e.K(i);if("object"!==n)return r=r.concat([new e.V("light-3d",i,`object expected, ${n} found`)]),r;const o=t.styleSpec,s=o["light-3d"],a=t.key,l=t.style,c=t.style.lights;for(const t of["type","id"])if(!(t in i))return r=r.concat([new e.V("light-3d",i,`missing property ${t} on light`)]),r;if(i.type&&c)for(let n=0;n[],array:$,boolean:function(t){const i=t.value,r=t.key,n=e.K(i);return"boolean"!==n?[new e.V(r,i,`boolean expected, ${n} found`)]:[]},number:Z,color:function(t){const i=t.key,r=t.value,n=e.K(r);return"string"!==n?[new e.V(i,r,`color expected, ${n} found`)]:null===e.a0.parseCSSColor(r)?[new e.V(i,r,`color expected, "${r}" found`)]:[]},enum:X,filter:Y,function:q,layer:re,object:G,source:se,model:e.a4,light:le,"light-3d":ce,terrain:ue,fog:he,string:ne,formatted:function(e){return 0===ne(e).length?[]:K(e)},resolvedImage:function(e){return 0===ne(e).length?[]:K(e)},projection:function(t){const i=t.value,r=t.styleSpec,n=r.projection,o=t.style;let s=[];const a=e.K(i);if("object"===a)for(const e in i)s=s.concat(pe({key:e,value:i[e],valueSpec:n[e],style:o,styleSpec:r}));else"string"!==a&&(s=s.concat([new e.V("projection",i,`object or string expected, ${a} found`)]));return s},import:function(t){const{value:i,styleSpec:r}=t,{data:n,...o}=i;Object.defineProperty(o,"__line__",{value:i.__line__,enumerable:!1});let s=G(e.L({},t,{value:o,valueSpec:r.import}));return""===e.M(o.id)&&s.push(new e.V(`${t.key}.id`,o,"import id can't be an empty string")),n&&(s=s.concat(Ae(n,r,{key:`${t.key}.data`}))),s},iconset:function(t){const i=t.value,r=t.key,n=t.styleSpec,o=t.style;if(!i.type)return[new e.V(r,i,'"type" is required')];const s=e.M(i.type);let a=[];if(a=a.concat(G({key:r,value:i,valueSpec:n[`iconset_${s}`],style:o,styleSpec:n})),"source"===s&&i.source){const t=o.sources&&o.sources[i.source],n=t&&e.M(t.type);t?"raster-array"!==n&&a.push(new e.V(r,i.source,`iconset cannot be used with a source of type ${String(n)}, it only be used with a "raster-array" source type`)):a.push(new e.V(r,i.source,`source "${i.source}" not found`))}return a}};function pe(t,i=!1){const r=t.value,n=t.valueSpec,o=t.styleSpec;if(n.expression&&e.a2(e.M(r)))return q(t);if(n.expression&&e.S(e.U(r)))return K(t);if(n.type&&de[n.type]){const r=de[n.type](t);return!0===i&&r.length>0&&"array"===e.K(t.value)?K(t):r}return G(e.L({},t,{valueSpec:n.type?o[n.type]:n}))}function fe(t){const i=t.value,r=t.key,n=ne(t);return n.length||(-1===i.indexOf("{fontstack}")&&n.push(new e.V(r,i,'"glyphs" url must include a "{fontstack}" token')),-1===i.indexOf("{range}")&&n.push(new e.V(r,i,'"glyphs" url must include a "{range}" token'))),n}function Ae(t,i=e.a5,r={}){return pe({key:r.key||"",value:t,valueSpec:i.$root,styleSpec:i,style:t,objectElementValidators:{glyphs:fe,"*":()=>[]}})}function me(t,i=e.a5){return Me(Ae(t,i))}const ge=e=>Me(se(e)),_e=e=>Me(le(e)),ye=e=>Me(ce(e)),ve=e=>Me(ue(e)),xe=e=>Me(he(e)),be=t=>Me(function(t){const i=t.value,r=t.style,n=t.styleSpec,o=n.snow;let s=[];const a=e.K(i);if(void 0===i)return s;if("object"!==a)return s=s.concat([new e.V("snow",i,`object expected, ${a} found`)]),s;for(const t in i){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&o[a[1]]&&o[a[1]].transition?pe({key:t,value:i[t],valueSpec:n.transition,style:r,styleSpec:n}):o[t]?pe({key:t,value:i[t],valueSpec:o[t],style:r,styleSpec:n}):[new e.J(t,i[t],`unknown property "${t}"`)])}return s}(t)),we=t=>Me(function(t){const i=t.value,r=t.style,n=t.styleSpec,o=n.rain;let s=[];const a=e.K(i);if(void 0===i)return s;if("object"!==a)return s=s.concat([new e.V("rain",i,`object expected, ${a} found`)]),s;for(const t in i){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&o[a[1]]&&o[a[1]].transition?pe({key:t,value:i[t],valueSpec:n.transition,style:r,styleSpec:n}):o[t]?pe({key:t,value:i[t],valueSpec:o[t],style:r,styleSpec:n}):[new e.J(t,i[t],`unknown property "${t}"`)])}return s}(t)),Te=e=>Me(re(e)),Be=e=>Me(Y(e)),Ce=e=>Me(te(e)),Se=e=>Me(ie(e)),Ee=t=>Me(e.a4(t));function Me(e){return e.slice().sort(((e,t)=>e.line&&t.line?e.line-t.line:0))}function Ie(t,i){let r=!1;if(i&&i.length)for(const n of i)n instanceof e.J?e.w(n.message):(t.fire(new e.z(new Error(n.message))),r=!0);return r}let Pe;class Le extends e.E{constructor(t,i="flat"){super(),this._transitionable=new e.a6(Pe||(Pe=new e.a7({anchor:new e.a8(e.a5.light.anchor),position:new e.a9(e.a5.light.position),color:new e.a8(e.a5.light.color),intensity:new e.a8(e.a5.light.intensity)}))),this.setLight(t,i),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t,i={}){this._validate(_e,e,i)||(this._transitionable.setTransitionOrValue(e),this.id=t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Ie(this,t.call(me,e.l({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}}let Fe=class extends e.E{constructor(t,i,r,n){super(),this.scope=r,this._transitionable=new e.a6(new e.a7({source:new e.a8(e.a5.terrain.source),exaggeration:new e.a8(e.a5.terrain.exaggeration)}),r,n),this._transitionable.setTransitionOrValue(t,n),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=i}get(){return this._transitionable.serialize()}set(e,t){this._transitionable.setTransitionOrValue(e,t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(t){return this._transitioning.possiblyEvaluate(new e.aa(t)).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const t=this._transitionable._values.exaggeration;if(!t)return null;const i=t.value.expression;if(!i)return null;let r=-1,n=-1,o=1;for(const t of i.zoomStops)o=i.evaluate(new e.aa(t)),o>.01?(r=t,n=-1):n=t;return o<.01&&r>0&&n>r?[r,n]:null}isZoomDependent(){const t=this._transitionable._values.exaggeration;return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof e.ab}};const ke=45,ze=65,Re=.05;function De(t,i,r,n){const o=e.ae(ke,ze,r),[s,a]=Oe(t,n);let l=1-Math.min(1,Math.exp((i-s)/(a-s)*-6));return l*=l*l,l=Math.min(1,1.00747*l),l*o*t.alpha}function Oe(e,t){const i=.5/Math.tan(.5*t);return[e.range[0]+i,e.range[1]+i]}function Ue(t,i,r,n,o){const s=e.ad.vec3.transformMat4([],[i,r,n],o.mercatorFogMatrix);return De(t,e.ad.vec3.length(s),o.pitch,o._fov)}function Ne(t,i,r,n,o,s,a){const l=[[r,n,0],[o,n,0],[o,s,0],[r,s,0]];let c=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(const t of l){const r=e.ad.vec3.transformMat4([],t,i),n=e.ad.vec3.length(r);c=Math.min(c,n),u=Math.max(u,n)}return[De(t,c,a.pitch,a._fov),De(t,u,a.pitch,a._fov)]}class Qe extends e.E{constructor(t,i,r,n){super();const o=new e.a7({range:new e.a8(e.a5.fog.range),color:new e.a8(e.a5.fog.color),"color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new e.a8(e.a5.fog["high-color"]),"high-color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new e.a8(e.a5.fog["space-color"]),"space-color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new e.a8(e.a5.fog["horizon-blend"]),"star-intensity":new e.a8(e.a5.fog["star-intensity"]),"vertical-range":new e.a8(e.a5.fog["vertical-range"])});this._transitionable=new e.a6(o,r,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this._transform=i,this.properties=new e.af(o),this.scope=r}get state(){const t=this._transform,i="globe"===t.projection.name,r=e.ag(t.zoom),n=this.properties.get("range"),o=[.5,3];return{range:i?[e.ah(o[0],n[0],r),e.ah(o[1],n[1],r)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,i,r={}){if(this._validate(xe,t,r))return;const n=e.l({},t);for(const t of Object.keys(e.a5.fog))void 0===n[t]&&(n[t]=e.a5.fog[t].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,i)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const i=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.ae(ke,ze,t))*i.a}getOpacityAtLatLng(t,i){return this._transform.projection.supportsFog?function(t,i,r){const n=e.ac.fromLngLat(i),o=r.elevation?r.elevation.getAtPointOrZero(n):0;return Ue(t,n.x,n.y,o,r)}(this.state,t,i):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const i=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Ne(this.state,i,0,0,e.ai,e.ai,this._transform)}getOpacityForBounds(e,t,i,r,n){return this._transform.projection.supportsFog?Ne(this.state,e,t,i,r,n,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?Oe(this.state,e):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const i=[4,5,6,7];for(const r of i){const i=t.points[r];let n;if(i[2]>=0)n=i;else{const o=t.points[r-4];n=e.aj(o,i,o[2]/(o[2]-i[2]))}if(Ue(this.state,n[0],n[1],0,this._transform)>=Re)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Ie(this,t.call(me,e.l({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}}let je,Ve,He,Ge,$e=class extends e.E{constructor(t,i,r,n){super();const o=je||(je=new e.a7({density:new e.a8(e.a5.snow.density),intensity:new e.a8(e.a5.snow.intensity),color:new e.a8(e.a5.snow.color),opacity:new e.a8(e.a5.snow.opacity),vignette:new e.a8(e.a5.snow.vignette),"vignette-color":new e.a8(e.a5.snow["vignette-color"]),"center-thinning":new e.a8(e.a5.snow["center-thinning"]),direction:new e.a8(e.a5.snow.direction),"flake-size":new e.a8(e.a5.snow["flake-size"])}));this._transitionable=new e.a6(o,r,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.af(o),this.scope=r}get state(){const t=this.properties.get("opacity"),i=this.properties.get("color"),r=this.properties.get("direction"),n=e.ak(r[0]),o=-Math.max(e.ak(r[1]),.01),s=[Math.cos(n)*Math.cos(o),Math.sin(n)*Math.cos(o),Math.sin(o)],a=this.properties.get("vignette"),l=this.properties.get("vignette-color");return l.a=a,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.al(i.r,i.g,i.b,i.a*t),direction:s,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:l}}get(){return this._transitionable.serialize()}set(t,i,r={}){if(this._validate(be,t,r))return;const n=e.l({},t);for(const t of Object.keys(e.a5.snow))void 0===n[t]&&(n[t]=e.a5.snow[t].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Ie(this,t.call(me,e.l({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}},Ze=class extends e.E{constructor(t,i,r,n){super();const o=Ve||(Ve=new e.a7({density:new e.a8(e.a5.rain.density),intensity:new e.a8(e.a5.rain.intensity),color:new e.a8(e.a5.rain.color),opacity:new e.a8(e.a5.rain.opacity),vignette:new e.a8(e.a5.rain.vignette),"vignette-color":new e.a8(e.a5.rain["vignette-color"]),"center-thinning":new e.a8(e.a5.rain["center-thinning"]),direction:new e.a8(e.a5.rain.direction),"droplet-size":new e.a8(e.a5.rain["droplet-size"]),"distortion-strength":new e.a8(e.a5.rain["distortion-strength"])}));this._transitionable=new e.a6(o,r,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.af(o),this.scope=r}get state(){const t=this.properties.get("opacity"),i=this.properties.get("color"),r=this.properties.get("direction"),n=e.ak(r[0]),o=-Math.max(e.ak(r[1]),.01),s=[Math.cos(n)*Math.cos(o),Math.sin(n)*Math.cos(o),Math.sin(o)],a=this.properties.get("vignette-color");return a.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.al(i.r,i.g,i.b,i.a*t),direction:s,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:a}}get(){return this._transitionable.serialize()}set(t,i,r={}){if(this._validate(we,t,r))return;const n=e.l({},t);for(const t of Object.keys(e.a5.rain))void 0===n[t]&&(n[t]=e.a5.rain[t].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Ie(this,t.call(me,e.l({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}};class qe extends e.E{constructor(t,i,r,n){super(),this.scope=r,this._options=t,this.properties=new e.af(i),this._transitionable=new e.a6(i,r,new Map(n)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,t){this._options=e,this._transitionable.setTransitionOrValue(e.properties,t)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}class Ke{constructor(e,t,i,r){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=i,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,r)}static createFromScreenPoints(t,i){let r,n;if(t instanceof e.P||"number"==typeof t[0]){const o=e.P.convert(t);r=[o],n=i.isPointAboveHorizon(o)}else{const o=e.P.convert(t[0]),s=e.P.convert(t[1]);r=[o,s],n=e.an(o,s).every((e=>i.isPointAboveHorizon(e)))}return new Ke(r,i.getCameraPoint(),n,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.an(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.an(i,r,0,!1);return this.cameraPoint.y>r.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x=r.x?n[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(n[3]=this.cameraPoint)),e.ao(n,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.an(i,r,t),o=this.cameraPoint.clone();switch(3*((o.y>i.y)+(o.y>r.y))+((o.x>i.x)+(o.x>r.x))){case 0:n[0]=o,n[4]=o.clone();break;case 1:n.splice(1,0,o);break;case 2:n[1]=o;break;case 3:n.splice(4,0,o);break;case 5:n.splice(2,0,o);break;case 6:n[3]=o;break;case 7:n.splice(3,0,o);break;case 8:n[2]=o}return n}containsTile(t,i,r,n=0){const o=t.queryPadding/i._pixelsPerMercatorPixel+1,s=r?this._bufferedCameraMercator(o,i):this._bufferedScreenMercator(o,i);let a=t.tileID.wrap+(s.unwrapped?n:0);const l=s.polygon.map((i=>e.ap(t.tileTransform,i,a)));if(!e.aq(l,0,0,e.ai,e.ai))return;a=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);const c=this.screenGeometryMercator.polygon.map((i=>e.ar(t.tileTransform,i,a))),u=c.map((t=>new e.P(t[0],t[1]))),h=i.getFreeCameraOptions().position||new e.ac(0,0,0),d=e.ar(t.tileTransform,h,a),p=c.map((t=>{const i=e.ad.vec3.sub(t,t,d);return e.ad.vec3.normalize(i,i),new e.as(d,i)})),f=e.at(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(A=e.au(l),A.min.x=e.ay(A.min.x,0,e.ai),A.min.y=e.ay(A.min.y,0,e.ai),A.max.x=e.ay(A.max.x,0,e.ai),A.max.y=e.ay(A.max.y,0,e.ai),A),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:f};var A}_bufferedScreenMercator(e,t){const i=Ye(e);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[i]=r,r}}_bufferedCameraMercator(e,t){const i=Ye(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[i]=r,r}}_projectAndResample(t,i){const r=function(t,i){const r=e.ad.mat4.multiply([],i.pixelMatrix,i.globeMatrix),n=[0,-e.az,0,1],o=[0,e.az,0,1],s=[0,0,0,1];e.ad.vec4.transformMat4(n,n,r),e.ad.vec4.transformMat4(o,o,r),e.ad.vec4.transformMat4(s,s,r);const a=new e.P(n[0]/n[3],n[1]/n[3]),l=new e.P(o[0]/o[3],o[1]/o[3]),c=e.aw(t,a)&&n[3]1?We(t.slice(0,d),i):[],A=dnew e.P(Xe(t.x),t.y))),A=A.map((t=>new e.P(Xe(t.x),t.y)));const m=[...f];0===m.length&&m.push(A[A.length-1]);const g=e.ah(m[m.length-1].y,(0===A.length?f[0]:A[0]).y,p);let _;return _=c?[new e.P(0,g),new e.P(0,0),new e.P(1,0),new e.P(1,g)]:[new e.P(1,g),new e.P(1,1),new e.P(0,1),new e.P(0,g)],m.push(..._),0===A.length?m.push(f[0]):m.push(...A),{polygon:m.map((t=>new e.ac(t.x,t.y))),unwrapped:!1}}(t,i);if(r)return r;const n=function(t,i){let r=!1,n=-1/0,o=0;for(let e=0;en&&(n=t[e].x,o=e);for(let e=0;e.5&&(n.x{e.x-=1})),{polygon:t,unwrapped:r}}(We(t,i).map((t=>new e.P(Xe(t.x),t.y))),i);return{polygon:n.polygon.map((t=>new e.ac(t.x,t.y))),unwrapped:n.unwrapped}}}function We(t,i){return e.ax(t,(e=>{const t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y}),1/256)}function Xe(e){return e<0?1+e%1:e%1}function Ye(e){return 100*e|0}function Je(t,i,r,n,o){const s=function(r,n){if(r)return o(r);if(n){if(t.url&&n.tiles&&t.tiles&&delete t.tiles,n.variants){if(!Array.isArray(n.variants))return o(new Error("variants must be an array"));for(const t of n.variants){if(null==t||"object"!=typeof t||t.constructor!==Object)return o(new Error("variant must be an object"));if(!Array.isArray(t.capabilities))return o(new Error("capabilities must be an array"));if(1===t.capabilities.length&&"meshopt"===t.capabilities[0]){n=e.l(n,t);break}}}const r=e.aA(e.l({},n,t),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);r.tiles=i.canonicalizeTileset(r,t.url),o(null,r)}},a=function(e,t,i){if(!e)return null;if(!t&&!i)return e;i=i||e.worldview_default;const r=Object.values(e.language||{});if(0===r.length)return null;const n=Object.values(e.worldview||{});if(0===n.length)return null;const o=r.every((e=>e===t)),s=n.every((e=>e===i));return o&&s?e:t in(e.language_options||{})||i in(e.worldview_options||{})?null:e.language_options&&e.worldview_options?e:null}(t.data,r,n);return a?e.q.frame((()=>s(null,a))):t.url?e.n(i.transformRequest(i.normalizeSourceURL(t.url,null,r,n),e.R.Source),s):e.q.frame((()=>{const{data:e,...i}=t;s(null,i)}))}class et{constructor(t,i,r){this.bounds=e.aB.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),r=Math.floor(e.av(this.bounds.getWest())*i),n=Math.floor(e.aC(this.bounds.getNorth())*i),o=Math.ceil(e.av(this.bounds.getEast())*i),s=Math.ceil(e.aC(this.bounds.getSouth())*i);return t.x>=r&&t.x=n&&t.y{if(this._tileJSONRequest=null,this._loaded=!0,n)i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),r&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new e.z(n));else if(o){if(e.l(this,o),this.hasWorldviews=!!o.worldview_options,o.worldview_default&&(this.worldviewDefault=o.worldview_default),o.vector_layers){this.vectorLayers=o.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const e of o.vector_layers)this.vectorLayerIds.push(e.id),o.worldview&&o.worldview[e.source]&&this.localizableLayerIds.add(e.id)}o.bounds&&(this.tileBounds=new et(o.bounds,this.minzoom,this.maxzoom)),P(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}t&&t(n)}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.C(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}loadTile(t,i){const r=t.tileID.canonical.url(this.tiles,this.scheme),n=this.map._requestManager.normalizeTileURL(r),o=this.map._requestManager.transformRequest(n,e.R.Tile),s=this.map.style?this.map.style.getLut(this.scope):null,a=s?{image:s.image.clone()}:null,l={request:o,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:a,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor()};if(this.hasWorldviews&&e.f(r)&&(l.worldview=this.map.getWorldview()||this.worldviewDefault,l.localizableLayerIds=this.localizableLayerIds),l.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=i:t.request=t.actor.send("reloadTile",l,c.bind(this));else if(t.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",l,c.bind(this),void 0,!0);else{const i=e.aE.call({deduped:this._deduped},l,((e,i)=>{e||!i?c.call(this,e):(l.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},t.actor&&t.actor.send("loadTile",l,c.bind(this),void 0,!0))}),!0);t.request={cancel:i}}function c(r,n){return delete t.request,t.aborted?i(null):r&&404!==r.status?i(r):(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),e.aF(this.dispatcher),i(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(e,t){e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class it extends e.E{constructor(t,i,r,n){super(),this.id=t,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.l({type:"raster"},i),e.l(this,e.aA(i,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"})),this._tileJSONRequest=Je(this._options,this.map._requestManager,null,null,((i,r)=>{this._tileJSONRequest=null,this._loaded=!0,i?this.fire(new e.z(i)):r&&(e.l(this,r),r.raster_layers&&(this.rasterLayers=r.raster_layers,this.rasterLayerIds=this.rasterLayers.map((e=>e.id))),r.bounds&&(this.tileBounds=new et(r.bounds,this.minzoom,this.maxzoom)),P(r.tiles),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(i)}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.C(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const r=e.q.devicePixelRatio>=2,n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),r,this.tileSize);t.request=e.o(this.map._requestManager.transformRequest(n,e.R.Tile),((r,n,o,s)=>(delete t.request,t.aborted?(t.state="unloaded",i(null)):r?(t.state="errored",i(r)):n?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s}),t.setTexture(n,this.map.painter),t.state="loaded",e.aF(this.dispatcher),void i(null)):i(null))))}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t&&t()}unloadTile(t,i){t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),i&&i()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class rt extends it{constructor(t,i,r,n){super(t,i,r,n),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._options=e.l({type:"raster-array"},i)}triggerRepaint(e){const t=this.map.painter._terrain,i=this.map.style.getSourceCache(this.id);t&&t.enabled&&i&&t._clearRenderCacheForTile(i.id,e.tileID),this.map.triggerRepaint()}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),n=this.map._requestManager.transformRequest(r,e.R.Tile),o={request:n,uid:t.uid,tileID:t.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=n,t.actor||(t.actor=this.dispatcher.getActor());const s=(e,r,n,o)=>{if(delete t.request,t.aborted)return t.state="unloaded",i(null);if(e){if("AbortError"===e.name)return;return t.state="errored",i(e)}if(this.map._refreshExpiredTiles&&r&&t.setExpiryData({cacheControl:n,expires:o}),this.partial)t.state="empty";else{if(!r)return i(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=r}i(null)};t.request=this.partial?t.fetchHeader(void 0,s.bind(this)):t.actor.send("loadTile",o,s.bind(this),void 0,!0)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,i){const r=t.texture;r&&r instanceof e.T?(t.destroy(!0),this.map.painter.saveTileTexture(r)):(t.destroy(),t.flushQueues(),t._isHeaderLoaded=!1,delete t._mrt,delete t.textureDescriptor),t.fbo&&(t.fbo.destroy(),delete t.fbo),delete t.request,delete t.requestParams,delete t.neighboringTiles,t.state="unloaded"}prepareTile(t,i,r){t._isHeaderLoaded&&("empty"!==t.state&&(t.state="reloading"),t.fetchBand(i,r,((i,r)=>{if(i)return t.state="errored",this.fire(new e.z(i)),void this.triggerRepaint(t);r&&(t._isHeaderLoaded=!0,t.setTexture(r,this.map.painter),t.state="loaded",this.triggerRepaint(t))})))}getInitialBand(e){if(!this.rasterLayers)return 0;const t=this.rasterLayers.find((({id:t})=>t===e)),i=t&&t.fields,r=i&&i.bands&&i.bands;return r?r[0]:0}getTextureDescriptor(t,i,r){if(!t)return;const n=i.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!n)return;let o=null;i instanceof e.aI?o=i.paint.get("raster-array-band"):i instanceof e.aJ&&(o=i.paint.get("raster-particle-array-band"));const s=o||this.getInitialBand(n);if(null!=s)if(t.textureDescriptor){if(!t.updateNeeded(n,s)||r)return Object.assign({},t.textureDescriptor,{texture:t.texture})}else this.prepareTile(t,n,s)}getImages(t,i){const r=new Map;for(const n of t)for(const t of i){const[i,o]=t.split("/"),s=n.getLayer(i);if(!s)continue;if(!s.hasBand(o)||!s.hasDataForBand(o))continue;const{bytes:a,tileSize:l,buffer:c}=s.getBandView(o),u=l+2*c,h={data:new e.r({width:u,height:u},a),pixelRatio:2,sdf:!1,usvg:!1,version:0};r.set(t,h)}return r}}const nt={vector:tt,raster:it,"raster-dem":class extends it{constructor(t,i,r,n){super(t,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=e.l({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,r){e&&(t.state="errored",i(e)),r&&(t.dem=r,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",i(null))}t.request=e.o(this.map._requestManager.transformRequest(r,e.R.Tile),function(r,o,s,a){if(delete t.request,t.aborted)t.state="unloaded",i(null);else if(r)t.state="errored",i(r);else if(o){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:s,expires:a});const i=ImageBitmap&&o instanceof ImageBitmap&&e.t(),r=1-(o.width-e.aG(o.width))/2;r<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=i?o:e.q.getImageData(o,r),c={uid:t.uid,tileID:t.tileID,source:this.id,type:this.type,scope:this.scope,rawImageData:l,encoding:this.encoding,padding:r};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadTile",c,n.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(t){const i=t.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?t.wrap-1:t.wrap,s=(i.x+1+r)%r,a=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.aH(t.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new e.aH(t.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new e.aH(t.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new e.aH(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.aH(t.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1{if(this._loaded=!0,this._pendingLoad=null,i)this.fire(new e.z(i));else{const i={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&r&&r.resourceTiming&&r.resourceTiming[this.id]&&(i.resourceTiming=r.resourceTiming[this.id]),t&&(this._partialReload=!0),this.fire(new e.A("data",i)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(t),this._coalesce=!1)}))}loaded(){return this._loaded}reload(){const t=e.C(this.id,this.scope);this.map.style.clearSource(t),this._updateWorkerData()}loadTile(t,i){const r=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const n=this.map.style?this.map.style.getLut(this.scope):null,o=n?{image:n.image.clone()}:null,s=this._partialReload,a={type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:o,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,scaleFactor:this.map.getScaleFactor(),partial:s};t.request=this.actor.send(r,a,((e,n)=>s&&!n?(t.state="loaded",i(null)):(delete t.request,t.destroy(),t.aborted?i(null):e?i(e):(t.loadVectorData(n,this.map.painter,"reloadTile"===r),i(null)))),void 0,"loadTile"===r)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e,t){this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}onRemove(e){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.l({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends e.aK{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const i of t.urls)this.urls.push(this.map._requestManager.transformRequest(i,e.R.Source).url);e.aL(this.urls,((t,i)=>{this._loaded=!0,t?this.fire(new e.z(t)):i&&(this.video=i,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;ti.end(0)?this.fire(new e.z(new e.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.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 e.T(t,this.video,i.RGBA8),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.aK,model:class extends e.E{constructor(e,t,i,r){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const t=[];for(const i in this._options.models){const r=this._options.models[i],n=e.aN(this.map._requestManager.transformRequest(r.uri,e.R.Model).url).then((t=>{if(!t)return;const n=e.aO(t),o=new e.aP(i,r.position,r.orientation,n);o.computeBoundsAndApplyParent(),this.models.push(o)})).catch((t=>{this.fire(new e.z(new Error(`Could not load model ${i} from ${r.uri}: ${t.message}`)))}));t.push(n)}return Promise.allSettled(t).then((()=>{this._loaded=!0,this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"}))})).catch((t=>{this.fire(new e.z(new Error(`Could not load models: ${t.message}`)))}))}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,t){}serialize(){return{type:"model"}}},"batched-model":class extends e.E{constructor(e,t,i,r){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=i,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(r)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.C(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(t){this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,r=this.map.getWorldview();this._tileJSONRequest=Je(this._options,this.map._requestManager,i,r,((n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),r&&2!==r.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new e.z(n))):o&&(e.l(this,o),o.bounds&&(this.tileBounds=new et(o.bounds,this.minzoom,this.maxzoom)),P(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(n)}))}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(r,e.R.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:e.q.devicePixelRatio,promoteId:this.promoteId};if(t.actor&&"expired"!==t.state)if("loading"===t.state)t.reloadCallback=i;else{if(t.buckets){const e=Object.values(t.buckets);for(const t of e)t.dirty=!0;return void(t.state="loaded")}t.request=t.actor.send("reloadTile",n,o.bind(this))}else t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",n,o.bind(this),void 0,!0);function o(e,r){return t.aborted?i(null):e&&404!==e.status?i(e):(this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadModelData(r,this.map.painter),t.state="loaded",void i(null))}}serialize(){return e.l({},this._options)}},canvas:class extends e.aK{constructor(t,i,r,n){super(t,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new e.z(new e.V(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.z(new e.V(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.z(new e.V(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.z(new e.V(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.z(new e.V(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}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 e.z(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(e){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context;this.texture?!t&&!this._playing||this.texture instanceof e.aM||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(i,this.canvas,i.gl.RGBA8,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.E{constructor(t,i,r,n){super(),this.id=t,this.type="custom",this._dataType="raster",this._dispatcher=r,this._implementation=i,this.setEventedParent(n),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new et(this._implementation.bounds,this.minzoom,this.maxzoom)),i.update=this._update.bind(this),i.clearTiles=this._clearTiles.bind(this),i.coveringTiles=this._coveringTiles.bind(this),e.l(this,e.aA(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.aA(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(t){this.map=t,this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:r}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:r})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,t){const{x:i,y:r,z:n}=e.tileID.canonical,o=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:i,y:r,z:n},{signal:o.signal})).then(function(i){return delete e.request,e.aborted?(e.state="unloaded",t(null)):void 0===i?(e.state="errored",t(null)):null===i?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",t(null)):function(e){return e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof ImageBitmap||e instanceof HTMLImageElement}(i)?(this.loadTileData(e,i),e.state="loaded",void t(null)):(e.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch((i=>{"AbortError"!==i.name&&(e.state="errored",t(i))})),e.request.cancel=()=>o.abort()}loadTileData(e,t){e.setTexture(t,this.map.painter)}unloadTile(t,i){if(t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),this._implementation.unloadTile){const{x:e,y:i,z:r}=t.tileID.canonical;this._implementation.unloadTile({x:e,y:i,z:r})}i&&i()}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z})))}_clearTiles(){const t=e.C(this.id,this.scope);this.map.style.clearSource(t)}_update(){this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}}},ot=function(t,i,r,n){const o=new nt[i.type](t,i,r,n);if(o.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);return e.aQ(["load","abort","unload","serialize","prepare"],o),o};function st(e,t,i=""){return`${i}:${t.id||""}:${t.layer.id}:${function(e){if("layerId"in e)return`layer:${e.layerId}`;{const{featuresetId:t,importId:i}=e;return`featureset:${t}${i?`:import:${i}`:""}`}}(e.target)}`}function at(e,t,i,r=""){if(e.uniqueFeatureID){const n=st(e,t,r);if(i.has(n))return!0;i.add(n)}return!1}function lt(e,t,i,r,n=!1){const o=t.sourceCache.transform,s=t.sourceCache.tilesIn(e,t.has3DLayers,n);s.sort(ht);const a=[];for(const e of s){const s=e.tile.queryRenderedFeatures(t,e,i,r,o,n);Object.keys(s).length&&a.push({wrappedTileID:e.tile.tileID.wrapped().key,queryResults:s})}return 0===a.length?{}:function(e){const t={},i={};for(const r of e){const e=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in e){const r=e[i],n=o[i]=o[i]||{},s=t[i]=t[i]||[];for(const e of r)n[e.featureIndex]||(n[e.featureIndex]=!0,s.push(e))}}return t}(a)}function ct(e,t,i,r,n){const o={},s=r.queryRenderedSymbols(e),a=[];for(const e of Object.keys(s).map(Number))a.push(n[e]);a.sort(ht);for(const e of a){const r=e.featureIndex.lookupSymbolFeatures(s[e.bucketInstanceId],e.bucketIndex,e.sourceLayerIndex,t,i);for(const t in r){const i=o[t]=o[t]||[],n=r[t];n.sort(((t,i)=>{const r=e.featureSortOrder;if(r){const e=r.indexOf(t.featureIndex);return r.indexOf(i.featureIndex)-e}return i.featureIndex-t.featureIndex}));for(const e of n)i.push(e)}}return o}function ut(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],n={};for(let e=0;et.getLayer(e))).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.fqid]=r}}return i}const pt=32,ft=33,At=new Uint16Array(8184);for(let e=0;e<2046;e++){let t=e+2,i=0,r=0,n=0,o=0,s=0,a=0;for(1&t?n=o=s=pt:i=r=a=pt;(t>>=1)>1;){const e=i+n>>1,l=r+o>>1;1&t?(n=i,o=r,i=s,r=a):(i=n,r=o,n=s,o=a),s=e,a=l}const l=4*e;At[l+0]=i,At[l+1]=r,At[l+2]=n,At[l+3]=o}const mt=new Uint16Array(2178),gt=new Uint8Array(1089),_t=new Uint16Array(1089);function yt(e){return 0===e?-.03125:32===e?.03125:0}const vt={type:2,extent:e.ai,loadGeometry:()=>[[new e.P(0,0),new e.P(e.ai+1,0),new e.P(e.ai+1,e.ai+1),new e.P(0,e.ai+1),new e.P(0,0)]]};class xt{constructor(t,i,r,n,o){this.tileID=t,this.uid=e.aW(),this.uses=0,this.tileSize=i,this.tileZoom=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(t){const i=t+this.timeAdded;ie)t=!1;else if(i)if(this.expirationTime0&&!i;f&&!a.stateDependentLayers.length&&!i||a.update(d,u,n,p,f?a.stateDependentLayers:a.layers,i,o),(a instanceof e.b2||a instanceof e.b3)&&t._terrain&&t._terrain.enabled&&h&&a.uploadPending()&&t._terrain._clearRenderCacheForTile(h.id,this.tileID);const A=t&&t.style&&t.style.getOwnLayer(s);A&&(this.queryPadding=Math.max(this.queryPadding,A.queryRadius(a)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;e--){const t=4*e,i=At[t+0],r=At[t+1],n=At[t+2],o=At[t+3],s=i+n>>1,a=r+o>>1,l=s+a-r,c=a+i-s,u=r*ft+i,h=o*ft+n,d=a*ft+s,p=Math.hypot((mt[2*u+0]+mt[2*h+0])/2-mt[2*d+0],(mt[2*u+1]+mt[2*h+1])/2-mt[2*d+1])>=16;gt[d]=gt[d]||(p?1:0),e<1022&&(gt[d]=gt[d]||gt[(r+c>>1)*ft+(i+l>>1)]||gt[(o+c>>1)*ft+(n+l>>1)])}const o=new e.aU,s=new e.aV;let a=0;function l(t,i){const r=i*ft+t;return 0===_t[r]&&(o.emplaceBack(mt[2*r+0],mt[2*r+1],t*e.ai/pt,i*e.ai/pt),_t[r]=++a),_t[r]-1}function c(e,t,i,r,n,o){const a=e+i>>1,u=t+r>>1;if(Math.abs(e-n)+Math.abs(t-o)>1&>[u*ft+a])c(n,o,e,t,a,u),c(i,r,n,o,a,u);else{const a=l(e,t),c=l(i,r),u=l(n,o);s.emplaceBack(a,c,u)}}return c(0,0,pt,pt,pt,0),c(pt,pt,0,0,0,pt),{vertices:o,indices:s}}(this.tileID.canonical,i);n=t.vertices,o=t.indices}else{n=new e.aU,o=new e.aV;for(const{x:e,y:t}of r)n.emplaceBack(e,t,0,0);const t=e.b9(n.int16,void 0,4);for(let e=0;e0&&(l=e.ad.mat4.invert(new Float64Array(16),i.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,n,i,s,l,a),this._makeGlobeTileDebugTextBuffer(t,n,i,s,l,a)}_globePoint(t,i,r,n,o,s,a){let l=e.bd(t,i,r);if(s){const o=1<.5?d=-1:h<-.5&&(d=1);let p=(t/e.ai+r.x)/o+d,f=(i/e.ai+r.y)/o;p=(p-c)*n._pixelsPerMercatorPixel+c,f=(f-u)*n._pixelsPerMercatorPixel+u;const A=[p*n.worldSize,f*n.worldSize,0];e.ad.vec3.transformMat4(A,A,s),l=e.be(l,A,a)}return e.ad.vec3.transformMat4(l,l,o)}_makeGlobeTileDebugBorderBuffer(t,i,r,n,o,s){const a=new e.b5,l=new e.b6,c=new e.bf,u=(e,t,u,h,d)=>{const p=(u-e)/(d-1),f=(h-t)/(d-1),A=a.length;for(let u=0;uh*e+t;for(let e=0;e{if(e)i(e);else try{const e=r.getHeaderLength(n);if(e>t)return void(this.request=this.fetchHeader(e,i));r.parseHeader(n),this._isHeaderLoaded=!0;let a=0;for(const e of Object.values(r.layers))a=Math.max(a,e.dataIndex[e.dataIndex.length-1].lastByte);n.byteLength>=a&&(this.entireBuffer=n),i(null,this.entireBuffer||n,o,s)}catch(e){i(e)}})),this.request}fetchBand(t,i,r){const n=this._mrt;if(!this._isHeaderLoaded||!n)return void r(new Error("Tile header is not ready"));const o=this.actor;if(!o)return void r(new Error("Can't fetch tile band without an actor"));let s;const a=(e,n)=>{s.complete(e,n),e?r(e):(this.updateTextureDescriptor(t,i),r(null,this.textureDescriptor&&this.textureDescriptor.img))},l=(e,t)=>{if(e)return r(e);const i=o.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:t,task:s},a,void 0,!0);this._workQueue.push((()=>{i&&i.cancel(),s.cancel()}))},c=n.getLayer(t);if(!c)return void r(new Error(`Unknown sourceLayer "${t}"`));if(c.hasDataForBand(i))return this.updateTextureDescriptor(t,i),void r(null,this.textureDescriptor?this.textureDescriptor.img:null);const u=c.getDataRange([i]);if(s=n.createDecodingTask(u),!s||s.tasks.length)if(this.flushQueues(),this.entireBuffer)l(null,this.entireBuffer.slice(u.firstByte,u.lastByte+1));else{const t=Object.assign({},this.requestParams,{headers:{Range:`bytes=${u.firstByte}-${u.lastByte}`}}),i=e.bj(t,l);this._fetchQueue.push((()=>{i.cancel(),s.cancel()}))}else r(null)}updateNeeded(e,t){return(!this.textureDescriptor||this.textureDescriptor.band!==t||this.textureDescriptor.layer!==e)&&"errored"!==this.state}updateTextureDescriptor(t,i){if(!this._mrt)return;const r=this._mrt.getLayer(t);if(!r||!r.hasBand(i)||!r.hasDataForBand(i))return;const{bytes:n,tileSize:o,buffer:s,offset:a,scale:l}=r.getBandView(i),c=o+2*s,u=new e.r({width:c,height:c},n),h=this.texture;h&&h instanceof e.T&&h.update(u,{premultiply:!1}),this.textureDescriptor={layer:t,band:i,img:u,buffer:s,offset:a,tileSize:o,format:r.pixelFormat,mix:[l,256*l,65536*l,16777216*l]}}}class wt{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){const r=e.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:t,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(e,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const r of this.data[i])e(r.value)||t.push(r);for(const e of t)this.remove(e.value.tileID,e)}}class Tt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,i,r){const n=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},e.l(this.stateChanges[t][n],r),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==n&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][n]){this.deletedStates[t][n]={};for(const e in this.state[t][n])r[e]||(this.deletedStates[t][n][e]=null)}else for(const e in r)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][e]&&delete this.deletedStates[t][n][e]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(t,i){const r=this.state[t]||{},n=this.stateChanges[t]||{},o=this.deletedStates[t];if(null===o)return{};if(void 0!==i){const t=String(i),s=e.l({},r[t],n[t]);if(o){const e=o[i];if(null===e)return{};for(const t in e)delete s[t]}return s}const s=e.l({},r,n);if(o)for(const e in o)delete s[e];return s}initializeTileState(e,t){e.refreshFeatureState(t)}coalesceChanges(t,i){const r={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const i={};for(const r in this.stateChanges[t])this.state[t][r]||(this.state[t][r]={}),e.l(this.state[t][r],this.stateChanges[t][r]),i[r]=this.state[t][r];r[t]=i}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const i={};if(null===this.deletedStates[t])for(const e in this.state[t])i[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else if(this.state[t][e])for(const i of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][i];i[e]=this.state[t][e]}r[t]=r[t]||{},e.l(r[t],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const e in t)t[e].refreshFeatureState(i)}}class Bt extends e.E{constructor(e,t,i){super(),this.id=e,this._onlySymbols=i,t.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),t.on("error",(()=>{this._sourceErrored=!0})),this._source=t,this._tiles={},this._cache=new wt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Tt,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles)if(!this._tiles[e].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(Ct).map((e=>e.key))}getRenderableIds(t,i){const r=[];for(const e in this._tiles)this._isIdRenderable(+e,t,i)&&r.push(this._tiles[e]);return t?r.sort(((t,i)=>{const r=t.tileID,n=i.tileID,o=new e.P(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),s=new e.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-n.overscaledZ||s.y-o.y||s.x-o.x})).map((e=>e.tileID.key)):r.map((e=>e.tileID)).sort(Ct).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())&&(i||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}_tileLoaded(t,i,r,n){if(n)if(t.state="errored",404!==n.status)this._source.fire(new e.z(n,{tile:t}));else{if(this._source.fire(new e.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=e.q.now(),"expired"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),"raster-dem"===this._source.type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new e.A("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const t=this.getRenderableIds();for(let r=0;r1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>i)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>t+1;){const e=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[e.key],o&&o.hasData()&&(s=e)}let a=s;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]){r[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),r=this._getLoadedTile(t);if(r)return r}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const i=Math.ceil(e.width/t)+1,r=Math.ceil(e.height/t)+1,n=Math.floor(i*r*5),o="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,n):n,s="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(t,i,r,n){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!r)return;this.updateCacheSize(t,i),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const o="batched-model"===this._source.type;let s,a=this._source.maxzoom;const l=this.map&&this.map.painter?this.map.painter._terrain:null;if(l&&l.sourceCache===this&&l.attenuationRange()){const e=l.attenuationRange()[0],t=Math.floor(e)-Math.log2(l.getDemUpscale());a>t&&(a=t)}if(this.used||this.usedForTerrain){if(this._source.tileID)s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new e.aH(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)));else if(0!==this.tileCoverLift){const n=t.clone();n.tileCoverLift=this.tileCoverLift,s=n.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:a,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.minzoom<=1&&"globe"===t.projection.name&&(s.push(new e.aH(1,0,1,0,0)),s.push(new e.aH(1,0,1,1,0)),s.push(new e.aH(1,0,1,0,1)),s.push(new e.aH(1,0,1,1,1)))}else if(s=t.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:a,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.hasTile){const e=this._source.hasTile.bind(this._source);s=s.filter((t=>e(t)))}}else s=[];if(s.length>0&&this.castsShadows&&n&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!St(this._source.type)){const e=t.coveringZoomLevel({tileSize:i||this._source.tileSize,roundZoom:this._source.roundZoom&&!r}),a=Math.min(e,this._source.maxzoom);if(o){const e=t.extendTileCover(s,a);for(const t of e)s.push(t)}else{const e=t.extendTileCover(s,a,n);for(const t of e)this._shadowCasterTiles[t.key]=!0,s.push(t)}}const c=this._updateRetainedTiles(s);if(St(this._source.type)&&0!==s.length){const t={},i={},r=Object.keys(c);for(const n of r){const r=c[n],o=this._tiles[n];if(!o||o.fadeEndTime&&o.fadeEndTime<=e.q.now())continue;const s=this.findLoadedParent(r,Math.max(r.overscaledZ-Bt.maxOverzooming,this._source.minzoom));s&&(this._addTile(s.tileID),t[s.tileID.key]=s.tileID),i[n]=r}const n=s[s.length-1].overscaledZ;for(const e in this._tiles){const t=this._tiles[e];if(c[e]||!t.hasData())continue;let r=t.tileID;for(;r.overscaledZ>n;){r=r.scaledTo(r.overscaledZ-1);const n=this._tiles[r.key];if(n&&n.hasData()&&i[r.key]){c[e]=t.tileID;break}}}for(const e in t)c[e]||(this._coveredTiles[e]=!0,c[e]=t[e])}for(const e in c)this._tiles[e].clearFadeHold();const u=e.bk(this._tiles,c);for(const e of u){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const i={},r=e.reduce(((e,t)=>Math.min(e,t.overscaledZ)),1/0),n=e[0].overscaledZ,o=Math.max(n-Bt.maxOverzooming,this._source.minzoom),s=Math.max(n+Bt.maxUnderzooming,this._source.minzoom),a={};for(const i of e){const e=this._addTile(i);t[i.key]=i,e.hasData()||r=this._source.maxzoom){const e=r.children(this._source.maxzoom)[0],i=this.getTile(e);if(i&&i.hasData()){t[e.key]=e;continue}}else{const e=r.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let n=e.wasRequested();for(let s=r.overscaledZ-1;s>=o;--s){const o=r.scaledTo(s);if(i[o.key])break;if(i[o.key]=!0,e=this.getTile(o),!e&&n&&(e=this._addTile(o)),e&&(t[o.key]=o,n=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;r=e}for(const e of t)this._loadedParentTiles[e]=i}}_addTile(t){let i=this._tiles[t.key];if(i)return!0!==i.isExtraShadowCaster||!!this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const r=Boolean(i);if(!r){const e=this.map?this.map.painter:null,r=this._source.tileSize*t.overscaleFactor();i="raster-array"===this._source.type?new bt(t,r,this.transform.tileZoom,e,this._isRaster):new xt(t,r,this.transform.tileZoom,e,this._isRaster),this._loadTile(i,this._tileLoaded.bind(this,i,t.key,i.state))}return i?(i.uses++,this._tiles[t.key]=i,r||this._source.fire(new e.A("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i):null}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state||"empty"===t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,i,r){const n=[],o=this.transform;if(!o)return n;const s="globe"===o.projection.name,a=e.av(o.center.lng);for(const l in this._tiles){const c=this._tiles[l];if(r&&c.clearQueryDebugViz(),c.holdingForFade())continue;let u;if(s){const t=c.tileID.canonical;if(0===t.z){const i=[Math.abs(e.ay(a,...Et(t,-1))-a),Math.abs(e.ay(a,...Et(t,1))-a)];u=[0,2*i.indexOf(Math.min(...i))-1]}else{const i=[Math.abs(e.ay(a,...Et(t,-1))-a),Math.abs(e.ay(a,...Et(t,0))-a),Math.abs(e.ay(a,...Et(t,1))-a)];u=[i.indexOf(Math.min(...i))-1]}}else u=[0];for(const e of u){const r=t.containsTile(c,o,i,e);r&&n.push(r)}}return n}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,t){const i=this.getRenderableIds(e,t).map((e=>this._tiles[e].tileID)),r="globe"===this.transform.projection.name;for(const e of i)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped()),e.expandedProjMatrix=r?this.transform.calculateProjMatrix(e.toUnwrapped(),!1,!0):e.projMatrix;return i}sortCoordinatesByDistance(e){const t=e.slice(),i=this.transform._camera.position,r=this.transform._camera.forward(),n={};for(const e of t){const t=1/(1<n[e.key]-n[t.key])),t}hasTransition(){if(this._source.hasTransition())return!0;if(St(this._source.type))for(const t in this._tiles){const i=this._tiles[t];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=e.q.now())return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,i){const r=this._tiles[e];r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter((i=>!i.hasDependency(e,t)))}_preloadTiles(t,i){if(!this._sourceLoaded){const e=()=>{this._sourceLoaded&&(this._source.off("data",e),this._preloadTiles(t,i))};return void this._source.on("data",e)}const r=new Map,n=Array.isArray(t)?t:[t],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize;for(const e of n){const t=e.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)r.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1)}const a=Array.from(r.values());e.bl(a,((e,t)=>{const i=new xt(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(i,(e=>{"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),t(e,i)}))}),i)}}function Ct(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function St(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function Et(e,t){const i=1<0:"model"===i.type&&(r=!i.isHidden(e)&&i.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!r&&t.visible,t.visible=r}}updateZOffset(e,t){this.currentBuildingBuckets=[];for(const e of this.layers){const i=e.layer,r=this.style.getLayerSourceCache(i);let n=1;"fill-extrusion"===i.type&&(n=e.visible?i.paint.get("fill-extrusion-vertical-scale"):0);let o=r?r.getTile(t):null;if(!o&&r&&t.canonical.z>r.getSource().minzoom){let e=t.scaledTo(Math.min(r.getSource().maxzoom,t.overscaledZ-1));for(;e.overscaledZ>=r.getSource().minzoom&&(o=r.getTile(e),!o&&0!==e.overscaledZ);)e=e.scaledTo(e.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:o?o.getBucket(i):null,tileID:o?o.tileID:t,verticalScale:n})}e.hasAnyZOffset=!1;let i=!1;for(let r=0;r{e in i&&(r[e]=i[e])})),r}function Pt(e){e=e.slice();const t=Object.create(null);for(let i=0;i0?(n-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}class Qt{constructor(e,t,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;ethis.width||r<0||t>this.height)return!n&&[];const s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return!0;for(let e=0;e0:s}_queryCircle(e,t,i,r,n){const o=e-i,s=e+i,a=t-i,l=t+i;if(s<0||o>this.width||l<0||a>this.height)return!r&&[];const c=[];return this._forEachCell(o,a,s,l,this._queryCellCircle,c,{hitTest:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),r?c.length>0:c}query(e,t,i,r,n){return this._query(e,t,i,r,!1,n)}hitTest(e,t,i,r,n){return this._query(e,t,i,r,!0,n)}hitTestCircle(e,t,i,r){return this._queryCircle(e,t,i,!0,r)}_queryCell(e,t,i,r,n,o,s,a){const l=s.seenUids,c=this.boxCells[n];if(null!==c){const n=this.bboxes;for(const u of c)if(!l.box[u]){l.box[u]=!0;const c=4*u;if(e<=n[c+2]&&t<=n[c+3]&&i>=n[c+0]&&r>=n[c+1]&&(!a||a(this.boxKeys[u]))){if(s.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[u],x1:n[c],y1:n[c+1],x2:n[c+2],y2:n[c+3]})}}}const u=this.circleCells[n];if(null!==u){const n=this.circles;for(const c of u)if(!l.circle[c]){l.circle[c]=!0;const u=3*c;if(this._circleAndRectCollide(n[u],n[u+1],n[u+2],e,t,i,r)&&(!a||a(this.circleKeys[c]))){if(s.hitTest)return o.push(!0),!0;{const e=n[u],t=n[u+1],i=n[u+2];o.push({key:this.circleKeys[c],x1:e-i,y1:t-i,x2:e+i,y2:t+i})}}}}}_queryCellCircle(e,t,i,r,n,o,s,a){const l=s.circle,c=s.seenUids,u=this.boxCells[n];if(null!==u){const e=this.bboxes;for(const t of u)if(!c.box[t]){c.box[t]=!0;const i=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(this.boxKeys[t])))return o.push(!0),!0}}const h=this.circleCells[n];if(null!==h){const e=this.circles;for(const t of h)if(!c.circle[t]){c.circle[t]=!0;const i=3*t;if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(this.circleKeys[t])))return o.push(!0),!0}}}_forEachCell(e,t,i,r,n,o,s,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(n.call(this,e,t,i,r,this.xCellCount*l+d,o,s,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,n,o){const s=r-e,a=n-t,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(e,t,i,r,n,o,s){const a=(o-r)/2,l=Math.abs(e-(r+a));if(l>a+i)return!1;const c=(s-n)/2,u=Math.abs(t-(n+c));if(u>c+i)return!1;if(l<=a||u<=c)return!0;const h=l-a,d=u-c;return h*h+d*d<=i*i}}const jt={unknown:0,flipRequired:1,flipNotRequired:2},Vt=Math.tan(85*Math.PI/180);function Ht(t,i,r,n,o,s,a){const l=e.ad.mat4.create();if(r)if("globe"===s.name){const t=e.bo(o,i);e.ad.mat4.multiply(l,l,t)}else{const t=e.ad.mat2.invert([],a);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],n||e.ad.mat4.rotateZ(l,l,o.angle)}else e.ad.mat4.multiply(l,o.labelPlaneMatrix,t);return l}function Gt(e,t,i,r,n,o,s){const a=Ht(e,t,i,r,n,o,s);return"globe"===o.name&&i||(a[2]=a[6]=a[10]=a[14]=0),a}function $t(t,i,r,n,o,s,a){if(r){if("globe"===s.name){const l=Ht(t,i,r,n,o,s,a);return e.ad.mat4.invert(l,l),e.ad.mat4.multiply(l,t,l),l}{const i=e.ad.mat4.clone(t),r=e.ad.mat4.identity([]);return r[0]=a[0],r[1]=a[1],r[4]=a[2],r[5]=a[3],e.ad.mat4.multiply(i,i,r),n||e.ad.mat4.rotateZ(i,i,-o.angle),i}}return o.glCoordMatrix}function Zt(t,i,r,n){const o=[t,i,r,1];r?e.ad.vec4.transformMat4(o,o,n):ni(o,o,n);const s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function qt(e,t){return Math.min(.5+e/t*.5,1.5)}function Kt(e,t){const i=e[0]/e[3],r=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&r>=-t[1]&&r<=t[1]}function Wt(t,i,r,n,o,s,a,l,c,u){const h=r.transform,d=n?t.textSizeData:t.iconSizeData,p=e.bp(d,r.transform.zoom),f="globe"===h.projection.name,A=[256/r.width*2+1,256/r.height*2+1],m=n?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;m.clear();let g=null;f&&(g=n?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const _=t.lineVertexArray,y=n?t.text.placedSymbolArray:t.icon.placedSymbolArray,v=r.transform.width/r.transform.height;let x,b=!1;for(let n=0;nMath.abs(r)?{useVertical:!0}:t===e.bq.vertical?n>0?{needsFlipping:!0}:null:i!==jt.unknown&&function(e,t){return 0===e||Math.abs(t/e)>Vt}(r,n)?i===jt.flipRequired?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null}function Jt(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v){const x=i/24,b=t.lineOffsetX*x,w=t.lineOffsetY*x,{lineStartIndex:T,glyphStartIndex:B,numGlyphs:C,segment:S,writingMode:E,flipState:M}=t,I=T+t.lineLength,P=t=>{if(h){const[i,r,n]=t.up,o=u.length;e.bs(h,o+0,i,r,n),e.bs(h,o+1,i,r,n),e.bs(h,o+2,i,r,n),e.bs(h,o+3,i,r,n)}const[i,r,n]=t.point;e.bt(u,i,r,n,t.angle)};if(C>1){const e=Xt(x,l,b,w,r,d,p,t,c,s,f,m,!1,g,_,y,v);if(!e)return{notEnoughRoom:!0};if(n&&!r){let[i,r,n]=e.first.point,[o,s,l]=e.last.point;[i,r]=Zt(i,r,n,a),[o,s]=Zt(o,s,l,a);const c=Yt(E,M,(o-i)*A,s-r);if(t.flipState=c&&c.needsFlipping?jt.flipRequired:jt.flipNotRequired,c)return c}P(e.first);for(let e=B+1;e0?s:ti(p,n,i,1,o,void 0,g,_.canonical),l=Yt(E,M,(a[0]-i[0])*A,a[1]-i[1]);if(t.flipState=l&&l.needsFlipping?jt.flipRequired:jt.flipNotRequired,l)return l}const i=ii(x*l.getoffsetX(B),b,w,r,d,p,S,T,I,c,s,f,m,!1,!1,g,_,y,v);if(!i)return{notEnoughRoom:!0};P(i)}return{}}function ei(e,t,i,r,n){const{x:o,y:s,z:a}=r.projectTilePoint(e.x,e.y,t);if(!n)return Zt(o,s,a,i);const[l,c,u]=n(e);return Zt(o+l,s+c,a+u,i)}function ti(t,i,r,n,o,s,a,l){const c=ei(t.sub(i)._unit()._add(t),l,o,a,s);return e.ad.vec3.sub(c,r,c),e.ad.vec3.normalize(c,c),e.ad.vec3.scaleAndAdd(c,r,c,n)}function ii(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y){const v=n?t-i:t+i;let x=v>0?1:-1,b=0;n&&(x*=-1,b=Math.PI),x<0&&(b+=Math.PI);let w=l+a+(x>0?0:1)|0,T=o,B=o,C=0,S=0;const E=Math.abs(v),M=[],I=[];let P=s,L=P,F=e.ad.vec3.zero([]);const k=()=>ti(L,P,B,E-C+1,h,p,m,g.canonical);for(;C+S<=E;){if(w+=x,w=c)return null;if(B=T,L=P,M.push(B),f&&I.push(L),P=new e.P(u.getx(w),u.gety(w)),T=d[w],!T){const e=ei(P,g.canonical,h,m,p);T=e[3]>0?d[w]=e:k()}C+=S;const t=e.ad.vec3.sub([],T,B),i=e.ad.vec3.distance(B,T);if(r&&i>0&&S>0&&e.ad.vec3.dot(F,t)/(S*i)0,p),A=o*f.perspectiveRatio,m=(i.x1*t+r.x-i.padding)*A+f.point.x,g=(i.y1*t+r.y-i.padding)*A+f.point.y,_=(i.x2*t+r.x+i.padding)*A+f.point.x,y=(i.y2*t+r.y+i.padding)*A+f.point.y,v=f.perspectiveRatio<=.55||f.occluded;return!this.isInsideGrid(m,g,_,y)||!n&&this.grid.hitTest(m,g,_,y,a)||v?{box:[],offscreen:!1,occluded:f.occluded}:{box:[m,g,_,y],offscreen:this.isOffscreen(m,g,_,y),occluded:!1}}placeCollisionCircles(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A){const m=[],g=this.transform.elevation,_=t.getProjection(),y=g?g.getAtTileOffsetFunc(A,this.transform.center.lat,this.transform.worldSize,_):null,v=new e.P(r.tileAnchorX,r.tileAnchorY);let{x:x,y:b,z:w}=_.projectTilePoint(v.x,v.y,A.canonical);if(y){const[e,t,i]=y(v);x+=e,b+=t,w+=i}const T="globe"===_.name,B=this.projectAndGetPerspectiveRatio(a,x,b,w,A,T||!!g||this.transform.pitch>0,_),{perspectiveRatio:C}=B,S=(h?s/C:s*C)/e.bw,E=Zt(x,b,w,l),M=r.lineOffsetX*S,I=r.lineOffsetY*S,P=e.ak(t.layers[0].layout.get("text-max-angle")),L=Math.cos(P),F=B.signedDistanceFromCamera>0?Xt(S,o,M,I,!1,E,v,r,n,l,{},g&&!h?y:null,h&&!!g,_,A,h,L):null;let k=!1,z=!1,R=!0;if(F&&!B.occluded){const t=.5*p*C+f,r=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new Nt,{first:s,last:a}=F,l=s.path.length;let h=[];for(let e=l-1;e>=1;e--)h.push(s.path[e]);for(let e=1;e(y&&!T&&(i=y(re[3]<=0))&&(h=[]));let g=[];if(h.length>0){let t=1/0,i=-1/0,o=1/0,s=-1/0;for(const e of h)t=Math.min(t,e[0]),o=Math.min(o,e[1]),i=Math.max(i,e[0]),s=Math.max(s,e[1]);i>=r.x&&t<=n.x&&s>=r.y&&o<=n.y&&(g=[h.map((t=>new e.P(t[0],t[1])))],(tn.x||on.y)&&(g=e.bu(g,r.x,r.y,n.x,n.y)))}for(const e of g){o.reset(e,.25*t);let r=0;r=o.length<=.5*t?1:Math.ceil(o.paddedLength/A)+1;for(let e=0;e0){if(e.ad.vec4.transformMat4(l,l,t),this.fogState&&o&&"globe"!==a.name){const t=function(t,i,r,n,o,s){const a=s.calculateFogTileMatrix(o),l=[i,r,n];return e.ad.vec3.transformMat4(l,l,a),De(t,e.ad.vec3.length(l),s.pitch,s._fov)}(this.fogState,i,r,n,o.toUnwrapped(),this.transform);c=t>.9}}else ni(l,l,t);const u=l[3];return{point:new e.P((l[0]/u+1)/2*this.transform.width+oi,(-l[1]/u+1)/2*this.transform.height+oi),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/u*.5,1.5),signedDistanceFromCamera:u,occluded:s&&l[2]>u||c}}isOffscreen(e,t,i,r){return i=this.screenRightBoundary||rthis.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e=0&&te.collisionGroupID===t}}return this.collisionGroups[e]}}function mi(t,i,r,n,o){const{horizontalAlign:s,verticalAlign:a}=e.bD(t),l=-(s-.5)*i,c=-(a-.5)*r,u=e.bC(t,n);return new e.P(l+u[0]*o,c+u[1]*o)}function gi(t,i,r,n,o){const s=new e.P(t,i);return r&&s._rotate(n?o:-o),s}class _i{constructor(e,t,i,r,n,o){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new si(this.transform,n),this.buildingIndex=o,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new Ai(i),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,i,r,n,o=1){const s=r.getBucket(i),a=r.latestFeatureIndex;if(!s||!a||i.fqid!==s.layerIds[0])return;const l=s.layers[0].layout,c=s.layers[0].paint,u=r.collisionBoxArray,h=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),d=r.tileSize/e.ai,p=r.tileID.toUnwrapped();this.transform.setProjection(s.projection);const f=(A=r.tileID,m=s.getProjection(),g=this.transform,m.name===this.projection?g.calculateProjMatrix(A.toUnwrapped()):ai(g,m,A));var A,m,g;const _="map"===l.get("text-pitch-alignment"),y="map"===l.get("text-rotation-alignment");i.compileFilter(i.options);const v=i.dynamicFilter(),x=i.dynamicFilterNeedsFeature(),b=this.transform.calculatePixelsToTileUnitsMatrix(r),w=Gt(f,r.tileID.canonical,_,y,this.transform,s.getProjection(),b);let T=null;if(_){const t=$t(f,r.tileID.canonical,_,y,this.transform,s.getProjection(),b);T=e.ad.mat4.multiply([],this.transform.labelPlaneMatrix,t)}let B=null;v&&r.latestFeatureIndex&&(B={unwrappedTileID:p,dynamicFilter:v,dynamicFilterNeedsFeature:x}),this.retainedQueryData[s.bucketInstanceId]=new fi(s.bucketInstanceId,a,s.sourceLayerIndex,s.index,r.tileID);const[C,S]=s.layers[0].layout.get("text-size-scale-range"),E=e.ay(o,C,S),[M,I]=l.get("icon-size-scale-range"),P=e.ay(o,M,I),L={bucket:s,layout:l,paint:c,posMatrix:f,textLabelPlaneMatrix:w,labelToScreenMatrix:T,clippingData:B,scale:h,textPixelRatio:d,holdingForFade:r.holdingForFade(),collisionBoxArray:u,partiallyEvaluatedTextSize:e.bp(s.textSizeData,this.transform.zoom,E),partiallyEvaluatedIconSize:e.bp(s.iconSizeData,this.transform.zoom,P),collisionGroup:this.collisionGroups.get(s.sourceID),latestFeatureIndex:r.latestFeatureIndex};if(n)for(const e of s.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=e;t.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:L})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:L})}attemptAnchorPlacement(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g){const{textOffset0:_,textOffset1:y,crossTileID:v}=h,x=[_,y],b=mi(e,i,r,x,n),w=this.collisionIndex.placeCollisionBox(p,n,t,gi(b.x,b.y,o,s,this.transform.angle),u,a,l,c.predicate);if(A){const e=p.getSymbolInstanceIconSize(g,this.transform.zoom,h.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(p,e,A,gi(b.x,b.y,o,s,this.transform.angle),u,a,l,c.predicate).box.length)return}if(w.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[v]&&this.prevPlacement.placements[v]&&this.prevPlacement.placements[v].text&&(t=this.prevPlacement.variableOffsets[v].anchor),this.variableOffsets[v]={textOffset:x,width:i,height:r,anchor:e,textScale:n,prevAnchor:t},this.markUsedJustification(p,e,h,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,h),this.placedOrientations[v]=f),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(t,i,r,n,o=1){const{bucket:s,layout:a,paint:l,posMatrix:c,textLabelPlaneMatrix:u,labelToScreenMatrix:h,clippingData:d,textPixelRatio:p,holdingForFade:f,collisionBoxArray:A,partiallyEvaluatedTextSize:m,partiallyEvaluatedIconSize:g,collisionGroup:_,latestFeatureIndex:y}=t.parameters,v=a.get("text-optional"),x=a.get("icon-optional"),b=a.get("text-allow-overlap"),w=a.get("icon-allow-overlap"),T="map"===a.get("text-rotation-alignment"),B="map"===a.get("text-pitch-alignment"),C=l.get("symbol-z-offset"),S="sea"===a.get("symbol-elevation-reference"),[E,M]=a.get("text-size-scale-range"),[I,P]=a.get("icon-size-scale-range"),L=e.ay(o,E,M),F=e.ay(o,I,P);this.transform.setProjection(s.projection);let k=b&&(w||!s.hasIconData()||x),z=w&&(b||!s.hasTextData()||v);const R=!C.isConstant();!s.collisionArrays&&A&&s.deserializeCollisionBoxes(A),r&&n&&s.updateCollisionDebugBuffers(this.transform.zoom,A,L,F);const D=(t,n,l)=>{const{crossTileID:A,numVerticalGlyphVertices:E}=t;let M=null;if(d&&d.dynamicFilterNeedsFeature||R){const e=this.retainedQueryData[s.bucketInstanceId];M=y.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.sourceLayerIndex,layoutVertexArrayOffset:0})}if(d&&!(0,d.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},M,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new e.P(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(d.unwrappedTileID)))return this.placements[A]=new di(!1,!1,!1,!0),void i.add(A);const I=C.evaluate(M,{});if(i.has(A))return;if(f)return void(this.placements[A]=new di(!1,!1,!1));let P=!1,L=!1,F=!0,D=!1,O=!1,U=null,N={box:null,offscreen:null,occluded:null},Q={box:null,offscreen:null,occluded:null},j=null,V=null,H=null,G=0,$=0,Z=0;l.textFeatureIndex?G=l.textFeatureIndex:t.useRuntimeCollisionCircles&&(G=t.featureIndex),l.verticalTextFeatureIndex&&($=l.verticalTextFeatureIndex);const q=e=>{e.tileID=this.retainedQueryData[s.bucketInstanceId].tileID;const i=this.transform.elevation;e.elevation=S?I:I+(i?i.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0),e.elevation+=t.zOffset},K=l.textBox;if(K){q(K);const i=i=>{let r=e.bq.horizontal;if(s.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[A];e&&(this.placedOrientations[A]=e,r=e,this.markUsedOrientation(s,r,t))}return r},r=(t,i)=>{if(s.allowVerticalPlacement&&E>0&&l.verticalTextBox){for(const r of s.writingModes)if(r===e.bq.vertical?(N=i(),Q=N):N=t(),N&&N.box&&N.box.length)break}else N=t()};if(a.get("text-variable-anchor")){let o=a.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[A]){const e=this.prevPlacement.variableOffsets[A];o.indexOf(e.anchor)>0&&(o=o.filter((t=>t!==e.anchor)),o.unshift(e.anchor))}const u=(e,i,r)=>{const a=s.getSymbolInstanceTextSize(m,t,this.transform.zoom,n),l=(e.x2-e.x1)*a+2*e.padding,u=(e.y2-e.y1)*a+2*e.padding,h=t.hasIconTextFit&&!w?i:null;h&&q(h);let d={box:[],offscreen:!1,occluded:!1};const f=b?2*o.length:o.length;for(let i=0;i=o.length,t,n,s,r,h,m,g);if(f&&(d=f.placedGlyphBoxes,d&&d.box&&d.box.length)){P=!0,U=f.shift;break}}return d};r((()=>u(K,l.iconBox,e.bq.horizontal)),(()=>{const t=l.verticalTextBox;return t&&q(t),s.allowVerticalPlacement&&!(N&&N.box&&N.box.length)&&E>0&&t?u(t,l.verticalIconBox,e.bq.vertical):{box:null,offscreen:null,occluded:null}})),N&&(P=N.box,F=N.offscreen,D=N.occluded);const h=i(!(!N||!N.box));if(!P&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[A];e&&(this.variableOffsets[A]=e,this.markUsedJustification(s,e.anchor,t,h))}}else{const a=(i,r)=>{const a=s.getSymbolInstanceTextSize(m,t,this.transform.zoom,n,o),l=this.collisionIndex.placeCollisionBox(s,a,i,new e.P(0,0),b,p,c,_.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(s,r,t),this.placedOrientations[A]=r),l};r((()=>a(K,e.bq.horizontal)),(()=>{const t=l.verticalTextBox;return s.allowVerticalPlacement&&E>0&&t?(q(t),a(t,e.bq.vertical)):{box:null,offscreen:null,occluded:null}})),i(!!(N&&N.box&&N.box.length))}}if(j=N,P=j&&j.box&&j.box.length>0,F=j&&j.offscreen,D=j&&j.occluded,t.useRuntimeCollisionCircles){const i=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),n=e.br(s.textSizeData,m,i),o=a.get("text-padding");V=this.collisionIndex.placeCollisionCircles(s,b,i,s.lineVertexArray,s.glyphOffsetArray,n,c,u,h,r,B,_.predicate,t.collisionCircleDiameter*n/e.bw,o,this.retainedQueryData[s.bucketInstanceId].tileID),P=b||V.circles.length>0&&!V.collisionDetected,F=F&&V.offscreen,D=V.occluded}if(l.iconFeatureIndex&&(Z=l.iconFeatureIndex),l.iconBox){const i=i=>{q(i);const r=t.hasIconTextFit&&U?gi(U.x,U.y,T,B,this.transform.angle):new e.P(0,0),n=s.getSymbolInstanceIconSize(g,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(s,n,i,r,w,p,c,_.predicate)};Q&&Q.box&&Q.box.length&&l.verticalIconBox?(H=i(l.verticalIconBox),L=H.box.length>0):(H=i(l.iconBox),L=H.box.length>0),F=F&&H.offscreen,O=H.occluded}const W=v||0===t.numHorizontalGlyphVertices&&0===E,X=x||0===t.numIconVertices;if(W||X?X?W||(L=L&&P):P=L&&P:L=P=L&&P,P&&j&&j.box&&this.collisionIndex.insertCollisionBox(j.box,a.get("text-ignore-placement"),s.bucketInstanceId,Q&&Q.box&&$?$:G,_.ID),L&&H&&this.collisionIndex.insertCollisionBox(H.box,a.get("icon-ignore-placement"),s.bucketInstanceId,Z,_.ID),V&&(P&&this.collisionIndex.insertCollisionCircles(V.circles,a.get("text-ignore-placement"),s.bucketInstanceId,G,_.ID),r)){const e=s.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new pi);for(let e=0;e=0;--e){const i=t[e];D(s.symbolInstances.get(i),i,s.collisionArrays[i])}s.hasAnyZOffset&&e.w(`${s.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(s.hasAnyZOffset){const e=s.getSortedIndexesByZOffset();for(let t=0;t=0&&(t.text.placedSymbolArray.get(o).crossTileID=h>=0&&o!==h?0:c),s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=h>=0&&s!==h?0:c),a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=h>=0&&a!==h?0:c),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=h>=0&&l!==h?0:c)}markUsedOrientation(t,i,r){const n=i===e.bq.horizontal||i===e.bq.horizontalOnly?i:0,o=i===e.bq.vertical?i:0,{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=r,u=t.text.placedSymbolArray;s>=0&&(u.get(s).placedOrientation=n),a>=0&&(u.get(a).placedOrientation=n),l>=0&&(u.get(l).placedOrientation=n),c>=0&&(u.get(c).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=n[e];o?(this.opacities[e]=new hi(o,r,t.text,t.icon,null,t.clipped),i=i||t.text!==o.text.placed||t.icon!==o.icon.placed):(this.opacities[e]=new hi(null,r,t.text,t.icon,t.skipFade,t.clipped),i=i||t.text||t.icon)}for(const e in n){const t=n[e];if(!this.opacities[e]){const n=new hi(t,r,!1,!1);n.isHidden()||(this.opacities[e]=n,i=i||t.text.placed||t.icon.placed)}}for(const e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(const e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t,i,r){const n=new Set;for(const o of t){const t=o.getBucket(e);t&&o.latestFeatureIndex&&e.fqid===t.layerIds[0]&&(this.updateBucketOpacities(t,n,o,o.collisionBoxArray,i,r,o.tileID,e.scope),"offset"===t.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(t,o.tileID),"road"===t.elevationType&&t.updateRoadElevation(),t.updateZOffset())}}updateBucketOpacities(t,i,r,n,o,s,a,l){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const c=t.layers[0].layout,u=t.layers[0].paint,h=!!t.layers[0].dynamicFilter(),d=new hi(null,0,!1,!1,!0),p=c.get("text-allow-overlap"),f=c.get("icon-allow-overlap"),A=c.get("text-variable-anchor"),m="map"===c.get("text-rotation-alignment"),g="map"===c.get("text-pitch-alignment"),_=u.get("symbol-z-offset"),y="sea"===c.get("symbol-elevation-reference"),v=!_.isConstant(),x=new hi(null,0,p&&(f||!t.hasIconData()||c.get("icon-optional")),f&&(p||!t.hasTextData()||c.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const b=(e,t,i)=>{for(let r=0;r0||p>0,F=T>0,k=this.placedOrientations[f],z=k===e.bq.vertical,R=k===e.bq.horizontal||k===e.bq.horizontalOnly;!L&&!F||P.isHidden()||w++;let D=!1;if((L||F)&&s)for(const i of t.activeReplacements){if(e.bx(i,o,e.by.Symbol,l))continue;if(i.min.x>B||B>i.max.x||i.min.y>C||C>i.max.y)continue;const t=e.bz(B,C,a.canonical,i.footprintTileId.canonical);if(D=e.bA(t,i.footprint),D)break}if(L){const e=D?Ei:Si(P.text);b(t.text,u,z?Ei:e),b(t.text,p,R?Ei:e);const i=P.text.isHidden(),{leftJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:n,rightJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:s}=c,a=t.text.placedSymbolArray,l=i||z?1:0;r>=0&&(a.get(r).hidden=l),n>=0&&(a.get(n).hidden=l),o>=0&&(a.get(o).hidden=l),s>=0&&(a.get(s).hidden=i||R?1:0);const h=this.variableOffsets[f];h&&this.markUsedJustification(t,h.anchor,c,k);const d=this.placedOrientations[f];d&&(this.markUsedJustification(t,"left",c,d),this.markUsedOrientation(t,d,c))}if(F){const e=D?Ei:Si(P.icon),{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:r}=c,n=t.icon.placedSymbolArray,o=P.icon.isHidden()?1:0;i>=0&&(b(t.icon,T,z?Ei:e),n.get(i).hidden=o),r>=0&&(b(t.icon,c.numVerticalIconVertices,R?Ei:e),n.get(r).hidden=o)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[n];if(i){let r=new e.P(0,0),n=!0;if(i.textBox||i.verticalTextBox){if(A){const e=this.variableOffsets[f];e?(r=mi(e.anchor,e.width,e.height,e.textOffset,e.textScale),m&&r._rotate(g?this.transform.angle:-this.transform.angle)):n=!1}h&&(n=!P.clipped),i.textBox&&yi(t.textCollisionBox.collisionVertexArray,P.text.placed,!n||z,M,y,r.x,r.y),i.verticalTextBox&&yi(t.textCollisionBox.collisionVertexArray,P.text.placed,!n||R,M,y,r.x,r.y)}const o=n&&Boolean(!R&&i.verticalIconBox);i.iconBox&&yi(t.iconCollisionBox.collisionVertexArray,P.icon.placed,o,M,y,c.hasIconTextFit?r.x:0,c.hasIconTextFit?r.y:0),i.verticalIconBox&&yi(t.iconCollisionBox.collisionVertexArray,P.icon.placed,!o,M,y,c.hasIconTextFit?r.x:0,c.hasIconTextFit?r.y:0)}}}if(t.fullyClipped=0===w,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function yi(e,t,i,r,n,o,s){e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0)}const vi=Math.pow(2,25),xi=Math.pow(2,24),bi=Math.pow(2,17),wi=Math.pow(2,16),Ti=Math.pow(2,9),Bi=Math.pow(2,8),Ci=Math.pow(2,1);function Si(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*vi+t*xi+i*bi+t*wi+i*Ti+t*Bi+i*Ci+t}const Ei=0;class Mi{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,t,i,r,n,o){const s=this._bucketParts;for(;this._currentTileIndexe.sortKey-t.sortKey)));this._currentPartIndex{const t=e.q.now()-s;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const s=i[t[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){const t=s,i=t.layout.get("symbol-z-elevate"),l=void 0!==t.layout.get("symbol-sort-key").constantOr(1),c=t.layout.get("symbol-z-order"),u="viewport-y"===c||"auto"===c&&!("viewport-y"!==c&&l),h=t.layout.get("text-allow-overlap")||t.layout.get("icon-allow-overlap")||t.layout.get("text-ignore-placement")||t.layout.get("icon-ignore-placement"),d=u&&h,p=this._inProgressLayer=this._inProgressLayer||new Mi(t),f=e.C(s.source,s.scope);if(p.continuePlacement(i||d?n[f]:r[f],this.placement,this._showCollisionBoxes,s,a,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Pi=512/e.ai/2;class Li{constructor(t,i,r){this.tileID=t,this.bucketInstanceId=r,this.index=new e.bE(i.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const n=t.canonical.x*e.ai,o=t.canonical.y*e.ai;for(let e=0;ee.overscaledZ)for(const i in n){const o=n[i];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,r)}else{const o=n[e.scaledTo(Number(i)).key];o&&o.findMatches(t.symbolInstances,e,r)}}for(let e=0;e{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}const Ri=771;class Di{constructor(e,t,i,r){this.blendFunction=e,this.blendColor=t,this.mask=i,this.blendEquation=r}}Di.Replace=[1,0,1,0],Di.disabled=new Di(Di.Replace,e.al.transparent,[!1,!1,!1,!1]),Di.unblended=new Di(Di.Replace,e.al.transparent,[!0,!0,!0,!0]),Di.alphaBlended=new Di([1,Ri,1,Ri],e.al.transparent,[!0,!0,!0,!0]),Di.alphaBlendedNonPremultiplied=new Di([770,Ri,770,Ri],e.al.transparent,[!0,!0,!0,!0]),Di.multiply=new Di([774,0,774,0],e.al.transparent,[!0,!0,!0,!0]);class Oi{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}Oi.ReadOnly=!1,Oi.ReadWrite=!0,Oi.disabled=new Oi(519,Oi.ReadOnly,[0,1]);const Ui=7680;class Ni{constructor(e,t,i,r,n,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}Ni.disabled=new Ni({func:519,mask:0},0,0,Ui,Ui,Ui);const Qi=1029,ji=2305;class Vi{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}function Hi(t,i){const r=e.bG(t,3);e.ad.mat4.fromQuat(t,i),e.bI(t,3,r)}function Gi(t,i){const r=e.ad.quat.identity([]);return e.ad.quat.rotateZ(r,r,-i),e.ad.quat.rotateX(r,r,-t),r}function $i(t,i){const r=[t[0],t[1],0],n=[i[0],i[1],0];if(e.ad.vec3.length(r)>=1e-15){const t=e.ad.vec3.normalize([],r);e.ad.vec3.scale(n,t,e.ad.vec3.dot(n,t)),i[0]=n[0],i[1]=n[1]}const o=e.ad.vec3.cross([],i,t);if(e.ad.vec3.len(o)<1e-15)return null;const s=Math.atan2(-o[1],o[0]);return Gi(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),s)}Vi.disabled=new Vi(!1,Qi,ji),Vi.backCCW=new Vi(!0,Qi,ji),Vi.backCW=new Vi(!0,Qi,2304),Vi.frontCW=new Vi(!0,1028,2304),Vi.frontCCW=new Vi(!0,1028,ji);class Zi{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(t){if(t){const i=t instanceof e.ac?t:new e.ac(t[0],t[1],t[2]);this._renderWorldCopies&&(i.x=e.bF(i.x,0,1)),this._position=i}else this._position=null}lookAtPoint(t,i){if(this.orientation=null,!this.position)return;const r=this.position,n=this._elevation?this._elevation.getAtPointOrZero(e.ac.fromLngLat(t)):0,o=e.ac.fromLngLat(t,n),s=[o.x-r.x,o.y-r.y,o.z-r.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=$i(s,i)}setPitchBearing(t,i){this.orientation=Gi(e.ak(t),e.ak(-i))}}class qi{constructor(t,i){this._transform=e.ad.mat4.identity([]),this.orientation=i,this.position=t}get mercatorPosition(){const t=this.position;return new e.ac(t[0],t[1],t[2])}get position(){const t=e.bG(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var i;t&&e.bI(this._transform,3,[(i=t)[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.ad.quat.identity([]),t&&Hi(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=Gi(e,t),Hi(this._transform,this._orientation)}forward(){const t=e.bG(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=e.bG(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=e.bG(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,i){const r=new Float64Array(16);return e.ad.mat4.invert(r,this.getWorldToCamera(t,i)),r}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,i,r){const n=this.position;e.ad.vec3.scale(n,n,-t);const o=new Float64Array(16);return e.ad.mat4.fromScaling(o,[r,r,r]),e.ad.mat4.translate(o,o,n),o[10]*=i,o}getWorldToCamera(t,i){const r=new Float64Array(16),n=new Float64Array(4),o=this.position;return e.ad.quat.conjugate(n,this._orientation),e.ad.vec3.scale(o,o,-t),e.ad.mat4.fromQuat(r,n),e.ad.mat4.translate(r,r,o),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=i,r[9]*=i,r[10]*=i,r[11]*=i,r}getCameraToClipPerspective(t,i,r,n){const o=new Float64Array(16);return e.ad.mat4.perspective(o,t,i,r,n),o}getCameraToClipOrthographic(t,i,r,n,o,s){const a=new Float64Array(16);return e.ad.mat4.ortho(a,t,i,r,n,o,s),a}getDistanceToElevation(t,i=!1){const r=0===t?0:e.bH(t,i?e.aT(this.position[1]):this.position[1]),n=this.forward();return(r-this.position[2])/n[2]}clone(){return new qi([...this.position],[...this.orientation])}}const Ki={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Wi{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=r}interpolate(t,i,r){return null!=i.top&&null!=t.top&&(this.top=e.ah(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.ah(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=e.ah(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=e.ah(t.right,i.right,r)),this}getCenter(t,i){const r=e.ay((this.left+t-this.right)/2,0,t),n=e.ay((this.top+i-this.bottom)/2,0,i);return new e.P(r,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Wi(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Xi=15;class Yi{constructor(t,i,r,n,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=r??0,this._maxPitch=n??60,this.setProjection(s),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new e.bO(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Wi,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new qi,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const e=new Yi(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e._allowWorldUnderZoom=this._allowWorldUnderZoom,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!t||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const i=this._elevation;t||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&i.exaggeration()&&this._centerAltitudeValidForExaggeration!==i.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*i.exaggeration(),this._centerAltitudeValidForExaggeration=i.exaggeration()):(this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=i.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop();let n=0,o=0;for(let s=0;s{const l=e.c5(i,t,r,o,s);a.has(l)||(n.push(new e.aH(t,i,r,o,s)),a.add(l))};for(let e=0;e0,f=a.y+10,m=n.wrap-(p?0:1),g=n.wrap+(d?0:1),_=p?a.x-1:h-1,y=d?a.x+1:0;if(o)r[0]<0?(l(c,g,a.z,y,a.y),r[1]<0&&f&&(l(c,u,a.z,a.x,a.y+1),l(c,g,a.z,y,a.y+1)),r[1]>0&&A&&(l(c,u,a.z,a.x,a.y-1),l(c,g,a.z,y,a.y-1))):r[0]>0?(l(c,m,a.z,_,a.y),r[1]<0&&f&&(l(c,u,a.z,a.x,a.y+1),l(c,m,a.z,_,a.y+1)),r[1]>0&&A&&(l(c,u,a.z,a.x,a.y-1),l(c,m,a.z,_,a.y-1))):r[1]<0&&f?l(c,u,a.z,a.x,a.y+1):A&&l(c,u,a.z,a.x,a.y-1);else{const e=n.visibleQuadrants;1&e&&(l(c,m,a.z,_,a.y),A&&(l(c,u,a.z,a.x,a.y-1),l(c,m,a.z,_,a.y-1))),2&e&&(l(c,g,a.z,y,a.y),A&&(l(c,u,a.z,a.x,a.y-1),l(c,g,a.z,y,a.y-1))),4&e&&(l(c,m,a.z,_,a.y),f&&(l(c,u,a.z,a.x,a.y+1),l(c,m,a.z,_,a.y+1))),8&e&&(l(c,g,a.z,y,a.y),f&&(l(c,u,a.z,a.x,a.y+1),l(c,g,a.z,y,a.y+1)))}}const c=[];for(const e of n)n.some((t=>e.isChildOf(t)))||c.push(e);if(n=c.filter((e=>!t.some((t=>!!(e.overscaledZ{const t=e.canonical.x+.5-r[0],i=e.canonical.y+.5-r[1];return t*t+i*it.maxzoom&&(i=t.maxzoom);const a=this.locationCoordinate(this.center),l=this.center.lat,c=1<{const i=1/4e4,r=new e.ac(t.x+i,t.y,t.z),n=new e.ac(t.x,t.y+i,t.z),o=t.toLngLat(),s=r.toLngLat(),a=n.toLngLat(),l=this.locationCoordinate(o),c=this.locationCoordinate(s),u=this.locationCoordinate(a),h=Math.hypot(c.x-l.x,c.y-l.y),d=Math.hypot(u.x-l.x,u.y-l.y);return Math.sqrt(h*d)*w/i},B=t=>{const i=x,r=b;return{aabb:e.bV(this,c,0,0,0,t,r,i,this.projection),zoom:0,x:0,y:0,minZ:r,maxZ:i,wrap:t,fullyVisible:!1}},C=[];let S=[];const E=i,M=t.reparseOverscaled?r:i,I=(m-this._centerAltitude)*A,P=e=>{if(!this._elevation||!e.tileID||!s)return;const t=this._elevation.getMinMaxForTile(e.tileID),i=e.aabb;t?(i.min[2]=t.min,i.max[2]=t.max,i.center[2]=(i.min[2]+i.max[2])/2):(e.shouldSplit=F(e),e.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude))},L=(e,t)=>{if(.707*t{if(t.zoom=.9)return!0}else if(o&&(a=t.aabb.distanceZ(g)*A),this.projection.isReprojectedInTileSpace&&r<=5){const i=Math.pow(2,t.zoom),r=T(new e.ac((t.x+.5)/i,(t.y+.5)/i));c=r>.85?1:r}if(!s){const e=Math.sqrt(i*i+n*n+a*a);let r=(1<0;){const r=C.pop(),n=r.x,a=r.y;let l=r.fullyVisible;const d=()=>"globe"===this.projection.name&&(0===r.y||r.y===(1<>1),d={aabb:s?r.aabb.quadrant(t):e.bV(this,c,r.zoom+1,i,u,r.wrap,r.minZ,r.maxZ,this.projection),zoom:r.zoom+1,x:i,y:u,wrap:r.wrap,fullyVisible:l,tileID:void 0,shouldSplit:void 0,minZ:r.minZ,maxZ:r.maxZ};o&&!h&&(d.tileID=new e.aH(r.zoom+1===E?M:r.zoom+1,r.wrap,r.zoom+1,i,u),P(d)),C.push(d)}else{const o=r.zoom===E?M:r.zoom;if(t.minzoom&&t.minzoom>o)continue;let s=0;if(!l){let i=_?r.aabb.intersectsPrecise(p):r.aabb.intersectsPreciseFlat(p);if(0===i&&d()){const t=new e.bT(r.zoom,n,a);i=e.bU(this,c,t,!0).intersectsPrecise(p)}if(0===i)continue;if(t.calculateQuadrantVisibility)if(p.containsPoint(r.aabb.center))s=15;else for(let e=0;e<4;e++)0!==r.aabb.quadrant(e).intersects(p)&&(s|=1<{const o=[0,0,0,1],s=[e.ai,e.ai,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());e.ad.vec4.transformMat4(o,o,a),e.ad.vec4.transformMat4(s,s,a);const l=e.ad.vec4.min([],o,s),c=e.ad.vec4.max([],o,s),u=e.bW(l,c);if(0===u)return!0;let h=!1;const d=this._elevation;if(d&&u>i&&0!==r){const i=this.calculateProjMatrix(n.tileID.toUnwrapped());let o;t.isTerrainDEM||(o=d.getMinMaxForTile(n.tileID)),o||(o={min:b,max:x});const s=e.c7(this.rotation),a=[s[0]*e.ai,s[1]*e.ai,o.max];e.ad.vec3.transformMat4(a,a,i),h=(1-a[1])*this.height*.5e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const i=e.ay(t.lat,-e.bX,e.bX),r=this.projection.project(t.lng,i);return new e.P(r.x*this.worldSize,r.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.bH(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,i){let r,n;const o=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;r=(i.x-o.x)/e,n=(i.y-o.y)/e}else{const e=this.pointCoordinate(i),t=this.pointCoordinate(o);r=e.x-t.x,n=e.y-t.y}const s=this.locationCoordinate(t);this.setLocation(new e.ac(s.x-r,s.y-n))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e,t){return this.projection.locationPoint(this,e,t)}locationPoint3D(e,t){return this.projection.locationPoint(this,e,t,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e,t){return this.coordinateLocation(this.pointCoordinate3D(e,t))}locationCoordinate(t,i){const r=i?e.bH(i,t.lat):void 0,n=this.projection.project(t.lng,t.lat);return new e.ac(n.x,n.y,r)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,i){const r=null!=i?i:this._centerAltitude,n=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.ad.vec4.transformMat4(n,n,this.pixelMatrixInverse),e.ad.vec4.transformMat4(o,o,this.pixelMatrixInverse);const s=o[3];e.ad.vec4.scale(n,n,1/n[3]),e.ad.vec4.scale(o,o,1/s);const a=n[2],l=o[2];return{p0:n,p1:o,t:a===l?0:(r-a)/(l-a)}}screenPointToMercatorRay(t){const i=[t.x,t.y,0,1],r=[t.x,t.y,1,1];return e.ad.vec4.transformMat4(i,i,this.pixelMatrixInverse),e.ad.vec4.transformMat4(r,r,this.pixelMatrixInverse),e.ad.vec4.scale(i,i,1/i[3]),e.ad.vec4.scale(r,r,1/r[3]),i[2]=e.bH(i[2],this._center.lat)*this.worldSize,r[2]=e.bH(r[2],this._center.lat)*this.worldSize,e.ad.vec4.scale(i,i,1/this.worldSize),e.ad.vec4.scale(r,r,1/this.worldSize),new e.as([i[0],i[1],i[2]],e.ad.vec3.normalize([],e.ad.vec3.sub([],r,i)))}rayIntersectionCoordinate(t){const{p0:i,p1:r,t:n}=t,o=e.bH(i[2],this._center.lat),s=e.bH(r[2],this._center.lat);return new e.ac(e.ah(i[0],r[0],n)/this.worldSize,e.ah(i[1],r[1],n)/this.worldSize,e.ah(o,s,n))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t,i){if(!this.elevation)return this.pointCoordinate(t,i);let r=this.projection.pointCoordinate3D(this,t.x,t.y);if(r)return new e.ac(r[0],r[1],r[2]);let n=0,o=this.horizonLineFromTop();if(t.y>o)return this.pointCoordinate(t,i);const s=.02*o,a=t.clone();for(let t=0;t<10&&o-n>s;t++){a.y=e.ah(n,o,.66);const t=this.projection.pointCoordinate3D(this,a.x,a.y);t?(o=a.y,r=t):n=a.y}return r?new e.ac(r[0],r[1],r[2]):this.pointCoordinate(t)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=e.bY)return!this.isPointAboveHorizon(t);const i=this.pointCoordinate(t);return i.y>=0&&i.y<=1}_coordinatePoint(t,i){const r=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,n=[t.x*this.worldSize,t.y*this.worldSize,r+t.toAltitude(),1];return e.ad.vec4.transformMat4(n,n,this.pixelMatrix),n[3]>0?new e.P(n[0]/n[3],n[1]/n[3]):new e.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:i}=this._edgeInsets,r=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,o=this.pointLocation3D(new e.P(i,t)),s=this.pointLocation3D(new e.P(n,t)),a=this.pointLocation3D(new e.P(n,r)),l=this.pointLocation3D(new e.P(i,r));let c=Math.min(o.lng,s.lng,a.lng,l.lng),u=Math.max(o.lng,s.lng,a.lng,l.lng),h=Math.min(o.lat,s.lat,a.lat,l.lat),d=Math.max(o.lat,s.lat,a.lat,l.lat);const p=Math.pow(2,-this.zoom)/16*270,f="globe"===this.projection.name?1:4,A=(t,i,r,n,o)=>{const s=(t+r)/2,a=(i+n)/2,l=new e.P(s,a),{lng:m,lat:g}=this.pointLocation3D(l),_=Math.max(0,c-m,h-g,m-u,g-d);c=Math.min(c,m),u=Math.max(u,m),h=Math.min(h,g),d=Math.max(d,g),(op)&&(A(t,i,s,a,o+1),A(s,a,r,n,o+1))};if(A(i,t,n,t,1),A(n,t,n,r,1),A(n,r,i,r,1),A(i,r,i,t,1),"globe"===this.projection.name){const[t,i]=e.bZ(this);t?(d=90,u=180,c=-180):i&&(h=-90,u=180,c=-180)}return new e.aB(new e.bO(c,h),new e.bO(u,d))}_getBoundsRectangular(t,i){const{top:r,left:n}=this._edgeInsets,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,a=new e.P(n,r),l=new e.P(s,r),c=new e.P(s,o),u=new e.P(n,o);let h=this.pointCoordinate(a,t),d=this.pointCoordinate(l,t);const p=this.pointCoordinate(c,i),f=this.pointCoordinate(u,i),A=(e,t)=>(t.y-e.y)/(t.x-e.x);return h.y>1&&d.y>=0?h=new e.ac((1-f.y)/A(f,h)+f.x,1):h.y<0&&d.y<=1&&(h=new e.ac(-f.y/A(f,h)+f.x,0)),d.y>1&&h.y>=0?d=new e.ac((1-p.y)/A(p,d)+p.x,1):d.y<0&&h.y<=1&&(d=new e.ac(-p.y/A(p,d)+p.x,0)),(new e.aB).extend(this.coordinateLocation(h)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(p))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce(((e,t)=>{if(t.dem){const i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0])}return e}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-e.bX,this.maxLat=e.bX,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLngh&&(a=h-c),h-ut&&(s=t-l),t-e{for(let o=0;o<16;o++)t[o]=e.ah(i[o],r[o],n)})(a,a,l,e.c9(this.pitch>=Xi?1:this.pitch/Xi))}else a=l;const c=e.ad.mat4.mul([],l,s);let u=e.ad.mat4.mul([],a,s);if(this.projection.isReprojectedInTileSpace){const t=this.locationCoordinate(this.center),i=e.ad.mat4.identity([]);e.ad.mat4.translate(i,i,[t.x*this.worldSize,t.y*this.worldSize,0]),e.ad.mat4.multiply(i,i,e.c0(this)),e.ad.mat4.translate(i,i,[-t.x*this.worldSize,-t.y*this.worldSize,0]),e.ad.mat4.multiply(u,u,i),e.ad.mat4.multiply(c,c,i),this.inverseAdjustmentMatrix=e.c1(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.ad.mat4.scale([],u,[this.worldSize,this.worldSize,this.worldSize/o,1]),this.projMatrix=u,this.invProjMatrix=e.ad.mat4.invert(new Float64Array(16),this.projMatrix),i){const i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);i[8]=2*-t.x/this.width,i[9]=2*t.y/this.height,this.expandedFarZProjMatrix=e.ad.mat4.mul([],i,s)}else this.expandedFarZProjMatrix=this.projMatrix;const h=e.ad.mat4.invert([],a);this.frustumCorners=e.c2.fromInvProjectionMatrix(h,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!i);const d=new Float32Array(16);e.ad.mat4.identity(d),e.ad.mat4.scale(d,d,[1,-1,1]),e.ad.mat4.rotateX(d,d,this._pitch),e.ad.mat4.rotateZ(d,d,this.angle);const p=e.ad.mat4.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.ad.mat4.clone(p);const f=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;p[8]=2*-t.x/this.width,p[9]=2*(t.y+f)/this.height,this.skyboxMatrix=e.ad.mat4.multiply(d,p,d);const A=this.point,m=A.x,g=A.y,_=this.width%2/2,y=this.height%2/2,v=Math.cos(this.angle),x=Math.sin(this.angle),b=m-Math.round(m)+v*_+x*y,w=g-Math.round(g)+v*y+x*_,T=new Float64Array(u);if(e.ad.mat4.translate(T,T,[b>.5?b-1:b,w>.5?w-1:w,0]),this.alignedProjMatrix=T,u=e.ad.mat4.create(),e.ad.mat4.scale(u,u,[this.width/2,-this.height/2,1]),e.ad.mat4.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=e.ad.mat4.create(),e.ad.mat4.scale(u,u,[1,-1,1]),e.ad.mat4.translate(u,u,[-1,-1,0]),e.ad.mat4.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.pixelMatrix=e.ad.mat4.multiply(new Float64Array(16),this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},u=e.ad.mat4.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=u,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.c3(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.ad.vec3.transformMat4(t,t,s),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=u;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,r=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,o=[t,t,i];e.ad.vec3.scale(o,o,n),e.ad.vec3.scale(r,r,-1),e.ad.vec3.multiply(r,r,o);const s=e.ad.mat4.create();e.ad.mat4.translate(s,s,r),e.ad.mat4.scale(s,s,o),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,n)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),r=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[r.x/this.worldSize-i[0]*n,r.y/this.worldSize-i[1]*n,e/this.worldSize*this._centerAltitude-i[2]*n]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=this._camera.position[2],n=t[2];let o=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(o=Math.min((i-r)/n,1)),this._camera.position=e.ad.vec3.scaleAndAdd([],this._camera.position,t,o),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,i=this._camera.forward(),{pitch:r,bearing:n}=this._camera.getPitchBearing(),o=e.bH(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.ak(this._maxPitch)),a=Math.max((t[2]-o)/Math.cos(r),s),l=this._zoomFromMercatorZ(a);e.ad.vec3.scaleAndAdd(t,t,i,a),this._pitch=e.ay(r,e.ak(this.minPitch),e.ak(this.maxPitch)),this.angle=e.bF(n,-Math.PI,Math.PI),this._setZoom(e.ay(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.ac(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(t){let i=0,r=e.bY,n=0,o=1/0;for(;r-i>1e-6&&r>i;){const e=i+.5*(r-i),s=this.tileSize*Math.pow(2,e),a=this.getCameraToCenterDistance(this.projection,e,s),l=this.scaleZoom(a/(t*this.tileSize)),c=Math.abs(e-l);cc||i.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.c4(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(t,i){const r=e.ad.vec3.length(e.ad.vec3.sub([],this._camera.position,t)),n=this._zoomFromMercatorZ(r)+i;return r-this._mercatorZfromZoom(n)}getCameraPoint(){if("globe"===this.projection.name){const t=function([t,i,r],n){const o=[t,i,r,1];e.ad.vec4.transformMat4(o,o,n);const s=o[3]=Math.max(o[3],1e-6);return o[0]/=s,o[1]/=s,o[2]/=s,o}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}}getCameraToCenterDistance(t,i=this.zoom,r=this.worldSize){const n=e.b$(t,i,this.width,this.height,1024),o=t.pixelSpaceConversion(this.center.lat,r,n);let s=.5/Math.tan(.5*this._fov)*this.height*o;return this.isOrthographic&&(s=e.ah(1,s,e.c9(this.pitch>=Xi?1:this.pitch/Xi))),s}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.ad.mat4.multiply(t,t,this.globeMatrix),t}getFrustum(t){return e.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,"meters"===this.projection.zAxisUnit)}}const Ji=(t,i)=>{if(i>0&&t.terrain&&e.w("Cutoff is currently disabled on terrain"),i<=0||t.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const r=t.transform,n=Math.max(Math.abs(r._zoom-(t.minCutoffZoom-1)),1),o=r.isLODDisabled(!1)?e.ae(60,45,r.pitch):e.ae(30,15,r.pitch),s=r._farZ-r._nearZ,a=i*r.height,l=((1-(c=o))*r.cameraToCenterDistance+c*(r._farZ+a))*n;var c;return{shouldRenderCutoff:o<1,uniformValues:{u_cutoff_params:[r._nearZ,r._farZ,(l-r._nearZ)/s,(l-a-r._nearZ)/s]}}},er={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class tr{constructor(e,t){this.aabb=e,this.lastCascade=t}}class ir{add(e,t){const i=this.receivers[e.key];void 0!==i?(i.aabb.min[0]=Math.min(i.aabb.min[0],t.min[0]),i.aabb.min[1]=Math.min(i.aabb.min[1],t.min[1]),i.aabb.min[2]=Math.min(i.aabb.min[2],t.min[2]),i.aabb.max[0]=Math.max(i.aabb.max[0],t.max[0]),i.aabb.max[1]=Math.max(i.aabb.max[1],t.max[1]),i.aabb.max[2]=Math.max(i.aabb.max[2],t.max[2])):this.receivers[e.key]=new tr(t,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(t,i,r){const n=e.ce.fromPoints(t.points);let o=0;for(const t in this.receivers){const s=this.receivers[t];if(!s)continue;if(!n.intersectsAabb(s.aabb))continue;s.aabb.min=n.closestPoint(s.aabb.min),s.aabb.max=n.closestPoint(s.aabb.max);const a=s.aabb.getCorners();for(let t=0;t1||s[1]<-1||s[1]>1){n=!1;break}}if(s.lastCascade=t,o=Math.max(o,t),n)break}}return o+1}}class rr{constructor(e){this.painter=e,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new ir,this._depthMode=new Oi(e.context.gl.LEQUAL,Oi.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,e.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},(()=>{this.painter.style.map.triggerRepaint()})),e.tp.registerParameter(er,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),e.tp.registerParameter(er,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),e.tp.registerParameter(er,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),e.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,i){const r=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!i||!i.properties)return;const n=i.properties.get("shadow-intensity");if(!i.shadowsEnabled()||n<=0)return;if(this._shadowLayerCount=r.style.order.reduce(((e,i)=>{const n=r.style._mergedLayers[i];return e+(n.hasShadowPass()&&!n.isHidden(t.zoom)?1:0)}),0),this._enabled=this._shadowLayerCount>0,!this.enabled)return;const o=r.context,s=er.shadowMapResolution,a=er.shadowMapResolution;if(0===this._cascades.length||er.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let t=0;te.dem)).forEach((e=>{const t=e.dem.tree;i[0]=Math.min(i[0],t.minimums[0]),i[1]=Math.max(i[1],t.maximums[0])})),1e4!==i[0]&&(l=(i[1]-i[0])*e.exaggeration())}const c=1.5*t.cameraToCenterDistance,u=3*c,h=new Float64Array(16);for(let i=0;i=0)return{};const o=function(t,i,r){const n=r/(1<0&&(e.ad.vec3.add(o[1],o[1],[n[0]*s,0,0]),e.ad.vec3.add(o[2],o[2],[n[0]*s,0,0])),n[1]<0?(e.ad.vec3.add(o[0],o[0],[0,n[1]*s,0]),e.ad.vec3.add(o[1],o[1],[0,n[1]*s,0])):n[1]>0&&(e.ad.vec3.add(o[2],o[2],[0,n[1]*s,0]),e.ad.vec3.add(o[3],o[3],[0,n[1]*s,0]));const a={};return a.vertices=o,a.planes=[nr(o[1],o[0],o[4]),nr(o[2],o[1],o[5]),nr(o[3],o[2],o[6]),nr(o[0],o[3],o[7])],a}addShadowReceiver(t,i,r){this._receivers.add(t,e.ce.fromTileIdAndHeight(t,i,r))}getMaxCascadeForTile(e){const t=this._receivers.get(e);return t&&t.lastCascade?t.lastCascade:0}}function nr(t,i,r){const n=e.ad.vec3.sub([],r,i),o=e.ad.vec3.sub([],t,i),s=e.ad.vec3.cross([],n,o),a=e.ad.vec3.length(s);return 0===a?[0,0,1,0]:(e.ad.vec3.scale(s,s,1/a),[s[0],s[1],s[2],-e.ad.vec3.dot(s,i)])}function or(t){const i=t.properties.get("direction"),r=e.cc(i.x,i.y,i.z);r[2]=e.ay(r[2],0,75);const n=e.cf([r[0],r[1],r[2]]);return e.ad.vec3.fromValues(n.x,n.y,n.z)}function sr(t,i,r){const n="none"===i.properties.get("color-use-theme"),o=i.properties.get("color"),s=i.properties.get("intensity"),a=i.properties.get("direction"),l=[a.x,a.y,a.z],c="none"===r.properties.get("color-use-theme"),u=r.properties.get("color"),h=r.properties.get("intensity"),d=Math.max(e.ad.vec3.dot([0,0,1],l),0),p=[0,0,0];e.ad.vec3.scale(p,u.toRenderColor(c?null:t.getLut(i.scope)).toArray01Linear().slice(0,3),h);const f=[0,0,0];return e.ad.vec3.scale(f,o.toRenderColor(n?null:t.getLut(r.scope)).toArray01Linear().slice(0,3),d*s),e.cg([p[0]>0?p[0]/(p[0]+f[0]):0,p[1]>0?p[1]/(p[1]+f[1]):0,p[2]>0?p[2]/(p[2]+f[2]):0])}function ar(t,i,r,n,o,s){const a=t.zoom,l=t.scale,c=t.worldSize,u=1/c,h=t.aspect,d=Math.sqrt(1+h*h)*Math.tan(.5*t.fovX),p=d*d,f=n-r,A=n+r;let m,g;p>f/A?(m=n,g=n*d):(m=.5*A*(1+p),g=.5*Math.sqrt(f*f+2*(n*n+r*r)*p+A*A*p*p));const _=t.projection.pixelsPerMeter(t.center.lat,c),y=t._camera.getCameraToWorldMercator(),v=[0,0,-m*u];e.ad.vec3.transformMat4(v,v,y);let x=g*u;const b=t._edgeInsets;if(!(0===b.left&&0===b.top&&0===b.right&&0===b.bottom||b.left===b.right&&b.top===b.bottom)){const i=t._camera.getWorldToCamera(t.worldSize,"meters"===t.projection.zAxisUnit?_:1),o=t._camera.getCameraToClipPerspective(t._fov,t.width/t.height,r,n);o[8]=2*-t.centerOffset.x/t.width,o[9]=2*t.centerOffset.y/t.height;const s=new Float64Array(16);e.ad.mat4.mul(s,o,i);const u=new Float64Array(16);e.ad.mat4.invert(u,s);const h=e.bR.fromInvProjectionMatrix(u,c,a,!0);for(const i of h.points){const r=((w=i)[0]/=l,w[1]/=l,w[2]=e.bH(w[2],t._center.lat),w);x=Math.max(x,e.ad.vec3.len(e.ad.vec3.subtract([],v,r)))}}var w;x*=o/(o-1);const T=Math.acos(i[2]),B=Math.atan2(-i[0],-i[1]),C=new qi;C.position=v,C.setPitchBearing(T,B);const S=C.getWorldToCamera(c,_),E=x*c,M=Math.min(t._mercatorZfromZoom(17)*c*-2,-2*E),I=C.getCameraToClipOrthographic(-E,E,-E,E,M,(E+s*_)/i[2]),P=new Float64Array(16);e.ad.mat4.multiply(P,I,S);const L=e.ad.vec3.fromValues(Math.floor(1e6*v[0])/1e6*c,Math.floor(1e6*v[1])/1e6*c,0),F=.5*o,k=[0,0,0];e.ad.vec3.transformMat4(k,L,P),e.ad.vec3.scale(k,k,F);const z=[Math.floor(k[0]),Math.floor(k[1]),Math.floor(k[2])],R=[0,0,0];e.ad.vec3.sub(R,k,z),e.ad.vec3.scale(R,R,-1/F);const D=new Float64Array(16);return e.ad.mat4.identity(D),e.ad.mat4.translate(D,D,R),e.ad.mat4.multiply(P,D,P),[P,E]}class lr extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.modelUris={"":{}},this.numModelsLoading={}}loadModel(t,i){return e.aN(this.requestManager.transformRequest(i,e.R.Model).url).then((i=>{if(!i)return;const r=e.aO(i),n=new e.aP(t,void 0,void 0,r);return n.computeBoundsAndApplyParent(),n})).catch((r=>{if(r&&404===r.status)return null;this.fire(new e.z(new Error(`Could not load model ${t} from ${i}: ${r.message}`)))}))}load(t,i,r={keepNumReferences:!1}){this.models[i]||(this.models[i]={});const n=Object.keys(t);this.numModelsLoading[i]=(this.numModelsLoading[i]||0)+n.length;const o=[];for(const e of n)o.push(this.loadModel(e,t[e]));Promise.allSettled(o).then((t=>{for(let e=0;e{this.fire(new e.z(new Error(`Could not load models: ${t.message}`)))}))}isLoaded(){for(const e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,t){return!!this.getModel(e,t)}getModel(e,t){return this.models[t]||(this.models[t]={}),this.models[t][e]?this.models[t][e].model:void 0}addModel(e,t,i){this.models[i]||(this.models[i]={}),this.modelUris[i]||(this.modelUris[i]={}),this.hasModel(e,i)&&this.models[i][e].numReferences++,this.modelUris[i][e]=this.requestManager.normalizeModelURL(t),this.load({[e]:this.modelUris[i][e]},i)}addModels(e,t){this.models[t]||(this.models[t]={}),this.modelUris[t]||(this.modelUris[t]={});const i=this.modelUris[t];for(const r in e)this.models[t][r]={},i[r]=this.requestManager.normalizeModelURL(e[r]);this.load(i,t,{keepNumReferences:!0})}reloadModels(e){this.load(this.modelUris[e],e)}addModelsFromBucket(e,t){this.models[t]||(this.models[t]={}),this.modelUris[t]||(this.modelUris[t]={});const i={};for(const r of e)this.hasModel(r,t)?this.models[t][r].numReferences++:(this.modelUris[t][r]=this.requestManager.normalizeModelURL(r),i[r]=this.modelUris[t][r]);this.load(i,t)}removeModel(e,t){if(this.models[t]&&this.models[t][e]&&(this.models[t][e].numReferences--,0===this.models[t][e].numReferences)){const i=this.models[t][e].model;delete this.models[t][e],delete this.modelUris[t][e],i.destroy()}}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,t){this.models[t]||(this.models[t]={});for(const i in this.models[t])this.models[t][i].model&&this.models[t][i].model.upload(e.context)}}const cr=new e.a7({data:new e.a8(e.a5.colorTheme.data)}),ur={"mbx-indoor-active-floorplans":{default:["literal",[]]},"mbx-indoor-underground":{default:["literal",!1]},"mbx-indoor-loaded-levels":{default:["literal",[]]},"mbx-indoor-level-height":{default:["literal",{}]},"mbx-indoor-level-base":{default:["literal",{}]},"mbx-indoor-level-selected":{default:["literal",{}]},"mbx-indoor-level-overlapped":{default:["literal",{}]}};function hr(e){return e=e||{},Object.assign(e,ur)}class dr extends e.E{constructor(t){super(),this.mergeFloors=!0,this._scope=void 0,this._queryFeatureSetId=void 0,this._buildingEntryFeatureSetId=void 0,this._selectedFloorplan=void 0,this._indoorData=void 0,this._selectedLevel=void 0,this._floorplanStates={},e.aQ(["_onLoad","_onMove","_checkFloorplanVisible"],this),this._map=t,this._checkFloorplanVisible(!0),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=void 0}_onLoad(){this._map.style.forEachFragmentStyle((t=>{t.stylesheet.indoor&&(this._queryFeatureSetId?this.fire(new e.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._queryFeatureSetId=t.stylesheet.indoor.floorplanFeaturesetId,this._buildingEntryFeatureSetId=t.stylesheet.indoor.buildingFeaturesetId,this._scope=t.scope))})),this._queryFeatureSetId&&this._buildingEntryFeatureSetId&&this._map.addInteraction("mbx-indoor-buildingclick",{type:"click",target:{featuresetId:this._buildingEntryFeatureSetId,importId:this._scope},handler:e=>(e.feature&&e.feature.properties.floorplan&&this.selectFloorplan(e.feature.properties.floorplan),!0)}),this._checkFloorplanVisible(!0)}_onMove(){this._checkFloorplanVisible(!1)}_checkFloorplanVisible(t){if(!this._queryFeatureSetId)return;if(!this._map.isStyleLoaded())return;if(this._map.transform.zoom<13)return;this._indoorData&&!function(e,t){const[i,r]=e,{center:n,radius:o}=t,[s,a]=n,l=Math.abs(i-s);return Math.sqrt((l>180?360-l:l)**2+(r-a)**2)<=o}([this._map.getCenter().lng,this._map.getCenter().lat],this._indoorData.circumCircle)&&(this._indoorData=void 0,this._selectedFloorplan=void 0,this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",["literal",[]]),this.fire(new e.A("floorplangone")));const i={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},r=new e.P(this._map.transform.width/2,this._map.transform.height/2),n=[new e.P(0,0),new e.P(this._map.transform.width,this._map.transform.height)],o=this._map.queryRenderedFeatures(t?n:r,i);o.length>0&&(this._selectedFloorplan&&o[0].properties.id===this._selectedFloorplan.properties.id||(this._selectedFloorplan=o[0],this._floorplanSelected(!1)))}_floorplanSelected(t){this._indoorData=JSON.parse(this._selectedFloorplan.properties["indoor-data"]),this._indoorData.id=this._selectedFloorplan.properties.id,this._indoorData.circumCircle=function(e){const[[t,i],[r,n]]=e,o=(r-t+360)%360,s=o>180?360-o:o;return{center:[(t+s/2+360)%360,(i+n)/2],radius:Math.sqrt(s**2+(n-i)**2)/2}}(this._indoorData.extent),this._floorplanStates[this._indoorData.id]||(this._floorplanStates[this._indoorData.id]={});const i=this._floorplanStates[this._indoorData.id].selectedBuilding,r=this._floorplanStates[this._indoorData.id].selectedLevel;let n;if(this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",this._indoorData.floorplanIDs),this._selectedLevel)for(const e of this._indoorData.levels)e.id===this._selectedLevel.id&&(n=e.id);if(this.fire(new e.A("floorplanselected",{buildings:this._indoorData.buildings,levels:this._indoorData.levels,selectedLevelId:n})),i){const e=this._indoorData.buildings.find((e=>e.id===i));this._buildingSelected(e,!1)}else this._indoorData.buildings.length>0&&this._buildingSelected(this._indoorData.buildings[0],!1);if(r){const e=this._indoorData.levels.find((e=>e.id===r));this._updateLevels(e,t)}else t&&this._indoorData["default-levels"].length>0&&this.selectLevel(this._indoorData["default-levels"][0])}_buildingSelected(t,i){i&&t&&t.extent&&this._map.fitBounds(t.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),this._floorplanStates[this._indoorData.id].selectedBuilding=t?t.id:void 0;const r=this._indoorData.levels.filter((e=>t.levels.includes(e.id)));this.fire(new e.A("buildingselected",{buildingId:t.id,levels:r}))}_levelSelected(t){if("overview"===t)this._updateLevels(void 0,!0);else{const e=this._indoorData.levels.find((e=>e.id===t));this._updateLevels(e,!0)}this.fire(new e.A("levelselected",{levelId:"overview"===t?void 0:t}))}_updateLevels(e,t){if(!e)return this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",[]]),this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._floorplanStates[this._indoorData.id].selectedLevel=void 0,void(t&&this._indoorData.extent&&this._map.fitBounds(this._indoorData.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}));function i(e){const t=e.indexOf("/floor/");if(-1===t)return e;const i=t+7,r=e.indexOf("/",i);return-1===r?e.slice(i):e.slice(i,r)}this._selectedLevel=e,this._floorplanStates[this._indoorData.id].selectedLevel=e?e.id:void 0;const r=[],n={},o={},s={},a={};for(const t of this._indoorData.levels)if(r.push(t.id),n[t.id]=t.height,o[t.id]=t.base,e){if(this.mergeFloors){const r=i(e.id),n=i(t.id);s[t.id]=n===r?"true":"false"}else s[t.id]=t.id===e.id?"true":"false";a[t.id]=t.base=1?{pitch:this._map.getPitch(),bearing:this._map.getBearing()}:{pitch:this._map.getPitch(),bearing:this._map.getBearing(),zoom:i})}}selectFloorplan(t){const i={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},r=[new e.P(0,0),new e.P(this._map.transform.width,this._map.transform.height)],n=this._map.queryRenderedFeatures(r,i);if(n.length>0)for(const e of n)if(JSON.parse(e.properties["indoor-data"]).floorplanIDs.includes(t)){this._selectedFloorplan=e,this._floorplanSelected(!0);break}}selectBuilding(e){const t=this._indoorData.buildings.find((t=>t.id===e));this._buildingSelected(t,!0)}selectLevel(e){this._levelSelected(e)}}function pr(t){if(!t.metadata||!t.metadata.content_area)return;const i=e.q.devicePixelRatio,{left:r,top:n,width:o,height:s}=t.metadata.content_area,a=r*i,l=n*i;return[a,l,a+o*i,l+s*i]}function fr(t){if(t)return t.map((([t,i])=>[t*e.q.devicePixelRatio,i*e.q.devicePixelRatio]))}class Ar{constructor(e,t,i){this.id=e,this.scope=t,this.sourceCache=i,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(e){this.missingRequests.has(e.name)||this.pendingRequests.has(e.name)||this.pendingRequests.add(e.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const i=this.sourceCache.getVisibleCoordinates();if(0===i.length)return t;const r=this.sourceCache.getSource();if(!(r instanceof rt))return t;const n=i.map((e=>this.sourceCache.getTile(e))),o=r.getImages(n,Array.from(this.pendingRequests));for(const[i,r]of o)t.set(e.I.from({name:i,iconsetId:this.id}),r),this.pendingRequests.delete(i);for(const e of this.pendingRequests)this.missingRequests.add(e);return this.pendingRequests.clear(),t}}const mr=(e,t)=>Ie(e,t&&t.filter((e=>"source.canvas"!==e.identifier))),gr=e.aA(Lt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),_r=e.aA(Lt,["setCenter","setZoom","setBearing","setPitch"]),yr=new Set(["background","sky","slot","custom"]),vr={version:8,layers:[],sources:{}},xr={duration:300,delay:0};class br extends e.E{constructor(t,i={}){super(),this.map=t,this.scope=i.scope||"",this.globalId=null,this.fragments=[],this.importDepth=i.importDepth||0,this.importsCache=i.importsCache||new Map,this.resolvedImports=i.resolvedImports||new Set,this.transition=e.l({},xr),this._buildingIndex=new Mt(this),this.crossTileSymbolIndex=new zi,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=i.styleChanges||new j,this.dispatcher=i.dispatcher?i.dispatcher:new e.D(e.cj(),this),i.imageManager?this.imageManager=i.imageManager:(this.imageManager=new H(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=i.glyphManager?i.glyphManager:new e.ck(t._requestManager,i.localFontFamily?e.cl.all:i.localIdeographFontFamily?e.cl.ideographs:e.cl.none,i.localFontFamily||i.localIdeographFontFamily),i.modelManager?this.modelManager=i.modelManager:(this.modelManager=new lr(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this.options=i.configOptions?i.configOptions:new Map,this._configDependentLayers=i.configDependentLayers?i.configDependentLayers:new Set,this._config=i.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:i.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=i.initialConfig,this.dispatcher.broadcast("setReferrer",e.cm());const r=this;this._rtlTextPluginCallback=br.registerForPluginStateChange((t=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},((t,i)=>{if(e.cn(t),i&&i.every((e=>e)))for(const e in r._sourceCaches){const t=r._sourceCaches[e],i=t.getSource().type;"vector"!==i&&"geojson"!==i||t.reload()}}))})),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getOwnSource(e.sourceId);if(t&&t.vectorLayerIds)for(const e in this._layers){const i=this._layers[e];i.source===t.id&&this._validateLayer(i)}}))}load(e){return e?("string"==typeof e?this.loadURL(e):this.loadJSON(e),this):this}_getGlobalId(t){if(!t)return null;if("string"==typeof t){if(e.f(t))return t;const i=e.co(t);if(!i.startsWith("http"))try{return new URL(i,location.href).toString()}catch(e){return i}return i}return`json://${e.cp(JSON.stringify(t))}`}_diffStyle(t,i,r){this.globalId=this._getGlobalId(t);const n=(e,t)=>{try{t(null,this.setState(e,r))}catch(e){t(e,!1)}};if("string"==typeof t){const r=this.map._requestManager.normalizeStyleURL(t),o=this.map._requestManager.transformRequest(r,e.R.Style);e.n(o,((t,r)=>{t?this.fire(new e.z(t)):r&&n(r,i)}))}else"object"==typeof t&&n(t,i)}loadURL(t,i={}){this.fire(new e.A("dataloading",{dataType:"style"}));const r="boolean"==typeof i.validate?i.validate:!e.f(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,i.accessToken),this.resolvedImports.add(t);const n=this.importsCache.get(t);if(n)return this._load(n,r);const o=this.map._requestManager.transformRequest(t,e.R.Style);this._request=e.n(o,((i,n)=>{if(this._request=null,i)this.fire(new e.z(i));else if(n)return this.importsCache.set(t,n),this._load(n,r)}))}loadJSON(t,i={}){this.fire(new e.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=e.q.frame((()=>{this._request=null,this._load(t,!1!==i.validate)}))}loadEmpty(){this.fire(new e.A("dataloading",{dataType:"style"})),this._load(vr,!1)}_loadImports(t,i,r){if(this.importDepth>=4)return e.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const n=[];for(const e of t){const t=this._createFragmentStyle(e),o=new Promise((e=>{t.once("style.import.load",e),t.once("error",e)})).then((()=>this.mergeAll()));if(n.push(o),this.resolvedImports.has(e.url)){t.loadEmpty();continue}const s=e.data||this.importsCache.get(e.url);s?(t.loadJSON(s,{validate:i}),this._isInternalStyle(s)&&(t.globalId=null)):e.url?t.loadURL(e.url,{validate:i}):t.loadEmpty();const a={style:t,id:e.id,config:e.config};if(r){const e=this.fragments.findIndex((({id:e})=>e===r));this.fragments=this.fragments.slice(0,e).concat(a).concat(this.fragments.slice(e))}else this.fragments.push(a)}return Promise.allSettled(n)}getImportGlobalIds(e=this,t=new Set){for(const i of e.fragments)i.style.globalId&&t.add(i.style.globalId),this.getImportGlobalIds(i.style,t);return[...t.values()]}_createFragmentStyle(t){const i=this.scope?e.C(t.id,this.scope):t.id;let r;const n=this._initialConfig&&this._initialConfig[i];(t.config||n)&&(r=e.l({},t.config,n));const o=new br(this.map,{scope:i,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:r,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers});return o.setEventedParent(this.map,{style:o}),o}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}_load(t,i){const r=t.indoor?hr(t.schema):t.schema;if(this._isInternalStyle(t)){const r=e.l({},vr,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(r,i)}if(this.updateConfig(this._config,r),i&&mr(this,me(t)))return;this._loaded=!0,this.stylesheet=e.cq(t);const n=()=>{for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const e in t.iconsets)this.addIconset(e,t.iconsets[e]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.setGlyphsUrl(t.glyphs);const r=Pt(this.stylesheet.layers);if(this._order=r.map((e=>e.id)),this.stylesheet.light&&e.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){const e=this.stylesheet.lights[0];this.light=new Le(e.properties,e.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Le(this.stylesheet.light)),this._layers={};for(const t of r){const i=e.cv(t,this.scope,this._styleColorTheme.lut,this.options);0!==i.configDependencies.size&&this._configDependentLayers.add(i.fqid),i.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=i;const r=this.getOwnLayerSourceCache(i),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();r&&i.canCastShadows()&&n&&(r.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const n=this.stylesheet.terrain;n&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(n,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.A("data",{dataType:"style"}));const o=this.isRootStyle();t.imports?this._loadImports(t.imports,i).then((()=>{this._reloadImports(),this.fire(new e.A(o?"style.load":"style.import.load"))})):(this._reloadImports(),this.fire(new e.A(o?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(o){const t=this._evaluateColorThemeData(o);this._loadColorTheme(t).then((()=>{n()})).catch((t=>{e.w(`Couldn't load color theme from the stylesheet: ${t}`),n()}))}else this._styleColorTheme.lut=null,n()}isRootStyle(){return 0===this.importDepth}mergeAll(){let t,i,r,n,o,s,a,l,c,u;const h={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((e=>{if(e.stylesheet){if(null!=e.light&&(t=e.light),e.stylesheet.lights)for(const t of e.stylesheet.lights)"ambient"===t.type&&null!=e.ambientLight&&(i=e.ambientLight),"directional"===t.type&&null!=e.directionalLight&&(r=e.directionalLight);n=this._prioritizeTerrain(n,e.terrain,e.stylesheet.terrain),e.stylesheet.fog&&null!=e.fog&&(o=e.fog),e.stylesheet.snow&&null!=e.snow&&(s=e.snow),e.stylesheet.rain&&null!=e.rain&&(a=e.rain),null!=e.stylesheet.camera&&(u=e.stylesheet.camera),null!=e.stylesheet.projection&&(l=e.stylesheet.projection),null!=e.stylesheet.transition&&(c=e.stylesheet.transition),h[e.scope]=e._styleColorTheme}})),this.light=t,this.ambientLight=i,this.directionalLight=r,this.fog=o,this.snow=s,this.rain=a,this._styleColorThemeForScope=h,null===n?delete this.terrain:this.terrain=n,this.camera=u||{"camera-projection":"perspective"},this.projection=l||{name:"mercator"},this.transition=e.l({},xr,c),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(e){const t=i=>{for(const e of i.fragments)t(e.style);e(i)};t(this)}_prioritizeTerrain(e,t,i){const r=e&&0===e.drapeRenderMode;return null===i?t&&0===t.drapeRenderMode?t:r?e:null:null!=t&&(!e||r||t&&1===t.drapeRenderMode)?t:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((t=>{e=this._prioritizeTerrain(e,t.terrain,t.stylesheet.terrain)})),null===e?delete this.terrain:this.terrain=e}mergeProjection(){let e;this.forEachFragmentStyle((t=>{null!=t.stylesheet.projection&&(e=t.stylesheet.projection)})),this.projection=e||{name:"mercator"}}mergeSources(){const t={},i={},r={};this.forEachFragmentStyle((n=>{for(const i in n._sourceCaches){const r=e.C(i,n.scope);t[r]=n._sourceCaches[i]}for(const t in n._otherSourceCaches){const r=e.C(t,n.scope);i[r]=n._otherSourceCaches[t]}for(const t in n._symbolSourceCaches){const i=e.C(t,n.scope);r[i]=n._symbolSourceCaches[t]}})),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=i,this._mergedSymbolSourceCaches=r}mergeLayers(){const t={},i=[],r={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle((r=>{for(const n of r._order){const o=r._layers[n];if("slot"===o.type){const i=e.cr(n);if(t[i])continue;t[i]=[]}o.slot&&t[o.slot]?t[o.slot].push(o):i.push(o)}})),this._mergedOrder=[];const n=(i=[])=>{for(const o of i)if("slot"===o.type){const i=e.cr(o.id);t[i]&&n(t[i]),this._mergedSlots.push(i)}else{const t=e.C(o.id,o.scope);this._mergedOrder.push(t),r[t]=o,o.is3D(!!this.terrain)&&(this._has3DLayers=!0),"circle"===o.type&&(this._hasCircleLayers=!0),"symbol"===o.type&&(this._hasSymbolLayers=!0),"clip"===o.type&&(this._clipLayerPresent=!0)}};n(i),this._mergedOrder.sort(((e,t)=>{const i=r[e],n=r[t];return i.hasInitialOcclusionOpacityProperties?n.is3D(!!this.terrain)?1:0:i.is3D(!!this.terrain)&&n.hasInitialOcclusionOpacityProperties?-1:0})),this._mergedLayers=r,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=e.l({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(t,i,r){const n=e.l({},i);for(const t of Object.keys(e.a5.colorTheme))void 0===n[t]&&(n[t]=e.a5.colorTheme[t].default);const o=new e.a6(cr,t,new Map(r));return o.setTransitionOrValue(n,r),o.untransitioned().possiblyEvaluate(new e.aa(0))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const i=this._styleColorTheme.lutLoadingCorrelationID;return new Promise(((r,n)=>{const o="data:image/png;base64,";if(!t||0===t.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void r();let s=t;s.startsWith(o)||(s=o+s);const a=e.I.from("mapbox-reserved-lut"),l=new Image;l.src=s,l.onerror=()=>{this._styleColorTheme.lutLoading=!1,n(new Error("Failed to load image data"))},l.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==i)return void r();this._styleColorTheme.lutLoading=!1;const{width:o,height:s,data:c}=e.q.getImageData(l);if(s>32)return void n(new Error("The height of the image must be less than or equal to 32 pixels."));if(o!==s*s)return void n(new Error("The width of the image must be equal to the height squared."));this.getImage(a,this.scope)&&this.removeImage(a,this.scope),this.addImage(a,this.scope,{data:new e.r({width:o,height:s},c),pixelRatio:1,sdf:!1,usvg:!1,version:0});const u=this.imageManager.getImage(a,this.scope);u?(this._styleColorTheme.lut={image:u.data,data:t},r()):n(new Error("Missing LUT image."))}}))}getLut(e){const t=this._styleColorThemeForScope[e];return t?t.lut:null}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(t,i,r){let n,o,s;const a=e.q.devicePixelRatio>1?"@2x":"";let l=e.n(i.transformRequest(i.normalizeSpriteURL(t,a,".json"),e.R.SpriteJSON),((e,t)=>{l=null,s||(s=e,n=t,u())})),c=e.o(i.transformRequest(i.normalizeSpriteURL(t,a,".png"),e.R.SpriteImage),((e,t)=>{c=null,s||(s=e,o=t,u())}));function u(){if(s)r(s);else if(n&&o){const t=e.q.getImageData(o),i={};for(const r in n){const{width:o,height:s,x:a,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p}=n[r],f=new e.r({width:o,height:s});e.r.copy(t,f,{x:a,y:l},{x:0,y:0},{width:o,height:s},null),i[r]={data:f,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p,usvg:!1}}r(null,i)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(t,this.map._requestManager,((t,i)=>{if(this._spriteRequest=null,t)this.fire(new e.z(t));else if(i){const t=new Map;for(const r in i)t.set(e.I.from(r),i[r]);this.addImages(t,this.scope)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.A("data",{dataType:"style"}))}))}addIconset(t,i){if("sprite"===i.type)return void this._loadSprite(i.url);const r=this.getOwnSourceCache(i.source);if(!r)return void this.fire(new e.z(new Error(`Source "${i.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const n=r.getSource();if("raster-array"!==n.type)return void this.fire(new e.z(new Error(`Source "${i.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));n.partial=!1;const o=new Ar(t,this.scope,r);this.imageManager.addImageProvider(o,this.scope)}removeIconset(e){this.imageManager.removeImageProvider(e,this.scope)}_loadIconset(t){if(!e.f(t)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(t);const i="auto"===this.map._spriteFormat;var r,n;this._spriteRequest=(n=(r,n)=>{if(this._spriteRequest=null,r)i?this._loadSprite(t):this.fire(new e.z(r));else if(n){const t=new Map;for(const i in n)t.set(e.I.from(i),n[i]);this.addImages(t,this.scope)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.A("data",{dataType:"style"}))},e.bj((r=this.map._requestManager).transformRequest(r.normalizeIconsetURL(t),e.R.Iconset),((t,i)=>{if(t)return void n(t);const r={},o=e.ch(new e.bi(i));for(const t of o.icons){const i={version:1,pixelRatio:e.q.devicePixelRatio,content:pr(t),stretchX:t.metadata?fr(t.metadata.stretch_x_areas):void 0,stretchY:t.metadata?fr(t.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:t};r[t.name]=i}n(null,r)})))}_validateLayer(t){const i=this.getOwnSource(t.source);if(!i)return;const r=t.sourceLayer;r&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new e.z(new Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded())return!1;if(this.imageManager.hasPatternsInFlight())return!1;if(!this.modelManager.isLoaded())return!1;if(this._styleColorTheme.lutLoading)return!1;for(const{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map(((e,t)=>{const i=this.fragments[t];return i&&i.style&&(e.data=i.style.serialize()),e}))}_serializeSources(){const e={};for(const t in this._sourceCaches){const i=this._sourceCaches[t].getSource();e[i.id]||(e[i.id]=i.serialize())}return e}_serializeLayers(e){const t=[];for(const i of e){const e=this._layers[i];e&&"custom"!==e.type&&t.push(e.serialize())}return t}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions())return!0;if(this.hasFogTransition())return!0;if(this.hasSnowTransition())return!0;if(this.hasRainTransition())return!0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(e){return e?this.order:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const i=this.getOwnLayer(t);if(i)return i;this.fire(new e.z(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const i=this.getOwnSource(t);if(i)return i;this.fire(new e.z(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(e,t){const i=this.map.painter;if(i)for(let r=e.minzoom||0;r<(e.maxzoom||25.5);r++){const r=e.getProgramIds();if(r)for(const n of r){const r=e.getDefaultProgramParams(n,t.zoom,this._styleColorTheme.lut);r&&(i.style=this,this.fog&&(i._fogVisible=!0,r.overrideFog=!0,i.getOrCreateProgram(n,r)),i._fogVisible=!1,r.overrideFog=!1,i.getOrCreateProgram(n,r),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(r.overrideRtt=!0,i.getOrCreateProgram(n,r)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const i=this.calculateLightsBrightness();t.brightness=i||0,i!==this._brightness&&(this._brightness=i,this.dispatcher.broadcast("setBrightness",i));const r=this._changes.isDirty();let n=!1;if(this._changes.isDirty()){const e=this._changes.getLayerUpdatesByScope();for(const t in e){const{updatedIds:i,removedIds:r}=e[t];(i||r)&&(this._updateWorkerLayers(t,i,r),n=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const o={};for(const e in this._mergedSourceCaches){const t=this._mergedSourceCaches[e];o[e]=t.used,t.used=!1,t.tileCoverLift=0}for(const e of this._mergedOrder){const i=this._mergedLayers[e];if(i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)){const e=this.getLayerSourceCache(i);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,i.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback((()=>{this.precompilePrograms(i,t)})):this.precompilePrograms(i,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&n&&this.mergeLayers();const s=this.imageManager.getPendingImageProviders();for(const e of s)e.sourceCache.used=!0;for(const t in o){const i=this._mergedSourceCaches[t];o[t]!==i.used&&i.getSource().fire(new e.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:i.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),r&&this.fire(new e.A("data",{dataType:"style"}))}updateImageProviders(){const e=this.imageManager.getPendingImageProviders();for(const t of e){const e=t.resolvePendingRequests();this.addImages(e,t.scope)}}_updateTilesForChangedImages(){const e={};for(const t in this._mergedSourceCaches){const i=this._mergedSourceCaches[t].getSource().scope;e[i]=e[i]||this._changes.getUpdatedImages(i),0!==e[i].length&&this._mergedSourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e[i])}for(const t in e)this._changes.resetUpdatedImages(t)}_updateWorkerLayers(e,t,i){const r=this.getFragmentStyle(e);r&&this.dispatcher.broadcast("updateLayers",{layers:t?r._serializeLayers(t):[],scope:e,removedIds:i||[],options:r.options})}setState(t,i){if(this._checkLoaded(),mr(this,me(t)))return!1;(t=e.cq(t)).layers=Pt(t.layers);const r=function(t,i){if(!t)return[{command:Lt.setStyle,args:[i]}];let r=[];try{if(!e.bn(t.version,i.version))return[{command:Lt.setStyle,args:[i]}];if(e.bn(t.center,i.center)||r.push({command:Lt.setCenter,args:[i.center]}),e.bn(t.zoom,i.zoom)||r.push({command:Lt.setZoom,args:[i.zoom]}),e.bn(t.bearing,i.bearing)||r.push({command:Lt.setBearing,args:[i.bearing]}),e.bn(t.pitch,i.pitch)||r.push({command:Lt.setPitch,args:[i.pitch]}),e.bn(t.sprite,i.sprite)||r.push({command:Lt.setSprite,args:[i.sprite]}),e.bn(t.glyphs,i.glyphs)||r.push({command:Lt.setGlyphs,args:[i.glyphs]}),e.bn(t.imports,i.imports)||function(t=[],i=[],r){i=i||[];const n=(t=t||[]).map(Ot),o=i.map(Ot),s=t.reduce(Ut,{}),a=i.reduce(Ut,{}),l=n.slice();let c,u,h,d;for(c=0,u=0;c{e.source&&n[e.source]?r.push({command:Lt.removeLayer,args:[e.id]}):s.push(e)}));let a=t.terrain;a&&n[a.source]&&(r.push({command:Lt.setTerrain,args:[void 0]}),a=void 0),r=r.concat(o),e.bn(a,i.terrain)||r.push({command:Lt.setTerrain,args:[i.terrain]}),function(t,i,r){i=i||[];const n=(t=t||[]).map(Ot),o=i.map(Ot),s=t.reduce(Ut,{}),a=i.reduce(Ut,{}),l=n.slice(),c=Object.create(null);let u,h,d,p,f,A,m;for(u=0,h=0;u!(e.command in _r)));if(0===r.length)return!1;const n=r.filter((e=>!(e.command in gr)));if(n.length>0)throw new Error(`Unimplemented: ${n.map((e=>e.command)).join(", ")}.`);const o=[];return r.forEach((e=>{o.push(this[e.command].apply(this,e.args))})),i&&Promise.all(o).then(i),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(e){const t=this.getFragmentStyle(e);t&&(t._availableImages=t.imageManager.listImages(e),t.dispatcher.broadcast("setImages",{scope:e,images:t._availableImages}))}addImages(t,i){for(const[r,n]of t.entries()){if(this.getImage(r,i))return this.fire(new e.z(new Error(`An image with the name "${r.name}" already exists.`)));this.imageManager.addImage(r,i,n),this._changes.updateImage(r,i)}return this._updateWorkerImages(i),this.fire(new e.A("data",{dataType:"style"})),this}addImage(t,i,r){return this.getImage(t,i)?this.fire(new e.z(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,i,r),this._changes.updateImage(t,i),this._updateWorkerImages(i),this.fire(new e.A("data",{dataType:"style"})),this)}updateImage(t,i,r,n=!1){this.imageManager.updateImage(t,i,r),n&&(this._changes.updateImage(t,i),this._updateWorkerImages(i),this.fire(new e.A("data",{dataType:"style"})))}getImage(e,t){return this.imageManager.getImage(e,t)}removeImage(t,i){return this.getImage(t,i)?(this.imageManager.removeImage(t,i),this._changes.updateImage(t,i),this._updateWorkerImages(i),this.fire(new e.A("data",{dataType:"style"})),this):this.fire(new e.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(e,t,i={}){return this._checkLoaded(),this._validate(Ee,`models.${e}`,t,null,i)||(this.modelManager.addModel(e,t,this.scope),this._changes.setDirty()),this}hasModel(e){return this.modelManager.hasModel(e,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope),this):this.fire(new e.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,i,r={}){if(this._checkLoaded(),void 0!==this.getOwnSource(t))throw new Error(`There is already a source with ID "${t}".`);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(ge,`sources.${t}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=ot(t,i,this.dispatcher,this);n.scope=this.scope,n.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(n.id),source:n.serialize(),sourceId:n.id})));const o=t=>{const i=(t?"symbol:":"other:")+n.id,r=e.C(i,this.scope),o=this._sourceCaches[i]=new Bt(r,n,t);(t?this._symbolSourceCaches:this._otherSourceCaches)[n.id]=o,o.onAdd(this.map)};o(!1),"vector"!==i.type&&"geojson"!==i.type||o(!0),n.onAdd&&n.onAdd(this.map),r.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const i=this.getOwnSource(t);if(!i)throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.z(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new e.z(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const i=Object.entries(this.stylesheet.iconsets).find((([e,i])=>"source"===i.type&&i.source===t));if(i)return this.fire(new e.z(new Error(`Source "${t}" cannot be removed while iconset "${i[0]}" is using it.`)))}const r=this.getOwnSourceCaches(t);for(const t of r){const i=e.cr(t.id);delete this._sourceCaches[i],this._changes.discardSourceCacheUpdate(t.id),t.fire(new e.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:t.getSource().id})),t.setEventedParent(null),t.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getOwnSource(e).setData(t),this._changes.setDirty()}getOwnSource(e){const t=this.getOwnSourceCache(e);return t&&t.getSource()}getOwnSources(){const e=[];for(const t in this._otherSourceCaches){const i=this.getOwnSourceCache(t);i&&e.push(i.getSource())}return e}areTilesLoaded(){const e=this._mergedSourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const i=this._getTransitionParameters();for(const r of t){if(this._validate(ye,"lights",r))return;switch(r.type){case"ambient":if(this.ambientLight){const e=this.ambientLight;e.set(r),e.updateTransitions(i)}else this.ambientLight=new qe(r,He||(He=new e.a7({color:new e.a8(e.a5.properties_light_ambient.color),"color-use-theme":new e.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.a8(e.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const e=this.directionalLight;e.set(r),e.updateTransitions(i)}else this.directionalLight=new qe(r,Ge||(Ge=new e.a7({direction:new e.am(e.a5.properties_light_directional.direction),color:new e.a8(e.a5.properties_light_directional.color),"color-use-theme":new e.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.a8(e.a5.properties_light_directional.intensity),"cast-shadows":new e.a8(e.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new e.a8(e.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new e.a8(e.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const r=new e.aa(this.z||0,i);this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,i=this.ambientLight;if(!t||!i)return;const r=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),n=t.properties.get("color").toRenderColor(null).toArray01(),o=t.properties.get("intensity"),s=t.properties.get("direction"),a=1-e.cc(s.x,s.y,s.z)[2]/90,l=r(n)*o*a,c=i.properties.get("color").toRenderColor(null).toArray01(),u=i.properties.get("intensity"),h=r(c)*u;return Number(((l+h)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(!t)return this;if(e.cs(t)){const i=e.ct(t),r=this.fragments.find((({id:e})=>e===i));if(!r)throw new Error(`Style import '${t}' not found`);const n=e.cr(t);return r.style.getFragmentStyle(n)}{const e=this.fragments.find((({id:e})=>e===t));return e?e.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const i={},r=(e,t="")=>`${e}::${t}`;this._featuresetSelectors={};for(const n in t){const o=this._featuresetSelectors[n]=[];for(const s of t[n].selectors){if(s.featureNamespace){const t=this.getOwnLayer(s.layer);if(!t){e.w(`Layer is undefined for selector: ${s.layer}`);continue}const o=r(t.source,t.sourceLayer);if(o in i&&i[o]!==s.featureNamespace){e.w(`"featureNamespace ${s.featureNamespace} of featureset ${n}'s selector is not associated to the same source, skip this selector`);continue}i[o]=s.featureNamespace}let t;if(s.properties)for(const i in s.properties){const r=e.X(s.properties[i]);"success"===r.result&&(t=t||{},t[i]=r.value)}o.push({layerId:s.layer,namespace:s.featureNamespace,properties:t,uniqueFeatureID:s._uniqueFeatureID})}}}getFeaturesetDescriptors(e){const t=this.getFragmentStyle(e);if(!t||!t.stylesheet.featuresets)return[];const i=[];for(const e in t.stylesheet.featuresets)i.push({featuresetId:e,importId:t.scope?t.scope:void 0});return i}getFeaturesetLayers(t,i){const r=this.getFragmentStyle(i),n=r.stylesheet.featuresets;if(!n||!n[t])return this.fire(new e.z(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const o=[];for(const e of n[t].selectors){const t=r.getOwnLayer(e.layer);t&&o.push(t)}return o}getConfigProperty(t,i){const r=this.getFragmentStyle(t);if(!r)return null;const n=e.C(i,r.scope),o=r.options.get(n),s=o?o.value||o.default:null;return s?s.serialize():null}setConfigProperty(t,i,r){const n=this.getFragmentStyle(t);if(!n)return;const o=n.stylesheet.indoor?hr(n.stylesheet.schema):n.stylesheet.schema;if(!o||!o[i])return;const s=e.X(r);if("success"!==s.result)return void mr(this,s.value);const a=s.value.expression,l=e.C(i,n.scope),c=n.options.get(l);if(!c)return;let u;const{minValue:h,maxValue:d,stepValue:p,type:f,values:A}=o[i],m=e.X(o[i].default);"success"===m.result&&(u=m.value.expression),u?(this.options.set(l,Object.assign({},c,{value:a,default:u,minValue:h,maxValue:d,stepValue:p,type:f,values:A})),this.updateConfigDependencies(i)):this.fire(new e.z(new Error(`No schema defined for the config option "${i}" in the "${t}" fragment.`)))}getConfig(t){const i=this.getFragmentStyle(t);if(!i)return null;const r=i.stylesheet.schema;if(!r)return null;const n={};for(const t in r){const r=e.C(t,i.scope),o=i.options.get(r),s=o?o.value||o.default:null;n[t]=s?s.serialize():null}return n}setConfig(e,t){const i=this.getFragmentStyle(e);i&&(i.updateConfig(t,i.stylesheet.schema),this.updateConfigDependencies())}getSchema(e){const t=this.getFragmentStyle(e);return t?t.stylesheet.schema:null}setSchema(e,t){const i=this.getFragmentStyle(e);i&&(i.stylesheet.schema=t,i.updateConfig(i._config,t),this.updateConfigDependencies())}updateConfig(t,i){if(this._config=t,t||i)if(i)for(const r in i){let n,o;const s=e.X(i[r].default);if("success"===s.result&&(n=s.value.expression),t&&void 0!==t[r]){const i=e.X(t[r]);"success"===i.result&&(o=i.value.expression)}const{minValue:a,maxValue:l,stepValue:c,type:u,values:h}=i[r];if(n){const t=e.C(r,this.scope);this.options.set(t,{default:n,value:o,minValue:a,maxValue:l,stepValue:c,type:u,values:h})}else this.fire(new e.z(new Error(`No schema defined for config option "${r}".`)))}else this.fire(new e.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(e){for(const t of this._configDependentLayers){const i=this.getLayer(t);if(i){if(e&&!i.configDependencies.has(e))continue;i.possiblyEvaluateVisibility(),this._updateLayer(i)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle((e=>{const t=e._styleColorTheme.colorThemeOverride?e._styleColorTheme.colorThemeOverride:e._styleColorTheme.colorTheme;if(t){const i=e._evaluateColorThemeData(t);(!e._styleColorTheme.lut&&""!==i||e._styleColorTheme.lut&&i!==e._styleColorTheme.lut.data)&&e.setColorTheme(t)}})),this._changes.setDirty()}addLayer(t,i,r={}){this._checkLoaded();const n=t.id;if(this._layers[n])return void this.fire(new e.z(new Error(`Layer with id "${n}" already exists on this map`)));let o;if("custom"===t.type){if(mr(this,e.cu(t)))return;o=e.cv(t,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof t.source&&(this.addSource(n,t.source),t=e.cq(t),t=e.l(t,{source:n})),this._validate(Te,`layers.${n}`,t,{arrayIndex:-1},r))return;o=e.cv(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid);let s=this._order.length;if(i){const t=this._order.indexOf(i);if(-1===t)return void this.fire(new e.z(new Error(`Layer with id "${i}" does not exist on this map.`)));o.slot===this._layers[i].slot?s=t:e.w(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=o;const a=this.getOwnLayerSourceCache(o),l=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&o.canCastShadows()&&l&&(a.castsShadows=!0);const c=this._changes.getRemovedLayer(o);if(c&&o.source&&a&&"custom"!==o.type){this._changes.discardLayerRemoval(o);const t=e.C(o.source,o.scope);c.type!==o.type?this._changes.updateSourceCache(t,"clear"):(this._changes.updateSourceCache(t,"reload"),a.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),o.scope=this.scope,this.mergeLayers()}moveLayer(t,i){this._checkLoaded();const r=this._checkLayer(t);if(!r)return;if(t===i)return;const n=this._order.indexOf(t);this._order.splice(n,1);let o=this._order.length;if(i){const t=this._order.indexOf(i);if(-1===t)return void this.fire(new e.z(new Error(`Layer with id "${i}" does not exist on this map.`)));r.slot===this._layers[i].slot?o=t:e.w(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(o,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(e){this._checkLoaded();const t=this._checkLayer(e);if(!t)return;t.setEventedParent(null);const i=this._order.indexOf(e);this._order.splice(i,1),delete this._layers[e],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(t.fqid),this._changes.removeLayer(t);const r=this.getOwnLayerSourceCache(t);if(r&&r.castsShadows){let e=!1;for(const i in this._layers)if(this._layers[i].source===t.source&&this._layers[i].canCastShadows()){e=!0;break}r.castsShadows=e}t.onRemove&&t.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(e,t,i){this._checkLoaded();const r=this._checkLayer(e);r&&(r.minzoom===t&&r.maxzoom===i||(null!=t&&(r.minzoom=t),null!=i&&(r.maxzoom=i),this._updateLayer(r)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(e,t){this._checkLoaded();const i=this._checkLayer(e);i&&i.slot!==t&&(i.slot=t,this._updateLayer(i))}setFilter(t,i,r={}){this._checkLoaded();const n=this._checkLayer(t);if(n&&!e.bn(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(Be,`layers.${n.id}.filter`,i,{layerType:n.type},r)||(n.filter=e.cq(i),this._updateLayer(n)))}getFilter(t){const i=this._checkLayer(t);if(i)return e.cq(i.filter)}setLayoutProperty(t,i,r,n={}){this._checkLoaded();const o=this._checkLayer(t);if(o&&!e.bn(o.getLayoutProperty(i),r)){if(null!=r&&(!n||!1!==n.validate)&&mr(o,Se.call(me,{key:`layers.${t}.layout.${i}`,layerType:o.type,objectKey:i,value:r,styleSpec:e.a5,style:{glyphs:!0,sprite:!0}})))return;o.setLayoutProperty(i,r),0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),this._updateLayer(o)}}getLayoutProperty(e,t){const i=this._checkLayer(e);if(i)return i.getLayoutProperty(t)}setPaintProperty(t,i,r,n={}){this._checkLoaded();const o=this._checkLayer(t);if(!o)return;if(e.bn(o.getPaintProperty(i),r))return;if(null!=r&&(!n||!1!==n.validate)&&mr(o,Ce.call(me,{key:`layers.${t}.paint.${i}`,layerType:o.type,objectKey:i,value:r,styleSpec:e.a5})))return;const s=o.setPaintProperty(i,r);0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),s&&this._updateLayer(o),this._changes.updatePaintProperties(o)}getPaintProperty(e,t){const i=this._checkLayer(e);if(i)return i.getPaintProperty(t)}setFeatureState(t,i){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:e,importId:r}=t.target,n=this.getFragmentStyle(r),o=n.getFeaturesetLayers(e);for(const{source:e,sourceLayer:r}of o)n.setFeatureState({id:t.id,source:e,sourceLayer:r},i)}else if("layerId"in t.target){const{layerId:e}=t.target,r=this.getLayer(e);this.setFeatureState({id:t.id,source:r.source,sourceLayer:r.sourceLayer},i)}return}const r=t.source,n=t.sourceLayer,o=this._checkSource(r);if(!o)return;const s=o.type;if("geojson"===s&&n)return void this.fire(new e.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!n)return void this.fire(new e.z(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===t.id&&this.fire(new e.z(new Error("The feature id parameter must be provided.")));const a=this.getOwnSourceCaches(r);for(const e of a)e.setFeatureState(n,t.id,i)}removeFeatureState(t,i){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:e,importId:r}=t.target,n=this.getFragmentStyle(r),o=n.getFeaturesetLayers(e);for(const{source:e,sourceLayer:r}of o)n.removeFeatureState({id:t.id,source:e,sourceLayer:r},i)}else if("layerId"in t.target){const{layerId:e}=t.target,r=this.getLayer(e);this.removeFeatureState({id:t.id,source:r.source,sourceLayer:r.sourceLayer},i)}return}const r=t.source,n=this._checkSource(r);if(!n)return;const o=n.type,s="vector"===o?t.sourceLayer:void 0;if("vector"===o&&!s)return void this.fire(new e.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(i&&"string"!=typeof t.id&&"number"!=typeof t.id)return void this.fire(new e.z(new Error("A feature id is required to remove its specific state property.")));const a=this.getOwnSourceCaches(r);for(const e of a)e.removeFeatureState(s,t.id,i)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let i;if("featuresetId"in t.target){const{featuresetId:r,importId:n}=t.target,o=this.getFragmentStyle(n),s=o.getFeaturesetLayers(r);for(const{source:r,sourceLayer:n}of s){const s=o.getFeatureState({id:t.id,source:r,sourceLayer:n});if(s&&!i)i=s;else if(!e.bn(i,s))return void this.fire(new e.z(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:e}=t.target,r=this.getLayer(e);i=this.getFeatureState({id:t.id,source:r.source,sourceLayer:r.sourceLayer})}return i}const i=t.source,r=t.sourceLayer,n=this._checkSource(i);if(n){if("vector"!==n.type||r)return void 0===t.id&&this.fire(new e.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(i)[0].getFeatureState(r,t.id);this.fire(new e.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=e.l({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return e.l({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),i=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return e.cw({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:i,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},(e=>void 0!==e))}_updateFilteredLayers(e){for(const t of Object.values(this._mergedLayers))e(t)&&this._updateLayer(t)}_updateLayer(t){this._changes.updateLayer(t);const i=this.getLayerSourceCache(t),r=e.C(t.source,t.scope),n=this._changes.getUpdatedSourceCaches();t.source&&!n[r]&&i&&"raster"!==i.getSource().type&&(this._changes.updateSourceCache(r,"reload"),i.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>this._mergedLayers[e].is3D(!!this.terrain),i=this.order,r={},n=[];for(let o=i.length-1;o>=0;o--){const s=i[o];if(t(s)){r[s]=o;for(const t of e){const e=t[s];if(e)for(const t of e)n.push(t)}}}n.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const o=[];for(let s=i.length-1;s>=0;s--){const a=i[s];if(t(a))for(let e=n.length-1;e>=0;e--){const t=n[e].feature;if(t.layer&&r[t.layer.id]{if(yr.has(e.type))return;const t=this.getOwnLayerSourceCache(e),i=o[t.id]=o[t.id]||{sourceCache:t,layers:{},has3DLayers:!1};e.is3D(!!this.terrain)&&(i.has3DLayers=!0),i.layers[e.fqid]=i.layers[e.fqid]||{styleLayer:e,targets:[]},i.layers[e.fqid].targets.push({filter:n})};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new e.z(new Error("parameters.layers must be an Array."))),[];for(const t of i.layers){const i=this._layers[t];if(!i)return this.fire(new e.z(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];s(i)}}else for(const e in this._layers)s(this._layers[e]);const a=this._queryRenderedFeatures(t,o,r),l=this._flattenAndSortRenderedFeatures(a),c=[];for(const t of l)e.ct(t.layer.id)===this.scope&&c.push(t);return c}queryRenderedFeatureset(t,i,r){let n;i&&!Array.isArray(i)&&i.filter&&(this._validate(Be,"queryRenderedFeatures.filter",i.filter,null,i),n=e.a_(i.filter));const o="mock",s=[];if(i&&i.target)s.push(Object.assign({},i,{targetId:o,filter:n}));else{const e=this.getFeaturesetDescriptors();for(const t of e)s.push({targetId:o,filter:n,target:t});for(const{style:e}of this.fragments){const t=e.getFeaturesetDescriptors();for(const e of t)s.push({targetId:o,filter:n,target:e})}}const a=this.queryRenderedTargets(t,s,r),l=[],c=new Set;for(const t of a)for(const i of t.variants[o])at(i,t,c)||l.push(new e.cx(t,i));return l}queryRenderedTargets(t,i,r){const n={},o=(e,t,i,r)=>{const o=n[t.id]=n[t.id]||{sourceCache:t,layers:{},has3DLayers:!1};if(o.layers[e.fqid]=o.layers[e.fqid]||{styleLayer:e,targets:[]},e.is3D(!!this.terrain)&&(o.has3DLayers=!0),!r)return i.uniqueFeatureID=!1,void o.layers[e.fqid].targets.push(i);o.layers[e.fqid].targets.push(Object.assign({},i,{namespace:r.namespace,properties:r.properties,uniqueFeatureID:r.uniqueFeatureID}))};for(const t of i)if("featuresetId"in t.target){const{featuresetId:i,importId:r}=t.target,n=this.getFragmentStyle(r);if(!n||!n._featuresetSelectors)continue;const s=n._featuresetSelectors[i];if(!s){this.fire(new e.z(new Error(`The featureset '${i}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const e of s){const i=n.getOwnLayer(e.layerId);i&&!yr.has(i.type)&&o(i,n.getOwnLayerSourceCache(i),t,e)}}else if("layerId"in t.target){const{layerId:e}=t.target,i=this.getLayer(e);if(!i||yr.has(i.type))continue;o(i,this.getLayerSourceCache(i),t)}const s=this._queryRenderedFeatures(t,n,r);return this._flattenAndSortRenderedFeatures(s)}_queryRenderedFeatures(e,t,i){const r=[],n=!!this.map._showQueryGeometry,o=Ke.createFromScreenPoints(e,i);for(const e in t){const s=lt(o,t[e],this._availableImages,i,n);Object.keys(s).length&&r.push(s)}if(this.placement)for(const e in t){if(!t[e].sourceCache._onlySymbols)continue;const i=ct(o.screenGeometry,t[e],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData);Object.keys(i).length&&r.push(i)}return r}querySourceFeatures(e,t){const i=t&&t.filter;i&&this._validate(Be,"querySourceFeatures.filter",i,null,t);let r=[];const n=this.getOwnSourceCaches(e);for(const e of n)r=r.concat(ut(e,t));return r}addSourceType(e,t,i){return br.getSourceType(e)?i(new Error(`A source type called "${e}" already exists.`)):(br.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},i):i(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,i,r={}){this._checkLoaded();const n=this.light.getLight();let o=!1;for(const i in t)if(!e.bn(t[i],n[i])){o=!0;break}if(!o)return;const s=this._getTransitionParameters();this.light.setLight(t,i,r),this.light.updateTransitions(s)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&e.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,i=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===i&&delete this.terrain,null===t?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let r=t;const n=null==t.source;if(1===i){if(this.disableElevatedTerrain)return;if("object"==typeof r.source){const t="terrain-dem-src";this.addSource(t,r.source),r=e.cq(r),r=e.l(r,{source:t})}const t=e.l({},r),i={};if(this.terrain&&n){t.source=this.terrain.get().source;const e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(i.style=e.serialize())}if(this._validate(ve,"terrain",t,i))return}if(!this.terrain||this.terrain.scope!==this.scope&&!n||this.terrain&&i!==this.terrain.drapeRenderMode){if(!r)return;this._createTerrain(r,i),this.fire(new e.A("data",{dataType:"style"}))}else{const i=this.terrain,n=i.get();for(const t of Object.keys(e.a5.terrain))!r.hasOwnProperty(t)&&e.a5.terrain[t].default&&(r[t]=e.a5.terrain[t].default);for(const r in t)if(!e.bn(t[r],n[r])){i.set(t,this.options),this.stylesheet.terrain=t;const r=this._getTransitionParameters({duration:0});i.updateTransitions(r),this.fire(new e.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new Qe(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_createSnow(e){const t=this.snow=new $e(e,this.map.transform,this.scope,this.options);this.stylesheet.snow=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_createRain(e){const t=this.rain=new Ze(e,this.map.transform,this.scope,this.options);this.stylesheet.rain=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const e of this.map._markers)e._evaluateOpacity()}))}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog;if(!e.bn(i.get(),t)){i.set(t,this.options),this.stylesheet.fog=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const i=this.snow;if(!e.bn(i.get(),t)){i.set(t,this.options),this.stylesheet.snow=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const i=this.rain;if(!e.bn(i.get(),t)){i.set(t,this.options),this.stylesheet.rain=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles()},i=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!i)return this._styleColorTheme.lut=null,void t();const r=this._evaluateColorThemeData(i);this._loadColorTheme(r).then((()=>{this.fire(new e.A("colorthemeset")),t()})).catch((t=>{e.w(`Couldn't set color theme: ${t}`)}))}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&e.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(e,t){const i=this.getFragmentStyle(e);i&&(i._styleColorTheme.colorThemeOverride=t,i._reloadColorTheme())}_getTransitionParameters(t){return{now:e.q.now(),transition:e.l(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const e=[],t=[];for(const i of this._mergedOrder)this.isLayerDraped(this._mergedLayers[i])?e.push(i):t.push(i);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const i=this.terrain=new Fe(e,t,this.scope,this.options);1===t&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(t,i,r,n,o={}){if(o&&!1===o.validate)return!1;const s=e.l({},this.serialize());return mr(this,t.call(me,e.l({key:i,style:s,value:r,styleSpec:e.a5},n)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.cy.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._mergedLayers)this._mergedLayers[e].setEventedParent(null);for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(e){const t=this.getSourceCaches(e);for(const e of t)e.clearTiles()}clearSources(){for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}reloadSource(e){const t=this.getSourceCaches(e);for(const e of t)e.resume(),e.reload()}reloadSources(){for(const e of this.getSources())e.reload&&e.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle((e=>{e.modelManager.reloadModels(e.scope)}))}updateSources(e){let t;this.directionalLight&&(t=or(this.directionalLight));for(const i in this._mergedSourceCaches)this._mergedSourceCaches[i].update(e,void 0,void 0,t)}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}_updatePlacement(t,i,r,n,o,s,a=!1){let l=!1,c=!1;const u={},h={};for(const t of this._mergedOrder){const r=this._mergedLayers[t];if("symbol"!==r.type)continue;const n=e.C(r.source,r.scope);let o=u[n];if(!o){const e=this.getLayerSourceCache(r);if(!e)continue;const t=e.getRenderableIds(!0).map((t=>e.getTileByID(t)));h[n]=t.slice(),o=u[n]=t.sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const s=this.crossTileSymbolIndex.addLayer(r,o,i.center.lng,i.projection);l=l||s}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),a=a||this._layerOrderChanged||0===n,this._layerOrderChanged&&this.fire(new e.A("neworder")),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.q.now(),i.zoom))&&(this.pauseablePlacement=new Ii(i,this._mergedOrder,a,r,n,o,this.placement,this.fog&&i.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,u,h,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.q.now()),c=!0),l&&this.pauseablePlacement.placement.setStale()),c||l){this._buildingIndex.onNewFrame(i.zoom);for(let t=0;te===t.id)))return void this.fire(new e.z(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!i)return r.push(t),this._loadImports([t],!0);const n=r.findIndex((({id:e})=>e===i));return-1===n&&this.fire(new e.z(new Error(`Import with id "${i}" does not exist on this map.`))),this.stylesheet.imports=r.slice(0,n).concat(t).concat(r.slice(n)),this._loadImports([t],!0,i)}updateImport(t,i){this._checkLoaded();const r=this.stylesheet.imports||[],n=this.getImportIndex(t);return-1===n?this:"string"==typeof i?(this.setImportUrl(t,i),this):(i.url&&i.url!==r[n].url&&this.setImportUrl(t,i.url),e.bn(i.config,r[n].config)||this.setImportConfig(t,i.config,i.data.schema),e.bn(i.data,r[n].data)||this.setImportData(t,i.data),this)}moveImport(e,t){this._checkLoaded();let i=this.stylesheet.imports||[];const r=this.getImportIndex(e);if(-1===r)return this;const n=this.getImportIndex(t);if(-1===n)return this;const o=i[r],s=this.fragments[r];return i=i.filter((({id:t})=>t!==e)),this.fragments=this.fragments.filter((({id:t})=>t!==e)),this.stylesheet.imports=i.slice(0,n).concat(o).concat(i.slice(n)),this.fragments=this.fragments.slice(0,n).concat(s).concat(this.fragments.slice(n)),this.mergeLayers(),this}setImportUrl(e,t){this._checkLoaded();const i=this.stylesheet.imports||[],r=this.getImportIndex(e);if(-1===r)return this;i[r].url=t;const n=this.fragments[r];return n.style=this._createFragmentStyle(i[r]),n.style.on("style.import.load",(()=>this.mergeAll())),n.style.loadURL(t),this}setImportData(e,t){this._checkLoaded();const i=this.getImportIndex(e),r=this.stylesheet.imports||[];return-1===i?this:t?(this.fragments[i].style.setState(t),this._reloadImports(),this):(delete r[i].data,this.setImportUrl(e,r[i].url))}setImportConfig(e,t,i){this._checkLoaded();const r=this.getImportIndex(e),n=this.stylesheet.imports||[];if(-1===r)return this;t?n[r].config=t:delete n[r].config;const o=this.fragments[r];i&&o.style.stylesheet&&(o.style.stylesheet.schema=i);const s=o.style.stylesheet&&o.style.stylesheet.schema;return o.config=t,o.style.updateConfig(t,s),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();const t=this.stylesheet.imports||[],i=this.getImportIndex(e);-1!==i&&(t.splice(i,1),this.fragments[i].style._remove(),this.fragments.splice(i,1),this._reloadImports())}getImportIndex(t){const i=(this.stylesheet.imports||[]).findIndex((e=>e.id===t));return-1===i&&this.fire(new e.z(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),i}getLayer(e){return this._mergedLayers[e]}getSources(){const e=[];for(const t in this._mergedOtherSourceCaches){const i=this._mergedOtherSourceCaches[t];i&&e.push(i.getSource())}return e}getSource(e,t){const i=this.getSourceCache(e,t);return i&&i.getSource()}getLayerSource(e){const t=this.getLayerSourceCache(e);return t&&t.getSource()}getSourceCache(t,i){const r=e.C(t,i);return this._mergedOtherSourceCaches[r]}getLayerSourceCache(t){const i=e.C(t.source,t.scope);return"symbol"===t.type?this._mergedSymbolSourceCaches[i]:this._mergedOtherSourceCaches[i]}getSourceCaches(e){if(null==e)return Object.values(this._mergedSourceCaches);const t=[];return this._mergedOtherSourceCaches[e]&&t.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&t.push(this._mergedSymbolSourceCaches[e]),t}updateSourceCaches(){const e=this._changes.getUpdatedSourceCaches();for(const t in e){const i=e[t];"reload"===i?this.reloadSource(t):"clear"===i&&this.clearSource(t)}}updateLayers(e){const t=this._changes.getUpdatedPaintProperties();for(const i of t){const t=this.getLayer(i);t&&t.updateTransitions(e)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(e){this.stylesheet.glyphs=e,this.glyphManager.setURL(e,this.scope)}getImages(t,i,r){this.imageManager.getImages(i.images,i.scope,r),this._updateTilesForChangedImages();const n=t=>{if(t){const r=i.images.map((t=>e.I.toString(t)));t.setDependencies(i.tileID.key,i.type,r)}},o=e.C(i.source,i.scope);n(this._mergedOtherSourceCaches[o]),n(this._mergedSymbolSourceCaches[o])}rasterizeImages(e,t,i){this.imageManager.rasterizeImages(t,i)}getGlyphs(e,t,i){this.glyphManager.getGlyphs(t.stacks,t.scope,i)}getResource(t,i,r){return e.cz(i,r)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const i=this.getOwnSourceCaches(t);return 0===i.length?(this.fire(new e.z(new Error(`There is no source with ID '${t}'`))),!1):i.every((e=>e.loaded()))}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(e,t){if(!this._clipLayerPresent&&"fill-extrusion"!==e.type)return!1;const i="fill-extrusion"===e.type&&"building"===e.sourceLayer;if(e.is3D(!!this.terrain)){if(i||t&&"batched-model"===t.type)return!0;if("model"===e.type)return!0}else if("symbol"===e.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach((e=>{e.style._remove()})),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}br.getSourceType=function(e){return nt[e]},br.setSourceType=function(e,t){nt[e]=t},br.registerForPluginStateChange=e.ci;var wr="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",Tr="\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color,float height) {\n#ifdef INDICATOR_CUTOUT\nfloat verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",Br="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\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(\nunpack_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 vec2 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 (units_to_pixels*pos+offset)/pattern_size;}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) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}",Cr="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Sr="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif//DEPTH_OCCLUSION",Er="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",Mr="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",Ir="#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",Pr="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",Lr="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif//RENDER_SHADOWS",Fr="#ifdef RENDER_SHADOWS\n#ifdef DEPTH_TEXTURE\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\n#else\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\n#endif\nuniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_1,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_0,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;\n#ifdef TEXTURE_GATHER\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\n#else\nhighp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\n);\n#endif\nvec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return clamp(mix(lerpx.x,lerpx.y,f.y),0.0,1.0);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {\n#ifdef SHADOWS_SINGLE_CASCADE\nlight_view_pos0.xyz/=light_view_pos0.w;vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\n#else\nlight_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";const kr=[];Nr(wr,kr),Nr(Br,kr),Nr(Tr,kr);const zr={"_prelude_fog.vertex.glsl":Er,"_prelude_terrain.vertex.glsl":Sr,"_prelude_shadow.vertex.glsl":Lr,"_prelude_fog.fragment.glsl":Mr,"_prelude_shadow.fragment.glsl":Fr,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif//LIGHTING_3D_MODE","_prelude_raster_array.glsl":Ir,"_prelude_raster_particle.glsl":Pr},Rr={};Qr("",Sr),Qr(Mr,Er),Qr(Fr,Lr),Qr(Ir,""),Qr(Pr,"");const Dr=Qr(Tr,Br),Or=wr;var Ur={background:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),backgroundPattern:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),circle:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in 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\nuniform float u_emissive_strength;void 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 blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? \nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\n#ifdef ELEVATED_ROADS\nin float a_circle_z_offset;\n#endif\nout vec3 v_data;out 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\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void 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);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\n#ifdef ELEVATED_ROADS\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:Qr("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Qr('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in 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);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout 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;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:Qr("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Qr("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}'),collisionCircle:Qr("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in 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);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out 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_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-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(\n0.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:Qr("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),elevatedStructuresDepth:Qr("void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=vec4(0.);\n#endif\n}","in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Qr("#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#endif\nglFragColor=vec4(1.0,0.0,0.0,1.0);}","in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}"),elevatedStructures:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvoid main() {vec3 color=vec3(241.0/255.0,236.0/255.0,225.0/255.0);\n#ifdef LIGHTING_3D_MODE\nvec3 normal=normalize(v_normal);\n#ifdef RENDER_SHADOWS\nfloat shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#else\ncolor=apply_lighting(color,normal);\n#endif\nif (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_height);\n#endif\nglFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;\n#endif\nvoid main() {v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(v_normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fill:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=opacity;\n#ifdef INDICATOR_CUTOUT\nif (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=z_offset;\n#endif\n}'),fillOutline:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\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);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,h);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionDepth:Qr("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,height);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:Qr('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:Qr("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:Qr("precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(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);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),line:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset > 0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)\nin vec3 a_z_offset_width;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec3 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\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 border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\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 border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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;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;\n#ifdef VARIABLE_LINE_WIDTH\nfloat left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\noffset=-1.0*offset*u_width_scale;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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),0.001);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),linePattern:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nuniform float u_emissive_strength;\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset > 0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_z_offset);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec3 a_z_offset_width;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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;vec2 pos=floor(a_pos_normal*0.5);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=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\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=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),raster:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:Qr("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:Qr("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Qr('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Qr('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\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\n#pragma mapbox: initialize lowp float emissive_strength\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform 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_elevation_from_sea;uniform bool u_pitch_with_map;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 vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\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\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\n#ifdef PROJECTED_POS_ON_VIEWPORT\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\n#else\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); \n#endif\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+(u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#else\nz+=u_pitch_with_map ? (u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=e;\n#endif\n}'),terrainRaster:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:Qr("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:Qr('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',Cr),skyboxGradient:Qr('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',Cr),skyboxCapture:Qr("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nhighp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:Qr('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor,v_position_height.w);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:Qr("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:Qr("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),snowParticle:Qr("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"),rainParticle:Qr("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"),vignette:Qr("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Qr("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function Nr(e,t){const i=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let e of i)if(e=e.trim(),"#"===e[0]&&e.includes("if")&&!e.includes("endif")){e=e.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const i=e.split(" ");for(const e of i)t.includes(e)||t.push(e)}}function Qr(e,t){const i=/#include\s+"([^"]+)"/g,r=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let n=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);n&&(n=n.map((e=>{const t=e.split(" ");return t[t.length-1]})),n=[...new Set(n)]);const o={},s=[],a=[];if(e=e.replace(i,((e,t)=>(a.push(t),""))),(t=t.replace(i,((e,t)=>(s.push(t),"")))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let l=[...kr];Nr(e,l),Nr(t,l);for(const e of[...s,...a])zr[e]||console.error(`Undefined include: ${e}`),Rr[e]||(Rr[e]=[],Nr(zr[e],Rr[e])),l=[...l,...Rr[e]];return{fragmentSource:e=e.replace(r,((e,t,i,r,n)=>(o[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"initialize"===t?`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n in ${i} ${r} ${n};\n#endif\n`:"initialize-attribute"===t?"":void 0))),vertexSource:t=t.replace(r,((e,t,i,r,n)=>{const s="float"===r?"vec2":r,a=n.match(/color/)?"color":s;return"define-attribute-vertex-shader-only"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\nin ${i} ${r} a_${n};\n#endif\n`:o[n]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${s} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"initialize"===t?"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n in ${i} ${r} a_${n};\n out ${i} ${r} ${n};\n#endif\n`:"initialize-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n ${n} = a_${n};\n#endif\n`:void 0:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${s} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"define-instanced"===t?"mat4"===a?`\n#ifdef INSTANCED_ARRAYS\nin vec4 a_${n}0;\nin vec4 a_${n}1;\nin vec4 a_${n}2;\nin vec4 a_${n}3;\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef INSTANCED_ARRAYS\nin ${i} ${s} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"initialize-attribute-custom"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n ${i} ${r} ${n} = a_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:n,usedDefines:l,vertexIncludes:s,fragmentIncludes:a}}class jr{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,i,r,n,o,s,a){this.context=e;let l=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!l&&e{const o=r.paint.get("hillshade-shadow-color"),s="none"===r.paint.get("hillshade-shadow-color-use-theme").constantOr("default"),a=r.paint.get("hillshade-highlight-color"),l="none"===r.paint.get("hillshade-highlight-color-use-theme").constantOr("default"),c=r.paint.get("hillshade-accent-color"),u="none"===r.paint.get("hillshade-accent-color-use-theme").constantOr("default"),h=r.paint.get("hillshade-emissive-strength");let d=e.ak(r.paint.get("hillshade-illumination-direction"));if("viewport"===r.paint.get("hillshade-illumination-anchor"))d-=t.transform.angle;else if(t.style&&t.style.enable3dLights()&&t.style.directionalLight){const i=t.style.directionalLight.properties.get("direction"),r=e.cc(i.x,i.y,i.z);d=e.ak(r[1])}const p=!t.options.moving;return{u_matrix:n||t.transform.calculateProjMatrix(i.tileID.toUnwrapped(),p),u_image:0,u_latrange:Vr(0,i.tileID),u_light:[r.paint.get("hillshade-exaggeration"),d],u_shadow:o.toRenderColor(s?null:r.lut),u_highlight:a.toRenderColor(l?null:r.lut),u_emissive_strength:h,u_accent:c.toRenderColor(u?null:r.lut)}})(t,r,n,t.terrain?i.projMatrix:null);t.uploadCommonUniforms(l,d,i.toUnwrapped());const{tileBoundsBuffer:f,tileBoundsIndexBuffer:A,tileBoundsSegments:m}=t.getTileBoundsBuffers(r);d.draw(t,c.TRIANGLES,o,s,a,Vi.disabled,p,n.id,f,A,m)}function Gr(t,i,r){if(!i.needsDEMTextureUpload)return;const n=t.context,o=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(r.stride);const s=r.getPixels();i.demTexture?i.demTexture.update(s,{premultiply:!1}):i.demTexture=new e.T(n,s,o.R32F,{premultiply:!1}),i.needsDEMTextureUpload=!1}function $r(t,i,r){const n=t.context,o=n.gl;if(!i.dem)return;const s=i.dem;if(n.activeTexture.set(o.TEXTURE1),Gr(t,i,s),!i.demTexture)return;i.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE);const a=s.dim;n.activeTexture.set(o.TEXTURE0);let l=i.hillshadeFBO;if(!l){const t=new e.T(n,{width:a,height:a,data:null},o.RGBA8);t.bind(o.LINEAR,o.CLAMP_TO_EDGE),l=i.hillshadeFBO=n.createFramebuffer(a,a,!0,"renderbuffer"),l.colorAttachment.set(t.texture)}n.bindFramebuffer.set(l.framebuffer),n.viewport.set([0,0,a,a]);const{tileBoundsBuffer:c,tileBoundsIndexBuffer:u,tileBoundsSegments:h}=t.getMercatorTileBoundsBuffers(),d=[];t.linearFloatFilteringSupported()&&d.push("TERRAIN_DEM_FLOAT_FORMAT"),t.getOrCreateProgram("hillshadePrepare",{defines:d}).draw(t,o.TRIANGLES,Oi.disabled,Ni.disabled,Di.unblended,Vi.disabled,((t,i)=>{const r=i.stride,n=e.ad.mat4.create();return e.ad.mat4.ortho(n,0,e.ai,-e.ai,0,0,1),e.ad.mat4.translate(n,n,[0,-e.ai,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ}})(i.tileID,s),r.id,c,u,h),i.needsHillshadePrepare=!1}class Zr{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class qr extends Zr{getDefault(){return e.al.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Kr extends Zr{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Wr extends Zr{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Xr extends Zr{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Yr extends Zr{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Jr extends Zr{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class en extends Zr{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class tn extends Zr{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class rn extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class nn extends Zr{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class on extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class sn extends Zr{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class an extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class ln extends Zr{getDefault(){const e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class cn extends Zr{getDefault(){return e.al.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class un extends Zr{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class hn extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class dn extends Zr{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class pn extends Zr{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let fn=class extends Zr{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class An extends Zr{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class mn extends Zr{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class gn extends Zr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class _n extends Zr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class yn extends Zr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class vn extends Zr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class xn extends Zr{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class bn extends Zr{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class wn extends Zr{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Tn extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Bn extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Cn extends Zr{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class Sn extends Cn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class En extends Cn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,this.attachment(),t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Mn extends Cn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,this.attachment(),t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class In extends En{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Pn=(e,t,i)=>({u_matrix:e,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:i}),Ln=(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(r),u_merc_matrix:i,u_zoom_transition:n,u_merc_center:o,u_image0:0,u_frustum_tl:s,u_frustum_tr:a,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:u,u_globe_radius:h,u_viewport:d,u_grid_matrix:A?Float32Array.from(A):new Float32Array(9),u_skirt_height:p,u_far_z_cutoff:f});function Fn(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const kn=new class{constructor(){this.operations={}}newMorphing(e,t,i,r,n){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==i.tileID.key&&(t.queued=i)}else this.operations[e]={startTime:r,phase:0,duration:n,from:t,to:i,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},zn={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Rn(e,t,i){if(0===t)return 0;const r=t<1&&514===i?.25/t:1;return 6*Math.pow(1.5,22-e)*Math.max(t,1)*r}function Dn(e,t){const i=1<({u_matrix:e});function Un(t,i,r,n,o){if(o>0){const s=e.q.now(),a=(s-t.timeAdded)/o,l=i?(s-i.timeAdded)/o:-1,c=r.getSource(),u=n.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),d=h&&t.refreshedUponExpiration?1:e.ay(h?a:1-l,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}class Nn extends Bt{constructor(t){const i={type:"raster-dem",maxzoom:t.transform.maxZoom},r=new e.D(e.cj(),null),n=ot("mock-dem",i,r,t.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class Qn extends Bt{constructor(t){const i=ot("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new e.D(e.cj(),null),t.style);super("proxy",i,!1),i.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,t,i){if(e.freezeTileCoverage)return;this.transform=e;const r=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((t,i)=>{if(t[i.key]="",!this._tiles[i.key]){const t=new xt(i,this._source.tileSize*i.overscaleFactor(),e.tileZoom);t.state="loaded",this._tiles[i.key]=t}return t}),{});for(const e in this._tiles)e in r||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const i=Object.values(t);this.renderCachePool.push(...i),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach((e=>e.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class jn extends e.aH{constructor(e,t,i){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=i}}class Vn extends e.cK{constructor(t,i){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},(()=>{this._style.map.triggerRepaint()})),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},(()=>{this._style.map.triggerRepaint()})),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",(()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()})),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[r,n,o]=function(){const t=new e.b5,i=new e.aV,r=131;t.reserve(17161),i.reserve(33800);const n=e.ai/128,o=e.ai+n/2,s=o+n;for(let i=-n;io||i<0||i>o?24575:0,s=e.ay(Math.round(r),0,e.ai),a=e.ay(Math.round(i),0,e.ai);t.emplaceBack(s+n,a)}const a=(e,t)=>{const n=t*r+e;i.emplaceBack(n+1,n,n+r),i.emplaceBack(n+r,n+r+1,n+1)};for(let e=1;e<129;e++)for(let t=1;t<129;t++)a(t,e);return[0,129].forEach((e=>{for(let t=0;t<130;t++)a(t,e),a(e,t)})),[t,i,32768]}(),s=t.context;this.gridBuffer=s.createVertexBuffer(r,e.b7.members),this.gridIndexBuffer=s.createIndexBuffer(n),this.gridSegments=e.b8.simpleSegment(0,0,r.length,n.length),this.gridNoSkirtSegments=e.b8.simpleSegment(0,0,r.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Qn(i.map),this.orthoMatrix=e.ad.mat4.create(),e.ad.mat4.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.ai,0,e.ai,0,1);const a=s.gl;this._overlapStencilMode=new Ni({func:a.GEQUAL,mask:255},0,255,a.KEEP,a.KEEP,a.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=i,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Nn(i.map),this._pendingGroundEffectLayers=[]}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",(()=>{this._clearLineLayersFromRenderCache()}))}update(t,i,r){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const n=t.terrain.properties,o=0===t.terrain.drapeRenderMode,s=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.q.now();const a=t.terrain&&t.terrain.scope,l=n.get("source"),c=o?this._mockSourceCache:t.getSourceCache(l,a);if(!c)return void e.w(`Couldn't find terrain source "${l}".`);if(this.sourceCache=c,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=s?this.calculateExaggeration(i):n.get("exaggeration"),!i.projection.requiresDraping&&s&&0===this._exaggeration)return void this._disable();this.enabled=!0;const u=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(i,t,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,u(),this._initializing=!0),u(),i.updateElevation(!0,r),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0,this._previousZoom=i.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const i=this._previousCameraAltitude,r=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=r;const n=null!=i?r-i:Number.MAX_VALUE;if(Math.abs(n)<2)return this._exaggeration;const o=t.zoom,s=this._style.terrain;if(!this._previousUpdateTimestamp)return s.getExaggeration(o);let a=o-this._previousZoom;const l=this._previousUpdateTimestamp;let c=o;null!=this._evaluationZoom&&(c=this._evaluationZoom,Math.abs(o-c)>.5&&(a=.5*(o-c+a)),a*n<0&&(c+=a)),this._evaluationZoom=c;const u=s.getExaggeration(c),h=u===s.getExaggeration(Math.max(0,c-.1));if(h&&Math.abs(u-this._exaggeration)<.01)return u;let d=Math.min(.1,.00375*(this._updateTimestamp-l));return(h||u<.1||Math.abs(a)<1e-4)&&(d=Math.min(.2,4*d)),e.ah(this._exaggeration,u,d)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach((e=>e.fb.destroy())),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,r=this.painter.transform;this._initializing&&(this._initializing=0===r._centerAltitude&&-1===this.getAtPointOrZero(e.ac.fromLngLat(r.center),-1),this._emptyDEMTextureDirty=!this._initializing);const n=this.proxyCoords=i.getIds().map((e=>{const t=i.getTileByID(e).tileID;return t.projMatrix=r.calculateProjMatrix(t.toUnwrapped()),t}));!function(t,i){const r=i.transform.pointCoordinate(i.transform.getCameraPoint()),n=new e.P(r.x,r.y);t.sort(((t,i)=>{if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;const r=new e.P(t.canonical.x+(1<{this.proxyToSource[e.key]={}})),this.terrainTileForTile={};const s=this._style._mergedSourceCaches;for(const e in s){const i=s[e];if(!i.used)continue;if(i!==this.sourceCache&&this.resetTileLookupCache(i.id),this._setupProxiedCoordsForOrtho(i,t[e],o),i.usedForTerrain)continue;const r=t[e];i.getSource().reparseOverscaled&&this._assignTerrainTiles(r)}this.proxiedCoords[i.id]=n.map((e=>new jn(e,e.key,this.orthoMatrix))),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1;const a={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const i=t.tileID.key;i in a||(this._visibleDemTiles.push(t),a[i]=i)}}_assignTerrainTiles(e){this._initializing||e.forEach((e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)}))}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const i in this.terrainTileForTile){const r=this.terrainTileForTile[i],n=r.dem;!n||r.demTexture&&!r.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),Gr(this.painter,r,n))}}_prepareDemTileUniforms(e,t,i,r){if(!t||null==t.demTexture)return!1;const n=e.tileID.canonical,o=Math.pow(2,t.tileID.canonical.z-n.z),s=r||"";return i[`u_dem_tl${s}`]=[n.x*o%1,n.y*o%1],i[`u_dem_scale${s}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let e=0;const t=this._visibleDemTiles.reduce(((t,i)=>{if(!i.dem)return t;const r=i.dem.tree.minimums[0];return r>0&&e++,t+r}),0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);const r=this._getLoadedAreaMinimum(),n=new e.cL({width:1,height:1},new Float32Array([r]));this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(n,{premultiply:!1}):o=this._emptyDEMTexture=new e.T(t,n,i.R32F,{premultiply:!1}),o}setupElevationDraw(t,i,r){const n=this.painter.context,o=n.gl,s={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};s.u_exaggeration=this.exaggeration();let a=null,l=null,c=1;if(r&&r.morphing&&this._useVertexMorphing){const e=r.morphing.srcDemTile,i=r.morphing.dstDemTile;c=r.morphing.phase,e&&i&&(this._prepareDemTileUniforms(t,e,s,"_prev")&&(l=e),this._prepareDemTileUniforms(t,i,s)&&(a=i))}const u=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?o.LINEAR:o.NEAREST;let h=null;var d;if(this.enabled?l&&a?(h=a.demTexture,n.activeTexture.set(o.TEXTURE4),l.demTexture.bind(u(l),o.CLAMP_TO_EDGE),s.u_dem_lerp=c):(a=this.terrainTileForTile[t.tileID.key],h=this._prepareDemTileUniforms(t,a,s)?a.demTexture:this.emptyDEMTexture):h=this.emptyDEMTexture,n.activeTexture.set(o.TEXTURE2),h&&(s.u_dem_size=1===(d=h).size[0]?1:d.size[0]-2,h.bind(u(a),o.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(r&&r.useDepthForOcclusion,i,s),r&&r.useMeterToDem&&a){const t=(1<{if(c===i)return;const r=[zn[i],"PROJECTION_GLOBE_VIEW"];h&&r.push("CUSTOM_ANTIALIASING");const n=t.isTileAffectedByFog(e);l=t.getOrCreateProgram("globeRaster",{defines:r,overrideFog:n}),c=i},p=t.colorModeForRenderPass(),f=new Oi(a.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D);kn.update(o);const A=e.cE(u),m=[e.av(u.center.lng),e.aC(u.center.lat)],g=t.globeSharedBuffers,_=[u.width*e.q.devicePixelRatio,u.height*e.q.devicePixelRatio],y=Float32Array.from(u.globeMatrix),v={useDenormalizedUpVectorScale:!0};{const u=t.transform,h=Rn(u.zoom,i.exaggeration(),i.sourceCache._source.tileSize);c=-1;const x=a.TRIANGLES;for(const c of n){const n=r.getTile(c),b=Ni.disabled,w=i.prevTerrainTileForTile[c.key],T=i.terrainTileForTile[c.key];Fn(w,T)&&kn.newMorphing(c.key,w,T,o,250),s.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const B=kn.getMorphValuesForProxy(c.key),C=B?1:0;B&&e.L(v,{morphing:{srcDemTile:B.from,dstDemTile:B.to,phase:e.cC(B.phase)}});const S=e.cF(c.canonical),E=e.cG(S.getCenter().lat),M=e.cH(c.canonical,S,E,u.worldSize/u._pixelsPerMercatorPixel),I=e.bc(e.cI(c.canonical)),P=Ln(u.expandedFarZProjMatrix,y,A,I,e.ag(u.zoom),m,u.frustumCorners.TL,u.frustumCorners.TR,u.frustumCorners.BR,u.frustumCorners.BL,u.globeCenterInViewSpace,u.globeRadius,_,h,u._farZ,M);if(d(c,C),l&&(i.setupElevationDraw(n,l,v),t.uploadCommonUniforms(s,l,c.toUnwrapped()),g)){const[e,i,r]=g.getGridBuffers(E,0!==h);l.draw(t,x,f,b,p,Vi.backCCW,P,"globe_raster",e,i,r)}}}if(g&&(t.renderDefaultNorthPole||t.renderDefaultSouthPole)){const o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];h&&o.push("CUSTOM_ANTIALIASING"),l=t.getOrCreateProgram("globeRaster",{defines:o});for(const o of n){const{x:n,y:c,z:h}=o.canonical,d=0===c,A=c===(1<e.draw(t,a.TRIANGLES,f,Ni.disabled,p,Vi.disabled,Ln(u.expandedFarZProjMatrix,g,g,T,0,m,u.frustumCorners.TL,u.frustumCorners.TR,u.frustumCorners.BR,u.frustumCorners.BL,u.globeCenterInViewSpace,u.globeRadius,_,0,u._farZ),"globe_pole_raster",i,b,w);i.setupElevationDraw(c,l,v),t.uploadCommonUniforms(s,l,o.toUnwrapped()),d&&t.renderDefaultNorthPole&&B(l,y),A&&t.renderDefaultSouthPole&&(g=e.ad.mat4.scale(e.ad.mat4.create(),g,[1,-1,1]),B(l,x))}}}}(t,i,r,n,o);else{const s=t.context,a=s.gl;let l,c;const u=t.shadowRenderer,h=Ji(t,t.longestCutoffRange),d=e=>{if(c===e)return;const i=[];i.push(zn[e]),h.shouldRenderCutoff&&i.push("RENDER_CUTOFF"),u&&(i.push("RENDER_SHADOWS","DEPTH_TEXTURE"),u.useNormalOffset&&i.push("NORMAL_OFFSET")),l=t.getOrCreateProgram("terrainRaster",{defines:i}),c=e},p=t.colorModeForRenderPass(),f=new Oi(a.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D);kn.update(o);const A=t.transform,m=Rn(A.zoom,i.exaggeration(),i.sourceCache._source.tileSize);let g=[0,0,0];if(u){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(g=sr(t.style,e,i))}{c=-1;const _=a.TRIANGLES,[y,v]=[i.gridIndexBuffer,i.gridSegments];for(const c of n){const n=r.getTile(c),x=Ni.disabled,b=i.prevTerrainTileForTile[c.key],w=i.terrainTileForTile[c.key];Fn(b,w)&&kn.newMorphing(c.key,b,w,o,250),s.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const T=kn.getMorphValuesForProxy(c.key),B=T?1:0;let C;T&&(C={morphing:{srcDemTile:T.from,dstDemTile:T.to,phase:e.cC(T.phase)}});const S=Pn(c.projMatrix,Dn(c.canonical,A.renderWorldCopies)?m/10:m,g);if(d(B),!l)continue;i.setupElevationDraw(n,l,C);const E=c.toUnwrapped();u&&u.setupShadows(E,l),t.uploadCommonUniforms(s,l,E,null,h),l.draw(t,_,f,x,p,Vi.backCCW,S,"terrain_raster",i.gridBuffer,y,v)}}}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const i=this.painter,r=this.painter.context,n=this.proxySourceCache,o=this.proxiedCoords[n.id],s=this._drapedRenderBatches.shift(),a=i.style.order,l=[];let c=0;for(const u of o){const o=n.getTileByID(u.proxyTileKey),h=n.proxyCachedFBO[u.key]?n.proxyCachedFBO[u.key][t]:void 0,d=void 0!==h?n.renderCache[h]:this.pool[c++],p=void 0!==h;if(o.texture=d.tex,p&&!d.dirty){l.push(o.tileID);continue}let f;r.bindFramebuffer.set(d.fb.framebuffer),this.renderedToTile=!1,d.dirty&&(r.clear({color:e.al.transparent,stencil:0}),d.dirty=!1);for(let e=s.start;e<=s.end;++e){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const n=i.style.getLayerSourceCache(t),o=n?this.proxyToSource[u.key][n.id]:[u];if(!o)continue;const s=o;r.viewport.set([0,0,d.fb.width,d.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(d,o,t,n),f=n?n.id:null),i.renderLayer(i,n,t,s)}if(0===this._drapedRenderBatches.length)for(const e of this._pendingGroundEffectLayers){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const n=i.style.getLayerSourceCache(t),o=n?this.proxyToSource[u.key][n.id]:[u];if(!o)continue;const s=o;r.viewport.set([0,0,d.fb.width,d.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(d,o,t,n),f=n?n.id:null),i.renderLayer(i,n,t,s)}this.renderedToTile?(d.dirty=!0,l.push(o.tileID)):p||--c,5===c&&(c=0,this.renderToBackBuffer(l))}return this.renderToBackBuffer(l),this.renderingToTexture=!1,r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),s.end+1}postRender(){}isLayerOrderingCorrect(e){const t=e.order.length;let i=-1,r=t;for(let n=0;ni}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter((e=>e.dem)).forEach((t=>{e=Math.min(e,t.dem.tree.minimums[0])})),0===e?e:(e-30)*this._exaggeration}raycast(e,t,i){if(!this._visibleDemTiles)return null;const r=this._visibleDemTiles.filter((e=>e.dem)).map((r=>{const n=r.tileID,o=1<(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)));for(const n of r){if(null==n.t)return null;const r=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,e,t,i);if(null!=r)return r}return null}_createFBO(){const t=this.painter.context,i=t.gl,r=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);const n=new e.T(t,{width:r[0],height:r[1],data:null},i.RGBA8);n.bind(i.LINEAR,i.CLAMP_TO_EDGE);const o=t.createFramebuffer(r[0],r[1],!0,null);return o.colorAttachment.set(n.texture),o.depthAttachment=new In(t,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:o,tex:n,dirty:!1}}_initFBOPool(){for(;this.pool.length{const t=this._style._mergedLayers[e],i=t.isHidden(this.painter.transform.zoom);return"hillshade"===t.type||"custom"===t.type?!i&&t.shouldRedrape():!i&&t.hasTransition()}))}_clearLineLayersFromRenderCache(){let t=!1;for(const e of this._style.getSources())if(e instanceof tt){t=!0;break}if(!t)return;const i={};for(let t=0;te>t.end))||e.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=r}_setupRenderCache(e){const t=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,t.renderCache.length>t.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let i=0;i=0;n--){const o=i[n];if(t.getTileByID(o.key),void 0!==t.proxyCachedFBO[o.key]){const i=e[o.key],n=this.proxyToSource[o.key];let s=0;for(const e in n){const t=n[e],o=i[e];if(!o||o.length!==t.length||t.some(((t,i)=>t!==o[i]||r[e]&&r[e].hasOwnProperty(t.key)))){s=-1;break}++s}for(const e in t.proxyCachedFBO[o.key])t.renderCache[t.proxyCachedFBO[o.key][e]].dirty=s<0||s!==Object.values(i).length}}const n=[...this._drapedRenderBatches];n.sort(((e,t)=>t.end-t.start-(e.end-e.start)));for(const e of n)for(const r of i){if(t.proxyCachedFBO[r.key])continue;let i=t.renderCachePool.pop();void 0===i&&t.renderCache.length<50&&(i=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==i&&(t.proxyCachedFBO[r.key]={},t.proxyCachedFBO[r.key][e.start]=i,t.renderCache[i].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,i,r){if(!r||!this._sourceTilesOverlap[r.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const n=this.painter.context,o=n.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let s;if(i.isTileClipped())s=t.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);s=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+s>255&&(n.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=s,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):Ni.disabled}_renderTileClippingMasks(e,t){const i=this.painter,r=this.painter.context,n=r.gl;i._tileClippingMaskIDs={},r.setColorMode(Di.disabled),r.setDepthMode(Oi.disabled);const o=i.getOrCreateProgram("clippingMask");for(const r of e){const e=i._tileClippingMaskIDs[r.key]=--t;o.draw(i,n.TRIANGLES,Oi.disabled,new Ni({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),Di.disabled,Vi.disabled,On(r.projMatrix),"$clipping",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments)}}pointCoordinate(t){const i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;const r=[t.x,t.y,1,1];e.ad.vec4.transformMat4(r,r,i.pixelMatrixInverse),e.ad.vec4.scale(r,r,1/r[3]),r[0]/=i.worldSize,r[1]/=i.worldSize;const n=i._camera.position,o=e.bH(1,i.center.lat),s=[n[0],n[1],n[2]/o,0],a=e.ad.vec3.subtract([],r.slice(0,3),s);e.ad.vec3.normalize(a,a);const l=this.raycast(s,a,this._exaggeration);return null!==l&&l?(e.ad.vec3.scaleAndAdd(s,s,a,l),s[3]=s[2],s[2]*=o,s):null}_setupProxiedCoordsForOrtho(t,i,r){if(t.getSource()instanceof e.aK)return this._setupProxiedCoordsForImageSource(t,i,r);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const n=this.proxiedCoords[t.id]=[],o=this.proxyCoords;for(let e=0;et.overscaledZ-e.overscaledZ))}_setupProxiedCoordsForImageSource(t,i,r){if(!t.getSource().loaded())return;const n=this.proxiedCoords[t.id]=[],o=this.proxyCoords,s=t.getSource(),a=s.tileID;if(!a)return;const l=new e.P(a.x,a.y)._div(1<(e.min.x=Math.min(e.min.x,t.x-l.x),e.min.y=Math.min(e.min.y,t.y-l.y),e.max.x=Math.max(e.max.x,t.x-l.x),e.max.y=Math.max(e.max.y,t.y-l.y),e)),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=(t,i)=>{const r=t.wrap+t.canonical.x/(1<s+c.max.x||n+oa+c.max.y};for(let e=0;ee.key===i.tileID.key));if(e)return e}if(i.tileID.key!==t.key){const r=t.canonical.z-i.tileID.canonical.z;let o,s,a;n=e.ad.mat4.create();const l=i.tileID.wrap-t.wrap<0?(o=e.ai>>r,s=o*((i.tileID.canonical.x<=n){const r=t.canonical.z-n;i.getSource().reparseOverscaled?(a=Math.max(t.canonical.z+2,i.transform.tileZoom),s=new e.aH(a,t.wrap,n,t.canonical.x>>r,t.canonical.y>>r)):0!==r&&(a=n,s=new e.aH(a,t.wrap,n,t.canonical.x>>r,t.canonical.y>>r))}s.key!==t.key&&(c.push(s.key),r=i.getTile(s))}const u=e=>{c.forEach((t=>{n[t]=e})),c.length=0};for(a-=1;a>=l&&(!r||!r.hasData());a--){r&&u(r.tileID.key);const e=s.calculateScaledKey(a);if(r=i.getTileByID(e),r&&r.hasData())break;const t=n[e];if(null===t)break;void 0===t?c.push(e):r=i.getTileByID(t)}return u(r?r.tileID.key:null),r&&r.hasData()?r:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}}function Hn(t,i,r){const n=function(t,i,r){const n=e.ad.vec3.dot(i,t),o=e.ad.vec3.dot(r,[.2126,.7152,.0722]),s=(e,t,i)=>(1-i)*e+i*t,a=s(1-.3*Math.min(o,1),1,Math.min(n+1,1));return s(.92,1,Math.asin(e.ay(i[2],-1,1))/Math.PI+.5)*a}(t,[0,0,1],i),o=[0,0,0];e.ad.vec3.scale(o,r.slice(0,3),n);const s=[0,0,0];e.ad.vec3.scale(s,i.slice(0,3),t[2]);const a=[0,0,0];return e.ad.vec3.add(a,o,s),e.cg(a)}const Gn=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],$n=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class Zn{static cacheKey(e,t,i,r){let n=`${t}${r?r.cacheKey:""}`;for(const t of i)e.usedDefines.includes(t)&&(n+=`/${t}`);return n}constructor(t,i,r,n,o,s){const a=t.gl;this.program=a.createProgram(),this.configuration=n,this.name=i,this.fixedDefines=[...s];const l=n?n.getBinderAttributes():[],c=(r.staticAttributes||[]).concat(l);let u=n?n.defines():[];u=u.concat(s.map((e=>`#define ${e}`)));const h="#version 300 es\n";let d=h+u.concat("precision mediump float;",Or,Dr.fragmentSource).join("\n");for(const e of r.fragmentIncludes)d+=`\n${zr[e]}`;d+=`\n${r.fragmentSource}`;let p=h+u.concat("precision highp float;",Or,Dr.vertexSource).join("\n");for(const e of r.vertexIncludes)p+=`\n${zr[e]}`;this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&-1!==r.vertexSource.indexOf("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&(p+="\nuniform int u_instanceID;\n"),p+=`\n${r.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(p=p.replaceAll("gl_InstanceID","u_instanceID"));const f=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(f,d),a.compileShader(f),a.attachShader(this.program,f);const A=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(A,p),a.compileShader(A),a.attachShader(this.program,A),this.attributes={},this.numAttributes=c.length;for(let e=0;e({u_instanceID:new e.bN(t)}))(t)),(s.includes("TERRAIN")||-1!==i.indexOf("symbol")||-1!==i.indexOf("circle"))&&(this.terrainUniforms=(t=>({u_dem:new e.bN(t),u_dem_prev:new e.bN(t),u_dem_tl:new e.bK(t),u_dem_scale:new e.bM(t),u_dem_tl_prev:new e.bK(t),u_dem_scale_prev:new e.bM(t),u_dem_size:new e.bM(t),u_dem_lerp:new e.bM(t),u_exaggeration:new e.bM(t),u_depth:new e.bN(t),u_depth_size_inv:new e.bK(t),u_depth_range_unpack:new e.bK(t),u_occluder_half_size:new e.bM(t),u_occlusion_depth_offset:new e.bM(t),u_meter_to_dem:new e.bM(t),u_label_plane_matrix_inv:new e.bJ(t)}))(t)),s.includes("GLOBE")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.bL(t),u_tile_tr_up:new e.bL(t),u_tile_br_up:new e.bL(t),u_tile_bl_up:new e.bL(t),u_tile_up_scale:new e.bM(t)}))(t)),s.includes("FOG")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.bJ(t),u_fog_range:new e.bK(t),u_fog_color:new e.cb(t),u_fog_horizon_blend:new e.bM(t),u_fog_vertical_limit:new e.bK(t),u_fog_temporal_offset:new e.bM(t),u_frustum_tl:new e.bL(t),u_frustum_tr:new e.bL(t),u_frustum_br:new e.bL(t),u_frustum_bl:new e.bL(t),u_globe_pos:new e.bL(t),u_globe_radius:new e.bM(t),u_globe_transition:new e.bM(t),u_is_globe:new e.bN(t),u_viewport:new e.bK(t)}))(t)),s.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(t=>({u_cutoff_params:new e.cb(t)}))(t)),s.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(t=>({u_lighting_ambient_color:new e.bL(t),u_lighting_directional_dir:new e.bL(t),u_lighting_directional_color:new e.bL(t),u_ground_radiance:new e.bL(t)}))(t)),s.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(t=>({u_light_matrix_0:new e.bJ(t),u_light_matrix_1:new e.bJ(t),u_fade_range:new e.bK(t),u_shadow_normal_offset:new e.bL(t),u_shadow_intensity:new e.bM(t),u_shadow_texel_size:new e.bM(t),u_shadow_map_resolution:new e.bM(t),u_shadow_direction:new e.bL(t),u_shadow_bias:new e.bL(t),u_shadowmap_0:new e.bN(t),u_shadowmap_1:new e.bN(t)}))(t))}}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const i=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const i=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const i=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setCutoffUniformValues(e,t){if(!this.cutoffUniforms)return;const i=this.cutoffUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setLightsUniformValues(e,t){if(!this.lightsUniforms)return;const i=this.lightsUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setShadowUniformValues(e,t){if(this.failedToCreate||!this.shadowUniforms)return;const i=this.shadowUniforms;e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}_drawDebugWireframe(t,i,r,n,o,s,a,l,c,u){const h=t.options.wireframe;if(!1===h.terrain&&!1===h.layers2D&&!1===h.layers3D)return;const d=t.context;if(!(()=>!(!h.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!h.layers2D||t._terrain&&t._terrain.renderingToTexture||!Gn.includes(this.name))||!(!h.layers3D||!$n.includes(this.name)))())return;const p=d.gl,f=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,o,d);if(!f)return;const A=[...this.fixedDefines];A.push("DEBUG_WIREFRAME");const m=t.getOrCreateProgram(this.name,{config:this.configuration,defines:A});d.program.set(m.program);const g=(e,t,i)=>{if(t[e]&&i[e])for(const r in t[e])i[e][r]&&i[e][r].set(i.program,r,t[e][r].current)};c&&c.setUniforms(m.program,d,m.binderUniforms,a,{zoom:l}),g("fixedUniforms",this,m),g("terrainUniforms",this,m),g("globeUniforms",this,m),g("fogUniforms",this,m),g("lightsUniforms",this,m),g("shadowUniforms",this,m),f.bind(),d.setColorMode(new Di([p.ONE,p.ONE_MINUS_SRC_ALPHA,p.ZERO,p.ONE],e.al.transparent,[!0,!0,!0,!1])),d.setDepthMode(new Oi(i.func===p.LESS?p.LEQUAL:i.func,Oi.ReadOnly,i.range)),d.setStencilMode(Ni.disabled);const _=3*s.primitiveLength*2,y=3*s.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const e=u||1;for(let t=0;t1?p.drawElementsInstanced(p.LINES,_,p.UNSIGNED_SHORT,y,u):p.drawElements(p.LINES,_,p.UNSIGNED_SHORT,y);o.bind(),d.program.set(this.program),d.setDepthMode(i),d.setStencilMode(r),d.setColorMode(n)}checkUniforms(e,t,i){if(this.fixedDefines.includes(t))for(const r of Object.keys(i))if(!i[r].initialized)throw new Error(`Program '${this.name}', from draw '${e}': uniform ${r} not set but required by ${t} being defined`)}draw(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A){const m=e.context,g=m.gl;if(this.failedToCreate)return;m.program.set(this.program),m.setDepthMode(i),m.setStencilMode(r),m.setColorMode(n),m.setCullFace(o);for(const e of Object.keys(this.fixedUniforms))this.fixedUniforms[e].set(this.program,e,s[e]);p&&p.setUniforms(this.program,m,this.binderUniforms,h,{zoom:d});const _={[g.POINTS]:1,[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[t];this.checkUniforms(a,"RENDER_SHADOWS",this.shadowUniforms);const y=A&&A>0?1:void 0;for(const o of u.get()){const s=o.vaos||(o.vaos={});if((s[a]||(s[a]=new jr)).bind(m,this,l,p?p.getPaintVertexBuffers():[],c,o.vertexOffset,f||[],y),this.forceManualRenderingForInstanceIDShaders){const e=A||1;for(let i=0;i1?g.drawElementsInstanced(t,o.primitiveLength*_,g.UNSIGNED_SHORT,o.primitiveOffset*_*2,A):c?g.drawElements(t,o.primitiveLength*_,g.UNSIGNED_SHORT,o.primitiveOffset*_*2):g.drawArrays(t,o.vertexOffset,o.vertexLength);t===g.TRIANGLES&&c&&this._drawDebugWireframe(e,i,r,n,c,o,h,d,p,A)}}}function qn(t,i){const r=Math.pow(2,i.tileID.overscaledZ),n=i.tileSize*Math.pow(2,t.transform.tileZoom)/r,o=n*(i.tileID.canonical.x+i.tileID.wrap*r),s=n*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.at(i,1,t.transform.tileZoom),u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}const Kn={terrain:0,flat:1},Wn=e.ad.mat4.create(),Xn=(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_)=>{const y=i.style.light,v=y.properties.get("position"),x=[v.x,v.y,v.z],b=e.ad.mat3.create();"viewport"===y.properties.get("anchor")&&(e.ad.mat3.fromRotation(b,-i.transform.angle),e.ad.vec3.transformMat3(x,x,b));const w=y.properties.get("color"),T=i.transform,B={u_matrix:t,u_lightpos:x,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[w.r,w.g,w.b],u_vertical_gradient:+r,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Wn,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Kn[u],u_base_type:Kn[h],u_ao:o,u_edge_radius:s,u_width_scale:a,u_flood_light_color:A,u_vertical_scale:m,u_flood_light_intensity:g,u_ground_shadow_factor:_};return"globe"===T.projection.name&&(B.u_tile_id=[l.canonical.x,l.canonical.y,1<({u_matrix:e,u_edge_radius:t,u_width_scale:i,u_vertical_scale:r,u_height_type:Kn[n],u_base_type:Kn[o]}),Jn=(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g)=>{const _=Xn(t,i,r,n,o,s,a,l,u,h,d,p,f,A,m,g,1,[0,0,0]),y={u_height_factor:-Math.pow(2,l.overscaledZ)/c.tileSize/8};return e.l(_,qn(i,c),y)},eo=(e,t)=>({u_matrix:e,u_emissive_strength:t}),to=(t,i,r,n)=>e.l(eo(t,i),qn(r,n)),io=(e,t,i)=>({u_matrix:e,u_world:i,u_emissive_strength:t}),ro=(t,i,r,n,o)=>e.l(to(t,i,r,n),{u_world:o}),no=(e,t,i,r,n)=>({u_matrix:e,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:i,u_height_scale:r,u_reset_depth:n}),oo=(t,i,r,n)=>{const o=e.ai/r.tileSize;return{u_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(n),u_extrude_scale:[i.pixelsToGLUnits[0]/o,i.pixelsToGLUnits[1]/o]}},so=(e,t,i=1)=>({u_matrix:e,u_color:t.toRenderColor(null),u_overlay:0,u_overlay_scale:i}),ao=e.ad.mat4.create(),lo=(t,i,r,n,o,s,a)=>{const l=t.transform,c="globe"===l.projection.name,u=c?e.cO(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:e.at(r,1,s),h={u_matrix:i.projMatrix,u_extrude_scale:u,u_intensity:a,u_inv_rot_matrix:ao,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){h.u_inv_rot_matrix=n,h.u_merc_center=o,h.u_tile_id=[i.canonical.x,i.canonical.y,1<({u_matrix:t,u_normalize_matrix:i,u_globe_matrix:r,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:s,u_scale_parent:u,u_fade_t:h.mix,u_opacity:h.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:e.cP(d.paint.get("raster-saturation")),u_contrast_factor:e.cQ(d.paint.get("raster-contrast")),u_spin_weights:po(d.paint.get("raster-hue-rotate")),u_perspective_transform:p,u_raster_elevation:f,u_zoom_transition:a,u_merc_center:l,u_cutoff_params:c,u_colorization_mix:co(e.cR,m,_),u_colorization_offset:uo(e.cR,g,_),u_color_ramp:A,u_texture_offset:[v/(y+2*v),y/(y+2*v)],u_texture_res:[y+2*v,y+2*v],u_emissive_strength:x});function po(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const fo=.05,Ao=(e,t,i,r,n,o,s,a,l,c,u,h)=>({u_matrix:e,u_normalize_matrix:t,u_globe_matrix:i,u_merc_matrix:r,u_grid_matrix:n,u_tl_parent:o,u_scale_parent:c,u_fade_t:u.mix,u_opacity:u.opacity,u_image0:0,u_image1:1,u_raster_elevation:h,u_zoom_transition:s,u_merc_center:a,u_cutoff_params:l}),mo=(e,t,i,r,n,o,s,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_tile_offset:i,u_velocity:r,u_color_ramp:o,u_velocity_res:n,u_max_speed:s,u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[fo,fo]}),go=(e,t,i,r,n,o,s,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_velocity:i,u_velocity_res:r,u_max_speed:n,u_speed_factor:o,u_reset_rate:s,u_rand_seed:Math.random(),u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[fo,fo]}),_o=e.ad.mat4.create(),yo=(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b)=>{const w=o.transform,T={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:w.getCameraToCenterDistance(y),u_rotate_symbol:+r,u_aspect_ratio:w.width/w.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+u,u_elevation_from_sea:c?1:0,u_pitch_with_map:+n,u_texsize:h,u_texsize_icon:d,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:_o,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:_o,u_up_vector:[0,-1,0],u_color_adj_mat:v,u_icon_transition:x||0,u_gamma_scale:n?o.transform.getCameraToCenterDistance(y)*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.q.devicePixelRatio,u_is_halo:+p,u_scale_factor:b||1};return"globe"===y.name&&(T.u_tile_id=[f.canonical.x,f.canonical.y,1<({u_matrix:e,u_emissive_strength:t,u_opacity:i,u_color:r}),xo=(t,i,r,n,o,s,a,l,c)=>e.l(function(t,i,r,n,o,s){const{width:a,height:l}=n.imageManager.getPixelSize(i),c=Math.pow(2,s.tileID.overscaledZ),u=s.tileSize*Math.pow(2,n.transform.tileZoom)/c,h=u*(s.tileID.canonical.x+s.tileID.wrap*c),d=u*s.tileID.canonical.y;return{u_image:0,u_pattern_tl:r.tl,u_pattern_br:r.br,u_texsize:[a,l],u_pattern_size:r.displaySize,u_pattern_units_to_pixels:o?[n.transform.width,-1*n.transform.height]:[1/e.at(s,1,n.transform.tileZoom),1/e.at(s,1,n.transform.tileZoom)],u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(0,s,a,n,l,c),{u_matrix:t,u_emissive_strength:i,u_opacity:r}),bo=new Float32Array(e.ad.mat4.identity([])),wo=(t,i,r,n,o,s,a,l,c,u,h,d,p,f=[0,0,0],A)=>{const m=o.style.light,g=m.properties.get("position"),_=[-g.x,-g.y,g.z],y=e.ad.mat3.create();"viewport"===m.properties.get("anchor")&&(e.ad.mat3.fromRotation(y,-o.transform.angle),e.ad.vec3.transformMat3(_,_,y));const v="MASK"===h.alphaMode,x=m.properties.get("color").toRenderColor(null),b=p.paint.get("model-ambient-occlusion-intensity"),w=p.paint.get("model-color").constantOr(e.al.white).toRenderColor(null),T=p.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:t,u_lighting_matrix:i,u_normal_matrix:r,u_node_matrix:n||bo,u_lightpos:_,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[x.r,x.g,x.b],u_camera_pos:f,u_opacity:s,u_baseTextureIsAlpha:0,u_alphaMask:+v,u_alphaCutoff:h.alphaCutoff,u_baseColorFactor:[a.r,a.g,a.b,a.a],u_emissiveFactor:[l[0],l[1],l[2],1],u_metallicFactor:c,u_roughnessFactor:u,u_baseColorTexture:Ki.BaseColor,u_metallicRoughnessTexture:Ki.MetallicRoughness,u_normalTexture:Ki.Normal,u_occlusionTexture:Ki.Occlusion,u_emissionTexture:Ki.Emission,u_lutTexture:Ki.LUT,u_color_mix:[w.r,w.g,w.b,T],u_aoIntensity:b,u_emissive_strength:d,u_occlusionTextureTransform:A||[0,0,0,0]}},To=(e,t=bo,i=bo)=>({u_matrix:e,u_instance:t,u_node_matrix:i}),Bo={fillExtrusion:t=>({u_matrix:new e.bJ(t),u_lightpos:new e.bL(t),u_lightintensity:new e.bM(t),u_lightcolor:new e.bL(t),u_vertical_gradient:new e.bM(t),u_opacity:new e.bM(t),u_edge_radius:new e.bM(t),u_width_scale:new e.bM(t),u_ao:new e.bK(t),u_height_type:new e.bN(t),u_base_type:new e.bN(t),u_tile_id:new e.bL(t),u_zoom_transition:new e.bM(t),u_inv_rot_matrix:new e.bJ(t),u_merc_center:new e.bK(t),u_up_dir:new e.bL(t),u_height_lift:new e.bM(t),u_flood_light_color:new e.bL(t),u_vertical_scale:new e.bM(t),u_flood_light_intensity:new e.bM(t),u_ground_shadow_factor:new e.bL(t)}),fillExtrusionDepth:t=>({u_matrix:new e.bJ(t),u_edge_radius:new e.bM(t),u_width_scale:new e.bM(t),u_vertical_scale:new e.bM(t),u_height_type:new e.bN(t),u_base_type:new e.bN(t)}),fillExtrusionPattern:t=>({u_matrix:new e.bJ(t),u_lightpos:new e.bL(t),u_lightintensity:new e.bM(t),u_lightcolor:new e.bL(t),u_vertical_gradient:new e.bM(t),u_height_factor:new e.bM(t),u_edge_radius:new e.bM(t),u_width_scale:new e.bM(t),u_ao:new e.bK(t),u_height_type:new e.bN(t),u_base_type:new e.bN(t),u_tile_id:new e.bL(t),u_zoom_transition:new e.bM(t),u_inv_rot_matrix:new e.bJ(t),u_merc_center:new e.bK(t),u_up_dir:new e.bL(t),u_height_lift:new e.bM(t),u_image:new e.bN(t),u_texsize:new e.bK(t),u_pixel_coord_upper:new e.bK(t),u_pixel_coord_lower:new e.bK(t),u_tile_units_to_pixels:new e.bM(t),u_opacity:new e.bM(t)}),fillExtrusionGroundEffect:t=>({u_matrix:new e.bJ(t),u_opacity:new e.bM(t),u_ao_pass:new e.bM(t),u_meter_to_tile:new e.bM(t),u_ao:new e.bK(t),u_flood_light_intensity:new e.bM(t),u_flood_light_color:new e.bL(t),u_attenuation:new e.bM(t),u_edge_radius:new e.bM(t),u_fb:new e.bN(t),u_fb_size:new e.bM(t),u_dynamic_offset:new e.bM(t)}),fill:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t)}),fillPattern:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t),u_image:new e.bN(t),u_texsize:new e.bK(t),u_pixel_coord_upper:new e.bK(t),u_pixel_coord_lower:new e.bK(t),u_tile_units_to_pixels:new e.bM(t)}),fillOutline:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t),u_world:new e.bK(t)}),fillOutlinePattern:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t),u_world:new e.bK(t),u_image:new e.bN(t),u_texsize:new e.bK(t),u_pixel_coord_upper:new e.bK(t),u_pixel_coord_lower:new e.bK(t),u_tile_units_to_pixels:new e.bM(t)}),elevatedStructures:t=>({u_matrix:new e.bJ(t)}),elevatedStructuresDepthReconstruct:t=>({u_matrix:new e.bJ(t),u_camera_pos:new e.bL(t),u_depth_bias:new e.bM(t),u_height_scale:new e.bM(t),u_reset_depth:new e.bM(t)}),circle:e.cT,collisionBox:t=>({u_matrix:new e.bJ(t),u_camera_to_center_distance:new e.bM(t),u_extrude_scale:new e.bK(t)}),collisionCircle:t=>({u_matrix:new e.bJ(t),u_inv_matrix:new e.bJ(t),u_camera_to_center_distance:new e.bM(t),u_viewport_size:new e.bK(t)}),debug:t=>({u_color:new e.cA(t),u_matrix:new e.bJ(t),u_overlay:new e.bN(t),u_overlay_scale:new e.bM(t)}),clippingMask:t=>({u_matrix:new e.bJ(t)}),heatmap:t=>({u_extrude_scale:new e.bM(t),u_intensity:new e.bM(t),u_matrix:new e.bJ(t),u_inv_rot_matrix:new e.bJ(t),u_merc_center:new e.bK(t),u_tile_id:new e.bL(t),u_zoom_transition:new e.bM(t),u_up_dir:new e.bL(t)}),heatmapTexture:t=>({u_image:new e.bN(t),u_color_ramp:new e.bN(t),u_opacity:new e.bM(t)}),hillshade:t=>({u_matrix:new e.bJ(t),u_image:new e.bN(t),u_latrange:new e.bK(t),u_light:new e.bK(t),u_shadow:new e.cA(t),u_highlight:new e.cA(t),u_emissive_strength:new e.bM(t),u_accent:new e.cA(t)}),hillshadePrepare:t=>({u_matrix:new e.bJ(t),u_image:new e.bN(t),u_dimension:new e.bK(t),u_zoom:new e.bM(t)}),line:e.cU,linePattern:e.cV,raster:t=>({u_matrix:new e.bJ(t),u_normalize_matrix:new e.bJ(t),u_globe_matrix:new e.bJ(t),u_merc_matrix:new e.bJ(t),u_grid_matrix:new e.cB(t),u_tl_parent:new e.bK(t),u_scale_parent:new e.bM(t),u_fade_t:new e.bM(t),u_opacity:new e.bM(t),u_image0:new e.bN(t),u_image1:new e.bN(t),u_brightness_low:new e.bM(t),u_brightness_high:new e.bM(t),u_saturation_factor:new e.bM(t),u_contrast_factor:new e.bM(t),u_spin_weights:new e.bL(t),u_perspective_transform:new e.bK(t),u_raster_elevation:new e.bM(t),u_zoom_transition:new e.bM(t),u_merc_center:new e.bK(t),u_cutoff_params:new e.cb(t),u_colorization_mix:new e.cb(t),u_colorization_offset:new e.bM(t),u_color_ramp:new e.bN(t),u_texture_offset:new e.bK(t),u_texture_res:new e.bK(t),u_emissive_strength:new e.bM(t)}),rasterParticle:t=>({u_matrix:new e.bJ(t),u_normalize_matrix:new e.bJ(t),u_globe_matrix:new e.bJ(t),u_merc_matrix:new e.bJ(t),u_grid_matrix:new e.cB(t),u_tl_parent:new e.bK(t),u_scale_parent:new e.bM(t),u_fade_t:new e.bM(t),u_opacity:new e.bM(t),u_image0:new e.bN(t),u_image1:new e.bN(t),u_raster_elevation:new e.bM(t),u_zoom_transition:new e.bM(t),u_merc_center:new e.bK(t),u_cutoff_params:new e.cb(t)}),rasterParticleTexture:t=>({u_texture:new e.bN(t),u_opacity:new e.bM(t)}),rasterParticleDraw:t=>({u_particle_texture:new e.bN(t),u_particle_texture_side_len:new e.bM(t),u_tile_offset:new e.bK(t),u_velocity:new e.bN(t),u_color_ramp:new e.bN(t),u_velocity_res:new e.bK(t),u_max_speed:new e.bM(t),u_uv_offset:new e.bK(t),u_data_scale:new e.bK(t),u_data_offset:new e.bM(t),u_particle_pos_scale:new e.bM(t),u_particle_pos_offset:new e.bK(t)}),rasterParticleUpdate:t=>({u_particle_texture:new e.bN(t),u_particle_texture_side_len:new e.bM(t),u_velocity:new e.bN(t),u_velocity_res:new e.bK(t),u_max_speed:new e.bM(t),u_speed_factor:new e.bM(t),u_reset_rate:new e.bM(t),u_rand_seed:new e.bM(t),u_uv_offset:new e.bK(t),u_data_scale:new e.bK(t),u_data_offset:new e.bM(t),u_particle_pos_scale:new e.bM(t),u_particle_pos_offset:new e.bK(t)}),symbol:t=>({u_is_size_zoom_constant:new e.bN(t),u_is_size_feature_constant:new e.bN(t),u_size_t:new e.bM(t),u_size:new e.bM(t),u_camera_to_center_distance:new e.bM(t),u_rotate_symbol:new e.bN(t),u_aspect_ratio:new e.bM(t),u_fade_change:new e.bM(t),u_matrix:new e.bJ(t),u_label_plane_matrix:new e.bJ(t),u_coord_matrix:new e.bJ(t),u_is_text:new e.bN(t),u_elevation_from_sea:new e.bN(t),u_pitch_with_map:new e.bN(t),u_texsize:new e.bK(t),u_texsize_icon:new e.bK(t),u_texture:new e.bN(t),u_texture_icon:new e.bN(t),u_gamma_scale:new e.bM(t),u_device_pixel_ratio:new e.bM(t),u_tile_id:new e.bL(t),u_zoom_transition:new e.bM(t),u_inv_rot_matrix:new e.bJ(t),u_merc_center:new e.bK(t),u_camera_forward:new e.bL(t),u_tile_matrix:new e.bJ(t),u_up_vector:new e.bL(t),u_ecef_origin:new e.bL(t),u_is_halo:new e.bN(t),u_icon_transition:new e.bM(t),u_color_adj_mat:new e.bJ(t),u_scale_factor:new e.bM(t)}),background:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t),u_opacity:new e.bM(t),u_color:new e.cA(t)}),backgroundPattern:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t),u_opacity:new e.bM(t),u_image:new e.bN(t),u_pattern_tl:new e.bK(t),u_pattern_br:new e.bK(t),u_texsize:new e.bK(t),u_pattern_size:new e.bK(t),u_pixel_coord_upper:new e.bK(t),u_pixel_coord_lower:new e.bK(t),u_pattern_units_to_pixels:new e.bK(t)}),terrainRaster:t=>({u_matrix:new e.bJ(t),u_image0:new e.bN(t),u_skirt_height:new e.bM(t),u_ground_shadow_factor:new e.bL(t)}),skybox:t=>({u_matrix:new e.bJ(t),u_sun_direction:new e.bL(t),u_cubemap:new e.bN(t),u_opacity:new e.bM(t),u_temporal_offset:new e.bM(t)}),skyboxGradient:t=>({u_matrix:new e.bJ(t),u_color_ramp:new e.bN(t),u_center_direction:new e.bL(t),u_radius:new e.bM(t),u_opacity:new e.bM(t),u_temporal_offset:new e.bM(t)}),skyboxCapture:t=>({u_matrix_3f:new e.cB(t),u_sun_direction:new e.bL(t),u_sun_intensity:new e.bM(t),u_color_tint_r:new e.cb(t),u_color_tint_m:new e.cb(t),u_luminance:new e.bM(t)}),globeRaster:t=>({u_proj_matrix:new e.bJ(t),u_globe_matrix:new e.bJ(t),u_normalize_matrix:new e.bJ(t),u_merc_matrix:new e.bJ(t),u_zoom_transition:new e.bM(t),u_merc_center:new e.bK(t),u_image0:new e.bN(t),u_grid_matrix:new e.cB(t),u_skirt_height:new e.bM(t),u_far_z_cutoff:new e.bM(t),u_frustum_tl:new e.bL(t),u_frustum_tr:new e.bL(t),u_frustum_br:new e.bL(t),u_frustum_bl:new e.bL(t),u_globe_pos:new e.bL(t),u_globe_radius:new e.bM(t),u_viewport:new e.bK(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.bL(t),u_frustum_tr:new e.bL(t),u_frustum_br:new e.bL(t),u_frustum_bl:new e.bL(t),u_horizon:new e.bM(t),u_transition:new e.bM(t),u_fadeout_range:new e.bM(t),u_color:new e.cb(t),u_high_color:new e.cb(t),u_space_color:new e.cb(t),u_temporal_offset:new e.bM(t),u_horizon_angle:new e.bM(t)}),model:t=>({u_matrix:new e.bJ(t),u_lighting_matrix:new e.bJ(t),u_normal_matrix:new e.bJ(t),u_node_matrix:new e.bJ(t),u_lightpos:new e.bL(t),u_lightintensity:new e.bM(t),u_lightcolor:new e.bL(t),u_camera_pos:new e.bL(t),u_opacity:new e.bM(t),u_baseColorFactor:new e.cb(t),u_emissiveFactor:new e.cb(t),u_metallicFactor:new e.bM(t),u_roughnessFactor:new e.bM(t),u_baseTextureIsAlpha:new e.bN(t),u_alphaMask:new e.bN(t),u_alphaCutoff:new e.bM(t),u_baseColorTexture:new e.bN(t),u_metallicRoughnessTexture:new e.bN(t),u_normalTexture:new e.bN(t),u_occlusionTexture:new e.bN(t),u_emissionTexture:new e.bN(t),u_lutTexture:new e.bN(t),u_color_mix:new e.cb(t),u_aoIntensity:new e.bM(t),u_emissive_strength:new e.bM(t),u_occlusionTextureTransform:new e.cb(t)}),modelDepth:t=>({u_matrix:new e.bJ(t),u_instance:new e.bJ(t),u_node_matrix:new e.bJ(t)}),groundShadow:t=>({u_matrix:new e.bJ(t),u_ground_shadow_factor:new e.bL(t)}),stars:t=>({u_matrix:new e.bJ(t),u_up:new e.bL(t),u_right:new e.bL(t),u_intensity_multiplier:new e.bM(t)}),snowParticle:t=>({u_modelview:new e.bJ(t),u_projection:new e.bJ(t),u_time:new e.bM(t),u_cam_pos:new e.bL(t),u_velocityConeAperture:new e.bM(t),u_velocity:new e.bM(t),u_horizontalOscillationRadius:new e.bM(t),u_horizontalOscillationRate:new e.bM(t),u_boxSize:new e.bM(t),u_billboardSize:new e.bM(t),u_simpleShapeParameters:new e.bK(t),u_screenSize:new e.bK(t),u_thinningCenterPos:new e.bK(t),u_thinningShape:new e.bL(t),u_thinningAffectedRatio:new e.bM(t),u_thinningParticleOffset:new e.bM(t),u_particleColor:new e.cb(t),u_direction:new e.bL(t)}),rainParticle:t=>({u_modelview:new e.bJ(t),u_projection:new e.bJ(t),u_time:new e.bM(t),u_cam_pos:new e.bL(t),u_texScreen:new e.bN(t),u_velocityConeAperture:new e.bM(t),u_velocity:new e.bM(t),u_boxSize:new e.bM(t),u_rainDropletSize:new e.bK(t),u_distortionStrength:new e.bM(t),u_rainDirection:new e.bL(t),u_color:new e.cb(t),u_screenSize:new e.bK(t),u_thinningCenterPos:new e.bK(t),u_thinningShape:new e.bL(t),u_thinningAffectedRatio:new e.bM(t),u_thinningParticleOffset:new e.bM(t),u_shapeDirectionalPower:new e.bM(t),u_shapeNormalPower:new e.bM(t),u_mode:new e.bM(t)}),vignette:t=>({u_vignetteShape:new e.bL(t),u_vignetteColor:new e.cb(t)}),occlusion:t=>({u_matrix:new e.bJ(t),u_anchorPos:new e.bL(t),u_screenSizePx:new e.bK(t),u_occluderSizePx:new e.bK(t),u_color:new e.cb(t)})};class Co{constructor(e,t,i,r){this.id=Co.uniqueIdxCounter,Co.uniqueIdxCounter++,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||r||t.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=Co.uniqueIdxCounter,Co.uniqueIdxCounter++;const t=this.context.gl;this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Co.uniqueIdxCounter=0;const So={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Eo{constructor(e,t,i,r,n,o){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.instanceCount=o,this.context=e;const s=e.gl;this.buffer=s.createBuffer(),e.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||n||t.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i0&&e.vertexAttribDivisor(n,i)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Mo{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;const o=this.framebuffer=e.gl.createFramebuffer();r&&(this.colorAttachment=new Sn(e,o)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new En(e,o):new Mn(e,o))}destroy(){const e=this.context.gl;if(this.colorAttachment){const t=this.colorAttachment.get();t&&e.deleteTexture(t)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}else{const t=this.depthAttachment.get();t&&e.deleteTexture(t)}e.deleteFramebuffer(this.framebuffer)}}class Io{constructor(e,t){this.gl=e,this.clearColor=new qr(this),this.clearDepth=new Kr(this),this.clearStencil=new Wr(this),this.colorMask=new Xr(this),this.depthMask=new Yr(this),this.stencilMask=new Jr(this),this.stencilFunc=new en(this),this.stencilOp=new tn(this),this.stencilTest=new rn(this),this.depthRange=new nn(this),this.depthTest=new on(this),this.depthFunc=new sn(this),this.blend=new an(this),this.blendFunc=new ln(this),this.blendColor=new cn(this),this.blendEquation=new un(this),this.cullFace=new hn(this),this.cullFaceSide=new dn(this),this.frontFace=new pn(this),this.program=new fn(this),this.activeTexture=new An(this),this.viewport=new mn(this),this.bindFramebuffer=new gn(this),this.bindRenderbuffer=new _n(this),this.bindTexture=new yn(this),this.bindVertexBuffer=new vn(this),this.bindElementBuffer=new xn(this),this.bindVertexArrayOES=new bn(this),this.pixelStoreUnpack=new wn(this),this.pixelStoreUnpackPremultiplyAlpha=new Tn(this),this.pixelStoreUnpackFlipY=new Bn(this),this.options=t?Object.assign({},t):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=t&&!!t.forceManualRenderingForInstanceIDShaders||this.renderer&&-1!==this.renderer.indexOf("PowerVR"),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxPointSize=e.getParameter(e.ALIASED_POINT_SIZE_RANGE)[1]}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.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t,i){return new Co(this,e,t,i)}createVertexBuffer(e,t,i,r,n){return new Eo(this,e,t,i,r,n)}createRenderbuffer(e,t,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new Mo(this,e,t,i,r)}clear({color:e,depth:t,stencil:i,colorMask:r}){const n=this.gl;let o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set(r||[!0,!0,!0,!0])),void 0!==t&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(t){e.bn(t.blendFunction,Di.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Po;function Lo(t,i,r,n,o,s,a){const l=t.context,c=l.gl,u=t.transform,h=t.getOrCreateProgram("collisionBox"),d=[];let p=0,f=0;for(let l=0;l0){const t=e.ad.mat4.create(),i=y;e.ad.mat4.mul(t,g.placementInvProjMatrix,u.glCoordMatrix),e.ad.mat4.mul(t,t,g.placementViewportMatrix),d.push({circleArray:x,circleOffset:f,transform:i,invTransform:t,projection:g.getProjection()}),p+=x.length/4,f=p}v&&(t.terrain&&t.terrain.setupElevationDraw(m,h),h.draw(t,c.LINES,Oi.disabled,Ni.disabled,t.colorModeForRenderPass(),Vi.disabled,oo(y,u,m,g.getProjection()),r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,u.zoom,null,[v.collisionVertexBuffer,v.collisionVertexBufferExt]))}if(!a||!d.length)return;const A=t.getOrCreateProgram("collisionCircle"),m=new e.cW;m.resize(4*p),m._trim();let g=0;for(const e of d)for(let t=0;t=0&&(A[v.associatedIconIndex]={x:B,y:C,z:S,angle:L})}else ri(w,p)}if(h){f.clear();const i=t.icon.placedSymbolArray;for(let t=0;t{B.depthOcclusionForSymbolsAndCircles&&(r.hasInitialOcclusionOpacityProperties||t.terrain)&&(e.push("DEPTH_D24"),e.push("DEPTH_OCCLUSION"))},N=()=>{const i=C&&"point"!==r.layout.get("symbol-placement"),a=[];U(a);const c=i||L,h=r.paint.get("icon-image-cross-fade").constantOr(0);t.terrainRenderModeElevated()&&E&&a.push("PITCH_WITH_MAP_TERRAIN"),d&&(a.push("PROJECTION_GLOBE_VIEW"),c&&a.push("PROJECTED_POS_ON_VIEWPORT")),h>0&&a.push("ICON_TRANSITION"),s.icon.zOffsetVertexBuffer&&a.push("Z_OFFSET"),0===_&&0===y&&0===v&&1===x||a.push("COLOR_ADJUSTMENT"),s.sdfIcons&&a.push("RENDER_SDF");const g=s.icon.programConfigurations.get(r.id),w=t.getOrCreateProgram("symbol",{config:g,defines:a}),S=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],M=s.iconSizeData,I=e.bp(M,B.zoom),P=E||0!==B.pitch,k=Ht(f,n.tileID.canonical,E,C,B,s.getProjection(),A),R=$t(f,n.tileID.canonical,E,C,B,s.getProjection(),A),N=t.translatePosMatrix(R,n,l,u,!0),Q=t.translatePosMatrix(f,n,l,u),j=c?Fo:k,V=C&&!E&&!i;let H=D;!z&&!B.mercatorFromTransition||C||(H=ko(B));const G=d?H:D,$=r.getColorAdjustmentMatrix(_,y,v,x),Z=yo(M.kind,I,V,E,t,Q,j,N,b,!1,S,[0,0],!0,o,p,F,O,G,s.getProjection(),$,h),q=n.imageAtlasTexture?n.imageAtlasTexture:null,K=1!==r.layout.get("icon-size").constantOr(0)||s.iconsNeedLinear,W=s.sdfIcons||t.options.rotating||t.options.zooming||K||P?T.LINEAR:T.NEAREST,X=s.sdfIcons&&0!==r.paint.get("icon-halo-width").constantOr(1),Y=t.terrain&&E&&i?e.ad.mat4.invert(e.ad.mat4.create(),k):Fo;if(i&&s.icon){const e=B.elevation,i=e?e.getAtTileOffsetFunc(o,B.center.lat,B.worldSize,s.getProjection()):null,r=Gt(f,n.tileID.canonical,E,C,B,s.getProjection(),A);Wt(s,f,t,!1,r,R,E,m,i,o)}return{program:w,buffers:s.icon,uniformValues:Z,atlasTexture:q,atlasTextureIcon:null,atlasInterpolation:W,atlasInterpolationIcon:null,isSDF:s.sdfIcons,hasHalo:X,tile:n,labelPlaneMatrixInv:Y}},Q=()=>{const i=S&&"point"!==r.layout.get("symbol-placement"),a=[],l=i||k||L;t.terrainRenderModeElevated()&&M&&a.push("PITCH_WITH_MAP_TERRAIN"),d&&(a.push("PROJECTION_GLOBE_VIEW"),l&&a.push("PROJECTED_POS_ON_VIEWPORT")),s.text.zOffsetVertexBuffer&&a.push("Z_OFFSET"),s.iconsInText&&a.push("RENDER_TEXT_AND_SYMBOL"),a.push("RENDER_SDF"),U(a);const u=s.text.programConfigurations.get(r.id),m=t.getOrCreateProgram("symbol",{config:u,defines:a});let _,y=[0,0],v=null;const x=s.textSizeData;s.iconsInText&&(y=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],v=n.imageAtlasTexture?n.imageAtlasTexture:null,_=M||0!==B.pitch||t.options.rotating||t.options.zooming||"composite"===x.kind||"camera"===x.kind?T.LINEAR:T.NEAREST);const w=n.glyphAtlasTexture?n.glyphAtlasTexture.size:[0,0],C=r.layout.get("text-size-scale-range"),E=e.ay(t.scaleFactor,C[0],C[1]),I=e.bp(x,B.zoom,E),P=Ht(f,n.tileID.canonical,M,S,B,s.getProjection(),A),R=$t(f,n.tileID.canonical,M,S,B,s.getProjection(),A),N=t.translatePosMatrix(R,n,c,h,!0),Q=t.translatePosMatrix(f,n,c,h),j=l?Fo:P,V=S&&!M&&!i;let H=D;!z&&!B.mercatorFromTransition||S||(H=ko(B));const G=yo(x.kind,I,V,M,t,Q,j,N,b,!0,w,y,!0,o,p,F,O,d?H:D,s.getProjection(),null,null,E),$=n.glyphAtlasTexture?n.glyphAtlasTexture:null,Z=T.LINEAR,q=0!==r.paint.get("text-halo-width").constantOr(1),K=t.terrain&&M&&i?e.ad.mat4.invert(e.ad.mat4.create(),P):Fo;if(i&&s.text){const e=B.elevation,i=e?e.getAtTileOffsetFunc(o,B.center.lat,B.worldSize,s.getProjection()):null,r=Gt(f,n.tileID.canonical,M,S,B,s.getProjection(),A);Wt(s,f,t,!0,r,R,M,g,i,o)}return{program:m,buffers:s.text,uniformValues:G,atlasTexture:$,atlasTextureIcon:v,atlasInterpolation:Z,atlasInterpolationIcon:_,isSDF:!0,hasHalo:q,tile:n,labelPlaneMatrixInv:K}},j=s.icon.segments.get().length,V=s.text.segments.get().length,H=j&&!a.onlyText?N():null,G=V&&!a.onlyIcons?Q():null,$=r.paint.get("icon-opacity").constantOr(1),Z=r.paint.get("text-opacity").constantOr(1);if(I&&s.canOverlap){P=!0;const t=$&&!a.onlyText?s.icon.segments.get():[],i=Z&&!a.onlyIcons?s.text.segments.get():[];for(const i of t)R.push({segments:new e.b8([i]),sortKey:i.sortKey,state:H});for(const t of i)R.push({segments:new e.b8([t]),sortKey:t.sortKey,state:G})}else a.onlyText||R.push({segments:$?s.icon.segments:new e.b8([]),sortKey:0,state:H}),a.onlyIcons||R.push({segments:Z?s.text.segments:new e.b8([]),sortKey:0,state:G})}P&&R.sort(((e,t)=>e.sortKey-t.sortKey));for(const e of R){const i=e.state;if(i)if(t.terrain?t.terrain.setupElevationDraw(i.tile,i.program,{useDepthForOcclusion:B.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:i.labelPlaneMatrixInv}):t.setupDepthForOcclusion(B.depthOcclusionForSymbolsAndCircles,i.program),w.activeTexture.set(T.TEXTURE0),i.atlasTexture&&i.atlasTexture.bind(i.atlasInterpolation,T.CLAMP_TO_EDGE,!0),i.atlasTextureIcon&&(w.activeTexture.set(T.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,T.CLAMP_TO_EDGE,!0)),t.uploadCommonLightUniforms(t.context,i.program),i.hasHalo){const n=i.uniformValues;n.u_is_halo=1,Oo(i.buffers,e.segments,r,t,i.program,L,o,s,n,2),n.u_is_halo=0}else{if(i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Oo(i.buffers,e.segments,r,t,i.program,L,o,s,n,1)),n.u_is_halo=0}Oo(i.buffers,e.segments,r,t,i.program,L,o,s,i.uniformValues,1)}}}function Oo(e,t,i,r,n,o,s,a,l,c){const u=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer];n.draw(r,r.context.gl.TRIANGLES,o,s,a,Vi.disabled,l,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),u,c)}function Uo(t,i){const r=1<=Xi?1:i/Xi))),2*r}(t.transform),u=t.transform.getFreeCameraOptions().position,h="elevatedStructuresDepthReconstruct",d=t.getOrCreateProgram(h,{defines:["DEPTH_RECONSTRUCTION"]}),p=t.getOrCreateProgram(h);for(const e of n){const n=i.getTile(e),h=n.getBucket(r);if(!h)continue;const f=h.elevatedStructures;if(!f)continue;const A=h.elevationBufferData.heightRange,m=Uo(e.toUnwrapped(),u),g=t.translatePosMatrix(e.projMatrix,n,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));let _,y,v,x;if("initialize"===o){if(!A||A.min>=1||0===f.depthSegments.segments[0].primitiveLength)continue;_=no(g,m,c,1,0),y=a,v=f.depthSegments,x=d}else if("reset"===o){if(!A||A.min>=0||0===f.maskSegments.segments[0].primitiveLength)continue;_=no(g,m,0,0,1),y=l,v=f.maskSegments,x=d}else if("geometry"===o){if(0===f.depthSegments.segments[0].primitiveLength)continue;_=no(g,m,c,1,0),y=a,v=f.depthSegments,x=p}x.draw(t,s.TRIANGLES,y,Ni.disabled,Di.disabled,Vi.disabled,_,r.id,f.vertexBuffer,f.indexBuffer,v,r.paint,t.transform.zoom)}}function Qo(t,i,r){const{painter:n,sourceCache:o,layer:s,coords:a,colorMode:l,elevationType:c,terrainEnabled:u,pass:h}=t,d=n.context.gl,p=s.paint.get("fill-pattern");let f=c;"road"!==c||i&&!u||(f="none");const A="road"===f,m=new Oi(n.context.gl.LEQUAL,Oi.ReadWrite,n.depthRangeFor3D),g=p&&p.constantOr(1),_=(t,c)=>{let u,h,_,y,v;c?(h=g&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=d.LINES):(h=g?"fillPattern":"fill",u=d.TRIANGLES);for(const x of a){const a=o.getTile(x);if(g&&!a.patternsLoaded())continue;const b=a.getBucket(s);if(!b)continue;const w=i?b.elevationBufferData:b.bufferData;if(w.isEmpty())continue;n.prepareDrawTile();const T=w.programConfigurations.get(s.id),B=n.isTileAffectedByFog(x),C=[],S=[];A&&(C.push("ELEVATED_ROADS"),S.push(w.elevatedLayoutVertexBuffer));const E=n.getOrCreateProgram(h,{config:T,overrideFog:B,defines:C});g&&(n.context.activeTexture.set(d.TEXTURE0),a.imageAtlasTexture&&a.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),T.updatePaintBuffers());const M=p.constantOr(null);if(M&&a.imageAtlas){const t=a.imageAtlas,i=e.d0.from(M).getPrimary().scaleSelf(e.q.devicePixelRatio).toString(),r=t.patternPositions.get(i);r&&T.setConstantPatternPositions(r)}const I=n.translatePosMatrix(x.projMatrix,a,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor")),P=s.paint.get("fill-emissive-strength");if(c){y=w.lineIndexBuffer,v=w.lineSegments;const e=n.terrain&&n.terrain.renderingToTexture?n.terrain.drapeBufferSize:[d.drawingBufferWidth,d.drawingBufferHeight];_="fillOutlinePattern"===h&&g?ro(I,P,n,a,e):io(I,P,e)}else y=w.indexBuffer,v=w.triangleSegments,_=g?to(I,P,n,a):eo(I,P);n.uploadCommonUniforms(n.context,E,x.toUnwrapped()),E.draw(n,u,"none"!==f?m:t,r||n.stencilModeForClipping(x),l,Vi.disabled,_,s.id,w.layoutVertexBuffer,y,v,s.paint,n.transform.zoom,T,S)}};n.renderPass===h&&_(n.depthModeForSublayer(1,"opaque"===n.renderPass?Oi.ReadWrite:Oi.ReadOnly),!1),"none"===f&&"translucent"===n.renderPass&&s.paint.get("fill-antialias")&&_(n.depthModeForSublayer(s.getPaintProperty("fill-outline-color")?2:0,Oi.ReadOnly),!0)}function jo(t,i,r,n,o,s,a,l){r.resetLayerRenderingStats(t);const c=t.context,u=c.gl,h=t.transform,d=r.paint.get("fill-extrusion-pattern"),p=d.constantOr(1),f=r.paint.get("fill-extrusion-opacity"),A=t.style.enable3dLights(),m=r.paint.get(A&&!p?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),g=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),m],_=r.layout.get("fill-extrusion-edge-radius"),y=_>0&&!r.paint.get("fill-extrusion-rounded-roof"),v=y?0:_,x="globe"===h.projection.name?e.d6():0,b="globe"===h.projection.name,w=b?e.ag(h.zoom):0,T=[e.av(h.center.lng),e.aC(h.center.lat)],B="none"===r.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),C=r.paint.get("fill-extrusion-flood-light-color").toRenderColor(B?null:r.lut).toArray01().slice(0,3),S=r.paint.get("fill-extrusion-flood-light-intensity"),E=r.paint.get("fill-extrusion-vertical-scale"),M=0!==r.paint.get("fill-extrusion-line-width").constantOr(1),I=r.paint.get("fill-extrusion-height-alignment"),P=r.paint.get("fill-extrusion-base-alignment"),L=Ji(t,r.paint.get("fill-extrusion-cutoff-fade-range")),F=[];let k;b&&F.push("PROJECTION_GLOBE_VIEW"),g[0]>0&&F.push("FAUX_AO"),y&&F.push("ZERO_ROOF_RADIUS"),l&&F.push("HAS_CENTROID"),S>0&&F.push("FLOOD_LIGHT"),L.shouldRenderCutoff&&F.push("RENDER_CUTOFF"),M&&F.push("RENDER_WALL_MODE");const z="shadow"===t.renderPass,R=t.shadowRenderer,D=z&&!!R;t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!0);let O=[0,0,0];if(R){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(O=sr(t.style,e,i)),z||(F.push("RENDER_SHADOWS","DEPTH_TEXTURE"),R.useNormalOffset&&F.push("NORMAL_OFFSET")),k=F.concat(["SHADOWS_SINGLE_CASCADE"])}const U=D?"fillExtrusionDepth":p?"fillExtrusionPattern":"fillExtrusion",N=r.getLayerRenderingStats();for(const A of n){const n=i.getTile(A),m=n.getBucket(r);if(!m||m.projection.name!==h.projection.name)continue;let _=!1;R&&(_=0===R.getMaxCascadeForTile(A.toUnwrapped()));const y=t.isTileAffectedByFog(A),B=m.programConfigurations.get(r.id),D=t.getOrCreateProgram(U,{config:B,defines:_?k:F,overrideFog:y});if(t.terrain&&t.terrain.setupElevationDraw(n,D,{useMeterToDem:!0}),!m.centroidVertexBuffer){const e=D.attributes.a_centroid_pos;void 0!==e&&u.vertexAttrib2f(e,0,0)}!z&&R&&R.setupShadows(n.tileID.toUnwrapped(),D,"vector-tile",n.tileID.overscaledZ),p&&(t.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),B.updatePaintBuffers());const Q=d.constantOr(null);if(Q&&n.imageAtlas){const t=n.imageAtlas,i=e.d0.from(Q).getPrimary().scaleSelf(e.q.devicePixelRatio),r=t.patternPositions.get(i.toString());r&&B.setConstantPatternPositions(r)}const j=r.paint.get("fill-extrusion-vertical-gradient"),V=1/m.tileToMeter;let H;if(z&&R){if(qo(n.tileID,m,t))continue;const e=R.calculateShadowPassMatrixFromTile(n.tileID.toUnwrapped());H=Yn(e,v,V,E,I,P)}else{const e=t.translatePosMatrix(A.expandedProjMatrix,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),i=h.projection.createInversionMatrix(h,A.canonical);H=p?Jn(e,t,j,f,g,v,V,A,n,x,I,P,w,T,i,C,E):Xn(e,t,j,f,g,v,V,A,x,I,P,w,T,i,C,E,S,O)}t.uploadCommonUniforms(c,D,A.toUnwrapped(),null,L);let G=m.segments;if("mercator"===h.projection.name&&!z&&(G=m.getVisibleSegments(n.tileID,t.terrain,t.transform.getFrustum(0)),!G.get().length))continue;if(N)if(z)for(const e of G.get())N.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(const e of G.get())N.numRenderedVerticesInTransparentPass+=e.primitiveLength;const $=[];(t.terrain||l)&&$.push(m.centroidVertexBuffer),b&&$.push(m.layoutVertexExtBuffer),M&&$.push(m.wallVertexBuffer),D.draw(t,c.gl.TRIANGLES,o,s,a,Vi.backCCW,H,r.id,m.layoutVertexBuffer,m.indexBuffer,G,r.paint,t.transform.zoom,B,$)}t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!1)}function Vo(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y){const v=t.context,x=v.gl,b=t.transform,w=t.transform.zoom,T=[],B=Ji(t,r.paint.get("fill-extrusion-cutoff-fade-range"));"clear"===u?(T.push("CLEAR_SUBPASS"),y&&(T.push("CLEAR_FROM_TEXTURE"),v.activeTexture.set(x.TEXTURE0),y.bind(x.LINEAR,x.CLAMP_TO_EDGE))):"sdf"===u&&T.push("SDF_SUBPASS"),g&&T.push("HAS_CENTROID"),B.shouldRenderCutoff&&T.push("RENDER_CUTOFF");const C=r.layout.get("fill-extrusion-edge-radius"),S=(e,i,n,u,_)=>{const x=i.programConfigurations.get(r.id),b=t.isTileAffectedByFog(e),S=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:x,defines:T,overrideFog:b}),E=((e,t,i,r,n,o,s,a,l,c,u)=>({u_matrix:t,u_opacity:i,u_ao_pass:r?1:0,u_meter_to_tile:n,u_ao:o,u_flood_light_intensity:s,u_flood_light_color:a,u_attenuation:l,u_edge_radius:c,u_fb:0,u_fb_size:u,u_dynamic_offset:1}))(0,u,h,c,_,[d,p*_],f,A,m,w>=17?0:C*_,y?y.size[0]:0),M=[];g&&M.push(i.hiddenByLandmarkVertexBuffer),t.uploadCommonUniforms(v,S,e.toUnwrapped(),null,B),S.draw(t,v.gl.TRIANGLES,o,s,a,l,E,r.id,i.vertexBuffer,i.indexBuffer,n,r.paint,w,x,M)};for(const o of n){const n=i.getTile(o),s=n.getBucket(r);if(!s||s.projection.name!==b.projection.name||!s.groundEffect||s.groundEffect&&!s.groundEffect.hasData())continue;const a=s.groundEffect,l=1/s.tileToMeter;{const e=t.translatePosMatrix(o.projMatrix,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),i=a.getDefaultSegment();S(o,a,i,e,l)}if(_)for(let s=0;s<4;s++){const a=e.d7[s](o),c=i.getTile(a);if(!c)continue;const u=c.getBucket(r);if(!u||u.projection.name!==b.projection.name||!u.groundEffect||u.groundEffect&&!u.groundEffect.hasData())continue;const h=u.groundEffect;let d,p;0===s?(d=[-e.ai,0,0],p=1):1===s?(d=[e.ai,0,0],p=0):2===s?(d=[0,-e.ai,0],p=3):(d=[0,e.ai,0],p=2);const f=h.regionSegments[p];if(!f)continue;const A=new Float32Array(16);e.ad.mat4.translate(A,o.projMatrix,d),S(o,h,f,t.translatePosMatrix(A,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),l)}}}function Ho(t,i,r,n,o,s,a){0===n.centroidVertexArray.length&&n.createCentroidsBuffer();const l=s?s.findDEMTileFor(r):null;if(!(l&&l.dem||a))return;s&&l&&l.dem&&n.selfDEMTileTimestamp!==l.dem._timestamp&&(n.borderDoneWithNeighborZ=[-1,-1,-1,-1],n.selfDEMTileTimestamp=l.dem._timestamp);const c=t=>new e.P(Math.ceil((t+e.da)*e.db),0),u=e=>{const t=i.getSource().minzoom,r=e=>{const t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(o)},n=[0,-1,1];for(const i of n){if(e.overscaledZ+i(h[0]=Math.min(t.min.y,i.min.y),h[1]=Math.max(t.max.y,i.max.y),h[2]=e.ai-i.min.x>t.max.x?i.min.x-e.ai:t.max.x,h),p=(t,i)=>(h[0]=Math.min(t.min.x,i.min.x),h[1]=Math.max(t.max.x,i.max.x),h[2]=e.ai-i.min.y>t.max.y?i.min.y-e.ai:t.max.y,h),f=[(e,t)=>d(e,t),(e,t)=>d(t,e),(e,t)=>p(e,t),(e,t)=>p(t,e)],A=(t,i,n,o,a,c,u)=>{if(!s)return 0;const h=[[c?n:t,c?t:n,0],[c?n:i,c?i:n,0]],d=u<0?e.ai+u:u,p=[c?d:(t+i)/2,c?(t+i)/2:d,0];return 0===n&&u<0||0!==n&&u>0?s.getForTilePoints(a,[p],!0,o):h.push(p),s.getForTilePoints(r,h,!0,l),Math.max(h[0][2],h[1][2],p[2])/s.exaggeration()};for(let t=0;t<4;t++){const i=n.borderFeatureIndices[t];if(0===i.length)continue;const o=e.d7[t](r),l=u(o);if(!(l&&l instanceof e.d8))continue;const h=s?s.findDEMTileFor(o):null;if(!(h&&h.dem||a))continue;if(s&&h&&h.dem&&n.borderDEMTileTimestamp[t]!==h.dem._timestamp&&(n.borderDoneWithNeighborZ[t]=-1,n.borderDEMTileTimestamp[t]=h.dem._timestamp),n.borderDoneWithNeighborZ[t]===l.canonical.z)continue;0===l.centroidVertexArray.length&&l.createCentroidsBuffer();const d=(t<2?1:5)-t,p=l.borderDoneWithNeighborZ[d]!==n.canonical.z,_=l.borderFeatureIndices[d];let y=0;if(n.canonical.z!==l.canonical.z){for(const e of i)n.showCentroid(n.featuresOnBorder[e]);if(p)for(const e of _)l.showCentroid(l.featuresOnBorder[e]);n.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[d]=n.canonical.z}for(const r of i){const i=n.featuresOnBorder[r],s=n.centroidData[i.centroidDataIndex],u=i.borders[t];let p;for(;y<_.length;){p=l.featuresOnBorder[_[y]];const e=p.borders[d];if(e[1]>u[0]+3||e[0]>u[0]-3)break;l.showCentroid(p),y++}if(p&&y<_.length){const r=y;let v=0;for(;!(p.borders[d][0]>u[1]-3)&&(v++,++y!==_.length);)p=l.featuresOnBorder[_[y]];p=l.featuresOnBorder[_[r]];let x=!1;if(v>=1){const e=p.borders[d];Math.abs(u[0]-e[0])<3&&Math.abs(u[1]-e[1])<3&&(v=1,x=!0,y=r+1)}else if(0===v){n.showCentroid(i);continue}const b=l.centroidData[p.centroidDataIndex];a&&x&&(((m=s).flags|(g=b).flags)&e.d9?(m.flags|=e.d9,g.flags|=e.d9):(m.flags&=~e.d9,g.flags&=~e.d9));const w=i.intersectsCount()>1||p.intersectsCount()>1;if(v>1)y=r,s.centroidXY=b.centroidXY=new e.P(0,0);else if(h&&h.dem&&!w){const i=f[t](s,b),r=t%2?e.ai-1:0,n=A(i[0],Math.min(e.ai-1,i[1]),r,h,o,t<2,i[2]);s.centroidXY=b.centroidXY=c(n)}else w?s.centroidXY=b.centroidXY=new e.P(0,0):(s.centroidXY=n.encodeBorderCentroid(i),b.centroidXY=l.encodeBorderCentroid(p));n.writeCentroidToBuffer(s),l.writeCentroidToBuffer(b)}else n.showCentroid(i)}n.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[d]=n.canonical.z}var m,g;(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(t)}const Go=[1,0,0],$o=[0,1,0],Zo=[0,0,1];function qo(t,i,r){const n=r.transform,o=r.shadowRenderer;if(!o)return!0;const s=t.toUnwrapped(),a=n.tileSize*o._cascades[r.currentShadowCascade].scale;let l=i.maxHeight;if(n.elevation){const e=n.elevation.getMinMaxForTile(t);e&&(l+=e.max)}const c=[...o.shadowDirection];c[2]=-c[2];const u=o.computeSimplifiedTileShadowVolume(s,l,a,c);if(!u)return!1;const h=[Go,$o,Zo,c,[c[0],0,c[2]],[0,c[1],c[2]]],d="globe"===n.projection.name,p=n.scaleZoom(a),f=e.bR.fromInvProjectionMatrix(n.invProjMatrix,n.worldSize,p,!d),A=o.getCurrentCascadeFrustum();return 0===f.intersectsPrecise(u.vertices,u.planes,h)||0===A.intersectsPrecise(u.vertices,u.planes,h)}function Ko(t){return[t[0]*e.dc,t[1]*e.dc,t[2]*e.dc,0]}function Wo(t,i,r,n,o,s,a,l,c){const u=n.getSource(),h=r.globeSharedBuffers;if(!h)return;let d,p,f;if(i&&(d=n.getTile(i)),u instanceof e.aK?(p=u.texture,f=e.cJ(0,0,r.transform)):d&&i&&(p=d.texture,f=e.cJ(i.canonical.z,i.canonical.x,r.transform)),!p||!f)return;t||(f=e.ad.mat4.scale(e.ad.mat4.create(),f,[1,-1,1]));const A=r.context,m=A.gl,g="nearest"===o.paint.get("raster-resampling")?m.NEAREST:m.LINEAR,_=r.colorModeForDrapableLayerRenderPass(s),y=a.defines;y.push("GLOBE_POLES");const v=new Oi(m.LEQUAL,Oi.ReadWrite,r.depthRangeFor3D),x=Float32Array.from(r.transform.expandedFarZProjMatrix),b=Float32Array.from(e.bc(e.cI(new e.bT(0,0,0))));r.terrain&&r.terrain.prepareDrawTile(),A.activeTexture.set(m.TEXTURE0),p.bind(g,m.CLAMP_TO_EDGE),A.activeTexture.set(m.TEXTURE1),p.bind(g,m.CLAMP_TO_EDGE),"useMipmap"in p&&A.extTextureFilterAnisotropic&&r.transform.pitch>20&&m.texParameterf(m.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const[w,T,B,C]=i?h.getPoleBuffers(i.canonical.z,!1):h.getPoleBuffers(0,!0),S=o.paint.get("raster-elevation");let E;t?(E=w,r.renderDefaultNorthPole=0!==S):(E=T,r.renderDefaultSouthPole=0!==S);const M=Ko(a.mix),I=((e,t,i,r,n,o,s,a,l,c,u,h,d)=>ho(e,t,i,new Float32Array(16),new Float32Array(9),[0,0],r,[0,0],[0,0,0,0],1,{opacity:1,mix:0},o,[0,0]||[0,0],a,2,c,u,h,1,0,d))(x,b,f,e.ag(r.transform.zoom),0,o,0,S,0,M,a.offset,a.range,s),P=r.getOrCreateProgram("raster",{defines:y});r.uploadCommonUniforms(A,P,null),P.draw(r,m.TRIANGLES,v,c,_,l,I,o.id,E,B,C)}function Xo(e){const t=e._nearZ,i=e.projection.farthestPixelDistance(e),r=i-t,n=.2*e.height,o=t+n;return[t,i,(o-n-t)/r,(o-t)/r]}function Yo(e,t,i,r){if(e)return t instanceof rt&&e instanceof bt?t.getTextureDescriptor(e,i,!0):{texture:e.texture,mix:Ko(r.mix),offset:r.offset,buffer:0,tileSize:1}}var Jo=e.dd([{name:"a_index",type:"Int16",components:1}]);class es{constructor(t,i,r,n){const o={width:r[0],height:r[1],data:null},s=t.gl;this.targetColorTexture=new e.T(t,o,s.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new e.T(t,o,s.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(i,n),this.lastInvalidatedAt=0}updateParticleTexture(t,i){if(this.particleTextureDimension===i.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const r=this.context.gl,n=i.width*i.height;this.particleTexture0=new e.T(this.context,i,r.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new e.T(this.context,i,r.RGBA8,{premultiply:!1,useMipmap:!1});const o=new e.de;o.reserve(n);for(let e=0;e0){const t=e.bb(r.canonical,c),i=e.dg(t);p=e.ad.mat4.multiply(new Float32Array(16),c.globeMatrix,i),e.ad.mat4.multiply(p,c.projMatrix,p)}const f=e.ad.mat4.create();f[12]+=2*o/(e.q.devicePixelRatio*c.width),f[13]+=2*s/(e.q.devicePixelRatio*c.height),e.ad.mat4.multiply(p,f,p);const A=t.getOrCreateProgram("debug",{defines:d}),m=i.getTileByID(r.key);t.terrain&&t.terrain.setupElevationDraw(m,A);const g=Oi.disabled,_=Ni.disabled,y=t.colorModeForRenderPass(),v="$debug";l.activeTexture.set(u.TEXTURE0),t.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),h?m._makeGlobeTileDebugBuffers(t.context,c):m._makeDebugTileBoundsBuffers(t.context,c.projection);const x=m._tileDebugBuffer||t.debugBuffer,b=m._tileDebugIndexBuffer||t.debugIndexBuffer,w=m._tileDebugSegments||t.debugSegments;if(A.draw(t,u.LINE_STRIP,g,_,y,Vi.disabled,so(p,n),v,x,b,w,null,null,null,[m._globeTileDebugBorderBuffer]),a){const e=m.latestRawTileData,i=Math.floor((e&&e.byteLength||0)/1024);let n=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(n+=` => ${r.overscaledZ}`),n+=` ${m.state}`,n+=` ${i}kb`,function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,n)}const T=i.getTile(r).tileSize,B=512/Math.min(T,512)*(r.overscaledZ/c.zoom)*.5,C=m._tileDebugTextBuffer||t.debugBuffer,S=m._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,E=m._tileDebugTextSegments||t.debugSegments;A.draw(t,u.TRIANGLES,g,_,Di.alphaBlended,Vi.disabled,so(p,e.al.transparent,B),v,C,S,E,null,null,null,[m._globeTileDebugTextBuffer])}function cs(e,t,i,r){hs(e,0,t+i/2,e.transform.width,i,r)}function us(e,t,i,r){hs(e,t-i/2,0,i,e.transform.height,r)}function hs(t,i,r,n,o,s){const a=t.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.q.devicePixelRatio,r*e.q.devicePixelRatio,n*e.q.devicePixelRatio,o*e.q.devicePixelRatio),a.clear({color:s}),l.disable(l.SCISSOR_TEST)}const ds=e.dd([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:ps}=ds;function fs(e,t,i,r){e.emplaceBack(t,i,r)}class As{constructor(t){this.vertexArray=new e.dh,this.indices=new e.aV,fs(this.vertexArray,-1,-1,1),fs(this.vertexArray,1,-1,1),fs(this.vertexArray,-1,1,1),fs(this.vertexArray,1,1,1),fs(this.vertexArray,-1,-1,-1),fs(this.vertexArray,1,-1,-1),fs(this.vertexArray,-1,1,-1),fs(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,ps),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.b8.simpleSegment(0,0,36,12)}}function ms(t,i,r,n,o,s){const a=t.context.gl,l=i.paint.get("sky-atmosphere-color"),c=i.paint.get("sky-atmosphere-halo-color"),u=i.paint.get("sky-atmosphere-sun-intensity"),h=((e,t,i,r,n)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[r.r,r.g,r.b,r.a],u_color_tint_m:[n.r,n.g,n.b,n.a],u_luminance:5e-5}))(e.ad.mat3.fromMat4(e.ad.mat3.create(),n),o,u,l,c);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+s,i.skyboxTexture,0),r.draw(t,a.TRIANGLES,Oi.disabled,Ni.disabled,Di.unblended,Vi.frontCW,h,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const gs=e.dd([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class _s{constructor(t){const i=new e.di;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const r=new e.aV;r.emplaceBack(0,1,2),r.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(i,gs.members),this.indexBuffer=t.createIndexBuffer(r),this.segments=e.b8.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const ys=e.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class vs{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class xs{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Di([1,Ri,1,Ri],e.al.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Di([1,0,1,0],e.al.transparent,[!1,!1,!1,!0]),this.params=new vs,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},(()=>{this.updateNeeded=!0})),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0})),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0}))}update(t){const i=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new _s(i);const t=this.params.sizeRange,r=this.params.intensityRange,n=function(t){const i=e.dl(30),r=[];for(let n=0;n{const i="globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];e&&i.push("ALPHA_PASS");const l=t.getOrCreateProgram("globeAtmosphere",{defines:i}),c=((e,t,i,r,n,o,s,a,l,c,u,h)=>({u_frustum_tl:e,u_frustum_tr:t,u_frustum_br:i,u_frustum_bl:r,u_horizon:n,u_transition:o,u_fadeout_range:s,u_color:a,u_high_color:l,u_space_color:c,u_temporal_offset:u,u_horizon_angle:h}))(o.frustumCorners.TL,o.frustumCorners.TR,o.frustumCorners.BR,o.frustumCorners.BL,o.frustumCorners.horizon,a,m,u,d,f,_,x);t.uploadCommonUniforms(r,l);const h=this.atmosphereBuffer;h&&l.draw(t,n.TRIANGLES,s,Ni.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Vi.backCW,c,e?"atmosphere_glow_alpha":"atmosphere_glow",h.vertexBuffer,h.indexBuffer,h.segments)};b(!1),b(!0)}drawStars(t,i){const r=e.ay(i.properties.get("star-intensity"),0,1);if(0===r)return;const n=t.context,o=n.gl,s=t.transform,a=t.getOrCreateProgram("stars"),l=e.ad.quat.identity([]);e.ad.quat.rotateX(l,l,-s._pitch),e.ad.quat.rotateZ(l,l,-s.angle),e.ad.quat.rotateX(l,l,e.ak(s._center.lat)),e.ad.quat.rotateY(l,l,-e.ak(s._center.lng));const c=e.ad.mat4.fromQuat(new Float32Array(16),l),u=e.ad.mat4.multiply([],s.starsProjMatrix,c),h=e.ad.mat3.fromMat4([],c),d=e.ad.mat3.invert([],h),p=[0,1,0];e.ad.vec3.transformMat3(p,p,d),e.ad.vec3.scale(p,p,this.params.sizeMultiplier);const f=[1,0,0];e.ad.vec3.transformMat3(f,f,d),e.ad.vec3.scale(f,f,this.params.sizeMultiplier);const A=(m=p,g=f,_=r,{u_matrix:Float32Array.from(u),u_up:m,u_right:g,u_intensity_multiplier:_});var m,g,_;t.uploadCommonUniforms(n,a),this.starsVx&&this.starsIdx&&a.draw(t,o.TRIANGLES,Oi.disabled,Ni.disabled,this.colorModeAlphaBlendedWriteRGB,Vi.disabled,A,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function bs(t,i){const r=[...t],n=i.cameraWorldSizeForFog/i.worldSize,o=e.ad.mat4.identity([]);return e.ad.mat4.scale(o,o,[n,n,1]),e.ad.mat4.multiply(r,o,r),e.ad.mat4.multiply(r,i.worldToFogMatrix,r),r}function ws(t,i,r,n,o){const s=r.material,a=n.context,{baseColorTexture:l,metallicRoughnessTexture:c}=s.pbrMetallicRoughness,{normalTexture:u,occlusionTexture:h,emissionTexture:d}=s;function p(e,i,r){if(e&&(t.push(i),a.activeTexture.set(a.gl.TEXTURE0+r),e.gfxTexture)){const{minFilter:t,magFilter:i,wrapS:r,wrapT:n}=e.sampler;e.gfxTexture.bindExtraParam(t,i,r,n)}}p(l,"HAS_TEXTURE_u_baseColorTexture",Ki.BaseColor),p(c,"HAS_TEXTURE_u_metallicRoughnessTexture",Ki.MetallicRoughness),p(u,"HAS_TEXTURE_u_normalTexture",Ki.Normal),p(h,"HAS_TEXTURE_u_occlusionTexture",Ki.Occlusion),p(d,"HAS_TEXTURE_u_emissionTexture",Ki.Emission),o&&(o.texture||(o.texture=new e.dn(n.context,o.image,[o.image.height,o.image.height,o.image.height],a.gl.RGBA8)),a.activeTexture.set(a.gl.TEXTURE0+Ki.LUT),o.texture&&o.texture.bind(a.gl.LINEAR,a.gl.CLAMP_TO_EDGE),t.push("APPLY_LUT_ON_GPU")),r.texcoordBuffer&&(t.push("HAS_ATTRIBUTE_a_uv_2f"),i.push(r.texcoordBuffer)),r.colorBuffer&&(t.push(12===r.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),i.push(r.colorBuffer)),r.normalBuffer&&(t.push("HAS_ATTRIBUTE_a_normal_3f"),i.push(r.normalBuffer)),r.pbrBuffer&&(t.push("HAS_ATTRIBUTE_a_pbr"),t.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),i.push(r.pbrBuffer)),"OPAQUE"!==s.alphaMode&&"MASK"!==s.alphaMode||t.push("UNPREMULT_TEXTURE_IN_SHADER"),s.defined||t.push("DIFFUSE_SHADED");const f=n.shadowRenderer;f&&(t.push("RENDER_SHADOWS","DEPTH_TEXTURE"),f.useNormalOffset&&t.push("NORMAL_OFFSET"))}function Ts(t,i,r,n,o,s){const a=r.paint.get("model-opacity").constantOr(1),l=i.context,c=new Oi(i.context.gl.LEQUAL,Oi.ReadWrite,i.depthRangeFor3D),u=i.transform,h=t.mesh,d=h.material,p=d.pbrMetallicRoughness,f=i.style.fog;let A;A="pixels"===i.transform.projection.zAxisUnit?[...t.nodeModelMatrix]:e.ad.mat4.multiply([],n.zScaleMatrix,t.nodeModelMatrix),e.ad.mat4.multiply(A,n.negCameraPosMatrix,A);const m=e.ad.mat4.invert([],A);e.ad.mat4.transpose(m,m);const g="none"===r.paint.get("model-color-use-theme").constantOr("default"),_=r.paint.get("model-emissive-strength").constantOr(0),y=wo(new Float32Array(t.worldViewProjection),new Float32Array(A),new Float32Array(m),null,i,a,p.baseColorFactor.toRenderColor(null),d.emissiveFactor,p.metallicFactor,p.roughnessFactor,d,_,r),v={defines:[]},x=[],b=i.shadowRenderer;b&&(b.useNormalOffset=!1),ws(v.defines,x,h,i,g?null:r.lut);let w=null;if(f){const e=bs(t.nodeModelMatrix,i.transform);if(w=new Float32Array(e),"globe"!==u.projection.name){const t=h.aabb.min,i=h.aabb.max,[r,n]=f.getOpacityForBounds(e,t[0],t[1],i[0],i[1]);v.overrideFog=r>=Re||n>=Re}}const T=Ji(i,r.paint.get("model-cutoff-fade-range"));T.shouldRenderCutoff&&v.defines.push("RENDER_CUTOFF");const B=i.getOrCreateProgram("model",v);i.uploadCommonUniforms(l,B,null,w,T),"shadow"!==i.renderPass&&b&&b.setupShadowsFromMatrix(t.nodeModelMatrix,B),B.draw(i,l.gl.TRIANGLES,c,o,s,h.material.doubleSided?Vi.disabled:Vi.backCCW,y,r.id,h.vertexBuffer,h.indexBuffer,h.segments,r.paint,i.transform.zoom,void 0,x)}function Bs(t,i,r,n,o,s,a){let l;l="globe"===t.projection.name?e.dp(r,t):[...r],e.ad.mat4.multiply(l,l,i.matrix);const c=e.ad.mat4.multiply([],n,l);if(i.meshes)for(const r of i.meshes){if("BLEND"!==r.material.alphaMode){a.push({mesh:r,depth:0,modelIndex:o,worldViewProjection:c,nodeModelMatrix:l});continue}const i=e.ad.vec3.transformMat4([],r.centroid,c);!t.isOrthographic&&i[2]<=0||s.push({mesh:r,depth:i[2],modelIndex:o,worldViewProjection:c,nodeModelMatrix:l})}if(i.children)for(const e of i.children)Bs(t,e,r,n,o,s,a)}function Cs(e,t,i,r){const n=i.shadowRenderer;if(!n)return;const o=n.getShadowPassDepthMode(),s=n.getShadowPassColorMode(),a=n.calculateShadowPassMatrixFromMatrix(t),l=To(a);i.getOrCreateProgram("modelDepth",{defines:i._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(i,i.context.gl.TRIANGLES,o,Ni.disabled,s,Vi.backCCW,l,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,void 0)}function Ss(t,i,r){const n=i.updateZoomBasedPaintProperties(),o=function(t,i,r){let n,o,s,a=t.terrain?t.terrain.exaggeration():0;if(t.terrain&&a>0){const i=t.terrain,o=i.findDEMTileFor(r);o&&o.dem?n=e.dr.create(i,r,o):a=0}if(0===a&&(i.terrainElevationMin=0,i.terrainElevationMax=0),a===i.validForExaggeration&&(0===a||n&&n._demTile&&n._demTile.tileID===i.validForDEMTile.id&&n._dem._timestamp===i.validForDEMTile.timestamp))return!1;for(const e in i.instancesPerModel){const t=i.instancesPerModel[e];for(let e=0;eu&&(u=e.max)}const h=e.ay(n.x,s,a)-n.x,d=e.ay(n.y,l,c)-n.y,p=e.bH(u,i.center.lat)-n.z;return i._zoomFromMercatorZ(Math.sqrt(h*h+d*d+p*p))}function Is(e,t,i,r,n,o,s){const a=e.context,l="shadow"===e.renderPass,c=e.shadowRenderer,u=l&&c?c.getShadowPassDepthMode():new Oi(a.gl.LEQUAL,Oi.ReadWrite,e.depthRangeFor3D),h=e.isTileAffectedByFog(o);if(i.meshes)for(const d of i.meshes){const p=["MODEL_POSITION_ON_GPU"],f=[];let A,m,g;r.instancedDataArray.length>20&&p.push("INSTANCED_ARRAYS");const _=Ji(e,t.paint.get("model-cutoff-fade-range"));if(_.shouldRenderCutoff&&p.push("RENDER_CUTOFF"),l&&c)A=e.getOrCreateProgram("modelDepth",{defines:p}),m=To(s.shadowTileMatrix,s.shadowTileMatrix,Float32Array.from(i.matrix)),g=c.getShadowPassColorMode();else{ws(p,f,d,e,"none"===t.paint.get("model-color-use-theme").constantOr("default")?null:t.lut),A=e.getOrCreateProgram("model",{defines:p,overrideFog:h});const r=d.material,l=r.pbrMetallicRoughness,u=t.paint.get("model-opacity").constantOr(1),y=t.paint.get("model-emissive-strength").constantOr(0);m=wo(o.expandedProjMatrix,Float32Array.from(i.matrix),new Float32Array(16),null,e,u,l.baseColorFactor.toRenderColor(null),r.emissiveFactor,l.metallicFactor,l.roughnessFactor,r,y,t,n),c&&(s.shadowUniformsInitialized?A.setShadowUniformValues(a,c.getShadowUniformValues()):(c.setupShadows(o.toUnwrapped(),A,"model-tile",o.overscaledZ),s.shadowUniformsInitialized=!0)),g=_.shouldRenderCutoff||u<1||"OPAQUE"!==r.alphaMode?Di.alphaBlended:Di.unblended}e.uploadCommonUniforms(a,A,o.toUnwrapped(),null,_);const y=d.material.doubleSided?Vi.disabled:Vi.backCCW;if(r.instancedDataArray.length>20)f.push(r.instancedDataBuffer),A.draw(e,a.gl.TRIANGLES,u,Ni.disabled,g,y,m,t.id,d.vertexBuffer,d.indexBuffer,d.segments,t.paint,e.transform.zoom,void 0,f,r.instancedDataArray.length);else{const i=l?"u_instance":"u_normal_matrix";for(let n=0;nc[1]?a:c,s[0]=r.max[0],a=e.ad.vec4.transformMat4(e.ad.vec4.create(),s,o),l=a[1]c[1]?a:c,s[1]=r.min[1],a=e.ad.vec4.transformMat4(e.ad.vec4.create(),s,o),l=a[1]c[1]?a:c;const u=e.ay(n[0],0,1),h=100*i.pixelsPerMeter*e.ay(n[1],0,1),d=e.ay(n[2],0,1),p=e.ad.vec4.lerp(e.ad.vec4.create(),l,c,u),f=Math.tan(.5*i.fovX),A=-p[2]*f;if(0===h)return p[1]<-Math.abs(A)?d:1;const m=(-Math.abs(A)-p[1])/h,g=(e,t,i)=>(1-i)*e+i*t,_=e.ay(g(1,d,m),d,1);return g(1,_,e.ay((i.pitch-20)/20,0,1))}class zs{}class Rs{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,i,r){{const e=this._storage.get(i.id);if(e)return e.lastUsedFrameIdx=t,e.buf}const n=r.gl,o=n.getBufferParameter(n.ELEMENT_ARRAY_BUFFER,n.BUFFER_SIZE),s=new ArrayBuffer(o),a=new Int16Array(s);n.getBufferSubData(n.ELEMENT_ARRAY_BUFFER,0,new Int16Array(s));const l=new e.dt;for(let e=0;e30&&(i.buf.destroy(),this._storage.delete(t))}destroy(){for(const[e,t]of this._storage)t.buf.destroy(),this._storage.delete(e)}}class Ds{constructor(e){this.occluderSize=30,this.depthOffset=-1e-4,e.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),e.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const Os=e.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Us{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class Ns{constructor(e,t){this.revealStart=11,this.revealRange=2,e.registerParameter(this,[...t,"Reveal"],"revealStart",{min:0,max:17,step:.05}),e.registerParameter(this,[...t,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const Qs=e.dd([{type:"Float32",name:"a_pos_2f",components:2}]);class js{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,i){const r=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const i=new e.du,r=new e.aV;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1),r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(i,Qs.members),this.vignetteIdx=t.context.createIndexBuffer(r)}const n=e.b8.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,r);const e={u_vignetteShape:(o={vignetteShape:[i.start,i.range,Math.pow(10,i.fadePower)],vignetteColor:[i.color.r,i.color.g,i.color.b,i.color.a*i.strength]}).vignetteShape,u_vignetteColor:o.vignetteColor};r.draw(t,t.context.gl.TRIANGLES,Oi.disabled,Ni.disabled,Di.alphaBlended,Vi.disabled,e,"vignette",this.vignetteVx,this.vignetteIdx,n)}var o}}class Vs{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,i){const r=t.getFreeCameraOptions().position,n=r.toAltitude(),o=r.toLngLat(),s=e.ak(o.lng),a=e.ak(o.lat),l=t.pixelsPerMeter/i,c=s*e.dv,u=e.dv*Math.log(Math.tan(Math.PI/4+a/2));if(void 0===this._offsetXPrev)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const e=-this._offsetYPrev+u,t=-this._elevationPrev+n;this._accumulatedOffsetX+=(-this._offsetXPrev+c)*l,this._accumulatedOffsetY+=e*l,this._accumulatedElevation+=t*l,this._offsetXPrev=c,this._offsetYPrev=u,this._elevationPrev=n}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Hs(e,t){return[-(e[0]-Math.floor(e[0]/t)*t),-(e[1]-Math.floor(e[1]/t)*t),-(e[2]-Math.floor(e[2]/t)*t)]}function Gs(t){const i=e.dl(1323123451230),r=[];for(let n=0;nr)return;const n=$s(0,1,i.revealStart,i.revealStart+i.revealRange,r);if(!this.particlesVx||!this.particlesIdx)return;const o=structuredClone(this._params);let s=[-o.direction.x,o.direction.y,-100];e.ad.vec3.normalize(s,s);const a=structuredClone(this._vignetteParams);a.strength*=n,o.overrideStyleParameters||(o.intensity=t.style.rain.state.density,o.timeFactor=t.style.rain.state.intensity,o.color=structuredClone(t.style.rain.state.color),s=structuredClone(t.style.rain.state.direction),o.screenThinning.intensity=t.style.rain.state.centerThinning,o.dropletSizeX=t.style.rain.state.dropletSize[0],o.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],o.distortionStrength=100*t.style.rain.state.distortionStrength,a.strength=1,a.color=structuredClone(t.style.rain.state.vignetteColor));const l=this.updateOnRender(t,o.timeFactor),c=t.context,u=c.gl,h=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new e.T(c,{width:t.width,height:t.height,data:null},u.RGBA8)),o.distortionStrength>0&&(c.activeTexture.set(u.TEXTURE0),this.screenTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.copyTexSubImage2D(u.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const d=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(c,d),c.activeTexture.set(u.TEXTURE0),this.screenTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const p=[o.color.r,o.color.g,o.color.b,o.color.a],f=(i,r)=>{const n=Hs(this._movement.getPosition(),i),a=o.dropletSizeX,c=o.dropletSizeX*o.dropletSizeYScale,f=t.width/2,A=t.height/2,m=$s(0,o.screenThinning.start,0,1,o.screenThinning.intensity),g=$s(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),_=$s(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),y=(v={modelview:l.modelviewMatrix,projection:l.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:n,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,boxSize:i,rainDropletSize:[a,c],distortionStrength:o.distortionStrength,rainDirection:s,color:p,screenSize:[h.width,h.height],thinningCenterPos:[f,A],thinningShape:[m,g,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:_,shapeDirectionalPower:o.shapeDirPower,shapeNormalPower:o.shapeNormalPower,mode:r?0:1},{u_modelview:Float32Array.from(v.modelview),u_projection:Float32Array.from(v.projection),u_time:v.time,u_cam_pos:v.camPos,u_texScreen:0,u_velocityConeAperture:v.velocityConeAperture,u_velocity:v.velocity,u_boxSize:v.boxSize,u_rainDropletSize:v.rainDropletSize,u_distortionStrength:v.distortionStrength,u_rainDirection:v.rainDirection,u_color:v.color,u_screenSize:v.screenSize,u_thinningCenterPos:v.thinningCenterPos,u_thinningShape:v.thinningShape,u_thinningAffectedRatio:v.thinningAffectedRatio,u_thinningParticleOffset:v.thinningParticleOffset,u_shapeDirectionalPower:v.shapeDirectionalPower,u_shapeNormalPower:v.shapeNormalPower,u_mode:v.mode});var v;const x=Math.round(o.intensity*this.particlesCount),b=e.b8.simpleSegment(0,0,4*x,2*x);d.draw(t,u.TRIANGLES,Oi.disabled,Ni.disabled,Di.alphaBlended,Vi.disabled,y,"rain_particles",this.particlesVx,this.particlesIdx,b)};o.distortionStrength>0&&f(o.boxSize,!0),f(o.boxSize,!1),this._vignette.draw(t,a)}}const Ks=e.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class Ws extends Zs{constructor(e){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new Ns(e.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const i=t.context;if(!this.particlesVx){const t=Gs(this.particlesCount),r=new e.dx,n=new e.aV;let o=0;const s=e.dl(1323123451230);for(let e=0;es)return;const a=$s(0,1,o.revealStart,o.revealStart+o.revealRange,s);n.strength*=a,i.overrideStyleParameters||(i.intensity=t.style.snow.state.density,i.timeFactor=t.style.snow.state.intensity,i.color=structuredClone(t.style.snow.state.color),r=structuredClone(t.style.snow.state.direction),i.screenThinning.intensity=t.style.snow.state.centerThinning,i.billboardSize=2.79*t.style.snow.state.flakeSize,n.strength=1,n.color=structuredClone(t.style.snow.state.vignetteColor));const l=this.updateOnRender(t,i.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const c=t.context,u=c.gl,h=t.transform,d=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(c,d),((i,n,o)=>{const s=Hs(this._movement.getPosition(),i),a=h.width/2,c=h.height/2,p=$s(0,o.screenThinning.start,0,1,o.screenThinning.intensity),f=$s(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),A=$s(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),m=(g={modelview:l.modelviewMatrix,projection:l.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:s,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,horizontalOscillationRadius:o.horizontalOscillationRadius,horizontalOscillationRate:o.horizontalOscillationRate,boxSize:i,billboardSize:1*o.billboardSize,simpleShapeParameters:[o.shapeFadeStart,o.shapeFadePower],screenSize:[h.width,h.height],thinningCenterPos:[a,c],thinningShape:[p,f,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:A,color:[o.color.r,o.color.g,o.color.b,o.color.a],direction:r},{u_modelview:Float32Array.from(g.modelview),u_projection:Float32Array.from(g.projection),u_time:g.time,u_cam_pos:g.camPos,u_velocityConeAperture:g.velocityConeAperture,u_velocity:g.velocity,u_horizontalOscillationRadius:g.horizontalOscillationRadius,u_horizontalOscillationRate:g.horizontalOscillationRate,u_boxSize:g.boxSize,u_billboardSize:g.billboardSize,u_simpleShapeParameters:g.simpleShapeParameters,u_screenSize:g.screenSize,u_thinningCenterPos:g.thinningCenterPos,u_thinningShape:g.thinningShape,u_thinningAffectedRatio:g.thinningAffectedRatio,u_thinningParticleOffset:g.thinningParticleOffset,u_particleColor:g.color,u_direction:g.direction});var g;const _=Math.round(o.intensity*this.particlesCount),y=e.b8.simpleSegment(0,0,4*_,2*_);this.particlesVx&&this.particlesIdx&&d.draw(t,u.TRIANGLES,Oi.disabled,Ni.disabled,Di.alphaBlended,Vi.disabled,m,"snow_particles",this.particlesVx,this.particlesIdx,y)})(i.boxSize,0,i),this._vignette.draw(t,n)}}const Xs={symbol:function(t,i,r,n,o){if("translucent"!==t.renderPass)return;const s=Ni.disabled,a=t.colorModeForRenderPass(),l=r.layout.get("text-variable-anchor"),c=r.layout.get("text-size-scale-range"),u=e.ay(t.scaleFactor,c[0],c[1]);l&&function(t,i,r,n,o,s,a,l){const c=i.transform,u="map"===o,h="map"===s;for(const i of t){const t=n.getTile(i),o=t.getBucket(r);if(!o||!o.text||!o.text.segments.get().length)continue;const s=e.bp(o.textSizeData,c.zoom,l),d=ci(i,o.getProjection(),c),p=c.calculatePixelsToTileUnitsMatrix(t),f=Ht(d,t.tileID.canonical,h,u,c,o.getProjection(),p),A=o.hasIconTextFit()&&o.hasIconData();if(s){const r=Math.pow(2,c.zoom-t.tileID.overscaledZ);Ro(o,u,h,a,e.cY,c,f,i,r,s,A)}}}(n,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),o,u);const h=0!==r.paint.get("icon-opacity").constantOr(1),d=0!==r.paint.get("text-opacity").constantOr(1);void 0!==r.layout.get("symbol-sort-key").constantOr(1)&&(h||d)?Do(t,i,r,n,s,a):(h&&Do(t,i,r,n,s,a,{onlyIcons:!0}),d&&Do(t,i,r,n,s,a,{onlyText:!0})),i.map.showCollisionBoxes&&(Lo(t,i,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),Lo(t,i,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(t,i,r,n){if("translucent"!==t.renderPass)return;const o=r.paint.get("circle-opacity"),s=r.paint.get("circle-stroke-width"),a=r.paint.get("circle-stroke-opacity"),l=void 0!==r.layout.get("circle-sort-key").constantOr(1),c=r.paint.get("circle-emissive-strength");if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const u=t.context,h=u.gl,d=t.transform,p=t.depthModeForSublayer(0,Oi.ReadOnly),f=Ni.disabled,A=t.colorModeForDrapableLayerRenderPass(c),m="globe"===d.projection.name,g=[e.av(d.center.lng),e.aC(d.center.lat)],_=[];for(let o=0;oe.sortKey-t.sortKey));const y={useDepthForOcclusion:d.depthOcclusionForSymbolsAndCircles};for(const e of _){const{programConfiguration:i,program:n,layoutVertexBuffer:o,globeExtVertexBuffer:s,indexBuffer:a,uniformValues:l,tile:c}=e.state,m=e.segments;t.terrain&&t.terrain.setupElevationDraw(c,n,y),t.uploadCommonUniforms(u,n,c.tileID.toUnwrapped()),n.draw(t,h.TRIANGLES,p,f,A,Vi.disabled,l,r.id,o,a,m,r.paint,d.zoom,i,[s])}},heatmap:function(t,i,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const o=t.context,s=o.gl,a=Ni.disabled,l=new Di([s.ONE,s.ONE,s.ONE,s.ONE],e.al.transparent,[!0,!0,!0,!0]);!function(e,t,i,r){const n=e.gl,o=t.width*r,s=t.height*r;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,o,s]);let a=i.heatmapFbo;if(!a||a&&(a.width!==o||a.height!==s)){a&&a.destroy();const t=n.createTexture();n.bindTexture(n.TEXTURE_2D,t),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),a=i.heatmapFbo=e.createFramebuffer(o,s,!0,null),function(e,t,i,r,n,o){const s=e.gl;s.texImage2D(s.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?s.RGBA16F:s.RGBA,n,o,0,s.RGBA,e.extRenderToTextureHalfFloat?s.HALF_FLOAT:s.UNSIGNED_BYTE,null),r.colorAttachment.set(i)}(e,0,t,a,o,s)}else n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)}(o,t,r,"globe"===t.transform.projection.name?.5:.25),o.clear({color:e.al.transparent});const c=t.transform,u="globe"===c.projection.name,h=u?["PROJECTION_GLOBE_VIEW"]:[],d=u?Vi.frontCCW:Vi.disabled,p=[e.av(c.center.lng),e.aC(c.center.lat)];for(let e=0;e({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}(t,r))},line:function(t,i,r,n){if("translucent"!==t.renderPass)return;const o=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;const a=r.paint.get("line-emissive-strength"),l=r.paint.get("line-occlusion-opacity"),c=r.layout.get("line-elevation-reference"),u="meters"===r.layout.get("line-width-unit"),h="sea"===c,d=t.context,p=d.gl;if(r.hasElevatedBuckets&&"globe"===t.transform.projection.name)return;const f=r.layout.get("line-cross-slope"),A=void 0!==f,m=f<1,g=t.colorModeForDrapableLayerRenderPass(a),_=t.terrain&&t.terrain.renderingToTexture,y=_?1:e.q.devicePixelRatio,v=r.paint.get("line-dasharray"),x=v.constantOr(1),b=r.layout.get("line-cap"),w=v.constantOr(null),T=b.constantOr(null),B=r.paint.get("line-pattern"),C=B.constantOr(1),S=B.constantOr(null),E=r.paint.get("line-opacity").constantOr(1);let M=!C&&1!==E||t.depthOcclusion&&l>0&&l<1;const I=r.paint.get("line-gradient"),P=C?"linePattern":"line",L=e.c$(r);let F;if(_&&t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(M=!1),0!==l&&t.depthOcclusion){const t=r.paint._values["line-opacity"];t&&t.value&&"constant"===t.value.kind?F=t.value:e.w(`Occlusion opacity for layer ${r.id} is supported only when line-opacity isn't data-driven.`)}"constant"!==s.value.kind&&!1===s.value.isLineProgressConstant&&L.push("VARIABLE_LINE_WIDTH");const k=(n,o,s,a,c,f)=>{for(const A of n){const n=i.getTile(A);if(C&&!n.patternsLoaded())continue;const m=n.getBucket(r);if(!m)continue;if(m.hasZOffset&&!c||!m.hasZOffset&&c)continue;t.prepareDrawTile();const v=m.programConfigurations.get(r.id),b=t.isTileAffectedByFog(A),B=t.getOrCreateProgram(P,{config:v,defines:o,overrideFog:b,overrideRtt:!c&&void 0});if(S&&n.imageAtlas){const t=e.d0.from(S).getPrimary().scaleSelf(y).toString(),i=n.imageAtlas.patternPositions.get(t);i&&v.setConstantPatternPositions(i)}if(!C&&w&&T&&n.lineAtlas){const e=n.lineAtlas.getDash(w,T);e&&v.setConstantPatternPositions(e)}let[L,k]=r.paint.get("line-trim-offset");if("round"===T||"square"===T){const e=1;L!==k&&(0===L&&(L-=e),1===k&&(k+=e))}const z=_?A.projMatrix:null,R=u?1/m.tileToMeter/e.at(n,1,t.transform.zoom):1,D=u?1/m.tileToMeter/e.at(n,1,Math.floor(t.transform.zoom)):1,O=C?e.d1(t,n,r,z,y,R,D,[L,k]):e.d2(t,n,r,z,m.lineClipsArray.length,y,R,D,[L,k]);if(I){const n=m.gradients[r.id];let o=n.texture;if(r.gradientVersion!==n.version){let s=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,n=A.canonical.z===r?Math.ceil(1<{null!=F&&(F.value=E*l),B.draw(t,p.TRIANGLES,s,e,g,Vi.disabled,O,r.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,r.paint,t.transform.zoom,v,[m.layoutVertexBuffer2,m.patternVertexBuffer,m.zOffsetVertexBuffer]),null!=F&&(F.value=E)};if(M&&!c){const e=t.stencilModeForClipping(A).ref;0===e&&_&&d.clear({stencil:0});const i={func:p.EQUAL,mask:255};O.u_alpha_discard_threshold=.8,U(new Ni(i,e,255,p.KEEP,p.KEEP,p.INVERT)),O.u_alpha_discard_threshold=0,U(new Ni(i,e,255,p.KEEP,p.KEEP,p.KEEP))}else O.u_alpha_discard_threshold=M&&c&&f?.8:0,U(c?a:t.stencilModeForClipping(A))}};if(r.hasNonElevatedBuckets){const i=!_&&t.terrain;0!==l&&i?e.w(`Occlusion opacity for layer ${r.id} is supported on terrain only if the layer has line-z-offset enabled.`):i?e.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${r.id}.`):k(n,L,t.depthModeForSublayer(0,Oi.ReadOnly),Ni.disabled,!1,!0)}if(r.hasElevatedBuckets){L.push("ELEVATED"),A&&L.push(m?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),h&&L.push("ELEVATION_REFERENCE_SEA");const e=M?t.stencilModeFor3D():Ni.disabled,i=new Oi(t.depthOcclusion?p.GREATER:p.LEQUAL,Oi.ReadOnly,t.depthRangeFor3D);t.forceTerrainMode=!0,k(n,L,i,e,!0,!0),M&&k(n,L,i,e,!0,!1),t.forceTerrainMode=!1}M&&(t.resetStencilClippingMasks(),_&&d.clear({stencil:0})),0===l||t.depthOcclusion||_||t.layersWithOcclusionOpacity.push(t.currentLayer)},fill:function(t,i,r,n){const o=r.paint.get("fill-color"),s=r.paint.get("fill-opacity");if(0===s.constantOr(1))return;const a=r.paint.get("fill-emissive-strength"),l=t.colorModeForDrapableLayerRenderPass(a),c=r.paint.get("fill-pattern"),u=t.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===o.constantOr(e.al.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";let h="none";"none"!==r.layout.get("fill-elevation-reference")?h="road":0!==r.paint.get("fill-z-offset").constantOr(1)&&(h="offset");const d=!(!t.terrain||!t.terrain.enabled),p={painter:t,sourceCache:i,layer:r,coords:n,colorMode:l,elevationType:h,terrainEnabled:d,pass:u};if("offset"!==h){if(Qo(p,!1),"road"===h){const e=!d&&"translucent"===t.renderPass;e&&No(t,i,r,n,"geometry"),Qo(p,!0,Ni.disabled),e&&function(e){const{painter:t,sourceCache:i,layer:r,coords:n,colorMode:o}=e,s=t.context.gl,a=new Oi(t.context.gl.LEQUAL,Oi.ReadOnly,t.depthRangeFor3D);for(const e of n){const n=i.getTile(e),l=n.getBucket(r);if(!l)continue;const c=l.elevatedStructures;if(!c||!c.renderableSegments||0===c.renderableSegments.segments[0].primitiveLength)continue;t.prepareDrawTile();const u=l.bufferData.programConfigurations.get(r.id),h=t.isTileAffectedByFog(e),d=t.getOrCreateProgram("elevatedStructures",{config:u,overrideFog:h,defines:["NORMAL_OFFSET"]}),p={u_matrix:t.translatePosMatrix(e.projMatrix,n,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"))};t.uploadCommonUniforms(t.context,d,e.toUnwrapped()),d.draw(t,s.TRIANGLES,a,Ni.disabled,o,Vi.backCCW,p,r.id,c.vertexBuffer,c.indexBuffer,c.renderableSegments,r.paint,t.transform.zoom,u,[c.vertexBufferNormal])}}(p)}}else Qo(p,!1,t.stencilModeFor3D())},"fill-extrusion":function(t,i,r,n){const o=r.paint.get("fill-extrusion-opacity"),s=t.context,a=s.gl,l=t.terrain,c=l&&l.renderingToTexture;if(0===o)return;const u=t.conflationActive&&t.style.isLayerClipped(r,i.getSource()),h=t.style.order.indexOf(r.fqid);if(u&&function(e,t,i,r,n){for(const o of r){const r=t.getTile(o).getBucket(i);r&&(r.updateReplacement(o,e.replacementSource,n),r.uploadCentroid(e.context))}}(t,i,r,n,h),l||u)for(const e of n){const n=i.getTile(e).getBucket(r);n&&Ho(t.context,i,e,n,r,l,u)}if("shadow"===t.renderPass&&t.shadowRenderer){const s=t.shadowRenderer;if(l&&o<.65&&r._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.ab)return;const a=s.getShadowPassDepthMode(),c=s.getShadowPassColorMode();jo(t,i,r,n,a,Ni.disabled,c,u)}else if("translucent"===t.renderPass){const h=!r.paint.get("fill-extrusion-pattern").constantOr(1),d=r.paint.get("fill-extrusion-color").constantOr(e.al.white);if(!c&&0!==d.a){const e=new Oi(t.context.gl.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D);1===o&&h?jo(t,i,r,n,e,Ni.disabled,Di.unblended,u):(jo(t,i,r,n,e,Ni.disabled,Di.disabled,u),jo(t,i,r,n,e,t.stencilModeFor3D(),t.colorModeForRenderPass(),u),t.resetStencilClippingMasks())}if(t.style.enable3dLights()&&h&&(!l&&"globe"!==t.transform.projection.name||c)){const o=r.paint.get("fill-extrusion-opacity"),h=r.paint.get("fill-extrusion-ambient-occlusion-intensity"),d=r.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),p=r.paint.get("fill-extrusion-flood-light-intensity"),f="none"===r.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),A=r.paint.get("fill-extrusion-flood-light-color").toRenderColor(f?null:r.lut).toArray01().slice(0,3),m=h>0&&d>0,g=p>0,_=(e,t,i)=>(1-i)*e+i*t,y=s=>{const l=t.depthModeForSublayer(1,Oi.ReadOnly,a.LEQUAL,!0),c=r.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),f=_(.1,3,c),m=t._showOverdrawInspector;if(!m){const c=new Ni({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),m=new Di([a.ONE,a.ONE,a.ONE,a.ONE],e.al.transparent,[!1,!1,!1,!0],a.MIN);Vo(t,i,r,n,l,c,m,Vi.disabled,s,"sdf",o,h,d,p,A,f,u,!1)}{const c=m?Ni.disabled:new Ni({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),g=m?t.colorModeForRenderPass():new Di([a.ONE_MINUS_DST_ALPHA,a.DST_ALPHA,a.ONE,a.ONE],e.al.transparent,[!0,!0,!0,!0]);Vo(t,i,r,n,l,c,g,Vi.disabled,s,"color",o,h,d,p,A,f,u,!1)}};if(c){const c=(s,l,c)=>{const f=t.depthModeForSublayer(1,Oi.ReadOnly,a.LEQUAL,!1),m=r.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),g=_(.1,3,m);{const c=new Di([a.ONE,a.ONE,a.ONE,a.ONE],e.al.transparent,[!1,!1,!1,!0]);Vo(t,i,r,n,f,Ni.disabled,c,Vi.disabled,s,"clear",o,h,d,p,A,g,u,l)}{const c=new Ni({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),m=new Di([a.ONE,a.ONE,a.ONE,a.ONE],e.al.transparent,[!1,!1,!1,!0],a.MIN);Vo(t,i,r,n,f,c,m,Vi.disabled,s,"sdf",o,h,d,p,A,g,u,l)}{const c=s?a.ZERO:a.ONE_MINUS_DST_ALPHA,m=new Ni({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),_=new Di([c,a.DST_ALPHA,a.ONE_MINUS_DST_ALPHA,a.ZERO],e.al.transparent,[!0,!0,!0,!0]);Vo(t,i,r,n,f,m,_,Vi.disabled,s,"color",o,h,d,p,A,g,u,l)}{const m=new Di([a.ONE,a.ONE,a.ONE,s?a.ZERO:a.ONE],e.al.transparent,[!1,!1,!1,!0],s?a.FUNC_ADD:a.MAX);Vo(t,i,r,n,f,Ni.disabled,m,Vi.disabled,s,"clear",o,h,d,p,A,g,u,l,c)}};if(m||g){let i;if(t.prepareDrawTile(),l){const t=l.drapeBufferSize[0],r=l.drapeBufferSize[1];i=l.framebufferCopyTexture,i&&(!i||i.size[0]===t&&i.size[1]===r)||(i&&i.destroy(),i=l.framebufferCopyTexture=new e.T(s,new e.r({width:t,height:r}),a.RGBA8)),i.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.copyTexSubImage2D(a.TEXTURE_2D,0,0,0,0,0,t,r)}m&&c(!0,!1,i),g&&c(!1,!0,i)}}else m&&y(!0),g&&y(!1),(m||g)&&t.resetStencilClippingMasks()}}},hillshade:function(e,t,i,r){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;if(e.style.disableElevatedTerrain)return;const n=e.context,o=e.terrain&&e.terrain.renderingToTexture,[s,a]="translucent"!==e.renderPass||o?[{},r]:e.stencilConfigForOverlap(r);for(const r of a){const n=t.getTile(r);if(n.needsHillshadePrepare&&"offscreen"===e.renderPass)$r(e,n,i);else if("translucent"===e.renderPass){const t=e.depthModeForSublayer(0,Oi.ReadOnly),a=i.paint.get("hillshade-emissive-strength"),l=e.colorModeForDrapableLayerRenderPass(a),c=o&&e.terrain?e.terrain.stencilModeForRTTOverlap(r):s[r.overscaledZ];Hr(e,r,n,i,t,c,l)}}n.viewport.set([0,0,e.width,e.height]),e.resetStencilClippingMasks()},raster:function(t,i,r,n,o,s){if("translucent"!==t.renderPass)return;if(0===r.paint.get("raster-opacity"))return;const a="globe"===t.transform.projection.name,l=0!==r.paint.get("raster-elevation"),c=l&&a;if(t.renderElevatedRasterBackface&&!c)return;const u=t.context,h=u.gl,d=i.getSource(),p=function(t,i,r,n){const o=i.paint.get("raster-color"),s="raster-array"===t.type,a=[],l=i.paint.get("raster-resampling"),c=i.paint.get("raster-color-mix");let u=i.paint.get("raster-color-range");const h=[c[0],c[1],c[2],0],d=c[3];let p="nearest"===l?n.NEAREST:n.LINEAR;if(s&&(a.push("RASTER_ARRAY"),o||a.push("RASTER_COLOR"),"linear"===l&&a.push("RASTER_ARRAY_LINEAR"),p=n.NEAREST,!u&&t.rasterLayers)){const e=t.rasterLayers.find((({id:e})=>e===i.sourceLayer));e&&e.fields&&e.fields.range&&(u=e.fields.range)}if(u=u||[0,1],o){a.push("RASTER_COLOR"),r.activeTexture.set(n.TEXTURE2),i.updateColorRamp(u);let t=i.colorRampTexture;t||(t=i.colorRampTexture=new e.T(r,i.colorRamp,n.RGBA8)),t.bind(n.LINEAR,n.CLAMP_TO_EDGE)}return{mix:h,range:u,offset:d,defines:a,resampling:p}}(d,r,u,h);if(d instanceof e.aK&&!n.length&&!a)return;const f=r.paint.get("raster-emissive-strength"),A=t.colorModeForDrapableLayerRenderPass(f),m=t.terrain&&t.terrain.renderingToTexture,g=!t.options.moving,_="nearest"===r.paint.get("raster-resampling")?h.NEAREST:h.LINEAR;if(d instanceof e.aK&&!n.length&&(d.onNorthPole||d.onSouthPole)){const e=l?t.stencilModeFor3D():Ni.disabled;return void Wo(!!d.onNorthPole,null,t,i,r,f,p,Vi.disabled,e)}if(!n.length)return;const[y,v]=d instanceof e.aK||m?[{},n]:t.stencilConfigForOverlap(n),x=v[v.length-1].overscaledZ;c&&p.defines.push("PROJECTION_GLOBE_VIEW"),l&&p.defines.push("RENDER_CUTOFF");const b=(n,o,v)=>{for(const b of n){const n=b.toUnwrapped(),w=i.getTile(b);if(m&&(!w||!w.hasData()))continue;u.activeTexture.set(h.TEXTURE0);const T=Yo(w,d,r,p);if(!T||!T.texture)continue;const{texture:B,mix:C,offset:S,tileSize:E,buffer:M}=T;let I,P;m?(I=Oi.disabled,P=b.projMatrix):l?(I=new Oi(h.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D),P=a?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(n,g)):(I=t.depthModeForSublayer(b.overscaledZ-x,1===r.paint.get("raster-opacity")?Oi.ReadWrite:Oi.ReadOnly,h.LESS),P=t.transform.calculateProjMatrix(n,g));const L=t.terrain&&m?t.terrain.stencilModeForRTTOverlap(b):y[b.overscaledZ],F=s?0:r.paint.get("raster-fade-duration");w.registerFadeDuration(F);const k=i.findLoadedParent(b,0),z=Un(w,k,i,t.transform,F);let R,D;t.terrain&&t.terrain.prepareDrawTile(),u.activeTexture.set(h.TEXTURE0),B.bind(_,h.CLAMP_TO_EDGE),u.activeTexture.set(h.TEXTURE1),k?(k.texture&&k.texture.bind(_,h.CLAMP_TO_EDGE),R=Math.pow(2,k.tileID.overscaledZ-w.tileID.overscaledZ),D=[w.tileID.canonical.x*R%1,w.tileID.canonical.y*R%1]):B.bind(_,h.CLAMP_TO_EDGE),"useMipmap"in B&&u.extTextureFilterAnisotropic&&t.transform.pitch>20&&h.texParameterf(h.TEXTURE_2D,u.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u.extTextureFilterAnisotropicMax);const O=t.transform;let U;const N=l?Xo(O):[0,0,0,0];let Q,j,V,H,G,$=0;if(c&&d instanceof e.aK&&d.coordinates.length>3)Q=Float32Array.from(e.bc(e.cI(new e.bT(0,0,0)))),j=Float32Array.from(O.globeMatrix),V=Float32Array.from(e.cE(O)),H=[e.av(O.center.lng),e.aC(O.center.lat)],U=d.elevatedGlobePerspectiveTransform,G=d.elevatedGlobeGridMatrix||new Float32Array(9);else if(c){const t=e.cF(b.canonical);$=e.cG(t.getCenter().lat),Q=Float32Array.from(e.bc(e.cI(b.canonical))),j=Float32Array.from(O.globeMatrix),V=Float32Array.from(e.cE(O)),H=[e.av(O.center.lng),e.aC(O.center.lat)],U=[0,0],G=Float32Array.from(e.cH(b.canonical,t,$,O.worldSize/O._pixelsPerMercatorPixel))}else U=d instanceof e.aK?d.perspectiveTransform:[0,0],Q=new Float32Array(16),j=new Float32Array(9),V=new Float32Array(16),H=[0,0],G=new Float32Array(9);const Z=ho(P,Q,j,V,G,D||[0,0],e.ag(t.transform.zoom),H,N,R||1,z,r,U,l?r.paint.get("raster-elevation"):0,2,C,S,p.range,E,M,f),q=t.isTileAffectedByFog(b),K=t.getOrCreateProgram("raster",{defines:p.defines,overrideFog:q});if(t.uploadCommonUniforms(u,K,n),d instanceof e.aK){const i=d.elevatedGlobeVertexBuffer,n=d.elevatedGlobeIndexBuffer;if(m||!a)d.boundsBuffer&&d.boundsSegments&&K.draw(t,h.TRIANGLES,I,Ni.disabled,A,Vi.disabled,Z,r.id,d.boundsBuffer,t.quadTriangleIndexBuffer,d.boundsSegments);else if(i&&n){const s=O.zoom<=e.c6?d.elevatedGlobeSegments:d.getSegmentsForLongitude(O.center.lng);s&&K.draw(t,h.TRIANGLES,I,Ni.disabled,A,o,Z,r.id,i,n,s)}}else if(c){I=new Oi(h.LEQUAL,Oi.ReadOnly,t.depthRangeFor3D);const e=t.globeSharedBuffers;if(e){const[i,n,s]=e.getGridBuffers($,!1);K.draw(t,h.TRIANGLES,I,v||L,t.colorModeForRenderPass(),o,Z,r.id,i,n,s)}}else{const{tileBoundsBuffer:e,tileBoundsIndexBuffer:i,tileBoundsSegments:n}=t.getTileBoundsBuffers(w);K.draw(t,h.TRIANGLES,I,L,A,Vi.disabled,Z,r.id,e,i,n)}}if(!(d instanceof e.aK)&&c)for(const e of n){const n=e.canonical.y===(1<>>16,2654435769),((e=Math.imul(e^e>>>16,2654435769))>>>0)/4294967296},n=1/1.1;for(let e=0;ee.d7[t](n)));f.push(n);const A=n.canonical.x,m=n.canonical.y;for(const e of f){const o=i.getTile(l?e.wrapped():e);if(!o)continue;const a=o.rasterParticleState;if(!a)continue;const u=e.canonical.x+(1<e.tileID))),f&&(u.activeTexture.set(h.TEXTURE0),t.imageManager.bind(t.context,r.scope)),c){const i=t.getOrCreateProgram(v,{overrideFog:!1,overrideRtt:!0}),n=new Float32Array(e.ad.mat4.identity([])),u=new e.aH(0,0,0,0,0),d=f?xo(n,l,a,t,0,r.scope,A,c,{tileID:u,tileSize:p}):vo(n,l,a,o.toRenderColor(s?null:r.lut));i.draw(t,h.TRIANGLES,_,g,y,Vi.disabled,d,r.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments)}else for(const e of b){const m=t.isTileAffectedByFog(e),b=t.getOrCreateProgram(v,{overrideFog:m}),w=e.toUnwrapped(),T=n?e.projMatrix:t.transform.calculateProjMatrix(w);t.prepareDrawTile();const B=i?i.getTile(e):x?x[e.key]:new xt(e,p,d.zoom,t),C=f?xo(T,l,a,t,0,r.scope,A,c,{tileID:e,tileSize:p}):vo(T,l,a,o.toRenderColor(s?null:r.lut));t.uploadCommonUniforms(u,b,w);const{tileBoundsBuffer:S,tileBoundsIndexBuffer:E,tileBoundsSegments:M}=t.getTileBoundsBuffers(B);b.draw(t,h.TRIANGLES,_,g,y,Vi.disabled,C,r.id,S,E,M)}},sky:function(t,i,r){const n=t._atmosphere?e.ag(t.transform.zoom):1,o=r.paint.get("sky-opacity")*n;if(0===o)return;const s=t.context,a=r.paint.get("sky-type"),l=new Oi(s.gl.LEQUAL,Oi.ReadOnly,[0,1]),c=t.frameCounter/1e3%1;"atmosphere"===a?"offscreen"===t.renderPass?r.needsSkyboxCapture(t)&&(function(t,i){const r=t.context,n=r.gl;let o=i.skyboxFbo;if(!o){o=i.skyboxFbo=r.createFramebuffer(32,32,!0,null),i.skyboxGeometry=new As(r),i.skyboxTexture=r.gl.createTexture(),n.bindTexture(n.TEXTURE_CUBE_MAP,i.skyboxTexture),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,n.LINEAR);for(let e=0;e<6;++e)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,n.RGBA,32,32,0,n.RGBA,n.UNSIGNED_BYTE,null)}r.bindFramebuffer.set(o.framebuffer),r.viewport.set([0,0,32,32]);const s=i.getCenter(t,!0),a=t.getOrCreateProgram("skyboxCapture"),l=new Float64Array(16);e.ad.mat4.identity(l),e.ad.mat4.rotateY(l,l,.5*-Math.PI),ms(t,i,a,l,s,0),e.ad.mat4.identity(l),e.ad.mat4.rotateY(l,l,.5*Math.PI),ms(t,i,a,l,s,1),e.ad.mat4.identity(l),e.ad.mat4.rotateX(l,l,.5*-Math.PI),ms(t,i,a,l,s,2),e.ad.mat4.identity(l),e.ad.mat4.rotateX(l,l,.5*Math.PI),ms(t,i,a,l,s,3),e.ad.mat4.identity(l),ms(t,i,a,l,s,4),e.ad.mat4.identity(l),e.ad.mat4.rotateY(l,l,Math.PI),ms(t,i,a,l,s,5),r.viewport.set([0,0,t.width,t.height])}(t,r),r.markSkyboxValid(t)):"sky"===t.renderPass&&function(e,t,i,r,n){const o=e.context,s=o.gl,a=e.transform,l=e.getOrCreateProgram("skybox");o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,t.skyboxTexture);const c=((e,t,i,r,n)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:r,u_temporal_offset:n}))(a.skyboxMatrix,t.getCenter(e,!1),0,r,n);e.uploadCommonUniforms(o,l),l.draw(e,s.TRIANGLES,i,Ni.disabled,e.colorModeForRenderPass(),Vi.backCW,c,"skybox",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}(t,r,l,o,c):"gradient"===a&&"sky"===t.renderPass&&function(t,i,r,n,o){const s=t.context,a=s.gl,l=t.transform,c=t.getOrCreateProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new As(s)),s.activeTexture.set(a.TEXTURE0);let u=i.colorRampTexture;u||(u=i.colorRampTexture=new e.T(s,i.colorRamp,a.RGBA8)),u.bind(a.LINEAR,a.CLAMP_TO_EDGE);const h=((t,i,r,n,o)=>({u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.ak(r),u_opacity:n,u_temporal_offset:o}))(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get("sky-gradient-radius"),n,o);t.uploadCommonUniforms(s,c),c.draw(t,a.TRIANGLES,r,Ni.disabled,t.colorModeForRenderPass(),Vi.backCW,h,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,r,l,o,c)},debug:function(t,i,r,n,o,s){for(let a=0;a{a&&(a.useNormalOffset=!0,l||(a.enabled=!0))},u=i.getSource();if("light-beam"===t.renderPass&&"batched-model"!==u.type)return;if("vector"===u.type||"geojson"===u.type)return function(t,i,r,n,o){const s=t.transform;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D models for ${s.projection.name} projection is not yet implemented`);const a=s.getFreeCameraOptions().position;if(!t.modelManager)return;const l=t.modelManager;r.modelManager=l;const c=t.shadowRenderer;if(!r._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const u=r._unevaluatedLayout._values["model-id"],h=Object.assign({},r.layout.get("model-id").parameters),d=t.style.order.indexOf(r.fqid);for(const p of n){const n=i.getTile(p).getBucket(r);if(!n||n.projection.name!==s.projection.name)continue;const f=n.getModelUris();f&&!n.modelsRequested&&(l.addModelsFromBucket(f,o),n.modelsRequested=!0);const A=Ms(p,s);h.zoom=A;const m=u.possiblyEvaluate(h);if(Ss(t,n,p),Es.shadowUniformsInitialized=!1,Es.useSingleShadowCascade=!!c&&0===c.getMaxCascadeForTile(p.toUnwrapped()),"shadow"===t.renderPass&&c){if(1===t.currentShadowCascade&&n.isInsideFirstShadowMapFrustum)continue;const i=s.calculatePosMatrix(p.toUnwrapped(),s.worldSize);if(Es.tileMatrix.set(i),Es.shadowTileMatrix=Float32Array.from(c.calculateShadowPassMatrixFromMatrix(i)),Es.aabb.min.fill(0),Es.aabb.max[0]=Es.aabb.max[1]=e.ai,Es.aabb.max[2]=0,Ls(n,Es,t,r.scope))continue}const g=1<0&&t.style.isLayerClipped(r,i.getSource())&&n.updateReplacement(p,t.replacementSource,d,o)&&(n.uploaded=!1,n.upload(t.context));for(let e in n.instancesPerModel){const i=n.instancesPerModel[e];i.features.length>0&&(e=m.evaluate(i.features[0].feature,{}));const s=l.getModel(e,o);if(s&&s.uploaded)for(const e of s.nodes)Is(t,r,e,i,_,p,Es)}}}(t,i,r,n,"vector"===u.type?r.scope:""),void c();if(!u.loaded())return;if("batched-model"===u.type)return function(t,i,r,n){r.resetLayerRenderingStats(t);const o=t.context,s=t.transform,a=t.style.fog,l=t.shadowRenderer;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D landmark models for ${s.projection.name} projection is not yet implemented`);const c=t.transform.getFreeCameraOptions().position,u=e.ad.vec3.scale([],[c.x,c.y,c.z],t.transform.worldSize),h=e.ad.vec3.negate([],u),d=e.ad.mat4.identity([]),p=e.dm(s.center.lat,s.zoom),f=e.ad.mat4.fromScaling([],[1,1,1/p]);e.ad.mat4.translate(d,d,h);const A=r.paint.get("model-opacity").constantOr(1),m=new Oi(o.gl.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D),g=new Oi(o.gl.LEQUAL,Oi.ReadOnly,t.depthRangeFor3D),_=new e.ce([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),y="shadow"===t.renderPass,v=y&&l?l.getCurrentCascadeFrustum():s.getFrustum(s.scaleZoom(s.worldSize)),x=r.paint.get("model-front-cutoff"),b=x[2]<1,w=Ji(t,r.paint.get("model-cutoff-fade-range")),T=r.getLayerRenderingStats();(function(e,t,i,r){const n=e.terrain?e.terrain.exaggeration():0,o=e.transform.zoom;for(const s of r){const r=t.getTile(s).getBucket(i);r&&(r.setFilter(i.filter),e.conflationActive&&r.updateReplacement(s,e.replacementSource),r.evaluateScale(e,i),e.terrain&&n>0&&r.elevationUpdate(e.terrain,n,s,i.source),r.needsReEvaluation(e,o,i)&&r.evaluate(i))}})(t,i,r,n),function(){let c,h,B;b?(c=n.length-1,h=-1,B=-1):(c=0,h=n.length,B=1);const C=new Float64Array(16),S=e.ad.vec3.create(),E=new e.P(0,0);for(let M=c;M!==h;M+=B){const c=n[M],h=i.getTile(c).getBucket(r);if(!h||!h.uploaded)continue;let B=!1;l&&(B=0===l.getMaxCascadeForTile(c.toUnwrapped()));const I=s.calculatePosMatrix(c.toUnwrapped(),s.worldSize),P=h.modelTraits;!y&&b&&(e.ad.mat4.invert(C,I),e.ad.vec3.transformMat4(S,u,C),E.x=S[0],E.y=S[1]);const L=[];h.setFilter(r.filter);for(const i of h.getNodesInfo()){if(i.hiddenByReplacement)continue;if(!i.node.meshes)continue;const r=i.node;let n=0;t.terrain&&r.elevation&&(n=r.elevation*t.terrain.exaggeration());const o=(()=>{const t=i.aabb;return _.min=[...t.min],_.max=[...t.max],_.min[2]+=n,_.max[2]+=n,e.ad.vec3.transformMat4(_.min,_.min,I),e.ad.vec3.transformMat4(_.max,_.max,I),_})(),a=i.evaluatedScale;if(a[0]<=1&&a[1]<=1&&a[2]<=1&&0===o.intersects(v))continue;if(!y&&b){const t=1/6;i.cameraCollisionOpacity=u[0]>o.min[0]&&u[0]o.min[1]&&u[1]!b||1===e.opacity&&1===t.opacity?e.deptht.depth?-1:1));for(const i of L){const n=i.nodeInfo,c=n.node;let u=e.ad.mat4.multiply([],f,i.tileModelMatrix);e.ad.mat4.multiply(u,d,u);const h=e.ad.mat4.invert([],u);e.ad.mat4.transpose(h,h),e.ad.mat4.scale(h,h,Ps),u=e.ad.mat4.multiply(u,u,c.matrix);const p="light-beam"===t.renderPass,A="none"===r.paint.get("model-color-use-theme").constantOr("default"),_=P&e.ds.HasMapboxMeshFeatures,v=_?0:n.evaluatedRMEA[0][2];for(let e=0;e=Re||n>=Re}}const S=d.material;let E;S.occlusionTexture&&S.occlusionTexture.offsetScale&&(E=S.occlusionTexture.offsetScale,b.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const M=t.getOrCreateProgram("model",b);!y&&l&&l.setupShadowsFromMatrix(i.tileModelMatrix,M,l.useNormalOffset),t.uploadCommonUniforms(o,M,null,C);const I=S.pbrMetallicRoughness;I.metallicFactor=.9,I.roughnessFactor=.5;const P=wo(new Float32Array(x),new Float32Array(u),new Float32Array(h),new Float32Array(c.matrix),t,i.opacity,I.baseColorFactor.toRenderColor(null),S.emissiveFactor,I.metallicFactor,I.roughnessFactor,S,v,r,[0,0,0],E);!f&&(n.hasTranslucentParts||i.opacity<1)&&M.draw(t,o.gl.TRIANGLES,m,Ni.disabled,Di.disabled,Vi.backCCW,P,r.id,d.vertexBuffer,d.indexBuffer,d.segments,r.paint,t.transform.zoom,void 0,w),M.draw(t,o.gl.TRIANGLES,f?g:m,Ni.disabled,f||i.opacity<1||n.hasTranslucentParts?Di.alphaBlended:Di.unblended,Vi.backCCW,P,r.id,d.vertexBuffer,d.indexBuffer,d.segments,r.paint,t.transform.zoom,void 0,w)}}}}()}(t,i,r,n),void c();if("model"!==u.type)return;const h=u.getModels(),d=[],p=t.transform.getFreeCameraOptions().position,f=e.ad.vec3.scale([],[p.x,p.y,p.z],t.transform.worldSize);e.ad.vec3.negate(f,f);const A=[],m=[];let g=0;for(const i of h){const n=r.paint.get("model-rotation").constantOr(null),o=r.paint.get("model-scale").constantOr(null),s=r.paint.get("model-translation").constantOr(null);i.computeModelMatrix(t,n,o,s,!0,!0,!1);const a=e.ad.mat4.identity([]),l=e.dm(i.position.lat,t.transform.zoom),c=e.ad.mat4.fromScaling([],[1,1,1/l]);e.ad.mat4.translate(a,a,f),d.push({zScaleMatrix:c,negCameraPosMatrix:a});for(const e of i.nodes)Bs(t.transform,e,i.matrix,t.transform.expandedFarZProjMatrix,g,A,m);g++}if(A.sort(((e,t)=>t.depth-e.depth)),"shadow"!==t.renderPass){if(1===o)for(const e of m)Ts(e,t,r,d[e.modelIndex],Ni.disabled,t.colorModeForRenderPass());else{for(const e of m)Ts(e,t,r,d[e.modelIndex],Ni.disabled,Di.disabled);for(const e of m)Ts(e,t,r,d[e.modelIndex],t.stencilModeFor3D(),t.colorModeForRenderPass());t.resetStencilClippingMasks()}for(const e of A)Ts(e,t,r,d[e.modelIndex],Ni.disabled,t.colorModeForRenderPass());c()}else{for(const e of m)Cs(e.mesh,e.nodeModelMatrix,t,r);for(const e of A)Cs(e.mesh,e.nodeModelMatrix,t,r);c()}}},Ys={line:function(e,t,i){if(e.hasElevatedBuckets=!1,e.hasNonElevatedBuckets=!1,void 0!==e._unevaluatedLayout.getValue("line-elevation-reference")||void 0!==e._unevaluatedLayout.getValue("line-z-offset")){if(t){const i=t.getVisibleCoordinates();for(const r of i){const i=t.getTile(r).getBucket(e);if(i&&(i.hasZOffset?e.hasElevatedBuckets=!0:e.hasNonElevatedBuckets=!0,e.hasElevatedBuckets&&e.hasNonElevatedBuckets))break}}}else e.hasNonElevatedBuckets=!0},model:function(e,t,i){const r=t.getSource();if(!r.loaded())return;if("vector"===r.type||"geojson"===r.type)return void(i.modelManager&&i.modelManager.upload(i,"vector"===r.type?e.scope:""));if("batched-model"===r.type)return;if("model"!==r.type)return;const n=r.getModels();for(const e of n)e.upload(i.context)},raster:function(e,t,i){const r=t.getSource();if(!(r instanceof rt&&r.loaded()))return;const n=e.sourceLayer||r.rasterLayerIds&&r.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-array-band")||r.getInitialBand(n);if(null==o)return;const s=t.getIds().map((e=>t.getTileByID(e)));for(const e of s)e.updateNeeded(n,o)&&r.prepareTile(e,n,o)},"raster-particle":function(e,t,i){const r=t.getSource();if(!(r instanceof rt&&r.loaded()))return;const n=e.sourceLayer||r.rasterLayerIds&&r.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-particle-array-band")||r.getInitialBand(n);if(null==o)return;const s=t.getIds().map((e=>t.getTileByID(e)));for(const e of s)e.updateNeeded(n,o)&&r.prepareTile(e,n,o)}},Js={fill:No};class ea{constructor(t,i,r,n,o){this.context=new Io(t,i),this.transform=r,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=o,this._timeStamp=e.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const s=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const e of s)this._debugParams.enabledLayers[e]=!0;o.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},(()=>{this.style.map.triggerRepaint()})),o.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),o.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),o.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),o.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),o.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const e of s)o.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],e);this.occlusionParams=new Ds(o),this.setup(),this.numSublayers=Bt.maxUnderzooming+Bt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.dy,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new rr(this),this._wireframeDebugCache=new Rs,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const a=new e.r({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new e.T(this.context,a,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=n}updateTerrain(e,t){const i=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(i||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Vn(this,e));const r=this._terrain;this.transform.elevation=i?r:null,r.update(e,this.transform,t),this.transform.elevation&&!r.enabled&&(this.transform.elevation=null)}_updateFog(e){const t=e.fog;if(!t||"globe"===this.transform.projection.name||t.getOpacity(this.transform.pitch)<1||t.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[i,r]=t.getFovAdjustedRange(this.transform._fov);if(i>r)return void(this.transform.fogCullDistSq=null);const n=i+.78*(r-i);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(e){e&&!this._terrain&&(this._terrain=new Vn(this,this.style)),this._forceTerrainMode=e}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,i){if(this.width=t*e.q.devicePixelRatio,this.height=i*e.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._mergedLayers[e].resize()}setup(){const t=this.context,i=new e.b5;i.emplaceBack(0,0),i.emplaceBack(e.ai,0),i.emplaceBack(0,e.ai),i.emplaceBack(e.ai,e.ai),this.tileExtentBuffer=t.createVertexBuffer(i,e.b7.members),this.tileExtentSegments=e.b8.simpleSegment(0,0,4,2);const r=new e.b5;r.emplaceBack(0,0),r.emplaceBack(e.ai,0),r.emplaceBack(0,e.ai),r.emplaceBack(e.ai,e.ai),this.debugBuffer=t.createVertexBuffer(r,e.b7.members),this.debugSegments=e.b8.simpleSegment(0,0,4,5);const n=new e.b5;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,e.b7.members),this.viewportSegments=e.b8.simpleSegment(0,0,4,2);const o=new e.aU;o.emplaceBack(0,0,0,0),o.emplaceBack(e.ai,0,e.ai,0),o.emplaceBack(0,e.ai,0,e.ai),o.emplaceBack(e.ai,e.ai,e.ai,e.ai),this.mercatorBoundsBuffer=t.createVertexBuffer(o,e.ba.members),this.mercatorBoundsSegments=e.b8.simpleSegment(0,0,4,2);const s=new e.aV;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s);const a=new e.b6;for(const e of[0,1,3,2,0])a.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(a),this.emptyTexture=new e.T(t,new e.r({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=e.ad.mat4.create();const l=this.context.gl;this.stencilClearMode=new Ni({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,e.TRIANGLES,Oi.disabled,this.stencilClearMode,Di.disabled,Vi.disabled,On(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(e,t,i){if(!t||this.currentStencilSource===t.id||!e.isTileClipped()||!i||0===i.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of i)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=t.id;const r=this.context,n=r.gl;this.nextStencilID+i.length>256&&this.clearStencil(),r.setColorMode(Di.disabled),r.setDepthMode(Oi.disabled);const o=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const e of i){const i=t.getTile(e),r=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,{tileBoundsBuffer:s,tileBoundsIndexBuffer:a,tileBoundsSegments:l}=this.getTileBoundsBuffers(i);o.draw(this,n.TRIANGLES,Oi.disabled,new Ni({func:n.ALWAYS,mask:0},r,255,n.KEEP,n.KEEP,n.REPLACE),Di.disabled,Vi.disabled,On(e.projMatrix),"$clipping",s,a,l)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new Ni({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);const t=this.context.gl;return new Ni({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){const t=this.context.gl,i=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const e={};for(let i=0;ithis.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture)()&&"translucent"===this.renderPass?new Di([i.ONE,i.ONE_MINUS_SRC_ALPHA,i.CONSTANT_ALPHA,i.ONE_MINUS_SRC_ALPHA],new e.al(0,0,0,void 0===t?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(e,t,i,r=!1){if(this.depthOcclusion)return new Oi(this.context.gl.GREATER,Oi.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!r)return Oi.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Oi(i||this.context.gl.LEQUAL,t,[n,n])}opaquePassEnabledForLayer(){return this.currentLayerthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce(((e,t)=>e+t/this._fpsHistory.length),0))}render(t,i){const r=e.q.now();this._dt=r-this._timeStamp,this._timeStamp=r,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=i;const n=this.style._mergedLayers,o=!(!this.terrain||!this.terrain.enabled),s=()=>this.style._getOrder(o).filter((e=>{const t=n[e];return!(t.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[t.type]}));let a=s(),l=!1,c=!1;for(const e of a){const t=n[e];"circle"===t.type&&(l=!0),"symbol"===t.type&&(t.hasInitialOcclusionOpacityProperties?c=!0:l=!0)}let u=a.map((e=>n[e]));const h=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.q.now()),this.imageManager.beginFrame();let d=0,p=!1;for(const e in h){const t=h[e];t.used&&(t.prepare(this.context),t.getSource().usedInConflation&&++d)}let f=!1;for(const e of u)e.isHidden(this.transform.zoom)||("clip"===e.type&&(f=!0),this.prepareLayer(e));const A={},m={},g={},_={},y={};for(const e in h){const t=h[e];A[e]=t.getVisibleCoordinates(),m[e]=A[e].slice().reverse(),g[e]=t.getVisibleCoordinates(!0).reverse(),_[e]=t.getShadowCasterCoordinates(),y[e]=t.sortCoordinatesByDistance(A[e])}const v=e=>{const t=this.style.getLayerSourceCache(e);return t&&t.used?t.getSource():null};if(d||f||this._clippingActiveLastFrame){const t=[],i=[];let r=0;for(const e of u)this.isSourceForClippingOrConflation(e,v(e))&&(t.push(e),i.push(r)),r++;if(t&&(f||t.length>1)||this._clippingActiveLastFrame){f=!1;const r=[];for(let n=0;n0){const e=v(t);e&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom)),t.minzoom&&(this.minCutoffZoom=Math.max(t.minzoom,this.minCutoffZoom))}t.is3D(o)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=e),this._lastOcclusionLayer=e)}const x=this.style&&this.style.fog;x?(this._fogVisible=0!==x.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=x.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(g),this.opaquePassCutoff=0,a=s(),u=a.map((e=>n[e])));const b=this._shadowRenderer;if(b){b.updateShadowParameters(this.transform,this.style.directionalLight);for(const e in h)for(const t of A[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(t)||e),b.addShadowReceiver(t.toUnwrapped(),e.min,e.max)}}"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.dz(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new xs(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const w=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),T=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(w&&!this._snow&&(this._snow=new Ws(this)),!w&&this._snow&&(this._snow.destroy(),delete this._snow),T&&!this._rain&&(this._rain=new qs(this)),!T&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),!N.has(this.context.gl))return;this.renderPass="offscreen";for(const e of u){const i=t.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const r=i?m[i.id]:void 0;("custom"===e.type||"raster"===e.type||"raster-particle"===e.type||e.isSky()||r&&r.length)&&this.renderLayer(this,i,e,r)}this.depthRangeFor3D=[0,1-(u.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,_)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const B="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),C=(()=>{if(i.showOverdrawInspector)return e.al.black;const t=this.style.fog;if(t&&this.transform.projection.supportsFog){const i=this.style.getLut(t.scope);if(!B){const r="none"===t.properties.get("color-use-theme"),n=t.properties.get("color").toRenderColor(r?null:i).toArray01();return new e.al(...n)}if(B){const r="none"===t.properties.get("space-color-use-theme"),n=t.properties.get("space-color").toRenderColor(r?null:i).toArray01();return new e.al(...n)}}return e.al.transparent})();if(this.context.clear({color:C,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&B&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const e=u[this.currentLayer],i=t.getLayerSourceCache(e);if(e.isSky())continue;const r=i?(e.is3D(o)?y:m)[i.id]:void 0;this._renderTileClippingMasks(e,i,r),this.renderLayer(this,i,e,r)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&B&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.ag(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer{for(this.currentLayer=0;this.currentLayer0&&e.hasShadowPass()&&0==--E&&(b.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=e;this.currentLayer++){const e=u[this.currentLayer];if(!e.hasLightBeamPass())continue;const i=t.getLayerSourceCache(e);this.renderLayer(this,i,e,i?m[i.id]:void 0)}this.currentLayer=e,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const e=this.currentLayer;this.depthOcclusion=!0;for(const e of this.layersWithOcclusionOpacity){this.currentLayer=e;const i=u[this.currentLayer],r=t.getLayerSourceCache(i),n=r?m[r.id]:void 0;this.terrain||this._renderTileClippingMasks(i,r,r?A[r.id]:void 0),this.renderLayer(this,r,i,n)}this.depthOcclusion=!1,this.currentLayer=e,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let i=null;u.forEach((e=>{const r=t.getLayerSourceCache(e);r&&!e.isHidden(this.transform.zoom)&&r.getVisibleCoordinates().length&&(!i||i.getSource().maxzoom0?t.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,t,i){const r=void 0===i?this.terrain&&this.terrain.renderingToTexture:i,n=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(n.push("LIGHTING_3D_MODE"),n.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):r||n.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass&&(this._shadowMapDebug||n.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(n.push("TERRAIN"),this.linearFloatFilteringSupported()&&n.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&n.push("GLOBE"),!this._fogVisible||r||void 0!==t&&!t||n.push("FOG","FOG_DITHERING"),r&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}getOrCreateProgram(e,t){this.cache=this.cache||{};const i=t&&t.defines||[],r=t&&t.config,n=this.currentGlobalDefines(e,t&&t.overrideFog,t&&t.overrideRtt).concat(i),o=Zn.cacheKey(Ur[e],e,n,r);return this.cache[o]||(this.cache[o]=new Zn(this.context,e,Ur[e],r,Bo[e],n)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,i){if(this.style.enable3dLights()){const r=this.style.directionalLight,n=this.style.ambientLight;if(r&&n){const o=((t,i,r)=>{const n=t.properties.get("direction"),o="none"===t.properties.get("color-use-theme"),s=t.properties.get("color").toRenderColor(o?null:r.getLut(t.scope)).toArray01(),a=t.properties.get("intensity"),l="none"===i.properties.get("color-use-theme"),c=i.properties.get("color").toRenderColor(l?null:r.getLut(i.scope)).toArray01(),u=i.properties.get("intensity"),h=[n.x,n.y,n.z],d=e.cN(c,u),p=e.cN(s,a);return{u_lighting_ambient_color:d,u_lighting_directional_dir:h,u_lighting_directional_color:p,u_ground_radiance:Hn(h,p,d)}})(r,n,this.style);i.setLightsUniformValues(t,o)}}}uploadCommonUniforms(t,i,r,n,o){if(this.uploadCommonLightUniforms(t,i),this.terrain&&this.terrain.renderingToTexture)return;const s=this.style.fog;if(s){const o=s.getOpacity(this.transform.pitch),a=((t,i,r,n,o,s,a,l,c,u,h,d)=>{const p=t.transform,f="none"===i.properties.get("color-use-theme"),A=i.properties.get("color").toRenderColor(f?null:t.style.getLut(i.scope)).toArray01();A[3]=n;const m=t.frameCounter/1e3%1,[g,_]=i.properties.get("vertical-range");return{u_fog_matrix:r?p.calculateFogTileMatrix(r):d||t.identityMat,u_fog_range:i.getFovAdjustedRange(p._fov),u_fog_color:A,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(g,_),_],u_fog_temporal_offset:m,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:a,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:u,u_viewport:h,u_globe_transition:e.ag(p.zoom),u_is_globe:+("globe"===p.projection.name)}})(this,s,r,o,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.q.devicePixelRatio,this.transform.height*e.q.devicePixelRatio],n);i.setFogUniformValues(t,a)}o&&i.setCutoffUniformValues(t,o.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const e=this._backgroundTiles,t=this._backgroundTiles={},i=this.transform.coveringTiles({tileSize:512});for(const r of i)t[r.key]=e[r.key]||new xt(r,512,this.transform.tileZoom,this);return t}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,t){return!(!e.is3D(!(!this.terrain||!this.terrain.enabled))||"clip"!==e.type&&(e.minzoom&&e.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==e.sourceLayer)&&(!t||"batched-model"!==t.type)))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let t=this._cachedTileFogOpacities[e.key];return t||(this._cachedTileFogOpacities[e.key]=t=this.style.fog.getOpacityForTile(e)),t[0]>=Re||t[1]>=Re}setupDepthForOcclusion(e,t,i){const r=this.context,n=r.gl,o=!!i;var s;i||(i={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),r.activeTexture.set(n.TEXTURE3),e&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),i.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],i.u_depth_range_unpack=[2/((s=this.depthRangeFor3D)[1]-s[0]),-1-2*s[0]/(s[1]-s[0])],i.u_occluder_half_size=.5*this.occlusionParams.occluderSize,i.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),r.activeTexture.set(n.TEXTURE0),o||t.setTerrainUniformValues(r,i)}}function ta(e,t){let i=!1,r=null;const n=()=>{r=null,i&&(e(),r=setTimeout(n,t),i=!1)};return()=>(i=!0,r||n(),r)}class ia{constructor(t){this._hashName=t&&encodeURIComponent(t),e.aQ(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=ta(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const e=this._map;if(!e)return"";const t=ra(e);if(this._hashName){const e=this._hashName;let i=!1;const r=location.hash.slice(1).split("&").map((r=>{const n=r.split("=")[0];return n===e?(i=!0,`${n}=${t}`):r})).filter((e=>e));return i||r.push(`${e}=${t}`),`#${r.join("&")}`}return`#${t}`}_getCurrentHash(){const e=location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((e=>e.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some((e=>isNaN(e)))){const i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function ra(e,t){const i=e.getCenter(),r=Math.round(100*e.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),s=Math.round(i.lng*o)/o,a=Math.round(i.lat*o)/o,l=e.getBearing(),c=e.getPitch();let u=t?`/${s}/${a}/${r}`:`${r}/${a}/${s}`;return(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),u}const na={linearity:.3,easing:e.dB(0,0,.3,1)},oa=e.l({deceleration:2500,maxSpeed:1400},na),sa=e.l({deceleration:20,maxSpeed:1400},na),aa=e.l({deceleration:1e3,maxSpeed:360},na),la=e.l({deceleration:1e3,maxSpeed:90},na);class ca{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.q.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=e.q.now();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const o=ha(i.pan.mag(),r,e.l({},oa,t||{}));n.offset=i.pan.mult(o.amount/i.pan.mag()),n.center=this._map.transform.center,ua(n,o)}if(i.zoom){const e=ha(i.zoom,r,sa);n.zoom=this._map.transform.zoom+e.amount,ua(n,e)}if(i.bearing){const t=ha(i.bearing,r,aa);n.bearing=this._map.transform.bearing+e.ay(t.amount,-179,179),ua(n,t)}if(i.pitch){const e=ha(i.pitch,r,la);n.pitch=this._map.transform.pitch+e.amount,ua(n,e)}if(n.zoom||n.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function ua(e,t){(!e.duration||e.durationi.unproject(e))),a=o.reduce(((e,t,i,r)=>e.add(t.div(r.length))),new e.P(0,0));super(t,{points:o,point:a,lngLats:s,lngLat:i.unproject(a),originalEvent:r}),this._defaultPrevented=!1}}class fa extends e.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}}class Aa{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new fa(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new da(e.type,this._map,e))}mouseup(e){this._map.fire(new da(e.type,this._map,e))}preclick(t){const i=e.l({},t);i.type="preclick",this._map.fire(new da(i.type,this._map,i))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new da(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new da(e.type,this._map,e))}mouseover(e){this._map.fire(new da(e.type,this._map,e))}mouseout(e){this._map.fire(new da(e.type,this._map,e))}touchstart(e){return this._firePreventable(new pa(e.type,this._map,e))}touchmove(e){this._map.fire(new pa(e.type,this._map,e))}touchend(e){this._map.fire(new pa(e.type,this._map,e))}touchcancel(e){this._map.fire(new pa(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ma{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new da(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new da("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new da(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ga{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(p(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t,r=this._startPos,n=this._lastPos;if(!r||!n||n.equals(i)||!this._box&&i.dist(r){this._box&&(this._box.style.transform=`translate(${o}px,${a}px)`,this._box.style.width=s-o+"px",this._box.style.height=c-a+"px")}))}mouseupWindow(t,i){if(!this._active)return;const r=this._startPos,n=i;if(r&&0===t.button){if(this.reset(),m(),r.x!==n.x||r.y!==n.y)return this._map.fire(new e.A("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(r,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),f(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.A(t,{originalEvent:i}))}}function _a(e,t){const i={};for(let r=0;rthis.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=_a(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const r=_a(i,t);for(const e in this.touches){const t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class va{constructor(e){this.singleTap=new ya(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const r=this.singleTap.touchend(e,t,i);if(r){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class xa{constructor(){this._zoomIn=new va({numTouches:1,numTaps:2}),this._zoomOut=new va({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i);return r?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(r)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const ba={0:1,2:2},wa={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Ta{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const i=y(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}mousemoveWindow(e,t){const i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const i=ba[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)0&&(this._active=!0);const n=_a(r,i),o=new e.P(0,0),s=new e.P(0,0);let a=0;for(const e in n){const t=n[e],i=this._touches[e];i&&(o._add(t),s._add(t.sub(i)),a++,n[e]=t)}if(this._touches=n,a{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")}),500)}}class Ma{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,i){return{}}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){const r=this._firstTwoTouches;if(!r)return;e.preventDefault();const[n,o]=r,s=Ia(i,t,n),a=Ia(i,t,o);if(!s||!a)return;const l=this._aroundCenter?null:s.add(a).div(2);return this._move([s,a],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[r,n]=this._firstTwoTouches,o=Ia(i,t,r),s=Ia(i,t,n);o&&s||(this._active&&m(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Ia(e,t,i){for(let r=0;rMath.abs(e.x)}class Ra extends Ma{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,za(e[0].sub(e[1]))&&(this._valid=!1)}_move(t,i,r){const n=this._lastPoints;if(!n)return;const o=t[0].sub(n[0]),s=t[1].sub(n[1]);return this._map._cooperativeGestures&&!e.dC()&&r.touches.length<3||(this._valid=this.gestureBeginsVertically(o,s,r.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+s.y)/2*-.5})}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,n=t.mag()>=2;if(!r&&!n)return;if(!r||!n)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return za(e)&&za(t)&&o}}const Da={panStep:100,bearingStep:15,pitchStep:10};class Oa{constructor(){const e=Da;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:s=>{const a=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:Ua,zoom:t?Math.round(a)+t*(e.shiftKey?2:1):a,bearing:s.getBearing()+i*this._bearingStep,pitch:s.getPitch()+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.getCenter()},{originalEvent:e})}}}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 Ua(e){return e*(2-e)}const Na=4.000244140625,Qa=1/450;class ja{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._handler=i,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Qa,e.aQ(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.dC()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const r=e.q.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%Na==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=g(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;"wheel"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const i=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>Na?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==r&&(r=1/r);const n=i(),o=Math.pow(2,n),s="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(s*r))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const r="number"==typeof this._targetZoom?this._targetZoom:i(),n=this._startZoom,o=this._easing;let s,a=!1;if("wheel"===this._type&&n&&o){const t=Math.min((e.q.now()-this._lastWheelEventTime)/200,1),i=o(t);s=e.ah(n,r,i),t<1?this._frameId||(this._frameId=!0):a=!0}else s=r,a=!0;this._active=!0,a&&(this._active=!1,this._finishTimeout=window.setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200));let l=s-i();return l*this._lastDelta<0&&(l=0),{noInertia:!0,needsRenderFrame:!a,zoomDelta:l,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.dD;if(this._prevEase){const t=this._prevEase,r=(e.q.now()-t.start)/t.duration,n=t.easing(r+.01)-t.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=e.dB(o,s,.25,1)}return this._prevEase={start:e.q.now(),duration:t,easing:i},i}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")}),200)}}class Va{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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 Ha{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ga{constructor(){this._tap=new va({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $a{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Za{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,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 qa{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-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 Ka=e=>e.zoom||e.drag||e.pitch||e.rotate;class Wa extends e.A{}class Xa{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,i){const r=e.ad.vec3.sub([],i,t);this.radius=e.ad.vec3.length(r[2]<0?e.ad.vec3.div([],r,this.constants):[r[0],r[1],0])}projectRay(t){e.ad.vec3.div(t,t,this.constants),e.ad.vec3.normalize(t,t),e.ad.vec3.mul(t,t,this.constants);const i=e.ad.vec3.scale([],t,this.radius);if(i[2]>0){const t=e.ad.vec3.scale([],[0,0,1],e.ad.vec3.dot(i,[0,0,1])),r=e.ad.vec3.scale([],e.ad.vec3.normalize([],[i[0],i[1],0]),this.radius),n=e.ad.vec3.add([],i,e.ad.vec3.scale([],e.ad.vec3.sub([],e.ad.vec3.add([],r,t),i),2));i[0]=n[0],i[1]=n[1]}return i}}function Ya(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Ja{constructor(t,i){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ca(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Xa,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),e.aQ(["handleEvent","handleWindowEvent"],this);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,t,i]of this._listeners){const r=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(t,r,i)}}destroy(){for(const[e,t,i]of this._listeners){const r=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(t,r,i)}}_addDefaultHandlers(e){const t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new Aa(t,e));const r=t.boxZoom=new ga(t,e);this._add("boxZoom",r);const n=new xa,o=new Ha;t.doubleClickZoom=new Va(o,n),this._add("tapZoom",n),this._add("clickZoom",o);const s=new Ga;this._add("tapDragZoom",s);const a=t.touchPitch=new Ra(t);this._add("touchPitch",a);const l=new Ca(e),c=new Sa(e);t.dragRotate=new Za(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new Ba(e),h=new Ea(t,e);t.dragPan=new $a(i,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const d=new ka,p=new La;t.touchZoomRotate=new qa(i,p,d,s),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new ma(t));const f=t.scrollZoom=new ja(t,this);this._add("scrollZoom",f,["mousePan"]);const A=t.keyboard=new Oa;this._add("keyboard",A);for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[i]&&t[i].enable(e[i])}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ka(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,t,i){for(const r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}handleEvent(e,t){this._updatingCamera=!0;const i="renderFrame"===e.type,r=i?void 0:e,n={needsRenderFrame:!1},o={},s={},a=e.touches?this._getMapTouches(e.touches):void 0,l=a?_(this._el,a):i?void 0:g(this._el,e);for(const{handlerName:i,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;this._blockedByActive(s,u,i)?c.reset():c[t||e.type]&&(h=c[t||e.type](e,l,a),this.mergeHandlerResult(n,o,h,i,r),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||c.isActive())&&(s[i]=c)}const c={};for(const e in this._previousActiveHandlers)s[e]||(c[e]=r);this._previousActiveHandlers=s,(Object.keys(c).length||Ya(n))&&(this._changes.push([n,o,c]),this._triggerRenderFrame()),(Object.keys(s).length||Ya(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=n;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(t,i,r,n,o){if(!r)return;e.l(t,r);const s={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){const t={},i={},r={};for(const[n,o,s]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.aroundCoord&&(t.aroundCoord=n.aroundCoord),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),e.l(i,o),e.l(r,s);this._updateMapTransform(t,i,r),this._changes=[]}_updateMapTransform(t,i,r){const n=this._map,o=n.transform,s=e=>[e.x,e.y,e.z];if((()=>{const e=this._eventsInProgress.drag;return e&&!this._handlersById[e.handlerName].isActive()})()&&!Ya(t)){const e=o.zoom;o.cameraElevationReference="sea",null!=this._originalZoom&&o._orthographicProjectionAtLowPitch&&"globe"!==o.projection.name&&0===o.pitch?(o.cameraElevationReference="ground",o.zoom=this._originalZoom):(o.recenterOnTerrain(),o.cameraElevationReference="ground"),e!==o.zoom&&this._map._update(!0)}if(o._isCameraConstrained&&n._stop(!0),!Ya(t))return void this._fireEvents(i,r,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,aroundCoord:d,pinchAround:p}=t;o._isCameraConstrained&&(l>0&&(l=0),o._isCameraConstrained=!1),void 0!==p&&(h=p),(l||(e=>i[e]&&!this._eventsInProgress[e])("drag"))&&h&&(this._dragOrigin=s(o.pointCoordinate3D(h)),this._originalZoom=o.zoom,this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",n._stop(!0),h=h||n.transform.centerPoint,c&&(o.bearing+=c),u&&(o.pitch+=u),o._updateCameraState();const f=[0,0,0];if(a)if("mercator"===o.projection.name){const e=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h).dir),t=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h.sub(a)).dir);f[0]=t[0]-e[0],f[1]=t[1]-e[1]}else{const t=o.pointCoordinate(h);if("globe"===o.projection.name){a=a.rotate(-o.angle);const i=o._pixelsPerMercatorPixel/o.worldSize;f[0]=-a.x*e.dE(e.aT(t.y))*i,f[1]=-a.y*e.dE(o.center.lat)*i}else{const e=o.pointCoordinate(h.sub(a));t&&e&&(f[0]=e.x-t.x,f[1]=e.y-t.y)}}const A=o.zoom,m=[0,0,0];if(l){const t=s(d||o.pointCoordinate3D(h)),i={dir:e.ad.vec3.normalize([],e.ad.vec3.sub([],t,o._camera.position))};if(i.dir[2]<0){const r=o.zoomDeltaToMovement(t,l);e.ad.vec3.scale(m,i.dir,r)}}const g=e.ad.vec3.add(f,f,m);o._translateCameraConstrained(g),l&&Math.abs(o.zoom-A)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}_fireEvents(t,i,r){const n=Ka(this._eventsInProgress),o=Ka(t),s={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in s)this._fireEvent(e,s[e]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const a={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=i[t]||r,a[`${e}end`]=l)}for(const e in a)this._fireEvent(e,a[e]);const c=Ka(this._eventsInProgress);if(r&&(n||o)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new Wa("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const el="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class tl extends e.E{constructor(t,i){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._respectPrefersReducedMotion=!1!==i.respectPrefersReducedMotion,e.aQ(["_renderFrameCallback"],this)}getCenter(){return new e.bO(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,i,r){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.l({offset:t},i),r)}panTo(t,i,r){return this.easeTo(e.l({center:t},i),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,i,r){return this.easeTo(e.l({zoom:t},i),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,i,r){return this.easeTo(e.l({bearing:t},i),r)}resetNorth(t,i){return this.rotateTo(0,e.l({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.l({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):r/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,i,r,n,o,s){const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=n,a.pitch=o;const c=e.bO.convert(i),u=e.bO.convert(r),h=.5*(c.lat+u.lat),d=.5*(c.lng+u.lng),p=e.dF(h,d),f=e.ad.vec3.normalize([],p),A=e.ad.vec3.normalize([],e.ad.vec3.cross([],f,[0,1,0])),m=e.ad.vec3.cross([],A,f),g=[A[0],A[1],A[2],0,m[0],m[1],m[2],0,f[0],f[1],f[2],0,0,0,0,1],_=[p,e.dF(c.lat,c.lng),e.dF(u.lat,c.lng),e.dF(u.lat,u.lng),e.dF(c.lat,u.lng),e.dF(h,c.lng),e.dF(h,u.lng),e.dF(c.lat,d),e.dF(u.lat,d)];let y=e.ce.fromPoints(_.map((t=>[e.ad.vec3.dot(A,t),e.ad.vec3.dot(m,t),e.ad.vec3.dot(f,t)])));const v=e.ad.vec3.transformMat4([],y.center,g);0===e.ad.vec3.squaredLength(v)&&e.ad.vec3.set(v,0,0,1),e.ad.vec3.normalize(v,v),e.ad.vec3.scale(v,v,e.az),a.center=e.dG(v);const x=a.getWorldToCameraMatrix(),b=e.ad.mat4.invert(new Float64Array(16),x);y=e.ce.applyTransform(y,e.ad.mat4.multiply([],x,g));const w=this._extendAABB(y,a,l,n);if(!w)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");y=w,e.ad.vec3.transformMat4(v,v,x);const T=.5*(y.max[2]-y.min[2]),B=this._minimumAABBFrustumDistance(a,y),C=e.ad.vec3.scale([],[0,0,1],T),S=e.ad.vec3.add(C,v,C),E=B+(0===a.pitch?0:e.ad.vec3.distance(v,S)),M=a.globeCenterInViewSpace,I=e.ad.vec3.sub([],v,[M[0],M[1],M[2]]);e.ad.vec3.normalize(I,I),e.ad.vec3.scale(I,I,E);const P=e.ad.vec3.add([],v,I);e.ad.vec3.transformMat4(P,P,b);const L=e.dv/e.az,F=e.ad.vec3.length(P),k=e.bH(Math.max(F*L-e.dv,Number.EPSILON),0),z=Math.min(a.zoomFromMercatorZAdjusted(k),l.maxZoom);return z>.5*(e.c6+e.bY)?(a.setProjection({name:"mercator"}),a.zoom=z,this._cameraForBounds(a,i,r,n,o,s)):{center:a.center,zoom:z,bearing:n,pitch:o}}_extendAABB(t,i,r,n){const o=.5*((r.padding.left||0)+(r.padding.right||0)),s=.5*((r.padding.top||0)+(r.padding.bottom||0)),a=s,l=o,c=o,u=s,h=i.width-(l+c),d=i.height-(a+u),p=e.ad.vec3.sub([],t.max,t.min),f=Math.min(h/p[0],d/p[1]),A=Math.min(i.scaleZoom(i.scale*f),r.maxZoom);if(isNaN(A))return null;const m=i.scale/i.zoomScale(A),g=new e.ce([t.min[0]-l*m,t.min[1]-u*m,t.min[2]],[t.max[0]+c*m,t.max[1]+a*m,t.max[2]]),_=("number"==typeof r.offset.x&&"number"==typeof r.offset.y?new e.P(r.offset.x,r.offset.y):e.P.convert(r.offset)).rotate(-e.ak(n));return g.center[0]-=_.x*m,g.center[1]+=_.y*m,g}queryTerrainElevation(t,i){const r=this.transform.elevation;return r?(i=e.l({},{exaggerated:!0},i),r.getAtPoint(e.ac.fromLngLat(t),null,i.exaggerated)):null}_cameraForBounds(t,i,r,n,o,s){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,r,n,o,s);const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=n,a.pitch=o;const c=e.bO.convert(i),u=e.bO.convert(r),h=new e.bO(c.lng,u.lat),d=new e.bO(u.lng,c.lat),p=a.project(c),f=a.project(u),A=this.queryTerrainElevation(c),m=this.queryTerrainElevation(u),g=this.queryTerrainElevation(h),_=this.queryTerrainElevation(d),y=[[p.x,p.y,Math.min(A||0,m||0,g||0,_||0)],[f.x,f.y,Math.max(A||0,m||0,g||0,_||0)]];let v=e.ce.fromPoints(y);const x=a.getWorldToCameraMatrix(),b=e.ad.mat4.invert(new Float64Array(16),x);v=e.ce.applyTransform(v,x);const w=this._extendAABB(v,a,l,n);if(!w)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v=w;const T=.5*e.ad.vec3.sub([],v.max,v.min)[2],B=this._minimumAABBFrustumDistance(a,v),C=[0,0,1,0];e.ad.vec4.transformMat4(C,C,x),e.ad.vec4.normalize(C,C);const S=e.ad.vec3.scale([],C,B+T),E=e.ad.vec3.add([],v.center,S);e.ad.vec3.transformMat4(v.center,v.center,b),e.ad.vec3.transformMat4(E,E,b);const M=a.unproject(new e.P(v.center[0],v.center[1])),I=e.dH(a.projection,M),P=Math.pow(2,I),L=Math.min(a._zoomFromMercatorZ(E[2]*a.pixelsPerMeter*P/a.worldSize),l.maxZoom);return a.mercatorFromTransition&&L<.5*(e.c6+e.bY)?(a.setProjection({name:"globe"}),a.zoom=L,this._cameraForBounds(a,i,r,n,o,s)):{center:M,zoom:L,bearing:n,pitch:o}}fitBounds(e,t,i){const r=this.cameraForBounds(e,t);return this._fitInternal(r,t,i)}fitScreenCoordinates(t,i,r,n,o){const s=e.P.convert(t),a=e.P.convert(i),l=new e.P(Math.min(s.x,a.x),Math.min(s.y,a.y)),c=new e.P(Math.max(s.x,a.x),Math.max(s.y,a.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(s,a))return this;const u=this.transform.pointLocation3D(l),h=this.transform.pointLocation3D(c),d=this.transform.pointLocation3D(new e.P(l.x,c.y)),p=this.transform.pointLocation3D(new e.P(c.x,l.y)),f=[Math.min(u.lng,h.lng,d.lng,p.lng),Math.min(u.lat,h.lat,d.lat,p.lat)],A=[Math.max(u.lng,h.lng,d.lng,p.lng),Math.max(u.lat,h.lat,d.lat,p.lat)],m=n&&n.pitch?n.pitch:this.getPitch(),g=this._cameraForBounds(this.transform,f,A,r,m,n);return this._fitInternal(g,n,o)}_fitInternal(t,i,r){return t?(i=e.l(t,i)).linear?this.easeTo(i,r):this.flyTo(i,r):this}jumpTo(t,i){this.stop();const r=t.preloadOnly?this.transform.clone():this.transform;let n=!1,o=!1,s=!1;"zoom"in t&&r.zoom!==+t.zoom&&(n=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=e.bO.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(o=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(s=!0,r.pitch=+t.pitch);const a="number"==typeof t.padding?this._extendPadding(t.padding):t.padding;if(null!=t.padding&&!r.isPaddingEqual(a))if(!1===t.retainPadding){const e=r.clone();e.padding=a,r.setLocationAtPoint(r.center,e.centerPoint)}else r.padding=a;return t.preloadOnly?(this._preloadTiles(r),this):(this.fire(new e.A("movestart",i)).fire(new e.A("move",i)),n&&this.fire(new e.A("zoomstart",i)).fire(new e.A("zoom",i)).fire(new e.A("zoomend",i)),o&&this.fire(new e.A("rotatestart",i)).fire(new e.A("rotate",i)).fire(new e.A("rotateend",i)),s&&this.fire(new e.A("pitchstart",i)).fire(new e.A("pitch",i)).fire(new e.A("pitchend",i)),this.fire(new e.A("moveend",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(el),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,i){const r=this.transform;if(!r.projection.supportsFreeCamera)return e.w(el),this;this.stop();const n=r.zoom,o=r.pitch,s=r.bearing;r.setFreeCameraOptions(t);const a=n!==r.zoom,l=o!==r.pitch,c=s!==r.bearing;return this.fire(new e.A("movestart",i)).fire(new e.A("move",i)),a&&this.fire(new e.A("zoomstart",i)).fire(new e.A("zoom",i)).fire(new e.A("zoomend",i)),c&&this.fire(new e.A("rotatestart",i)).fire(new e.A("rotate",i)).fire(new e.A("rotateend",i)),l&&this.fire(new e.A("pitchstart",i)).fire(new e.A("pitch",i)).fire(new e.A("pitchend",i)),this.fire(new e.A("moveend",i)),this}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.l({offset:[0,0],duration:500,easing:e.dD},t)).animate||this._prefersReducedMotion(t))&&(t.duration=0);const r=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?+t.zoom:n,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:s,h=this._extendPadding(t.padding),d=e.P.convert(t.offset);let p,f,A;if("globe"===r.projection.name){const i=e.ac.fromLngLat(r.center),n=d.rotate(-r.angle);i.x+=n.x/r.worldSize,i.y+=n.y/r.worldSize;const o=i.toLngLat(),s=e.bO.convert(t.center||o);this._normalizeCenter(s),p=r.centerPoint.add(n),f=new e.P(i.x,i.y).mult(r.worldSize),A=new e.P(e.av(s.lng),e.aC(s.lat)).mult(r.worldSize).sub(f)}else{p=r.centerPoint.add(d);const i=r.pointLocation(p),n=e.bO.convert(t.center||i);this._normalizeCenter(n),f=r.project(i),A=r.project(n).sub(f)}const m=r.zoomScale(l-n);let g,_;t.around&&(g=e.bO.convert(t.around),_=r.locationPoint(g));const y=this._zooming||l!==n,v=this._rotating||o!==c,x=this._pitching||u!==s,b=!r.isPaddingEqual(h),w=!1===t.retainPadding?r.clone():r,T=r=>T=>{if(y&&(r.zoom=e.ah(n,l,T)),v&&(r.bearing=e.ah(o,c,T)),x&&(r.pitch=e.ah(s,u,T)),b&&(w.interpolatePadding(a,h,T),p=w.centerPoint.add(d)),g)r.setLocationAtPoint(g,_);else{const e=r.zoomScale(r.zoom-n),t=l>n?Math.min(2,m):Math.max(.5,m),i=Math.pow(t,1-T),o=r.unproject(f.add(A.mult(T*i)).mult(e));r.setLocationAtPoint(r.renderWorldCopies?o.wrap():o,p)}return t.preloadOnly||this._fireMoveEvents(i),r};if(t.preloadOnly){const e=this._emulate(T,t.duration,r);return this._preloadTiles(e),this}const B={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=y,this._rotating=v,this._pitching=x,this._padding=b,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,B),this._ease(T(r),(e=>{"sea"===r.cameraElevationReference&&r.recenterOnTerrain(),this._afterEase(i,e)}),t),this}_prepareEase(t,i,r={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),i||r.moving||this.fire(new e.A("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.A("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.A("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new e.A("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.A("move",t)),this._zooming&&this.fire(new e.A("zoom",t)),this._rotating&&this.fire(new e.A("rotate",t)),this._pitching&&this.fire(new e.A("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const r=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new e.A("zoomend",t)),n&&this.fire(new e.A("rotateend",t)),o&&this.fire(new e.A("pitchend",t)),this.fire(new e.A("moveend",t))}flyTo(t,i){if(this._prefersReducedMotion(t)){const r=e.aA(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(r,i)}this.stop(),t=e.l({offset:[0,0],speed:1.2,curve:1.42,easing:e.dD},t);const r=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?e.ay(+t.zoom,r.minZoom,r.maxZoom):n,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:s,h=this._extendPadding(t.padding),d=r.zoomScale(l-n),p=e.P.convert(t.offset);let f=r.centerPoint.add(p);const A=r.pointLocation(f),m=e.bO.convert(t.center||A);this._normalizeCenter(m);const g=r.project(A),_=r.project(m).sub(g);let y=t.curve;const v=Math.max(r.width,r.height),x=v/d,b=_.mag();if("minZoom"in t){const i=e.ay(Math.min(t.minZoom,n,l),r.minZoom,r.maxZoom),o=v/r.zoomScale(i-n);y=Math.sqrt(o/b*2)}const w=y*y;function T(e){const t=(x*x-v*v+(e?-1:1)*w*w*b*b)/(2*(e?x:v)*w*b);return Math.log(Math.sqrt(t*t+1)-t)}function B(e){return(Math.exp(e)-Math.exp(-e))/2}function C(e){return(Math.exp(e)+Math.exp(-e))/2}const S=T(0);let E=function(e){return C(S)/C(S+y*e)},M=function(e){return v*((C(S)*(B(t=S+y*e)/C(t))-B(S))/w)/b;var t},I=(T(1)-S)/y;if(Math.abs(b)<1e-6||!isFinite(I)){if(Math.abs(v-x)<1e-6)return this.easeTo(t,i);const e=xt.maxDuration&&(t.duration=0);const P=o!==c,L=u!==s,F=!r.isPaddingEqual(h),k=!1===t.retainPadding?r.clone():r,z=r=>d=>{const A=d*I,y=1/E(A);r.zoom=1===d?l:n+r.scaleZoom(y),P&&(r.bearing=e.ah(o,c,d)),L&&(r.pitch=e.ah(s,u,d)),F&&(k.interpolatePadding(a,h,d),f=k.centerPoint.add(p));const v=1===d?m:r.unproject(g.add(_.mult(M(A))).mult(y));return r.setLocationAtPoint(r.renderWorldCopies?v.wrap():v,f),r._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(i),r};if(t.preloadOnly){const e=this._emulate(z,t.duration,r);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=P,this._pitching=L,this._padding=F,this._prepareEase(i,!1),this._ease(z(r),(()=>this._afterEase(i)),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,i,r){!1===r.animate||0===r.duration?(t(1),i()):(this._easeStart=e.q.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.q.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,i){t=e.bF(t,-180,180);const r=Math.abs(t-i);return Math.abs(t-360-i)180?-360:i<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&e.q.prefersReducedMotion&&!(t&&t.essential)}_emulate(e,t,i){const r=Math.ceil(15*t/1e3),n=[],o=e(i.clone());for(let e=0;e<=r;e++){const t=o(e/r);n.push(t.clone())}return n}_preloadTiles(e,t){}}class il{constructor(t={}){this.options=t,e.aQ(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact,i=e._getUIString("AttributionControl.ToggleAttribution");this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=l("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",i);const r=l("span","mapboxgl-ctrl-icon",this._compactButton);return r.setAttribute("aria-hidden","true"),r.setAttribute("title",i),this._innerContainer=l("div","mapboxgl-ctrl-attrib-inner",this._container),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.e.ACCESS_TOKEN}];if(t){const r=i.reduce(((e,t,r)=>(t.value&&(e+=`${t.key}=${t.value}${re.length-t.length)),e=e.filter(((t,i)=>{for(let r=i+1;r=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class rl{constructor(){e.aQ(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=l("div","mapboxgl-ctrl");const t=l("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(const t in e){const i=e[t].getSource();if(i.hasOwnProperty("mapbox_logo")&&!i.mapbox_logo)return!1}return!0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}class nl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class ol{constructor(e){this.jumpTo(e)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const i=e.cC((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i}}const sl={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class al extends e.A{constructor(e,t,i,r){const{point:n,lngLat:o,originalEvent:s,target:a}=e;super(e.type,{point:n,lngLat:o,originalEvent:s,target:a}),this.preventDefault=()=>{e.preventDefault()},this.id=t,this.interaction=i,this.feature=r}}class ll{constructor(e){this.map=e,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(t,i){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const r=i.filter;let n=i.type;r&&this.filters.set(t,e.a_(r)),"mouseover"===n&&(n="mouseenter"),"mouseout"===n&&(n="mouseleave");const o=this.interactionsByType.get(n)||new Map;"mouseenter"===n||"mouseleave"===n?(0===this.delegatedInteractions.size&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,i)):0===o.size&&this.map.on(n,this.handleType),0===o.size&&this.interactionsByType.set(n,o),o.set(t,i),this.typeById.set(t,n)}get(e){const t=this.typeById.get(e);if(!t)return;const i=this.interactionsByType.get(t);return i?i.get(e):void 0}remove(e){const t=this.typeById.get(e);if(!t)return;this.typeById.delete(e),this.filters.delete(e);const i=this.interactionsByType.get(t);i&&(i.delete(e),"mouseenter"===t||"mouseleave"===t?(this.delegatedInteractions.delete(e),0===this.delegatedInteractions.size&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):0===i.size&&this.map.off(t,this.handleType))}queryTargets(e,t){const i=[];for(const[e,r]of t)r.target&&i.push({targetId:e,target:r.target,filter:this.filters.get(e)});return this.map.style.queryRenderedTargets(e,i,this.map.transform)}handleMove(e){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const t=this.queryTargets(e.point,Array.from(this.delegatedInteractions).reverse());t.length&&(e.type="mouseenter",this.handleType(e,t));const i=new Map;for(const[e,{feature:t}]of this.prevHoveredFeatures)this.hoveredFeatures.has(e)||i.set(t.id,t);i.size&&(e.type="mouseleave",this.handleType(e,Array.from(i.values())))}handleOut(e){const t=Array.from(this.hoveredFeatures.values()).map((({feature:e})=>e));t.length&&(e.type="mouseleave",this.handleType(e,t)),this.hoveredFeatures.clear()}handleType(t,i){const r=Array.from(this.interactionsByType.get(t.type)).reverse(),n=!!i;i=i||this.queryTargets(t.point,r);const o="mouseenter"===t.type;let s=!1;const a=new Set;for(const l of i){for(const[i,c]of r){if(!c.target)continue;const r=l.variants?l.variants[i]:null;if(r){for(const u of r){if(at(u,l,a,i))continue;const r=new e.cx(l,u),h=st(u,l,i);n&&(r.state=this.map.getFeatureState(r));const d=o?this.prevHoveredFeatures.get(h):null,p=new al(t,i,c,r),f=d?d.stop:c.handler(p);if(o&&this.hoveredFeatures.set(h,{feature:l,stop:f}),!1!==f){s=!0;break}}if(s)break}}if(s)break}if(!s)for(const[e,i]of r){const{handler:r,target:n}=i;if(!n&&!1!==r(new al(t,e,i,null)))break}}}function cl(t,i){if(Array.isArray(t)&&Array.isArray(i)){const e=new Set(t),r=new Set(i);return e.size===r.size&&t.every((e=>r.has(e)))}return e.bn(t,i)}const ul={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},hl={showCompass:!0,showZoom:!0,visualizePitch:!1};class dl{constructor(t,i,r=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new Ca({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,r&&(this.mousePitch=new Sa({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.aQ(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchmove",this.touchmove),i.addEventListener("touchend",this.touchend),i.addEventListener("touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),p()}move(e,t){const i=this.map,r=this.mouseRotate.mousemoveWindow(e,t),n=r&&r.bearingDelta;if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){const r=this.mousePitch.mousemoveWindow(e,t),n=r&&r.pitchDelta;n&&i.setPitch(i.getPitch()+n)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){f(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(e.l({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),g(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,g(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=_(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=_(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)r.width||i.y>r.height;r.locationPoint3D(n).distSqr(i)180;){const e=r.locationPoint3D(t);if(e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}const fl={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%)"},Al={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class ml extends e.E{constructor(t,i){super(),(t instanceof HTMLElement||i)&&(t=e.l({element:t},i)),e.aQ(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:r="center",color:n="#3FB1CE",scale:o=1,draggable:s=!1,clickTolerance:a=0,rotation:l=Al.rotation,rotationAlignment:c=Al.rotationAlignment,pitchAlignment:u=Al.pitchAlignment,occludedOpacity:h=Al.occludedOpacity,altitude:d=Al.altitude}=t||{};this._anchor=r,this._color=n,this._scale=o,this._draggable=s,this._clickTolerance=a,this._rotation=l,this._rotationAlignment=c,this._pitchAlignment=u,this._occludedOpacity=h,this._altitude=d,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=e.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()}));const p=this._element.classList;for(const e in fl)p.remove(`mapboxgl-marker-anchor-${e}`);p.add(`mapboxgl-marker-anchor-${this._anchor}`);const f=t&&t.className?t.className.trim().split(/\s+/):[];p.add(...f),this._popup=null}_createDefaultMarker(){const e=l("div"),t=c("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},e);if(0===this._altitude){const e=c("radialGradient",{id:"shadowGradient"},c("defs",{},t));c("stop",{offset:"10%","stop-opacity":.4},e),c("stop",{offset:"100%","stop-opacity":.05},e),c("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},t)}return c("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},t),c("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},t),c("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},t),e}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.bO.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(e){return e===this._altitude||(this._defaultMarker&&(0===this._altitude&&0!==e||0!==this._altitude&&0===e)&&(this._element=this._createDefaultMarker()),this._altitude=e||Al.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,r=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,e._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return!1;const i=e.unproject(t,this._altitude),r=e.getFreeCameraOptions();if(!r.position)return!1;const n=r.position.toLngLat();return n.distanceTo(i)<.9*n.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)return void this._clearFadeTimer();const r=t.unproject(i,this._altitude);let n;t._showingGlobe()&&e.dK(t.transform,this._lngLat)?n=0:(n=1-t._queryFogOpacity(r),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(n*=this._occludedOpacity)),this._element.style.opacity=`${n}`,this._element.style.pointerEvents=n>0?"auto":"none",this._popup&&this._popup._setOpacity(n),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n translate(${e.x}px,${e.y}px)\n ${fl[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `}_calculateXYTransform(){const t=this._pos,i=this._map,r=this.getPitchAlignment();if(!i||!t||"map"!==r)return"";if(!i._showingGlobe()){const e=i.getPitch();return e?`rotateX(${e}deg)`:""}const n=e.c4(e.dL(i.transform,this._lngLat)),o=t.sub(e.dM(i.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";const a=n/s;return`rotateX(${-o.y*a}deg) rotateY(${o.x*a}deg)`}_calculateZTransform(){const t=this._pos,i=this._map;if(!i||!t)return"";let r=0;const n=this.getRotationAlignment();if("map"===n)if(i._showingGlobe()){const t=i.project(new e.bO(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),n=i.project(new e.bO(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(t);r=e.c4(Math.atan2(n.y,n.x))-90}else r=-i.getBearing();else if("horizon"===n){const n=e.ae(4,6,i.getZoom()),o=e.dM(i.transform);o.y+=n*i.transform.height;const s=t.sub(o),a=e.c4(Math.atan2(s.y,s.x));r=(a>90?a-270:a+90)*(1-n)}return r+=this._rotation,r?`rotateZ(${r}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);const t=this._map;t&&(t.transform.renderWorldCopies&&(this._lngLat=pl(this._lngLat,this._pos,t.transform)),this._pos=t.project(this._lngLat,this._altitude),!0===e?this._updateFrameId=requestAnimationFrame((()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())})):this._pos=this._pos.round(),t._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(t._showingGlobe()||t.getTerrain()||t.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))})))}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(t){const i=this._map;if(!i)return;const r=this._pointerdownPos,n=this._positionDelta;if(r&&n){if(!this._isDragging){const e=this._clickTolerance||i._clickTolerance;if(t.point.dist(r)t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.dI(window)&&(t.antialias=!1,e.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Yi(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies,null,null),t),this._repaint=!!t.repaint,this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._collectResourceTiming=t.collectResourceTiming,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new nl,this._domRenderTaskQueue=new nl,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.aW(),this._locale=e.l({},sl,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._tessellationStep=t.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=t.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new ol(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=t.scaleFactor,this._requestManager=new w(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,this._contextCreateOptions=t.contextCreateOptions?Object.assign({},t.contextCreateOptions):{},"string"==typeof t.container){const e=document.getElementById(t.container);if(!e)throw new Error(`Container '${t.container.toString()}' not found.`);this._container=e}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(this._container.childNodes.length>0&&e.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._spriteFormat=t.spriteFormat,e.aQ(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new Us),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},(()=>{this._update()})),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},(()=>{this.setScaleFactor(this._scaleFactor)})),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");if(this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Ja(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,(t.style||!t.testMode)&&this.setStyle(t.style||e.e.DEFAULT_STYLE,{config:t.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),this.indoor=new dr(this),t.hash&&(this._hash=new ia("string"==typeof t.hash&&t.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==n.center&&null==n.zoom||(this.transform._unmodified=!1),this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch});const i=t.bounds;i&&(this.resize(),this.fitBounds(i,e.l({},t.fitBoundsOptions,{duration:0})))}this.resize(),t.attributionControl&&this.addControl(new il({customAttribution:t.customAttribution})),this._logoControl=new rl,this.addControl(this._logoControl,t.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.A(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.A(`${t.dataType}dataloading`,t))})),this._interactions=new ll(this)}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=t.onAdd(this);this._controls.push(t);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const i=!this._moving;return i&&this.fire(new e.A("movestart",t)).fire(new e.A("move",t)),this.fire(new e.A("resize",t)),i&&this.fire(new e.A("moveend",t)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.aB.convert(t)),this._update()}setMinZoom(t){if((t=t??-2)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.A("zoomstart")).fire(new e.A("zoom")).fire(new e.A("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=t??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.A("pitchstart")).fire(new e.A("pitch")).fire(new e.A("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(e){return this._scaleFactor=e,this.painter.scaleFactor=e,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers((e=>"symbol"===e.type)),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map((e=>"auto"===e?navigator.language:e)):e}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const e of this._controls)e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const t=this.transform,i=t.projection.name;let r;"globe"===i&&t.zoom>=e.bY?(t.setMercatorFromTransition(),r=!0):"mercator"===i&&t.zoom=e.bY?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),i&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(t,i){return this.transform.locationPoint3D(e.bO.convert(t),i)}unproject(t,i){return this.transform.pointLocation3D(e.P.convert(t),i)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,t,i){const r=e=>{let i=[];if(Array.isArray(t)){const r=t.filter((e=>this.getLayer(e)));i=r.length?this.queryRenderedFeatures(e,{layers:r}):[]}else i=this.queryRenderedFeatures(e,{target:t});return i};if("mouseenter"===e||"mouseover"===e){let n=!1;const o=t=>{const o=r(t.point);o.length?n||(n=!0,i.call(this,new da(e,this,t.originalEvent,{features:o}))):n=!1};return{listener:i,targets:t,delegates:{mousemove:o,mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1;const o=t=>{r(t.point).length?n=!0:n&&(n=!1,i.call(this,new da(e,this,t.originalEvent)))},s=t=>{n&&(n=!1,i.call(this,new da(e,this,t.originalEvent)))};return{listener:i,targets:t,delegates:{mousemove:o,mouseout:s}}}{const n=e=>{const t=r(e.point);t.length&&(e.features=t,i.call(this,e),delete e.features)};return{listener:i,targets:t,delegates:{[e]:n}}}}on(e,t,i){if("function"==typeof t||void 0===i)return super.on(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r);for(const e in r.delegates)this.on(e,r.delegates[e]);return this}once(e,t,i){if("function"==typeof t||void 0===i)return super.once(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._createDelegatedListener(e,t,i);for(const e in r.delegates)this.once(e,r.delegates[e]);return this}off(e,t,i){if("function"==typeof t||void 0===i)return super.off(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._delegatedListeners?this._delegatedListeners[e]:void 0;return r&&(e=>{for(let r=0;r{r?(e.w(`Unable to perform style diff: ${String(r.message||r.error||r)}. Rebuilding the style from scratch.`),this._updateStyle(t,i)):n&&this._update(!0)}),(()=>{this._postStyleLoadEvent()})),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(t,i))}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(t,i){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),t){const r=e.l({},i);i&&i.config&&(r.initialConfig=i.config,delete r.config),this.style=new br(this,r).load(t),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new br(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.w("There is no style added to the map."),!1)}_isValidId(t){return null==t?(this.fire(new e.z(new Error("IDs can't be empty."))),!1):!e.cs(t)||(this.fire(new e.z(new Error(`IDs can't contain special symbols: "${t}".`))),!1)}_isTargetValid(e){return"featuresetId"in e?this._isValidId("importId"in e?e.importId:e.featuresetId):"layerId"in e&&this._isValidId(e.layerId)}_areTargetsValid(e){if(Array.isArray(e)){for(const t of e)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(e)}addSource(e,t){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(t,i,{pixelRatio:r=1,sdf:n=!1,stretchX:o,stretchY:s,content:a}={}){this._lazyInitEmptyStyle();const l=e.I.from(t);if(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap){const{width:t,height:c,data:u}=e.q.getImageData(i);this.style.addImage(l,this.style.scope,{data:new e.r({width:t,height:c},u),pixelRatio:r,stretchX:o,stretchY:s,content:a,sdf:n,version:0,usvg:!1})}else if(void 0===i.width||void 0===i.height)this.fire(new e.z(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`")));else{const{width:c,height:u}=i,h=i;this.style.addImage(l,this.style.scope,{data:new e.r({width:c,height:u},new Uint8Array(h.data)),pixelRatio:r,stretchX:o,stretchY:s,content:a,sdf:n,usvg:!1,version:0,userImage:h}),h.onAdd&&h.onAdd(this,t)}}updateImage(t,i){this._lazyInitEmptyStyle();const r=e.I.from(t),n=this.style.getImage(r,this.style.scope);if(!n)return void this.fire(new e.z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap?e.q.getImageData(i):i,{width:s,height:a,data:l}=o;if(void 0===s||void 0===a)return void this.fire(new e.z(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(s!==(n.usvg?n.icon.usvg_tree.width:n.data.width)||a!==(n.usvg?n.icon.usvg_tree.height:n.data.height))return void this.fire(new e.z(new Error(`The width and height of the updated image (${s}, ${a})\n must be that same as the previous version of the image\n (${n.data.width}, ${n.data.height})`)));const c=!(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap);let u=!1;n.usvg?(n.data=new e.r({width:s,height:a},new Uint8Array(l)),n.usvg=!1,n.icon=void 0,u=!0):n.data.replace(l,c),this.style.updateImage(r,this.style.scope,n,u)}hasImage(t){return t?!!this.style&&!!this.style.getImage(e.I.from(t),this.style.scope):(this.fire(new e.z(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(e.I.from(t),this.style.scope)}loadImage(t,i){e.o(this._requestManager.transformRequest(t,e.R.Image),((t,r)=>{i(t,r instanceof HTMLImageElement?e.q.getImageData(r):r)}))}listImages(){return this.style.listImages().map((e=>e.name))}addModel(e,t){this._lazyInitEmptyStyle(),this.style.addModel(e,t)}hasModel(t){return t?this.style.hasModel(t):(this.fire(new e.z(new Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,t){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)):this}getSlot(e){const t=this.getLayer(e);return t&&t.slot||null}setSlot(e,t){return this.style.setSlot(e,t),this.style.mergeLayers(),this._update(!0)}addImport(e,t){return this.style.addImport(e,t),this}updateImport(e,t){return"string"!=typeof t&&t.id!==e?(this.removeImport(e),this.addImport(t)):(this.style.updateImport(e,t),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,t){return this.style.moveImport(e,t),this._update(!0)}moveLayer(e,t){return this._isValidId(e)?(this.style.moveLayer(e,t),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){if(!this._isValidId(e))return null;const t=this.style.getOwnLayer(e);return t?"custom"===t.type?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(e,t,i){return this._isValidId(e)?(this.style.setLayerZoomRange(e,t,i),this._update(!0)):this}setFilter(e,t,i={}){return this._isValidId(e)?(this.style.setFilter(e,t,i),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setPaintProperty(e,t,i,r),this._update(!0)):this}getPaintProperty(e,t){return this._isValidId(e)?this.style.getPaintProperty(e,t):null}setLayoutProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,t,i,r),this._update(!0)):this}getLayoutProperty(e,t){return this._isValidId(e)?this.style.getLayoutProperty(e,t):null}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(e){return this.style.setGlyphsUrl(e),this._update(!0)}getSchema(e){return this.style.getSchema(e)}setSchema(e,t){return this.style.setSchema(e,t),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,t){return this.style.setConfig(e,t),this._update(!0)}getConfigProperty(e,t){return this.style.getConfigProperty(e,t)}setConfigProperty(e,t,i){return this.style.setConfigProperty(e,t,i),this._update(!0)}getFeaturesetDescriptors(e){return this.style.getFeaturesetDescriptors(e)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){const t=e[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(e){return this._lazyInitEmptyStyle(),this.style.setSnow(e),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(e){return this._lazyInitEmptyStyle(),this.style.setRain(e),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),this._update(!0)}setImportColorTheme(e,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(e,t),this._update(!0)}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.bO.convert(t),this.transform):0}setFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.setFeatureState(e,t),this._update())}removeFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.removeFeatureState(e,t),this._update())}getFeatureState(e){return e.source&&!this._isValidId(e.source)?null:this.style.getFeatureState(e)}_updateContainerDimensions(){if(!this._container)return;const e=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let i,r,n,o=this._container;for(;o&&(!r||!n);){const e=window.getComputedStyle(o).transform;e&&"none"!==e&&(i=e.match(/matrix.*\((.+)\)/)[1].split(", "),i[0]&&"0"!==i[0]&&"1"!==i[0]&&(r=i[0]),i[3]&&"0"!==i[3]&&"1"!==i[3]&&(n=i[3])),o=o.parentElement}this._containerWidth=r?Math.abs(e/r):e,this._containerHeight=n?Math.abs(t/n):t}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=l("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=l("div","mapboxgl-canvas-container",e);this._canvas=l("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=l("div","mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach((e=>{r[e]=l("div",`mapboxgl-ctrl-${e}`,i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i){const r=e.q.devicePixelRatio||1;this._canvas.width=r*Math.ceil(t),this._canvas.height=r*Math.ceil(i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const t=e.l({},a.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl2",t);i?(Q(i,!0),this.painter=new ea(i,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp),this.on("data",(e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)})),e.m.testSupport(i)):this.fire(new e.z(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.A("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style.reloadModels(),this.style.clearSources(),this._update(),this.fire(new e.A("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(t){let n;this.fire(new e.A("renderstart")),++this._frameId;const o=this.painter.context.extTimerQuery,s=e.q.now(),a=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(n=a.createQuery(),a.beginQuery(o.TIME_ELAPSED_EXT,n)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();const l=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=this.transform.pitch,r=e.q.now(),n=new e.aa(t,{now:r,fadeDuration:l,pitch:i,transition:this.style.transition});this.style.update(n)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let c=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),c=this._updateAverageElevation(s),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):c=this._updateAverageElevation(s);const u=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),u&&(this._placementDirty=u.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,r.mark(i.load),this.fire(new e.A("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),n){const t=e.q.now()-s;a.endQuery(o.TIME_ELAPSED_EXT),setTimeout((()=>{const i=a.getQueryParameter(n,a.QUERY_RESULT)/1e6;a.deleteQuery(n),this.fire(new e.A("gpu-timing-frame",{cpuTime:t,gpuTime:i}))}),50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(t);this.fire(new e.A("gpu-timing-layer",{layerTimes:i}))}),50)}if(this.listens("gpu-timing-deferred-render")){const t=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const i=this.painter.queryGpuTimeDeferredRender(t);this.fire(new e.A("gpu-timing-deferred-render",{gpuTime:i}))}),50)}const h=this._sourcesDirty||this._styleDirty||this._placementDirty||c;if(h||this._repaint)this.triggerRepaint();else{const t=this.idle();if(t&&(c=this._updateAverageElevation(s,!0)),c)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.A("speedindexcompleted",{speedIndex:t})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0,r.mark(i.fullLoad),this._performanceMetricsCollection&&D(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const i=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);const r=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(r||(t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let n=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;const o=Math.abs(t-n);if(o>1){if(this._isInitialLoad||r)return this._averageElevation.jumpTo(n),i(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),i(n)}return!!this._averageElevation.isEasing(e)&&i(this._averageElevation.getValue(e))}_authenticate(){U(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(t=>{if(t&&(t.message===b||401===t.status)){const t=this.painter.context.gl;Q(t,!1),this._logoControl instanceof rl&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.z(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),F(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_postStyleLoadEvent(){this.style.globalId&&z(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const i=this.painter.context.gl,r=i.createFramebuffer();function n(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);const t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,r),this._canvasPixelComparison(n(e),t.canvasCopies.map(n),t.timeStamps)}_canvasPixelComparison(e,t,i){let r=i[1]-i[0];const n=e.length/4;for(let o=0;o{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)})))}_preloadTiles(t){const i=this.style?this.style.getSourceCaches():[];return e.bl(i,((e,i)=>e._preloadTiles(t,i)),(()=>{this.triggerRepaint()})),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,this._tp.refreshUI(),e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,this._tp.refreshUI(),e&&this._update())}_setCacheLimits(t,i){e.dJ(t,i)}get version(){return t}},NavigationControl:class{constructor(t={}){this.options=e.l({},hl,t),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(e.aQ(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(e=>{this._map&&this._map.zoomIn({},{originalEvent:e})})),l("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(e=>{this._map&&this._map.zoomOut({},{originalEvent:e})})),l("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.aQ(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))})),this._compassIcon=l("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),i=t===e.getMaxZoom(),r=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=t)}))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new dl(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const i=l("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends e.E{constructor(t={}){super();const i=navigator.geolocation;this.options=e.l({geolocation:i},gl,t),e.aQ(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=ta(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){const t=(t=!!this.options.geolocation)=>{this._supportsGeolocation=t,e(t)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then((e=>t("denied"!==e.state))).catch((()=>t())):t()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitudet.getEast()||i.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.A("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.A("geolocate",t)),this._finish()}}_updateCamera(t){const i=new e.bO(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,n=this._map.getBearing(),o=e.l({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(r),o,{geolocateSource:!0})}_updateMarker(t){if(t){const i=new e.bO(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map.transform,i=e.bH(1,t._center.lat)*t.worldSize,r=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${r}px`,this._circleElement.style.height=`${r}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.A("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=l("button","mapboxgl-ctrl-geolocate",this._container),l("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=l("div","mapboxgl-user-location"),this._dotElement.appendChild(l("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(l("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new ml({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=l("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ml({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",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.A("trackuserlocationend")))}))}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const e=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};"undefined"!=typeof DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((t=>{"granted"===t&&e()})).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:il,ScaleControl:class{constructor(t={}){this.options=e.l({},_l,t),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.aQ(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,r=t._containerWidth/2-e/2,n=t.unproject([r,i]),o=t.unproject([r+e,i]),s=n.distanceTo(o);if("imperial"===this.options.unit){const t=3.2808*s;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,s/1852,"nautical-mile"):s>=1e3?this._setScale(e,s/1e3,"kilometer"):this._setScale(e,s,"meter")}_setScale(e,t,i){this._map._requestDomTask((()=>{const r=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(t),n=r/t;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==i?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:i}).format(r):`${r} ${yl[i]}`,this._container.style.width=e*n+"px"}))}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(t={}){this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w("Full screen control 'container' must be a DOM element.")),e.aQ(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=l("button","mapboxgl-ctrl-fullscreen",this._controlContainer);l("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.E{constructor(t){super(),this.options=e.l(Object.create(vl),t),this._altitude=this.options.altitude,e.aQ(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[])}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.A("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.A("close")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.bO.convert(t),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(e){return this._altitude=e,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=l("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=l("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.innerHTML='',e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,r=this._pos;if(!t||!i||!r)return"bottom";const n=i.offsetWidth,o=i.offsetHeight,s=r.xt.transform.width-n/2;if(r.y+et.transform.height-o){if(s)return"bottom-left";if(a)return"bottom-right"}return s?"left":a?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(t){const i=this._map,r=this._content;if(!i||!this._lngLat&&!this._trackPointer||!r)return;let n=this._container;if(n||(n=this._container=l("div","mapboxgl-popup",i.getContainer()),this._tip=l("div","mapboxgl-popup-tip",n),n.appendChild(r)),this.options.maxWidth&&n.style.maxWidth!==this.options.maxWidth&&(n.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=pl(this._lngLat,this._pos,i.transform)),!this._trackPointer||t){const r=this._pos=this._trackPointer&&t instanceof e.P?t:i.project(this._lngLat,this._altitude),n=bl(this.options.offset),o=this._anchor=this._getAnchor(n.y),s=bl(this.options.offset,o),a=r.add(s).round();i._requestDomTask((()=>{this._container&&o&&(this._container.style.transform=`${fl[o]} translate(${a.x}px,${a.y}px)`)}))}if(!this._marker&&i._showingGlobe()){const t=e.dK(i.transform,this._lngLat)?0:1;this._setOpacity(t)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(xl);e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:ml,Style:br,LngLat:e.bO,LngLatBounds:e.aB,Point:e.P,MercatorCoordinate:e.ac,FreeCameraOptions:Zi,Evented:e.E,config:e.e,prewarm:e.dP,clearPrewarmedResources:e.dQ,get accessToken(){return e.e.ACCESS_TOKEN},set accessToken(t){e.e.ACCESS_TOKEN=t},get baseApiUrl(){return e.e.API_URL},set baseApiUrl(t){e.e.API_URL=t},get workerCount(){return e.dR.workerCount},set workerCount(t){e.dR.workerCount=t},get maxParallelImageRequests(){return e.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.e.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.dS(t)},get workerUrl(){return e.dT.workerUrl},set workerUrl(t){e.dT.workerUrl=t},get workerClass(){return e.dT.workerClass},set workerClass(t){e.dT.workerClass=t},get workerParams(){return e.dT.workerParams},set workerParams(t){e.dT.workerParams=t},get dracoUrl(){return e.dU()},set dracoUrl(t){e.dV(t)},get meshoptUrl(){return e.dW()},set meshoptUrl(t){e.dX(t)},setNow:e.q.setNow,restoreNow:e.q.restoreNow};return wl}));var n=i;return n}();var xe=_e(ve.exports),be=e({__proto__:null,default:xe},[ve.exports]),we={exports:{}};we.exports=function(){var e={},t={};function i(i,r,n){if(t[i]=n,"index"===i){var o="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",s={};return t.shared(s),t.index(e,s),"undefined"!=typeof window&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),e}}return i("shared",["exports"],(function(e){function t(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,n;function o(){if(n)return r;function e(e,t){this.x=e,this.y=t}return n=1,r=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},r}"function"==typeof SuppressedError&&SuppressedError;var s,a,l=i(o()),c=function(){if(a)return s;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return a=1,s=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},s}(),u=i(c);let h,d;function p(){return null==h&&(h="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),h}function f(){if(null==d&&(d=!1,p())){const e=5,t=new OffscreenCanvas(e,e).getContext("2d",{willReadFrequently:!0});if(t){for(let i=0;i=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function F(e,t,i,r){const n=new u(e,t,i,r);return e=>n.solve(e)}const k=F(.25,.1,.25,1);function z(e,t,i){return Math.min(i,Math.max(t,e))}function R(e,t,i){const r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function D(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let O=1;function U(e,t,i){const r={};for(const i in e)r[i]=t.call(this,e[i],i,e);return r}function N(e,t,i){const r={};for(const i in e)t.call(this,e[i],i,e)&&(r[i]=e[i]);return r}function Q(e){return Array.isArray(e)?e.map(Q):"object"==typeof e&&e?U(e,Q):e}const j={};function V(e){j[e]||("undefined"!=typeof console&&console.warn(e),j[e]=!0)}function H(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function G(e){return"undefined"!=typeof WorkerGlobalScope&&void 0!==e&&e instanceof WorkerGlobalScope}let $=null;function Z(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}const q="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function K(e,i,r,n,o){return t(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const t=new VideoFrame(e,{timestamp:0});try{const s=null==t?void 0:t.format;if(!s||!s.startsWith("BGR")&&!s.startsWith("RGB"))throw new Error(`Unrecognized format ${s}`);const a=s.startsWith("BGR"),l=new Uint8ClampedArray(n*o*4);if(yield t.copyTo(l,function(e,t,i,r,n){const o=4*Math.max(1,0),s=(Math.max(0,i)-i)*r*4+o,a=4*r,l=Math.max(0,t),c=Math.max(0,i);return{rect:{x:l,y:c,width:Math.min(e.width,t+r)-l,height:Math.min(e.height,i+n)-c},layout:[{offset:s,stride:a}]}}(e,i,r,n,o)),a)for(let e=0;e{e.removeEventListener(t,i,r)}}}function J(e){return e/Math.PI*180}const ee={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},te={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},ie="AbortError";function re(){return new Error(ie)}const ne={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function oe(e){return ne.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const se="global-dispatcher";class ae extends Error{constructor(e,t,i,r){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=r}}const le=()=>G(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,ce=function(e,i){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){const t=oe(e.url);if(t)return t(e,i);if(G(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:se},i)}if(!(/^file:/.test(r=e.url)||/^file:/.test(le())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(e,i){return t(this,void 0,void 0,(function*(){const t=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:le(),signal:i.signal});let r,n;"json"!==e.type||t.headers.has("Accept")||t.headers.set("Accept","application/json");try{r=yield fetch(t)}catch(t){throw new ae(0,t.message,e.url,new Blob)}if(!r.ok){const t=yield r.blob();throw new ae(r.status,r.statusText,e.url,t)}n="arrayBuffer"===e.type||"image"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text();const o=yield n;if(i.signal.aborted)throw re();return{data:o,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}))}(e,i);if(G(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:se},i)}var r;return function(e,t){return new Promise(((i,r)=>{var n;const o=new XMLHttpRequest;o.open(e.method||"GET",e.url,!0),"arrayBuffer"!==e.type&&"image"!==e.type||(o.responseType="arraybuffer");for(const t in e.headers)o.setRequestHeader(t,e.headers[t]);"json"===e.type&&(o.responseType="text",(null===(n=e.headers)||void 0===n?void 0:n.Accept)||o.setRequestHeader("Accept","application/json")),o.withCredentials="include"===e.credentials,o.onerror=()=>{r(new Error(o.statusText))},o.onload=()=>{if(!t.signal.aborted)if((o.status>=200&&o.status<300||0===o.status)&&null!==o.response){let t=o.response;if("json"===e.type)try{t=JSON.parse(o.response)}catch(e){return void r(e)}i({data:t,cacheControl:o.getResponseHeader("Cache-Control"),expires:o.getResponseHeader("Expires")})}else{const t=new Blob([o.response],{type:o.getResponseHeader("Content-Type")});r(new ae(o.status,o.statusText,e.url,t))}},t.signal.addEventListener("abort",(()=>{o.abort(),r(re())})),o.send(e.body)}))}(e,i)};function ue(e){if(!e||e.indexOf("://")<=0||0===e.indexOf("data:image/")||0===e.indexOf("blob:"))return!0;const t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function he(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function de(e,t,i){if(i&&i[e]){const r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class pe{constructor(e,t={}){D(this,t),this.type=e}}class fe extends pe{constructor(e,t={}){super("error",D({error:e},t))}}class Ae{on(e,t){return this._listeners=this._listeners||{},he(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return de(e,t,this._listeners),de(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},he(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){"string"==typeof e&&(e=new pe(e,t||{}));const i=e.type;if(this.listens(i)){e.target=this;const t=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of t)i.call(this,e);const r=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const t of r)de(i,t,this._oneTimeListeners),t.call(this,e);const n=this._eventedParent;n&&(D(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(e))}else e instanceof fe&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var me={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_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 ge=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function _e(e,t){const i={};for(const t in e)"ref"!==t&&(i[t]=e[t]);return ge.forEach((e=>{e in t&&(i[e]=t[e])})),i}function ye(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Ze=[Le,Fe,ke,ze,Re,De,Qe,Oe,Ge(Ue),je,Ve,He];function qe(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!qe(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Ze)if(!qe(e,t))return null}return`Expected ${$e(e)} but found ${$e(t)} instead.`}function Ke(e,t){return t.some((t=>t.kind===e.kind))}function We(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}function Xe(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const Ye=.96422,Je=.82521,et=4/29,tt=6/29,it=3*tt*tt,rt=tt*tt*tt,nt=Math.PI/180,ot=180/Math.PI;function st(e){return(e%=360)<0&&(e+=360),e}function at([e,t,i,r]){let n,o;const s=ct((.2225045*(e=lt(e))+.7168786*(t=lt(t))+.0606169*(i=lt(i)))/1);e===t&&t===i?n=o=s:(n=ct((.4360747*e+.3850649*t+.1430804*i)/Ye),o=ct((.0139322*e+.0971045*t+.7141733*i)/Je));const a=116*s-16;return[a<0?0:a,500*(n-s),200*(s-o),r]}function lt(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ct(e){return e>rt?Math.pow(e,1/3):e/it+et}function ut([e,t,i,r]){let n=(e+16)/116,o=isNaN(t)?n:n+t/500,s=isNaN(i)?n:n-i/200;return n=1*dt(n),o=Ye*dt(o),s=Je*dt(s),[ht(3.1338561*o-1.6168667*n-.4906146*s),ht(-.9787684*o+1.9161415*n+.033454*s),ht(.0719453*o-.2289914*n+1.4052427*s),r]}function ht(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function dt(e){return e>tt?e*e*e:it*(e-et)}function pt(e){return parseInt(e.padEnd(2,e),16)/255}function ft(e,t){return At(t?e/100:e,0,1)}function At(e,t,i){return Math.min(Math.max(t,e),i)}function mt(e){return!e.some(Number.isNaN)}const gt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function _t(e,t,i){return e+i*(t-e)}function yt(e,t,i){return e.map(((e,r)=>_t(e,t[r],i)))}class vt{constructor(e,t,i,r=1,n=!0){this.r=e,this.g=t,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,i,r]))}static parse(e){if(e instanceof vt)return e;if("string"!=typeof e)return;const t=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=gt[e];if(t){const[e,i,r]=t;return[e/255,i/255,r/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let i=1;return[pt(e.slice(i,i+=t)),pt(e.slice(i,i+=t)),pt(e.slice(i,i+=t)),pt(e.slice(i,i+t)||"ff")]}if(e.startsWith("rgb")){const t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[e,i,r,n,o,s,a,l,c,u,h,d]=t,p=[n||" ",a||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[r,s,c].join(""),t="%%%"===e?100:""===e?255:0;if(t){const e=[At(+i/t,0,1),At(+o/t,0,1),At(+l/t,0,1),h?ft(+h,d):1];if(mt(e))return e}}return}}const i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[e,t,r,n,o,s,a,l,c]=i,u=[r||" ",o||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,At(+n,0,100),At(+s,0,100),l?ft(+l,c):1];if(mt(e))return function([e,t,i,r]){function n(r){const n=(r+e/30)%12,o=t*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return e=st(e),t/=100,i/=100,[n(0),n(8),n(4),r]}(e)}}}(e);return t?new vt(...t,!1):void 0}get rgb(){const{r:e,g:t,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[e/n,t/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,i,r,n]=at(e),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?st(Math.atan2(r,i)*ot):NaN,o,t,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",at(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,r]=this.rgb;return`rgba(${[e,t,i].map((e=>Math.round(255*e))).join(",")},${r})`}static interpolate(e,t,i,r="rgb"){switch(r){case"rgb":{const[r,n,o,s]=yt(e.rgb,t.rgb,i);return new vt(r,n,o,s,!1)}case"hcl":{const[r,n,o,s]=e.hcl,[a,l,c,u]=t.hcl;let h,d;if(isNaN(r)||isNaN(a))isNaN(r)?isNaN(a)?h=NaN:(h=a,1!==o&&0!==o||(d=l)):(h=r,1!==c&&0!==c||(d=n));else{let e=a-r;a>r&&e>180?e-=360:a180&&(e+=360),h=r+i*e}const[p,f,A,m]=function([e,t,i,r]){return e=isNaN(e)?0:e*nt,ut([i,Math.cos(e)*t,Math.sin(e)*t,r])}([h,null!=d?d:_t(n,l,i),_t(o,c,i),_t(s,u,i)]);return new vt(p,f,A,m,!1)}case"lab":{const[r,n,o,s]=ut(yt(e.lab,t.lab,i));return new vt(r,n,o,s,!1)}}}}vt.black=new vt(0,0,0,1),vt.white=new vt(1,1,1,1),vt.transparent=new vt(0,0,0,0),vt.red=new vt(1,0,0,1);class xt{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const bt=["bottom","center","top"];class wt{constructor(e,t,i,r,n,o){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=o}}class Tt{constructor(e){this.sections=e}static fromString(e){return new Tt([new wt(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof Tt?e:Tt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}}class Bt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Bt)return e;if("number"==typeof e)return new Bt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Bt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new Bt(yt(e.values,t.values,i))}}class Ct{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const St=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Et{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Et)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Lt(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof It||e instanceof vt||e instanceof xt||e instanceof Tt||e instanceof Bt||e instanceof Et||e instanceof Mt)return!0;if(Array.isArray(e)){for(const t of e)if(!Lt(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Lt(e[t]))return!1;return!0}return!1}function Ft(e){if(null===e)return Le;if("string"==typeof e)return ke;if("boolean"==typeof e)return ze;if("number"==typeof e)return Fe;if(e instanceof vt)return Re;if(e instanceof It)return De;if(e instanceof xt)return Ne;if(e instanceof Tt)return Qe;if(e instanceof Bt)return je;if(e instanceof Et)return He;if(e instanceof Mt)return Ve;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=Ft(t);if(i){if(i===e)continue;i=Ue;break}i=e}return Ge(i||Ue,t)}return Oe}function kt(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof vt||e instanceof It||e instanceof Tt||e instanceof Bt||e instanceof Et||e instanceof Mt?e.toString():JSON.stringify(e)}class zt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Lt(e[1]))return t.error("invalid value");const i=e[1];let r=Ft(i);const n=t.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new zt(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Rt={string:ke,number:Fe,boolean:ze,object:Oe};class Dt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in Rt)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=Rt[i],r++}else n=Ue;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],r++}i=Ge(n,o)}else{if(!Rt[n])throw new Error(`Types doesn't contain name = ${n}`);i=Rt[n]}const o=[];for(;re.outputDefined()))}}const Ot={"to-boolean":ze,"to-color":Re,"to-number":Fe,"to-string":ke};class Ut{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(!Ot[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!==e.length)return t.error("Expected one argument.");const r=Ot[i],n=[];for(let i=1;i4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Pt(t[0],t[1],t[2],t[3]),!i))return new vt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Ct(i||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const r=Bt.parse(t);if(r)return r}throw new Ct(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const r=Et.parse(t);if(r)return r}throw new Ct(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new Ct(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Tt.fromString(kt(this.args[0].evaluate(e)));case"resolvedImage":return Mt.fromString(kt(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return kt(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Nt=["Unknown","Point","LineString","Polygon"];class Qt{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?Nt[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(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=vt.parse(e)),t}}class jt{constructor(e,t,i=[],r,n=new Pe,o=[]){this.registry=e,this.path=i,this.key=i.map((e=>`[${e}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=t}parse(e,t,i,r,n={}){return t?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}_parse(e,t){function i(e,t,i){return"assert"===i?new Dt(t,[e]):"coerce"===i?new Ut(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind)if("projectionDefinition"!==e.kind||"string"!==n.kind&&"array"!==n.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==e.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind)if("variableAnchorOffsetCollection"!==e.kind||"value"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof zt)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const t=new Qt;try{r=new zt(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const r="number"==typeof e?this.path.concat(e):this.path,n=i?this.scope.concat(i):this.scope;return new jt(this.registry,this._isConstant,r,t||null,n,this.errors)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new Ie(i,e))}checkSubtype(e,t){const i=qe(e,t);return i&&this.error(i),i}}class Vt{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let r=1;r=i.length)throw new Ct(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new Ct(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class $t{constructor(e,t){this.type=ze,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Ue),r=t.parse(e[2],2,Ue);return i&&r?Ke(i.type,[ze,ke,Fe,Le,Ue])?new $t(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${$e(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!We(t,["boolean","string","number","null"]))throw new Ct(`Expected first argument to be of type boolean, string, number or null, but found ${$e(Ft(t))} instead.`);if(!We(i,["string","array"]))throw new Ct(`Expected second argument to be of type array or string, but found ${$e(Ft(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Zt{constructor(e,t,i){this.type=Fe,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Ue),r=t.parse(e[2],2,Ue);if(!i||!r)return null;if(!Ke(i.type,[ze,ke,Fe,Le,Ue]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${$e(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Fe);return n?new Zt(i,r,n):null}return new Zt(i,r)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!We(t,["boolean","string","number","null"]))throw new Ct(`Expected first argument to be of type boolean, string, number or null, but found ${$e(Ft(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),We(i,["string"])){const e=i.indexOf(t,r);return-1===e?-1:[...i.slice(0,e)].length}if(We(i,["array"]))return i.indexOf(t,r);throw new Ct(`Expected second argument to be of type array or string, but found ${$e(Ft(i))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class qt{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let s=2;sNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Ft(e)))return null}else i=Ft(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(l,s,r);if(!u)return null;r=r||u.type,o.push(u)}const s=t.parse(e[1],1,Ue);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,r);return a?"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new qt(i,r,s,n,o,a):null}evaluate(e){const t=this.input.evaluate(e);return(Ft(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Kt{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const r=[];for(let n=1;nt.outputDefined()))&&this.otherwise.outputDefined()}}class Wt{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Ue),r=t.parse(e[2],2,Fe);if(!i||!r)return null;if(!Ke(i.type,[Ge(Ue),ke,Ue]))return t.error(`Expected first argument to be of type array or string, but found ${$e(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Fe);return n?new Wt(i.type,i,r,n):null}return new Wt(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),We(t,["string"]))return[...t].slice(i,r).join("");if(We(t,["array"]))return t.slice(i,r);throw new Ct(`Expected first argument to be of type array or string, but found ${$e(Ft(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Xt(e,t){const i=e.length-1;let r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=e[a],n=e[a+1],r<=t){if(a===i||tt))throw new Ct("Input is not a number.");s=a-1}return 0}class Yt{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,Fe);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new Yt(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[Xt(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Jt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ei,ti,ii=function(){if(ti)return ei;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return ti=1,ei=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},ei}(),ri=Jt(ii);class ni{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=oi(t,e.base,i,r);else if("linear"===e.name)n=oi(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new ri(o[0],o[1],o[2],o[3]).solve(oi(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,Fe),!n)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=Re:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(r,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return Xe(a,Fe)||Xe(a,De)||Xe(a,Re)||Xe(a,je)||Xe(a,He)||Xe(a,Ge(Fe))?new ni(a,i,r,n,s):t.error(`Type ${$e(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=Xt(t,r),s=ni.interpolationFactor(this.interpolation,r,t[o],t[o+1]),a=i[o].evaluate(e),l=i[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return _t(a,l,s);case"color":return vt.interpolate(a,l,s);case"padding":return Bt.interpolate(a,l,s);case"variableAnchorOffsetCollection":return Et.interpolate(a,l,s);case"array":return yt(a,l,s);case"projectionDefinition":return It.interpolate(a,l,s)}case"interpolate-hcl":return vt.interpolate(a,l,s,"hcl");case"interpolate-lab":return vt.interpolate(a,l,s,"lab")}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function oi(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}const si={color:vt.interpolate,number:_t,padding:Bt.interpolate,variableAnchorOffsetCollection:Et.interpolate,array:yt};class ai{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of e.slice(1)){const e=t.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}if(!i)throw new Error("No output type");const o=r&&n.some((e=>qe(r,e.type)));return new ai(o?Ue:i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(e),i&&i instanceof Mt&&!i.available&&(t||(t=i.name),i=null,r===this.args.length&&(i=t)),null!==i)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function li(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function ci(e,t,i,r){return 0===r.compare(t,i)}function ui(e,t,i){const r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=ze,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,Ue);if(!o)return null;if(!li(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${$e(o.type)}'.`);let s=t.parse(e[2],2,Ue);if(!s)return null;if(!li(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${$e(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${$e(o.type)}' and '${$e(s.type)}'.`);r&&("value"===o.type.kind&&"value"!==s.type.kind?o=new Dt(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new Dt(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,Ne),!a)return null}return new n(o,s,a)}evaluate(n){const o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=Ft(o),i=Ft(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Ct(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=Ft(o),i=Ft(s);if("string"!==e.kind||"string"!==i.kind)return t(n,o,s)}return this.collator?i(n,o,s,this.collator.evaluate(n)):t(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const hi=ui("==",(function(e,t,i){return t===i}),ci),di=ui("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!ci(0,t,i,r)})),pi=ui("<",(function(e,t,i){return t",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),Ai=ui("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),mi=ui(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0}));class gi{constructor(e,t,i){this.type=Ne,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");const r=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,ze);if(!r)return null;const n=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,ze);if(!n)return null;let o=null;return i.locale&&(o=t.parse(i.locale,1,ke),!o)?null:new gi(r,n,o)}evaluate(e){return new xt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class _i{constructor(e,t,i,r,n){this.type=ke,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Fe);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parse(r.locale,1,ke),!n))return null;let o=null;if(r.currency&&(o=t.parse(r.currency,1,ke),!o))return null;let s=null;if(r["min-fraction-digits"]&&(s=t.parse(r["min-fraction-digits"],1,Fe),!s))return null;let a=null;return r["max-fraction-digits"]&&(a=t.parse(r["max-fraction-digits"],1,Fe),!a)?null:new _i(i,n,o,s,a)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class yi{constructor(e){this.type=Qe,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,Fe),!e))return null;let i=null;if(o["text-font"]&&(i=t.parse(o["text-font"],1,Ge(ke)),!i))return null;let s=null;if(o["text-color"]&&(s=t.parse(o["text-color"],1,Re),!s))return null;let a=null;if(o["vertical-align"]){if("string"==typeof o["vertical-align"]&&!bt.includes(o["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(a=t.parse(o["vertical-align"],1,ke),!a)return null}const l=r[r.length-1];l.scale=e,l.font=i,l.textColor=s,l.verticalAlign=a}else{const o=t.parse(e[i],1,Ue);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null,verticalAlign:null})}}return new yi(r)}evaluate(e){return new Tt(this.sections.map((t=>{const i=t.content.evaluate(e);return Ft(i)===Ve?new wt("",i,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new wt(kt(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class vi{constructor(e){this.type=Ve,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ke);return i?new vi(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=Mt.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class xi{constructor(e){this.type=Fe,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${$e(i.type)} instead.`):new xi(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new Ct(`Expected value to be of type string or array, but found ${$e(Ft(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const bi=8192;function wi(e,t){const i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*bi),Math.round(r*n*bi)]}function Ti(e,t){const i=Math.pow(2,t.z);return[(n=(e[0]/bi+t.x)/i,360*n-180),(r=(e[1]/bi+t.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function Bi(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Ci(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Si(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],s=e[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function Ei(e,t,i,r){return 0!=(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!ki(e,t,i,r)||!ki(i,r,e,t));var n,o}function Mi(e,t,i){for(const r of i)for(let i=0;i(n=e)[1]!=(s=a[t+1])[1]>n[1]&&n[0]<(s[0]-o[0])*(n[1]-o[1])/(s[1]-o[1])+o[0]&&(r=!r)}var n,o,s;return r}function Pi(e,t){for(const i of t)if(Ii(e,i))return!0;return!1}function Li(e,t){for(const i of e)if(!Ii(i,t))return!1;for(let i=0;i0&&a<0||s<0&&a>0}function zi(e,t,i){const r=[];for(let n=0;ni[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}Bi(t,e)}function Oi(e,t,i,r){const n=Math.pow(2,r.z)*bi,o=[r.x*bi,r.y*bi],s=[];for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];Di(r,t,i,n),s.push(r)}return s}function Ui(e,t,i,r){const n=Math.pow(2,r.z)*bi,o=[r.x*bi,r.y*bi],s=[];for(const i of e){const e=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];Bi(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=n/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of s)for(const r of e)Di(r,t,i,n)}var a;return s}class Ni{constructor(e,t){this.type=ze,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Lt(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const i of t.features){const{type:t,coordinates:r}=i.geometry;"Polygon"===t&&e.push(r),"MultiPolygon"===t&&e.push(...r)}if(e.length)return new Ni(t,{type:"MultiPolygon",coordinates:e})}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Ni(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Ni(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=zi(t.coordinates,r,n),s=Oi(e.geometry(),i,r,n);if(!Ci(i,r))return!1;for(const e of s)if(!Ii(e,o))return!1}if("MultiPolygon"===t.type){const o=Ri(t.coordinates,r,n),s=Oi(e.geometry(),i,r,n);if(!Ci(i,r))return!1;for(const e of s)if(!Pi(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=zi(t.coordinates,r,n),s=Ui(e.geometry(),i,r,n);if(!Ci(i,r))return!1;for(const e of s)if(!Li(e,o))return!1}if("MultiPolygon"===t.type){const o=Ri(t.coordinates,r,n),s=Ui(e.geometry(),i,r,n);if(!Ci(i,r))return!1;for(const e of s)if(!Fi(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Qi=class{constructor(e=[],t=(e,t)=>et?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e=0)break;t[e]=t[r],e=r}t[e]=n}};function ji(e,t,i=0,r=e.length-1,n=Hi){for(;r>i;){if(r-i>600){const o=r-i+1,s=t-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);ji(e,t,Math.max(i,Math.floor(t-s*l/o+c)),Math.min(r,Math.floor(t+(o-s)*l/o+c)),n)}const o=e[t];let s=i,a=r;for(Vi(e,i,t),n(e[r],o)>0&&Vi(e,i,r);s0;)a--}0===n(e[i],o)?Vi(e,i,a):(a++,Vi(e,a,r)),a<=t&&(i=a+1),t<=a&&(r=a-1)}}function Vi(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Hi(e,t){return et?1:0}function Gi(e,t){if(e.length<=1)return[e];const i=[];let r,n;for(const t of e){const e=Zi(t);0!==e&&(t.area=Math.abs(e),void 0===n&&(n=e<0),n===e<0?(r&&i.push(r),r=[t]):r.push(t))}if(r&&i.push(r),t>1)for(let e=0;e1?(l=e[a+1][0],c=e[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;p180;)e-=360;return e}}function Yi(e,t){return t[0]-e[0]}function Ji(e){return e[1]-e[0]+1}function er(e,t){return e[1]>=e[0]&&e[1]e[1])return[null,null];const i=Ji(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===i)return[e,null];const r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function ir(e,t){if(!er(t,e.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)Bi(i,e[r]);return i}function rr(e){const t=[1/0,1/0,-1/0,-1/0];for(const i of e)for(const e of i)Bi(t,e);return t}function nr(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function or(e,t,i){if(!nr(e)||!nr(t))return NaN;let r=0,n=0;return e[2]t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]=r)return r;if(Ci(n,o)){if(dr(e,t))return 0}else if(dr(t,e))return 0;let s=1/0;for(const r of e)for(let e=0,n=r.length,o=n-1;e0;){const n=s.pop();if(n[0]>=o)continue;const l=n[1],c=t?50:100;if(Ji(l)<=c){if(!er(l,e.length))return NaN;if(t){const t=hr(e,l,i,r);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const n=ur(e[t],i,r);if(o=Math.min(o,n),0===o)return 0}}else{const i=tr(l,t);fr(s,o,r,e,a,i[0]),fr(s,o,r,e,a,i[1])}}return o}function gr(e,t,i,r,n,o=1/0){let s=Math.min(o,n.distance(e[0],i[0]));if(0===s)return s;const a=new Qi([[0,[0,e.length-1],[0,i.length-1]]],Yi);for(;a.length>0;){const o=a.pop();if(o[0]>=s)continue;const l=o[1],c=o[2],u=t?50:100,h=r?50:100;if(Ji(l)<=u&&Ji(c)<=h){if(!er(l,e.length)&&er(c,i.length))return NaN;let o;if(t&&r)o=lr(e,l,i,c,n),s=Math.min(s,o);else if(t&&!r){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=sr(i[e],t,n),s=Math.min(s,o),0===s)return s}else if(!t&&r){const t=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(o=sr(e[i],t,n),s=Math.min(s,o),0===s)return s}else o=cr(e,l,i,c,n),s=Math.min(s,o)}else{const o=tr(l,t),u=tr(c,r);Ar(a,s,n,e,i,o[0],u[0]),Ar(a,s,n,e,i,o[0],u[1]),Ar(a,s,n,e,i,o[1],u[0]),Ar(a,s,n,e,i,o[1],u[1])}}return s}function _r(e){return"MultiPolygon"===e.type?e.coordinates.map((e=>({type:"Polygon",coordinates:e}))):"MultiLineString"===e.type?e.coordinates.map((e=>({type:"LineString",coordinates:e}))):"MultiPoint"===e.type?e.coordinates.map((e=>({type:"Point",coordinates:e}))):[e]}class yr{constructor(e,t){this.type=Fe,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Lt(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new yr(t,t.features.map((e=>_r(e.geometry))).flat());if("Feature"===t.type)return new yr(t,_r(t.geometry));if("type"in t&&"coordinates"in t)return new yr(t,_r(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>Ti([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new Xi(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,gr(r,!1,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,gr(r,!1,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,mr(r,!1,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>Ti([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new Xi(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,gr(r,!0,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,gr(r,!0,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,mr(r,!0,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){const i=e.geometry();if(0===i.length||0===i[0].length)return NaN;const r=Gi(i,0).map((t=>t.map((t=>t.map((t=>Ti([t.x,t.y],e.canonical))))))),n=new Xi(r[0][0][0][1]);let o=1/0;for(const e of t)for(const t of r){switch(e.type){case"Point":o=Math.min(o,mr([e.coordinates],!1,t,n,o));break;case"LineString":o=Math.min(o,mr(e.coordinates,!0,t,n,o));break;case"Polygon":o=Math.min(o,pr(t,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const vr={"==":hi,"!=":di,">":fi,"<":pi,">=":mi,"<=":Ai,array:Dt,at:Gt,boolean:Dt,case:Kt,coalesce:ai,collator:gi,format:yi,image:vi,in:$t,"index-of":Zt,interpolate:ni,"interpolate-hcl":ni,"interpolate-lab":ni,length:xi,let:Vt,literal:zt,match:qt,number:Dt,"number-format":_i,object:Dt,slice:Wt,step:Yt,string:Dt,"to-boolean":Ut,"to-color":Ut,"to-number":Ut,"to-string":Ut,var:Ht,within:Ni,distance:yr};class xr{constructor(e,t,i,r){this.name=e,this.type=t,this._evaluate=i,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],r=xr.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let a=null;for(const[r,o]of s){a=new jt(t.registry,Cr,t.path,null,t.scope);const s=[];let l=!1;for(let t=1;t{return t=e,Array.isArray(t)?`(${t.map($e).join(", ")})`:`(${$e(t.type)}...)`;var t})).join(" | "),r=[];for(let i=1;i{i=t?i&&Cr(e):i&&e instanceof zt})),!!i&&Sr(e)&&Mr(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Sr(e){if(e instanceof xr){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Ni)return!1;if(e instanceof yr)return!1;let t=!0;return e.eachChild((e=>{t&&!Sr(e)&&(t=!1)})),t}function Er(e){if(e instanceof xr&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!Er(e)&&(t=!1)})),t}function Mr(e,t){if(e instanceof xr&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!Mr(e,t)&&(i=!1)})),i}function Ir(e){return{result:"success",value:e}}function Pr(e){return{result:"error",value:e}}function Lr(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function Fr(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function kr(e){return!!e.expression&&e.expression.interpolated}function zr(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Rr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Dr(e){return e}function Or(e,t){const i="color"===t.type,r=e.stops&&"object"==typeof e.stops[0][0],n=r||!(r||void 0!==e.property),o=e.type||(kr(t)?"exponential":"interval");if(i||"padding"===t.type){const r=i?vt.parse:Bt.parse;(e=Me({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],r(e[1])]))),e.default=r(e.default?e.default:t.default)}if(e.colorSpace&&"rgb"!==(s=e.colorSpace)&&"hcl"!==s&&"lab"!==s)throw new Error(`Unknown color space: "${e.colorSpace}"`);var s;let a,l,c;if("exponential"===o)a=jr;else if("interval"===o)a=Qr;else if("categorical"===o){a=Nr,l=Object.create(null);for(const t of e.stops)l[t[0]]=t[1];c=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);a=Vr}if(r){const i={},r=[];for(let t=0;te[0])),evaluate:({zoom:i},r)=>jr({stops:n,base:e.base},t,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ni.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:i})=>a(e,t,i,l,c)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[e.property]:void 0;return void 0===n?Ur(e.default,t.default):a(e,t,n,l,c)}}}function Ur(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function Nr(e,t,i,r,n){return Ur(typeof i===n?r[i]:void 0,e.default,t.default)}function Qr(e,t,i){if("number"!==zr(i))return Ur(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const n=Xt(e.stops.map((e=>e[0])),i);return e.stops[n][1]}function jr(e,t,i){const r=void 0!==e.base?e.base:1;if("number"!==zr(i))return Ur(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const o=Xt(e.stops.map((e=>e[0])),i),s=function(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[o][0],e.stops[o+1][0]),a=e.stops[o][1],l=e.stops[o+1][1],c=si[t.type]||Dr;return"function"==typeof a.evaluate?{evaluate(...t){const i=a.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==i&&void 0!==r)return c(i,r,s,e.colorSpace)}}:c(a,l,s,e.colorSpace)}function Vr(e,t,i){switch(t.type){case"color":i=vt.parse(i);break;case"formatted":i=Tt.fromString(i.toString());break;case"resolvedImage":i=Mt.fromString(i.toString());break;case"padding":i=Bt.parse(i);break;default:zr(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0)}return Ur(i,e.default,t.default)}xr.register(vr,{error:[{kind:"error"},[ke],(e,[t])=>{throw new Ct(t.evaluate(e))}],typeof:[ke,[Ue],(e,[t])=>$e(Ft(t.evaluate(e)))],"to-rgba":[Ge(Fe,4),[Re],(e,[t])=>{const[i,r,n,o]=t.evaluate(e).rgb;return[255*i,255*r,255*n,o]}],rgb:[Re,[Fe,Fe,Fe],br],rgba:[Re,[Fe,Fe,Fe,Fe],br],has:{type:ze,overloads:[[[ke],(e,[t])=>wr(t.evaluate(e),e.properties())],[[ke,Oe],(e,[t,i])=>wr(t.evaluate(e),i.evaluate(e))]]},get:{type:Ue,overloads:[[[ke],(e,[t])=>Tr(t.evaluate(e),e.properties())],[[ke,Oe],(e,[t,i])=>Tr(t.evaluate(e),i.evaluate(e))]]},"feature-state":[Ue,[ke],(e,[t])=>Tr(t.evaluate(e),e.featureState||{})],properties:[Oe,[],e=>e.properties()],"geometry-type":[ke,[],e=>e.geometryType()],id:[Ue,[],e=>e.id()],zoom:[Fe,[],e=>e.globals.zoom],"heatmap-density":[Fe,[],e=>e.globals.heatmapDensity||0],"line-progress":[Fe,[],e=>e.globals.lineProgress||0],accumulated:[Ue,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Fe,Br(Fe),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[Fe,Br(Fe),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:Fe,overloads:[[[Fe,Fe],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[Fe],(e,[t])=>-t.evaluate(e)]]},"/":[Fe,[Fe,Fe],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[Fe,[Fe,Fe],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[Fe,[],()=>Math.LN2],pi:[Fe,[],()=>Math.PI],e:[Fe,[],()=>Math.E],"^":[Fe,[Fe,Fe],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[Fe,[Fe],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))],log2:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Fe,[Fe],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Fe,[Fe],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Fe,[Fe],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Fe,[Fe],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Fe,[Fe],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Fe,[Fe],(e,[t])=>Math.atan(t.evaluate(e))],min:[Fe,Br(Fe),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[Fe,Br(Fe),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[Fe,[Fe],(e,[t])=>Math.abs(t.evaluate(e))],round:[Fe,[Fe],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[Fe,[Fe],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Fe,[Fe],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ze,[ke,Ue],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[ze,[Ue],(e,[t])=>e.id()===t.value],"filter-type-==":[ze,[ke],(e,[t])=>e.geometryType()===t.value],"filter-<":[ze,[ke,Ue],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r{const i=e.id(),r=t.value;return typeof i==typeof r&&i":[ze,[ke,Ue],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[ze,[Ue],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[ze,[ke,Ue],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[ze,[Ue],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[ze,[ke,Ue],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[ze,[Ue],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[ze,[Ue],(e,[t])=>t.value in e.properties()],"filter-has-id":[ze,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[ze,[Ge(ke)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ze,[Ge(Ue)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ze,[ke,Ge(Ue)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ze,[ke,Ge(Ue)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:ze,overloads:[[[ze,ze],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Br(ze),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:ze,overloads:[[[ze,ze],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Br(ze),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[ze,[ze],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ze,[ke],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[ke,[ke],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[ke,[ke],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[ke,Br(Ue),(e,t)=>t.map((t=>kt(t.evaluate(e)))).join("")],"resolved-locale":[ke,[Ne],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Hr{constructor(e,t){var i;this.expression=e,this._warningHistory={},this._evaluator=new Qt,this._defaultValue=t?"color"===(i=t).type&&Rr(i.default)?new vt(0,0,0,0):"color"===i.type?vt.parse(i.default)||null:"padding"===i.type?Bt.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?Et.parse(i.default)||null:"projectionDefinition"===i.type?It.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,o){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Ct(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function Gr(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in vr}function $r(e,t){const i=new jt(vr,Cr,[],t?function(e){const t={color:Re,string:ke,number:Fe,enum:ke,boolean:ze,formatted:Qe,padding:je,projectionDefinition:De,resolvedImage:Ve,variableAnchorOffsetCollection:He};return"array"===e.type?Ge(t[e.value]||Ue,e.length):t[e.type]}(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?Ir(new Hr(r,t)):Pr(i.errors)}class Zr{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Er(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}}class qr{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Er(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?ni.interpolationFactor(this.interpolationType,e,t,i):0}}function Kr(e,t){const i=$r(e,t);if("error"===i.result)return i;const r=i.value.expression,n=Sr(r);if(!n&&!Lr(t))return Pr([new Ie("","data expressions not supported")]);const o=Mr(r,["zoom"]);if(!o&&!Fr(t))return Pr([new Ie("","zoom expressions not supported")]);const s=Xr(r);return s||o?s instanceof Ie?Pr([s]):s instanceof ni&&!kr(t)?Pr([new Ie("",'"interpolate" expressions cannot be used with this property')]):Ir(s?new qr(n?"camera":"composite",i.value,s.labels,s instanceof ni?s.interpolation:void 0):new Zr(n?"constant":"source",i.value)):Pr([new Ie("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Wr{constructor(e,t){this._parameters=e,this._specification=t,Me(this,Or(this._parameters,this._specification))}static deserialize(e){return new Wr(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Xr(e){let t=null;if(e instanceof Vt)t=Xr(e.result);else if(e instanceof ai){for(const i of e.args)if(t=Xr(i),t)break}else(e instanceof Yt||e instanceof ni)&&e.input instanceof xr&&"zoom"===e.input.name&&(t=e);return t instanceof Ie||e.eachChild((e=>{const i=Xr(e);i instanceof Ie?t=i:!t&&i?t=new Ie("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new Ie("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function Yr(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Yr(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const Jr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function en(e){if(null==e)return{filter:()=>!0,needGeometry:!1};Yr(e)||(e=nn(e));const t=$r(e,Jr);if("error"===t.result)throw new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return{filter:(e,i,r)=>t.value.evaluate(e,i,{},r),needGeometry:rn(e)}}function tn(e,t){return et?1:0}function rn(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t"===t||"<="===t||">="===t?on(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(nn))):"all"===t?["all"].concat(e.slice(1).map(nn)):"none"===t?["all"].concat(e.slice(1).map(nn).map(ln)):"in"===t?sn(e[1],e.slice(2)):"!in"===t?ln(sn(e[1],e.slice(2))):"has"===t?an(e[1]):"!has"!==t||ln(an(e[1]));var i}function on(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function sn(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(tn)]]:["filter-in-small",e,["literal",t]]}}function an(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function ln(e){return["!",e]}function cn(e){const t=typeof e;if("number"===t||"boolean"===t||"string"===t||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const i of e)t+=`${cn(i)},`;return`${t}]`}const i=Object.keys(e).sort();let r="{";for(let t=0;tr.maximum?[new Ee(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function gn(e){const t=e.valueSpec,i=dn(e.value.type);let r,n,o,s={};const a="categorical"!==i&&void 0===e.value.property,l=!a,c="array"===zr(e.value.stops)&&"array"===zr(e.value.stops[0])&&"object"===zr(e.value.stops[0][0]),u=fn({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new Ee(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(An({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===zr(r)&&0===r.length&&t.push(new Ee(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&a&&u.push(new Ee(e.key,e.value,'missing required property "property"')),"identity"===i||e.value.stops||u.push(new Ee(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!kr(e.valueSpec)&&u.push(new Ee(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Lr(e.valueSpec)?u.push(new Ee(e.key,e.value,"property functions not supported")):a&&!Fr(e.valueSpec)&&u.push(new Ee(e.key,e.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==e.value.property||u.push(new Ee(e.key,e.value,'"property" property is required')),u;function h(e){let i=[];const r=e.value,a=e.key;if("array"!==zr(r))return[new Ee(a,r,`array expected, ${zr(r)} found`)];if(2!==r.length)return[new Ee(a,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==zr(r[0]))return[new Ee(a,r,`object expected, ${zr(r[0])} found`)];if(void 0===r[0].zoom)return[new Ee(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new Ee(a,r,"object stop key must have value")];if(o&&o>dn(r[0].zoom))return[new Ee(a,r[0].zoom,"stop zoom values must appear in ascending order")];dn(r[0].zoom)!==o&&(o=dn(r[0].zoom),n=void 0,s={}),i=i.concat(fn({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:mn,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return Gr(pn(r[1]))?i.concat([new Ee(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(e.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const a=zr(e.value),l=dn(e.value),c=null!==e.value?e.value:o;if(r){if(a!==r)return[new Ee(e.key,c,`${a} stop domain type must match previous stop domain type ${r}`)]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new Ee(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let r=`number expected, ${a} found`;return Lr(t)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ee(e.key,c,r)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==n&&lnew Ee(`${e.key}${t.key}`,e.value,t.message)));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new Ee(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!Er(i))return[new Ee(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!Er(i))return[new Ee(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Mr(i,["zoom","feature-state"]))return[new Ee(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Sr(i))return[new Ee(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function yn(e){const t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(dn(i))&&n.push(new Ee(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(dn(i))&&n.push(new Ee(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function vn(e){return Yr(pn(e.value))?_n(Me({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xn(e)}function xn(e){const t=e.value,i=e.key;if("array"!==zr(t))return[new Ee(i,t,`array expected, ${zr(t)} found`)];const r=e.styleSpec;let n,o=[];if(t.length<1)return[new Ee(i,t,"filter array must have at least 1 element")];switch(o=o.concat(yn({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),dn(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===dn(t[1])&&o.push(new Ee(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new Ee(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=zr(t[1]),"string"!==n&&o.push(new Ee(`${i}[1]`,t[1],`string expected, ${n} found`)));for(let s=2;s{e in i&&t.push(new Ee(r,i[e],`"${e}" is prohibited for ref layers`))})),n.layers.forEach((t=>{dn(t.id)===a&&(e=t)})),e?e.ref?t.push(new Ee(r,i.ref,"ref cannot reference another ref layer")):s=dn(e.type):t.push(new Ee(r,i.ref,`ref layer "${a}" not found`))}else if("background"!==s)if(i.source){const e=n.sources&&n.sources[i.source],o=e&&dn(e.type);e?"vector"===o&&"raster"===s?t.push(new Ee(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===s?t.push(new Ee(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==s?t.push(new Ee(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==s?t.push(new Ee(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&e.lineMetrics||t.push(new Ee(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ee(r,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new Ee(r,i.source,`source "${i.source}" not found`))}else t.push(new Ee(r,i,'missing required property "source"'));return t=t.concat(fn({key:r,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"}),filter:vn,layout:e=>fn({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Tn(Me({layerType:s},e))}}),paint:e=>fn({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>wn(Me({layerType:s},e))}})}})),t}function Cn(e){const t=e.value,i=e.key,r=zr(t);return"string"!==r?[new Ee(i,t,`string expected, ${r} found`)]:[]}const Sn={promoteId:function({key:e,value:t}){if("string"===zr(t))return Cn({key:e,value:t});{const i=[];for(const r in t)i.push(...Cn({key:`${e}.${r}`,value:t[r]}));return i}}};function En(e){const t=e.value,i=e.key,r=e.styleSpec,n=e.style,o=e.validateSpec;if(!t.type)return[new Ee(i,t,'"type" is required')];const s=dn(t.type);let a;switch(s){case"vector":case"raster":return a=fn({key:i,value:t,valueSpec:r[`source_${s.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:Sn,validateSpec:o}),a;case"raster-dem":return a=function(e){var t;const i=null!==(t=e.sourceName)&&void 0!==t?t:"",r=e.value,n=e.styleSpec,o=n.source_raster_dem,s=e.style;let a=[];const l=zr(r);if(void 0===r)return a;if("object"!==l)return a.push(new Ee("source_raster_dem",r,`object expected, ${l} found`)),a;const c="custom"===dn(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const t in r)!c&&u.includes(t)?a.push(new Ee(t,r[t],`In "${i}": "${t}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[t]?a=a.concat(e.validateSpec({key:t,value:r[t],valueSpec:o[t],validateSpec:e.validateSpec,style:s,styleSpec:n})):a.push(new Ee(t,r[t],`unknown property "${t}"`));return a}({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:o}),a;case"geojson":if(a=fn({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:Sn}),t.cluster)for(const e in t.clusterProperties){const[r,n]=t.clusterProperties[e],o="string"==typeof r?[r,["accumulated"],["get",e]]:r;a.push(..._n({key:`${i}.${e}.map`,value:n,expressionContext:"cluster-map"})),a.push(..._n({key:`${i}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return fn({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return fn({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new Ee(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return yn({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Mn(e){const t=e.value,i=e.styleSpec,r=i.light,n=e.style;let o=[];const s=zr(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new Ee("light",t,`object expected, ${s} found`)]),o;for(const s in t){const a=s.match(/^(.*)-transition$/);o=o.concat(a&&r[a[1]]&&r[a[1]].transition?e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i}):r[s]?e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i}):[new Ee(s,t[s],`unknown property "${s}"`)])}return o}function In(e){const t=e.value,i=e.styleSpec,r=i.sky,n=e.style,o=zr(t);if(void 0===t)return[];if("object"!==o)return[new Ee("sky",t,`object expected, ${o} found`)];let s=[];for(const o in t)s=s.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i}):[new Ee(o,t[o],`unknown property "${o}"`)]);return s}function Pn(e){const t=e.value,i=e.styleSpec,r=i.terrain,n=e.style;let o=[];const s=zr(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new Ee("terrain",t,`object expected, ${s} found`)]),o;for(const s in t)o=o.concat(r[s]?e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i}):[new Ee(s,t[s],`unknown property "${s}"`)]);return o}function Ln(e){let t=[];const i=e.value,r=e.key;if(Array.isArray(i)){const n=[],o=[];for(const s in i)i[s].id&&n.includes(i[s].id)&&t.push(new Ee(r,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),n.push(i[s].id),i[s].url&&o.includes(i[s].url)&&t.push(new Ee(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),o.push(i[s].url),t=t.concat(fn({key:`${r}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return Cn({key:r,value:i})}const Fn={"*":()=>[],array:An,boolean:function(e){const t=e.value,i=e.key,r=zr(t);return"boolean"!==r?[new Ee(i,t,`boolean expected, ${r} found`)]:[]},number:mn,color:function(e){const t=e.key,i=e.value,r=zr(i);return"string"!==r?[new Ee(t,i,`color expected, ${r} found`)]:vt.parse(String(i))?[]:[new Ee(t,i,`color expected, "${i}" found`)]},constants:hn,enum:yn,filter:vn,function:gn,layer:Bn,object:fn,source:En,light:Mn,sky:In,terrain:Pn,projection:function(e){const t=e.value,i=e.styleSpec,r=i.projection,n=e.style,o=zr(t);if(void 0===t)return[];if("object"!==o)return[new Ee("projection",t,`object expected, ${o} found`)];let s=[];for(const o in t)s=s.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i}):[new Ee(o,t[o],`unknown property "${o}"`)]);return s},projectionDefinition:function(e){const t=e.key;let i=e.value;i=i instanceof String?i.valueOf():i;const r=zr(i);return"array"!==r||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(i)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(i)?["array","string"].includes(r)?[]:[new Ee(t,i,`projection expected, invalid type "${r}" found`)]:[new Ee(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Cn,formatted:function(e){return 0===Cn(e).length?[]:_n(e)},resolvedImage:function(e){return 0===Cn(e).length?[]:_n(e)},padding:function(e){const t=e.key,i=e.value;if("array"===zr(i)){if(i.length<1||i.length>4)return[new Ee(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let o=0;o[]}})),e.constants&&(i=i.concat(hn({key:"constants",value:e.constants}))),On(i)}function Dn(e){return function(t){return e({...t,validateSpec:kn})}}function On(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function Un(e){return function(...t){return On(e.apply(this,t))}}Rn.source=Un(Dn(En)),Rn.sprite=Un(Dn(Ln)),Rn.glyphs=Un(Dn(zn)),Rn.light=Un(Dn(Mn)),Rn.sky=Un(Dn(In)),Rn.terrain=Un(Dn(Pn)),Rn.layer=Un(Dn(Bn)),Rn.filter=Un(Dn(vn)),Rn.paintProperty=Un(Dn(wn)),Rn.layoutProperty=Un(Dn(Tn));const Nn=Rn,Qn=Nn.light,jn=Nn.sky,Vn=Nn.paintProperty,Hn=Nn.layoutProperty;function Gn(e,t){let i=!1;if(t&&t.length)for(const r of t)e.fire(new fe(new Error(r.message))),i=!0;return i}class $n{constructor(e,t,i){const r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(i=n[2]);for(let e=0;e=c[l+0]&&r>=c[l+1])?(s[h]=!0,o.push(n[h])):s[h]=!1}}}}_forEachCell(e,t,i,r,n,o,s,a){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(i),h=this._convertToCellCoord(r);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++){const c=this.d*l+d;if((!a||a(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&n.call(this,e,t,i,r,c,o,s,a))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=3+this.cells.length+1+1;let i=0;for(let e=0;e=0)continue;const o=e[r];n[r]=Zn[i].shallow.indexOf(r)>=0?o:Yn(o,t)}e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(n.$name=i),n}function Jn(e){if(Xn(e))return e;if(Array.isArray(e))return e.map(Jn);if("object"!=typeof e)throw new Error("can't deserialize object of type "+typeof e);const t=Wn(e)||"Object";if(!Zn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:i}=Zn[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);const r=Object.create(i.prototype);for(const i of Object.keys(e)){if("$name"===i)continue;const n=e[i];r[i]=Zn[t].shallow.indexOf(i)>=0?n:Jn(n)}return r}class eo{constructor(){this.first=!0}update(e,t){const i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoome>=128&&e<=255,"Hangul Jamo":e=>e>=4352&&e<=4607,Khmer:e=>e>=6016&&e<=6143,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Kanbun:e=>e>=12688&&e<=12703,"CJK Strokes":e=>e>=12736&&e<=12783,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Hangul Syllables":e=>e>=44032&&e<=55215,"Private Use Area":e=>e>=57344&&e<=63743,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function io(e){for(const t of e)if(lo(t.charCodeAt(0)))return!0;return!1}function ro(e){for(const t of e)if(!so(t.charCodeAt(0)))return!1;return!0}function no(e){const t=e.map((e=>{try{return new RegExp(`\\p{sc=${e}}`,"u").source}catch(e){return null}})).filter((e=>e));return new RegExp(t.join("|"),"u")}const oo=no(["Arab","Dupl","Mong","Ougr","Syrc"]);function so(e){return!oo.test(String.fromCodePoint(e))}const ao=no(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function lo(e){return!(746!==e&&747!==e&&(e<4352||!(to["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||to["CJK Compatibility"](e)||to["CJK Strokes"](e)||!(!to["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||to["Enclosed CJK Letters and Months"](e)||to["Ideographic Description Characters"](e)||to.Kanbun(e)||to.Katakana(e)&&12540!==e||!(!to["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!to["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||to["Vertical Forms"](e)||to["Yijing Hexagram Symbols"](e)||/\p{sc=Cans}/u.test(String.fromCodePoint(e))||/\p{sc=Hang}/u.test(String.fromCodePoint(e))||ao.test(String.fromCodePoint(e)))))}function co(e){return!(lo(e)||function(e){return!!(to["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||to["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||to["Letterlike Symbols"](e)||to["Number Forms"](e)||to["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||to["Control Pictures"](e)&&9251!==e||to["Optical Character Recognition"](e)||to["Enclosed Alphanumerics"](e)||to["Geometric Shapes"](e)||to["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||to["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||to["CJK Symbols and Punctuation"](e)||to.Katakana(e)||to["Private Use Area"](e)||to["CJK Compatibility Forms"](e)||to["Small Form Variants"](e)||to["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}const uo=no(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function ho(e){return uo.test(String.fromCodePoint(e))}function po(e,t){return!(!t&&ho(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||to.Khmer(e))}function fo(e){for(const t of e)if(ho(t.charCodeAt(0)))return!0;return!1}const Ao=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Ao.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,i){return t(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;const t=e.pluginURL,r=new Promise((e=>{this.loadScriptResolve=e}));i(t);const n=new Promise((e=>setTimeout((()=>e()),this.TIMEOUT)));if(yield Promise.race([r,n]),this.isParsed()){const e={pluginStatus:"loaded",pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}};class mo{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new eo,this.transition={})}isSupportedScript(e){return function(e,t){for(const i of e)if(!po(i.charCodeAt(0),t))return!1;return!0}(e,"loaded"===Ao.getRTLTextPluginStatus())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}}class go{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(Rr(e))return new Wr(e,t);if(Gr(e)){const i=Kr(e,t);if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return i.value}{let i=e;return"color"===t.type&&"string"==typeof e?i=vt.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)?i=Et.parse(e):"projectionDefinition"===t.type&&"string"==typeof e&&(i=It.parse(e)):i=Bt.parse(e),{kind:"constant",evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class _o{constructor(e){this.property=e,this.value=new go(e,void 0)}transitioned(e,t){return new vo(this.property,this.value,t,D({},e.transition,this.transition),e.now)}untransitioned(){return new vo(this.property,this.value,null,{},0)}}class yo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Q(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new _o(this._values[e].property)),this._values[e].value=new go(this._values[e].property,null===t?void 0:Q(t))}getTransition(e){return Q(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new _o(this._values[e].property)),this._values[e].transition=Q(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const r=this.getTransition(t);void 0!==r&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){const i=new xo(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){const e=new xo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class vo{constructor(e,t,i,r,n){this.property=e,this.value=t,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(rr.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class Eo{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){if(void 0!==e.value){if("constant"===e.expression.kind){const n=e.expression.evaluate(t,null,{},i,r);return this._calculate(n,n,n,t)}return this._calculate(e.expression.evaluate(new mo(Math.floor(t.zoom-1),t)),e.expression.evaluate(new mo(Math.floor(t.zoom),t)),e.expression.evaluate(new mo(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class Mo{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class Io{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const t in e){const i=e[t];i.specification.overridable&&this.overridableProperties.push(t);const r=this.defaultPropertyValues[t]=new go(i,void 0),n=this.defaultTransitionablePropertyValues[t]=new _o(i);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}qn("DataDrivenProperty",Co),qn("DataConstantProperty",Bo),qn("CrossFadedDataDrivenProperty",So),qn("CrossFadedProperty",Eo),qn("ColorRampProperty",Mo);const Po="-transition";class Lo extends Ae{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new bo(t.layout)),t.paint)){this._transitionablePaint=new yo(t.paint);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new To(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,i={}){null!=t&&this._validate(Hn,`layers.${this.id}.layout.${e}`,e,t,i)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return e.endsWith(Po)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(null!=t&&this._validate(Vn,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(e.endsWith(Po))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const i=this._transitionablePaint._values[e],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const s=this._transitionablePaint._values[e].value;return s.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(e,o,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),N(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,i,r,n={}){return(!n||!1!==n.validate)&&Gn(this,e.call(Nn,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:me,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof wo&&Lr(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}const Fo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ko{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class zo{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ro(e,t=1){let i=0,r=0;return{members:e.map((e=>{const n=Fo[e.type].BYTES_PER_ELEMENT,o=i=Do(i,Math.max(t,n)),s=e.components||1;return r=Math.max(r,n),i+=n*s,{name:e.name,type:e.type,components:s,offset:o}})),size:Do(i,Math.max(r,t)),alignment:t}}function Do(e,t){return Math.ceil(e/t)*t}class Oo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}Oo.prototype.bytesPerElement=4,qn("StructArrayLayout2i4",Oo);class Uo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}Uo.prototype.bytesPerElement=6,qn("StructArrayLayout3i6",Uo);class No extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,e}}No.prototype.bytesPerElement=8,qn("StructArrayLayout4i8",No);class Qo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,e}}Qo.prototype.bytesPerElement=12,qn("StructArrayLayout2i4i12",Qo);class jo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=4*e,l=8*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=s,e}}jo.prototype.bytesPerElement=8,qn("StructArrayLayout2i4ub8",jo);class Vo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}Vo.prototype.bytesPerElement=8,qn("StructArrayLayout2f8",Vo);class Ho extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,n,o,s,a,l,c)}emplace(e,t,i,r,n,o,s,a,l,c,u){const h=10*e;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=n,this.uint16[h+4]=o,this.uint16[h+5]=s,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,e}}Ho.prototype.bytesPerElement=20,qn("StructArrayLayout10ui20",Ho);class Go extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,o,s,a,l,c,u,h)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=s,this.uint16[p+6]=a,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}Go.prototype.bytesPerElement=24,qn("StructArrayLayout4i4ui4i24",Go);class $o extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}$o.prototype.bytesPerElement=12,qn("StructArrayLayout3f12",$o);class Zo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Zo.prototype.bytesPerElement=4,qn("StructArrayLayout1ul4",Zo);class qo extends zo{_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(e,t,i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,r,n,o,s,a,l)}emplace(e,t,i,r,n,o,s,a,l,c){const u=10*e,h=5*e;return this.int16[u+0]=t,this.int16[u+1]=i,this.int16[u+2]=r,this.int16[u+3]=n,this.int16[u+4]=o,this.int16[u+5]=s,this.uint32[h+3]=a,this.uint16[u+8]=l,this.uint16[u+9]=c,e}}qo.prototype.bytesPerElement=20,qn("StructArrayLayout6i1ul2ui20",qo);class Ko extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,e}}Ko.prototype.bytesPerElement=12,qn("StructArrayLayout2i2i2i12",Ko);class Wo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=4*e,a=8*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[a+6]=n,this.int16[a+7]=o,e}}Wo.prototype.bytesPerElement=16,qn("StructArrayLayout2f1f2i16",Wo);class Xo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=16*e,l=4*e,c=8*e;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[c+6]=o,this.int16[c+7]=s,e}}Xo.prototype.bytesPerElement=16,qn("StructArrayLayout2ub2f2i16",Xo);class Yo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}Yo.prototype.bytesPerElement=6,qn("StructArrayLayout3ui6",Yo);class Jo extends zo{_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(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g){const _=24*e,y=12*e,v=48*e;return this.int16[_+0]=t,this.int16[_+1]=i,this.uint16[_+2]=r,this.uint16[_+3]=n,this.uint32[y+2]=o,this.uint32[y+3]=s,this.uint32[y+4]=a,this.uint16[_+10]=l,this.uint16[_+11]=c,this.uint16[_+12]=u,this.float32[y+7]=h,this.float32[y+8]=d,this.uint8[v+36]=p,this.uint8[v+37]=f,this.uint8[v+38]=A,this.uint32[y+10]=m,this.int16[_+22]=g,e}}Jo.prototype.bytesPerElement=48,qn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Jo);class es extends zo{_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(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S){const E=this.length;return this.resize(E+1),this.emplace(E,e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S,E){const M=32*e,I=16*e;return this.int16[M+0]=t,this.int16[M+1]=i,this.int16[M+2]=r,this.int16[M+3]=n,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]=u,this.uint16[M+10]=h,this.uint16[M+11]=d,this.uint16[M+12]=p,this.uint16[M+13]=f,this.uint16[M+14]=A,this.uint16[M+15]=m,this.uint16[M+16]=g,this.uint16[M+17]=_,this.uint16[M+18]=y,this.uint16[M+19]=v,this.uint16[M+20]=x,this.uint16[M+21]=b,this.uint16[M+22]=w,this.uint32[I+12]=T,this.float32[I+13]=B,this.float32[I+14]=C,this.uint16[M+30]=S,this.uint16[M+31]=E,e}}es.prototype.bytesPerElement=64,qn("StructArrayLayout8i15ui1ul2f2ui64",es);class ts extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}ts.prototype.bytesPerElement=4,qn("StructArrayLayout1f4",ts);class is extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[6*e+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}is.prototype.bytesPerElement=12,qn("StructArrayLayout1ui2f12",is);class rs extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e;return this.uint32[2*e+0]=t,this.uint16[n+2]=i,this.uint16[n+3]=r,e}}rs.prototype.bytesPerElement=8,qn("StructArrayLayout1ul2ui8",rs);class ns extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}ns.prototype.bytesPerElement=4,qn("StructArrayLayout2ui4",ns);class os extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}os.prototype.bytesPerElement=2,qn("StructArrayLayout1ui2",os);class ss extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,e}}ss.prototype.bytesPerElement=16,qn("StructArrayLayout4f16",ss);class as extends ko{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 l(this.anchorPointX,this.anchorPointY)}}as.prototype.size=20;class ls extends qo{get(e){return new as(this,e)}}qn("CollisionBoxArray",ls);class cs extends ko{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}cs.prototype.size=48;class us extends Jo{get(e){return new cs(this,e)}}qn("PlacedSymbolArray",us);class hs extends ko{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}hs.prototype.size=64;class ds extends es{get(e){return new hs(this,e)}}qn("SymbolInstanceArray",ds);class ps extends ts{getoffsetX(e){return this.float32[1*e+0]}}qn("GlyphOffsetArray",ps);class fs extends Uo{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}qn("SymbolLineVertexArray",fs);class As extends ko{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]}}As.prototype.size=12;class ms extends is{get(e){return new As(this,e)}}qn("TextAnchorOffsetArray",ms);class gs extends ko{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]}}gs.prototype.size=8;class _s extends rs{get(e){return new gs(this,e)}}qn("FeatureIndexArray",_s);class ys extends Oo{}class vs extends Oo{}class xs extends Oo{}class bs extends Qo{}class ws extends jo{}class Ts extends Vo{}class Bs extends Ho{}class Cs extends Go{}class Ss extends $o{}class Es extends Zo{}class Ms extends Ko{}class Is extends Xo{}class Ps extends Yo{}class Ls extends ns{}const Fs=Ro([{name:"a_pos",components:2,type:"Int16"}],4),{members:ks}=Fs;class zs{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,i,r){const n=this.segments[this.segments.length-1];return e>zs.MAX_VERTEX_ARRAY_LENGTH&&V(`Max vertices per segment is ${zs.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${zs.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+e>zs.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r?this.createNewSegment(t,i,r):n}createNewSegment(e,t,i){const r={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(e,t,i){return this.prepareSegment(0,e,t,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,r){return new zs([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function Rs(e,t){return 256*(e=z(Math.floor(e),0,255))+z(Math.floor(t),0,255)}zs.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,qn("SegmentVector",zs);const Ds=Ro([{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 Os,Us,Ns,Qs={exports:{}},js={exports:{}},Vs={exports:{}},Hs=function(){if(Ns)return Qs.exports;Ns=1;var e=(Os||(Os=1,js.exports=function(e,t){var i,r,n,o,s,a,l,c;for(r=e.length-(i=3&e.length),n=t,s=3432918353,a=461845907,c=0;c>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),js.exports),t=(Us||(Us=1,Vs.exports=function(e,t){for(var i,r=e.length,n=t^r,o=0;r>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),Vs.exports);return Qs.exports=e,Qs.exports.murmur3=e,Qs.exports.murmur2=t,Qs.exports}(),Gs=i(Hs);class $s{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(Zs(e)),this.positions.push(t,i,r)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const t=Zs(e);let i=0,r=this.ids.length-1;for(;i>1;this.ids[e]>=t?r=e:i=e+1}const n=[];for(;this.ids[i]===t;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(e,t){const i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return qs(i,r,0,i.length-1),t&&t.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(e){const t=new $s;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function Zs(e){const t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Gs(String(e))}function qs(e,t,i,r){for(;i>1];let o=i-1,s=r+1;for(;;){do{o++}while(e[o]n);if(o>=s)break;Ks(e,o,s),Ks(t,3*o,3*s),Ks(t,3*o+1,3*s+1),Ks(t,3*o+2,3*s+2)}s-i`u_${e}`)),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return"color"===this.type?new Js(e,t):new Xs(e,t)}}class ra{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,i,r){const n="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;n&&e.set(n)}getBinding(e,t,i){return"u_pattern"===i.substr(0,9)?new Ys(e,t):new Xs(e,t)}}class na{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,n){const o=this.paintVertexArray.length,s=this.expression.evaluate(new mo(0),t,{},r,[],n);this.paintVertexArray.resize(e),this._setPaintValue(o,e,s)}updatePaintArray(e,t,i,r){const n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(e,t,n)}_setPaintValue(e,t,i){if("color"===this.type){const r=ta(i);for(let i=e;i`u_${e}_t`)),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,t,i,r,n){const o=this.expression.evaluate(new mo(this.zoom),t,{},r,[],n),s=this.expression.evaluate(new mo(this.zoom+1),t,{},r,[],n),a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(a,e,o,s)}updatePaintArray(e,t,i,r){const n=this.expression.evaluate({zoom:this.zoom},i,r),o=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(e,t,n,o)}_setPaintValue(e,t,i,r){if("color"===this.type){const n=ta(i),o=ta(r);for(let i=e;i`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof na||i instanceof oa)for(let t=0;t!0){this.programConfigurations={};for(const r of e)this.programConfigurations[r.id]=new aa(r,t,i);this.needsUpload=!1,this._featureMap=new $s,this._bufferOffset=0}populatePaintArrays(e,t,i,r,n,o){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,r,n,o);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r){for(const n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,n,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function ca(e,t){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"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function ua(e,t,i){const r={color:{source:Vo,composite:ss},number:{source:ts,composite:Vo}},n=function(e){return{"line-pattern":{source:Bs,composite:Bs},"fill-pattern":{source:Bs,composite:Bs},"fill-extrusion-pattern":{source:Bs,composite:Bs}}[e]}(e);return n&&n[i]||r[t][i]}qn("ConstantBinder",ia),qn("CrossFadedConstantBinder",ra),qn("SourceExpressionBinder",na),qn("CrossFadedCompositeBinder",sa),qn("CompositeExpressionBinder",oa),qn("ProgramConfiguration",aa,{omit:["_buffers"]}),qn("ProgramConfigurationSet",la);const ha=Math.pow(2,14)-1,da=-ha-1;function pa(e){const t=E/e.extent,i=e.loadGeometry();for(let e=0;ei.x+1||oi.y+1)&&V("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function fa(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?pa(e):[]}}const Aa=-32768;function ma(e,t,i,r,n){e.emplaceBack(Aa+8*t+r,Aa+8*i+n)}class ga{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new vs,this.indexArray=new Ps,this.segments=new zs,this.programConfigurations=new la(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){const r=this.layers[0],n=[];let o=null,s=!1,a="heatmap"===r.type;if("circle"===r.type){const e=r;o=e.layout.get("circle-sort-key"),s=!o.isConstant(),a=a||"map"===e.paint.get("circle-pitch-alignment")}const l=a?t.subdivisionGranularity.circle:1;for(const{feature:t,id:r,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=fa(t,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),c,i))continue;const u=s?o.evaluate(c,{},i):void 0,h={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:pa(t),patterns:{},sortKey:u};n.push(h)}s&&n.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of n){const{geometry:n,index:o,sourceLayerIndex:s}=r,a=e[o].feature;this.addFeature(r,n,o,i,l),t.featureIndex.insert(a,n,o,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ks),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,r,n=1){let o;switch(n){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}const s=o.length;for(const i of t)for(const t of i){const i=t.x,r=t.y;if(i<0||i>=E||r<0||r>=E)continue;const n=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),a=n.vertexLength;for(let e=0;e1){if(ba(e,t))return!0;for(let r=0;r1?i:i.sub(t)._mult(n)._add(t))}function Ca(e,t){for(let i=0;it.y!=s.y>t.y&&t.x<(s.x-o.x)*(t.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function Ea(e,t,i){const r=i[0],n=i[2];if(e.xn.x&&t.x>n.x||e.yn.y&&t.y>n.y)return!1;const o=H(e,t,i[0]);return o!==H(e,t,i[1])||o!==H(e,t,i[2])||o!==H(e,t,i[3])}function Ma(e,t,i){const r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Ia(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Pa(e,t,i,r,n){if(!t[0]&&!t[1])return e;const o=l.convert(t)._mult(n);"viewport"===i&&o._rotate(-r);const s=[];for(let t=0;tRa(e,t,i,r)))}(l,n,s,a),d=u?c*o:c;for(const e of r)for(const t of e){const e=u?t:Ra(t,n,s,a);let i=d;const r=n.projectTileCoordinates(t.x,t.y,s,a).signedDistanceFromCamera;if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=r/n.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=n.cameraToCenterDistance/r),ya(h,e,i))return!0}return!1}}function Ra(e,t,i,r){const n=t.projectTileCoordinates(e.x,e.y,i,r).point;return new l((.5*n.x+.5)*t.width,(.5*-n.y+.5)*t.height)}class Da extends ga{}let Oa;qn("HeatmapBucket",Da,{omit:["layers"]});var Ua={get paint(){return Oa=Oa||new Io({"heatmap-radius":new Co(me.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Co(me.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Bo(me.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Mo(me.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Bo(me.paint_heatmap["heatmap-opacity"])})}};function Na(e,{width:t,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${t*i*r}`)}else n=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=n,e}function Qa(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;const n=Na({},{width:t,height:i},r);ja(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},r),e.width=t,e.height=i,e.data=n.data}function ja(e,t,i,r,n,o){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const s=e.data,a=t.data;if(s===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l{t[e.evaluationKey]=o;const s=e.expression.evaluate(t);n.data[i+r+0]=Math.floor(255*s.r/s.a),n.data[i+r+1]=Math.floor(255*s.g/s.a),n.data[i+r+2]=Math.floor(255*s.b/s.a),n.data[i+r+3]=Math.floor(255*s.a)};if(e.clips)for(let t=0,n=0;t0)for(let n=t;n=t;n-=r)o=wl(n/r|0,e[n],e[n+1],o);return o&&gl(o,o.next)&&(Tl(o),o=o.next),o}function il(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!gl(r,r.next)&&0!==ml(r.prev,r,r.next))r=r.next;else{if(Tl(r),r=t=r.prev,r===r.next)break;i=!0}}while(i||r!==t);return t}function rl(e,t,i,r,n,o,s){if(!e)return;!s&&o&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=hl(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let o=null;for(t=0;n;){t++;let s=n,a=0;for(let e=0;e0||l>0&&s;)0!==a&&(0===l||!s||n.z<=s.z)?(r=n,n=n.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=s}o.nextZ=null,i*=2}while(t>1)}(n)}(e,r,n,o);let a=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?ol(e,r,n,o):nl(e))t.push(l.i,e.i,c.i),Tl(e),e=c.next,a=c.next;else if((e=c)===a){s?1===s?rl(e=sl(il(e),t),t,i,r,n,o,2):2===s&&al(e,t,i,r,n,o):rl(il(e),t,i,r,n,o,1);break}}}function nl(e){const t=e.prev,i=e,r=e.next;if(ml(t,i,r)>=0)return!1;const n=t.x,o=i.x,s=r.x,a=t.y,l=i.y,c=r.y,u=Math.min(n,o,s),h=Math.min(a,l,c),d=Math.max(n,o,s),p=Math.max(a,l,c);let f=r.next;for(;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&fl(n,a,o,l,s,c,f.x,f.y)&&ml(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ol(e,t,i,r){const n=e.prev,o=e,s=e.next;if(ml(n,o,s)>=0)return!1;const a=n.x,l=o.x,c=s.x,u=n.y,h=o.y,d=s.y,p=Math.min(a,l,c),f=Math.min(u,h,d),A=Math.max(a,l,c),m=Math.max(u,h,d),g=hl(p,f,t,i,r),_=hl(A,m,t,i,r);let y=e.prevZ,v=e.nextZ;for(;y&&y.z>=g&&v&&v.z<=_;){if(y.x>=p&&y.x<=A&&y.y>=f&&y.y<=m&&y!==n&&y!==s&&fl(a,u,l,h,c,d,y.x,y.y)&&ml(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,v.x>=p&&v.x<=A&&v.y>=f&&v.y<=m&&v!==n&&v!==s&&fl(a,u,l,h,c,d,v.x,v.y)&&ml(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;y&&y.z>=g;){if(y.x>=p&&y.x<=A&&y.y>=f&&y.y<=m&&y!==n&&y!==s&&fl(a,u,l,h,c,d,y.x,y.y)&&ml(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;v&&v.z<=_;){if(v.x>=p&&v.x<=A&&v.y>=f&&v.y<=m&&v!==n&&v!==s&&fl(a,u,l,h,c,d,v.x,v.y)&&ml(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function sl(e,t){let i=e;do{const r=i.prev,n=i.next.next;!gl(r,n)&&_l(r,i,i.next,n)&&xl(r,n)&&xl(n,r)&&(t.push(r.i,i.i,n.i),Tl(i),Tl(i.next),i=e=n),i=i.next}while(i!==e);return il(i)}function al(e,t,i,r,n,o){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&Al(s,e)){let a=bl(s,e);return s=il(s,s.next),a=il(a,a.next),rl(s,t,i,r,n,o,0),void rl(a,t,i,r,n,o,0)}e=e.next}s=s.next}while(s!==e)}function ll(e,t){let i=e.x-t.x;return 0===i&&(i=e.y-t.y,0===i)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function cl(e,t){const i=function(e,t){let i=t;const r=e.x,n=e.y;let o,s=-1/0;if(gl(e,i))return i;do{if(gl(e,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const e=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>s&&(s=e,o=i.x=i.x&&i.x>=l&&r!==i.x&&pl(no.x||i.x===o.x&&ul(o,i)))&&(o=i,u=t)}i=i.next}while(i!==a);return o}(e,t);if(!i)return t;const r=bl(i,e);return il(r,r.next),il(i,i.next)}function ul(e,t){return ml(e.prev,e,t.prev)<0&&ml(t.next,e,e.next)<0}function hl(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function dl(e){let t=e,i=e;do{(t.x=(e-s)*(o-a)&&(e-s)*(r-a)>=(i-s)*(t-a)&&(i-s)*(o-a)>=(n-s)*(r-a)}function fl(e,t,i,r,n,o,s,a){return!(e===s&&t===a)&&pl(e,t,i,r,n,o,s,a)}function Al(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&_l(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(xl(e,t)&&xl(t,e)&&function(e,t){let i=e,r=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(ml(e.prev,e,t.prev)||ml(e,t.prev,t))||gl(e,t)&&ml(e.prev,e,e.next)>0&&ml(t.prev,t,t.next)>0)}function ml(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function gl(e,t){return e.x===t.x&&e.y===t.y}function _l(e,t,i,r){const n=vl(ml(e,t,i)),o=vl(ml(e,t,r)),s=vl(ml(i,r,e)),a=vl(ml(i,r,t));return n!==o&&s!==a||!(0!==n||!yl(e,i,t))||!(0!==o||!yl(e,r,t))||!(0!==s||!yl(i,e,r))||!(0!==a||!yl(i,t,r))}function yl(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function vl(e){return e>0?1:e<0?-1:0}function xl(e,t){return ml(e.prev,e,e.next)<0?ml(e,t,e.next)>=0&&ml(e,e.prev,t)>=0:ml(e,t,e.prev)<0||ml(e,e.next,t)<0}function bl(e,t){const i=Bl(e.i,e.x,e.y),r=Bl(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function wl(e,t,i,r){const n=Bl(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Tl(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Bl(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Cl{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const i=0|Math.round(e),r=0|Math.round(t),n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(i,r),o}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){const i=[];for(let r=0;r0?(i.push(n),i.push(s),i.push(o)):(i.push(n),i.push(o),i.push(s))}return i}(this._vertexBuffer,e);const t=[],i=e.length;for(let r=0;r=1||y<=0)||A&&(an)){c>=r&&c<=n&&o.push(i[(e+1)%3]);continue}!A&&_>0&&o.push(this._vertexToIndex(s+d*_,a+p*_));const v=s+d*Math.max(_,0),x=s+d*Math.min(y,1);f||this._generateIntraEdgeVertices(o,s,a,l,c,v,x),!A&&y<1&&o.push(this._vertexToIndex(s+d*y,a+p*y)),(A||c>=r&&c<=n)&&o.push(i[(e+1)%3]),!A&&(c<=r||c>=n)&&this._generateInterEdgeVertices(o,s,a,l,c,u,h,x,r,n)}return o}_generateIntraEdgeVertices(e,t,i,r,n,o,s){const a=r-t,l=n-i,c=0===l,u=c?Math.min(t,r):Math.min(o,s),h=c?Math.max(t,r):Math.max(o,s),d=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(h/this._granularityCellSize)-1;if(c?t=d;r--){const n=r*this._granularityCellSize;e.push(this._vertexToIndex(n,i+l*(n-t)/a))}}_generateInterEdgeVertices(e,t,i,r,n,o,s,a,l,c){const u=n-i,h=o-r,d=s-n,p=(l-n)/d,f=(c-n)/d,A=Math.min(p,f),m=Math.max(p,f),g=r+h*A;let _=Math.floor(Math.min(g,a)/this._granularityCellSize)+1,y=Math.ceil(Math.max(g,a)/this._granularityCellSize)-1,v=a=1||m<=0){const e=i-s,r=o+(t-o)*Math.min((l-s)/e,(c-s)/e);_=Math.floor(Math.min(r,a)/this._granularityCellSize)+1,y=Math.ceil(Math.max(r,a)/this._granularityCellSize)-1,v=a0?c:l;if(v)for(let t=_;t<=y;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,b));else for(let t=y;t>=_;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,b))}_generateOutline(e){const t=[];for(const i of e){const e=Ll(i,this._granularity,!0),r=this._pointArrayToIndices(e),n=[];for(let e=1;en!=(o===El)?(e.push(t),e.push(i),e.push(this._vertexToIndex(r,o)),e.push(i),e.push(this._vertexToIndex(n,o)),e.push(this._vertexToIndex(r,o))):(e.push(i),e.push(t),e.push(this._vertexToIndex(r,o)),e.push(this._vertexToIndex(n,o)),e.push(i),e.push(this._vertexToIndex(r,o)))}_fillPoles(e,t,i){const r=this._vertexBuffer,n=E,o=e.length;for(let s=2;s80*i){a=1/0,l=1/0;let t=-1/0,r=-1/0;for(let o=i;ot&&(t=i),n>r&&(r=n)}c=Math.max(t-a,r-l),c=0!==c?32767/c:0}return rl(o,s,i,a,l,c,0),s}(i,r),t=this._convertIndices(i,e);n=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let o=[];return t&&(o=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(e,t){const i=[];for(let r=0;r0?(Math.floor(_/s)+1)*s:(Math.ceil(_/s)-1)*s,t=A>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,i=Math.abs(_-e),r=Math.abs(y-t),n=Math.abs(_-u),o=Math.abs(y-h),c=d?i/m:Number.POSITIVE_INFINITY,v=p?r/g:Number.POSITIVE_INFINITY;if((n<=i||!d)&&(o<=r||!p))break;if(c=0?s-1:o-1,n=(a+1)%o,l=e[2*t[r]],c=e[2*t[n]],u=e[2*t[s]],h=e[2*t[s]+1],d=e[2*t[a]+1];let p=!1;if(lc)p=!1;else{const i=d-h,o=-(e[2*t[a]]-u),s=h((c-u)*i+(e[2*t[n]+1]-h)*o)*s&&(p=!0)}if(p){const e=t[r],n=t[s],l=t[a];e!==n&&e!==l&&n!==l&&i.push(l,n,e),s--,s<0&&(s=o-1)}else{const e=t[n],r=t[s],l=t[a];e!==r&&e!==l&&r!==l&&i.push(l,r,e),a++,a>=o&&(a=0)}if(r===n)break}}function kl(e,t,i,r,n,o,s,a,l){const c=n.length/2,u=s&&a&&l;if(czs.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,i),l=a.count,A=!0,m=!0,g=!0,u=0);const _=zl(s,r,o,a,d,A,c),y=zl(s,r,o,a,p,m,c),v=zl(s,r,o,a,f,g,c);i.emplaceBack(u+_-l,u+y-l,u+v-l),c.primitiveLength++}}(t,i,r,n,o,e),u&&function(e,t,i,r,n,o){const s=[];for(let e=0;ezs.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,i),l=a.count,f=!0,A=!0,u=0);const m=zl(s,r,o,a,n,f,c),g=zl(s,r,o,a,h,A,c);i.emplaceBack(u+m-l,u+g-l),c.primitiveLength++}}}(s,i,a,n,l,e),t.forceNewSegmentOnNextPrepare(),null==s||s.forceNewSegmentOnNextPrepare()}function zl(e,t,i,r,n,o,s){if(o){const o=r.count;return i(t[2*n],t[2*n+1]),e[n]=r.count,r.count++,s.vertexLength++,o}return e[n]}class Rl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new xs,this.indexArray=new Ps,this.indexArray2=new Ls,this.programConfigurations=new la(e.layers,e.zoom),this.segments=new zs,this.segments2=new zs,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.hasPattern=Ja("fill",this.layers,t);const r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=fa(s,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),u,i))continue;const h=n?r.evaluate(u,{},i,t.availableImages):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:pa(s),patterns:{},sortKey:h};o.push(d)}n&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:s}=r;if(this.hasPattern){const e=el("fill",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ya),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,t,i,r,n,o){for(const e of Gi(t,500)){const t=Pl(e,r,o.fill.getGranularityForZoomLevel(r.z)),i=this.layoutVertexArray;kl(((e,t)=>{i.emplaceBack(e,t)}),this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}}let Dl,Ol;qn("FillBucket",Rl,{omit:["layers","patternFeatures"]});var Ul={get paint(){return Ol=Ol||new Io({"fill-antialias":new Bo(me.paint_fill["fill-antialias"]),"fill-opacity":new Co(me.paint_fill["fill-opacity"]),"fill-color":new Co(me.paint_fill["fill-color"]),"fill-outline-color":new Co(me.paint_fill["fill-outline-color"]),"fill-translate":new Bo(me.paint_fill["fill-translate"]),"fill-translate-anchor":new Bo(me.paint_fill["fill-translate-anchor"]),"fill-pattern":new So(me.paint_fill["fill-pattern"])})},get layout(){return Dl=Dl||new Io({"fill-sort-key":new Co(me.layout_fill["fill-sort-key"])})}};class Nl extends Lo{constructor(e){super(e,Ul)}recalculate(e,t){super.recalculate(e,t);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(e){return new Rl(e)}queryRadius(){return Ia(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){return va(Pa(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),t)}isTileClipped(){return!0}}const Ql=Ro([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),jl=Ro([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Vl}=Ql;var Hl,Gl,$l,Zl,ql,Kl,Wl,Xl={};function Yl(){if(Gl)return Hl;Gl=1;var e=o();function t(e,t,r,n,o){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,e.readFields(i,this,t)}function i(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){for(var i=e.readVarint()+e.pos;e.pos>3}if(o--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(i&&l.push(i),i=[]),i.push(new e(s,a));else{if(7!==n)throw new Error("unknown command "+n);i&&i.push(i[0].clone())}}return i&&l.push(i),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;e.pos>3}if(r--,1===i||2===i)(n+=e.readSVarint())a&&(a=n),(o+=e.readSVarint())c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[s,l,a,c]},t.prototype.toGeoJSON=function(e,i,n){var o,s,a=this.extent*Math.pow(2,n),l=this.extent*e,c=this.extent*i,u=this.loadGeometry(),h=t.types[this.type];function d(e){for(var t=0;t>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}return $l=t,t.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 i=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,i,this.extent,this._keys,this._values)},$l}function ec(){return Wl||(Wl=1,Xl.VectorTile=function(){if(Kl)return ql;Kl=1;var e=Jl();function t(t,i,r){if(3===t){var n=new e(r,r.readVarint()+r.pos);n.length&&(i[n.name]=n)}}return ql=function(e,i){this.layers=e.readFields(t,{},i)},ql}(),Xl.VectorTileFeature=Yl(),Xl.VectorTileLayer=Jl()),Xl}var tc=i(ec());const ic=tc.VectorTileFeature.types,rc=Math.pow(2,13);function nc(e,t,i,r,n,o,s,a){e.emplaceBack(t,i,2*Math.floor(r*rc)+s,n*rc*2,o*rc*2,Math.round(a))}class oc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new bs,this.centroidVertexArray=new ys,this.indexArray=new Ps,this.programConfigurations=new la(e.layers,e.zoom),this.segments=new zs,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.features=[],this.hasPattern=Ja("fill-extrusion",this.layers,t);for(const{feature:r,id:n,index:o,sourceLayerIndex:s}of e){const e=this.layers[0]._featureFilter.needGeometry,a=fa(r,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),a,i))continue;const l={id:n,sourceLayerIndex:s,index:o,geometry:e?a.geometry:pa(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(el("fill-extrusion",this.layers,l,this.zoom,t)):this.addFeature(l,l.geometry,o,i,{},t.subdivisionGranularity),t.featureIndex.insert(r,l.geometry,o,s,this.index,!0)}}addFeatures(e,t,i){for(const r of this.features){const{geometry:n}=r;this.addFeature(r,n,r.index,t,i,e.subdivisionGranularity)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vl),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,jl.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,i,r,n,o){for(const i of Gi(t,500)){const t={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(t,r,e,i,o);const s=this.layoutVertexArray.length-n,a=Math.floor(t.x/t.sampleCount),l=Math.floor(t.y/t.sampleCount);for(let e=0;e{nc(c,e,t,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let i=0;for(let r=1;rzs.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const s=n.sub(o)._perp()._unit(),a=o.dist(n);i+a>32768&&(i=0),nc(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,i),nc(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,i),i+=a,nc(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,i),nc(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,i);const l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}}function sc(e,t){for(let i=0;iE)||e.y===t.y&&(e.y<0||e.y>E)}function lc(e){return e.every((e=>e.x<0))||e.every((e=>e.x>E))||e.every((e=>e.y<0))||e.every((e=>e.y>E))}let cc;qn("FillExtrusionBucket",oc,{omit:["layers","features"]});var uc={get paint(){return cc=cc||new Io({"fill-extrusion-opacity":new Bo(me["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Co(me["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Bo(me["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Bo(me["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new So(me["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Co(me["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Co(me["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Bo(me["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class hc extends Lo{constructor(e){super(e,uc)}createBucket(e){return new oc(e)}queryRadius(){return Ia(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,pixelPosMatrix:s}){const a=Pa(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("fill-extrusion-height").evaluate(t,i),u=this.paint.get("fill-extrusion-base").evaluate(t,i),h=function(e,t){const i=[];for(const r of e){const e=[r.x,r.y,0,1];T(e,e,t),i.push(new l(e[0]/e[3],e[1]/e[3]))}return i}(a,s),d=function(e,t,i,r){const n=[],o=[],s=r[8]*t,a=r[9]*t,c=r[10]*t,u=r[11]*t,h=r[8]*i,d=r[9]*i,p=r[10]*i,f=r[11]*i;for(const t of e){const e=[],i=[];for(const n of t){const t=n.x,o=n.y,A=r[0]*t+r[4]*o+r[12],m=r[1]*t+r[5]*o+r[13],g=r[2]*t+r[6]*o+r[14],_=r[3]*t+r[7]*o+r[15],y=g+c,v=_+u,x=A+h,b=m+d,w=g+p,T=_+f,B=new l((A+s)/v,(m+a)/v);B.z=y/v,e.push(B);const C=new l(x/T,b/T);C.z=w/T,i.push(C)}n.push(e),o.push(i)}return[n,o]}(r,u,c,s);return function(e,t,i){let r=1/0;va(i,t)&&(r=pc(i,t[0]));for(let n=0;ne.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new ws,this.layoutVertexArray2=new Ts,this.indexArray=new Ps,this.programConfigurations=new la(e.layers,e.zoom),this.segments=new zs,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.hasPattern=Ja("line",this.layers,t);const r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),o=[];for(const{feature:t,id:s,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=fa(t,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),c,i))continue;const u=n?r.evaluate(c,{},i):void 0,h={id:s,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:pa(t),patterns:{},sortKey:u};o.push(h)}n&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:s}=r;if(this.hasPattern){const e=el("line",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,gc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ac),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,i,r,n,o){const s=this.layers[0].layout,a=s.get("line-join").evaluate(e,{}),l=s.get("line-cap"),c=s.get("line-miter-limit"),u=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const i of t)this.addLine(i,e,a,l,c,u,r,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}addLine(e,t,i,r,n,o,s,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Ll(e,s?a.line.getGranularityForZoomLevel(s.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t=2&&e[c-1].equals(e[c-2]);)c--;let u=0;for(;u0;if(x&&t>u){const e=p.dist(f);if(e>2*h){const t=p.sub(p.sub(f)._mult(h/e)._round());this.updateDistance(f,t),this.addCurrentVertex(t,m,0,0,d),f=t}}const w=f&&A;let T=w?i:l?"butt":r;if(w&&"round"===T&&(yn&&(T="bevel"),"bevel"===T&&(y>2&&(T="flipbevel"),y100)s=g.mult(-1);else{const e=y*m.add(g).mag()/m.sub(g).mag();s._perp()._mult(e*(b?-1:1))}this.addCurrentVertex(p,s,0,0,d),this.addCurrentVertex(p,s.mult(-1),0,0,d)}else if("bevel"===T||"fakeround"===T){const e=-Math.sqrt(y*y-1),t=b?e:0,i=b?0:e;if(f&&this.addCurrentVertex(p,m,t,i,d),"fakeround"===T){const e=Math.round(180*v/Math.PI/20);for(let t=1;t2*h){const t=p.add(A.sub(p)._mult(h/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,g,0,0,d),p=t}}}}addCurrentVertex(e,t,i,r,n,o=!1){const s=t.y*r-t.x,a=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,o,!1,i,n),this.addHalfVertex(e,s,a,o,!0,-r,n),this.distance>vc/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,n,o))}addHalfVertex({x:e,y:t},i,r,n,o,s,a){const l=.5*(this.lineClips?this.scaledDistance*(vc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+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,c,this.e2),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(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}let bc,wc;qn("LineBucket",xc,{omit:["layers","patternFeatures"]});var Tc={get paint(){return wc=wc||new Io({"line-opacity":new Co(me.paint_line["line-opacity"]),"line-color":new Co(me.paint_line["line-color"]),"line-translate":new Bo(me.paint_line["line-translate"]),"line-translate-anchor":new Bo(me.paint_line["line-translate-anchor"]),"line-width":new Co(me.paint_line["line-width"]),"line-gap-width":new Co(me.paint_line["line-gap-width"]),"line-offset":new Co(me.paint_line["line-offset"]),"line-blur":new Co(me.paint_line["line-blur"]),"line-dasharray":new Eo(me.paint_line["line-dasharray"]),"line-pattern":new So(me.paint_line["line-pattern"]),"line-gradient":new Mo(me.paint_line["line-gradient"])})},get layout(){return bc=bc||new Io({"line-cap":new Bo(me.layout_line["line-cap"]),"line-join":new Co(me.layout_line["line-join"]),"line-miter-limit":new Bo(me.layout_line["line-miter-limit"]),"line-round-limit":new Bo(me.layout_line["line-round-limit"]),"line-sort-key":new Co(me.layout_line["line-sort-key"])})}};class Bc extends Co{possiblyEvaluate(e,t){return t=new mo(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=D({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}let Cc;class Sc extends Lo{constructor(e){super(e,Tc),this.gradientVersion=0,Cc||(Cc=new Bc(Tc.paint.properties["line-width"].specification),Cc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this.gradientExpression();this.stepInterpolant=!!function(e){return void 0!==e._styleExpression}(e)&&e._styleExpression.expression instanceof Yt,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=Cc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new xc(e)}queryRadius(e){const t=e,i=Ec(Ma("line-width",this,t),Ma("line-gap-width",this,t)),r=Ma("line-offset",this,t);return i/2+Math.abs(r)+Ia(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o}){const s=Pa(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,o),a=o/2*Ec(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),c=this.paint.get("line-offset").evaluate(t,i);return c&&(r=function(e,t){const i=[];for(let r=0;r=3)for(let t=0;t0?t+2*e:e}const Mc=Ro([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ic=Ro([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ro([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Pc=Ro([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ro([{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 Lc=Ro([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Fc=Ro([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function kc(e,t,i){return e.sections.forEach((e=>{e.text=function(e,t,i){const r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),Ao.applyArabicShaping&&(e=Ao.applyArabicShaping(e)),e}(e.text,t,i)})),e}Ro([{name:"triangle",components:3,type:"Uint16"}]),Ro([{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"}]),Ro([{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"}]),Ro([{type:"Float32",name:"offsetX"}]),Ro([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ro([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const zc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Rc,Dc,Oc,Uc=24,Nc={};function Qc(){return Rc||(Rc=1,Nc.read=function(e,t,i,r,n){var o,s,a=8*n-r-1,l=(1<>1,u=-7,h=i?n-1:0,d=i?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},Nc.write=function(e,t,i,r,n,o){var s,a,l,c=8*o-n-1,u=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,A=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*l-1)*Math.pow(2,n),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;e[i+p]=255&a,p+=f,a/=256,n-=8);for(s=s<0;e[i+p]=255&s,p+=f,s/=256,c-=8);e[i+p-f]|=128*A}),Nc}function jc(){if(Oc)return Dc;Oc=1,Dc=t;var e=Qc();function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var i=4294967296,r=1/i,n="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");function o(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function a(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function l(e,t){for(var i=0;i>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos>3,o=this.pos;this.type=7&r,e(n,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=g(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=g(this.buf,this.pos)+g(this.buf,this.pos+4)*i;return this.pos+=8,e},readSFixed64:function(){var e=g(this.buf,this.pos)+y(this.buf,this.pos+4)*i;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return s(e,r,t);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return s(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&n?function(e,t,i){return n.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var r="",n=t;n239?4:l>223?3:l>191?2:1;if(n+u>i)break;1===u?l<128&&(c=l):2===u?128==(192&(o=e[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(s=e[n+2],128==(192&(o=e[n+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(s=e[n+2],a=e[n+3],128==(192&(o=e[n+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,u=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=u}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,i){if(this.type!==t.Bytes)return e.push(this.readVarint(i));var r=o(this);for(e=e||[];this.pos127;);else if(i===t.Bytes)this.pos=this.readVarint()+this.pos;else if(i===t.Fixed32)this.pos+=4;else{if(i!==t.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,o=0;o55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&a(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i=128&&a(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,i,r){this.writeTag(e,t.Bytes),this.writeRawMessage(i,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,l,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,c,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,d,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,u,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,h,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,p,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,A,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,m,t)},writeBytesField:function(e,i){this.writeTag(e,t.Bytes),this.writeBytes(i)},writeFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeSFixed64(i)},writeVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeVarint(i)},writeSVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeSVarint(i)},writeStringField:function(e,i){this.writeTag(e,t.Bytes),this.writeString(i)},writeFloatField:function(e,i){this.writeTag(e,t.Fixed32),this.writeFloat(i)},writeDoubleField:function(e,i){this.writeTag(e,t.Fixed64),this.writeDouble(i)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},Dc}var Vc=i(jc());const Hc=3;function Gc(e,t,i){1===e&&i.readMessage($c,t)}function $c(e,t,i){if(3===e){const{id:e,bitmap:r,width:n,height:o,left:s,top:a,advance:l}=i.readMessage(Zc,{});t.push({id:e,bitmap:new Va({width:n+2*Hc,height:o+2*Hc},r),metrics:{width:n,height:o,left:s,top:a,advance:l}})}}function Zc(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}const qc=Hc;function Kc(e){let t=0,i=0;for(const r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort(((e,t)=>t.h-e.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,o=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const i=r[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,o=Math.max(o,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===i.w&&t.h===i.h){const t=r.pop();e=0&&i>=e&&nu[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const i=new iu;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}getMaxImageSize(e){let t=0,i=0;for(let r=0;r=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ru(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A){const m=iu.fromFeature(t,o);let g;d===e.al.vertical&&m.verticalizePunctuation();const{processBidirectionalText:_,processStyledBidirectionalText:y}=Ao;if(_&&1===m.sections.length){g=[];const e=_(m.toString(),du(m,u,s,i,n,f));for(const t of e){const e=new iu;e.text=t,e.sections=m.sections;for(let i=0;i=0;let c=0;for(let i=0;ic){const e=Math.ceil(o/c);n*=e/s,s=e}return{x1:r,y1:n,x2:r+o,y2:n+s}}function bu(e,t,i,r,n,o){const s=e.image;let a;if(s.content){const e=s.content,t=s.pixelRatio||1;a=[e[0]/t,e[1]/t,s.displaySize[0]-e[2]/t,s.displaySize[1]-e[3]/t]}const l=t.left*o,c=t.right*o;let u,h,d,p;"width"===i||"both"===i?(p=n[0]+l-r[3],h=n[0]+c+r[1]):(p=n[0]+(l+c-s.displaySize[0])/2,h=p+s.displaySize[0]);const f=t.top*o,A=t.bottom*o;return"height"===i||"both"===i?(u=n[1]+f-r[0],d=n[1]+A+r[2]):(u=n[1]+(f+A-s.displaySize[1])/2,d=u+s.displaySize[1]),{image:s,top:u,right:h,bottom:d,left:p,collisionPadding:a}}const wu=255,Tu=128,Bu=wu*Tu;function Cu(e,t){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new mo(e+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:r}=i;let n=0;for(;ne.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cu(this.zoom,i["text-size"]),this.iconSizeData=Cu(this.zoom,i["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),o=r.get("symbol-z-order");this.canOverlap="never"!==Su(r,"text-overlap","text-allow-overlap")||"never"!==Su(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((t=>e.al[t]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=t.sourceID}createArrays(){this.text=new Fu(new la(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new Fu(new la(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new ps,this.lineVertexArray=new fs,this.symbolInstances=new ds,this.textAnchorOffsets=new ms}calculateGlyphDependencies(e,t,i,r,n){for(let o=0;o0)&&("constant"!==s.value.kind||s.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!c&&!u)return;const d=i.iconDependencies,p=i.glyphDependencies,f=i.availableImages,A=new mo(this.zoom);for(const{feature:i,id:a,index:l,sourceLayerIndex:m}of t){const t=n._featureFilter.needGeometry,g=fa(i,t);if(!n._featureFilter.filter(A,g,r))continue;let _,y;if(t||(g.geometry=pa(i)),c){const e=n.getValueAndResolveTokens("text-field",g,r,f),t=Tt.factory(e),i=this.hasRTLText=this.hasRTLText||Lu(t);(!i||"unavailable"===Ao.getRTLTextPluginStatus()||i&&Ao.isParsed())&&(_=kc(t,n,g))}if(u){const e=n.getValueAndResolveTokens("icon-image",g,r,f);y=e instanceof Mt?e:Mt.fromString(e)}if(!_&&!y)continue;const v=this.sortFeaturesByKey?h.evaluate(g,{},r):void 0;if(this.features.push({id:a,text:_,icon:y,index:l,sourceLayerIndex:m,geometry:g.geometry,properties:i.properties,type:Eu[i.type],sortKey:v}),y&&(d[y.name]=!0),_){const t=s.evaluate(g,{},r).join(","),i="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.al.vertical)>=0;for(const e of _.sections)if(e.image)d[e.image.name]=!0;else{const r=io(_.toString()),n=e.fontStack||t,o=p[n]=p[n]||{};this.calculateGlyphDependencies(e.text,o,i,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},r=[];let n=0;function o(t){r.push(e[t]),n++}function s(e,t,n){const o=i[e];return delete i[e],i[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function a(e,i,n){const o=t[i];return delete t[i],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(e,t,i){const r=i?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let c=0;ce.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment){let i=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]);const n={};for(let r=e.segment+1;r=0;i--)n[i]={x:t[i].x,y:t[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=t[i-1].dist(t[i]));for(let e=0;e0}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(e,t){const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;tr[e]-r[t]||n[t]-n[e])),o}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach(((e,t,i)=>{e>=0&&i.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)})),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Ru,Du;qn("SymbolBucket",zu,{omit:["layers","collisionBoxArray","features","compareText"]}),zu.MAX_GLYPHS=65535,zu.addDynamicAttributes=Pu;var Ou={get paint(){return Du=Du||new Io({"icon-opacity":new Co(me.paint_symbol["icon-opacity"]),"icon-color":new Co(me.paint_symbol["icon-color"]),"icon-halo-color":new Co(me.paint_symbol["icon-halo-color"]),"icon-halo-width":new Co(me.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Co(me.paint_symbol["icon-halo-blur"]),"icon-translate":new Bo(me.paint_symbol["icon-translate"]),"icon-translate-anchor":new Bo(me.paint_symbol["icon-translate-anchor"]),"text-opacity":new Co(me.paint_symbol["text-opacity"]),"text-color":new Co(me.paint_symbol["text-color"],{runtimeType:Re,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Co(me.paint_symbol["text-halo-color"]),"text-halo-width":new Co(me.paint_symbol["text-halo-width"]),"text-halo-blur":new Co(me.paint_symbol["text-halo-blur"]),"text-translate":new Bo(me.paint_symbol["text-translate"]),"text-translate-anchor":new Bo(me.paint_symbol["text-translate-anchor"])})},get layout(){return Ru=Ru||new Io({"symbol-placement":new Bo(me.layout_symbol["symbol-placement"]),"symbol-spacing":new Bo(me.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Bo(me.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Co(me.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Bo(me.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Bo(me.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Bo(me.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Bo(me.layout_symbol["icon-ignore-placement"]),"icon-optional":new Bo(me.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Bo(me.layout_symbol["icon-rotation-alignment"]),"icon-size":new Co(me.layout_symbol["icon-size"]),"icon-text-fit":new Bo(me.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Bo(me.layout_symbol["icon-text-fit-padding"]),"icon-image":new Co(me.layout_symbol["icon-image"]),"icon-rotate":new Co(me.layout_symbol["icon-rotate"]),"icon-padding":new Co(me.layout_symbol["icon-padding"]),"icon-keep-upright":new Bo(me.layout_symbol["icon-keep-upright"]),"icon-offset":new Co(me.layout_symbol["icon-offset"]),"icon-anchor":new Co(me.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Bo(me.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Bo(me.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Bo(me.layout_symbol["text-rotation-alignment"]),"text-field":new Co(me.layout_symbol["text-field"]),"text-font":new Co(me.layout_symbol["text-font"]),"text-size":new Co(me.layout_symbol["text-size"]),"text-max-width":new Co(me.layout_symbol["text-max-width"]),"text-line-height":new Bo(me.layout_symbol["text-line-height"]),"text-letter-spacing":new Co(me.layout_symbol["text-letter-spacing"]),"text-justify":new Co(me.layout_symbol["text-justify"]),"text-radial-offset":new Co(me.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Bo(me.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Co(me.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Co(me.layout_symbol["text-anchor"]),"text-max-angle":new Bo(me.layout_symbol["text-max-angle"]),"text-writing-mode":new Bo(me.layout_symbol["text-writing-mode"]),"text-rotate":new Co(me.layout_symbol["text-rotate"]),"text-padding":new Bo(me.layout_symbol["text-padding"]),"text-keep-upright":new Bo(me.layout_symbol["text-keep-upright"]),"text-transform":new Co(me.layout_symbol["text-transform"]),"text-offset":new Co(me.layout_symbol["text-offset"]),"text-allow-overlap":new Bo(me.layout_symbol["text-allow-overlap"]),"text-overlap":new Bo(me.layout_symbol["text-overlap"]),"text-ignore-placement":new Bo(me.layout_symbol["text-ignore-placement"]),"text-optional":new Bo(me.layout_symbol["text-optional"])})}};class Uu{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Le,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}qn("FormatSectionOverride",Uu,{omit:["defaultValue"]});class Nu extends Lo{constructor(e){super(e,Ou)}recalculate(e,t){if(super.recalculate(e,t),"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 e=this.layout.get("text-writing-mode");if(e){const t=[];for(const i of e)t.indexOf(i)<0&&t.push(i);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,r){const n=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Gr(o.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,((t,i)=>e&&i in e?String(e[i]):""))}(t.properties,n)}createBucket(e){return new zu(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Ou.paint.overridableProperties){if(!Nu.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new Uu(t),r=new Hr(i,t.property.specification);let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new Zr("source",r):new qr("composite",r,t.value.zoomStops),this.paint._values[e]=new wo(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&Nu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),r=Ou.paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof Tt)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{n||(t instanceof zt&&Ft(t.value)===Qe?o(t.value.sections):t instanceof yi?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}}let Qu;var ju={get paint(){return Qu=Qu||new Io({"background-color":new Bo(me.paint_background["background-color"]),"background-pattern":new Eo(me.paint_background["background-pattern"]),"background-opacity":new Bo(me.paint_background["background-opacity"])})}};class Vu extends Lo{constructor(e){super(e,ju)}}let Hu;var Gu={get paint(){return Hu=Hu||new Io({"raster-opacity":new Bo(me.paint_raster["raster-opacity"]),"raster-hue-rotate":new Bo(me.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Bo(me.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Bo(me.paint_raster["raster-brightness-max"]),"raster-saturation":new Bo(me.paint_raster["raster-saturation"]),"raster-contrast":new Bo(me.paint_raster["raster-contrast"]),"raster-resampling":new Bo(me.paint_raster["raster-resampling"]),"raster-fade-duration":new Bo(me.paint_raster["raster-fade-duration"])})}};class $u extends Lo{constructor(e){super(e,Gu)}}class Zu extends Lo{constructor(e){super(e,{}),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}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 qu{constructor(e){this._methodToThrottle=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Ku={once:!0},Wu=6371008.8;class Xu{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Xu(R(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Wu*Math.acos(Math.min(n,1))}static convert(e){if(e instanceof Xu)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Xu(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Xu(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Yu=2*Math.PI*Wu;function Ju(e){return Yu*Math.cos(e*Math.PI/180)}function eh(e){return(180+e)/360}function th(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function ih(e,t){return e/Ju(t)}function rh(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function nh(e,t){return e*Ju(rh(t))}class oh{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=Xu.convert(e);return new oh(eh(i.lng),th(i.lat),ih(t,i.lat))}toLngLat(){return new Xu(360*this.x-180,rh(this.y))}toAltitude(){return nh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Yu*(e=rh(this.y),1/Math.cos(e*Math.PI/180));var e}}function sh(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class ah{constructor(e,t,i){if(!function(e,t,i){return!(e<0||e>25||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}(e,t,i))throw new Error(`x=${t}, y=${i}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=t,this.y=i,this.key=uh(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){const r=(o=this.y,s=this.z,a=sh(256*(n=this.x),256*(o=Math.pow(2,s)-o-1),s),l=sh(256*(n+1),256*(o+1),s),a[0]+","+a[1]+","+l[0]+","+l[1]);var n,o,s,a,l;const c=function(e,t,i){let r,n="";for(let o=e;o>0;o--)r=1<1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){const t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){const t=Math.pow(2,this.z);return new l((e.x*t-this.x)*E,(e.y*t-this.y)*E)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lh{constructor(e,t){this.wrap=e,this.canonical=t,this.key=uh(e,t.z,t.z,t.x,t.y)}}class ch{constructor(e,t,i,r,n){if(this.terrainRttPosMatrix32f=null,e= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=t,this.canonical=new ah(i,+r,+n),this.key=uh(t,e,i,r,n)}clone(){return new ch(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const t=this.canonical.z-e;return e>this.canonical.z?new ch(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ch(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?uh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):uh(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new ch(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new ch(t,this.wrap,t,i,r),new ch(t,this.wrap,t,i+1,r),new ch(t,this.wrap,t,i,r+1),new ch(t,this.wrap,t,i+1,r+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=i),i=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new Ha({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-t*this.dim,l=-i*this.dim;for(let t=o;t=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class ph{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=i,e._y=r,this.properties=e.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&(e[t]=this[t]);return e}}class fh{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new $n(E,16,0),this.grid3D=new $n(E,16,0),this.featureIndexArray=new _s,this.promoteId=t}insert(e,t,i,r,n,o){const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);const a=o?this.grid3D:this.grid;for(let e=0;e=0&&r[3]>=0&&a.insert(s,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new tc.VectorTile(new Vc(this.rawTileData)).layers,this.sourceLayerCoder=new dh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,i,r){this.loadVTLayers();const n=e.params,o=E/e.tileSize/e.scale,s=en(n.filter),a=e.queryGeometry,c=e.queryPadding*o,u=mh(a),h=this.grid.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c),d=mh(e.cameraQueryGeometry),p=this.grid3D.query(d.minX-c,d.minY-c,d.maxX+c,d.maxY+c,((t,i,r,n)=>function(e,t,i,r,n){for(const o of e)if(t<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;const o=[new l(t,i),new l(t,n),new l(r,n),new l(r,i)];if(e.length>2)for(const t of o)if(Sa(e,t))return!0;for(let t=0;t(d||(d=pa(t)),i.queryIntersectsFeature({queryGeometry:a,feature:t,featureState:r,geometry:d,zoom:this.z,transform:e.transform,pixelsToTileUnits:o,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return f}loadMatchingFeature(e,t,i,r,n,o,s,a,l,c,u){const h=this.bucketLayerIDs[t];if(o&&!h.some((e=>o.has(e))))return;const d=this.sourceLayerCoder.decode(i),p=this.vtLayers[d].feature(r);if(n.needGeometry){const e=fa(p,!0);if(!n.filter(new mo(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!n.filter(new mo(this.tileID.overscaledZ),p))return;const f=this.getId(p,d);for(let t=0;t{const s=t instanceof To?t.get(o):null;return s&&s.evaluate?s.evaluate(i,r,n):s}))}function mh(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return{minX:t,minY:i,maxX:r,maxY:n}}function gh(e,t){return t-e}function _h(e,t,i,r,n){const o=[];for(let s=0;s=r&&u.x>=r||(s.x>=r?s=new l(r,s.y+(r-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=r&&(u=new l(r,s.y+(r-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=n&&u.y>=n||(s.y>=n?s=new l(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round():u.y>=n&&(u=new l(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round()),c&&s.equals(c[c.length-1])||(c=[s],o.push(c)),c.push(u)))))}}return o}qn("FeatureIndex",fh,{omit:["rawTileData","sourceLayerCoder"]});class yh extends l{constructor(e,t,i,r){super(e,t),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new yh(this.x,this.y,this.angle,this.segment)}}function vh(e,t,i,r,n){if(void 0===t.segment||0===i)return!0;let o=t,s=t.segment+1,a=0;for(;a>-i/2;){if(s--,s<0)return!1;a-=e[s].dist(o),o=e[s]}a+=e[s].dist(e[s+1]),s++;const l=[];let c=0;for(;ar;)c-=l.shift().angleDelta;if(c>n)return!1;s++,a+=t.dist(i)}return!0}function xh(e){let t=0;for(let i=0;ic){const u=(c-l)/o,h=si.number(r.x,n.x,u),d=si.number(r.y,n.y,u),p=new yh(h,d,n.angleTo(r),i);return p._round(),!s||vh(e,p,a,s,t)?p:void 0}l+=o}}function Bh(e,t,i,r,n,o,s,a,l){const c=bh(r,o,s),u=wh(r,n),h=u*s,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h=0&&g=0&&_=0&&d+c<=u){const i=new yh(g,_,A,t);i._round(),r&&!vh(e,i,o,r,n)||p.push(i)}}h+=f}return a||p.length||s||(p=Ch(e,h/2,i,r,n,o,s,!0,l)),p}qn("Anchor",yh);const Sh=Wc;function Eh(e,t,i,r){const n=[],o=e.image,s=o.pixelRatio,a=o.paddedRect.w-2*Sh,c=o.paddedRect.h-2*Sh;let u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom};const h=o.stretchX||[[0,a]],d=o.stretchY||[[0,c]],p=(e,t)=>e+t[1]-t[0],f=h.reduce(p,0),A=d.reduce(p,0),m=a-f,g=c-A;let _=0,y=f,v=0,x=A,b=0,w=m,T=0,B=g;if(o.content&&r){const t=o.content,i=t[2]-t[0],r=t[3]-t[1];(o.textFitWidth||o.textFitHeight)&&(u=xu(e)),_=Mh(h,0,t[0]),v=Mh(d,0,t[1]),y=Mh(h,t[0],t[2]),x=Mh(d,t[1],t[3]),b=t[0]-_,T=t[1]-v,w=i-y,B=r-x}const C=u.x1,S=u.y1,E=u.x2-C,M=u.y2-S,I=(e,r,n,a)=>{const c=Ph(e.stretch-_,y,E,C),u=Lh(e.fixed-b,w,e.stretch,f),h=Ph(r.stretch-v,x,M,S),d=Lh(r.fixed-T,B,r.stretch,A),p=Ph(n.stretch-_,y,E,C),m=Lh(n.fixed-b,w,n.stretch,f),g=Ph(a.stretch-v,x,M,S),I=Lh(a.fixed-T,B,a.stretch,A),P=new l(c,h),L=new l(p,h),F=new l(p,g),k=new l(c,g),z=new l(u/s,d/s),R=new l(m/s,I/s),D=t*Math.PI/180;if(D){const e=Math.sin(D),t=Math.cos(D),i=[t,-e,e,t];P._matMult(i),L._matMult(i),k._matMult(i),F._matMult(i)}const O=e.stretch+e.fixed,U=r.stretch+r.fixed;return{tl:P,tr:L,bl:k,br:F,tex:{x:o.paddedRect.x+Sh+O,y:o.paddedRect.y+Sh+U,w:n.stretch+n.fixed-O,h:a.stretch+a.fixed-U},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:z,pixelOffsetBR:R,minFontScaleX:w/s/E,minFontScaleY:B/s/M,isSDF:i}};if(r&&(o.stretchX||o.stretchY)){const e=Ih(h,m,f),t=Ih(d,g,A);for(let i=0;i0&&(r=Math.max(10,r),this.circleDiameter=r)}else{const c=(null===(h=o.image)||void 0===h?void 0:h.content)&&(o.image.textFitWidth||o.image.textFitHeight)?xu(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};c.y1=c.y1*s-a[0],c.y2=c.y2*s+a[2],c.x1=c.x1*s-a[3],c.x2=c.x2*s+a[1];const d=o.collisionPadding;if(d&&(c.x1-=d[0]*s,c.y1-=d[1]*s,c.x2+=d[2]*s,c.y2+=d[3]*s),u){const e=new l(c.x1,c.y1),t=new l(c.x2,c.y1),i=new l(c.x1,c.y2),r=new l(c.x2,c.y2),n=u*Math.PI/180;e._rotate(n),t._rotate(n),i._rotate(n),r._rotate(n),c.x1=Math.min(e.x,t.x,i.x,r.x),c.x2=Math.max(e.x,t.x,i.x,r.x),c.y1=Math.min(e.y,t.y,i.y,r.y),c.y2=Math.max(e.y,t.y,i.y,r.y)}e.emplaceBack(t.x,t.y,c.x1,c.y1,c.x2,c.y2,i,r,n)}this.boxEndIndex=e.length}}class kh{constructor(e=[],t=(e,t)=>et?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e=0)break;t[e]=t[r],e=r}t[e]=n}}function zh(e,t=1,i=!1){let r=1/0,n=1/0,o=-1/0,s=-1/0;const a=e[0];for(let e=0;eo)&&(o=t.x),(!e||t.y>s)&&(s=t.y)}const c=Math.min(o-r,s-n);let u=c/2;const h=new kh([],Rh);if(0===c)return new l(r,n);for(let t=r;td.d||!d.d)&&(d=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,p)),r.max-d.d<=t||(u=r.h/2,h.push(new Dh(r.p.x-u,r.p.y-u,u,e)),h.push(new Dh(r.p.x+u,r.p.y-u,u,e)),h.push(new Dh(r.p.x-u,r.p.y+u,u,e)),h.push(new Dh(r.p.x+u,r.p.y+u,u,e)),p+=4)}return i&&(console.log(`num probes: ${p}`),console.log(`best distance: ${d.d}`)),d.p}function Rh(e,t){return t.max-e.max}function Dh(e,t,i,r){this.p=new l(e,t),this.h=i,this.d=function(e,t){let i=!1,r=1/0;for(let n=0;ne.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(i=!i),r=Math.min(r,Ba(e,n,a))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var Oh;e.aB=void 0,(Oh=e.aB||(e.aB={}))[Oh.center=1]="center",Oh[Oh.left=2]="left",Oh[Oh.right=3]="right",Oh[Oh.top=4]="top",Oh[Oh.bottom=5]="bottom",Oh[Oh["top-left"]=6]="top-left",Oh[Oh["top-right"]=7]="top-right",Oh[Oh["bottom-left"]=8]="bottom-left",Oh[Oh["bottom-right"]=9]="bottom-right";const Uh=7,Nh=Number.POSITIVE_INFINITY;function Qh(e,t){return t[1]!==Nh?function(e,t,i){let r=0,n=0;switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-Uh;break;case"bottom-right":case"bottom-left":case"bottom":n=-i+Uh}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}return[r,n]}(e,t[0],t[1]):function(e,t){let i=0,r=0;t<0&&(t=0);const n=t/Math.SQRT2;switch(e){case"top-right":case"top-left":r=n-Uh;break;case"bottom-right":case"bottom-left":r=-n+Uh;break;case"bottom":r=-t+Uh;break;case"top":r=t-Uh}switch(e){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=t;break;case"right":i=-t}return[i,r]}(e,t[0])}function jh(e,t,i){var r;const n=e.layout,o=null===(r=n.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(t,{},i);if(o){const e=o.values,t=[];for(let i=0;ie*Uc));r.startsWith("top")?n[1]-=Uh:r.startsWith("bottom")&&(n[1]+=Uh),t[i+1]=n}return new Et(t)}const s=n.get("text-variable-anchor");if(s){let r;r=void 0!==e._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(t,{},i)*Uc,Nh]:n.get("text-offset").evaluate(t,{},i).map((e=>e*Uc));const o=[];for(const e of s)o.push(e,Qh(e,r));return new Et(o)}return null}function Vh(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Hh(t,i,r,n,o,s,a,l,c,u,h,d){let p=s.textMaxSize.evaluate(i,{});void 0===p&&(p=a);const f=t.layers[0].layout,A=f.get("icon-offset").evaluate(i,{},h),m=$h(r.horizontal),g=a/24,_=t.tilePixelRatio*g,y=t.tilePixelRatio*p/24,v=t.tilePixelRatio*l,x=t.tilePixelRatio*f.get("symbol-spacing"),b=f.get("text-padding")*t.tilePixelRatio,w=function(e,t,i,r=1){const n=e.get("icon-padding").evaluate(t,{},i),o=n&&n.values;return[o[0]*r,o[1]*r,o[2]*r,o[3]*r]}(f,i,h,t.tilePixelRatio),T=f.get("text-max-angle")/180*Math.PI,B="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),C="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),S=f.get("symbol-placement"),M=x/2,I=f.get("icon-text-fit");let P;n&&"none"!==I&&(t.allowVerticalPlacement&&r.vertical&&(P=bu(n,r.vertical,I,f.get("icon-text-fit-padding"),A,g)),m&&(n=bu(n,m,I,f.get("icon-text-fit-padding"),A,g)));const L=h?d.line.getGranularityForZoomLevel(h.z):1,F=(l,d)=>{d.x<0||d.x>=E||d.y<0||d.y>=E||function(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B){const C=t.addToLineVertexArray(i,r);let S,E,M,I,P=0,L=0,F=0,k=0,z=-1,R=-1;const D={};let O=Gs("");if(t.allowVerticalPlacement&&n.vertical){const e=l.layout.get("text-rotate").evaluate(x,{},T)+90;M=new Fh(c,i,u,h,d,n.vertical,p,f,A,e),a&&(I=new Fh(c,i,u,h,d,a,g,_,A,e))}if(o){const r=l.layout.get("icon-rotate").evaluate(x,{}),n="none"!==l.layout.get("icon-text-fit"),s=Eh(o,r,w,n),p=a?Eh(a,r,w,n):void 0;E=new Fh(c,i,u,h,d,o,g,_,!1,r),P=4*s.length;const f=t.iconSizeData;let A=null;"source"===f.kind?(A=[Tu*l.layout.get("icon-size").evaluate(x,{})],A[0]>Bu&&V(`${t.layerIds[0]}: Value for "icon-size" is >= ${wu}. Reduce your "icon-size".`)):"composite"===f.kind&&(A=[Tu*b.compositeIconSizes[0].evaluate(x,{},T),Tu*b.compositeIconSizes[1].evaluate(x,{},T)],(A[0]>Bu||A[1]>Bu)&&V(`${t.layerIds[0]}: Value for "icon-size" is >= ${wu}. Reduce your "icon-size".`)),t.addSymbols(t.icon,s,A,v,y,x,e.al.none,i,C.lineStartIndex,C.lineLength,-1,T),z=t.icon.placedSymbolArray.length-1,p&&(L=4*p.length,t.addSymbols(t.icon,p,A,v,y,x,e.al.vertical,i,C.lineStartIndex,C.lineLength,-1,T),R=t.icon.placedSymbolArray.length-1)}const U=Object.keys(n.horizontal);for(const r of U){const o=n.horizontal[r];if(!S){O=Gs(o.text);const e=l.layout.get("text-rotate").evaluate(x,{},T);S=new Fh(c,i,u,h,d,o,p,f,A,e)}const a=1===o.positionedLines.length;if(F+=Gh(t,i,o,s,l,A,x,m,C,n.vertical?e.al.horizontal:e.al.horizontalOnly,a?U:[r],D,z,b,T),a)break}n.vertical&&(k+=Gh(t,i,n.vertical,s,l,A,x,m,C,e.al.vertical,["vertical"],D,R,b,T));const N=S?S.boxStartIndex:t.collisionBoxArray.length,Q=S?S.boxEndIndex:t.collisionBoxArray.length,j=M?M.boxStartIndex:t.collisionBoxArray.length,H=M?M.boxEndIndex:t.collisionBoxArray.length,G=E?E.boxStartIndex:t.collisionBoxArray.length,$=E?E.boxEndIndex:t.collisionBoxArray.length,Z=I?I.boxStartIndex:t.collisionBoxArray.length,q=I?I.boxEndIndex:t.collisionBoxArray.length;let K=-1;const W=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;K=W(S,K),K=W(M,K),K=W(E,K),K=W(I,K);const X=K>-1?1:0;X&&(K*=B/Uc),t.glyphOffsetArray.length>=zu.MAX_GLYPHS&&V("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);const Y=jh(l,x,T),[J,ee]=function(t,i){const r=t.length,n=null==i?void 0:i.values;if((null==n?void 0:n.length)>0)for(let i=0;i=0?D.right:-1,D.center>=0?D.center:-1,D.left>=0?D.left:-1,D.vertical||-1,z,R,O,N,Q,j,H,G,$,Z,q,u,F,k,P,L,X,0,p,K,J,ee)}(t,d,l,r,n,o,P,t.layers[0],t.collisionBoxArray,i.index,i.sourceLayerIndex,t.index,_,[b,b,b,b],B,c,v,w,C,A,i,s,u,h,a)};if("line"===S)for(const e of _h(i.geometry,0,0,E,E)){const i=Ll(e,L),o=Bh(i,x,T,r.vertical||m,n,24,y,t.overscaling,E);for(const e of o)m&&Zh(t,m.text,M,e)||F(i,e)}else if("line-center"===S){for(const e of i.geometry)if(e.length>1){const t=Ll(e,L),i=Th(t,T,r.vertical||m,n,24,y);i&&F(t,i)}}else if("Polygon"===i.type)for(const e of Gi(i.geometry,0)){const t=zh(e,16);F(Ll(e[0],L,!0),new yh(t.x,t.y,0))}else if("LineString"===i.type)for(const e of i.geometry){const t=Ll(e,L);F(t,new yh(t[0].x,t[0].y,0))}else if("Point"===i.type)for(const e of i.geometry)for(const t of e)F([t],new yh(t.x,t.y,0))}function Gh(e,t,i,r,n,o,s,a,c,u,h,d,p,f,A){const m=function(e,t,i,r,n,o,s,a){const c=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(const e of t.positionedLines)for(const r of e.positionedGlyphs){if(!r.rect)continue;const o=r.rect||{};let h=qc+1,d=!0,p=1,f=0;const A=(n||a)&&r.vertical,m=r.metrics.advance*r.scale/2;if(a&&t.verticalizable&&(f=e.lineOffset/2-(r.imageName?-(Uc-r.metrics.width*r.scale)/2:(r.scale-1)*Uc)),r.imageName){const e=s[r.imageName];d=e.sdf,p=e.pixelRatio,h=Wc/p}const g=n?[r.x+m,r.y]:[0,0];let _=n?[0,0]:[r.x+m+i[0],r.y+i[1]-f],y=[0,0];A&&(y=_,_=[0,0]);const v=r.metrics.isDoubleResolution?2:1,x=(r.metrics.left-h)*r.scale-m+_[0],b=(-r.metrics.top-h)*r.scale+_[1],w=x+o.w/v*r.scale/p,T=b+o.h/v*r.scale/p,B=new l(x,b),C=new l(w,b),S=new l(x,T),E=new l(w,T);if(A){const e=new l(-m,m-eu),t=-Math.PI/2,i=Uc/2-m,n=new l(5-eu-i,-(r.imageName?i:0)),o=new l(...y);B._rotateAround(t,e)._add(n)._add(o),C._rotateAround(t,e)._add(n)._add(o),S._rotateAround(t,e)._add(n)._add(o),E._rotateAround(t,e)._add(n)._add(o)}if(c){const e=Math.sin(c),t=Math.cos(c),i=[t,-e,e,t];B._matMult(i),C._matMult(i),S._matMult(i),E._matMult(i)}const M=new l(0,0),I=new l(0,0);u.push({tl:B,tr:C,bl:S,br:E,tex:o,writingMode:t.writingMode,glyphOffset:g,sectionIndex:r.sectionIndex,isSDF:d,pixelOffsetTL:M,pixelOffsetBR:I,minFontScaleX:0,minFontScaleY:0})}return u}(0,i,a,n,o,s,r,e.allowVerticalPlacement),g=e.textSizeData;let _=null;"source"===g.kind?(_=[Tu*n.layout.get("text-size").evaluate(s,{})],_[0]>Bu&&V(`${e.layerIds[0]}: Value for "text-size" is >= ${wu}. Reduce your "text-size".`)):"composite"===g.kind&&(_=[Tu*f.compositeTextSizes[0].evaluate(s,{},A),Tu*f.compositeTextSizes[1].evaluate(s,{},A)],(_[0]>Bu||_[1]>Bu)&&V(`${e.layerIds[0]}: Value for "text-size" is >= ${wu}. Reduce your "text-size".`)),e.addSymbols(e.text,m,_,a,o,s,u,t,c.lineStartIndex,c.lineLength,p,A);for(const t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*m.length}function $h(e){for(const t in e)return e[t];return null}function Zh(e,t,i,r){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=qh[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new Kh(s,o,n,e)}constructor(e,t=64,i=Float64Array,r){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=qh.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Wh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:s}=this,a=[0,n.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=s){for(let s=h;s<=u;s++){const a=o[2*s],c=o[2*s+1];a>=e&&a<=i&&c>=t&&c<=r&&l.push(n[s])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=i&&f>=t&&f<=r&&l.push(n[d]),(0===c?e<=p:t<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?i>=p:r>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,s=[0,r.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=o){for(let i=h;i<=u;i++)ed(n[2*i],n[2*i+1],e,t)<=l&&a.push(r[i]);continue}const d=h+u>>1,p=n[2*d],f=n[2*d+1];ed(p,f,e,t)<=l&&a.push(r[d]),(0===c?e-i<=p:t-i<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?e+i>=p:t+i>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return a}}function Wh(e,t,i,r,n,o){if(n-r<=i)return;const s=r+n>>1;Xh(e,t,s,r,n,o),Wh(e,t,i,r,s-1,1-o),Wh(e,t,i,s+1,n,1-o)}function Xh(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const s=n-r+1,a=i-r+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);Xh(e,t,i,Math.max(r,Math.floor(i-a*c/s+u)),Math.min(n,Math.floor(i+(s-a)*c/s+u)),o)}const s=t[2*i+o];let a=r,l=n;for(Yh(e,t,r,i),t[2*n+o]>s&&Yh(e,t,r,n);as;)l--}t[2*r+o]===s?Yh(e,t,r,l):(l++,Yh(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Yh(e,t,i,r){Jh(e,i,r),Jh(t,2*i,2*r),Jh(t,2*i+1,2*r+1)}function Jh(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function ed(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}var td;e.cm=void 0,(td=e.cm||(e.cm={})).create="create",td.load="load",td.fullLoad="fullLoad";let id=null,rd=[];const nd=1e3/60,od="loadTime",sd="fullLoadTime",ad={mark(e){performance.mark(e)},frame(e){const t=e;null!=id&&rd.push(t-id),id=t},clearMetrics(){id=null,rd=[],performance.clearMeasures(od),performance.clearMeasures(sd);for(const t in e.cm)performance.clearMarks(e.cm[t])},getPerformanceMetrics(){performance.measure(od,e.cm.create,e.cm.load),performance.measure(sd,e.cm.create,e.cm.fullLoad);const t=performance.getEntriesByName(od)[0].duration,i=performance.getEntriesByName(sd)[0].duration,r=rd.length,n=1/(rd.reduce(((e,t)=>e+t),0)/r/1e3),o=rd.filter((e=>e>nd)).reduce(((e,t)=>e+(t-nd)/nd),0);return{loadTime:t,fullLoadTime:i,fps:n,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};e.$=oh,e.A=m,e.B=si,e.C=mo,e.D=Bo,e.E=Ae,e.F=jn,e.G=function(e){if(null==$){const t=e.navigator?e.navigator.userAgent:null;$=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return $},e.H=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new qu((()=>this.process())),this.subscription=Y(this.target,"message",(e=>this.receive(e)),!1),this.globalScope=G(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise(((i,r)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=t?Y(t.signal,"abort",(()=>{null==o||o.unsubscribe(),delete this.resolveRejects[n];const t={id:n,type:"",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)}),Ku):null;this.resolveRejects[n]={resolve:e=>{null==o||o.unsubscribe(),i(e)},reject:e=>{null==o||o.unsubscribe(),r(e)}};const s=[],a=Object.assign(Object.assign({},e),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Yn(e.data,s)});this.target.postMessage(a,{transfer:s})}))}receive(e){const t=e.data,i=t.id;if(!("file://"!==t.origin&&"file://"!==location.origin&&"resource://android"!==t.origin&&"resource://android"!==location.origin&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(""===t.type){delete this.tasks[i];const e=this.abortControllers[i];return delete this.abortControllers[i],void(e&&e.abort())}if(G(self)||t.mustQueue)return this.tasks[i]=t,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,t)}}process(){if(0===this.taskQueue.length)return;const e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,i){return t(this,void 0,void 0,(function*(){if(""===i.type){const t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;return void(i.error?t.reject(Jn(i.error)):t.resolve(Jn(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(e,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const t=Jn(i.data),r=new AbortController;this.abortControllers[e]=r;try{const n=yield this.messageHandlers[i.type](i.sourceMapId,t,r);this.completeTask(e,null,n)}catch(t){this.completeTask(e,t)}}))}completeTask(e,t,i){const r=[];delete this.abortControllers[e];const n={id:e,type:"",sourceMapId:this.mapId,origin:location.origin,error:t?Yn(t):null,data:Yn(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.I=Xc,e.J=se,e.K=function(){var e=new m(16);return m!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.L=function(e,t,i){var r,n,o,s,a,l,c,u,h,d,p,f,A=i[0],m=i[1],g=i[2];return t===e?(e[12]=t[0]*A+t[4]*m+t[8]*g+t[12],e[13]=t[1]*A+t[5]*m+t[9]*g+t[13],e[14]=t[2]*A+t[6]*m+t[10]*g+t[14],e[15]=t[3]*A+t[7]*m+t[11]*g+t[15]):(n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=r*A+a*m+h*g+t[12],e[13]=n*A+l*m+d*g+t[13],e[14]=o*A+c*m+p*g+t[14],e[15]=s*A+u*m+f*g+t[15]),e},e.M=function(e,t,i){var r=i[0],n=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.N=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],A=t[12],m=t[13],g=t[14],_=t[15],y=i[0],v=i[1],x=i[2],b=i[3];return e[0]=y*r+v*a+x*h+b*A,e[1]=y*n+v*l+x*d+b*m,e[2]=y*o+v*c+x*p+b*g,e[3]=y*s+v*u+x*f+b*_,e[4]=(y=i[4])*r+(v=i[5])*a+(x=i[6])*h+(b=i[7])*A,e[5]=y*n+v*l+x*d+b*m,e[6]=y*o+v*c+x*p+b*g,e[7]=y*s+v*u+x*f+b*_,e[8]=(y=i[8])*r+(v=i[9])*a+(x=i[10])*h+(b=i[11])*A,e[9]=y*n+v*l+x*d+b*m,e[10]=y*o+v*c+x*p+b*g,e[11]=y*s+v*u+x*f+b*_,e[12]=(y=i[12])*r+(v=i[13])*a+(x=i[14])*h+(b=i[15])*A,e[13]=y*n+v*l+x*d+b*m,e[14]=y*o+v*c+x*p+b*g,e[15]=y*s+v*u+x*f+b*_,e},e.O=function(e,t){const i={};for(let r=0;r{const t=window.document.createElement("video");return t.muted=!0,new Promise((i=>{t.onloadstart=()=>{i(t)};for(const i of e){const e=window.document.createElement("source");ue(i)||(t.crossOrigin="Anonymous"),e.src=i,t.appendChild(e)}}))},e.a3=Ee,e.a4=function(){return O++},e.a5=ls,e.a6=zu,e.a7=en,e.a8=fa,e.a9=ph,e.aA=function(e,t,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];const o=n?"map"===r?-e.bearingInRadians:0:"viewport"===r?e.bearingInRadians:0;if(o){const e=Math.sin(o),t=Math.cos(o);i=[i[0]*t-i[1]*e,i[0]*e+i[1]*t]}return[n?i[0]:M(t,i[0],e.zoom),n?i[1]:M(t,i[1],e.zoom)]},e.aC=Su,e.aD=Vh,e.aE=pu,e.aF=Kh,e.aG=Ro,e.aH=Sl,e.aI=ys,e.aJ=zs,e.aK=Ps,e.aL=R,e.aM=J,e.aN=nh,e.aO=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e},e.aP=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e},e.aQ=function(e){var t=new m(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.aR=function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e},e.aS=function(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e},e.aT=function(e,t){var i=t[0],r=t[1],n=t[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e},e.aU=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[0],a=i[1],l=i[2];return e[0]=n*l-o*a,e[1]=o*s-r*l,e[2]=r*a-n*s,e},e.aV=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.aW=lh,e.aX=uh,e.aY=function(e,t,i,r,n){var o,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+r)*(o=1/(r-n)),e[14]=2*n*r*o):(e[10]=-1,e[14]=-2*r),e},e.aZ=function(e){var t=new m(16);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},e.a_=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];return t!==e&&(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[0]=o*n+c*r,e[1]=s*n+u*r,e[2]=a*n+h*r,e[3]=l*n+d*r,e[4]=c*n-o*r,e[5]=u*n-s*r,e[6]=h*n-a*r,e[7]=d*n-l*r,e},e.aa=function(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,i,r,n)=>{const o=r||n;return t[i]=!o||o.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t},e.ab=function(e){return e*Math.PI/180},e.ac=function(e){return Math.pow(2,e)},e.ad=_,e.ae=z,e.af=85.051129,e.ag=ih,e.ah=function(e){return Math.log(e)/Math.LN2},e.ai=function(e){var t=e[0],i=e[1];return t*t+i*i},e.aj=function(e,t){const i=[];for(const r in e)r in t||i.push(r);return i},e.ak=function(e,t){let i=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){const{interpolationType:n,minZoom:o,maxZoom:s}=e,a=n?z(ni.interpolationFactor(n,t,o,s),0,1):0;"camera"===e.kind?r=si.number(e.minSize,e.maxSize,a):i=a}return{uSizeT:i,uSize:r}},e.am=function(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===e.kind?r/Tu:"composite"===e.kind?si.number(r/Tu,n/Tu,i):t},e.an=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],A=t[13],m=t[14],g=t[15],_=i*a-r*s,y=i*l-n*s,v=i*c-o*s,x=r*l-n*a,b=r*c-o*a,w=n*c-o*l,T=u*A-h*f,B=u*m-d*f,C=u*g-p*f,S=h*m-d*A,E=h*g-p*A,M=d*g-p*m,I=_*M-y*E+v*S+x*C-b*B+w*T;return I?(e[0]=(a*M-l*E+c*S)*(I=1/I),e[1]=(n*E-r*M-o*S)*I,e[2]=(A*w-m*b+g*x)*I,e[3]=(d*b-h*w-p*x)*I,e[4]=(l*C-s*M-c*B)*I,e[5]=(i*M-n*C+o*B)*I,e[6]=(m*v-f*w-g*y)*I,e[7]=(u*w-d*v+p*y)*I,e[8]=(s*E-a*C+c*T)*I,e[9]=(r*C-i*E-o*T)*I,e[10]=(f*b-A*v+g*_)*I,e[11]=(h*v-u*b-p*_)*I,e[12]=(a*B-s*S-l*T)*I,e[13]=(i*S-r*B+n*T)*I,e[14]=(A*y-f*x-m*_)*I,e[15]=(u*x-h*y+d*_)*I,e):null},e.ao=C,e.ap=function(e){return Math.hypot(e[0],e[1])},e.aq=function(e){return e[0]=0,e[1]=0,e},e.ar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},e.as=Pu,e.at=T,e.au=function(e,t,i,r){const n=t.y-e.y,o=t.x-e.x,s=r.y-i.y,a=r.x-i.x,c=s*o-a*n;if(0===c)return null;const u=(a*(e.y-i.y)-s*(e.x-i.x))/c;return new l(e.x+u*o,e.y+u*n)},e.av=_h,e.aw=_a,e.ax=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return[t,i,r,n]},e.ay=Uc,e.az=M,e.b=Z,e.b$=function(e,t){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=t[0],v=t[1],x=t[2],b=t[3],w=t[4],T=t[5],B=t[6],C=t[7],S=t[8],E=t[9],M=t[10],I=t[11],P=t[12],L=t[13],F=t[14],k=t[15];return Math.abs(i-y)<=A*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-v)<=A*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-x)<=A*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-b)<=A*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(s-w)<=A*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(a-T)<=A*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(l-B)<=A*Math.max(1,Math.abs(l),Math.abs(B))&&Math.abs(c-C)<=A*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(u-S)<=A*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(h-E)<=A*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(d-M)<=A*Math.max(1,Math.abs(d),Math.abs(M))&&Math.abs(p-I)<=A*Math.max(1,Math.abs(p),Math.abs(I))&&Math.abs(f-P)<=A*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(m-L)<=A*Math.max(1,Math.abs(m),Math.abs(L))&&Math.abs(g-F)<=A*Math.max(1,Math.abs(g),Math.abs(F))&&Math.abs(_-k)<=A*Math.max(1,Math.abs(_),Math.abs(k))},e.b0=function(){const e=new Float32Array(16);return _(e),e},e.b1=function(){const e=new Float64Array(16);return _(e),e},e.b2=function(){return new Float64Array(16)},e.b3=function(e,t,i){const r=new Float64Array(4);return function(e,t,i,r){var n=.5*Math.PI/180;t*=n,i*=n,r*=n;var o=Math.sin(t),s=Math.cos(t),a=Math.sin(i),l=Math.cos(i),c=Math.sin(r),u=Math.cos(r);e[0]=o*l*u-s*a*c,e[1]=s*a*u+o*l*c,e[2]=s*l*c-o*a*u,e[3]=s*l*u+o*a*c}(r,e,t-90,i),r},e.b4=function(e,t,i,r){var n,o,s,a,l,c=t[0],u=t[1],h=t[2],d=t[3],p=i[0],f=i[1],m=i[2],g=i[3];return(o=c*p+u*f+h*m+d*g)<0&&(o=-o,p=-p,f=-f,m=-m,g=-g),1-o>A?(n=Math.acos(o),s=Math.sin(n),a=Math.sin((1-r)*n)/s,l=Math.sin(r*n)/s):(a=1-r,l=r),e[0]=a*c+l*p,e[1]=a*u+l*f,e[2]=a*h+l*m,e[3]=a*d+l*g,e},e.b5=function(e){const t=new Float64Array(9);var i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y;h=(n=(r=e)[0])*(l=n+n),d=(o=r[1])*l,f=(s=r[2])*l,A=s*(c=o+o),g=(a=r[3])*l,_=a*c,y=a*(u=s+s),(i=t)[0]=1-(p=o*c)-(m=s*u),i[3]=d-y,i[6]=f+_,i[1]=d+y,i[4]=1-h-m,i[7]=A-g,i[2]=f-_,i[5]=A+g,i[8]=1-h-p;const v=J(-Math.asin(z(t[2],-1,1)));let x,b;return Math.hypot(t[5],t[8])<.001?(x=0,b=-J(Math.atan2(t[3],t[4]))):(x=J(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),b=J(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:x,pitch:v+90,bearing:b}},e.b6=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.b7=vt,e.b8=Xs,e.b9=El,e.bA=function(e){if("custom"===e.type)return new Zu(e);switch(e.type){case"background":return new Vu(e);case"circle":return new za(e);case"fill":return new Nl(e);case"fill-extrusion":return new hc(e);case"heatmap":return new Za(e);case"hillshade":return new Wa(e);case"line":return new Sc(e);case"raster":return new $u(e);case"symbol":return new Nu(e)}},e.bB=Q,e.bC=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!ye(e.version,t.version))return[{command:"setStyle",args:[t]}];ye(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),ye(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ye(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),ye(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),ye(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),ye(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),ye(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),ye(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),ye(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),ye(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),ye(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),ye(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),ye(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});const r={},n=[];!function(e,t,i,r){let n;for(n in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||be(n,i,r));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?ye(e[n],t[n])||("geojson"===e[n].type&&"geojson"===t[n].type&&Te(e,t,n)?ve(i,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):we(n,t,i,r)):xe(n,t,i))}(e.sources,t.sources,n,r);const o=[];e.layers&&e.layers.forEach((e=>{"source"in e&&r[e.source]?i.push({command:"removeLayer",args:[e.id]}):o.push(e)})),i=i.concat(n),function(e,t,i){t=t||[];const r=(e=e||[]).map(Ce),n=t.map(Ce),o=e.reduce(Se,{}),s=t.reduce(Se,{}),a=r.slice(),l=Object.create(null);let c,u,h,d,p;for(let e=0,t=0;ei?n-360:n+360;return Math.abs(n)0?s:-s},e.bt=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bu=Wu,e.bv=function(e,t){const i=I(e,2*Math.PI),r=I(t,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))},e.bw=function(){const e={},t=me.$version;for(const i in me.$root){const r=me.$root[i];if(r.required){let n=null;n="version"===i?t:"array"===r.type?[]:{},null!=n&&(e[i]=n)}}return e},e.bx=eo,e.by=le,e.bz=function(e){e=e.slice();const t=Object.create(null);for(let i=0;i"symbol"===e.type,e.c2=e=>"circle"===e.type,e.c3=e=>"heatmap"===e.type,e.c4=e=>"line"===e.type,e.c5=e=>"fill"===e.type,e.c6=e=>"fill-extrusion"===e.type,e.c7=e=>"hillshade"===e.type,e.c8=e=>"raster"===e.type,e.c9=e=>"background"===e.type,e.cA=tc,e.cB=Vc,e.cC=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return 0===e.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},e.cD=function(e,i,r,n,o){return t(this,void 0,void 0,(function*(){if(f())try{return yield K(e,i,r,n,o)}catch(e){}return function(e,t,i,r,n){const o=e.width,s=e.height;W&&X||(W=new OffscreenCanvas(o,s),X=W.getContext("2d",{willReadFrequently:!0})),W.width=o,W.height=s,X.drawImage(e,0,0,o,s);const a=X.getImageData(t,i,r,n);return X.clearRect(0,0,o,s),a.data}(e,i,r,n,o)}))},e.cE=hh,e.cF=i,e.cG=o,e.cH=ec,e.cI=jc,e.cJ=$r,e.cK=Ao,e.ca=e=>"custom"===e.type,e.cb=F,e.cc=function(e,t,i){const r=S(t.x-i.x,t.y-i.y),n=S(e.x-i.x,e.y-i.y);var o,s;return J(Math.atan2(r[0]*n[1]-r[1]*n[0],(o=r)[0]*(s=n)[0]+o[1]*s[1]))},e.cd=k,e.ce=function(e,t){return te[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)},e.cf=function(e,t){return ee[t]&&"touches"in e},e.cg=function(e){return ee[e]||te[e]},e.ch=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e},e.ci=function(e,t){const{x:i,y:r}=oh.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||i<0||i>=1)},e.cj=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.ck=class extends Uo{},e.cl=ad,e.cn=function(e){return e.message===ie},e.co=ae,e.cp=function(e,t){ne.REGISTERED_PROTOCOLS[e]=t},e.cq=function(e){delete ne.REGISTERED_PROTOCOLS[e]},e.cr=function(e,t){const i={};for(let r=0;re*Uc))}let y=a?"center":r.get("text-justify").evaluate(n,{},t.canonical);const v="point"===r.get("symbol-placement")?r.get("text-max-width").evaluate(n,{},t.canonical)*Uc:1/0,x=()=>{t.bucket.allowVerticalPlacement&&io(o)&&(f.vertical=ru(A,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,m,"left",p,g,e.al.vertical,!0,d,h))};if(!a&&_){const i=new Set;if("auto"===y)for(let e=0;e<_.values.length;e+=2)i.add(Vh(_.values[e]));else i.add(y);let r=!1;for(const n of i)if(!f.horizontal[n])if(r)f.horizontal[n]=f.horizontal[0];else{const i=ru(A,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,"center",n,p,g,e.al.horizontal,!1,d,h);i&&(f.horizontal[n]=i,r=1===i.positionedLines.length)}x()}else{"auto"===y&&(y=Vh(m));const i=ru(A,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,m,y,p,g,e.al.horizontal,!1,d,h);i&&(f.horizontal[y]=i),x(),io(o)&&a&&l&&(f.vertical=ru(A,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,m,y,p,g,e.al.vertical,!1,d,h))}}let _=!1;if(n.icon&&n.icon.name){const e=t.imageMap[n.icon.name];e&&(m=vu(t.imagePositions[n.icon.name],r.get("icon-offset").evaluate(n,{},t.canonical),r.get("icon-anchor").evaluate(n,{},t.canonical)),_=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=_:t.bucket.sdfIcons!==_&&V("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const y=$h(f.horizontal)||f.vertical;t.bucket.iconsInText=!!y&&y.iconsInText,(y||m)&&Hh(t.bucket,n,f,m,t.imageMap,o,d,p,g,_,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cx=xc,e.cy=Rl,e.cz=oc,e.d=ue,e.e=D,e.f=e=>t(void 0,void 0,void 0,(function*(){if(0===e.byteLength)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(e){throw new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),e.g=oe,e.h=e=>new Promise(((t,i)=>{const r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=q}))},r.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const n=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(n):q})),e.i=G,e.j=(e,t)=>ce(D(e,{type:"json"}),t),e.k=fe,e.l=pe,e.m=ce,e.n=(e,t)=>ce(D(e,{type:"arrayBuffer"}),t),e.o=function(e){return new Vc(e).readFields(Gc,[])},e.p=Kc,e.q=Va,e.r=Io,e.s=Y,e.t=Qn,e.u=to,e.v=me,e.w=V,e.x=Gn,e.y=Nn,e.z=function([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(i),y:e*Math.sin(t)*Math.sin(i),z:e*Math.cos(i)}}})),i("worker",["./shared"],(function(e){class t{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,i){for(const i of t){this._layerConfigs[i.id]=i;const t=this._layers[i.id]=e.bA(i);t._featureFilter=e.a7(t.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const e of i)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const r=e.cr(Object.values(this._layerConfigs),this.keyCache);for(const e of r){const t=e.map((e=>this._layers[e.id])),i=t[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const o=i.sourceLayer||"_geojsonTileLayer";let s=n[o];s||(s=n[o]=[]),s.push(t)}}}class i{constructor(t){const i={},r=[];for(const e in t){const n=t[e],o=i[e]={};for(const e in n){const t=n[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(i),o[e]={rect:i,metrics:t.metrics}}}const{w:n,h:o}=e.p(r),s=new e.q({width:n||1,height:o||1});for(const r in t){const n=t[r];for(const t in n){const o=n[+t];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const a=i[r][t].rect;e.q.copy(o.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},o.bitmap)}}this.image=s,this.positions=i}}e.cs("GlyphAtlas",i);class r{constructor(t){this.tileID=new e.Y(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,r,o,s,a){return e._(this,void 0,void 0,(function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.a5;const l=new e.ct(Object.keys(t.layers).sort()),c=new e.cu(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:o,subdivisionGranularity:a},d=r.familiesBySource[this.source];for(const i in d){const r=t.layers[i];if(!r)continue;1===r.version&&e.w(`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 e=0;e=i.maxzoom||"none"!==i.visibility&&(n(t,this.zoom,o),(u[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:s,sourceID:this.source})).populate(a,h,this.tileID.canonical),c.bucketLayerIDs.push(t.map((e=>e.id))))}}const p=e.bF(h.glyphDependencies,(e=>Object.keys(e).map(Number)));this.inFlightDependencies.forEach((e=>null==e?void 0:e.abort())),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){const e=new AbortController;this.inFlightDependencies.push(e),f=s.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}const A=Object.keys(h.iconDependencies);let m=Promise.resolve({});if(A.length){const e=new AbortController;this.inFlightDependencies.push(e),m=s.sendAsync({type:"GI",data:{icons:A,source:this.source,tileID:this.tileID,type:"icons"}},e)}const g=Object.keys(h.patternDependencies);let _=Promise.resolve({});if(g.length){const e=new AbortController;this.inFlightDependencies.push(e),_=s.sendAsync({type:"GI",data:{icons:g,source:this.source,tileID:this.tileID,type:"patterns"}},e)}const[y,v,x]=yield Promise.all([f,m,_]),b=new i(y),w=new e.cv(v,x);for(const t in u){const i=u[t];i instanceof e.a6?(n(i.layers,this.zoom,o),e.cw({bucket:i,glyphMap:y,glyphPositions:b.positions,imageMap:v,imagePositions:w.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:h.subdivisionGranularity})):i.hasPattern&&(i instanceof e.cx||i instanceof e.cy||i instanceof e.cz)&&(n(i.layers,this.zoom,o),i.addFeatures(h,this.tileID.canonical,w.patternPositions))}return this.status="done",{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:b.image,imageAtlas:w,glyphMap:this.returnDependencies?y:null,iconMap:this.returnDependencies?v:null,glyphPositions:this.returnDependencies?b.positions:null}}))}}function n(t,i,r){const n=new e.C(i);for(const e of t)e.recalculate(n,r)}class o{constructor(e,t,i){this.actor=e,this.layerIndex=t,this.availableImages=i,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(t,i){return e._(this,void 0,void 0,(function*(){const r=yield e.n(t.request,i);try{return{vectorTile:new e.cA.VectorTile(new e.cB(r.data)),rawData:r.data,cacheControl:r.cacheControl,expires:r.expires}}catch(e){const i=new Uint8Array(r.data);let n=`Unable to parse the tile at ${t.request.url}, `;throw n+=31===i[0]&&139===i[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${e.message}`,new Error(n)}}))}loadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.uid,n=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.cC(t.request),o=new r(t);this.loading[i]=o;const s=new AbortController;o.abort=s;try{const r=yield this.loadVectorTile(t,s);if(delete this.loading[i],!r)return null;const a=r.rawData,l={};r.expires&&(l.expires=r.expires),r.cacheControl&&(l.cacheControl=r.cacheControl);const c={};if(n){const e=n.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)))}o.vectorTile=r.vectorTile;const u=o.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);this.loaded[i]=o,this.fetching[i]={rawTileData:a,cacheControl:l,resourceTiming:c};try{const t=yield u;return e.e({rawTileData:a.slice(0)},t,l,c)}finally{delete this.fetching[i]}}catch(e){throw delete this.loading[i],o.status="done",this.loaded[i]=o,e}}))}reloadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.uid;if(!this.loaded||!this.loaded[i])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const r=this.loaded[i];if(r.showCollisionBoxes=t.showCollisionBoxes,"parsing"===r.status){const n=yield r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);let o;if(this.fetching[i]){const{rawTileData:t,cacheControl:r,resourceTiming:s}=this.fetching[i];delete this.fetching[i],o=e.e({rawTileData:t.slice(0)},n,r,s)}else o=n;return o}if("done"===r.status&&r.vectorTile)return r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){const e=this.loading,i=t.uid;e&&e[i]&&e[i].abort&&(e[i].abort.abort(),delete e[i])}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid]}))}}class s{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,(function*(){const{uid:i,encoding:r,rawImageData:n,redFactor:o,greenFactor:s,blueFactor:a,baseShift:l}=t,c=n.width+2,u=n.height+2,h=e.b(n)?new e.R({width:c,height:u},yield e.cD(n,-1,-1,c,u)):n,d=new e.cE(i,h,r,o,s,a,l);return this.loaded=this.loaded||{},this.loaded[i]=d,d}))}removeTile(e){const t=this.loaded,i=e.uid;t&&t[i]&&delete t[i]}}var a,l,c=function(){if(l)return a;function e(e,i){if(0!==e.length){t(e[0],i);for(var r=1;r=Math.abs(a)?i-l+a:a-l+i,i=l}i+r>=0!=!!t&&e.reverse()}return l=1,a=function t(i,r){var n,o=i&&i.type;if("FeatureCollection"===o)for(n=0;n>31}function c(e,t){for(var i=e.loadGeometry(),r=e.type,n=0,o=0,s=i.length,c=0;ce},x=Math.fround||(b=new Float32Array(1),e=>(b[0]=+e,b[0]));var b;const w=3,T=5,B=6;class C{constructor(e){this.options=Object.assign(Object.create(v),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let t=0;t=i;e--){const i=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){const e=this.getClusters([i,r,180,o],t),s=this.getClusters([-180,r,n,o],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(M(i),I(o),M(n),I(r)),l=s.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+T]>1?S(l,t,this.clusterProps):this.points[l[t+w]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(t*this.stride>=o.length)throw new Error(r);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=n.within(o[t*this.stride],o[t*this.stride+1],s),l=[];for(const t of a){const i=t*this.stride;o[i+4]===e&&l.push(o[i+T]>1?S(o,i,this.clusterProps):this.points[o[i+w]])}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,i){const r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){const r=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/n,c=(i+1+a)/n,u={features:[]};return this._addTileFeatures(r.range((t-a)/n,l,(t+1+a)/n,c),r.data,t,i,n,u),0===t&&this._addTileFeatures(r.range(1-a/n,l,1,c),r.data,n,i,n,u),t===n-1&&this._addTileFeatures(r.range(0,l,a/n,c),r.data,-1,i,n,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,r,n){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?n+o.point_count<=r?n+=o.point_count:n=this._appendLeaves(e,o.cluster_id,i,r,n):n1;let l,c,u;if(a)l=E(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+w]];l=i.properties;const[r,n]=i.geometry.coordinates;c=M(r),u=I(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(u*n-r))]],tags:l};let d;d=a||this.options.generateId?t[e+w]:this.points[t[e+w]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:r,reduce:n,minPoints:o}=this.options,s=i/(r*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let i=0;it&&(p+=a[i+T])}if(p>d&&p>=o){let e,o=r*d,s=u*d,f=-1;const A=(i/c<<5)+(t+1)+this.points.length;for(const r of h){const l=r*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+T];o+=a[l]*u,s+=a[l+1]*u,a[l+4]=A,n&&(e||(e=this._map(a,i,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(a,l)))}a[i+4]=A,l.push(o/p,s/p,1/0,A,-1,p),n&&l.push(f)}else{for(let e=0;e1)for(const e of h){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+T]>1){const r=this.clusterProps[e[t+B]];return i?Object.assign({},r):r}const r=this.points[e[t+w]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function S(e,t,i){return{type:"Feature",id:e[t+w],properties:E(e,t,i),geometry:{type:"Point",coordinates:[(r=e[t],360*(r-.5)),P(e[t+1])]}};var r}function E(e,t,i){const r=e[t+T],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+B],s=-1===o?{}:Object.assign({},i[o]);return Object.assign(s,{cluster:!0,cluster_id:e[t+w],point_count:r,point_count_abbreviated:n})}function M(e){return e/360+.5}function I(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function P(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function L(e,t,i,r){let n=r;const o=t+(i-t>>1);let s,a=i-t;const l=e[t],c=e[t+1],u=e[i],h=e[i+1];for(let r=t+3;rn)s=r,n=t;else if(t===n){const e=Math.abs(r-o);er&&(s-t>3&&L(e,t,s,r),e[s+2]=n,i-s>3&&L(e,s,i,r))}function F(e,t,i,r,n,o){let s=n-i,a=o-r;if(0!==s||0!==a){const l=((e-i)*s+(t-r)*a)/(s*s+a*a);l>1?(i=n,r=o):l>0&&(i+=s*l,r+=a*l)}return s=e-i,a=t-r,s*s+a*a}function k(e,t,i,r){const n={id:null==e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)z(n,i);else if("Polygon"===t)z(n,i[0]);else if("MultiLineString"===t)for(const e of i)z(n,e);else if("MultiPolygon"===t)for(const e of i)z(n,e[0]);return n}function z(e,t){for(let i=0;i0&&(s+=r?(n*l-a*o)/2:Math.sqrt(Math.pow(a-n,2)+Math.pow(l-o,2))),n=a,o=l}const a=t.length-3;t[2]=1,L(t,0,a,i),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function U(e,t,i,r){for(let n=0;n1?1:i}function j(e,t,i,r,n,o,s,a){if(r/=t,o>=(i/=t)&&s=r)return null;const l=[];for(const t of e){const e=t.geometry;let o=t.type;const s=0===n?t.minX:t.minY,c=0===n?t.maxX:t.maxY;if(s>=i&&c=r)continue;let u=[];if("Point"===o||"MultiPoint"===o)V(e,u,i,r,n);else if("LineString"===o)H(e,u,i,r,n,!1,a.lineMetrics);else if("MultiLineString"===o)$(e,u,i,r,n,!1);else if("Polygon"===o)$(e,u,i,r,n,!0);else if("MultiPolygon"===o)for(const t of e){const e=[];$(t,e,i,r,n,!0),e.length&&u.push(e)}if(u.length){if(a.lineMetrics&&"LineString"===o){for(const e of u)l.push(k(t.id,o,e,t.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===u.length?(o="LineString",u=u[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===u.length?"Point":"MultiPoint"),l.push(k(t.id,o,u,t.tags))}}return l.length?l:null}function V(e,t,i,r,n){for(let o=0;o=i&&s<=r&&Z(t,e[o],e[o+1],e[o+2])}}function H(e,t,i,r,n,o,s){let a=G(e);const l=0===n?q:K;let c,u,h=e.start;for(let d=0;di&&(u=l(a,p,f,m,g,i),s&&(a.start=h+c*u)):_>r?y=i&&(u=l(a,p,f,m,g,i),v=!0),y>r&&_<=r&&(u=l(a,p,f,m,g,r),v=!0),!o&&v&&(s&&(a.end=h+c*u),t.push(a),a=G(e)),s&&(h+=c)}let d=e.length-3;const p=e[d],f=e[d+1],A=0===n?p:f;A>=i&&A<=r&&Z(a,p,f,e[d+2]),d=a.length-3,o&&d>=3&&(a[d]!==a[0]||a[d+1]!==a[1])&&Z(a,a[0],a[1],a[2]),a.length&&t.push(a)}function G(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function $(e,t,i,r,n,o){for(const s of e)H(s,t,i,r,n,o,!1)}function Z(e,t,i,r){e.push(t,i,r)}function q(e,t,i,r,n,o){const s=(o-t)/(r-t);return Z(e,o,i+(n-i)*s,1),s}function K(e,t,i,r,n,o){const s=(o-i)/(n-i);return Z(e,t+(r-t)*s,o,1),s}function W(e,t){const i=[];for(let r=0;r0&&t.size<(n?s:r))return void(i.numPoints+=t.length/3);const a=[];for(let e=0;es)&&(i.numSimplified++,a.push(t[e],t[e+1])),i.numPoints++;n&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t0===t)for(let t=0,i=e.length;t24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let r=0;r1&&console.time("creation"),d=this.tiles[h]=ee(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==n){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(i!==o>>e||r!==s>>e)continue}}if(d.source=null,0===e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,A=.5+p,m=1+p;let g=null,_=null,y=null,v=null,x=j(e,u,i-p,i+A,0,d.minX,d.maxX,l),b=j(e,u,i+f,i+m,0,d.minX,d.maxX,l);e=null,x&&(g=j(x,u,r-p,r+A,1,d.minY,d.maxY,l),_=j(x,u,r+f,r+m,1,d.minY,d.maxY,l),x=null),b&&(y=j(b,u,r-p,r+A,1,d.minY,d.maxY,l),v=j(b,u,r+f,r+m,1,d.minY,d.maxY,l),b=null),c>1&&console.timeEnd("clipping"),a.push(g||[],t+1,2*i,2*r),a.push(_||[],t+1,2*i,2*r+1),a.push(y||[],t+1,2*i+1,2*r),a.push(v||[],t+1,2*i+1,2*r+1)}}getTile(e,t,i){e=+e,t=+t,i=+i;const r=this.options,{extent:n,debug:o}=r;if(e<0||e>24)return null;const s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);let l,c=e,u=t,h=i;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[oe(c,u,h)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,u,h),console.time("drilling down")),this.splitTile(l.source,c,u,h,e,t,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?Y(this.tiles[a],n):null):null}}function oe(e,t,i){return 32*((1<{s.properties=e;const t={};for(const e of a)t[e]=r[e].evaluate(o,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)o.accumulated=e[t],e[t]=n[t].evaluate(o,s)},t}(t)).load((yield this._pendingData).features):(n=yield this._pendingData,new ne(n,t.geojsonVtOptions)),this.loaded={};const i={};if(r){const e=r.finish();e&&(i.resourceTiming={},i.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}return i}catch(t){if(delete this._pendingRequest,e.cn(t))return{abandoned:!0};throw t}var n}))}getData(){return e._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(e){const t=this.loaded;return t&&t[e.uid]?super.reloadTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,i){return e._(this,void 0,void 0,(function*(){let r=yield this.loadGeoJSON(t,i);if(delete this._pendingRequest,"object"!=typeof r)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(u(r,!0),t.filter){const i=e.cJ(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));const n=r.features.filter((e=>i.value.evaluate({zoom:0},e)));r={type:"FeatureCollection",features:n}}return r}))}loadGeoJSON(t,i){return e._(this,void 0,void 0,(function*(){const{promoteId:r}=t;if(t.request){const n=yield e.j(t.request,i);return this._dataUpdateable=ae(n.data,r)?le(n.data,r):void 0,n.data}if("string"==typeof t.data)try{const e=JSON.parse(t.data);return this._dataUpdateable=ae(e,r)?le(e,r):void 0,e}catch(e){throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}if(!t.dataDiff)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${t.source}`);return function(e,t,i){var r,n,o,s;if(t.removeAll&&e.clear(),t.remove)for(const i of t.remove)e.delete(i);if(t.add)for(const r of t.add){const t=se(r,i);null!=t&&e.set(t,r)}if(t.update)for(const i of t.update){let t=e.get(i.id);if(null==t)continue;const a=!i.removeAllProperties&&((null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0||(null===(n=i.addOrUpdateProperties)||void 0===n?void 0:n.length)>0);if((i.newGeometry||i.removeAllProperties||a)&&(t=Object.assign({},t),e.set(i.id,t),a&&(t.properties=Object.assign({},t.properties))),i.newGeometry&&(t.geometry=i.newGeometry),i.removeAllProperties)t.properties={};else if((null===(o=i.removeProperties)||void 0===o?void 0:o.length)>0)for(const e of i.removeProperties)Object.prototype.hasOwnProperty.call(t.properties,e)&&delete t.properties[e];if((null===(s=i.addOrUpdateProperties)||void 0===s?void 0:s.length)>0)for(const{key:e,value:r}of i.addOrUpdateProperties)t.properties[e]=r}}(this._dataUpdateable,t.dataDiff,r),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(t){return e._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}class ue{constructor(t){this.self=t,this.actor=new e.H(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cp,this.self.removeProtocol=e.cq,this.self.registerRTLTextPlugin=t=>{e.cK.setMethods(t)},this.actor.registerMessageHandler("LDT",((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler("RDT",((t,i)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,i.source).removeTile(i)})))),this.actor.registerMessageHandler("GCEZ",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterExpansionZoom(i)})))),this.actor.registerMessageHandler("GCC",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterChildren(i)})))),this.actor.registerMessageHandler("GCL",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterLeaves(i)})))),this.actor.registerMessageHandler("LD",((e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler("GD",((e,t)=>this._getWorkerSource(e,t.type,t.source).getData())),this.actor.registerMessageHandler("LT",((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler("RT",((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler("AT",((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler("RMT",((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler("RS",((t,i)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[t]||!this.workerSources[t][i.type]||!this.workerSources[t][i.type][i.source])return;const e=this.workerSources[t][i.type][i.source];delete this.workerSources[t][i.type][i.source],void 0!==e.removeSource&&e.removeSource(i)})))),this.actor.registerMessageHandler("RM",(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t]})))),this.actor.registerMessageHandler("SR",((t,i)=>e._(this,void 0,void 0,(function*(){this.referrer=i})))),this.actor.registerMessageHandler("SRPS",((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler("IS",((t,i)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(i)})))),this.actor.registerMessageHandler("SI",((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler("UL",((t,i)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(i.layers,i.removedIds)})))),this.actor.registerMessageHandler("SL",((t,i)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(i)}))))}_setImages(t,i){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=i;for(const e in this.workerSources[t]){const r=this.workerSources[t][e];for(const e in r)r[e].availableImages=i}}))}_syncRTLPluginState(t,i){return e._(this,void 0,void 0,(function*(){return yield e.cK.syncState(i,this.self.importScripts)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let i=this.layerIndexes[e];return i||(i=this.layerIndexes[e]=new t),i}_getWorkerSource(e,t,i){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][i]){const r={sendAsync:(t,i)=>(t.targetMapId=e,this.actor.sendAsync(t,i))};switch(t){case"vector":this.workerSources[e][t][i]=new o(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][i]=new ce(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][i]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][i]}_getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new s),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new ue(self)),ue})),i("index",["exports","./shared"],(function(e,t){var i="5.4.0";function r(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let n,o;const s={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(e,i,r){const n=requestAnimationFrame((e=>{o(),i(e)})),{unsubscribe:o}=t.s(e.signal,"abort",(()=>{o(),cancelAnimationFrame(n),r(t.c())}),!1)},frameAsync(e){return new Promise(((t,i)=>{this.frame(e,t,i)}))},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){const t=window.document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0,e.width,e.height),i},resolveURL:e=>(n||(n=document.createElement("a")),n.href=e,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==o&&(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)}};class a{static testProp(e){if(!a.docStyle)return e[0];for(let t=0;t{window.removeEventListener("click",a.suppressClickInternal,!0)}),0)}static getScale(e){const t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,i,r){const n=i.boundingClientRect;return new t.P((r.clientX-n.left)/i.x-e.clientLeft,(r.clientY-n.top)/i.y-e.clientTop)}static mousePos(e,t){const i=a.getScale(e);return a.getPoint(e,i,t)}static touchPos(e,t){const i=[],r=a.getScale(e);for(let n=0;n{c&&p(c),c=null,d=!0},u.onerror=()=>{h=!0,c=null},u.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let i,r,n,o;e.resetRequestQueue=()=>{i=[],r=0,n=0,o={}},e.addThrottleControl=e=>{const t=n++;return o[t]=e,t},e.removeThrottleControl=e=>{delete o[e],a()},e.getImage=(e,r,n=!0)=>new Promise(((o,s)=>{l.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),t.e(e,{type:"image"}),i.push({abortController:r,requestParameters:e,supportImageRefresh:n,state:"queued",onError:e=>{s(e)},onSuccess:e=>{o(e)}}),a()}));const s=e=>t._(this,void 0,void 0,(function*(){e.state="running";const{requestParameters:i,supportImageRefresh:n,onError:o,onSuccess:s,abortController:l}=e,u=!1===n&&!t.i(self)&&!t.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce(((e,t)=>e&&"accept"===t),!0));r++;const h=u?c(i,l):t.m(i,l);try{const i=yield h;delete e.abortController,e.state="completed",i.data instanceof HTMLImageElement||t.b(i.data)?s(i):i.data&&s({data:yield(d=i.data,"function"==typeof createImageBitmap?t.f(d):t.h(d)),cacheControl:i.cacheControl,expires:i.expires})}catch(t){delete e.abortController,o(t)}finally{r--,a()}var d})),a=()=>{const e=(()=>{for(const e of Object.keys(o))if(o[e]())return!0;return!1})()?t.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t0;t++){const e=i.shift();e.abortController.signal.aborted?t--:s(e)}},c=(e,i)=>new Promise(((r,n)=>{const o=new Image,s=e.url,a=e.credentials;a&&"include"===a?o.crossOrigin="use-credentials":(a&&"same-origin"===a||!t.d(s))&&(o.crossOrigin="anonymous"),i.signal.addEventListener("abort",(()=>{o.src="",n(t.c())})),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,r({data:o})},o.onerror=()=>{o.onerror=o.onload=null,i.signal.aborted||n(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."))},o.src=s}))}(f||(f={})),f.resetRequestQueue();class A{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function m(e){const t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){const i=[];for(const{id:r,url:n}of e){const e=`${r}${n}`;-1===i.indexOf(e)&&(i.push(e),t.push({id:r,url:n}))}}return t}function g(e,t,i){try{const r=new URL(e);return r.pathname+=`${t}${i}`,r.toString()}catch(t){throw new Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class _{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,r)}update(e,i,r){const{width:n,height:o}=e,s=!(this.size&&this.size[0]===n&&this.size[1]===o||r),{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=[n,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.b(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,n,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:s}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.b(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,s,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,s,n,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,i){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),e!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function y(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class v extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const e=i.spriteData;i.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}addImage(e,t){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,i){let r=!0;const n=i.data||i.spriteData;return this._validateStretch(i.stretchX,n&&n.width)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,n&&n.height)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let i=0;for(const r of e){if(r[0]{let r=!0;if(!this.isLoaded())for(const t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})}))}_getImagesForIds(e){const i={};for(const r of e){let e=this.getImage(r);e||(this.fire(new t.l("styleimagemissing",{id:r})),e=this.getImage(r)),e?i[r]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.w(`Image "${r}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){const{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){const i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{const i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new t.I(i,r);this.patterns[e]={bin:i,position:n}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new _(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:r}=t.p(e),n=this.atlasImage;n.resize({width:i||1,height:r||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],r=i.x+1,o=i.y+1,s=this.getImage(e).data,a=s.width,l=s.height;t.R.copy(s,n,{x:0,y:0},{x:r,y:o},{width:a,height:l}),t.R.copy(s,n,{x:0,y:l-1},{x:r,y:o-1},{width:a,height:1}),t.R.copy(s,n,{x:0,y:0},{x:r,y:o+l},{width:a,height:1}),t.R.copy(s,n,{x:a-1,y:0},{x:r-1,y:o},{width:1,height:l}),t.R.copy(s,n,{x:0,y:0},{x:r+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.w(`Image with ID: "${i}" was not found`),y(e)&&this.updateImage(i,e)}}}const x=1e20;function b(e,t,i,r,n,o,s,a,l){for(let c=t;c-1);l++,o[l]=a,s[l]=c,s[l+1]=x}for(let a=0,l=0;a65535)throw new Error("glyphs > 65535 not supported");if(t.ranges[n])return{stack:e,id:i,glyph:r};if(!this.url)throw new Error("glyphsUrl is not set");if(!t.requests[n]){const i=T.loadGlyphRange(e,n,this.url,this.requestManager);t.requests[n]=i}const o=yield t.requests[n];for(const e in o)this._doesCharSupportLocalGlyph(+e)||(t.glyphs[+e]=o[+e]);return t.ranges[n]=!0,{stack:e,id:i,glyph:o[i]||null}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))||t.u["CJK Unified Ideographs"](e)||t.u["Hangul Syllables"](e)||t.u.Hiragana(e)||t.u.Katakana(e)||t.u["CJK Symbols and Punctuation"](e)||t.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,r){const n=this.localIdeographFontFamily;if(!n)return;if(!this._doesCharSupportLocalGlyph(r))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 T.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:t})}const s=o.draw(String.fromCharCode(r));return{id:r,bitmap:new t.q({width:s.width||60,height:s.height||60},s.data),metrics:{width:s.glyphWidth/2||24,height:s.glyphHeight/2||24,left:s.glyphLeft/2+.5||0,top:s.glyphTop/2-27.5||-8,advance:s.glyphAdvance/2||24,isDoubleResolution:!0}}}}T.loadGlyphRange=function(e,i,r,n){return t._(this,void 0,void 0,(function*(){const o=256*i,s=o+255,a=n.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${o}-${s}`),"Glyphs"),l=yield t.n(a,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${i}, ${o}-${s}`);const c={};for(const e of t.o(l.data))c[e.id]=e;return c}))},T.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=r,this.radius=i;const a=this.size=e+4*t,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${o} ${e}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,s+Math.ceil(r)),c=a+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return p;const{ctx:f,buffer:A,gridInner:m,gridOuter:g}=this;f.clearRect(A,A,a,l),f.fillText(e,A,A+s);const _=f.getImageData(A,A,a,l);g.fill(x,0,h),m.fill(0,0,h);for(let e=0;e0?e*e:0,m[r]=e<0?e*e:0}}b(g,0,0,c,u,c,this.f,this.v,this.z),b(m,A,A,a,l,c,this.f,this.v,this.z);for(let e=0;e1&&(s=e[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),u=Math.min(l,c);let h;const d=t/i*(r+1);if(s.isDash){const e=r-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=r-Math.sqrt(u*u+d*d);this.data[n+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){const i=e[t],r=e[t+1];i.zeroLength?e.splice(t,1):r&&r.isDash===i.isDash&&(r.left=i.left,e.splice(t,1))}const t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);const r=this.width*this.nextRow;let n=0,o=e[n];for(let t=0;t1&&(o=e[++n]);const i=Math.abs(t-o.left),s=Math.abs(t-o.right),a=Math.min(i,s);this.data[r+t]=Math.max(0,Math.min(255,(o.isDash?a:-a)+128))}}addDash(e,i){const r=i?7:0,n=2*r+1;if(this.nextRow+n>this.height)return t.w("LineAtlas out of space"),null;let o=0;for(let t=0;t{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[P]}numActive(){return Object.keys(this.active).length}}const F=Math.floor(s.hardwareConcurrency/2);let k,z;function R(){return k||(k=new L),k}L.workerCount=t.G(globalThis)?Math.max(Math.min(F,3),1):1;class D{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let e=0;e{e.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(const i of this.actors)i.registerMessageHandler(e,t)}}function O(){return z||(z=new D(R(),t.J),z.registerMessageHandler("GR",((e,i,r)=>t.m(i,r)))),z}function U(e,i){const r=t.K();return t.L(r,r,[1,1,0]),t.M(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.N(r,r,e.calculatePosMatrix(i.toUnwrapped())):r}function N(e,t,i,r,n,o,s){var a;const l=function(e,t,i){if(e)for(const r of e){const e=t[r];if(e&&e.source===i&&"fill-extrusion"===e.type)return!0}else for(const e in t){const r=t[e];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(null!==(a=null==n?void 0:n.layers)&&void 0!==a?a:null,t,e.id),c=o.maxPitchScaleFactor(),u=e.tilesIn(r,c,l);u.sort(Q);const h=[];for(const r of u)h.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,i,e._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,n,o,c,U(e.transform,r.tileID),s?(e,t)=>s(r.tileID,e,t):void 0)});return function(e,t){for(const i in e)for(const r of e[i])j(r,t);return e}(function(e){const t={},i={};for(const r of e){const e=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in e){const r=e[i],n=o[i]=o[i]||{},s=t[i]=t[i]||[];for(const e of r)n[e.featureIndex]||(n[e.featureIndex]=!0,s.push(e))}}return t}(h),e)}function Q(e,t){const i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function j(e,t){const i=e.feature,r=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=r}function V(e,i,r){return t._(this,void 0,void 0,(function*(){let n=e;if(e.url?n=(yield t.j(i.transformRequest(e.url,"Source"),r)).data:yield s.frameAsync(r),!n)return null;const o=t.O(t.e(n,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(o.vectorLayerIds=n.vector_layers.map((e=>e.id))),o}))}class H{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.Q?new t.Q(e.lng,e.lat):t.Q.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.Q?new t.Q(e.lng,e.lat):t.Q.convert(e),this}extend(e){const i=this._sw,r=this._ne;let n,o;if(e instanceof t.Q)n=e,o=e;else{if(!(e instanceof H))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(H.convert(e)):this.extend(t.Q.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.Q.convert(e)):this;if(n=e._sw,o=e._ne,!n||!o)return this}return i||r?(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(o.lng,r.lng),r.lat=Math.max(o.lat,r.lat)):(this._sw=new t.Q(n.lng,n.lat),this._ne=new t.Q(o.lng,o.lat)),this}getCenter(){return new t.Q((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.Q(this.getWest(),this.getNorth())}getSouthEast(){return new t.Q(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:r}=t.Q.convert(e);let n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(e){return e instanceof H?e:e?new H(e):e}static fromLngLat(e,i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*e.lat);return new H(new t.Q(e.lng-n,e.lat-r),new t.Q(e.lng+n,e.lat+r))}adjustAntiMeridian(){const e=new t.Q(this._sw.lng,this._sw.lat),i=new t.Q(this._ne.lng,this._ne.lat);return new H(e,e.lng>i.lng?new t.Q(i.lng+360,i.lat):i)}}class G{constructor(e,t,i){this.bounds=H.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),r=Math.floor(t.U(this.bounds.getWest())*i),n=Math.floor(t.S(this.bounds.getNorth())*i),o=Math.ceil(t.U(this.bounds.getEast())*i),s=Math.ceil(t.S(this.bounds.getSouth())*i);return e.x>=r&&e.x=n&&e.y{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise(((t,i)=>{e.reloadPromise={resolve:t,reject:i}}))}else e.actor=this.dispatcher.getActor(),r="LT";e.abortController=new AbortController;try{const t=yield e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t)}catch(t){if(delete e.abortController,e.aborted)return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}}))}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){const t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Z extends t.E{constructor(e,i,r,n){super(),this.id=e,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.e({type:"raster"},i),t.e(this,t.O(i,["url","scheme","tileSize"]))}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield V(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new G(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this.fire(new t.k(e))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const i=yield f.getImage(this.map._requestManager.transformRequest(t,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const t=this.map.painter.context,r=t.gl,n=i.data;e.texture=this.map.painter.getTileTexture(n.width),e.texture?e.texture.update(n,{useMipmap:!0}):(e.texture=new _(t,n,r.RGBA,{useMipmap:!0}),e.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class q extends Z{constructor(e,i,r,n){super(e,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const i=yield f.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i&&i.data){const r=i.data;this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const n=t.b(r)&&t.V()?r:yield this.readImageNow(r),o={type:this.type,uid:e.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||"expired"===e.state){e.actor=this.dispatcher.getActor();const t=yield e.actor.sendAsync({type:"LDT",data:o});e.dem=t,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}))}readImageNow(e){return t._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&t.W()){const i=e.width+2,r=e.height+2;try{return new t.R({width:i,height:r},yield t.X(e,-1,-1,i,r))}catch(e){}}return s.getImageData(e,1)}))}_getNeighboringTiles(e){const i=e.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?e.wrap-1:e.wrap,s=(i.x+1+r)%r,a=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.Y(e.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new t.Y(e.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new t.Y(e.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new t.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.Y(e.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1e.coordinates)).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return t._(this,void 0,void 0,(function*(){const e=new H,t=yield this.getData();let i;switch(t.type){case"FeatureCollection":i=t.features.map((e=>this.getCoordinatesFromGeometry(e.geometry))).flat(1/0);break;case"Feature":i=this.getCoordinatesFromGeometry(t.geometry);break;default:i=this.getCoordinatesFromGeometry(t)}if(0==i.length)return e;for(let t=0;t0&&t.e(n,{resourceTiming:r}),this.fire(new t.l("data",Object.assign(Object.assign({},n),{sourceDataType:"metadata"}))),this.fire(new t.l("data",Object.assign(Object.assign({},n),{sourceDataType:"content"})))}catch(e){if(this._pendingLoads--,this._removed)return void this.fire(new t.l("dataabort",{dataType:"source"}));this.fire(new t.k(e))}}))}loaded(){return 0===this._pendingLoads}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.actor?"RT":"LT";e.actor=this.actor;const i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const r=yield this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,"RT"===t)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return t.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class W extends t.E{constructor(e,t,i,r){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}load(e){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const t=yield f.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,this.fire(new t.k(e))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(t.$.fromLngLat);var r;return this.tileID=function(e){let i=1/0,r=1/0,n=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),r=Math.min(r,t.y),n=Math.max(n,t.x),o=Math.max(o,t.y);const s=Math.max(n-i,o-r),a=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),l=Math.pow(2,a);return new t.a1(a,Math.floor((i+n)/2*l),Math.floor((r+o)/2*l))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map((e=>this.tileID.getTilePoint(e)._round())),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new t.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new _(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let i=1/0,r=1/0,n=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),r=Math.min(r,t.y),n=Math.max(n,t.x),o=Math.max(o,t.y);const s={};for(let e=0;e<=t.a0;e++){const t=Math.pow(2,e),a=Math.floor(i*t),l=Math.floor(r*t),c=Math.floor(n*t),u=Math.floor(o*t);s[e]={minTileX:a,minTileY:l,maxTileX:c,maxTileY:u}}return s}}class X extends W{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{const e=yield t.a2(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.k(e))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;ei.end(0)?this.fire(new t.k(new t.a3(`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(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;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 _(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Y extends W{constructor(e,i,r,n){super(e,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new t.k(new t.a3(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.k(new t.a3(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.k(new t.a3(`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.k(new t.a3(`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.k(new t.a3(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}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,r=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new _(i,this.canvas,r.RGBA,{premultiply:!0});let n=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,n=!0)}n&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const J={},ee=e=>{switch(e){case"geojson":return K;case"image":return W;case"raster":return Z;case"raster-dem":return q;case"vector":return $;case"video":return X;case"canvas":return Y}return J[e]},te="RTLPluginLoaded";class ie extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=O()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((e=>{throw this.status="error",e}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,(function*(e,t=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=s.resolveURL(e),!this.url)throw new Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}))}_requestImport(){return t._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new t.l(te))}))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let re=null;function ne(){return re||(re=new ie),re}class oe{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const t=e+this.timeAdded;tt.getLayer(e))).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.id]=r}}return i}(e.buckets,null==i?void 0:i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.a6){if(this.hasSymbolBuckets=!0,!r)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.a6&&i.hasRTLText){this.hasRTLText=!0,ne().lazyLoad();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const i=this.buckets[t];i.uploadPending()&&i.upload(e)}const t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new _(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new _(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,n,o,s,a,l,c,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:a,params:s,queryPadding:this.queryPadding*l,getElevation:u},e,t,i):{}}querySourceFeatures(e,i){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),o=i&&i.sourceLayer?i.sourceLayer:"",s=n._geojsonTileLayer||n[o];if(!s)return;const a=t.a7(i&&i.filter),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let i=0;ie)t=!1;else if(i)if(this.expirationTime{this.remove(e,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const r of this.data[i])e(r.value)||t.push(r);for(const e of t)this.remove(e.value.tileID,e)}}class ae{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,r){const n=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},t.e(this.stateChanges[e][n],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==n&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][n]){this.deletedStates[e][n]={};for(const t in this.state[e][n])r[t]||(this.deletedStates[e][n][t]=null)}else for(const t in r)this.deletedStates[e]&&this.deletedStates[e][n]&&null===this.deletedStates[e][n][t]&&delete this.deletedStates[e][n][t]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,i){const r=String(i),n=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return{};for(const e in t)delete n[e]}return n}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,i){const r={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),i[r]=this.state[e][r];r[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]}r[e]=r[e]||{},t.e(r[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const t in e)e[t].setFeatureState(r,i)}}const le=89.25;function ce(e,i){const r=t.ae(i.lat,-85.051129,t.af);return new t.P(t.U(i.lng)*e,t.S(r)*e)}function ue(e,i){return new t.$(i.x/e,i.y/e).toLngLat()}function he(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.ab(90-e.pitch)),Math.tan(t.ab(le-e.pitch)))}function de(e,i){const r=e.canonical,n=i/t.ac(r.z),o=r.x+Math.pow(2,r.z)*e.wrap,s=t.ad(new Float64Array(16));return t.L(s,s,[o*n,r.y*n,0]),t.M(s,s,[n/t.Z,n/t.Z,1]),s}function pe(e,i,r,n,o){const s=t.$.fromLngLat(e,i),a=o*t.ag(1,e.lat),l=a*Math.cos(t.ab(r)),c=Math.sqrt(a*a-l*l),u=c*Math.sin(t.ab(-n)),h=c*Math.cos(t.ab(-n));return new t.$(s.x+u,s.y+h,s.z+l)}function fe(e,t,i){const r=t.intersectsFrustum(e);if(!i)return r;const n=t.intersectsPlane(i);return 0===r||0===n?0:2===r&&2===n?2:1}function Ae(e,t,i){let r=0;const n=(i-t)/10;for(let o=0;o<10;o++)r+=n*Math.pow(Math.cos(t+(o+.5)/10*(i-t)),e);return r}function me(e,i){return function(r,n,o,s,a){const l=2*((e-1)/t.ah(Math.cos(t.ab(le-a))/Math.cos(t.ab(le)))-1),c=Math.acos(o/s),u=2*Ae(l-1,0,t.ab(a/2)),h=Math.min(t.ab(le),c+t.ab(a/2)),d=Ae(l-1,Math.min(h,c-t.ab(a/2)),h),p=Math.atan(n/o),f=Math.hypot(n,o);let A=r;return A+=t.ah(s/f/Math.max(.5,Math.cos(t.ab(a/2)))),A+=l*t.ah(Math.cos(p))/2,A-=t.ah(Math.max(1,d/u/i))/2,A}}const ge=me(9.314,3);function _e(e,i){const r=(i.roundZoom?Math.round:Math.floor)(e.zoom+t.ah(e.tileSize/i.tileSize));return Math.max(0,r)}function ye(e,i){const r=e.getCameraFrustum(),n=e.getClippingPlane(),o=e.screenPointToMercatorCoordinate(e.getCameraPoint()),s=t.$.fromLngLat(e.center,e.elevation);o.z=s.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;const a=e.getCoveringTilesDetailsProvider(),l=a.allowVariableZoom(e,i),c=_e(e,i),u=i.minzoom||0,h=void 0!==i.maxzoom?i.maxzoom:e.maxZoom,d=Math.min(Math.max(0,c),h),p=Math.pow(2,d),f=[p*o.x,p*o.y,0],A=[p*s.x,p*s.y,0],m=Math.hypot(s.x-o.x,s.y-o.y),g=Math.abs(s.z-o.z),_=Math.hypot(m,g),y=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),v=[],x=[];if(e.renderWorldCopies&&a.allowWorldCopies())for(let e=1;e<=3;e++)v.push(y(-e)),v.push(y(e));for(v.push(y(0));v.length>0;){const p=v.pop(),m=p.x,y=p.y;let b=p.fullyVisible;const w={x:m,y:y,z:p.zoom},T=a.getTileAABB(w,p.wrap,e.elevation,i);if(!b){const e=fe(r,T,n);if(0===e)continue;b=2===e}const B=a.distanceToTile2d(o.x,o.y,w,T);let C=c;l&&(C=(i.calculateTileZoom||ge)(e.zoom+t.ah(e.tileSize/i.tileSize),B,g,_,e.fov)),C=(i.roundZoom?Math.round:Math.floor)(C),C=Math.max(0,C);const S=Math.min(C,h);if(p.wrap=a.getWrap(s,w,p.wrap),p.zoom>=S){if(p.zoom>1),wrap:p.wrap,fullyVisible:b})}return x.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}class ve extends t.E{constructor(e,t,i){super(),this.id=e,this.dispatcher=i,this.on("data",(e=>this._dataHandler(e))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((e,t,i,r)=>{const n=new(ee(t.type))(e,t,i,r);if(n.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${n.id}`);return n})(e,t,i,this),this._tiles={},this._cache=new se(0,(e=>this._unloadTile(e))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ae,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}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 e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,r){return t._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,r)}catch(i){e.state="errored",404!==i.status?this._source.fire(new t.k(i,{tile:e})):this.update(this.transform,this.terrain)}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(xe).map((e=>e.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 r=e.tileID,n=i.tileID,o=new t.P(r.canonical.x,r.canonical.y)._rotate(-this.transform.bearingInRadians),s=new t.P(n.canonical.x,n.canonical.y)._rotate(-this.transform.bearingInRadians);return r.overscaledZ-n.overscaledZ||s.y-o.y||s.x-o.x})).map((e=>e.tileID.key)):i.map((e=>e.tileID)).sort(xe).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)(e||"errored"!==this._tiles[t].state)&&this._reloadTile(t,"reloading")}}_reloadTile(e,i){return t._(this,void 0,void 0,(function*(){const t=this._tiles[e];t&&("loading"!==t.state&&(t.state=i),yield this._loadTile(t,e,i))}))}_tileLoaded(e,i,r){e.timeAdded=s.now(),"expired"===r&&(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.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const t=this.getRenderableIds();for(let r=0;r1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>i)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>t+1;){const e=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[e.key],o&&o.hasData()&&(s=e)}let a=s;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]||e[a.canonical.key]){r[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),r=this._getLoadedTile(t);if(r)return r}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,n=Math.floor(i*r*(null===this._maxTileCacheZoomLevels?t.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(o)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}}_updateCoveredAndRetainedTiles(e,t,i,r,n,o){const a={},l={},c=Object.keys(e),u=s.now();for(const i of c){const r=e[i],n=this._tiles[i];if(!n||0!==n.fadeEndTime&&n.fadeEndTime<=u)continue;const o=this.findLoadedParent(r,t),s=this.findLoadedSibling(r),c=o||s||null;c&&(this._addTile(c.tileID),a[c.tileID.key]=c.tileID),l[i]=r}this._retainLoadedChildren(l,r,i,e);for(const t in a)e[t]||(this._coveredTiles[t]=!0,e[t]=a[t]);if(o){const t={},i={};for(const e of n)this._tiles[e.key].hasData()?t[e.key]=e:i[e.key]=e;for(const r in i){const n=i[r].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]=e[n[0].key]=n[0],t[n[1].key]=e[n[1].key]=n[1],t[n[2].key]=e[n[2].key]=n[2],t[n[3].key]=e[n[3].key]=n[3],delete i[r])}for(const r in i){const n=i[r],o=this.findLoadedParent(n,this._source.minzoom),s=this.findLoadedSibling(n),a=o||s||null;if(a){t[a.tileID.key]=e[a.tileID.key]=a.tileID;for(const e in t)t[e].isChildOf(a.tileID)&&delete t[e]}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.Y(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=ye(e,{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,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[];const n=_e(e,this._source),o=Math.max(n-ve.maxOverzooming,this._source.minzoom),s=Math.max(n+ve.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const e={};for(const t of r)if(t.canonical.z>this._source.minzoom){const i=t.scaledTo(t.canonical.z-1);e[i.key]=i;const r=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[r.key]=r}r=r.concat(Object.values(e))}const a=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new t.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(r,n);be(this._source.type)&&this._updateCoveredAndRetainedTiles(l,o,s,n,r,i);for(const e in l)this._tiles[e].clearFadeHold();const c=t.aj(this._tiles,l);for(const e of c){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var i;const r={},n={},o=Math.max(t-ve.maxOverzooming,this._source.minzoom),s=Math.max(t+ve.maxUnderzooming,this._source.minzoom),a={};for(const i of e){const e=this._addTile(i);r[i.key]=i,e.hasData()||tthis._source.maxzoom){const e=s.children(this._source.maxzoom)[0],t=this.getTile(e);if(t&&t.hasData()){r[e.key]=e;continue}}else{const e=s.children(this._source.maxzoom);if(r[e[0].key]&&r[e[1].key]&&r[e[2].key]&&r[e[3].key])continue}let a=e.wasRequested();for(let t=s.overscaledZ-1;t>=o;--t){const o=s.scaledTo(t);if(n[o.key])break;if(n[o.key]=!0,e=this.getTile(o),!e&&a&&(e=this._addTile(o)),e){const t=e.hasData();if((t||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||a)&&(r[o.key]=o),a=e.wasRequested(),t)break}}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;r=e}for(const e of t)this._loadedParentTiles[e]=i}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const t=this._tiles[e].tileID,i=this._getLoadedTile(t);this._loadedSiblingTiles[t.key]=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 r=i;return i||(i=new oe(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,r||this._source.fire(new t.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){const t=e.sourceDataType;"source"===e.dataType&&"metadata"===t&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===t&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,r){const n=[],o=this.transform;if(!o)return n;const s=r?o.getCameraQueryGeometry(e):e,a=e.map((e=>o.screenPointToMercatorCoordinate(e,this.terrain))),l=s.map((e=>o.screenPointToMercatorCoordinate(e,this.terrain))),c=this.getIds();let u=1/0,h=1/0,d=-1/0,p=-1/0;for(const e of l)u=Math.min(u,e.x),h=Math.min(h,e.y),d=Math.max(d,e.x),p=Math.max(p,e.y);for(let e=0;e=0&&m[1].y+A>=0){const e=a.map((e=>s.getTilePoint(e))),t=l.map((e=>s.getTilePoint(e)));n.push({tile:r,tileID:s,queryGeometry:e,cameraQueryGeometry:t,scale:f})}}return n}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));return this.transform&&this.transform.populateCache(t),t}hasTransition(){if(this._source.hasTransition())return!0;if(be(this._source.type)){const e=s.now();for(const t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,i){const r=this._tiles[e];r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(e,t)))}}function xe(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function be(e){return"raster"===e||"image"===e||"video"===e}ve.maxOverzooming=10,ve.maxUnderzooming=3;class we{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e0?(n-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function Te(e,t){let i=!0;return"always"===e||"never"!==e&&"never"!==t||(i=!1),i}class Be{constructor(e,t,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;ethis.width||r<0||t>this.height)return[];const a=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:e,y1:t,x2:i,y2:r}];for(let e=0;e0}hitTestCircle(e,t,i,r,n){const o=e-i,s=e+i,a=t-i,l=t+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:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(e,t,i,r,n,o,s,a){const{seenUids:l,hitTest:c,overlapMode:u}=s,h=this.boxCells[n];if(null!==h){const n=this.bboxes;for(const s of h)if(!l.box[s]){l.box[s]=!0;const h=4*s,d=this.boxKeys[s];if(e<=n[h+2]&&t<=n[h+3]&&i>=n[h+0]&&r>=n[h+1]&&(!a||a(d))&&(!c||!Te(u,d.overlapMode))&&(o.push({key:d,x1:n[h],y1:n[h+1],x2:n[h+2],y2:n[h+3]}),c))return!0}}const d=this.circleCells[n];if(null!==d){const n=this.circles;for(const s of d)if(!l.circle[s]){l.circle[s]=!0;const h=3*s,d=this.circleKeys[s];if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],e,t,i,r)&&(!a||a(d))&&(!c||!Te(u,d.overlapMode))){const e=n[h],t=n[h+1],i=n[h+2];if(o.push({key:d,x1:e-i,y1:t-i,x2:e+i,y2:t+i}),c)return!0}}}return!1}_queryCellCircle(e,t,i,r,n,o,s,a){const{circle:l,seenUids:c,overlapMode:u}=s,h=this.boxCells[n];if(null!==h){const e=this.bboxes;for(const t of h)if(!c.box[t]){c.box[t]=!0;const i=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(r))&&!Te(u,r.overlapMode))return o.push(!0),!0}}const d=this.circleCells[n];if(null!==d){const e=this.circles;for(const t of d)if(!c.circle[t]){c.circle[t]=!0;const i=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(r))&&!Te(u,r.overlapMode))return o.push(!0),!0}}}_forEachCell(e,t,i,r,n,o,s,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(n.call(this,e,t,i,r,this.xCellCount*l+d,o,s,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,n,o){const s=r-e,a=n-t,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(e,t,i,r,n,o,s){const a=(o-r)/2,l=Math.abs(e-(r+a));if(l>a+i)return!1;const c=(s-n)/2,u=Math.abs(t-(n+c));if(u>c+i)return!1;if(l<=a||u<=c)return!0;const h=l-a,d=u-c;return h*h+d*d<=i*i}}function Ce(e,i,n){const o=t.K();if(!e){const{vecSouth:e,vecEast:t}=Ee(i),n=r();n[0]=t[0],n[1]=t[1],n[2]=e[0],n[3]=e[1],s=n,(d=(l=(a=n)[0])*(h=a[3])-(u=a[2])*(c=a[1]))&&(s[0]=h*(d=1/d),s[1]=-c*d,s[2]=-u*d,s[3]=l*d),o[0]=n[0],o[1]=n[1],o[4]=n[2],o[5]=n[3]}var s,a,l,c,u,h,d;return t.M(o,o,[1/n,1/n,1]),o}function Se(e,i,r,n){if(e){const e=t.K();if(!i){const{vecSouth:t,vecEast:i}=Ee(r);e[0]=i[0],e[1]=i[1],e[4]=t[0],e[5]=t[1]}return t.M(e,e,[n,n,1]),e}return r.pixelsToClipSpaceMatrix}function Ee(e){const i=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),n=Math.cos(e.pitchInRadians),o=Math.cos(e.bearingInRadians),s=Math.sin(e.bearingInRadians),a=t.ao();a[0]=-o*n*r-s*i,a[1]=-s*n*r+o*i;const l=t.ap(a);l<1e-9?t.aq(a):t.ar(a,a,1/l);const c=t.ao();c[0]=o*n*i-s*r,c[1]=s*n*i+o*r;const u=t.ap(c);return u<1e-9?t.aq(c):t.ar(c,c,1/u),{vecEast:c,vecSouth:a}}function Me(e,i,r,n){let o;n?(o=[e,i,n(e,i),1],t.at(o,o,r)):(o=[e,i,0,1],$e(o,o,r));const s=o[3];return{point:new t.P(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}function Ie(e,t){return.5+e/t*.5}function Pe(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function Le(e,i,r,n,o,s,a,l,c,u,h,d,p){const f=r?e.textSizeData:e.iconSizeData,A=t.ak(f,i.transform.zoom),m=[256/i.width*2+1,256/i.height*2+1],g=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();const _=e.lineVertexArray,y=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=i.transform.width/i.transform.height;let x=!1;for(let r=0;rMath.abs(r.x-i.x)*n?{useVertical:!0}:(e===t.al.vertical?i.yr.x)?{needsFlipping:!0}:null}function ze(e){const{projectionContext:i,pitchedLabelPlaneMatrixInverse:r,symbol:n,fontSize:o,flip:s,keepUpright:a,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=e,d=o/24,p=n.lineOffsetX*d,f=n.lineOffsetY*d;let A;if(n.numGlyphs>1){const e=n.glyphStartIndex+n.numGlyphs,t=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,c=Fe(d,l,p,f,s,n,h,i);if(!c)return{notEnoughRoom:!0};const m=Ue(c.first.point.x,c.first.point.y,i,r),g=Ue(c.last.point.x,c.last.point.y,i,r);if(a&&!s){const e=ke(n.writingMode,m,g,u);if(e)return e}A=[c.first];for(let r=n.glyphStartIndex+1;r0?a.point:Re(i.tileAnchorPoint,s,e,1,i),c=Ue(e.x,e.y,i,r),h=Ue(l.x,l.y,i,r),d=ke(n.writingMode,c,h,u);if(d)return d}const e=Ve(d*l.getoffsetX(n.glyphStartIndex),p,f,s,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,i,h);if(!e||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};A=[e]}for(const e of A)t.as(c,e.point,e.angle);return{}}function Re(e,t,i,r,n){const o=e.add(e.sub(t)._unit()),s=Oe(o.x,o.y,n).point,a=i.sub(s);return i.add(a._mult(r/a.mag()))}function De(e,i,r){const n=i.projectionCache;if(n.projections[e])return n.projections[e];const o=new t.P(i.lineVertexArray.getx(e),i.lineVertexArray.gety(e)),s=Oe(o.x,o.y,i);if(s.signedDistanceFromCamera>0)return n.projections[e]=s.point,n.anyProjectionOccluded=n.anyProjectionOccluded||s.isOccluded,s.point;const a=e-r.direction;return Re(0===r.distanceFromAnchor?i.tileAnchorPoint:new t.P(i.lineVertexArray.getx(a),i.lineVertexArray.gety(a)),o,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,i)}function Oe(e,t,i){const r=e+i.translation[0],n=t+i.translation[1];let o;return i.pitchWithMap?(o=Me(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),o.isOccluded=!1):(o=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),o.point.x=(.5*o.point.x+.5)*i.width,o.point.y=(.5*-o.point.y+.5)*i.height),o}function Ue(e,i,r,n){if(r.pitchWithMap){const o=[e,i,0,1];return t.at(o,o,n),r.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],r.unwrappedTileID,r.getElevation).point}return{x:e/r.width*2-1,y:i/r.height*2-1}}function Ne(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function Qe(e,t,i){return e._unit()._perp()._mult(t*i)}function je(e,i,r,n,o,s,a,l,c){if(l.projectionCache.offsets[e])return l.projectionCache.offsets[e];const u=r.add(i);if(e+c.direction=o)return l.projectionCache.offsets[e]=u,u;const h=De(e+c.direction,l,c),d=Qe(h.sub(r),a,c.direction),p=r.add(d),f=h.add(d);return l.projectionCache.offsets[e]=t.au(s,u,p,f)||u,l.projectionCache.offsets[e]}function Ve(e,t,i,r,n,o,s,a,l){const c=r?e-t:e+t;let u=c>0?1:-1,h=0;r&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let d,p=u>0?o+n:o+n+1;a.projectionCache.cachedAnchorPoint?d=a.projectionCache.cachedAnchorPoint:(d=Oe(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,a.projectionCache.cachedAnchorPoint=d);let f,A,m=d,g=d,_=0,y=0;const v=Math.abs(c),x=[];let b;for(;_+y<=v;){if(p+=u,p=s)return null;_+=y,g=m,A=f;const e={absOffsetX:v,direction:u,distanceFromAnchor:_,previousVertex:g};if(m=De(p,a,e),0===i)x.push(g),b=m.sub(g);else{let t;const r=m.sub(g);t=0===r.mag()?Qe(De(p+u,a,e).sub(m),i,u):Qe(r,i,u),A||(A=g.add(t)),f=je(p,t,m,o,s,A,i,a,e),x.push(A),b=f.sub(A)}y=b.mag()}const w=b._mult((v-_)/y)._add(A||g),T=h+Math.atan2(m.y-g.y,m.x-g.x);return x.push(w),{point:w,angle:l?T:0,path:x}}const He=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ge(e,t){for(let i=0;i=1;e--)p.push(s.path[e]);for(let e=1;ee.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let m=[];if(p.length>0){const e=p[0].clone(),i=p[0].clone();for(let t=1;t=r.x&&i.x<=n.x&&e.y>=r.y&&i.y<=n.y?[p]:i.xn.x||i.yn.y?[]:t.av([p],r.x,r.y,n.x,n.y)}for(const t of m){o.reset(t,.25*i);let r=0;r=o.length<=.5*i?1:Math.ceil(o.paddedLength/f)+1;for(let t=0;t{const t=Me(e.x,e.y,r,i.getElevation),n=i.transform.projectTileCoordinates(t.point.x,t.point.y,i.unwrappedTileID,i.getElevation);return n.point.x=(.5*n.point.x+.5)*i.width,n.point.y=(.5*-n.point.y+.5)*i.height,n}))}(e,i);return function(e){let t=0,i=0,r=0,n=0;for(let o=0;oi&&(i=n,t=r));return e.slice(t,t+i)}(r)}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,n=1/0,o=-1/0,s=-1/0;for(const a of e){const e=new t.P(a.x+Ze,a.y+Ze);r=Math.min(r,e.x),n=Math.min(n,e.y),o=Math.max(o,e.x),s=Math.max(s,e.y),i.push(e)}const a=this.grid.query(r,n,o,s).concat(this.ignoredGrid.query(r,n,o,s)),l={},c={};for(const e of a){const r=e.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const n=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.aw(i,n)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(e,t,i,r,n,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n,o){const s=i?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:t};for(let t=0;t=this.screenRightBoundary||rthis.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e=0&&tthis.projectAndGetPerspectiveRatio(e.x,e.y,n,c,h)));M=e.some((e=>!e.isOccluded)),E=e.map((e=>new t.P(e.x,e.y)))}else M=!0;return{box:t.ax(E),allPointsOccluded:!M}}}class Ke{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class We{constructor(e,t,i,r,n){this.text=new Ke(e?e.text:null,t,i,n),this.icon=new Ke(e?e.icon:null,t,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Xe{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}}class Ye{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class Je{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function et(e,i,r,n,o){const{horizontalAlign:s,verticalAlign:a}=t.aE(e);return new t.P(-(s-.5)*i+n[0]*o,-(a-.5)*r+n[1]*o)}class tt{constructor(e,t,i,r,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new qe(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Je(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const t=this.terrain;return t?(i,r)=>t.getElevation(e,i,r):null}getBucketParts(e,i,r,n){const o=r.getBucket(i),s=r.latestFeatureIndex;if(!o||!s||i.id!==o.layerIds[0])return;const a=r.collisionBoxArray,l=o.layers[0].layout,c=o.layers[0].paint,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),h=r.tileSize/t.Z,d=r.tileID.toUnwrapped(),p="map"===l.get("text-rotation-alignment"),f=t.az(r,1,this.transform.zoom),A=t.aA(this.collisionIndex.transform,r,c.get("text-translate"),c.get("text-translate-anchor")),m=t.aA(this.collisionIndex.transform,r,c.get("icon-translate"),c.get("icon-translate-anchor")),g=Ce(p,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new Ye(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,r.tileID);const _={bucket:o,layout:l,translationText:A,translationIcon:m,unwrappedTileID:d,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:h,holdingForFade:r.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:t.ak(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=t;e.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v){const x=t.aB[e.textAnchor],b=[e.textOffset0,e.textOffset1],w=et(x,r,n,b,o),T=this.collisionIndex.placeCollisionBox(i,d,l,c,u,a,s,m,h.predicate,y,w,v);if((!_||this.collisionIndex.placeCollisionBox(_,d,l,c,u,a,s,g,h.predicate,y,w,v).placeable)&&T.placeable){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:b,width:r,height:n,anchor:x,textBoxScale:o,prevAnchor:e},this.markUsedJustification(f,x,p,A),f.allowVerticalPlacement&&(this.markUsedOrientation(f,A,p),this.placedOrientations[p.crossTileID]=A),{shift:w,placedGlyphBoxes:T}}}placeLayerBucketPart(e,i,r){const{bucket:n,layout:o,translationText:s,translationIcon:a,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:u,holdingForFade:h,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:f}=e.parameters,A=o.get("text-optional"),m=o.get("icon-optional"),g=t.aC(o,"text-overlap","text-allow-overlap"),_="always"===g,y=t.aC(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"),B=_&&(v||!n.hasIconData()||m),C=v&&(_||!n.hasTextData()||A);!n.collisionArrays&&d&&n.deserializeCollisionBoxes(d);const S=this.retainedQueryData[n.bucketInstanceId].tileID,E=this._getTerrainElevationFunc(S),M=this.transform.getFastPathSimpleProjectionMatrix(S),I=(e,d,v)=>{var T,I;if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new Xe(!1,!1,!1));let P=!1,L=!1,F=!0,k=null,z={box:null,placeable:!1,offscreen:null,occluded:!1},R={placeable:!1},D=null,O=null,U=null,N=0,Q=0,j=0;d.textFeatureIndex?N=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(N=e.featureIndex),d.verticalTextFeatureIndex&&(Q=d.verticalTextFeatureIndex);const V=d.textBox;if(V){const i=i=>{let r=t.al.horizontal;if(n.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(n,r,e))}return r},o=(i,r)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const e of n.writingModes)if(e===t.al.vertical?(z=r(),R=z):z=i(),z&&z.placeable)break}else z=i()},c=e.textAnchorOffsetStartIndex,h=e.textAnchorOffsetEndIndex;if(h===c){const r=(t,i)=>{const r=this.collisionIndex.placeCollisionBox(t,g,u,S,l,b,x,s,f.predicate,E,void 0,M);return r&&r.placeable&&(this.markUsedOrientation(n,i,e),this.placedOrientations[e.crossTileID]=i),r};o((()=>r(V,t.al.horizontal)),(()=>{const i=d.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?r(i,t.al.vertical):{box:null,offscreen:null}})),i(z&&z.placeable)}else{let p=t.aB[null===(I=null===(T=this.prevPlacement)||void 0===T?void 0:T.variableOffsets[e.crossTileID])||void 0===I?void 0:I.anchor];const A=(t,i,o)=>{const d=t.x2-t.x1,A=t.y2-t.y1,m=e.textBoxScale,_=w&&"never"===y?i:null;let v=null,T="never"===g?1:2,B="never";p&&T++;for(let i=0;iA(V,d.iconBox,t.al.horizontal)),(()=>{const i=d.verticalTextBox;return n.allowVerticalPlacement&&(!z||!z.placeable)&&e.numVerticalGlyphVertices>0&&i?A(i,d.verticalIconBox,t.al.vertical):{box:null,occluded:!0,offscreen:null}})),z&&(P=z.placeable,F=z.offscreen);const m=i(z&&z.placeable);if(!P&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,m))}}}if(D=z,P=D&&D.placeable,F=D&&D.offscreen,e.useRuntimeCollisionCircles){const i=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),a=t.am(n.textSizeData,p,i),u=o.get("text-padding");O=this.collisionIndex.placeCollisionCircles(g,i,n.lineVertexArray,n.glyphOffsetArray,a,l,c,r,b,f.predicate,e.collisionCircleDiameter,u,s,E),O.circles.length&&O.collisionDetected&&!r&&t.w("Collisions detected, but collision boxes are not shown"),P=_||O.circles.length>0&&!O.collisionDetected,F=F&&O.offscreen}if(d.iconFeatureIndex&&(j=d.iconFeatureIndex),d.iconBox){const e=e=>this.collisionIndex.placeCollisionBox(e,y,u,S,l,b,x,a,f.predicate,E,w&&k?k:void 0,M);R&&R.placeable&&d.verticalIconBox?(U=e(d.verticalIconBox),L=U.placeable):(U=e(d.iconBox),L=U.placeable),F=F&&U.offscreen}const H=A||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,G=m||0===e.numIconVertices;H||G?G?H||(L=L&&P):P=L&&P:L=P=L&&P;const $=L&&U.placeable;if(P&&D.placeable&&this.collisionIndex.insertCollisionBox(D.box,g,o.get("text-ignore-placement"),n.bucketInstanceId,R&&R.placeable&&Q?Q:N,f.ID),$&&this.collisionIndex.insertCollisionBox(U.box,y,o.get("icon-ignore-placement"),n.bucketInstanceId,j,f.ID),O&&P&&this.collisionIndex.insertCollisionCircles(O.circles,g,o.get("text-ignore-placement"),n.bucketInstanceId,N,f.ID),r&&this.storeCollisionData(n.bucketInstanceId,v,d,D,U,O),0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new Xe((P||B)&&!(null==D?void 0:D.occluded),(L||C)&&!(null==U?void 0:U.occluded),F||n.justReloaded),i[e.crossTileID]=!0};if(T){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){const i=t[e];I(n.symbolInstances.get(i),n.collisionArrays[i],i)}}else for(let t=e.symbolInstanceStart;t=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:r.crossTileID)}markUsedOrientation(e,i,r){const n=i===t.al.horizontal||i===t.al.horizontalOnly?i:0,o=i===t.al.vertical?i:0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const t of s)e.text.placedSymbolArray.get(t).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=n[e];o?(this.opacities[e]=new We(o,r,t.text,t.icon),i=i||t.text!==o.text.placed||t.icon!==o.icon.placed):(this.opacities[e]=new We(null,r,t.text,t.icon,t.skipFade),i=i||t.text||t.icon)}for(const e in n){const t=n[e];if(!this.opacities[e]){const n=new We(t,r,!1,!1);n.isHidden()||(this.opacities[e]=n,i=i||t.text.placed||t.icon.placed)}}for(const e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(const e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const i={};for(const r of t){const t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,i,r,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 o=e.layers[0],s=o.layout,a=new We(null,0,!1,!1,!0),l=s.get("text-allow-overlap"),c=s.get("icon-allow-overlap"),u=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h="map"===s.get("text-rotation-alignment"),d="map"===s.get("text-pitch-alignment"),p="none"!==s.get("icon-text-fit"),f=new We(null,0,l&&(c||!e.hasIconData()||s.get("icon-optional")),c&&(l||!e.hasTextData()||s.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);const A=(e,t,i)=>{for(let r=0;r0,_=this.placedOrientations[n.crossTileID],y=_===t.al.vertical,v=_===t.al.horizontal||_===t.al.horizontalOnly;if(o>0||s>0){const t=ut(c.text);A(e.text,o,y?ht:t),A(e.text,s,v?ht:t);const i=c.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||y?1:0)})),n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=i||v?1:0);const r=this.variableOffsets[n.crossTileID];r&&this.markUsedJustification(e,r.anchor,n,_);const a=this.placedOrientations[n.crossTileID];a&&(this.markUsedJustification(e,"left",n,a),this.markUsedOrientation(e,a,n))}if(g){const t=ut(c.icon),i=!(p&&n.verticalPlacedIconSymbolIndex&&y);n.placedIconSymbolIndex>=0&&(A(e.icon,n.numIconVertices,i?t:ht),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=c.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(A(e.icon,n.numVerticalIconVertices,i?ht:t),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=c.icon.isHidden())}const x=m&&m.has(i)?m.get(i):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const r=e.collisionArrays[i];if(r){let i=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){const e=this.variableOffsets[l];e?(i=et(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),h&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let n;r.textBox&&(n=y),r.verticalTextBox&&(n=v),it(e.textCollisionBox.collisionVertexArray,c.text.placed,!t||n,x.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){const t=Boolean(!v&&r.verticalIconBox);let n;r.iconBox&&(n=t),r.verticalIconBox&&(n=!t),it(e.iconCollisionBox.collisionVertexArray,c.icon.placed,n,x.icon,p?i.x:0,p?i.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),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`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function it(e,t,i,r,n,o){r&&0!==r.length||(r=[0,0,0,0]);const s=r[0]-Ze,a=r[1]-Ze,l=r[2]-Ze,c=r[3]-Ze;e.emplaceBack(t?1:0,i?1:0,n||0,o||0,s,a),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,l,a),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,l,c),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,s,c)}const rt=Math.pow(2,25),nt=Math.pow(2,24),ot=Math.pow(2,17),st=Math.pow(2,16),at=Math.pow(2,9),lt=Math.pow(2,8),ct=Math.pow(2,1);function ut(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*rt+t*nt+i*ot+t*st+i*at+t*lt+i*ct+t}const ht=0;class dt{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,r,n){const o=this._bucketParts;for(;this._currentTileIndexe.sortKey-t.sortKey)));this._currentPartIndex!this._forceFullPlacement&&s.now()-r>2;for(;this._currentPlacementIndex>=0;){const r=t[e[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===r.type&&(!r.minzoom||r.minzoom<=o)&&(!r.maxzoom||r.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new dt(r)),this._inProgressLayer.continuePlacement(i[r.source],this.placement,this._showCollisionBoxes,r,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const ft=512/t.Z/2;class At{constructor(e,i,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};const n=new Map;for(let e=0;e({x:Math.floor(e.anchorX*ft),y:Math.floor(e.anchorY*ft)}))),crossTileIDs:i.map((e=>e.crossTileID))};if(r.positions.length>128){const e=new t.aF(r.positions.length,16,Uint16Array);for(const{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,i){const{x:r,y:n,z:o}=this.tileID.canonical,{x:s,y:a,z:l}=i.canonical,c=ft/Math.pow(2,l-o),u=(a*t.Z+e.anchorY)*c,h=n*t.Z*ft;return{x:Math.floor((s*t.Z+e.anchorX)*c-r*t.Z*ft),y:Math.floor(u-h)}}findMatches(e,t,i){const r=this.tileID.canonical.ze))}}class mt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class gt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const e in this.indexes){const i=this.indexes[e],r={};for(const e in i){const n=i[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),r[n.tileID.key]=n}this.indexes[e]=r}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;ee.overscaledZ)for(const i in n){const o=n[i];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,r)}else{const o=n[e.scaledTo(Number(i)).key];o&&o.findMatches(t.symbolInstances,e,r)}}for(let e=0;e{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var yt="void main() {fragColor=vec4(1.0);}";const vt={prelude:xt("#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\nout highp vec4 fragColor;","#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;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\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(texture(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=(texture(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\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\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}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:xt("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:xt("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:xt("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:xt("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;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);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:xt("in vec3 v_data;in 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);float antialiased_blur=v_data.z;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));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out 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 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:xt(yt,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:xt("uniform highp float u_intensity;in 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);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out 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 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.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;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:xt("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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:xt("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:xt("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:xt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:xt(yt,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:xt("#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\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\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=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:xt("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\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);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\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=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:xt("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\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=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\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=projectTile(a_pos+u_fill_translate,a_pos);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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:xt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out 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=projectTile(a_pos+u_fill_translate,a_pos);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:xt("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout 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);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat 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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=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:xt("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in 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=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out 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 elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*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:xt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(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));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\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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:xt("uniform sampler2D u_image;in 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=texture(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);fragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:xt("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\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);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:xt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\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=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:xt("#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;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.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:xt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\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=texture(u_image,v_tex_a).a;float sdfdist_b=texture(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);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;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;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.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:xt("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:xt("uniform sampler2D u_texture;in vec2 v_tex;in 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;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:xt("#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;in vec2 v_data0;in 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=texture(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);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:xt("#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;in vec4 v_data0;in 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;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:xt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:xt("in 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() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:xt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:xt("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:xt("in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:xt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function xt(e,t){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=o?o.concat(n):n,a={};return{fragmentSource:e=e.replace(i,((e,t,i,r,n)=>(a[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`))),vertexSource:t=t.replace(i,((e,t,i,r,n)=>{const o="float"===r?"vec2":"vec4",s=n.match(/color/)?"color":o;return a[n]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${s}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${s}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:r,staticUniforms:s}}class bt{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var wt=t.aG([{name:"a_pos",type:"Int16",components:2}]);const Tt="#define PROJECTION_MERCATOR",Bt="mercator";class Ct{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Bt}get shaderDefine(){return Tt}get shaderPreludeCode(){return vt.projectionMercator}get vertexShaderPreludeCode(){return vt.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aH.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,r,n,o){if(this._cachedMesh)return this._cachedMesh;const s=new t.aI;s.emplaceBack(0,0),s.emplaceBack(t.Z,0),s.emplaceBack(0,t.Z),s.emplaceBack(t.Z,t.Z);const a=e.createVertexBuffer(s,wt.members),l=t.aJ.simpleSegment(0,0,4,2),c=new t.aK;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const u=e.createIndexBuffer(c);return this._cachedMesh=new bt(a,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class St{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=r}interpolate(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.B.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.B.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.B.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.B.number(e.right,i.right,r)),this}getCenter(e,i){const r=t.ae((this.left+e-this.right)/2,0,e),n=t.ae((this.top+i-this.bottom)/2,0,i);return new t.P(r,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new St(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Et(e,t){if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function Mt(e){return Math.max(0,Math.floor(e))}class It{constructor(e,i,r,n,o,s){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===s||!!s,this._minZoom=i||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==o?60:o,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.Q(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Mt(this._zoom),this._scale=t.ac(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new St,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,r){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=Mt(this._zoom),this._scale=t.ac(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new St(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!r&&e.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=t.aL(e,-180,180)*Math.PI/180;var n,o,s,a,l,c,u,h,d;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=r(),n=this._rotationMatrix,s=-this._bearingInRadians,a=(o=this._rotationMatrix)[0],l=o[1],c=o[2],u=o[3],h=Math.sin(s),d=Math.cos(s),n[0]=a*d+c*h,n[1]=l*d+u*h,n[2]=a*-h+c*d,n[3]=l*-h+u*d)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=t.ae(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return t.aM(this._fovInRadians)}setFov(e){e=t.ae(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.ab(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const i=this.getConstrained(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=t.ac(i),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new H([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-85.051129,t.af])}getConstrained(e,t){return this._callbacks.getConstrained(e,t)}getCameraQueryGeometry(e,i){if(1===i.length)return[i[0],e];{let r=e.x,n=e.y,o=e.x,s=e.y;for(const e of i)r=Math.min(r,e.x),n=Math.min(n,e.y),o=Math.max(o,e.x),s=Math.max(s,e.y);return[new t.P(r,n),new t.P(o,n),new t.P(o,s),new t.P(r,s),new t.P(r,n)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:t,zoom:i}=this.getConstrained(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.ad(new Float64Array(16));t.M(e,e,[this._width/2,-this._height/2,1]),t.L(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.ad(new Float64Array(16)),t.M(e,e,[1,-1,1]),t.L(e,e,[-1,-1,0]),t.M(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,r,n){const o=void 0!==r?r:this.bearing,s=n=void 0!==n?n:this.pitch,a=t.$.fromLngLat(e,i),l=-Math.cos(t.ab(s)),c=Math.sin(t.ab(s)),u=c*Math.sin(t.ab(o)),h=-c*Math.cos(t.ab(o));let d=this.elevation;const p=i-d;let f;l*p>=0||Math.abs(l)<.1?(f=1e4,d=i+f*l):f=-p/l;let A,m,g=t.aN(1,a.y),_=0;do{if(_+=1,_>10)break;m=f/g,A=new t.$(a.x+u*m,a.y+h*m),g=1/A.meterInMercatorCoordinateUnits()}while(Math.abs(f-m*g)>1e-12);return{center:A.toLngLat(),elevation:d,zoom:t.ah(this.height/2/Math.tan(this.fovInRadians/2)/m/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=t.ag(1,this.center.lat)*this.worldSize,r=this.cameraToCenterDistance/i,n=t.$.fromLngLat(this.center,this.elevation),o=pe(this.center,this.elevation,this.pitch,this.bearing,r);this._elevation=e;const s=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),t.aN(o.z,n.y),this.bearing,this.pitch);this._elevation=s.elevation,this._center=s.center,this.setZoom(s.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=t.ag(1,this.center.lat)*this.worldSize;return pe(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const i=e.canonical.z>=0?1<this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]0?(t+=e[r]*this.min[r],i+=e[r]*this.max[r]):(i+=e[r]*this.min[r],t+=e[r]*this.max[r]);return t>=0?2:i<0?0:1}}class Lt{distanceToTile2d(e,t,i,r){const n=r.distanceX([e,t]),o=r.distanceY([e,t]);return Math.hypot(n,o)}getWrap(e,t,i){return i}getTileAABB(e,i,r,n){var o,s;let a=r,l=r;if(n.terrain){const c=new t.Y(e.z,i,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(c);a=null!==(o=u.minElevation)&&void 0!==o?o:r,l=null!==(s=u.maxElevation)&&void 0!==s?s:r}const c=1<n}allowWorldCopies(){return!0}recalculateCache(){}}class Ft{constructor(e,t,i){this.points=e,this.planes=t,this.aabb=i}static fromInvProjectionMatrix(e,i=1,r=0){const n=Math.pow(2,r),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((r=>{const o=1/(r=t.at([],r,e))[3]/i*n;return t.aR(r,r,[o,o,1/r[3],o])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const i=t.aS([],o[e[0]],o[e[1]]),r=t.aS([],o[e[2]],o[e[1]]),n=t.aT([],t.aU([],i,r)),s=-t.aV(n,o[e[1]]);return n.concat(s)})),a=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],l=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const e of o)for(let t=0;t<3;t++)a[t]=Math.min(a[t],e[t]),l[t]=Math.max(l[t],e[t]);return new Ft(o,s,new Pt(a,l))}}class kt{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e,t,i,r,n){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new It({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)},e,t,i,r,n),this._coveringTilesDetailsProvider=new Lt}clone(){const e=new kt;return e.apply(this),e}apply(e,t,i){this._helper.apply(e,t,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const i=[new t.aW(0,e)];if(this._helper._renderWorldCopies){const r=this.screenPointToMercatorCoordinate(new t.P(0,0)),n=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new t.P(0,this._helper._height)),a=Math.floor(Math.min(r.x,n.x,o.x,s.x)),l=Math.floor(Math.max(r.x,n.x,o.x,s.x)),c=1;for(let r=a-c;r<=l+c;r++)0!==r&&i.push(new t.aW(r,e))}return i}getCameraFrustum(){return Ft.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const t=this.screenPointToLocation(this.centerPoint,e),i=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(e,i){const r=t.ag(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(i,r),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),s=t.$.fromLngLat(e),a=new t.$(s.x-(n.x-o.x),s.y-(n.y-o.y));this.setCenter(null==a?void 0:a.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(t.$.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(t.$.fromLngLat(e))}screenPointToLocation(e,t){var i;return null===(i=this.screenPointToMercatorCoordinate(e,t))||void 0===i?void 0:i.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){const i=t.pointCoordinate(e);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){const r=i||0,n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.at(n,n,this._pixelMatrixInverse),t.at(o,o,this._pixelMatrixInverse);const s=n[3],a=o[3],l=n[1]/s,c=o[1]/a,u=n[2]/s,h=o[2]/a,d=u===h?0:(r-u)/(h-u);return new t.$(t.B.number(n[0]/s,o[0]/a,d)/this.worldSize,t.B.number(l,c,d)/this.worldSize,r)}coordinatePoint(e,i=0,r=this._pixelMatrix){const n=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.at(n,n,r),new t.P(n[0]/n[3],n[1]/n[3])}getBounds(){const e=Math.max(0,this._helper._height/2-he(this));return(new H).extend(this.screenPointToLocation(new t.P(0,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new t.P(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=t.pointCoordinate(e):e.y>this.height/2-he(this)}calculatePosMatrix(e,i=!1,r){var n;const o=null!==(n=e.key)&&void 0!==n?n:t.aX(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),s=i?this._alignedPosMatrixCache:this._posMatrixCache;if(s.has(o)){const e=s.get(o);return r?e.f32:e.f64}const a=de(e,this.worldSize);t.N(a,i?this._alignedProjMatrix:this._viewProjMatrix,a);const l={f64:a,f32:new Float32Array(a)};return s.set(o,l),r?l.f32:l.f64}calculateFogMatrix(e){const i=e.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);const n=de(e,this.worldSize);return t.N(n,this._fogMatrix,n),r.set(i,new Float32Array(n)),r.get(i)}getConstrained(e,i){i=t.ae(+i,this.minZoom,this.maxZoom);const r={center:new t.Q(e.lng,e.lat),zoom:i};let n=this._helper._lngRange;this._helper._renderWorldCopies||null!==n||(n=[-179.9999999999,180-1e-10]);const o=this.tileSize*t.ac(r.zoom);let s=0,a=o,l=0,c=o,u=0,h=0;const{x:d,y:p}=this.size;if(this._helper._latRange){const e=this._helper._latRange;s=t.S(e[1])*o,a=t.S(e[0])*o,a-sa&&(g=a-e)}if(n){const e=(l+c)/2;let i=f;this._helper._renderWorldCopies&&(i=t.aL(f,e-o/2,e+o/2));const r=d/2;i-rc&&(m=c-r)}if(void 0!==m||void 0!==g){const e=new t.P(null!=m?m:f,null!=g?g:A);r.center=ue(o,e).wrap()}return r}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}_calculateNearFarZIfNeeded(e,i,r){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=e-n*this._helper._pixelPerMeter/Math.cos(i),s=n<0?o:e,a=Math.PI/2+this.pitchInRadians,l=t.ab(this.fov)*(Math.abs(Math.cos(t.ab(this.roll)))*this.height+Math.abs(Math.sin(t.ab(this.roll)))*this.width)/this.height*(.5+r.y/this.height),c=Math.sin(l)*s/Math.sin(t.ae(Math.PI-a-l,.01,Math.PI-.01)),u=he(this),h=Math.atan(u/this._helper.cameraToCenterDistance),d=t.ab(.75),p=h>d?2*h*(.5+r.y/(2*u)):d,f=Math.sin(p)*s/Math.sin(t.ae(Math.PI-a-p,.01,Math.PI-.01)),A=Math.min(c,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*A+s),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=ce(this.worldSize,this.center),r=i.x,n=i.y;this._helper._pixelPerMeter=t.ag(1,this.center.lat)*this.worldSize;const o=t.ab(Math.min(this.pitch,le)),s=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));let a;this._calculateNearFarZIfNeeded(s,o,e),a=new Float64Array(16),t.aY(a,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),t.an(this._invProjMatrix,a),a[8]=2*-e.x/this._helper._width,a[9]=2*e.y/this._helper._height,this._projectionMatrix=t.aZ(a),t.M(a,a,[1,-1,1]),t.L(a,a,[0,0,-this._helper.cameraToCenterDistance]),t.a_(a,a,-this.rollInRadians),t.a$(a,a,this.pitchInRadians),t.a_(a,a,-this.bearingInRadians),t.L(a,a,[-r,-n,0]),this._mercatorMatrix=t.M([],a,[this.worldSize,this.worldSize,this.worldSize]),t.M(a,a,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,a),t.L(a,a,[0,0,-this.elevation]),this._viewProjMatrix=a,this._invViewProjMatrix=t.an([],a);const l=[0,0,-1,1];t.at(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),t.aY(this._fogMatrix,this.fovInRadians,this.width/this.height,s,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,t.M(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.L(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.a_(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.a$(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.a_(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.L(this._fogMatrix,this._fogMatrix,[-r,-n,0]),t.M(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.L(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,a);const c=this._helper._width%2/2,u=this._helper._height%2/2,h=Math.cos(this.bearingInRadians),d=Math.sin(-this.bearingInRadians),p=r-Math.round(r)+h*c+d*u,f=n-Math.round(n)+h*u+d*c,A=new Float64Array(a);if(t.L(A,A,[p>.5?p-1:p,f>.5?f-1:f,0]),this._alignedProjMatrix=A,a=t.an(new Float64Array(16),this._pixelMatrix),!a)throw new Error("failed to invert matrix");this._pixelMatrixInverse=a,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new t.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.at(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=t.ag(1,this.center.lat)*this.worldSize;return pe(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const r=t.$.fromLngLat(e),n=[r.x*this.worldSize,r.y*this.worldSize,i,1];return t.at(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(e){const{overscaledTileID:i,aligned:r,applyTerrainMatrix:n}=e,o=this._helper.getMercatorTileCoordinates(i),s=i?this.calculatePosMatrix(i,r,!0):null;let a;return a=i&&i.terrainRttPosMatrix32f&&n?i.terrainRttPosMatrix32f:s||t.b0(),{mainMatrix:a,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,i){return 1}transformLightDirection(e){return t.aQ(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,r,n){const o=this.calculatePosMatrix(r);let s;n?(s=[e,i,n(e,i),1],t.at(s,s,o)):(s=[e,i,0,1],$e(s,s,o));const a=s[3];return{point:new t.P(s[0]/a,s[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}populateCache(e){for(const t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,i){const r=t.$.fromLngLat(e,i),n=r.meterInMercatorCoordinateUnits(),o=t.b1();return t.L(o,o,[r.x,r.y,r.z]),t.a_(o,o,Math.PI),t.a$(o,o,Math.PI/2),t.M(o,o,[-n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const i=new t.Y(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),n=de(i,this.worldSize);t.N(n,this._viewProjMatrix,n),r.tileMercatorCoords=[0,0,1,1];const o=[t.Z,t.Z,this.worldSize/this._helper.pixelsPerMeter],s=t.b2();return t.M(s,n,o),r.fallbackMatrix=s,r.mainMatrix=s,r}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function zt(){t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Rt(e){if(e.useSlerp)if(e.k<1){const i=t.b3(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=t.b3(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),n=new Float64Array(4);t.b4(n,i,r,e.k);const o=t.b5(n);e.tr.setRoll(o.roll),e.tr.setPitch(o.pitch),e.tr.setBearing(o.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(t.B.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.B.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.B.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function Dt(e,i,r,n,o){const s=o.padding,a=ce(o.worldSize,r.getNorthWest()),l=ce(o.worldSize,r.getNorthEast()),c=ce(o.worldSize,r.getSouthEast()),u=ce(o.worldSize,r.getSouthWest()),h=t.ab(-n),d=a.rotate(h),p=l.rotate(h),f=c.rotate(h),A=u.rotate(h),m=new t.P(Math.max(d.x,p.x,A.x,f.x),Math.max(d.y,p.y,A.y,f.y)),g=new t.P(Math.min(d.x,p.x,A.x,f.x),Math.min(d.y,p.y,A.y,f.y)),_=m.sub(g),y=(o.width-(s.left+s.right+i.left+i.right))/_.x,v=(o.height-(s.top+s.bottom+i.top+i.bottom))/_.y;if(v<0||y<0)return void zt();const x=Math.min(t.ah(o.scale*Math.min(y,v)),e.maxZoom),b=t.P.convert(e.offset),w=new t.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(t.ab(n)),T=b.add(w).mult(o.scale/t.ac(x));return{center:ue(o.worldSize,a.add(c).div(2).sub(T)),zoom:x,bearing:n}}class Ot{get useGlobeControls(){return!1}handlePanInertia(e,t){return{easingOffset:e,easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around)}cameraForBoxAndBearing(e,t,i,r,n){return Dt(e,t,i,r,n)}handleJumpToCenterZoom(e,i){e.zoom!==(void 0!==i.zoom?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),void 0!==i.center&&e.setCenter(t.Q.convert(i.center))}handleEaseTo(e,i){const r=e.zoom,n=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},a=void 0!==i.zoom,l=!e.isPaddingEqual(i.padding);let c=!1;const u=a?+i.zoom:e.zoom;let h=e.centerPoint.add(i.offsetAsPoint);const d=e.screenPointToLocation(h),{center:p,zoom:f}=e.getConstrained(t.Q.convert(i.center||d),null!=u?u:r);Et(e,p);const A=ce(e.worldSize,d),m=ce(e.worldSize,p).sub(A),g=t.ac(f-r);return c=f!==r,{easeFunc:a=>{if(c&&e.setZoom(t.B.number(r,f,a)),t.b6(o,s)||Rt({startEulerAngles:o,endEulerAngles:s,tr:e,k:a,useSlerp:o.roll!=s.roll}),l&&(e.interpolatePadding(n,i.padding,a),h=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const i=t.ac(e.zoom-r),n=f>r?Math.min(2,g):Math.max(.5,g),o=Math.pow(n,1-a),s=ue(e.worldSize,A.add(m.mult(a*o)).mult(i));e.setLocationAtPoint(e.renderWorldCopies?s.wrap():s,h)}},isZooming:c,elevationCenter:p}}handleFlyTo(e,i){const r=void 0!==i.zoom,n=e.zoom,o=e.getConstrained(t.Q.convert(i.center||i.locationAtOffset),r?+i.zoom:n),s=o.center,a=o.zoom;Et(e,s);const l=ce(e.worldSize,i.locationAtOffset),c=ce(e.worldSize,s).sub(l),u=c.mag(),h=t.ac(a-n);let d;if(void 0!==i.minZoom){const r=Math.min(+i.minZoom,n,a),o=e.getConstrained(s,r).zoom;d=t.ac(o-n)}return{easeFunc:(i,r,o,u)=>{e.setZoom(1===i?a:n+t.ah(r));const h=1===i?s:ue(e.worldSize,l.add(c.mult(o)).mult(r));e.setLocationAtPoint(e.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:s,scaleOfMinZoom:d,pixelPathLength:u}}}class Ut{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}Ut.Replace=[1,0],Ut.disabled=new Ut(Ut.Replace,t.b7.transparent,[!1,!1,!1,!1]),Ut.unblended=new Ut(Ut.Replace,t.b7.transparent,[!0,!0,!0,!0]),Ut.alphaBlended=new Ut([1,771],t.b7.transparent,[!0,!0,!0,!0]);const Nt=2305;class Qt{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}Qt.disabled=new Qt(!1,1029,Nt),Qt.backCCW=new Qt(!0,1029,Nt),Qt.frontCCW=new Qt(!0,1028,Nt);class jt{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}jt.ReadOnly=!1,jt.ReadWrite=!0,jt.disabled=new jt(519,jt.ReadOnly,[0,1]);const Vt=7680;class Ht{constructor(e,t,i,r,n,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}Ht.disabled=new Ht({func:519,mask:0},0,0,Vt,Vt,Vt);const Gt=new WeakMap;function $t(e){var t;if(Gt.has(e))return Gt.get(e);{const i=null===(t=e.getParameter(e.VERSION))||void 0===t?void 0:t.startsWith("WebGL 2.0");return Gt.set(e,i),i}}class Zt{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const i=e.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;const n=new t.aI;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const o=new t.aK;o.emplaceBack(0,1,2),this._fullscreenTriangle=new bt(i.createVertexBuffer(n,wt.members),i.createIndexBuffer(o),t.aJ.simpleSegment(0,0,n.length,o.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);const s=r.createTexture();r.bindTexture(r.TEXTURE_2D,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(s),$t(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,t){const i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,t=e.gl;e.activeTexture.set(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){const r=this._cachedRenderContext.context,n=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:t.b7.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,n.TRIANGLES,jt.disabled,Ht.disabled,Ut.unblended,Qt.disabled,((e,t)=>({u_input:e,u_output_expected:t}))(e,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&$t(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);const e=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:e}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&$t(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return t.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Zt._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let t=0;return t+=e[0]/256,t+=e[1]/65536,t+=e[2]/16777216,e[3]<127&&(t=-t),t/128}}const qt=t.Z/128;function Kt(e,i){const r=void 0!==e.granularity?Math.max(e.granularity,1):1,n=r+(e.generateBorders?2:0),o=r+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),s=n+1,a=o+1,l=e.generateBorders?-1:0,c=e.generateBorders||e.extendToNorthPole?-1:0,u=r+(e.generateBorders?1:0),h=r+(e.generateBorders||e.extendToSouthPole?1:0),d=s*a,p=n*o*6,f=s*a>65536;if(f&&"16bit"===i)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const A=f||"32bit"===i,m=new Int16Array(2*d);let g=0;for(let i=c;i<=h;i++)for(let n=l;n<=u;n++){let o=n/r*t.Z;-1===n&&(o=-64),n===r+1&&(o=t.Z+qt);let s=i/r*t.Z;-1===i&&(s=e.extendToNorthPole?t.b9:-64),i===r+1&&(s=e.extendToSouthPole?t.ba:t.Z+qt),m[g++]=o,m[g++]=s}const _=A?new Uint32Array(p):new Uint16Array(p);let y=0;for(let e=0;e0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,i,r,n){return this.currentProjection.getMeshFromTileID(e,t,i,r,n)}setProjection(e){this._transitionable.setValue("type",(null==e?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function ei(e){const t=ri(e.worldSize,e.center.lat);return 2*Math.PI*t}function ti(e,i,r,n,o){const s=1/(1<1e-6){const n=e[0]/r,o=Math.acos(e[2]/r),s=(n>0?o:-o)/Math.PI*180;return new t.Q(t.aL(s,-180,180),i)}return new t.Q(0,i)}function oi(e){return Math.cos(e*Math.PI/180)}function si(e,i){const r=oi(e),n=oi(i);return t.ah(n/r)}function ai(e,i){const r=e.rotate(i.bearingInRadians),n=i.zoom+si(i.center.lat,0),o=t.bc(1/oi(i.center.lat),1/oi(Math.min(Math.abs(i.center.lat),60)),t.bf(n,7,3,0,1)),s=360/ei({worldSize:i.worldSize,center:{lat:i.center.lat}});return new t.Q(i.center.lng-r.x*s*o,t.ae(i.center.lat+r.y*s,-85.051129,t.af))}function li(e){const t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function ci(e,i,r,n){const o=e.lat+r*n;if(Math.abs(r)>1){const s=(Math.sign(e.lat+r)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,a=Math.abs(e.lat+r)*Math.PI/180,l=li(s+n*(a-s)),c=li(s),u=li(a);return new t.Q(e.lng+i*((l-c)/(u-c)),o)}return new t.Q(e.lng+i*n,o)}class ui{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._aabbFactory=e}recalculateCache(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileAABB(e,t,i,r){const n=`${e.z}_${e.x}_${e.y}`,o=this._cache.get(n);if(o)return o;const s=this._cachePrevious.get(n);if(s)return this._cache.set(n,s),s;const a=this._aabbFactory(e,t,i,r);return this._cache.set(n,a),this._hadAnyChanges=!0,a}}function hi(e,t,i){const r=e-t;return r<0?-r:Math.max(0,r-i)}function di(e,t,i,r,n){const o=e-i;let s;return s=o<0?Math.min(-o,1+o-n):o>1?Math.min(Math.max(o-n,0),1-o):0,Math.max(s,hi(t,r,n))}class pi{constructor(){this._aabbCache=new ui(this._computeTileAABB)}recalculateCache(){this._aabbCache.recalculateCache()}distanceToTile2d(e,t,i,r){const n=1<4}allowWorldCopies(){return!1}getTileAABB(e,t,i,r){return this._aabbCache.getTileAABB(e,t,i,r)}_computeTileAABB(e,i,r,n){if(e.z<=0)return new Pt([-1,-1,-1],[1,1,1]);if(1===e.z)return new Pt([0===e.x?-1:0,0===e.y?0:-1,-1],[0===e.x?0:1,0===e.y?1:0,1]);{const i=[ti(0,0,e.x,e.y,e.z),ti(t.Z,0,e.x,e.y,e.z),ti(t.Z,t.Z,e.x,e.y,e.z),ti(0,t.Z,e.x,e.y,e.z)],r=[1,1,1],n=[-1,-1,-1];for(const e of i)for(let t=0;t<3;t++)r[t]=Math.min(r[t],e[t]),n[t]=Math.max(n[t],e[t]);if(0===e.y||e.y===(1<{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)}),this._coveringTilesDetailsProvider=new pi}clone(){const e=new fi;return e.apply(this),e}apply(e,t){this._globeLatitudeErrorCorrectionRadians=t||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=t.bh();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:t,applyGlobeMatrix:i}=e,r=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,r=this.cameraToCenterDistance/e,n=Math.sin(i)*r,o=Math.cos(i)*r+1,s=1/Math.sqrt(n*n+o*o)*1;let a=-n,l=o;const c=Math.sqrt(a*a+l*l);a/=c,l/=c;const u=[0,a,l];t.bl(u,u,[0,0,0],-this.bearingInRadians),t.bm(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.bn(u,u,[0,0,0],this.center.lng*Math.PI/180);const h=1/t.bo(u);return t.aO(u,u,h),[...u,-s*h]}isLocationOccluded(e){return!this.isSurfacePointVisible(ii(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,n=Math.cos(r),o=[Math.sin(i)*n,Math.sin(r),Math.cos(i)*n],s=[o[2],0,-o[0]],a=[0,0,0];t.aU(a,s,o),t.aT(s,s),t.aT(a,a);const l=[0,0,0];return t.aT(l,[s[0]*e[0]+a[0]*e[1]+o[0]*e[2],s[1]*e[0]+a[1]*e[1]+o[1]*e[2],s[2]*e[0]+a[2]*e[1]+o[2]*e[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,r){const n=function(e,i,r){const n=1/(1<o&&(o=i),ra&&(a=r)}const u=[c.lng+s,c.lat+l,c.lng+o,c.lat+a];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new H(u)}getConstrained(e,i){const r=t.ae(e.lat,-85.051129,t.af),n=t.ae(+i,this.minZoom+si(0,r),this.maxZoom);return{center:new t.Q(e.lng,r),zoom:n}}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,i){const r=ii(this.unprojectScreenPoint(i)),n=ii(e),o=t.bh();t.br(o);const s=t.bh();t.bn(s,r,o,-this.center.lng*Math.PI/180),t.bm(s,s,o,this.center.lat*Math.PI/180);const a=n[0]*n[0]+n[2]*n[2],l=s[0]*s[0];if(a=-g&&f<=g,y=m>=-g&&m<=g;let v,x;if(_&&y){const e=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;t.bv(h,e)+t.bv(f,i)=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const i=t.bk();return t.at(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){const r=t.aV(e,i),n=t.bh(),o=t.bh();t.aO(o,i,r),t.aS(n,e,o);const s=1-t.aV(n,n);if(s<0)return null;const a=t.aV(e,e)-1,l=-r+(r<0?1:-1)*Math.sqrt(s),c=a/l,u=l;return{tMin:Math.min(c,u),tMax:Math.max(c,u)}}unprojectScreenPoint(e){const i=this._cameraPosition,r=this.getRayDirectionFromPixel(e),n=this.rayPlanetIntersection(i,r);if(n){const e=t.bh();t.aP(e,i,[r[0]*n.tMin,r[1]*n.tMin,r[2]*n.tMin]);const o=t.bh();return t.aT(o,e),ni(o)}const o=this._cachedClippingPlane,s=o[0]*r[0]+o[1]*r[1]+o[2]*r[2],a=-t.bt(o,i)/s,l=t.bh();if(a>0)t.aP(l,i,[r[0]*a,r[1]*a,r[2]*a]);else{const e=t.bh();t.aP(e,i,[2*r[0],2*r[1],2*r[2]]);const n=t.bt(this._cachedClippingPlane,e);t.aS(l,e,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const c=function(e){const i=t.bh();return i[0]=e[0]*-e[3],i[1]=e[1]*-e[3],i[2]=e[2]*-e[3],{center:i,radius:Math.sqrt(1-e[3]*e[3])}}(o);return ni(function(e,i,r){const n=t.bh();t.aS(n,r,e);const o=t.bh();return t.bi(o,e,n,i/t.bj(n)),o}(c.center,c.radius,l))}getMatrixForModel(e,i){const r=t.Q.convert(e),n=1/t.bu,o=t.b1();return t.bp(o,o,r.lng/180*Math.PI),t.a$(o,o,-r.lat/180*Math.PI),t.L(o,o,[0,0,1+i/t.bu]),t.a$(o,o,.5*Math.PI),t.M(o,o,[n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new t.Y(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class Ai{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,t){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().recalculateCache(),this._mercatorTransform.getCoveringTilesDetailsProvider().recalculateCache()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new It({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)}),this._globeness=1,this._mercatorTransform=new kt,this._verticalPerspectiveTransform=new fi}clone(){const e=new Ai;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const t=this._mercatorTransform.getProjectionData(e),i=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:t.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return t.bc(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bc(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,r){const n=this._mercatorTransform.getPitchedTextCorrection(e,i,r),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,r);return t.bc(n,o,this._globeness)}projectTileCoordinates(e,t,i,r){return this.currentTransform.projectTileCoordinates(e,t,i,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,t){return this.currentTransform.getConstrained(e,t)}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,t){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,t){return this.currentTransform.getMatrixForModel(e,t)}getProjectionDataForCustomLayer(e=!0){const t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;const i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return i.fallbackMatrix=t.mainMatrix,i}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class mi{get useGlobeControls(){return!0}handlePanInertia(e,i){const r=ai(e,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new t.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const r=e.around,n=i.screenPointToLocation(r);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);const o=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);const s=i.zoom-o;if(0===s)return;const a=t.bq(i.center.lng,n.lng),l=a/(Math.abs(a/180)+1),c=t.bq(i.center.lat,n.lat),u=i.getRayDirectionFromPixel(r),h=i.cameraPosition,d=-1*t.aV(h,u),p=t.bh();t.aP(p,h,[u[0]*d,u[1]*d,u[2]*d]);const f=t.bo(p)-1,A=Math.exp(.5*-Math.max(f-.3,0)),m=ri(i.worldSize,i.center.lat)/Math.min(i.width,i.height),g=t.bf(m,.9,.5,1,.25),_=(1-t.ac(-s))*Math.min(A,g),y=i.center.lat,v=i.zoom,x=new t.Q(i.center.lng+l*_,t.ae(i.center.lat+c*_,-85.051129,t.af));i.setLocationAtPoint(n,r);const b=i.center,w=t.bf(Math.abs(a),45,85,0,1),T=t.bf(m,.75,.35,0,1),B=Math.pow(Math.max(w,T),.25),C=t.bq(b.lng,x.lng),S=t.bq(b.lat,x.lat);i.setCenter(new t.Q(b.lng+C*B,b.lat+S*B).wrap()),i.setZoom(v+si(y,i.center.lat))}handleMapControlsPan(e,t,i){if(!e.panDelta)return;const r=t.center.lat,n=t.zoom;t.setCenter(ai(e.panDelta,t).wrap()),t.setZoom(n+si(r,t.center.lat))}cameraForBoxAndBearing(e,i,r,n,o){const s=Dt(e,i,r,n,o),a=i.left/o.width*2-1,l=(o.width-i.right)/o.width*2-1,c=i.top/o.height*-2+1,u=(o.height-i.bottom)/o.height*-2+1,h=t.bq(r.getWest(),r.getEast())<0,d=h?r.getEast():r.getWest(),p=h?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),A=Math.min(r.getNorth(),r.getSouth()),m=d+.5*t.bq(d,p),g=f+.5*t.bq(f,A),_=o.clone();_.setCenter(s.center),_.setBearing(s.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(s.zoom);const y=_.modelViewProjectionMatrix,v=[ii(r.getNorthWest()),ii(r.getNorthEast()),ii(r.getSouthWest()),ii(r.getSouthEast()),ii(new t.Q(p,g)),ii(new t.Q(d,g)),ii(new t.Q(m,f)),ii(new t.Q(m,A))],x=ii(s.center);let b=Number.POSITIVE_INFINITY;for(const e of v)a<0&&(b=mi.getLesserNonNegativeNonNull(b,mi.solveVectorScale(e,x,y,"x",a))),l>0&&(b=mi.getLesserNonNegativeNonNull(b,mi.solveVectorScale(e,x,y,"x",l))),c>0&&(b=mi.getLesserNonNegativeNonNull(b,mi.solveVectorScale(e,x,y,"y",c))),u<0&&(b=mi.getLesserNonNegativeNonNull(b,mi.solveVectorScale(e,x,y,"y",u)));if(Number.isFinite(b)&&0!==b)return s.zoom=_.zoom+t.ah(b),s;zt()}handleJumpToCenterZoom(e,i){const r=e.center.lat,n=e.getConstrained(i.center?t.Q.convert(i.center):e.center,e.zoom).center;e.setCenter(n.wrap());const o=void 0!==i.zoom?+i.zoom:e.zoom+si(r,n.lat);e.zoom!==o&&e.setZoom(o)}handleEaseTo(e,i){const r=e.zoom,n=e.center,o=e.padding,s={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},l=void 0!==i.zoom,c=!e.isPaddingEqual(i.padding);let u=!1;const h=i.center?t.Q.convert(i.center):n,d=e.getConstrained(h,r).center;Et(e,d);const p=e.clone();p.setCenter(d),p.setZoom(l?+i.zoom:r+si(n.lat,h.lat)),p.setBearing(i.bearing);const f=new t.P(t.ae(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.ae(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(d,f);const A=(i.offset&&i.offsetAsPoint.mag())>0?p.center:d,m=l?+i.zoom:r+si(n.lat,A.lat),g=r+si(n.lat,0),_=m+si(A.lat,0),y=t.bq(n.lng,A.lng),v=t.bq(n.lat,A.lat),x=t.ac(_-g);return u=m!==r,{easeFunc:r=>{if(t.b6(s,a)||Rt({startEulerAngles:s,endEulerAngles:a,tr:e,k:r,useSlerp:s.roll!=a.roll}),c&&e.interpolatePadding(o,i.padding,r),i.around)t.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const t=_>g?Math.min(2,x):Math.max(.5,x),i=Math.pow(t,1-r),o=ci(n,y,v,r*i);e.setCenter(o.wrap())}if(u){const i=t.B.number(g,_,r)+si(0,e.center.lat);e.setZoom(i)}},isZooming:u,elevationCenter:A}}handleFlyTo(e,i){const r=void 0!==i.zoom,n=e.center,o=e.zoom,s=e.padding,a=!e.isPaddingEqual(i.padding),l=e.getConstrained(t.Q.convert(i.center||i.locationAtOffset),o).center,c=r?+i.zoom:e.zoom+si(e.center.lat,l.lat),u=e.clone();u.setCenter(l),u.setZoom(c),u.setBearing(i.bearing);const h=new t.P(t.ae(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.ae(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));u.setLocationAtPoint(l,h);const d=u.center;Et(e,d);const p=function(e,i,r){const n=ii(i),o=ii(r),s=t.aV(n,o),a=Math.acos(s),l=ei(e);return a/(2*Math.PI)*l}(e,n,d),f=o+si(n.lat,0),A=c+si(d.lat,0),m=t.ac(A-f);let g;if("number"==typeof i.minZoom){const r=+i.minZoom+si(d.lat,0),n=Math.min(r,f,A)+si(0,d.lat),o=e.getConstrained(d,n).zoom+si(d.lat,0);g=t.ac(o-f)}const _=t.bq(n.lng,d.lng),y=t.bq(n.lat,d.lat);return{easeFunc:(r,o,l,u)=>{const h=ci(n,_,y,l);a&&e.interpolatePadding(s,i.padding,r);const p=1===r?d:h;e.setCenter(p.wrap());const A=f+t.ah(o);e.setZoom(1===r?c:A+si(0,p.lat))},scaleOfZoom:m,targetCenter:d,scaleOfMinZoom:g,pixelPathLength:p}}static solveVectorScale(e,t,i,r,n){const o="x"===r?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],s=[i[3],i[7],i[11],i[15]],a=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],l=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],c=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2];return c+n*l===a+n*u||s[3]*(a-c)+o[3]*(u-l)+a*u==c*l?null:(c+o[3]-n*u-n*s[3])/(c-a-n*u+n*l)}static getLesserNonNegativeNonNull(e,t){return null!==t&&t>=0&&tt.x(e,i&&i.filter((e=>"source.canvas"!==e.identifier))),yi=t.bw();class vi extends t.E{constructor(e,i={}){super(),this._rtlPluginLoaded=()=>{for(const e in this.sourceCaches){const t=this.sourceCaches[e].getSource().type;"vector"!==t&&"geojson"!==t||this.sourceCaches[e].reload()}},this.map=e,this.dispatcher=new D(R(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",((e,t)=>this.getGlyphs(e,t))),this.dispatcher.registerMessageHandler("GI",((e,t)=>this.getImages(e,t))),this.imageManager=new v,this.imageManager.setEventedParent(this),this.glyphManager=new T(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new I(256,512),this.crossTileSymbolIndex=new _t,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.bx,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",t.by()),ne().on(te,this._rtlPluginLoaded),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.sourceCaches[e.sourceId];if(!t)return;const i=t.getSource();if(i&&i.vectorLayerIds)for(const e in this._layers){const t=this._layers[e];t.source===i.id&&this._validateLayer(t)}}))}loadURL(e,i={},r){this.fire(new t.l("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const n=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const o=this._loadStyleRequest;t.j(n,this._loadStyleRequest).then((e=>{this._loadStyleRequest=null,this._load(e.data,i,r)})).catch((e=>{this._loadStyleRequest=null,e&&!o.signal.aborted&&this.fire(new t.k(e))}))}loadJSON(e,i={},r){this.fire(new t.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,s.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(e,i,r)})).catch((()=>{}))}loadEmpty(){this.fire(new t.l("dataloading",{dataType:"style"})),this._load(yi,{validate:!1})}_load(e,i,r){var n,o;const s=i.transformStyle?i.transformStyle(r,e):e;if(!i.validate||!_i(this,t.y(s))){this._loaded=!0,this.stylesheet=s;for(const e in s.sources)this.addSource(e,s.sources[e],{validate:!1});s.sprite?this._loadSprite(s.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(s.glyphs),this._createLayers(),this.light=new S(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new M(this.stylesheet.sky),this.map.setTerrain(null!==(o=this.stylesheet.terrain)&&void 0!==o?o:null),this.fire(new t.l("data",{dataType:"style"})),this.fire(new t.l("style.load"))}}_createLayers(){const e=t.bz(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map((e=>e.id)),this._layers={},this._serializedLayers=null;for(const i of e){const e=t.bA(i);e.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=e}}_loadSprite(e,i=!1,r=void 0){let n;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(e,i,r,n){return t._(this,void 0,void 0,(function*(){const o=m(e),a=r>1?"@2x":"",l={},c={};for(const{id:e,url:r}of o){const o=i.transformRequest(g(r,a,".json"),"SpriteJSON");l[e]=t.j(o,n);const s=i.transformRequest(g(r,a,".png"),"SpriteImage");c[e]=f.getImage(s,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(e,i){return t._(this,void 0,void 0,(function*(){const t={};for(const r in e){t[r]={};const n=s.getImageCanvasContext((yield i[r]).data),o=(yield e[r]).data;for(const e in o){const{width:i,height:s,x:a,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:A}=o[e];t[r][e]={data:null,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:A,spriteData:{width:i,height:s,x:a,y:l,context:n}}}}return t}))}(l,c)}))}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((e=>{if(this._spriteRequest=null,e)for(const t in e){this._spritesImagesIds[t]=[];const r=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in e))):[];for(const e of r)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(const r in e[t]){const n="default"===t?r:`${t}:${r}`;this._spritesImagesIds[t].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,e[t][r],!1):this.imageManager.addImage(n,e[t][r]),i&&(this._changedImages[n]=!0)}}})).catch((e=>{this._spriteRequest=null,n=e,this.fire(new t.k(n))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"})),r&&r(n)}))}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const r=e.sourceLayer;if(!r)return;const n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(r))&&this.fire(new t.k(new Error(`Source layer "${r}" does not exist on source "${n.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,i=!1){const r=this._serializedAllLayers();if(!e||0===e.length)return Object.values(i?t.bB(r):r);const n=[];for(const o of e)if(r[o]){const e=i?t.bB(r[o]):r[o];n.push(e)}return n}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const t=Object.keys(this._layers);for(const i of t){const t=this._layers[i];"custom"!==t.type&&(e[i]=t.serialize())}return e}hasTransitions(){var e,t,i;if(null===(e=this.light)||void 0===e?void 0:e.hasTransition())return!0;if(null===(t=this.sky)||void 0===t?void 0:t.hasTransition())return!0;if(null===(i=this.projection)||void 0===i?void 0:i.hasTransition())return!0;for(const e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].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(i){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const e in this._updatedSources){const t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const r={};for(const e in this.sourceCaches){const t=this.sourceCaches[e];r[e]=t.used,t.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 r){const i=this.sourceCaches[e];!!r[e]!=!!i.used&&i.fire(new t.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new t.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var r;this._checkLoaded();const n=this.serialize();if(e=i.transformStyle?i.transformStyle(n,e):e,(null===(r=i.validate)||void 0===r||r)&&_i(this,t.y(e)))return!1;(e=t.bB(e)).layers=t.bz(e.layers);const o=t.bC(n,e),s=this._getOperationsToPerform(o);if(s.unimplemented.length>0)throw new Error(`Unimplemented: ${s.unimplemented.join(", ")}.`);if(0===s.operations.length)return!1;for(const e of s.operations)e();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const t=[],i=[];for(const r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push((()=>this.addLayer.apply(this,r.args)));break;case"removeLayer":t.push((()=>this.removeLayer.apply(this,r.args)));break;case"setPaintProperty":t.push((()=>this.setPaintProperty.apply(this,r.args)));break;case"setLayoutProperty":t.push((()=>this.setLayoutProperty.apply(this,r.args)));break;case"setFilter":t.push((()=>this.setFilter.apply(this,r.args)));break;case"addSource":t.push((()=>this.addSource.apply(this,r.args)));break;case"removeSource":t.push((()=>this.removeSource.apply(this,r.args)));break;case"setLayerZoomRange":t.push((()=>this.setLayerZoomRange.apply(this,r.args)));break;case"setLight":t.push((()=>this.setLight.apply(this,r.args)));break;case"setGeoJSONSourceData":t.push((()=>this.setGeoJSONSourceData.apply(this,r.args)));break;case"setGlyphs":t.push((()=>this.setGlyphs.apply(this,r.args)));break;case"setSprite":t.push((()=>this.setSprite.apply(this,r.args)));break;case"setTerrain":t.push((()=>this.map.setTerrain.apply(this,r.args)));break;case"setSky":t.push((()=>this.setSky.apply(this,r.args)));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setTransition":t.push((()=>{}));break;default:i.push(r.command)}return{operations:t,unimplemented:i}}addImage(e,i){if(this.getImage(e))return this.fire(new t.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.k(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("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.y.source,`sources.${e}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=this.sourceCaches[e]=new ve(e,i,this.dispatcher);n.style=this,n.setEventedParent(this,(()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:e}))),n.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.k(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.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error(`There is no source with this ID=${e}`);const i=this.sourceCaches[e].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,i,r={}){this._checkLoaded();const n=e.id;if(this.getLayer(n))return void this.fire(new t.k(new Error(`Layer "${n}" already exists on this map.`)));let o;if("custom"===e.type){if(_i(this,t.bD(e)))return;o=t.bA(e)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=t.bB(e),e=t.e(e,{source:n})),this._validate(t.y.layer,`layers.${n}`,e,{arrayIndex:-1},r))return;o=t.bA(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)this.fire(new t.k(new Error(`Cannot add layer "${n}" before non-existing layer "${i}".`)));else{if(this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source&&"custom"!==o.type){const e=this._removedLayers[n];delete this._removedLayers[n],e.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.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const r=this._order.indexOf(e);this._order.splice(r,1);const n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new t.k(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.k(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const r=this._order.indexOf(e);this._order.splice(r,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(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,r){this._checkLoaded();const n=this.getLayer(e);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new t.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,r={}){this._checkLoaded();const n=this.getLayer(e);if(n){if(!t.bE(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.y.filter,`layers.${n.id}.filter`,i,null,r)||(n.filter=t.bB(i),this._updateLayer(n)))}else this.fire(new t.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bB(this.getLayer(e).filter)}setLayoutProperty(e,i,r,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bE(o.getLayoutProperty(i),r)||(o.setLayoutProperty(i,r,n),this._updateLayer(o)):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,r,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bE(o.getPaintProperty(i),r)||(o.setPaintProperty(i,r,n)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,i){this._checkLoaded();const r=e.source,n=e.sourceLayer,o=this.sourceCaches[r];if(void 0===o)return void this.fire(new t.k(new Error(`The source '${r}' does not exist in the map's style.`)));const s=o.getSource().type;"geojson"===s&&n?this.fire(new t.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||n?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,e.id,i)):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const r=e.source,n=this.sourceCaches[r];if(void 0===n)return void this.fire(new t.k(new Error(`The source '${r}' does not exist in the map's style.`)));const o=n.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.k(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(s,e.id,i):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,r=e.sourceLayer,n=this.sourceCaches[i];if(void 0!==n)return"vector"!==n.getSource().type||r?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),n.getFeatureState(r,e.id)):void this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=t.bF(this.sourceCaches,(e=>e.serialize())),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,n=this.stylesheet;return t.bG({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:e,layers:i,terrain:r},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.sourceCaches[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,i={},r=[];for(let n=this._order.length-1;n>=0;n--){const o=this._order[n];if(t(o)){i[o]=n;for(const t of e){const e=t[o];if(e)for(const t of e)r.push(t)}}}r.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const n=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if(t(s))for(let e=r.length-1;e>=0;e--){const t=r[e].feature;if(i[t.layer.id]this.map.terrain.getElevation(e,t,i):void 0));return this.placement&&o.push(function(e,t,i,r,n,o,s){const a={},l=o.queryRenderedSymbols(r),c=[];for(const e of Object.keys(l).map(Number))c.push(s[e]);c.sort(Q);for(const i of c){const r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(const e in r){const t=a[e]=a[e]||[],n=r[e];n.sort(((e,t)=>{const r=i.featureSortOrder;if(r){const i=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex}));for(const e of n)t.push(e)}}return function(e,t,i){for(const r in e)for(const n of e[r])j(n,i[t[r].source]);return e}(a,e,i)}(this._layers,s,this.sourceCaches,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.y.filter,"querySourceFeatures.filter",i.filter,null,i);const r=this.sourceCaches[e];return r?function(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],n={};for(let e=0;ee.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.now(),e.zoom))&&(this.pauseablePlacement=new pt(e,this.map.terrain,this._order,n,t,i,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(s.now()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(const e of this._order){const t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,l[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(s.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,i){return t._(this,void 0,void 0,(function*(){const e=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const t=this.sourceCaches[i.source];return t&&t.setDependencies(i.tileID.key,i.type,i.icons),e}))}getGlyphs(e,i){return t._(this,void 0,void 0,(function*(){const e=yield this.glyphManager.getGlyphs(i.stacks),t=this.sourceCaches[i.source];return t&&t.setDependencies(i.tileID.key,i.type,[""]),e}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.y.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,r={},n){this._checkLoaded();const o=[{id:e,url:i}],s=[...m(this.stylesheet.sprite),...o];this._validate(t.y.sprite,"sprite",s,null,r)||(this.stylesheet.sprite=s,this._loadSprite(o,!0,n))}removeSprite(e){this._checkLoaded();const i=m(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("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}else this.fire(new t.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return m(this.stylesheet.sprite)}setSprite(e,i={},r){this._checkLoaded(),e&&this._validate(t.y.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}}var xi=t.aG([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class bi{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,r,n,o,s,a,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!c&&e({u_texture:0,u_ele_delta:e,u_fog_matrix:i,u_fog_color:r?r.properties.get("fog-color"):t.b7.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:r?r.calculateFogBlendOpacity(n):0,u_horizon_color:r?r.properties.get("horizon-color"):t.b7.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),Ti={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Bi(e){const t=[];for(let i=0;i({u_depth:new t.bH(e,i.u_depth),u_terrain:new t.bH(e,i.u_terrain),u_terrain_dim:new t.b8(e,i.u_terrain_dim),u_terrain_matrix:new t.bJ(e,i.u_terrain_matrix),u_terrain_unpack:new t.bK(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.b8(e,i.u_terrain_exaggeration)}))(e,T),this.projectionUniforms=((e,i)=>({u_projection_matrix:new t.bJ(e,i.u_projection_matrix),u_projection_tile_mercator_coords:new t.bK(e,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.bK(e,i.u_projection_clipping_plane),u_projection_transition:new t.b8(e,i.u_projection_transition),u_projection_fallback_matrix:new t.bJ(e,i.u_projection_fallback_matrix)}))(e,T),this.binderUniforms=r?r.getUniforms(e,T):[]}draw(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_){const y=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(n),e.setCullFace(o),a){e.activeTexture.set(y.TEXTURE2),y.bindTexture(y.TEXTURE_2D,a.depthTexture),e.activeTexture.set(y.TEXTURE3),y.bindTexture(y.TEXTURE_2D,a.texture);for(const e in this.terrainUniforms)this.terrainUniforms[e].set(a[e])}if(l)for(const e in l)this.projectionUniforms[Ti[e]].set(l[e]);if(s)for(const e in this.fixedUniforms)this.fixedUniforms[e].set(s[e]);A&&A.setUniforms(e,this.binderUniforms,p,{zoom:f});let v=0;switch(t){case y.LINES:v=2;break;case y.TRIANGLES:v=3;break;case y.LINE_STRIP:v=1}for(const i of d.get()){const r=i.vaos||(i.vaos={});(r[c]||(r[c]=new bi)).bind(e,this,u,A?A.getPaintVertexBuffers():[],h,i.vertexOffset,m,g,_),y.drawElements(t,i.primitiveLength*v,y.UNSIGNED_SHORT,i.primitiveOffset*v*2)}}}function Si(e,i,r){const n=1/t.az(r,1,i.transform.tileZoom),o=Math.pow(2,r.tileID.overscaledZ),s=r.tileSize*Math.pow(2,i.transform.tileZoom)/o,a=s*(r.tileID.canonical.x+r.tileID.wrap*o),l=s*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[n,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[a>>16,l>>16],u_pixel_coord_lower:[65535&a,65535&l]}}const Ei=(e,i,r,n)=>{const o=e.style.light,s=o.properties.get("position"),a=[s.x,s.y,s.z],l=t.bN();"viewport"===o.properties.get("anchor")&&t.bO(l,e.transform.bearingInRadians),t.bP(a,a,l);const c=e.transform.transformLightDirection(a),u=o.properties.get("color");return{u_lightpos:a,u_lightpos_globe:c,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:n}},Mi=(e,i,r,n,o,s,a)=>t.e(Ei(e,i,r,n),Si(s,e,a),{u_height_factor:-Math.pow(2,o.overscaledZ)/a.tileSize/8}),Ii=(e,i,r,n)=>t.e(Si(i,e,r),{u_fill_translate:n}),Pi=(e,t)=>({u_world:e,u_fill_translate:t}),Li=(e,i,r,n,o)=>t.e(Ii(e,i,r,o),{u_world:n}),Fi=(e,i,r,n,o)=>{const s=e.transform;let a,l,c=0;if("map"===r.paint.get("circle-pitch-alignment")){const e=t.az(i,1,s.zoom);a=!0,l=[e,e],c=e/(t.Z*Math.pow(2,i.tileID.overscaledZ))*2*Math.PI*o}else a=!1,l=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+a,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:n}},ki=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),zi=e=>({u_viewport_size:[e.width,e.height]}),Ri=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),Di=(e,i,r,n)=>{const o=t.az(e,1,i)/(t.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:t.az(e,1,i),u_intensity:r,u_globe_extrude_scale:o}},Oi=(e,i,r,n)=>{const o=t.K();t.bQ(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:r,u_color_ramp:n,u_opacity:i.paint.get("heatmap-opacity")}},Ui=(e,t,i)=>{const r=i.paint.get("hillshade-shadow-color"),n=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color");let s=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return"viewport"===i.paint.get("hillshade-illumination-anchor")&&(s+=e.transform.bearingInRadians),{u_image:0,u_latrange:Qi(0,t.tileID),u_light:[i.paint.get("hillshade-exaggeration"),s],u_shadow:r,u_highlight:n,u_accent:o}},Ni=(e,i)=>{const r=i.stride,n=t.K();return t.bQ(n,0,t.Z,-8192,0,0,1),t.L(n,n,[0,-8192,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}};function Qi(e,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new t.$(0,n/r).toLngLat().lat,new t.$(0,(n+1)/r).toLngLat().lat]}const ji=(e,i,r,n)=>{const o=e.transform;return{u_translation:Zi(e,i,r),u_ratio:n/t.az(i,1,o.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Vi=(e,i,r,n,o)=>t.e(ji(e,i,r,n),{u_image:0,u_image_height:o}),Hi=(e,i,r,n,o)=>{const s=e.transform,a=$i(i,s);return{u_translation:Zi(e,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:n/t.az(i,1,s.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[a,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},Gi=(e,i,r,n,o,s)=>{const a=e.lineAtlas,l=$i(i,e.transform),c="round"===r.layout.get("line-cap"),u=a.getDash(o.from,c),h=a.getDash(o.to,c),d=u.width*s.fromScale,p=h.width*s.toScale;return t.e(ji(e,i,r,n),{u_patternscale_a:[l/d,-u.height/2],u_patternscale_b:[l/p,-h.height/2],u_sdfgamma:a.width/(256*Math.min(d,p)*e.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:h.y,u_mix:s.t})};function $i(e,i){return 1/t.az(e,1,i.tileZoom)}function Zi(e,i,r){return t.aA(e.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const qi=(e,t,i,r,n)=>{return{u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.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:Ki(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]};var o,s};function Ki(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const Wi=(e,t,i,r,n,o,s,a,l,c,u,h,d)=>{const p=s.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:p.width/p.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:o,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:d}},Xi=(e,i,r,n,o,s,a,l,c,u,h,d,p,f)=>{const A=a.transform;return t.e(Wi(e,i,r,n,o,s,a,l,c,u,h,d,f),{u_gamma_scale:n?Math.cos(A.pitch*Math.PI/180)*A.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:1})},Yi=(e,i,r,n,o,s,a,l,c,u,h,d,p)=>t.e(Xi(e,i,r,n,o,s,a,l,c,u,!0,h,0,p),{u_texsize_icon:d,u_texture_icon:1}),Ji=(e,t)=>({u_opacity:e,u_color:t}),er=(e,i,r,n,o)=>t.e(function(e,i,r,n){const o=r.imageManager.getPattern(e.from.toString()),s=r.imageManager.getPattern(e.to.toString()),{width:a,height:l}=r.imageManager.getPixelSize(),c=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,r.transform.tileZoom)/c,h=u*(n.tileID.canonical.x+n.tileID.wrap*c),d=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[a,l],u_mix:i.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/t.az(n,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(r,o,i,n),{u_opacity:e}),tr=(e,t)=>{},ir={fillExtrusion:(e,i)=>({u_lightpos:new t.bL(e,i.u_lightpos),u_lightpos_globe:new t.bL(e,i.u_lightpos_globe),u_lightintensity:new t.b8(e,i.u_lightintensity),u_lightcolor:new t.bL(e,i.u_lightcolor),u_vertical_gradient:new t.b8(e,i.u_vertical_gradient),u_opacity:new t.b8(e,i.u_opacity),u_fill_translate:new t.bM(e,i.u_fill_translate)}),fillExtrusionPattern:(e,i)=>({u_lightpos:new t.bL(e,i.u_lightpos),u_lightpos_globe:new t.bL(e,i.u_lightpos_globe),u_lightintensity:new t.b8(e,i.u_lightintensity),u_lightcolor:new t.bL(e,i.u_lightcolor),u_vertical_gradient:new t.b8(e,i.u_vertical_gradient),u_height_factor:new t.b8(e,i.u_height_factor),u_opacity:new t.b8(e,i.u_opacity),u_fill_translate:new t.bM(e,i.u_fill_translate),u_image:new t.bH(e,i.u_image),u_texsize:new t.bM(e,i.u_texsize),u_pixel_coord_upper:new t.bM(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bM(e,i.u_pixel_coord_lower),u_scale:new t.bL(e,i.u_scale),u_fade:new t.b8(e,i.u_fade)}),fill:(e,i)=>({u_fill_translate:new t.bM(e,i.u_fill_translate)}),fillPattern:(e,i)=>({u_image:new t.bH(e,i.u_image),u_texsize:new t.bM(e,i.u_texsize),u_pixel_coord_upper:new t.bM(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bM(e,i.u_pixel_coord_lower),u_scale:new t.bL(e,i.u_scale),u_fade:new t.b8(e,i.u_fade),u_fill_translate:new t.bM(e,i.u_fill_translate)}),fillOutline:(e,i)=>({u_world:new t.bM(e,i.u_world),u_fill_translate:new t.bM(e,i.u_fill_translate)}),fillOutlinePattern:(e,i)=>({u_world:new t.bM(e,i.u_world),u_image:new t.bH(e,i.u_image),u_texsize:new t.bM(e,i.u_texsize),u_pixel_coord_upper:new t.bM(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bM(e,i.u_pixel_coord_lower),u_scale:new t.bL(e,i.u_scale),u_fade:new t.b8(e,i.u_fade),u_fill_translate:new t.bM(e,i.u_fill_translate)}),circle:(e,i)=>({u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_scale_with_map:new t.bH(e,i.u_scale_with_map),u_pitch_with_map:new t.bH(e,i.u_pitch_with_map),u_extrude_scale:new t.bM(e,i.u_extrude_scale),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_globe_extrude_scale:new t.b8(e,i.u_globe_extrude_scale),u_translate:new t.bM(e,i.u_translate)}),collisionBox:(e,i)=>({u_pixel_extrude_scale:new t.bM(e,i.u_pixel_extrude_scale)}),collisionCircle:(e,i)=>({u_viewport_size:new t.bM(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.bI(e,i.u_color),u_overlay:new t.bH(e,i.u_overlay),u_overlay_scale:new t.b8(e,i.u_overlay_scale)}),depth:tr,clippingMask:tr,heatmap:(e,i)=>({u_extrude_scale:new t.b8(e,i.u_extrude_scale),u_intensity:new t.b8(e,i.u_intensity),u_globe_extrude_scale:new t.b8(e,i.u_globe_extrude_scale)}),heatmapTexture:(e,i)=>({u_matrix:new t.bJ(e,i.u_matrix),u_world:new t.bM(e,i.u_world),u_image:new t.bH(e,i.u_image),u_color_ramp:new t.bH(e,i.u_color_ramp),u_opacity:new t.b8(e,i.u_opacity)}),hillshade:(e,i)=>({u_image:new t.bH(e,i.u_image),u_latrange:new t.bM(e,i.u_latrange),u_light:new t.bM(e,i.u_light),u_shadow:new t.bI(e,i.u_shadow),u_highlight:new t.bI(e,i.u_highlight),u_accent:new t.bI(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.bJ(e,i.u_matrix),u_image:new t.bH(e,i.u_image),u_dimension:new t.bM(e,i.u_dimension),u_zoom:new t.b8(e,i.u_zoom),u_unpack:new t.bK(e,i.u_unpack)}),line:(e,i)=>({u_translation:new t.bM(e,i.u_translation),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bM(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_translation:new t.bM(e,i.u_translation),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bM(e,i.u_units_to_pixels),u_image:new t.bH(e,i.u_image),u_image_height:new t.b8(e,i.u_image_height)}),linePattern:(e,i)=>({u_translation:new t.bM(e,i.u_translation),u_texsize:new t.bM(e,i.u_texsize),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_image:new t.bH(e,i.u_image),u_units_to_pixels:new t.bM(e,i.u_units_to_pixels),u_scale:new t.bL(e,i.u_scale),u_fade:new t.b8(e,i.u_fade)}),lineSDF:(e,i)=>({u_translation:new t.bM(e,i.u_translation),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bM(e,i.u_units_to_pixels),u_patternscale_a:new t.bM(e,i.u_patternscale_a),u_patternscale_b:new t.bM(e,i.u_patternscale_b),u_sdfgamma:new t.b8(e,i.u_sdfgamma),u_image:new t.bH(e,i.u_image),u_tex_y_a:new t.b8(e,i.u_tex_y_a),u_tex_y_b:new t.b8(e,i.u_tex_y_b),u_mix:new t.b8(e,i.u_mix)}),raster:(e,i)=>({u_tl_parent:new t.bM(e,i.u_tl_parent),u_scale_parent:new t.b8(e,i.u_scale_parent),u_buffer_scale:new t.b8(e,i.u_buffer_scale),u_fade_t:new t.b8(e,i.u_fade_t),u_opacity:new t.b8(e,i.u_opacity),u_image0:new t.bH(e,i.u_image0),u_image1:new t.bH(e,i.u_image1),u_brightness_low:new t.b8(e,i.u_brightness_low),u_brightness_high:new t.b8(e,i.u_brightness_high),u_saturation_factor:new t.b8(e,i.u_saturation_factor),u_contrast_factor:new t.b8(e,i.u_contrast_factor),u_spin_weights:new t.bL(e,i.u_spin_weights),u_coords_top:new t.bK(e,i.u_coords_top),u_coords_bottom:new t.bK(e,i.u_coords_bottom)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.bH(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bH(e,i.u_is_size_feature_constant),u_size_t:new t.b8(e,i.u_size_t),u_size:new t.b8(e,i.u_size),u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_pitch:new t.b8(e,i.u_pitch),u_rotate_symbol:new t.bH(e,i.u_rotate_symbol),u_aspect_ratio:new t.b8(e,i.u_aspect_ratio),u_fade_change:new t.b8(e,i.u_fade_change),u_label_plane_matrix:new t.bJ(e,i.u_label_plane_matrix),u_coord_matrix:new t.bJ(e,i.u_coord_matrix),u_is_text:new t.bH(e,i.u_is_text),u_pitch_with_map:new t.bH(e,i.u_pitch_with_map),u_is_along_line:new t.bH(e,i.u_is_along_line),u_is_variable_anchor:new t.bH(e,i.u_is_variable_anchor),u_texsize:new t.bM(e,i.u_texsize),u_texture:new t.bH(e,i.u_texture),u_translation:new t.bM(e,i.u_translation),u_pitched_scale:new t.b8(e,i.u_pitched_scale)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.bH(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bH(e,i.u_is_size_feature_constant),u_size_t:new t.b8(e,i.u_size_t),u_size:new t.b8(e,i.u_size),u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_pitch:new t.b8(e,i.u_pitch),u_rotate_symbol:new t.bH(e,i.u_rotate_symbol),u_aspect_ratio:new t.b8(e,i.u_aspect_ratio),u_fade_change:new t.b8(e,i.u_fade_change),u_label_plane_matrix:new t.bJ(e,i.u_label_plane_matrix),u_coord_matrix:new t.bJ(e,i.u_coord_matrix),u_is_text:new t.bH(e,i.u_is_text),u_pitch_with_map:new t.bH(e,i.u_pitch_with_map),u_is_along_line:new t.bH(e,i.u_is_along_line),u_is_variable_anchor:new t.bH(e,i.u_is_variable_anchor),u_texsize:new t.bM(e,i.u_texsize),u_texture:new t.bH(e,i.u_texture),u_gamma_scale:new t.b8(e,i.u_gamma_scale),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_is_halo:new t.bH(e,i.u_is_halo),u_translation:new t.bM(e,i.u_translation),u_pitched_scale:new t.b8(e,i.u_pitched_scale)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.bH(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bH(e,i.u_is_size_feature_constant),u_size_t:new t.b8(e,i.u_size_t),u_size:new t.b8(e,i.u_size),u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_pitch:new t.b8(e,i.u_pitch),u_rotate_symbol:new t.bH(e,i.u_rotate_symbol),u_aspect_ratio:new t.b8(e,i.u_aspect_ratio),u_fade_change:new t.b8(e,i.u_fade_change),u_label_plane_matrix:new t.bJ(e,i.u_label_plane_matrix),u_coord_matrix:new t.bJ(e,i.u_coord_matrix),u_is_text:new t.bH(e,i.u_is_text),u_pitch_with_map:new t.bH(e,i.u_pitch_with_map),u_is_along_line:new t.bH(e,i.u_is_along_line),u_is_variable_anchor:new t.bH(e,i.u_is_variable_anchor),u_texsize:new t.bM(e,i.u_texsize),u_texsize_icon:new t.bM(e,i.u_texsize_icon),u_texture:new t.bH(e,i.u_texture),u_texture_icon:new t.bH(e,i.u_texture_icon),u_gamma_scale:new t.b8(e,i.u_gamma_scale),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_is_halo:new t.bH(e,i.u_is_halo),u_translation:new t.bM(e,i.u_translation),u_pitched_scale:new t.b8(e,i.u_pitched_scale)}),background:(e,i)=>({u_opacity:new t.b8(e,i.u_opacity),u_color:new t.bI(e,i.u_color)}),backgroundPattern:(e,i)=>({u_opacity:new t.b8(e,i.u_opacity),u_image:new t.bH(e,i.u_image),u_pattern_tl_a:new t.bM(e,i.u_pattern_tl_a),u_pattern_br_a:new t.bM(e,i.u_pattern_br_a),u_pattern_tl_b:new t.bM(e,i.u_pattern_tl_b),u_pattern_br_b:new t.bM(e,i.u_pattern_br_b),u_texsize:new t.bM(e,i.u_texsize),u_mix:new t.b8(e,i.u_mix),u_pattern_size_a:new t.bM(e,i.u_pattern_size_a),u_pattern_size_b:new t.bM(e,i.u_pattern_size_b),u_scale_a:new t.b8(e,i.u_scale_a),u_scale_b:new t.b8(e,i.u_scale_b),u_pixel_coord_upper:new t.bM(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bM(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.b8(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_texture:new t.bH(e,i.u_texture),u_ele_delta:new t.b8(e,i.u_ele_delta),u_fog_matrix:new t.bJ(e,i.u_fog_matrix),u_fog_color:new t.bI(e,i.u_fog_color),u_fog_ground_blend:new t.b8(e,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.b8(e,i.u_fog_ground_blend_opacity),u_horizon_color:new t.bI(e,i.u_horizon_color),u_horizon_fog_blend:new t.b8(e,i.u_horizon_fog_blend),u_is_globe_mode:new t.b8(e,i.u_is_globe_mode)}),terrainDepth:(e,i)=>({u_ele_delta:new t.b8(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_texture:new t.bH(e,i.u_texture),u_terrain_coords_id:new t.b8(e,i.u_terrain_coords_id),u_ele_delta:new t.b8(e,i.u_ele_delta)}),projectionErrorMeasurement:(e,i)=>({u_input:new t.b8(e,i.u_input),u_output_expected:new t.b8(e,i.u_output_expected)}),atmosphere:(e,i)=>({u_sun_pos:new t.bL(e,i.u_sun_pos),u_atmosphere_blend:new t.b8(e,i.u_atmosphere_blend),u_globe_position:new t.bL(e,i.u_globe_position),u_globe_radius:new t.b8(e,i.u_globe_radius),u_inv_proj_matrix:new t.bJ(e,i.u_inv_proj_matrix)}),sky:(e,i)=>({u_sky_color:new t.bI(e,i.u_sky_color),u_horizon_color:new t.bI(e,i.u_horizon_color),u_horizon:new t.bM(e,i.u_horizon),u_horizon_normal:new t.bM(e,i.u_horizon_normal),u_sky_horizon_blend:new t.b8(e,i.u_sky_horizon_blend),u_sky_blend:new t.b8(e,i.u_sky_blend)})};class rr{constructor(e,t,i){this.context=e;const r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const nr={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class or{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i0&&(u.push({circleArray:m,circleOffset:d,coord:p}),h+=m.length/4,d=h),A&&c.draw(s,l.LINES,jt.disabled,Ht.disabled,e.colorModeForRenderPass(),Qt.disabled,ki(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(p),a.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,A.layoutVertexBuffer,A.indexBuffer,A.segments,null,e.transform.zoom,null,null,A.collisionVertexBuffer)}if(!o||!u.length)return;const p=e.useProgram("collisionCircle"),f=new t.bR;f.resize(4*h),f._trim();let A=0;for(const e of u)for(let t=0;t=0&&(m[g.associatedIconIndex]={shiftedAnchor:E,angle:M})}else Ge(g.numGlyphs,f)}if(c){A.clear();const i=e.icon.placedSymbolArray;for(let e=0;ee.style.map.terrain.getElevation(l,t,i):null,i="map"===r.layout.get("text-rotation-alignment");Le(c,e,o,O,U,_,u,i,l.toUnwrapped(),m.width,m.height,Q,t)}const G=o&&T||H,$=y||G?Zr:_?O:e.transform.clipSpaceToPixelsMatrix,Z=f&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let q;q=f?c.iconsInText?Yi(w.kind,M,v,_,y,G,e,$,N,Q,P,z,C):Xi(w.kind,M,v,_,y,G,e,$,N,Q,o,P,0,C):Wi(w.kind,M,v,_,y,G,e,$,N,Q,o,P,C);const K={program:E,buffers:h,uniformValues:q,projectionData:j,atlasTexture:L,atlasTextureIcon:R,atlasInterpolation:F,atlasInterpolationIcon:k,isSDF:f,hasHalo:Z};if(x&&c.canOverlap){b=!0;const e=h.segments.get();for(const i of e)B.push({segments:new t.aJ([i]),sortKey:i.sortKey,state:K,terrainData:I})}else B.push({segments:h.segments,sortKey:0,state:K,terrainData:I})}b&&B.sort(((e,t)=>e.sortKey-t.sortKey));for(const t of B){const i=t.state;if(f.activeTexture.set(A.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,A.CLAMP_TO_EDGE),i.atlasTextureIcon&&(f.activeTexture.set(A.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,A.CLAMP_TO_EDGE)),i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Jr(i.buffers,t.segments,r,e,i.program,w,h,d,n,i.projectionData,t.terrainData)),n.u_is_halo=0}Jr(i.buffers,t.segments,r,e,i.program,w,h,d,i.uniformValues,i.projectionData,t.terrainData)}}function Jr(e,t,i,r,n,o,s,a,l,c,u){const h=r.context;n.draw(h,h.gl.TRIANGLES,o,s,a,Qt.backCCW,l,u,c,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function en(e,i,r,n,o){const s=e.context,a=s.gl,l=Ht.disabled,c=new Ut([a.ONE,a.ONE],t.b7.transparent,[!0,!0,!0,!0]),u=i.getBucket(r);if(!u)return;const h=n.key;let d=r.heatmapFbos.get(h);d||(d=rn(s,i.tileSize,i.tileSize),r.heatmapFbos.set(h,d)),s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,i.tileSize,i.tileSize]),s.clear({color:t.b7.transparent});const p=u.programConfigurations.get(r.id),f=e.useProgram("heatmap",p,!o),A=e.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),m=e.style.map.terrain.getTerrainData(n);f.draw(s,a.TRIANGLES,jt.disabled,l,c,Qt.disabled,Di(i,e.transform.zoom,r.paint.get("heatmap-intensity"),1),m,A,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,p)}function tn(e,t,i,r,n){const o=e.context,s=o.gl,a=e.transform;o.setColorMode(e.colorModeForRenderPass());const l=nn(o,t),c=i.key,u=t.heatmapFbos.get(c);if(!u)return;o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u.colorAttachment.get()),o.activeTexture.set(s.TEXTURE1),l.bind(s.LINEAR,s.CLAMP_TO_EDGE);const h=a.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});e.useProgram("heatmapTexture").draw(o,s.TRIANGLES,jt.disabled,Ht.disabled,e.colorModeForRenderPass(),Qt.disabled,Oi(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,a.zoom),u.destroy(),t.heatmapFbos.delete(c)}function rn(e,t,i){var r,n;const o=e.gl,s=o.createTexture();o.bindTexture(o.TEXTURE_2D,s),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);const a=null!==(r=e.HALF_FLOAT)&&void 0!==r?r:o.UNSIGNED_BYTE,l=null!==(n=e.RGBA16F)&&void 0!==n?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,t,i,0,o.RGBA,a,null);const c=e.createFramebuffer(t,i,!1,!1);return c.colorAttachment.set(s),c}function nn(e,t){return t.colorRampTexture||(t.colorRampTexture=new _(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function on(e,t,i,r,n){if(!i||!r||!r.imageAtlas)return;const o=r.imageAtlas.patternPositions;let s=o[i.to.toString()],a=o[i.from.toString()];if(!s&&a&&(s=a),!a&&s&&(a=s),!s||!a){const e=n.getPaintProperty(t);s=o[e],a=o[e]}s&&a&&e.setConstantPatternPositions(s,a)}function sn(e,i,r,n,o,s,a,l){const c=e.context.gl,u="fill-pattern",h=r.paint.get(u),d=h&&h.constantOr(1),p=r.getCrossfadeParameters();let f,A,m,g,_;const y=e.transform,v=r.paint.get("fill-translate"),x=r.paint.get("fill-translate-anchor");a?(A=d&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=c.LINES):(A=d?"fillPattern":"fill",f=c.TRIANGLES);const b=h.constantOr(null);for(const h of n){const w=i.getTile(h);if(d&&!w.patternsLoaded())continue;const T=w.getBucket(r);if(!T)continue;const B=T.programConfigurations.get(r.id),C=e.useProgram(A,B),S=e.style.map.terrain&&e.style.map.terrain.getTerrainData(h);d&&(e.context.activeTexture.set(c.TEXTURE0),w.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),B.updatePaintBuffers(p)),on(B,u,b,w,r);const E=y.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),M=t.aA(y,w,v,x);if(a){g=T.indexBuffer2,_=T.segments2;const t=[c.drawingBufferWidth,c.drawingBufferHeight];m="fillOutlinePattern"===A&&d?Li(e,p,w,t,M):Pi(t,M)}else g=T.indexBuffer,_=T.segments,m=d?Ii(e,p,w,M):{u_fill_translate:M};let I;if("translucent"===e.renderPass&&l){const[t]=e.getStencilConfigForOverlapAndUpdateStencilID(n);I=t[h.overscaledZ]}else I=e.stencilModeForClipping(h);C.draw(e.context,f,o,I,s,Qt.backCCW,m,S,E,r.id,T.layoutVertexBuffer,g,_,r.paint,e.transform.zoom,B)}}function an(e,i,r,n,o,s,a,l){const c=e.context,u=c.gl,h="fill-extrusion-pattern",d=r.paint.get(h),p=d.constantOr(1),f=r.getCrossfadeParameters(),A=r.paint.get("fill-extrusion-opacity"),m=d.constantOr(null),g=e.transform;for(const d of n){const n=i.getTile(d),_=n.getBucket(r);if(!_)continue;const y=e.style.map.terrain&&e.style.map.terrain.getTerrainData(d),v=_.programConfigurations.get(r.id),x=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",v);p&&(e.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),v.updatePaintBuffers(f));const b=g.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!l,applyTerrainMatrix:!0});on(v,h,m,n,r);const w=t.aA(g,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),T=r.paint.get("fill-extrusion-vertical-gradient"),B=p?Mi(e,T,A,w,d,f,n):Ei(e,T,A,w);x.draw(c,c.gl.TRIANGLES,o,s,a,Qt.backCCW,B,y,b,r.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,r.paint,e.transform.zoom,v,e.style.map.terrain&&_.centroidVertexBuffer)}}function ln(e,t,i,r,n,o,s,a,l){var c;const u=e.style.projection,h=e.context,d=e.transform,p=h.gl,f=e.useProgram("hillshade"),A=!e.options.moving;for(const m of r){const r=t.getTile(m),g=r.fbo;if(!g)continue;const _=u.getMeshFromTileID(h,m.canonical,a,!0,"raster"),y=null===(c=e.style.map.terrain)||void 0===c?void 0:c.getTerrainData(m);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,g.colorAttachment.get());const v=d.getProjectionData({overscaledTileID:m,aligned:A,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(h,p.TRIANGLES,o,n[m.overscaledZ],s,Qt.backCCW,Ui(e,r,i),y,v,i.id,_.vertexBuffer,_.indexBuffer,_.segments)}}const cn=[new t.P(0,0),new t.P(t.Z,0),new t.P(t.Z,t.Z),new t.P(0,t.Z)];function un(e,t,i,r,n,o,s,a,l=!1,c=!1){const u=r[r.length-1].overscaledZ,h=e.context,d=h.gl,p=e.useProgram("raster"),f=e.transform,A=e.style.projection,m=e.colorModeForRenderPass(),g=!e.options.moving;for(const _ of r){const r=e.getDepthModeForSublayer(_.overscaledZ-u,1===i.paint.get("raster-opacity")?jt.ReadWrite:jt.ReadOnly,d.LESS),y=t.getTile(_);y.registerFadeDuration(i.paint.get("raster-fade-duration"));const v=t.findLoadedParent(_,0),x=t.findLoadedSibling(_),b=hn(y,v||x||null,t,i,e.transform,e.style.map.terrain);let w,T;const B="nearest"===i.paint.get("raster-resampling")?d.NEAREST:d.LINEAR;h.activeTexture.set(d.TEXTURE0),y.texture.bind(B,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(d.TEXTURE1),v?(v.texture.bind(B,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),w=Math.pow(2,v.tileID.overscaledZ-y.tileID.overscaledZ),T=[y.tileID.canonical.x*w%1,y.tileID.canonical.y*w%1]):y.texture.bind(B,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),y.texture.useMipmap&&h.extTextureFilterAnisotropic&&e.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const C=e.style.map.terrain&&e.style.map.terrain.getTerrainData(_),S=f.getProjectionData({overscaledTileID:_,aligned:g,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),E=qi(T||[0,0],w||1,b,i,a),M=A.getMeshFromTileID(h,_.canonical,o,s,"raster");p.draw(h,d.TRIANGLES,r,n?n[_.overscaledZ]:Ht.disabled,m,l?Qt.frontCCW:Qt.backCCW,E,C,S,i.id,M.vertexBuffer,M.indexBuffer,M.segments)}}function hn(e,i,r,n,o,a){const l=n.paint.get("raster-fade-duration");if(!a&&l>0){const n=s.now(),a=(n-e.timeAdded)/l,c=i?(n-i.timeAdded)/l:-1,u=r.getSource(),h=_e(o,{tileSize:u.tileSize,roundZoom:u.roundZoom}),d=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),p=d&&e.refreshedUponExpiration?1:t.ae(d?a:1-c,0,1);return e.refreshedUponExpiration&&a>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const dn=new t.b7(1,0,0,1),pn=new t.b7(0,1,0,1),fn=new t.b7(0,0,1,1),An=new t.b7(1,0,1,1),mn=new t.b7(0,1,1,1);function gn(e,t,i,r){yn(e,0,t+i/2,e.transform.width,i,r)}function _n(e,t,i,r){yn(e,t-i/2,0,i,e.transform.height,r)}function yn(e,t,i,r,n,o){const s=e.context,a=s.gl;a.enable(a.SCISSOR_TEST),a.scissor(t*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,n*e.pixelRatio),s.clear({color:o}),a.disable(a.SCISSOR_TEST)}function vn(e,i,r){const n=e.context,o=n.gl,s=e.useProgram("debug"),a=jt.disabled,l=Ht.disabled,c=e.colorModeForRenderPass(),u="$debug",h=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r);n.activeTexture.set(o.TEXTURE0);const d=i.getTileByID(r.key).latestRawTileData,p=Math.floor((d&&d.byteLength||0)/1024),f=i.getTile(r).tileSize,A=512/Math.min(f,512)*(r.overscaledZ/e.transform.zoom)*.5;let m=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(m+=` => ${r.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,`${m} ${p}kB`);const g=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});s.draw(n,o.TRIANGLES,a,l,Ut.alphaBlended,Qt.disabled,Ri(t.b7.transparent,A),null,g,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),s.draw(n,o.LINE_STRIP,a,l,c,Qt.disabled,Ri(t.b7.red),h,g,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function xn(e,t,i,r){const{isRenderingGlobe:n}=r,o=e.context,s=o.gl,a=e.transform,l=e.colorModeForRenderPass(),c=e.getDepthModeFor3D(),u=e.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,e.width,e.height]);for(const r of i){const i=t.getTerrainMesh(r.tileID),h=e.renderToTexture.getTexture(r),d=t.getTerrainData(r.tileID);o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,h.texture);const p=t.getMeshFrameDelta(a.zoom),f=a.calculateFogMatrix(r.tileID.toUnwrapped()),A=wi(p,f,e.style.sky,a.pitch,n),m=a.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(o,s.TRIANGLES,c,Ht.disabled,l,Qt.backCCW,A,d,m,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}function bn(e,i){if(!i.mesh){const r=new t.aI;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);const n=new t.aK;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),i.mesh=new bt(e.createVertexBuffer(r,wt.members),e.createIndexBuffer(n),t.aJ.simpleSegment(0,0,r.length,n.length))}return i.mesh}class wn{constructor(e,i){this.context=new Hr(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.ad(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ve.maxUnderzooming+ve.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new _t}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style._order)this.style._layers[e].resize()}setup(){const e=this.context,i=new t.aI;i.emplaceBack(0,0),i.emplaceBack(t.Z,0),i.emplaceBack(0,t.Z),i.emplaceBack(t.Z,t.Z),this.tileExtentBuffer=e.createVertexBuffer(i,wt.members),this.tileExtentSegments=t.aJ.simpleSegment(0,0,4,2);const r=new t.aI;r.emplaceBack(0,0),r.emplaceBack(t.Z,0),r.emplaceBack(0,t.Z),r.emplaceBack(t.Z,t.Z),this.debugBuffer=e.createVertexBuffer(r,wt.members),this.debugSegments=t.aJ.simpleSegment(0,0,4,5);const n=new t.bY;n.emplaceBack(0,0,0,0),n.emplaceBack(t.Z,0,t.Z,0),n.emplaceBack(0,t.Z,0,t.Z),n.emplaceBack(t.Z,t.Z,t.Z,t.Z),this.rasterBoundsBuffer=e.createVertexBuffer(n,xi.members),this.rasterBoundsSegments=t.aJ.simpleSegment(0,0,4,2);const o=new t.aI;o.emplaceBack(0,0),o.emplaceBack(t.Z,0),o.emplaceBack(0,t.Z),o.emplaceBack(t.Z,t.Z),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,wt.members),this.rasterBoundsSegmentsPosOnly=t.aJ.simpleSegment(0,0,4,5);const s=new t.aI;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(s,wt.members),this.viewportSegments=t.aJ.simpleSegment(0,0,4,2);const a=new t.bZ;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);const l=new t.aK;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new Ht({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new bt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const r=t.K();t.bQ(r,0,this.width,this.height,0,0,1),t.M(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const n={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,jt.disabled,this.stencilClearMode,Ut.disabled,Qt.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();const r=this.context;r.setColorMode(Ut.disabled),r.setDepthMode(jt.disabled);const n={};for(const e of t)n[e.key]=this.nextStencilID++;this._renderTileMasks(n,t,i,!0),this._renderTileMasks(n,t,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,i,r){const n=this.context,o=n.gl,s=this.style.projection,a=this.transform,l=this.useProgram("clippingMask");for(const c of t){const t=e[c.key],u=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),h=s.getMeshFromTileID(this.context,c.canonical,r,!0,"stencil"),d=a.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!0});l.draw(n,o.TRIANGLES,jt.disabled,new Ht({func:o.ALWAYS,mask:0},t,255,o.KEEP,o.KEEP,o.REPLACE),Ut.disabled,i?Qt.disabled:Qt.backCCW,null,u,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}_renderTilesDepthBuffer(){const e=this.context,t=e.gl,i=this.style.projection,r=this.transform,n=this.useProgram("depth"),o=this.getDepthModeFor3D(),s=ye(r,{tileSize:r.tileSize});for(const a of s){const s=this.style.map.terrain&&this.style.map.terrain.getTerrainData(a),l=i.getMeshFromTileID(this.context,a.canonical,!0,!0,"raster"),c=r.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(e,t.TRIANGLES,o,Ht.disabled,Ut.disabled,Qt.backCCW,null,s,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new Ht({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){const t=this.context.gl;return new Ht({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const t=this.context.gl,i=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const e={};for(let i=0;it.overscaledZ-e.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){const e={},o={};for(let i=0;i0};for(const e in a){const t=a[e];t.used&&t.prepare(this.context),l[e]=t.getVisibleCoordinates(!1),c[e]=l[e].slice().reverse(),u[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;ethis.useProgram(e)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.b7.black:t.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(e,t){const i=e.context,r=i.gl,n=((e,t,i)=>{const r=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),o=he(t),s=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-o*n)*i,(t.height/2+o*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:s}})(t,e.style.map.transform,e.pixelRatio),o=new jt(r.LEQUAL,jt.ReadWrite,[0,1]),s=Ht.disabled,a=e.colorModeForRenderPass(),l=e.useProgram("sky"),c=bn(i,t);l.draw(i,r.TRIANGLES,o,s,a,Qt.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[o[this.currentLayer]],t=a[e.source],i=l[e.source];this._renderTileClippingMasks(e,i,!1),this.renderLayer(this,t,e,i,h)}this.renderPass="translucent";let d=!1;for(this.currentLayer=0;this.currentLayer({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:n}))(c,h,[f[0],f[1],f[2]],d,p),m=bn(n,i);s.draw(n,o.TRIANGLES,a,Ht.disabled,Ut.alphaBlended,Qt.disabled,A,null,null,"atmosphere",m.vertexBuffer,m.indexBuffer,m.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const e=function(e,t){let i=null;const r=Object.values(e._layers).flatMap((i=>i.source&&!i.isHidden(t)?[e.sourceCaches[i.source]]:[])),n=r.filter((e=>"vector"===e.getSource().type)),o=r.filter((e=>"vector"!==e.getSource().type)),s=e=>{(!i||i.getSource().maxzooms(e))),i||o.forEach((e=>s(e))),i}(this.style,this.transform.zoom);e&&function(e,t,i){for(let r=0;rh.getElevation(o,e,t):null;Wr(s,d,p,c,u,m,i,f,g,t.aA(u,e,a,l),o.toUnwrapped(),r)}}}(n,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&Yr(e,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),l,c,a),0!==r.paint.get("text-opacity").constantOr(1)&&Yr(e,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),l,c,a),i.map.showCollisionBoxes&&($r(e,i,r,n,!0),$r(e,i,r,n,!1))}(e,i,r,n,this.style.placement.variableOffsets,o):t.c2(r)?function(e,i,r,n,o){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:s}=o,a=r.paint.get("circle-opacity"),l=r.paint.get("circle-stroke-width"),c=r.paint.get("circle-stroke-opacity"),u=!r.layout.get("circle-sort-key").isConstant();if(0===a.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const h=e.context,d=h.gl,p=e.transform,f=e.getDepthModeForSublayer(0,jt.ReadOnly),A=Ht.disabled,m=e.colorModeForRenderPass(),g=[],_=p.getCircleRadiusCorrection();for(let o=0;oe.sortKey-t.sortKey));for(const t of g){const{programConfiguration:i,program:n,layoutVertexBuffer:o,indexBuffer:s,uniformValues:a,terrainData:l,projectionData:c}=t.state;n.draw(h,d.TRIANGLES,f,A,m,Qt.backCCW,a,l,c,r.id,o,s,t.segments,r.paint,e.transform.zoom,i)}}(e,i,r,n,o):t.c3(r)?function(e,i,r,n,o){if(0===r.paint.get("heatmap-opacity"))return;const s=e.context,{isRenderingToTexture:a,isRenderingGlobe:l}=o;if(e.style.map.terrain){for(const t of n){const n=i.getTile(t);i.hasRenderableParent(t)||("offscreen"===e.renderPass?en(e,n,r,t,l):"translucent"===e.renderPass&&tn(e,r,t,a,l))}s.viewport.set([0,0,e.width,e.height])}else"offscreen"===e.renderPass?function(e,i,r,n){const o=e.context,s=o.gl,a=e.transform,l=Ht.disabled,c=new Ut([s.ONE,s.ONE],t.b7.transparent,[!0,!0,!0,!0]);(function(e,i,r){const n=e.gl;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,i.width/4,i.height/4]);let o=r.heatmapFbos.get(t.bU);o?(n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),e.bindFramebuffer.set(o.framebuffer)):(o=rn(e,i.width/4,i.height/4),r.heatmapFbos.set(t.bU,o))})(o,e,r),o.clear({color:t.b7.transparent});for(let t=0;t0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1){this.cache=this.cache||{};const r=!!this.style.map.terrain,n=this.style.projection,o=e+(t?t.cacheKey:"")+`/${i?Bt:n.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(r?"/terrain":"");return this.cache[o]||(this.cache[o]=new Ci(this.context,vt[e],t,ir[e],this._showOverdrawInspector,r,i?vt.projectionMercator:n.shaderPreludeCode,i?Tt:n.shaderDefine)),this.cache[o]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new _(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function Tn(e,t){let i,r=!1,n=null,o=null;const s=()=>{n=null,r&&(e.apply(o,i),n=setTimeout(s,t),r=!1)};return(...e)=>(r=!0,o=this,i=e,n||s(),n)}class Bn{constructor(e){this._getCurrentHash=()=>{const e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((e=>e.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")},this._onHashChange=()=>{const e=this._getCurrentHash();if(!this._isValidHash(e))return!1;const t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{const e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{const e=this._getCurrentHash();if(0===e.length)return;const t=e.join("/");let i=t;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${t}`);let r=window.location.hash.replace(i,"");r.startsWith("#&")?r=r.slice(0,1)+r.slice(2):"#"===r&&(r="");let n=window.location.href.replace(/(#.+)?$/,r);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=Tn(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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()),this._removeHash(),delete this._map,this}getHashString(e){const t=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),o=Math.round(t.lng*n)/n,s=Math.round(t.lat*n)/n,a=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=e?`/${o}/${s}/${i}`:`${i}/${s}/${o}`,(a||l)&&(c+="/"+Math.round(10*a)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const e=this._hashName;let t=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const r=i.split("=")[0];return r===e?(t=!0,`${r}=${c}`):i})).filter((e=>e));return t||i.push(`${e}=${c}`),`#${i.join("&")}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.Q(+e[2],+e[1])}catch(e){return!1}const i=+e[0],r=+(e[3]||0),n=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&r>=-180&&r<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const Cn={linearity:.3,easing:t.cb(0,0,.3,1)},Sn=t.e({deceleration:2500,maxSpeed:1400},Cn),En=t.e({deceleration:20,maxSpeed:1400},Cn),Mn=t.e({deceleration:1e3,maxSpeed:360},Cn),In=t.e({deceleration:1e3,maxSpeed:90},Cn),Pn=t.e({deceleration:1e3,maxSpeed:360},Cn);class Ln{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,t=s.now();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,i.roll+=e.rollDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const o=kn(i.pan.mag(),r,t.e({},Sn,e||{})),s=i.pan.mult(o.amount/i.pan.mag()),a=this._map.cameraHelper.handlePanInertia(s,this._map.transform);n.center=a.easingCenter,n.offset=a.easingOffset,Fn(n,o)}if(i.zoom){const e=kn(i.zoom,r,En);n.zoom=this._map.transform.zoom+e.amount,Fn(n,e)}if(i.bearing){const e=kn(i.bearing,r,Mn);n.bearing=this._map.transform.bearing+t.ae(e.amount,-179,179),Fn(n,e)}if(i.pitch){const e=kn(i.pitch,r,In);n.pitch=this._map.transform.pitch+e.amount,Fn(n,e)}if(i.roll){const e=kn(i.roll,r,Pn);n.roll=this._map.transform.roll+t.ae(e.amount,-179,179),Fn(n,e)}if(n.zoom||n.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),t.e(n,{noMoveStart:!0})}}function Fn(e,t){(!e.duration||e.durationi.unproject(e))),l=o.reduce(((e,t,i,r)=>e.add(t.div(r.length))),new t.P(0,0));super(e,{points:o,point:l,lngLats:s,lngLat:i.unproject(l),originalEvent:r}),this._defaultPrevented=!1}}class Dn extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class On{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Dn(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new zn(e.type,this._map,e))}mouseup(e){this._map.fire(new zn(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new zn(e.type,this._map,e))}dblclick(e){return this._firePreventable(new zn(e.type,this._map,e))}mouseover(e){this._map.fire(new zn(e.type,this._map,e))}mouseout(e){this._map.fire(new zn(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Rn(e.type,this._map,e))}touchmove(e){this._map.fire(new Rn(e.type,this._map,e))}touchend(e){this._map.fire(new Rn(e.type,this._map,e))}touchcancel(e){this._map.fire(new Rn(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Un{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new zn(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new zn(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Nn{constructor(e){this._map=e}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.screenPointToLocation(t.P.convert(e),this._map.terrain)}}class Qn{constructor(e,t){this._map=e,this._tr=new Nn(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(a.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)e.fitScreenCoordinates(r,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(a.remove(this._box),this._box=null),a.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.l(e,{originalEvent:i}))}}function jn(e,t){if(e.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);const i={};for(let r=0;rthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){const i=new t.P(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=jn(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const r=jn(i,t);for(const e in this.touches){const t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class Hn{constructor(e){this.singleTap=new Vn(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const r=this.singleTap.touchend(e,t,i);if(r){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Gn{constructor(e){this._tr=new Nn(e),this._zoomIn=new Hn({numTouches:1,numTaps:2}),this._zoomOut=new Hn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i),o=this._tr;return r?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(r)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $n{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const r=Array.isArray(t)?t[0]:t;return!this._moved&&r.dist(i)!0}),t=new Kn){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,i){return e instanceof MouseEvent?t(e):"undefined"!=typeof TouchEvent&&e instanceof TouchEvent?i(e):void 0}startMove(e){this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.startMove(e)),(e=>this.oneFingerTouchMoveStateManager.startMove(e)))}endMove(e){this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.endMove(e)),(e=>this.oneFingerTouchMoveStateManager.endMove(e)))}isValidStartEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidStartEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e)))}isValidMoveEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidMoveEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e)))}isValidEndEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidEndEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e)))}}const Xn=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class Yn{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(!this._shouldBePrevented(i.length))return e.preventDefault(),this._calculateTransform(e,t,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,r){r.length>0&&(this._active=!0);const n=jn(r,i),o=new t.P(0,0),s=new t.P(0,0);let a=0;for(const e in n){const t=n[e],i=this._touches[e];i&&(o._add(t),s._add(t.sub(i)),a++,n[e]=t)}if(this._touches=n,this._shouldBePrevented(a)||!s.mag())return;const l=s.div(a);return this._sum._add(l),this._sum.mag()Math.abs(e.x)}class so extends Jn{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,oo(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const r=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,n=t.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return oo(e)&&oo(t)&&o}}const ao={panStep:100,bearingStep:15,pitchStep:10};class lo{constructor(e){this._tr=new Nn(e);const t=ao;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:s=>{const a=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:co,zoom:t?Math.round(a.zoom)+t*(e.shiftKey?2:1):a.zoom,bearing:a.bearing+i*this._bearingStep,pitch:a.pitch+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:a.center},{originalEvent:e})}}}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 co(e){return e*(2-e)}const uo=4.000244140625;class ho{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new Nn(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const i=s.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==t&&t%uo==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=a.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(t.Q.convert(r.center)):i,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("number"==typeof this._lastExpectedZoom){const t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){const i="wheel"===this._type&&Math.abs(this._delta)>uo?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);const n="number"!=typeof this._targetZoom?e.scale:t.ac(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,t.ah(n*r))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"!=typeof this._targetZoom?e.zoom:this._targetZoom,r=this._startZoom,n=this._easing;let o,a=!1;if("wheel"===this._type&&r&&n){const e=s.now()-this._lastWheelEventTime,l=Math.min((e+5)/200,1),c=n(l);o=t.B.number(r,i,c),l<1?this._frameId||(this._frameId=!0):a=!0}else o=i,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.cd;if(this._prevEase){const e=this._prevEase,r=(s.now()-e.start)/e.duration,n=e.easing(r+.01)-e.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,a=Math.sqrt(.0729-o*o);i=t.cb(o,a,.25,1)}return this._prevEase={start:s.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class po{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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 fo{constructor(e){this._tr=new Nn(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ao{constructor(){this._tap=new Hn({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(e,t,i){if(!this._swipePoint)if(this._tapTime){const r=t[0],n=e.timeStamp-this._tapTime<500,o=this._tapPoint.dist(r)<30;n&&o?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(e,t,i)}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const r=this._tap.touchend(e,t,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class mo{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},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 go{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class _o{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class yo{constructor(e,t){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=a.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);const n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(a.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new t.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const vo=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class xo extends t.l{}function bo(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class wo{constructor(e,i){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,i)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;const r="renderFrame"===e.type?void 0:e,n={needsRenderFrame:!1},o={},s={};for(const{handlerName:l,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;if(this._blockedByActive(s,u,l))c.reset();else if(c[i||e.type]){if(t.ce(e,i||e.type)){const t=a.mousePos(this._map.getCanvas(),e);h=c[i||e.type](e,t)}else if(t.cf(e,i||e.type)){const t=this._getMapTouches(e.touches),r=a.touchPos(this._map.getCanvas(),t);h=c[i||e.type](e,r,t)}else t.cg(i||e.type)||(h=c[i||e.type](e));this.mergeHandlerResult(n,o,h,l,r),h&&h.needsRenderFrame&&this._triggerRenderFrame()}(h||c.isActive())&&(s[l]=c)}const l={};for(const e in this._previousActiveHandlers)s[e]||(l[e]=r);this._previousActiveHandlers=s,(Object.keys(l).length||bo(n))&&(this._changes.push([n,o,l]),this._triggerRenderFrame()),(Object.keys(s).length||bo(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:c}=n;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ln(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,t,i]of this._listeners)a.addEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[e,t,i]of this._listeners)a.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){const i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new On(i,e));const n=i.boxZoom=new Qn(i,e);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();const o=i.cooperativeGestures=new yo(i,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();const s=new Gn(i),l=new fo(i);i.doubleClickZoom=new po(l,s),this._add("tapZoom",s),this._add("clickZoom",l),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const c=new Ao;this._add("tapDragZoom",c);const u=i.touchPitch=new so(i);this._add("touchPitch",u),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const h=()=>i.project(i.getCenter()),d=function({enable:e,clickTolerance:i,aroundCenter:r=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:o=.8},s){const l=new qn({checkCorrectEvent:e=>0===a.mouseButton(e)&&e.ctrlKey||2===a.mouseButton(e)&&!e.ctrlKey});return new $n({clickTolerance:i,move:(e,i)=>{const a=s();if(r&&Math.abs(a.y-e.y)>n)return{bearingDelta:t.cc(new t.P(e.x,i.y),i,a)};let l=(i.x-e.x)*o;return r&&i.y0===a.mouseButton(e)&&e.ctrlKey||2===a.mouseButton(e)});return new $n({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*i}),moveStateManager:r,enable:e,assignEvents:Xn})}(e),f=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){const n=new qn({checkCorrectEvent:e=>2===a.mouseButton(e)&&e.ctrlKey});return new $n({clickTolerance:t,move:(e,t)=>{const n=r();let o=(t.x-e.x)*i;return t.y0===a.mouseButton(e)&&!e.ctrlKey});return new $n({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:i,enable:e,assignEvents:Xn})}(e),m=new Yn(e,i);i.dragPan=new mo(r,A,m),this._add("mousePan",A),this._add("touchPan",m,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const g=new no,_=new io;i.touchZoomRotate=new _o(r,_,g,c),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",_,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const y=i.scrollZoom=new ho(i,(()=>this._triggerRenderFrame()));this._add("scrollZoom",y,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const v=i.keyboard=new lo(i);this._add("keyboard",v),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Un(i))}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(vo(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,i){for(const r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}mergeHandlerResult(e,i,r,n,o){if(!r)return;t.e(e,r);const s={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.rollDelta&&(i.roll=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){const e={},i={},r={};for(const[n,o,s]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(e.rollDelta=(e.rollDelta||0)+n.rollDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),t.e(i,o),t.e(r,s);this._updateMapTransform(e,i,r),this._changes=[]}_updateMapTransform(e,t,i){const r=this._map,n=r._getTransformForUpdate(),o=r.terrain;if(!(bo(e)||o&&this._terrainMovement))return this._fireEvents(t,i,!0);r._stop(!0);let{panDelta:s,zoomDelta:a,bearingDelta:l,pitchDelta:c,rollDelta:u,around:h,pinchAround:d}=e;void 0!==d&&(h=d),h=h||r.transform.centerPoint,o&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const p={panDelta:s,zoomDelta:a,rollDelta:u,pitchDelta:c,bearingDelta:l,around:h};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const f=h.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(s?h.sub(s):h);o?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,n),this._terrainMovement||!t.drag&&!t.zoom?t.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(s))):this._map.cameraHelper.handleMapControlsPan(p,n,f):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(p,n,f))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,n),this._map.cameraHelper.handleMapControlsPan(p,n,f)),r._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,i,r){const n=vo(this._eventsInProgress),o=vo(e),a={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(a[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in a)this._fireEvent(e,a[e]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const l={};let c;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],c=i[t]||r,l[`${e}end`]=c)}for(const e in l)this._fireEvent(e,l[e]);const u=vo(this._eventsInProgress),h=(n||o)&&!u;if(h&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const e=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(r&&h){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap{delete this._frameId,this.handleEvent(new xo("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class To extends t.E{constructor(e,t,i){super(),this._renderFrameCallback=()=>{const e=Math.min((s.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.cameraHelper=t,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(e,t){e.apply(this.transform),this.transform=e,this.cameraHelper=t}getCenter(){return new t.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,r){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},i),r)}panTo(e,i,r){return this.easeTo(t.e({center:e},i),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,i,r){return this.easeTo(t.e({zoom:e},i),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.l("movestart",i)).fire(new t.l("move",i)).fire(new t.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,i,r){return this.easeTo(t.e({bearing:e},i),r)}resetNorth(e,i){return this.rotateTo(0,t.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,t){return Math.abs(this.getBearing()){m.easeFunc(t),this.terrain&&!e.freezeElevation&&this._updateElevation(t),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(t=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,t)}),e),this}_prepareEase(e,i,r={}){this._moving=!0,i||r.moving||this.fire(new t.l("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.l("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.l("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.l("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new t.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(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.setElevation(t.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const t=e.getCameraLngLat(),i=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(ithis._elevateCameraIfInsideTerrain(e))),this.transformCameraUpdate&&t.push((e=>this.transformCameraUpdate(e))),!t.length)return;const i=e.clone();for(const e of t){const t=i.clone(),{center:r,zoom:n,roll:o,pitch:s,bearing:a,elevation:l}=e(t);r&&t.setCenter(r),void 0!==l&&t.setElevation(l),void 0!==n&&t.setZoom(n),void 0!==o&&t.setRoll(o),void 0!==s&&t.setPitch(s),void 0!==a&&t.setBearing(a),i.apply(t)}this.transform.apply(i)}_fireMoveEvents(e){this.fire(new t.l("move",e)),this._zooming&&this.fire(new t.l("zoom",e)),this._rotating&&this.fire(new t.l("rotate",e)),this._pitching&&this.fire(new t.l("pitch",e)),this._rolling&&this.fire(new t.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const r=this._zooming,n=this._rotating,o=this._pitching,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new t.l("zoomend",e)),n&&this.fire(new t.l("rotateend",e)),o&&this.fire(new t.l("pitchend",e)),s&&this.fire(new t.l("rollend",e)),this.fire(new t.l("moveend",e))}flyTo(e,i){if(!e.essential&&s.prefersReducedMotion){const r=t.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(r,i)}this.stop(),e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.cd},e);const r=this._getTransformForUpdate(),n=r.bearing,o=r.pitch,a=r.roll,l=r.padding,c="bearing"in e?this._normalizeBearing(e.bearing,n):n,u="pitch"in e?+e.pitch:o,h="roll"in e?this._normalizeBearing(e.roll,a):a,d="padding"in e?e.padding:r.padding,p=t.P.convert(e.offset);let f=r.centerPoint.add(p);const A=r.screenPointToLocation(f),m=this.cameraHelper.handleFlyTo(r,{bearing:c,pitch:u,roll:h,padding:d,locationAtOffset:A,offsetAsPoint:p,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let g=e.curve;const _=Math.max(r.width,r.height),y=_/m.scaleOfZoom,v=m.pixelPathLength;"number"==typeof m.scaleOfMinZoom&&(g=Math.sqrt(_/m.scaleOfMinZoom/v*2));const x=g*g;function b(e){const t=(y*y-_*_+(e?-1:1)*x*x*v*v)/(2*(e?y:_)*x*v);return Math.log(Math.sqrt(t*t+1)-t)}function w(e){return(Math.exp(e)-Math.exp(-e))/2}function T(e){return(Math.exp(e)+Math.exp(-e))/2}const B=b(!1);let C=function(e){return T(B)/T(B+g*e)},S=function(e){return _*((T(B)*(w(t=B+g*e)/T(t))-w(B))/x)/v;var t},E=(b(!0)-B)/g;if(Math.abs(v)<2e-6||!isFinite(E)){if(Math.abs(_-y)<1e-6)return this.easeTo(e,i);const t=y<_?-1:1;E=Math.abs(Math.log(y/_))/g,S=()=>0,C=e=>Math.exp(t*g*e)}return e.duration="duration"in e?+e.duration:1e3*E/("screenSpeed"in e?+e.screenSpeed/g:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=n!==c,this._pitching=u!==o,this._rolling=h!==a,this._padding=!r.isPaddingEqual(d),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease((s=>{const A=s*E,g=1/C(A),_=S(A);this._rotating&&r.setBearing(t.B.number(n,c,s)),this._pitching&&r.setPitch(t.B.number(o,u,s)),this._rolling&&r.setRoll(t.B.number(a,h,s)),this._padding&&(r.interpolatePadding(l,d,s),f=r.centerPoint.add(p)),m.easeFunc(s,g,_,f),this.terrain&&!e.freezeElevation&&this._updateElevation(s),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(e,t,i){!1===i.animate||0===i.duration?(e(1),t()):(this._easeStart=s.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=t.aL(e,-180,180);const r=Math.abs(e-i);return Math.abs(e-360-i)MapLibre'};class Co{constructor(e=Bo){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=e=>{!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType&&"terrain"!==e.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=a.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=a.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=a.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(){a.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(e,t){const i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((e=>"string"!=typeof e?"":e))):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style.sourceCaches;for(const i in t){const r=t[i];if(r.used||r.usedForTerrain){const t=r.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter((e=>String(e).trim())),e.sort(((e,t)=>e.length-t.length)),e=e.filter(((t,i)=>{for(let r=i+1;r=0)return!1;return!0}));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=a.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class So{constructor(e={}){this._updateCompact=()=>{const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=a.create("div","maplibregl-ctrl");const t=a.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){a.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Eo{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Mo=t.aG([{name:"a_pos3d",type:"Int16",components:3}]);class Io extends t.E{constructor(e){super(),this._lastTilesetChange=s.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const r={};for(const n of ye(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))r[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),t.bQ(n.terrainRttPosMatrix32f,0,t.Z,t.Z,0,0,1),this._tiles[n.key]=new oe(n,this.tileSize),this._lastTilesetChange=s.now());for(const e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(e){for(const t in this._tiles){const i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const r of this._renderableTilesKeys){const n=this._tiles[r].tileID,o=e.clone(),s=t.b2();if(n.canonical.equals(e.canonical))t.bQ(s,0,t.Z,t.Z,0,0,1);else if(n.canonical.isChildOf(e.canonical)){const i=n.canonical.z-e.canonical.z,r=n.canonical.x-(n.canonical.x>>i<>i<>i;t.bQ(s,0,a,a,0,0,1),t.L(s,s,[-r*a,-o*a,0])}else{if(!e.canonical.isChildOf(n.canonical))continue;{const i=e.canonical.z-n.canonical.z,r=e.canonical.x-(e.canonical.x>>i<>i<>i;t.bQ(s,0,t.Z,t.Z,0,0,1),t.L(s,s,[r*a,o*a,0]),t.M(s,s,[1/2**i,1/2**i,0])}}o.terrainRttPosMatrix32f=new Float32Array(s),i[r]=o}return i}_getTerrainCoordsForTileRanges(e,i){const r={};for(const n of this._renderableTilesKeys){const o=this._tiles[n].tileID;if(!this._isWithinTileRanges(o,i))continue;const s=e.clone(),a=t.b2();if(o.canonical.z===e.canonical.z){const i=e.canonical.x-o.canonical.x,r=e.canonical.y-o.canonical.y;t.bQ(a,0,t.Z,t.Z,0,0,1),t.L(a,a,[i*t.Z,r*t.Z,0])}else if(o.canonical.z>e.canonical.z){const i=o.canonical.z-e.canonical.z,r=o.canonical.x-(o.canonical.x>>i<>i<>i),l=e.canonical.y-(o.canonical.y>>i),c=t.Z>>i;t.bQ(a,0,c,c,0,0,1),t.L(a,a,[-r*c+s*t.Z,-n*c+l*t.Z,0])}else{const i=e.canonical.z-o.canonical.z,r=e.canonical.x-(e.canonical.x>>i<>i<>i)-o.canonical.x,l=(e.canonical.y>>i)-o.canonical.y,c=t.Z<i.maxzoom&&(r=i.maxzoom),r=i.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(e.scaledTo(r--).key);return n}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){return t[e.canonical.z]&&e.canonical.x>=t[e.canonical.z].minTileX&&e.canonical.x<=t[e.canonical.z].maxTileX&&e.canonical.y>=t[e.canonical.z].minTileY&&e.canonical.y<=t[e.canonical.z].maxTileY}}class Po{constructor(e,t,i){this._meshCache={},this.painter=e,this.sourceCache=new Io(t),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,r,n=t.Z){var o;if(!(i>=0&&i=0&&re.canonical.z&&(e.canonical.z>=r?n=e.canonical.z-r:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=e.canonical.x-(e.canonical.x>>n<>n<>8<<4|e>>8,i[t+3]=0;const r=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),n=new _(e,r,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),r=this.painter.context,n=r.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),s=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),a=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,a-s-1,1,1,n.RGBA,n.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),c=i[1]+((15&i[2])<<8),u=this.coordsIndex[255-i[3]],h=u&&this.sourceCache.getTileByID(u);if(!h)return null;const d=this._coordsTextureSize,p=(1<0,n=r&&0===e.canonical.y,o=r&&e.canonical.y===(1<e.id!==t)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length!e.inUse))}}const Fo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ko{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new Lo(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter((i=>!e._layers[i].isHidden(t))),this._coordsAscending={};for(const t in e.sourceCaches){this._coordsAscending[t]={};const i=e.sourceCaches[t].getVisibleCoordinates(),r=e.sourceCaches[t].getSource(),n=r instanceof W?r.terrainTileRanges:null;for(const e of i){const i=this.terrain.sourceCache.getTerrainCoords(e,n);for(const e in i)this._coordsAscending[t][e]||(this._coordsAscending[t][e]=[]),this._coordsAscending[t][e].push(i[e])}}this._coordsAscendingStr={};for(const t of e._order){const i=e._layers[t],r=i.source;if(Fo[i.type]&&!this._coordsAscendingStr[r]){this._coordsAscendingStr[r]={};for(const e in this._coordsAscending[r])this._coordsAscendingStr[r][e]=this._coordsAscending[r][e].map((e=>e.key)).sort().join()}}for(const e of this._renderableTiles)for(const t in this._coordsAscendingStr){const i=this._coordsAscendingStr[t][e.tileID.key];i&&i!==e.rttCoords[t]&&(e.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const r=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),n=e.type,o=this.painter,s=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Fo[n]&&(this._prevType&&Fo[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!s))return!0;if(Fo[this._prevType]||Fo[n]&&s){this._prevType=n;const e=this._stacks.length-1,i=this._stacks[e]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(xn(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[e]){const t=this.pool.getObjectForId(n.rtt[e].id);if(t.stamp===n.rtt[e].stamp){this.pool.useObject(t);continue}}const s=this.pool.getOrCreateFreeObject();this.pool.useObject(s),this.pool.stampObject(s),n.rtt[e]={id:s.id,stamp:s.stamp},o.context.bindFramebuffer.set(s.fbo.framebuffer),o.context.clear({color:t.b7.transparent,stencil:0}),o.currentStencilSource=void 0;for(let e=0;e{this.startMove(e,a.mousePos(this.element,e)),a.addEventListener(window,"mousemove",this.mousemove),a.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,a.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHanlder.dragEnd(e),this.offTemp()},this.touchstart=e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=a.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),a.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.addEventListener(window,"touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=a.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))},this.touchend=e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const n=new Wn;this._rotatePitchHanlder=new $n({clickTolerance:3,move:(e,n)=>{const o=i.getBoundingClientRect(),s=new t.P((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:t.cc(new t.P(e.x,n.y),n,s),pitchDelta:r?-.5*(n.y-e.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=e,a.addEventListener(i,"mousedown",this.mousedown),a.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),a.addEventListener(i,"touchcancel",this.reset)}startMove(e,t){this._rotatePitchHanlder.dragStart(e,t),a.disableDrag()}move(e,t){const i=this.map,{bearingDelta:r,pitchDelta:n}=this._rotatePitchHanlder.dragMove(e,t)||{};r&&i.setBearing(i.getBearing()+r),n&&i.setPitch(i.getPitch()+n)}off(){const e=this.element;a.removeEventListener(e,"mousedown",this.mousedown),a.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),a.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.removeEventListener(window,"touchend",this.touchend),a.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){a.enableDrag(),a.removeEventListener(window,"mousemove",this.mousemove),a.removeEventListener(window,"mouseup",this.mouseup),a.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.removeEventListener(window,"touchend",this.touchend)}}let No;function Qo(e,i,r,n=!1){if(n||!r.getCoveringTilesDetailsProvider().allowWorldCopies())return null==e?void 0:e.wrap();const o=new t.Q(e.lng,e.lat);if(e=new t.Q(e.lng,e.lat),i){const n=new t.Q(e.lng-360,e.lat),o=new t.Q(e.lng+360,e.lat),s=r.locationToScreenPoint(e).distSqr(i);r.locationToScreenPoint(n).distSqr(i)180;){const t=r.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e.lng!==o.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(e))?e:o}const jo={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 Vo(e,t,i){const r=e.classList;for(const e in jo)r.remove(`maplibregl-${i}-anchor-${e}`);r.add(`maplibregl-${i}-anchor-${t}`)}class Ho extends t.E{constructor(e){if(super(),this._onKeyPress=e=>{const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=e=>{const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;const t=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==e?void 0:e.type)||"render"===(null==e?void 0:e.type)&&!t)&&this._map.once("render",this._update),this._lngLat=Qo(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(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 r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&"moveend"!==e.type||(this._pos=this._pos.round()),a.setTransform(this._element,`${jo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${i}`),s.frameAsync(new AbortController).then((()=>{this._updateOpacity(e&&"moveend"===e.type)})).catch((()=>{}))},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.l("dragstart"))),this.fire(new t.l("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.l("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(null==e?void 0:e.opacity,null==e?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=t.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=a.create("div");const i=a.createNS("http://www.w3.org/2000/svg","svg"),r=41,n=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${r}px`),i.setAttributeNS(null,"width",`${n}px`),i.setAttributeNS(null,"viewBox",`0 0 ${n} ${r}`);const o=a.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const s=a.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const l=a.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 e of c){const t=a.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),l.appendChild(t)}const u=a.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill",this._color);const h=a.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),u.appendChild(h);const d=a.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const p=a.createNS("http://www.w3.org/2000/svg","path");p.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"),d.appendChild(p);const f=a.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const A=a.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"transform","translate(8.0, 8.0)");const m=a.createNS("http://www.w3.org/2000/svg","circle");m.setAttributeNS(null,"fill","#000000"),m.setAttributeNS(null,"opacity","0.25"),m.setAttributeNS(null,"cx","5.5"),m.setAttributeNS(null,"cy","5.5"),m.setAttributeNS(null,"r","5.4999962");const g=a.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#FFFFFF"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962"),A.appendChild(m),A.appendChild(g),s.appendChild(l),s.appendChild(u),s.appendChild(d),s.appendChild(f),s.appendChild(A),i.appendChild(s),i.setAttributeNS(null,"height",r*this._scale+"px"),i.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(i),this._offset=t.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()})),Vo(this._element,this._anchor,"marker"),e&&e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",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),a.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,r=Math.abs(i)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-13.5,-1*(t-i)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,r;if(!(null===(i=this._map)||void 0===i?void 0:i.terrain)){const e=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const n=this._map,o=n.terrain.depthAtPoint(this._pos),s=n.terrain.getElevationForLngLatZoom(this._lngLat,n.transform.tileZoom);if(n.transform.lngLatToCameraDepth(this._lngLat,s)-o<.006)return void(this._element.style.opacity=this._opacity);const a=-this._offset.y/n.transform.pixelsPerMeter,l=Math.sin(n.getPitch()*Math.PI/180)*a,c=n.terrain.depthAtPoint(new t.P(this._pos.x,this._pos.y-this._offset.y)),u=n.transform.lngLatToCameraDepth(this._lngLat,s+l)-c>.006;(null===(r=this._popup)||void 0===r?void 0:r.isOpen())&&u&&this._popup.remove(),this._element.style.opacity=u?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=e),void 0!==t&&(this._opacityWhenCovered=t),this._map&&this._updateOpacity(!0),this}}const Go={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let $o=0,Zo=!1;const qo={maxWidth:100,unit:"metric"};function Ko(e,t,i){const r=i&&i.maxWidth||100,n=e._container.clientHeight/2,o=e._container.clientWidth/2,s=e.unproject([o-r/2,n]),a=e.unproject([o+r/2,n]),l=Math.round(e.project(a).x-e.project(s).x),c=Math.min(r,l,e._container.clientWidth),u=s.distanceTo(a);if(i&&"imperial"===i.unit){const i=3.2808*u;i>5280?Wo(t,c,i/5280,e._getUIString("ScaleControl.Miles")):Wo(t,c,i,e._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Wo(t,c,u/1852,e._getUIString("ScaleControl.NauticalMiles")):u>=1e3?Wo(t,c,u/1e3,e._getUIString("ScaleControl.Kilometers")):Wo(t,c,u,e._getUIString("ScaleControl.Meters"))}function Wo(e,t,i,r){const n=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(i);e.style.width=t*(n/i)+"px",e.innerHTML=`${n} ${r}`}const Xo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Yo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Jo(e){if(e){if("number"==typeof e){const i=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,e),"top-left":new t.P(i,i),"top-right":new t.P(-i,i),bottom:new t.P(0,-e),"bottom-left":new t.P(i,-i),"bottom-right":new t.P(-i,-i),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){const i=t.P.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.P.convert(e.center||[0,0]),top:t.P.convert(e.top||[0,0]),"top-left":t.P.convert(e["top-left"]||[0,0]),"top-right":t.P.convert(e["top-right"]||[0,0]),bottom:t.P.convert(e.bottom||[0,0]),"bottom-left":t.P.convert(e["bottom-left"]||[0,0]),"bottom-right":t.P.convert(e["bottom-right"]||[0,0]),left:t.P.convert(e.left||[0,0]),right:t.P.convert(e.right||[0,0])}}return Jo(new t.P(0,0))}const es=i;e.AJAXError=t.co,e.Event=t.l,e.Evented=t.E,e.LngLat=t.Q,e.MercatorCoordinate=t.$,e.Point=t.P,e.addProtocol=t.cp,e.config=t.a,e.removeProtocol=t.cq,e.AttributionControl=Co,e.BoxZoomHandler=Qn,e.CanvasSource=Y,e.CooperativeGesturesHandler=yo,e.DoubleClickZoomHandler=po,e.DragPanHandler=mo,e.DragRotateHandler=go,e.EdgeInsets=St,e.FullscreenControl=class extends t.E{constructor(e={}){super(),this._onFullscreenChange=()=>{var e;let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(e=null==t?void 0:t.shadowRoot)||void 0===e?void 0:e.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){a.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const e=this._fullscreenButton=a.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);a.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_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.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new t.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},e.GeoJSONSource=K,e.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.l("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.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new t.Q(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=this._map.getBearing(),o=t.e({bearing:n},this.options.fitBoundsOptions),s=H.fromLngLat(i,r);this._map.fitBounds(s,o,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new t.Q(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 e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Zo)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=a.create("button","maplibregl-ctrl-geolocate",this._container),a.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){t.w("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=a.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ho({element:this._dotElement}),this._circleElement=a.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ho({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(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.l("trackuserlocationend")),this.fire(new t.l("userlocationlostfocus")))}))}},this.options=t.e({},Go,e)}onAdd(e){return this._map=e,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return t._(this,arguments,void 0,(function*(e=!1){if(void 0!==No&&!e)return No;if(void 0===window.navigator.permissions)return No=!!window.navigator.geolocation,No;try{const e=yield window.navigator.permissions.query({name:"geolocation"});No="denied"!==e.state}catch(e){No=!!window.navigator.geolocation}return No}))}().then((e=>this._finishSetupUI(e))),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(),a.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,$o=0,Zo=!1}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return t&&(i.longitudet.getEast()||i.latitudet.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 e=this._map.getBounds(),t=e.getSouthEast(),i=e.getNorthEast(),r=t.distanceTo(i),n=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}trigger(){if(!this._setup)return t.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":$o--,Zo=!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.l("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.l("trackuserlocationstart")),this.fire(new t.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),$o++,$o>1?(e={maximumAge:6e5,timeout:0},Zo=!0):(e=this.options.positionOptions,Zo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}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)}},e.GlobeControl=class{constructor(){this._toggleProjection=()=>{var e;const t=null===(e=this._map.getProjection())||void 0===e?void 0:e.type;this._map.setProjection("mercator"!==t&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(e=this._map.getProjection())||void 0===e?void 0:e.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=a.create("button","maplibregl-ctrl-globe",this._container),a.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){a.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},e.Hash=Bn,e.ImageSource=W,e.KeyboardHandler=lo,e.LngLatBounds=H,e.LogoControl=So,e.Map=class extends To{constructor(e){var i,r;t.cl.mark(t.cm.create);const n=Object.assign(Object.assign(Object.assign({},Do),e),{canvasContextAttributes:Object.assign(Object.assign({},Do.canvasContextAttributes),e.canvasContextAttributes)});if(null!=n.minZoom&&null!=n.maxZoom&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=n.minPitch&&null!=n.maxPitch&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=n.minPitch&&n.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=n.maxPitch&&n.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const o=new kt,s=new Ot;if(void 0!==n.minZoom&&o.setMinZoom(n.minZoom),void 0!==n.maxZoom&&o.setMaxZoom(n.maxZoom),void 0!==n.minPitch&&o.setMinPitch(n.minPitch),void 0!==n.maxPitch&&o.setMaxPitch(n.maxPitch),void 0!==n.renderWorldCopies&&o.setRenderWorldCopies(n.renderWorldCopies),super(o,s,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Eo,this._controls=[],this._mapId=t.a4(),this._contextLost=e=>{e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new t.l("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new t.l("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=!0===n.trackResize,this._bearingSnap=n.bearingSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=!0===n.refreshExpiredTiles,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=!0===n.crossSourceCollisions,this._collectResourceTiming=!0===n.collectResourceTiming,this._locale=Object.assign(Object.assign({},zo),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this.transformCameraUpdate=n.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=f.addThrottleControl((()=>this.isMoving())),this._requestManager=new A(n.transformRequest),"string"==typeof n.container){if(this._container=document.getElementById(n.container),!this._container)throw new Error(`Container '${n.container}' not found.`)}else{if(!(n.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=n.container}if(n.maxBounds&&this.setMaxBounds(n.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 e=!1;const t=Tn((e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())}),50);this._resizeObserver=new ResizeObserver((i=>{e?t(i):e=!0})),this._resizeObserver.observe(this._container)}this.handlers=new wo(this,n),this._hash=n.hash&&new Bn("string"==typeof n.hash&&n.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,t.e({},n.fitBoundsOptions,{duration:0}))));const a="string"==typeof n.style||!("globe"===(null===(r=null===(i=n.style)||void 0===i?void 0:i.projection)||void 0===r?void 0:r.type));this.resize(null,a),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new Co("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new So,n.logoPosition),this.on("style.load",(()=>{if(a||this._resizeTransform(),this.transform.unmodified){const e=t.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.l(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.l(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.l("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.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=e.onAdd(this);this._controls.push(e);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.k(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(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,t,i,r)}resize(e,i=!0){const[r,n]=this._containerDimensions(),o=this._getClampedPixelRatio(r,n);if(this._resizeCanvas(r,n,o),this.painter.resize(r,n,o),this.painter.overLimit()){const e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];const t=this._getClampedPixelRatio(r,n);this._resizeCanvas(r,n,t),this.painter.resize(r,n,t)}this._resizeTransform(i);const s=!this._moving;return s&&(this.stop(),this.fire(new t.l("movestart",e)).fire(new t.l("move",e))),this.fire(new t.l("resize",e)),s&&this.fire(new t.l("moveend",e)),this}_resizeTransform(e=!0){var t;const[i,r]=this._containerDimensions();this.transform.resize(i,r,e),null===(t=this._requestedCameraState)||void 0===t||t.resize(i,r,e)}_getClampedPixelRatio(e,t){const{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),o=e*n,s=t*n;return Math.min(o>i?i/o:1,s>r?r/s:1)*n}getPixelRatio(){var e;return null!==(e=this._overridePixelRatio)&&void 0!==e?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(H.convert(e)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom)return this.transform.setMinZoom(e),this._update(),this.getZoom()=this.transform.minZoom)return this.transform.setMaxZoom(e),this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()180)throw new Error("maxPitch must be less than or equal to 180");if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.Q.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null===(e=this.handlers)||void 0===e?void 0:e.isMoving())}isZooming(){var e;return this._zooming||(null===(e=this.handlers)||void 0===e?void 0:e.isZooming())}isRotating(){var e;return this._rotating||(null===(e=this.handlers)||void 0===e?void 0:e.isRotating())}_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let r=!1;const n=n=>{const o=t.filter((e=>this.getLayer(e))),s=0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];s.length?r||(r=!0,i.call(this,new zn(e,this,n.originalEvent,{features:s}))):r=!1};return{layers:t,listener:i,delegates:{mousemove:n,mouseout:()=>{r=!1}}}}if("mouseleave"===e||"mouseout"===e){let r=!1;const n=n=>{const o=t.filter((e=>this.getLayer(e)));(0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?r=!0:r&&(r=!1,i.call(this,new zn(e,this,n.originalEvent)))},o=t=>{r&&(r=!1,i.call(this,new zn(e,this,t.originalEvent)))};return{layers:t,listener:i,delegates:{mousemove:n,mouseout:o}}}{const r=e=>{const r=t.filter((e=>this.getLayer(e))),n=0!==r.length?this.queryRenderedFeatures(e.point,{layers:r}):[];n.length&&(e.features=n,i.call(this,e),delete e.features)};return{layers:t,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners||!this._delegatedListeners[e])return;const r=this._delegatedListeners[e];for(let e=0;et.includes(e)))){for(const e in n.delegates)this.off(e,n.delegates[e]);return void r.splice(e,1)}}}on(e,t,i){if(void 0===i)return super.on(e,t);const r="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,r,i);this._saveDelegatedListener(e,n);for(const e in n.delegates)this.on(e,n.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(void 0===i)return super.once(e,t);const r="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,r,i);for(const t in n.delegates){const o=n.delegates[t];n.delegates[t]=(...t)=>{this._removeDelegatedListener(e,r,i),o(...t)}}this._saveDelegatedListener(e,n);for(const e in n.delegates)this.once(e,n.delegates[e]);return this}off(e,t,i){return void 0===i?super.off(e,t):(this._removeDelegatedListener(e,"string"==typeof t?[t]:t,i),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let r;const n=e instanceof t.P||Array.isArray(e),o=n?e:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(n?{}:e)||{},o instanceof t.P||"number"==typeof o[0])r=[t.P.convert(o)];else{const e=t.P.convert(o[0]),i=t.P.convert(o[1]);r=[e,new t.P(i.x,e.y),i,new t.P(e.x,i.y),e]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,i){return!1!==(i=t.e({},{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(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var i,r;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(e,t)));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new vi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,n):this.style.loadJSON(e,t,n),this):(null===(r=null===(i=this.style)||void 0===i?void 0:i.projection)||void 0===r||r.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new vi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const r=this._requestManager.transformRequest(e,"Style");t.j(r,new AbortController).then((e=>{this._updateDiff(e.data,i)})).catch((e=>{e&&this.fire(new t.k(e))}))}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(r){t.w(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.w("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.k(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}`);null===this.terrain&&i.reload();for(const i in this.style._layers){const r=this.style._layers[i];"hillshade"===r.type&&r.source===e.source&&t.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Po(this.painter,i,e),this.painter.renderToTexture=new ko(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=t=>{var i;"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(i=t.source)||void 0===i?void 0:i.type)?this.terrain.sourceCache.freeRtt():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.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new t.l("terrain",{terrain:e})),this}getTerrain(){var e,t;return null!==(t=null===(e=this.terrain)||void 0===e?void 0:e.options)&&void 0!==t?t:null}areTilesLoaded(){const e=this.style&&this.style.sourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,i){if(i){const r=this.getSource(i);if(!r)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);r.calculateTileZoom=me(Math.max(1,e),Math.max(1,t))}else for(const i in this.style.sourceCaches)this.style.sourceCaches[i].getSource().calculateTileZoom=me(Math.max(1,e),Math.max(1,t));return this._update(!0),this}addImage(e,i,r={}){const{pixelRatio:n=1,sdf:o=!1,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h}=r;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.k(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:r,height:s,data:d}=i,p=i;return this.style.addImage(e,{data:new t.R({width:r,height:s},new Uint8Array(d)),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0,userImage:p}),p.onAdd&&p.onAdd(this,e),this}}{const{width:r,height:d,data:p}=s.getImageData(i);this.style.addImage(e,{data:new t.R({width:r,height:d},p),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0})}}updateImage(e,i){const r=this.style.getImage(e);if(!r)return this.fire(new t.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof HTMLImageElement||t.b(i)?s.getImageData(i):i,{width:o,height:a,data:l}=n;if(void 0===o||void 0===a)return this.fire(new t.k(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!==r.data.width||a!==r.data.height)return this.fire(new t.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(i instanceof HTMLImageElement||t.b(i));return r.data.replace(l,c),this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.k(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return f.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,r={}){return this.style.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,(e=>{e||this._update(!0)})),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,(e=>{e||this._update(!0)})),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){const e=this._container;e.classList.add("maplibregl-map");const t=this._canvasContainer=a.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=a.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);const n=this._controlContainer=a.create("div","maplibregl-control-container",e),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((e=>{o[e]=a.create("div",`maplibregl-ctrl-${e} `,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const e=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{t={requestedAttributes:e},i&&(t.statusMessage=i.statusMessage,t.type=i.type)}),{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!i){const e="Failed to initialize WebGL";throw t?(t.message=e,new Error(JSON.stringify(t))):new Error(e)}this.painter=new wn(i,this.transform),l.testSupport(i)}migrateProjection(e,i){super.migrateProjection(e,i),this.painter.transform=e,this.fire(new t.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var i,r,n,o,a;const l=this._idleTriggered?this._fadeDuration:0,c=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=s.now();this.style.zoomHistory.update(e,i);const r=new t.C(e,{now:i,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=r.crossFadingFactor();1===n&&n===this._crossFadingFactor||(u=!0,this._crossFadingFactor=n),this.style.update(r)}const h=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0!==c;null===(n=this.style.projection)||void 0===n||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(o=this.style.projection)||void 0===o?void 0:o.transitionState,null===(a=this.style.projection)||void 0===a?void 0:a.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||h)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,h),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding}),this.fire(new t.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.cl.mark(t.cm.load),this.fire(new t.l("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.l("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,t.cl.mark(t.cm.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),f.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),a.remove(this._canvasContainer),a.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),t.cl.clearMetrics(),this._removed=!0,this.fire(new t.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,s.frame(this._frameRequest,(e=>{t.cl.frame(e),this._frameRequest=null;try{this._render(e)}catch(e){if(!t.cn(e)&&!function(e){return e.message===jr}(e))throw e}}),(()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return Ro}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},e.MapMouseEvent=zn,e.MapTouchEvent=Rn,e.MapWheelEvent=Dn,e.Marker=Ho,e.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,t)=>{const i=this._map._getUIString(`NavigationControl.${t}`);e.title=i,e.setAttribute("aria-label",i)},this.options=t.e({},Oo,e),this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),a.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),a.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=a.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Uo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){a.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){const i=a.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},e.Popup=class extends t.E{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&a.remove(this._content),this._container&&(a.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new t.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=a.create("div","maplibregl-popup",this._map.getContainer()),this._tip=a.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const e of this.options.className.split(" "))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Qo(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const t=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let i=this.options.anchor;const r=Jo(this.options.offset);if(!i){const e=this._container.offsetWidth,n=this._container.offsetHeight;let o;o=t.y+r.bottom.ythis._map.transform.height-n?["bottom"]:[],t.xthis._map.transform.width-e/2&&o.push("right"),i=0===o.length?"bottom":o.join("-")}let n=t.add(r[i]);this.options.subpixelPositioning||(n=n.round()),a.setTransform(this._container,`${jo[i]} translate(${n.x}px,${n.y}px)`),Vo(this._container,i,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(Xo),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.Q.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){var e;return null===(e=this._container)||void 0===e?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=a.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}_createCloseButton(){this.options.closeButton&&(this._closeButton=a.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(Yo);e&&e.focus()}},e.RasterDEMTileSource=q,e.RasterTileSource=Z,e.ScaleControl=class{constructor(e){this._onMove=()=>{Ko(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Ko(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},qo),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){a.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},e.ScrollZoomHandler=ho,e.Style=vi,e.TerrainControl=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=e}onAdd(e){return this._map=e,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=a.create("button","maplibregl-ctrl-terrain",this._container),a.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(){a.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=so,e.TwoFingersTouchRotateHandler=no,e.TwoFingersTouchZoomHandler=io,e.TwoFingersTouchZoomRotateHandler=_o,e.VectorTileSource=$,e.VideoSource=X,e.addSourceType=(e,i)=>t._(void 0,void 0,void 0,(function*(){if(ee(e))throw new Error(`A source type called "${e}" already exists.`);((e,t)=>{J[e]=t})(e,i)})),e.clearPrewarmedResources=function(){const e=k;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(P),k=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()"))},e.createTileMesh=Kt,e.getMaxParallelImageRequests=function(){return t.a.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return ne().getRTLTextPluginStatus()},e.getVersion=function(){return es},e.getWorkerCount=function(){return L.workerCount},e.getWorkerUrl=function(){return t.a.WORKER_URL},e.importScriptInWorkers=function(e){return O().broadcast("IS",e)},e.prewarm=function(){R().acquire(P)},e.setMaxParallelImageRequests=function(e){t.a.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setRTLTextPlugin=function(e,t){return ne().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){L.workerCount=e},e.setWorkerUrl=function(e){t.a.WORKER_URL=e}})),e}();var Te=_e(we.exports),Be=e({__proto__:null,default:Te},[we.exports]);const Ce=[];function Se(e,i=t){let r;const n=new Set;function o(t){if(a(e,t)&&(e=t,r)){const t=!Ce.length;for(const t of n)t[1](),Ce.push(t,e);if(t){for(let e=0;e{n.delete(l),0===n.size&&r&&(r(),r=null)}}}}const Ee=Se([]),Me=Se([]),Ie=Se([]),Pe=Se(!0),Le=Se(!0),Fe=Se([]),ke=Se({}),ze=e=>{if(!Array.isArray(e))return!1;const t=["id","name","type"],i=e=>{const i=Object.keys(e);return t.filter((e=>!i.includes(e))).length>0};return!(e.filter((e=>"sublist"===e.type?e.presets.every(i):i(e))).length>0)},Re=(e,t)=>Math.round(e*10**t)/10**t;var De="Expected a function",Oe=/^\s+|\s+$/g,Ue=/^[-+]0x[0-9a-f]+$/i,Ne=/^0b[01]+$/i,Qe=/^0o[0-7]+$/i,je=parseInt,Ve="object"==typeof ge&&ge&&ge.Object===Object&&ge,He="object"==typeof self&&self&&self.Object===Object&&self,Ge=Ve||He||Function("return this")(),$e=Object.prototype.toString,Ze=Math.max,qe=Math.min,Ke=function(){return Ge.Date.now()};function We(e,t,i){var r,n,o,s,a,l,c=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(De);function p(t){var i=r,o=n;return r=n=void 0,c=t,s=e.apply(o,i)}function f(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-c>=o}function A(){var e=Ke();if(f(e))return m(e);a=setTimeout(A,function(e){var i=t-(e-l);return h?qe(i,o-(e-c)):i}(e))}function m(e){return a=void 0,d&&r?p(e):(r=n=void 0,s)}function g(){var e=Ke(),i=f(e);if(r=arguments,n=this,l=e,i){if(void 0===a)return function(e){return c=e,a=setTimeout(A,t),u?p(e):s}(l);if(h)return a=setTimeout(A,t),p(l)}return void 0===a&&(a=setTimeout(A,t)),s}return t=Ye(t)||0,Xe(i)&&(u=!!i.leading,o=(h="maxWait"in i)?Ze(Ye(i.maxWait)||0,t):o,d="trailing"in i?!!i.trailing:d),g.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=l=n=a=void 0},g.flush=function(){return void 0===a?s:m(Ke())},g}function Xe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ye(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==$e.call(e)}(e))return NaN;if(Xe(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xe(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Oe,"");var i=Ne.test(e);return i||Qe.test(e)?je(e.slice(2),i?2:8):Ue.test(e)?NaN:+e}var Je,et=function(e,t,i){var r=!0,n=!0;if("function"!=typeof e)throw new TypeError(De);return Xe(i)&&(r="leading"in i?!!i.leading:r,n="trailing"in i?!!i.trailing:n),We(e,t,{leading:r,maxWait:t,trailing:n})},tt=Object.prototype.toString,it=function(e){var t=tt.call(e),i="[object Arguments]"===t;return i||(i="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===tt.call(e.callee)),i};if(!Object.keys){var rt=Object.prototype.hasOwnProperty,nt=Object.prototype.toString,ot=it,st=Object.prototype.propertyIsEnumerable,at=!st.call({toString:null},"toString"),lt=st.call((function(){}),"prototype"),ct=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ut=function(e){var t=e.constructor;return t&&t.prototype===e},ht={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},dt=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!ht["$"+e]&&rt.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{ut(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();Je=function(e){var t=null!==e&&"object"==typeof e,i="[object Function]"===nt.call(e),r=ot(e),n=t&&"[object String]"===nt.call(e),o=[];if(!t&&!i&&!r)throw new TypeError("Object.keys called on a non-object");var s=lt&&i;if(n&&e.length>0&&!rt.call(e,0))for(var a=0;a0)for(var l=0;l3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new Et("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new Et("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new Et("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new Et("`loose`, if provided, must be a boolean");var r=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,s=arguments.length>6&&arguments[6],a=!!Mt&&Mt(e,t);if(Ct)Ct(e,t,{configurable:null===o&&a?a.configurable:!o,enumerable:null===r&&a?a.enumerable:!r,value:i,writable:null===n&&a?a.writable:!n});else{if(!s&&(r||n||o))throw new St("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=i}},Pt=xt,Lt=function(){return!!Pt};Lt.hasArrayLengthDefineBug=function(){if(!Pt)return null;try{return 1!==Pt([],"length",{value:1}).length}catch(e){return!0}};var Ft=Lt,kt=yt,zt="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),Rt=Object.prototype.toString,Dt=Array.prototype.concat,Ot=It,Ut=Ft(),Nt=function(e,t,i,r){if(t in e)if(!0===r){if(e[t]===i)return}else if(!function(e){return"function"==typeof e&&"[object Function]"===Rt.call(e)}(r)||!r())return;Ut?Ot(e,t,i,!0):Ot(e,t,i)},Qt=function(e,t){var i=arguments.length>2?arguments[2]:{},r=kt(t);zt&&(r=Dt.call(r,Object.getOwnPropertySymbols(t)));for(var n=0;n1&&"boolean"!=typeof t)throw new Gi('"allowMissing" argument must be a boolean');if(null===Tr(/^%?[^%]*%?$/,e))throw new Hi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=function(e){var t=wr(e,0,1),i=wr(e,-1);if("%"===t&&"%"!==i)throw new Hi("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==t)throw new Hi("invalid intrinsic syntax, expected opening `%`");var r=[];return br(e,Br,(function(e,t,i,n){r[r.length]=i?br(n,Cr,"$1"):t||e})),r}(e),r=i.length>0?i[0]:"",n=Sr("%"+r+"%",t),o=n.name,s=n.value,a=!1,l=n.alias;l&&(r=l[0],xr(i,vr([0,1],l)));for(var c=1,u=!0;c=i.length){var f=ir(s,h);s=(u=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:s[h]}else u=yr(s,h),s=s[h];u&&!a&&(fr[o]=s)}}return s},Mr=Er,Ir=It,Pr=Ft(),Lr=Bt,Fr=wt,kr=Mr("%Math.floor%"),zr=function(e,t){if("function"!=typeof e)throw new Fr("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||kr(t)!==t)throw new Fr("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],r=!0,n=!0;if("length"in e&&Lr){var o=Lr(e,"length");o&&!o.configurable&&(r=!1),o&&!o.writable&&(n=!1)}return(r||n||!i)&&(Pr?Ir(e,"length",t,!0,!0):Ir(e,"length",t)),e},Rr=fi,Dr=mi,Or=yi,Ur=function(){return Or(Rr,Dr,arguments)};!function(e){var t=zr,i=xt,r=Ti,n=Ur;e.exports=function(e){var i=r(arguments),n=e.length-(arguments.length-1);return t(i,1+(n>0?n:0),!0)},i?i(e.exports,"apply",{value:n}):e.exports.apply=n}(Ht);var Nr=Er,Qr=Ti,jr=Qr([Nr("%String.prototype.indexOf%")]),Vr=function(e,t){var i=Nr(e,!!t);return"function"==typeof i&&jr(e,".prototype.")>-1?Qr([i]):i},Hr=yt,Gr=ni(),$r=Vr,Zr=Gt,qr=$r("Array.prototype.push"),Kr=$r("Object.prototype.propertyIsEnumerable"),Wr=Gr?Zr.getOwnPropertySymbols:null,Xr=function(e,t){if(null==e)throw new TypeError("target must be an object");var i=Zr(e);if(1===arguments.length)return i;for(var r=1;r2&&!!arguments[2]&&!yn||(_n?gn(e,"name",t,!0,!0):gn(e,"name",t)),e},bn=wt,wn=Object,Tn=xn((function(){if(null==this||this!==wn(this))throw new bn("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e}),"get flags",!0),Bn=Tn,Cn=Vt.supportsDescriptors,Sn=Object.getOwnPropertyDescriptor,En=function(){if(Cn&&"gim"===/a/gim.flags){var e=Sn(RegExp.prototype,"flags");if(e&&"function"==typeof e.get&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var t="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(i,"sticky",{get:function(){t+="y"}}),e.get.call(i),"dy"===t)return e.get}}return Bn},Mn=Vt.supportsDescriptors,In=En,Pn=Bt,Ln=Object.defineProperty,Fn=$t,kn=zi,zn=/a/,Rn=Vt,Dn=Tn,On=En,Un=function(){if(!Mn||!kn)throw new Fn("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=In(),t=kn(zn),i=Pn(t,"flags");return i&&i.get===e||Ln(t,"flags",{configurable:!0,enumerable:!1,get:e}),e},Nn=(0,Ht.exports)(On());Rn(Nn,{getPolyfill:On,implementation:Dn,shim:Un});var Qn=Nn,jn=Symbol.iterator,Vn=ye(Object.freeze({__proto__:null,default:{}})),Hn="function"==typeof Map&&Map.prototype,Gn=Object.getOwnPropertyDescriptor&&Hn?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,$n=Hn&&Gn&&"function"==typeof Gn.get?Gn.get:null,Zn=Hn&&Map.prototype.forEach,qn="function"==typeof Set&&Set.prototype,Kn=Object.getOwnPropertyDescriptor&&qn?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Wn=qn&&Kn&&"function"==typeof Kn.get?Kn.get:null,Xn=qn&&Set.prototype.forEach,Yn="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,Jn="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,eo="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,to=Boolean.prototype.valueOf,io=Object.prototype.toString,ro=Function.prototype.toString,no=String.prototype.match,oo=String.prototype.slice,so=String.prototype.replace,ao=String.prototype.toUpperCase,lo=String.prototype.toLowerCase,co=RegExp.prototype.test,uo=Array.prototype.concat,ho=Array.prototype.join,po=Array.prototype.slice,fo=Math.floor,Ao="function"==typeof BigInt?BigInt.prototype.valueOf:null,mo=Object.getOwnPropertySymbols,go="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,_o="function"==typeof Symbol&&"object"==typeof Symbol.iterator,yo="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===_o||"symbol")?Symbol.toStringTag:null,vo=Object.prototype.propertyIsEnumerable,xo=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function bo(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||co.call(/e/,t))return t;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var r=e<0?-fo(-e):fo(e);if(r!==e){var n=String(r),o=oo.call(t,n.length+1);return so.call(n,i,"$&_")+"."+so.call(so.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return so.call(t,i,"$&_")}var wo=Vn,To=wo.custom,Bo=ko(To)?To:null,Co={__proto__:null,double:'"',single:"'"},So={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Eo=function e(t,i,r,n){var o=i||{};if(Ro(o,"quoteStyle")&&!Ro(Co,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ro(o,"maxStringLength")&&("number"==typeof o.maxStringLength?o.maxStringLength<0&&o.maxStringLength!==1/0:null!==o.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=!Ro(o,"customInspect")||o.customInspect;if("boolean"!=typeof s&&"symbol"!==s)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ro(o,"indent")&&null!==o.indent&&"\t"!==o.indent&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ro(o,"numericSeparator")&&"boolean"!=typeof o.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return Uo(t,o);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var l=String(t);return a?bo(t,l):l}if("bigint"==typeof t){var c=String(t)+"n";return a?bo(t,c):c}var u=void 0===o.depth?5:o.depth;if(void 0===r&&(r=0),r>=u&&u>0&&"object"==typeof t)return Lo(t)?"[Array]":"[Object]";var h=function(e,t){var i;if("\t"===e.indent)i="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;i=ho.call(Array(e.indent+1)," ")}return{base:i,prev:ho.call(Array(t+1),i)}}(o,r);if(void 0===n)n=[];else if(Oo(n,t)>=0)return"[Circular]";function d(t,i,s){if(i&&(n=po.call(n)).push(i),s){var a={depth:o.depth};return Ro(o,"quoteStyle")&&(a.quoteStyle=o.quoteStyle),e(t,a,r+1,n)}return e(t,o,r+1,n)}if("function"==typeof t&&!Fo(t)){var p=function(e){if(e.name)return e.name;var t=no.call(ro.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),f=Go(t,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(f.length>0?" { "+ho.call(f,", ")+" }":"")}if(ko(t)){var A=_o?so.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):go.call(t);return"object"!=typeof t||_o?A:Qo(A)}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var m="<"+lo.call(String(t.nodeName)),g=t.attributes||[],_=0;_"}if(Lo(t)){if(0===t.length)return"[]";var y=Go(t,d);return h&&!function(e){for(var t=0;t=0)return!1;return!0}(y)?"["+Ho(y,h)+"]":"[ "+ho.call(y,", ")+" ]"}if(function(e){return"[object Error]"===Do(e)&&Po(e)}(t)){var v=Go(t,d);return"cause"in Error.prototype||!("cause"in t)||vo.call(t,"cause")?0===v.length?"["+String(t)+"]":"{ ["+String(t)+"] "+ho.call(v,", ")+" }":"{ ["+String(t)+"] "+ho.call(uo.call("[cause]: "+d(t.cause),v),", ")+" }"}if("object"==typeof t&&s){if(Bo&&"function"==typeof t[Bo]&&wo)return wo(t,{depth:u-r});if("symbol"!==s&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!$n||!e||"object"!=typeof e)return!1;try{$n.call(e);try{Wn.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var x=[];return Zn&&Zn.call(t,(function(e,i){x.push(d(i,t,!0)+" => "+d(e,t))})),Vo("Map",$n.call(t),x,h)}if(function(e){if(!Wn||!e||"object"!=typeof e)return!1;try{Wn.call(e);try{$n.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var b=[];return Xn&&Xn.call(t,(function(e){b.push(d(e,t))})),Vo("Set",Wn.call(t),b,h)}if(function(e){if(!Yn||!e||"object"!=typeof e)return!1;try{Yn.call(e,Yn);try{Jn.call(e,Jn)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return jo("WeakMap");if(function(e){if(!Jn||!e||"object"!=typeof e)return!1;try{Jn.call(e,Jn);try{Yn.call(e,Yn)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return jo("WeakSet");if(function(e){if(!eo||!e||"object"!=typeof e)return!1;try{return eo.call(e),!0}catch(e){}return!1}(t))return jo("WeakRef");if(function(e){return"[object Number]"===Do(e)&&Po(e)}(t))return Qo(d(Number(t)));if(function(e){if(!e||"object"!=typeof e||!Ao)return!1;try{return Ao.call(e),!0}catch(e){}return!1}(t))return Qo(d(Ao.call(t)));if(function(e){return"[object Boolean]"===Do(e)&&Po(e)}(t))return Qo(to.call(t));if(function(e){return"[object String]"===Do(e)&&Po(e)}(t))return Qo(d(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||void 0!==ge&&t===ge)return"{ [object globalThis] }";if(!function(e){return"[object Date]"===Do(e)&&Po(e)}(t)&&!Fo(t)){var w=Go(t,d),T=xo?xo(t)===Object.prototype:t instanceof Object||t.constructor===Object,B=t instanceof Object?"":"null prototype",C=!T&&yo&&Object(t)===t&&yo in t?oo.call(Do(t),8,-1):B?"Object":"",S=(T||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(C||B?"["+ho.call(uo.call([],C||[],B||[]),": ")+"] ":"");return 0===w.length?S+"{}":h?S+"{"+Ho(w,h)+"}":S+"{ "+ho.call(w,", ")+" }"}return String(t)};function Mo(e,t,i){var r=i.quoteStyle||t,n=Co[r];return n+e+n}function Io(e){return so.call(String(e),/"/g,""")}function Po(e){return!yo||!("object"==typeof e&&(yo in e||void 0!==e[yo]))}function Lo(e){return"[object Array]"===Do(e)&&Po(e)}function Fo(e){return"[object RegExp]"===Do(e)&&Po(e)}function ko(e){if(_o)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!go)return!1;try{return go.call(e),!0}catch(e){}return!1}var zo=Object.prototype.hasOwnProperty||function(e){return e in this};function Ro(e,t){return zo.call(e,t)}function Do(e){return io.call(e)}function Oo(e,t){if(e.indexOf)return e.indexOf(t);for(var i=0,r=e.length;it.maxStringLength){var i=e.length-t.maxStringLength,r="... "+i+" more character"+(i>1?"s":"");return Uo(oo.call(e,0,t.maxStringLength),t)+r}var n=So[t.quoteStyle||"single"];return n.lastIndex=0,Mo(so.call(so.call(e,n,"\\$1"),/[\x00-\x1f]/g,No),"single",t)}function No(e){var t=e.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return i?"\\"+i:"\\x"+(t<16?"0":"")+ao.call(t.toString(16))}function Qo(e){return"Object("+e+")"}function jo(e){return e+" { ? }"}function Vo(e,t,i,r){return e+" ("+t+") {"+(r?Ho(i,r):ho.call(i,", "))+"}"}function Ho(e,t){if(0===e.length)return"";var i="\n"+t.prev+t.base;return i+ho.call(e,","+i)+"\n"+t.prev}function Go(e,t){var i=Lo(e),r=[];if(i){r.length=e.length;for(var n=0;n=0&&"[object Array]"!==Fs(e)&&"callee"in e&&"[object Function]"===Fs(e.callee)},Rs=function(){return ks(arguments)}();ks.isLegacyArguments=zs;var Ds,Os=Rs?ks:zs,Us={}.toString,Ns=Array.isArray||function(e){return"[object Array]"==Us.call(e)},Qs=Ht.exports,js=Vr,Vs=Er("%ArrayBuffer%",!0),Hs=js("ArrayBuffer.prototype.byteLength",!0),Gs=js("Object.prototype.toString"),$s=!!Vs&&!Hs&&new Vs(0).slice,Zs=!!$s&&Qs($s),qs=Hs||Zs?function(e){if(!e||"object"!=typeof e)return!1;try{return Hs?Hs(e):Zs(e,0),!0}catch(e){return!1}}:Vs?function(e){return"[object ArrayBuffer]"===Gs(e)}:function(e){return!1},Ks=Vr,Ws=Ks("Date.prototype.getDay"),Xs=Ks("Object.prototype.toString"),Ys=Ps(),Js=Vr,ea=Ps(),ta=Oi,ia=Bt;if(ea){var ra=Js("RegExp.prototype.exec"),na={},oa=function(){throw na},sa={toString:oa,valueOf:oa};"symbol"==typeof Symbol.toPrimitive&&(sa[Symbol.toPrimitive]=oa),Ds=function(e){if(!e||"object"!=typeof e)return!1;var t=ia(e,"lastIndex");if(!(t&&ta(t,"value")))return!1;try{ra(e,sa)}catch(e){return e===na}}}else{var aa=Js("Object.prototype.toString");Ds=function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===aa(e)}}var la=Ds,ca=Vr("SharedArrayBuffer.prototype.byteLength",!0),ua=ca?function(e){if(!e||"object"!=typeof e)return!1;try{return ca(e),!0}catch(e){return!1}}:function(e){return!1},ha=Vr,da=ha("String.prototype.valueOf"),pa=ha("Object.prototype.toString"),fa=Ps(),Aa=Vr,ma=Aa("Number.prototype.toString"),ga=Aa("Object.prototype.toString"),_a=Ps(),ya=Vr,va=ya("Boolean.prototype.toString"),xa=ya("Object.prototype.toString"),ba=Ps(),wa={exports:{}},Ta=la,Ba=Vr("RegExp.prototype.exec"),Ca=wt,Sa=Vr,Ea=Sa("Object.prototype.toString"),Ma=function(e){if(!Ta(e))throw new Ca("`regex` must be a RegExp");return function(t){return null!==Ba(e,t)}};if(ai()){var Ia=Sa("Symbol.prototype.toString"),Pa=Ma(/^Symbol\(.*\)$/);wa.exports=function(e){if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||"[object Symbol]"!==Ea(e))return!1;try{return function(e){return"symbol"==typeof e.valueOf()&&Pa(Ia(e))}(e)}catch(e){return!1}}}else wa.exports=function(e){return!1};var La={exports:{}},Fa="undefined"!=typeof BigInt&&BigInt;if("function"==typeof Fa&&"function"==typeof BigInt&&"bigint"==typeof Fa(42)&&"bigint"==typeof BigInt(42)){var ka=BigInt.prototype.valueOf;La.exports=function(e){return null!=e&&"boolean"!=typeof e&&"string"!=typeof e&&"number"!=typeof e&&"symbol"!=typeof e&&"function"!=typeof e&&("bigint"==typeof e||function(e){try{return ka.call(e),!0}catch(e){}return!1}(e))}}else La.exports=function(e){return!1};var za,Ra=function(e){return"string"==typeof e||!(!e||"object"!=typeof e)&&(fa?function(e){try{return da(e),!0}catch(e){return!1}}(e):"[object String]"===pa(e))},Da=function(e){return"number"==typeof e||!(!e||"object"!=typeof e)&&(_a?function(e){try{return ma(e),!0}catch(e){return!1}}(e):"[object Number]"===ga(e))},Oa=function(e){return"boolean"==typeof e||null!==e&&"object"==typeof e&&(ba?function(e){try{return va(e),!0}catch(e){return!1}}(e):"[object Boolean]"===xa(e))},Ua=wa.exports,Na=La.exports,Qa="function"==typeof Map&&Map.prototype?Map:null,ja="function"==typeof Set&&Set.prototype?Set:null;Qa||(za=function(e){return!1});var Va=Qa?Map.prototype.has:null,Ha=ja?Set.prototype.has:null;za||Va||(za=function(e){return!1});var Ga,$a=za||function(e){if(!e||"object"!=typeof e)return!1;try{if(Va.call(e),Ha)try{Ha.call(e)}catch(e){return!0}return e instanceof Qa}catch(e){}return!1},Za="function"==typeof Map&&Map.prototype?Map:null,qa="function"==typeof Set&&Set.prototype?Set:null;qa||(Ga=function(e){return!1});var Ka=Za?Map.prototype.has:null,Wa=qa?Set.prototype.has:null;Ga||Wa||(Ga=function(e){return!1});var Xa,Ya=Ga||function(e){if(!e||"object"!=typeof e)return!1;try{if(Wa.call(e),Ka)try{Ka.call(e)}catch(e){return!0}return e instanceof qa}catch(e){}return!1},Ja="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,el="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;Ja||(Xa=function(e){return!1});var tl=Ja?Ja.prototype.has:null,il=el?el.prototype.has:null;Xa||tl||(Xa=function(e){return!1});var rl=Xa||function(e){if(!e||"object"!=typeof e)return!1;try{if(tl.call(e,tl),il)try{il.call(e,il)}catch(e){return!0}return e instanceof Ja}catch(e){}return!1},nl={exports:{}},ol=Vr,sl=Er("%WeakSet%",!0),al=ol("WeakSet.prototype.has",!0);if(al){var ll=ol("WeakMap.prototype.has",!0);nl.exports=function(e){if(!e||"object"!=typeof e)return!1;try{if(al(e,al),ll)try{ll(e,ll)}catch(e){return!0}return e instanceof sl}catch(e){}return!1}}else nl.exports=function(e){return!1};var cl,ul,hl=$a,dl=Ya,pl=rl,fl=nl.exports,Al=Function.prototype.toString,ml="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof ml&&"function"==typeof Object.defineProperty)try{cl=Object.defineProperty({},"length",{get:function(){throw ul}}),ul={},ml((function(){throw 42}),null,cl)}catch(Ty){Ty!==ul&&(ml=null)}else ml=null;var gl=/^\s*class\b/,_l=function(e){try{var t=Al.call(e);return gl.test(t)}catch(e){return!1}},yl=function(e){try{return!_l(e)&&(Al.call(e),!0)}catch(e){return!1}},vl=Object.prototype.toString,xl="function"==typeof Symbol&&!!Symbol.toStringTag,bl=!(0 in[,]),wl=function(){return!1};if("object"==typeof document){var Tl=document.all;vl.call(Tl)===vl.call(document.all)&&(wl=function(e){if((bl||!e)&&(void 0===e||"object"==typeof e))try{var t=vl.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}var Bl=ml?function(e){if(wl(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{ml(e,null,cl)}catch(e){if(e!==ul)return!1}return!_l(e)&&yl(e)}:function(e){if(wl(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(xl)return yl(e);if(_l(e))return!1;var t=vl.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&yl(e)},Cl=Bl,Sl=Object.prototype.toString,El=Object.prototype.hasOwnProperty;var Ml=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Il="undefined"==typeof globalThis?ge:globalThis,Pl=function(e,t,i){if(!Cl(t))throw new TypeError("iterator must be a function");var r;arguments.length>=3&&(r=i),function(e){return"[object Array]"===Sl.call(e)}(e)?function(e,t,i){for(var r=0,n=e.length;r-1?hn(i):i},ql=Qn,Kl=Er,Wl=function(e){if(null!=e&&void 0!==e[jn])return e[jn]()},Xl=function(){var e,t={assert:function(e){if(!t.has(e))throw new fs("Side channel does not contain "+As(e))},delete:function(t){return!!e&&e.delete(t)},get:function(t){return e&&e.get(t)},has:function(t){return!!e&&e.has(t)},set:function(t,i){e||(e=gs()),e.set(t,i)}};return t},Yl=Ms,Jl=Os,ec=Ns,tc=qs,ic=function(e){return"object"==typeof e&&null!==e&&(Ys?function(e){try{return Ws(e),!0}catch(e){return!1}}(e):"[object Date]"===Xs(e))},rc=la,nc=ua,oc=yt,sc=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e?null:Ra(e)?"String":Da(e)?"Number":Oa(e)?"Boolean":Ua(e)?"Symbol":Na(e)?"BigInt":void 0},ac=function(e){if(e&&"object"==typeof e){if(hl(e))return"Map";if(dl(e))return"Set";if(pl(e))return"WeakMap";if(fl(e))return"WeakSet"}return!1},lc=function(e){if(!e||"object"!=typeof e)return!1;if(!Ol){var t=Ql(Dl(e),8,-1);return jl(Nl,t)>-1?t:"Object"===t&&function(e){var t=!1;return Pl(Vl,(function(i,r){if(!t)try{i(e),t=Ql(r,1)}catch(e){}})),t}(e)}return zl?function(e){var t=!1;return Pl(Vl,(function(i,r){if(!t)try{"$"+i(e)===r&&(t=Ql(r,1))}catch(e){}})),t}(e):null},cc=function(e){return Gl(e)?Hl?Hl(e):e.byteLength:NaN},uc=Zl("SharedArrayBuffer.prototype.byteLength",!0),hc=Zl("Date.prototype.getTime"),dc=Object.getPrototypeOf,pc=Zl("Object.prototype.toString"),fc=Kl("%Set%",!0),Ac=Zl("Map.prototype.has",!0),mc=Zl("Map.prototype.get",!0),gc=Zl("Map.prototype.size",!0),_c=Zl("Set.prototype.add",!0),yc=Zl("Set.prototype.delete",!0),vc=Zl("Set.prototype.has",!0),xc=Zl("Set.prototype.size",!0);function bc(e,t,i,r){for(var n,o=Wl(e);(n=o.next())&&!n.done;)if(Sc(t,n.value,i,r))return yc(e,n.value),!0;return!1}function wc(e){return void 0===e?null:"object"!=typeof e?"symbol"!=typeof e&&("string"!=typeof e&&"number"!=typeof e||+e==+e):void 0}function Tc(e,t,i,r,n,o){var s=wc(i);if(null!=s)return s;var a=mc(t,s),l=$l({},n,{strict:!1});return!(void 0===a&&!Ac(t,s)||!Sc(r,a,l,o))&&(!Ac(e,s)&&Sc(r,a,l,o))}function Bc(e,t,i){var r=wc(i);return null!=r?r:vc(t,r)&&!vc(e,r)}function Cc(e,t,i,r,n,o){for(var s,a,l=Wl(e);(s=l.next())&&!s.done;)if(Sc(i,a=s.value,n,o)&&Sc(r,mc(t,a),n,o))return yc(e,a),!0;return!1}function Sc(e,t,i,r){var n=i||{};if(n.strict?Yl(e,t):e===t)return!0;if(sc(e)!==sc(t))return!1;if(!e||!t||"object"!=typeof e&&"object"!=typeof t)return n.strict?Yl(e,t):e==t;var o,s=r.has(e),a=r.has(t);if(s&&a){if(r.get(e)===r.get(t))return!0}else o={};return s||r.set(e,o),a||r.set(t,o),function(e,t,i,r){var n,o;if(typeof e!=typeof t)return!1;if(null==e||null==t)return!1;if(pc(e)!==pc(t))return!1;if(Jl(e)!==Jl(t))return!1;var s=ec(e),a=ec(t);if(s!==a)return!1;var l=e instanceof Error,c=t instanceof Error;if(l!==c)return!1;if((l||c)&&(e.name!==t.name||e.message!==t.message))return!1;var u=rc(e),h=rc(t);if(u!==h)return!1;if((u||h)&&(e.source!==t.source||ql(e)!==ql(t)))return!1;var d=ic(e),p=ic(t);if(d!==p)return!1;if((d||p)&&hc(e)!==hc(t))return!1;if(i.strict&&dc&&dc(e)!==dc(t))return!1;var f=lc(e),A=lc(t);if(f!==A)return!1;if(f||A){if(e.length!==t.length)return!1;for(n=0;n=0;n--)if(b[n]!=w[n])return!1;for(n=b.length-1;n>=0;n--)if(!Sc(e[o=b[n]],t[o],i,r))return!1;var T=ac(e),B=ac(t);if(T!==B)return!1;if("Set"===T||"Set"===B)return function(e,t,i,r){if(xc(e)!==xc(t))return!1;var n,o,s,a=Wl(e),l=Wl(t);for(;(n=a.next())&&!n.done;)if(n.value&&"object"==typeof n.value)s||(s=new fc),_c(s,n.value);else if(!vc(t,n.value)){if(i.strict)return!1;if(!Bc(e,t,n.value))return!1;s||(s=new fc),_c(s,n.value)}if(s){for(;(o=l.next())&&!o.done;)if(o.value&&"object"==typeof o.value){if(!bc(s,o.value,i.strict,r))return!1}else if(!i.strict&&!vc(e,o.value)&&!bc(s,o.value,i.strict,r))return!1;return 0===xc(s)}return!0}(e,t,i,r);if("Map"===T)return function(e,t,i,r){if(gc(e)!==gc(t))return!1;var n,o,s,a,l,c,u=Wl(e),h=Wl(t);for(;(n=u.next())&&!n.done;)if(a=n.value[0],l=n.value[1],a&&"object"==typeof a)s||(s=new fc),_c(s,a);else if(void 0===(c=mc(t,a))&&!Ac(t,a)||!Sc(l,c,i,r)){if(i.strict)return!1;if(!Tc(e,t,a,l,i,r))return!1;s||(s=new fc),_c(s,a)}if(s){for(;(o=h.next())&&!o.done;)if(a=o.value[0],c=o.value[1],a&&"object"==typeof a){if(!Cc(s,e,a,c,i,r))return!1}else if(!(i.strict||e.has(a)&&Sc(mc(e,a),c,i,r)||Cc(s,e,a,c,$l({},i,{strict:!1}),r)))return!1;return 0===xc(s)}return!0}(e,t,i,r);return!0}(e,t,n,r)}function Ec(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&(!(e.length>0&&"number"!=typeof e[0])&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))))}var Mc=function(e,t,i){return Sc(e,t,i,Xl())};function Ic(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}function Pc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var Lc=function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var r,n,o;if(Array.isArray(t)){if((r=t.length)!=i.length)return!1;for(n=r;0!=n--;)if(!e(t[n],i[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(i,o[n]))return!1;for(n=r;0!=n--;){var s=o[n];if(!e(t[s],i[s]))return!1}return!0}return t!=t&&i!=i},Fc=Pc(Lc);const kc="__googleMapsScriptId";var zc;!function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"}(zc||(zc={}));class Rc{constructor({apiKey:e,authReferrerPolicy:t,channel:i,client:r,id:n=kc,language:o,libraries:s=[],mapIds:a,nonce:l,region:c,retries:u=3,url:h="https://maps.googleapis.com/maps/api/js",version:d}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=e,this.authReferrerPolicy=t,this.channel=i,this.client=r,this.id=n||kc,this.language=o,this.libraries=s,this.mapIds=a,this.nonce=l,this.region=c,this.retries=u,this.url=h,this.version=d,Rc.instance){if(!Fc(this.options,Rc.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(Rc.instance.options)}`);return Rc.instance}Rc.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?zc.FAILURE:this.done?zc.SUCCESS:this.loading?zc.LOADING:zc.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(e+=`&key=${this.apiKey}`),this.channel&&(e+=`&channel=${this.channel}`),this.client&&(e+=`&client=${this.client}`),this.libraries.length>0&&(e+=`&libraries=${this.libraries.join(",")}`),this.language&&(e+=`&language=${this.language}`),this.region&&(e+=`®ion=${this.region}`),this.version&&(e+=`&v=${this.version}`),this.mapIds&&(e+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(e+=`&auth_referrer_policy=${this.authReferrerPolicy}`),e}deleteScript(){const e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise(((e,t)=>{this.loadCallback((i=>{i?t(i.error):e(window.google)}))}))}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,t;if(document.getElementById(this.id))return void this.callback();const i={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(i).forEach((e=>!i[e]&&delete i[e])),(null===(t=null===(e=null===window||void 0===window?void 0:window.google)||void 0===e?void 0:e.maps)||void 0===t?void 0:t.importLibrary)||(e=>{let t,i,r,n="The Google Maps JavaScript API",o="google",s="importLibrary",a="__ib__",l=document,c=window;c=c[o]||(c[o]={});const u=c.maps||(c.maps={}),h=new Set,d=new URLSearchParams,p=()=>t||(t=new Promise(((s,c)=>Ic(this,void 0,void 0,(function*(){var p;for(r in yield i=l.createElement("script"),i.id=this.id,d.set("libraries",[...h]+""),e)d.set(r.replace(/[A-Z]/g,(e=>"_"+e[0].toLowerCase())),e[r]);d.set("callback",o+".maps."+a),i.src=this.url+"?"+d,u[a]=s,i.onerror=()=>t=c(Error(n+" could not load.")),i.nonce=this.nonce||(null===(p=l.querySelector("script[nonce]"))||void 0===p?void 0:p.nonce)||"",l.head.append(i)})))));u[s]?console.warn(n+" only loads once. Ignoring:",e):u[s]=(e,...t)=>h.add(e)&&p().then((()=>u[s](e,...t)))})(i);const r=this.libraries.map((e=>this.importLibrary(e)));r.length||r.push(this.importLibrary("core")),Promise.all(r).then((()=>this.callback()),(e=>{const t=new ErrorEvent("error",{error:e});this.loadErrorCallback(t)}))}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){const e=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout((()=>{this.deleteScript(),this.setScript()}),e)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach((e=>{e(this.onerrorEvent)})),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version)return console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."),void this.callback();this.loading=!0,this.setScript()}}}function Dc(e){let i;return{c(){i=b("div"),E(i,"id",e[0]),E(i,"class","map svelte-16c2pp7")},m(e,t){y(e,i,t)},p(e,[t]){1&t&&E(i,"id",e[0])},i:t,o:t,d(e){e&&v(i)}}}function Oc(e,t,i){let r,n,{id:o}=t,{bearing:s}=t,{center:a}=t,{pitch:l}=t,{zoom:c}=t,{mapStyle:u}=t,{numberOfMaps:h}=t,{onMapMount:d}=t;Ie.subscribe((e=>({googleMapsAPIKey:n}=e)));const p=H();let f,A={};const m=new Rc({apiKey:n,version:"beta"}),g=()=>({bearing:f.getHeading(),center:{lng:f.getCenter().lng(),lat:f.getCenter().lat()},pitch:f.getTilt(),zoom:f.getZoom()-1}),_=()=>{const e=y(g()),t=y(A);return!Mc(e,t)},y=e=>({bearing:Re(e.bearing,1),pitch:Re(e.pitch,1),center:{lat:Re(e.center.lat,6),lng:Re(e.center.lng,6)},zoom:Re(e.zoom,2)});return j((()=>{m.load().then((()=>{var t;HTMLCanvasElement.prototype.getContext=(t=HTMLCanvasElement.prototype.getContext,function(e,i){return(i=i||{}).preserveDrawingBuffer=!0,t.call(this,e,i)}),i(8,f=new google.maps.Map(document.getElementById(o),{center:A.center,zoom:A.zoom,mapId:r,disableDefaultUI:!0,isFractionalZoomEnabled:!0,fullscreenControl:!1,zoomControl:!1})),d(f);const n=et((()=>{document.getElementById(o).querySelector('div[tabindex="0"]').focus()}),250);document.getElementById(o).addEventListener("wheel",n,{passive:!0}),f.addListener("center_changed",e),f.addListener("heading_changed",e),f.addListener("tilt_changed",e),f.addListener("zoom_changed",e)}));const e=()=>{document.getElementById(o).contains(document.activeElement)&&_()&&p("mapMove",{options:g()})}})),e.$$set=e=>{"id"in e&&i(0,o=e.id),"bearing"in e&&i(1,s=e.bearing),"center"in e&&i(2,a=e.center),"pitch"in e&&i(3,l=e.pitch),"zoom"in e&&i(4,c=e.zoom),"mapStyle"in e&&i(5,u=e.mapStyle),"numberOfMaps"in e&&i(6,h=e.numberOfMaps),"onMapMount"in e&&i(7,d=e.onMapMount)},e.$$.update=()=>{if(32&e.$$.dirty&&(r=u?.mapId),30&e.$$.dirty&&i(9,A={bearing:s,center:a,pitch:l,zoom:c}),768&e.$$.dirty&&(e=>{e&&_()&&e.moveCamera({center:{lat:a.lat,lng:a.lng},zoom:c+1,heading:s,tilt:l})})(f),321&e.$$.dirty&&f&&h){const e=document.getElementById(o);if(e){new ResizeObserver((()=>{google.maps.event.trigger(f,"resize")})).observe(e)}}},[o,s,a,l,c,u,h,d,f,A]}class Uc extends me{constructor(e){super(),Ae(this,e,Oc,Dc,a,{id:0,bearing:1,center:2,pitch:3,zoom:4,mapStyle:5,numberOfMaps:6,onMapMount:7})}}function Nc(e){let i;return{c(){i=b("div"),E(i,"id",e[0]),E(i,"class","map svelte-369bnt")},m(e,t){y(e,i,t)},p(e,[t]){1&t&&E(i,"id",e[0])},i:t,o:t,d(e){e&&v(i)}}}function Qc(e,t,i){let r;l(e,Ie,(e=>i(18,r=e)));let n,{id:o}=t,{bearing:s}=t,{center:a}=t,{pitch:c}=t,{showCollisions:u}=t,{showBoundaries:h}=t,{zoom:d}=t,{mapStyle:p}=t,{numberOfMaps:f}=t,{onMapMount:A}=t,{mapRenderer:m}=t;const g=H();let _,y,v={},x=null,b=!1,w={};const T=()=>({bearing:y.getBearing(),center:y.getCenter(),pitch:y.getPitch(),zoom:y.getZoom()}),B=(e,t)=>{e&&!Mc(T(),w)&&e.jumpTo(t)};return j((async()=>{await(async()=>{"maplibre-gl"===m?(await Promise.resolve().then((function(){return wp})),n=await Promise.resolve().then((function(){return Be}))):"maptiler-sdk"===m?(await Promise.resolve().then((function(){return Tp})),n=await Promise.resolve().then((function(){return Ib})),n.config.apiKey=r.maptilerApiKey):(await Promise.resolve().then((function(){return Pb})),n=await Promise.resolve().then((function(){return be})),n.accessToken=r.mapboxGlAccessToken,r.mapboxBaseApiUrl&&(n.baseApiUrl=r.mapboxBaseApiUrl))})();const e=n;i(13,y=new e.Map({container:o,style:_,canvasContextAttributes:{preserveDrawingBuffer:!0},preserveDrawingBuffer:!0,...w})),A(y);const t=et((()=>{document.getElementById(o).querySelector('canvas[tabindex="0"]').focus()}),250);document.getElementById(o).addEventListener("wheel",t,{passive:!0});y.on("move",(e=>{e?.resize||(({origin:e})=>{document.getElementById(o)?.contains(document.activeElement)&&g("mapMove",{options:T()})})(e)})),y.on("click",(t=>{let i=y.queryRenderedFeatures(t.point);i.length&&(b?(x.remove(),x=null):(x=(new e.Popup).setLngLat(t.lngLat).setHTML((e=>{const t=e.reduce(((e,t)=>{const{source:i,sourceLayer:r,properties:n}=t;return e.some((e=>{const t=e.source===i&&e.sourceLayer===r,o=Object.keys(n).every((t=>n[t]===e.properties[t]));return t&&o}))||e.push(t),e}),[]);let i='",i})(i)).setMaxWidth(360).addTo(y),b=!0,x.on("close",(()=>{b=!1}))))}))})),V((()=>{y&&y.remove()})),e.$$set=e=>{"id"in e&&i(0,o=e.id),"bearing"in e&&i(1,s=e.bearing),"center"in e&&i(2,a=e.center),"pitch"in e&&i(3,c=e.pitch),"showCollisions"in e&&i(4,u=e.showCollisions),"showBoundaries"in e&&i(5,h=e.showBoundaries),"zoom"in e&&i(6,d=e.zoom),"mapStyle"in e&&i(7,p=e.mapStyle),"numberOfMaps"in e&&i(8,f=e.numberOfMaps),"onMapMount"in e&&i(9,A=e.onMapMount),"mapRenderer"in e&&i(10,m=e.mapRenderer)},e.$$.update=()=>{128&e.$$.dirty&&i(11,({style:v,url:_}=p),v,(i(12,_),i(7,p))),78&e.$$.dirty&&i(14,w={bearing:s,center:a,pitch:c,zoom:d}),8208&e.$$.dirty&&y&&i(13,y.showCollisionBoxes=u,y),8224&e.$$.dirty&&y&&i(13,y.showTileBoundaries=h,y),24576&e.$$.dirty&&B(y,w),14336&e.$$.dirty&&((e,t,i)=>{e&&e.setStyle(t||i)})(y,_,v),9473&e.$$.dirty&&y&&f&&"maplibre-gl"!==m&&"maptiler-sdk"!==m&&y.once("render",(()=>{const e=document.getElementById(o);if(e){new ResizeObserver((()=>{y.resize({resize:!0})})).observe(e)}}))},[o,s,a,c,u,h,d,p,f,A,m,v,_,y,w]}class jc extends me{constructor(e){super(),Ae(this,e,Qc,Nc,a,{id:0,bearing:1,center:2,pitch:3,showCollisions:4,showBoundaries:5,zoom:6,mapStyle:7,numberOfMaps:8,onMapMount:9,mapRenderer:10})}}var Vc={exports:{}}; +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function Pp(){return Sp||(Sp=1,Ip.read=function(e,t,i,r,n){var o,s,a=8*n-r-1,l=(1<>1,u=-7,h=i?n-1:0,d=i?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},Ip.write=function(e,t,i,r,n,o){var s,a,l,c=8*o-n-1,u=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,A=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*l-1)*Math.pow(2,n),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;e[i+p]=255&a,p+=f,a/=256,n-=8);for(s=s<0;e[i+p]=255&s,p+=f,s/=256,c-=8);e[i+p-f]|=128*A}),Ip}function Lp(){if(Mp)return Ep;Mp=1,Ep=t;var e=Pp();function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var i=4294967296,r=1/i,n="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function o(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function a(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function l(e,t){for(var i=0;i>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos>3,o=this.pos;this.type=7&r,e(n,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=g(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=g(this.buf,this.pos)+g(this.buf,this.pos+4)*i;return this.pos+=8,e},readSFixed64:function(){var e=g(this.buf,this.pos)+y(this.buf,this.pos+4)*i;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return s(e,r,t);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return s(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&n?function(e,t,i){return n.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var r="",n=t;n239?4:l>223?3:l>191?2:1;if(n+u>i)break;1===u?l<128&&(c=l):2===u?128==(192&(o=e[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(s=e[n+2],128==(192&(o=e[n+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(s=e[n+2],a=e[n+3],128==(192&(o=e[n+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,u=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=u}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,i){if(this.type!==t.Bytes)return e.push(this.readVarint(i));var r=o(this);for(e=e||[];this.pos127;);else if(i===t.Bytes)this.pos=this.readVarint()+this.pos;else if(i===t.Fixed32)this.pos+=4;else{if(i!==t.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,o=0;o55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&a(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i=128&&a(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,i,r){this.writeTag(e,t.Bytes),this.writeRawMessage(i,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,l,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,c,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,d,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,u,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,h,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,p,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,A,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,m,t)},writeBytesField:function(e,i){this.writeTag(e,t.Bytes),this.writeBytes(i)},writeFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeSFixed64(i)},writeVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeVarint(i)},writeSVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeSVarint(i)},writeStringField:function(e,i){this.writeTag(e,t.Bytes),this.writeString(i)},writeFloatField:function(e,i){this.writeTag(e,t.Fixed32),this.writeFloat(i)},writeDoubleField:function(e,i){this.writeTag(e,t.Fixed64),this.writeDouble(i)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},Ep}var Fp=t(Lp());const kp=3;function zp(e,t,i){t.glyphs=[],1===e&&i.readMessage(Rp,t)}function Rp(e,t,i){if(3===e){const{id:e,bitmap:r,width:n,height:o,left:s,top:a,advance:l}=i.readMessage(Dp,{});t.glyphs.push({id:e,bitmap:new hu({width:n+2*kp,height:o+2*kp},r),metrics:{width:n,height:o,left:s,top:a,advance:l}})}else 4===e?t.ascender=i.readSVarint():5===e&&(t.descender=i.readSVarint())}function Dp(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}const Op=kp,Up={horizontal:1,vertical:2,horizontalOnly:3};class Np{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,t){const i=new Np;return i.scale=e||1,i.fontStack=t,i}static forImage(e){const t=new Np;return t.image=e,t}}class Qp{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t,i){const r=new Qp;for(let n=0;n=0&&i>=e&&Vp[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const i=new Qp;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Np.forText(e.scale,e.fontStack||t));const i=this.sections.length-1;for(let t=0;t=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function jp(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A=1){const m=Qp.fromFeature(e,n,A);h===Up.vertical&&m.verticalizePunctuation(d);let g=[];const _=function(e,t,i,r,n,o){if(!e)return[];const s=[],a=function(e,t,i,r,n,o){let s=0;for(let i=0;i=0;let c=0;for(let i=0;i0&&o>x&&(x=o)}else{const e=i[a.fontStack];if(!e)continue;e[A]&&(T=e[A]);const r=t[a.fontStack];if(!r)continue;const o=r.glyphs[A];if(!o)continue;if(y=o.metrics,C=8203!==A?mp:0,m){const e=void 0!==r.ascender?Math.abs(r.ascender):0,t=void 0!==r.descender?Math.abs(r.descender):0,i=(e+t)*g;b-i/2;){if(s--,s<0)return!1;a-=e[s].dist(o),o=e[s]}a+=e[s].dist(e[s+1]),s++;const l=[];let c=0;for(;ar;)c-=l.shift().angleDelta;if(c>n)return!1;s++,a+=t.dist(i)}return!0}function rf(e){let t=0;for(let i=0;ic){const u=(c-l)/o,h=Et(r.x,n.x,u),d=Et(r.y,n.y,u),p=new ef(h,d,0,n.angleTo(r),i);return!s||tf(e,p,a,s,t)?p:void 0}l+=o}}function af(e,t,i,r,n,o,s,a,l){const c=nf(r,o,s),u=of(r,n),h=u*s,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h=0&&g=0&&_=0&&d+c<=u){const i=new ef(g,_,0,A,t);r&&!tf(e,i,o,r,n)||p.push(i)}}h+=f}return a||p.length||s||(p=lf(e,h/2,i,r,n,o,s,!0,l)),p}function cf(e,t,i,r,n){const o=[];for(let s=0;s=r&&c.x>=r||(s.x>=r?s=new V(r,s.y+(r-s.x)/(c.x-s.x)*(c.y-s.y))._round():c.x>=r&&(c=new V(r,s.y+(r-s.x)/(c.x-s.x)*(c.y-s.y))._round()),s.y>=n&&c.y>=n||(s.y>=n?s=new V(s.x+(n-s.y)/(c.y-s.y)*(c.x-s.x),n)._round():c.y>=n&&(c=new V(s.x+(n-s.y)/(c.y-s.y)*(c.x-s.x),n)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(c)))))}}return o}function uf(e){let t=0,i=0;for(const r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort(((e,t)=>t.h-e.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,o=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const i=r[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,o=Math.max(o,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===i.w&&t.h===i.h){const t=r.pop();e1?s-1:s,du.copy(r.data,l,{x:0,y:0},{x:a,y:c},r.data,i),du.copy(r.data,l,{x:0,y:h-s},{x:a,y:c-s},{width:u,height:s},i),du.copy(r.data,l,{x:0,y:0},{x:a,y:c+h},{width:u,height:s},i),du.copy(r.data,l,{x:u-s,y:0},{x:a-s,y:c},{width:s,height:h},i),du.copy(r.data,l,{x:0,y:0},{x:a+u,y:c},{width:s,height:h},i),du.copy(r.data,l,{x:u-s,y:h-s},{x:a-s,y:c-s},{width:s,height:s},i),du.copy(r.data,l,{x:0,y:h-s},{x:a+u,y:c-s},{width:s,height:s},i),du.copy(r.data,l,{x:0,y:0},{x:a+u,y:c+h},{width:s,height:s},i),du.copy(r.data,l,{x:u-s,y:0},{x:a-s,y:c+h},{width:s,height:s},i)}this.lut=i,this.image=l,this.iconPositions=r,this.patternPositions=n}addImages(e,t,i,r){for(const[n,o]of e.entries()){const{bin:e,imagePosition:s,imageVariant:a}=pf(n,o,i);t.set(n,s),r.push(e),o.hasRenderCallback&&this.haveRenderCallbacks.push(a.id)}}patchUpdatedImages(e,t,i){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((t=>e.hasImage(t,i))),e.dispatchRenderCallbacks(this.haveRenderCallbacks,i);for(const r of e.getUpdatedImages(i)){for(const n of this.iconPositions.keys()){const o=ei.parse(n);if(bt.isEqual(o.id,r)){const o=e.getImage(r,i);this.patchUpdatedImage(this.iconPositions.get(n),o,t)}}for(const n of this.patternPositions.keys()){const o=ei.parse(n);if(bt.isEqual(o.id,r)){const o=e.getImage(r,i);this.patchUpdatedImage(this.patternPositions.get(n),o,t)}}}}patchUpdatedImage(e,t,i){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[r,n]=e.tl,o=e.sdf;if(this.lut||o){const e={width:t.data.width,height:t.data.height},s=new du(e);du.copy(t.data,s,{x:0,y:0},{x:0,y:0},e,this.lut,o),i.update(s,{position:{x:r,y:n}})}else i.update(t.data,{position:{x:r,y:n}})}}co(df,"ImagePosition"),co(ff,"ImageAtlas");const Af=1e20;function mf(e,t,i,r,n,o,s,a,l){for(let c=t;c-1);l++,o[l]=a,s[l]=c,s[l+1]=Af}for(let a=0,l=0;a{let r=this.entries[e];r||(r=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=r.glyphs[t];if(void 0!==o)return void i(null,{stack:e,id:t,glyph:o});if(o=this._tinySDF(r,e,t),o)return r.glyphs[t]=o,void i(null,{stack:e,id:t,glyph:o});const s=Math.floor(t/256);if(256*s>65535)return de("glyphs > 65535 not supported"),void i(null,{stack:e,id:t,glyph:o});if(r.ranges[s])return void i(null,{stack:e,id:t,glyph:o});let a=r.requests[s];a||(a=r.requests[s]=[],vf.loadGlyphRange(e,s,n,this.requestManager,((e,t)=>{if(t){r.ascender=t.ascender,r.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(r.glyphs[+e]=t.glyphs[+e]);r.ranges[s]=!0}for(const i of a)i(e,t);delete r.requests[s]}))),a.push(((r,n)=>{r?i(r):n&&i(null,{stack:e,id:t,glyph:n.glyphs[t]||null})}))}),((e,t)=>{if(e)i(e);else if(t){const e={};for(const{stack:i,id:r,glyph:n}of t)void 0===e[i]&&(e[i]={}),void 0===e[i].glyphs&&(e[i].glyphs={}),e[i].glyphs[r]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[i].ascender=this.entries[i].ascender,e[i].descender=this.entries[i].descender;i(null,e)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==yf.none&&(this.localGlyphMode===yf.all?!!this.localFontFamily:!!this.localFontFamily&&(Ao["CJK Unified Ideographs"](e)||Ao["Hangul Syllables"](e)||Ao.Hiragana(e)||Ao.Katakana(e)||Ao["CJK Symbols and Punctuation"](e)||Ao["CJK Unified Ideographs Extension A"](e)||Ao["CJK Unified Ideographs Extension B"](e)||Ao.Osage(e)))}_tinySDF(e,t,i){const r=this.localFontFamily;if(!r||!this._doesCharSupportLocalGlyph(i))return;let n=e.tinySDF;if(!n){let i="400";/bold/i.test(t)?i="900":/medium/i.test(t)?i="500":/light/i.test(t)&&(i="200"),n=e.tinySDF=new vf.TinySDF({fontFamily:r,fontWeight:i,fontSize:24*_f,buffer:3*_f,radius:8*_f}),n.fontWeight=i}if(this.localGlyphs[n.fontWeight][i])return this.localGlyphs[n.fontWeight][i];const o=String.fromCodePoint(i),{data:s,width:a,height:l,glyphWidth:c,glyphHeight:u,glyphLeft:h,glyphTop:d,glyphAdvance:p}=n.draw(o);return this.localGlyphs[n.fontWeight][i]={id:i,bitmap:new hu({width:a,height:l},s),metrics:{width:c/_f,height:u/_f,left:h/_f,top:d/_f-27,advance:p/_f,localGlyph:!0}}}}vf.loadGlyphRange=function(e,t,i,r,n){const o=256*t,s=o+255,a=r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",`${o}-${s}`),Je.Glyphs);rt(a,((e,t)=>{if(e)n(e);else if(t){const e={},i=function(e){return new Fp(e).readFields(zp,{})}(t);for(const t of i.glyphs)e[t.id]=t;n(null,{glyphs:e,ascender:i.ascender,descender:i.descender})}}))},vf.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=r,this.radius=i;const a=this.size=e+4*t,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${o} ${e}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,s+Math.ceil(r)),c=a+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return p;const{ctx:f,buffer:A,gridInner:m,gridOuter:g}=this;f.clearRect(A,A,a,l),f.fillText(e,A,A+s);const _=f.getImageData(A,A,a,l);g.fill(Af,0,h),m.fill(0,0,h);for(let e=0;e0?e*e:0,m[r]=e<0?e*e:0}}mf(g,0,0,c,u,c,this.f,this.v,this.z),mf(m,A,A,a,l,c,this.f,this.v,this.z);for(let e=0;e{const d=Cf(r.stretch-_,y,u,e.left*n),p=Sf(r.fixed-b,w,r.stretch,f),m=Cf(o.stretch-v,x,h,e.top*n),g=Sf(o.fixed-T,B,o.stretch,A),C=Cf(l.stretch-_,y,u,e.left*n),S=Sf(l.fixed-b,w,l.stretch,f),E=Cf(c.stretch-v,x,h,e.top*n),M=Sf(c.fixed-T,B,c.stretch,A),I=new V(d,m),P=new V(C,m),L=new V(C,E),F=new V(d,E),k=new V(p/a,g/a),z=new V(S/a,M/a),R=t*Math.PI/180;if(R){const e=Math.sin(R),t=Math.cos(R),i=[t,-e,e,t];I._matMult(i),P._matMult(i),F._matMult(i),L._matMult(i)}const D=r.stretch+r.fixed,O=l.stretch+l.fixed,U=o.stretch+o.fixed,N=c.stretch+c.fixed,Q=e.imageSecondary;return{tl:I,tr:P,bl:F,br:L,texPrimary:{x:s.paddedRect.x+xf+D,y:s.paddedRect.y+xf+U,w:O-D,h:N-U},texSecondary:Q?{x:Q.paddedRect.x+xf+D,y:Q.paddedRect.y+xf+U,w:O-D,h:N-U}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:k,pixelOffsetBR:z,minFontScaleX:w/a/u,minFontScaleY:B/a/h,isSDF:i}};if(r&&(s.stretchX||s.stretchY)){const e=Bf(d,m,f),t=Bf(p,g,A);for(let i=0;io)&&(o=t.x),(!e||t.y>s)&&(s=t.y)}const l=Math.min(o-r,s-n);let c=l/2;const u=new Wi([],If);if(0===l)return new V(r,n);for(let t=r;th.d||!h.d)&&(h=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-h.d<=t||(c=r.h/2,u.push(new Pf(r.p.x-c,r.p.y-c,c,e)),u.push(new Pf(r.p.x+c,r.p.y-c,c,e)),u.push(new Pf(r.p.x-c,r.p.y+c,c,e)),u.push(new Pf(r.p.x+c,r.p.y+c,c,e)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${h.d}`)),h.p}function If(e,t){return t.max-e.max}class Pf{constructor(e,t,i,r){this.p=new V(e,t),this.h=i,this.d=function(e,t){let i=!1,r=1/0;for(let n=0;ne.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(i=!i),r=Math.min(r,Gl(e,n,a))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}}const Lf=Number.POSITIVE_INFINITY,Ff=Math.sqrt(2);function kf(e,[t,i]){let r=0,n=0;if(i===Lf){t<0&&(t=0);const i=t/Ff;switch(e){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-t;break;case"top":n=t-7}switch(e){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=t;break;case"right":r=-t}}else{switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}}return[r,n]}function zf(e,t,i,r,n,o,s,a){if(!e)return;const l=_p(t,i,r,n,o);return e.scaleSelf(l*a*s)}function Rf(e,t,i,r,n,o,s,a){return{iconPrimary:zf(e.getPrimary(),t,i,r,n,o,s,a),iconSecondary:zf(e.getSecondary(),t,i,r,n,o,s,a)}}function Df(e,t,i,r){if(!e)return;const n=t.get(i.toString());if(e.imagePrimary=n,r){const i=t.get(r.toString());e.imageSecondary=i}}function Of(e,t){for(const i in e.horizontal)Uf(e.horizontal[i],t);Uf(e.vertical,t)}function Uf(e,t){if(e)for(const i of e.positionedLines)for(const e of i.positionedGlyphs)if(null!==e.image){const i=e.image.toString();e.rect=t.get(i).paddedRect}}function Nf(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Qf(e,t,i,r,n,o,s,a,l){const c=$f(o.horizontal)||o.vertical,u=i.get("icon-text-fit-padding").evaluate(r,{},n);let h,d=t;return t&&"none"!==l&&(e.allowVerticalPlacement&&o.vertical&&(h=Jp(t,o.vertical,l,u,a,s)),c&&(d=Jp(t,c,l,u,a,s))),{defaultShapedIcon:d,verticallyShapedIcon:h}}function jf(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y){let v=s.textMaxSize.evaluate(t,{},d);void 0===v?v=a*s.textScaleFactor:v*=s.textScaleFactor;const x=e.layers[0].layout,b=$f(i.horizontal)||i.vertical,w="globe"===p.name,T=mp,B=e.tilePixelRatio*v/T,C=(L=e.overscaling,e.zoom>18&&L>2&&(L>>=1),Math.max(Xi/(512*L),1)*x.get("symbol-spacing")),S=x.get("text-padding")*e.tilePixelRatio,E=x.get("icon-padding")*e.tilePixelRatio,M=Z(x.get("text-max-angle")),I="map"===x.get("icon-rotation-alignment")&&"point"!==y,P=C/2;var L;!1===e.hasAnyIconTextFit&&"none"!==m&&(e.hasAnyIconTextFit=!0);const F=t.properties?+t.properties[ah]:null,k=F&&e.elevationFeatureIdToIndex?e.elevationFeatureIdToIndex.get(F):65535,z=(a,l,y)=>{if(l.x<0||l.x>=Xi||l.y<0||l.y>=Xi)return;let v=null;if(w){const{x:e,y:t,z:i}=p.projectTilePoint(l.x,l.y,y);v={anchor:new ef(e,t,i,0,void 0),up:p.upVector(y,l.x,l.y)}}!function(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S,E){const M=e.addToLineVertexArray(t,r);let I,P,L,F,k,z,R,D=0,O=0,U=0,N=0,Q=-1,j=-1;const V={};let H=mt("");const G=i?i.anchor:t,$="none"!==S;let Z=0,q=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[Z,q]=l.layout.get("text-offset").evaluate(v,{},T).map((e=>e*mp)):(Z=l.layout.get("text-radial-offset").evaluate(v,{},T)*mp,q=Lf),e.allowVerticalPlacement&&n.vertical){const e=n.vertical;if(f)z=qf(e),a&&(R=qf(a));else{const i=l.layout.get("text-rotate").evaluate(v,{},T)+90;L=Zf(c,G,t,u,h,d,e,p,i,A),a&&(F=Zf(c,G,t,u,h,d,a,g,i))}}if(o){const r=e.iconSizeData,n=l.layout.get("icon-rotate").evaluate(v,{},T),s=wf(o,n,b,$,x.iconScaleFactor),p=a?wf(a,n,b,$,x.iconScaleFactor):void 0;P=Zf(c,G,t,u,h,d,o,g,n,null),D=4*s.length;let f=null;"source"===r.kind?(f=[gp*l.layout.get("icon-size").evaluate(v,{},T)*x.iconScaleFactor],f[0]>Hf&&de(`${e.layerIds[0]}: Value for "icon-size" is >= ${Vf}. Reduce your "icon-size".`)):"composite"===r.kind&&(f=[gp*x.compositeIconSizes[0].evaluate(v,{},T)*x.iconScaleFactor,gp*x.compositeIconSizes[1].evaluate(v,{},T)*x.iconScaleFactor],(f[0]>Hf||f[1]>Hf)&&de(`${e.layerIds[0]}: Value for "icon-size" is >= ${Vf}. Reduce your "icon-size".`)),e.addSymbols(e.icon,s,f,y,_,v,!1,i,t,M.lineStartIndex,M.lineLength,-1,w,T,B,C),Q=e.icon.placedSymbolArray.length-1,p&&(O=4*p.length,e.addSymbols(e.icon,p,f,y,_,v,Up.vertical,i,t,M.lineStartIndex,M.lineLength,-1,w,T,B,C),j=e.icon.placedSymbolArray.length-1)}for(const r in n.horizontal){const o=n.horizontal[r];I||(H=mt(o.text),f?k=qf(o):I=Zf(c,G,t,u,h,d,o,p,l.layout.get("text-rotate").evaluate(v,{},T),A));const a=1===o.positionedLines.length;if(U+=Gf(e,i,t,o,s,l,f,v,A,M,n.vertical?Up.horizontal:Up.horizontalOnly,a?Object.keys(n.horizontal):[r],V,Q,x,w,T,B),a)break}n.vertical&&(N+=Gf(e,i,t,n.vertical,s,l,f,v,A,M,Up.vertical,["vertical"],V,j,x,w,T,B));let K=-1;const W=(e,t)=>e?Math.max(e,t):t;K=W(k,K),K=W(z,K),K=W(R,K);const X=K>-1?1:0;e.glyphOffsetArray.length>=65535&&de("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==v.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,v.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,G.x,G.y,G.z,V.right>=0?V.right:-1,V.center>=0?V.center:-1,V.left>=0?V.left:-1,V.vertical>=0?V.vertical:-1,Q,j,H,void 0!==I?I:e.collisionBoxArray.length,void 0!==I?I+1:e.collisionBoxArray.length,void 0!==L?L:e.collisionBoxArray.length,void 0!==L?L+1:e.collisionBoxArray.length,void 0!==P?P:e.collisionBoxArray.length,void 0!==P?P+1:e.collisionBoxArray.length,F||e.collisionBoxArray.length,F?F+1:e.collisionBoxArray.length,u,U,N,D,O,X,0,Z,q,K,0,$?1:0,E)}(e,l,v,a,i,r,o,n,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,S,_,c,0,E,I,g,t,s,u,h,d,f,A,m,k)};if("line"===y)for(const n of cf(t.geometry,0,0,Xi,Xi)){const t=af(n,C,M,i.vertical||b,r,T,B,e.overscaling,Xi);for(const i of t)b&&Kf(e,b.text,P,i)||z(n,i,d)}else if("line-center"===y){for(const e of t.geometry)if(e.length>1){const t=sf(e,M,i.vertical||b,r,T,B);t&&z(e,t,d)}}else if("Polygon"===t.type)for(const e of Hu(t.geometry,0)){const t=Mf(e,16);z(e[0],new ef(t.x,t.y,0,0,void 0),d)}else if("LineString"===t.type)for(const e of t.geometry)z(e,new ef(e[0].x,e[0].y,0,0,void 0),d);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)z([t],new ef(t.x,t.y,0,0,void 0),d)}const Vf=255,Hf=Vf*gp;function Gf(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g){const _=function(e,t,i,r,n,o,s,a){const l=[];if(0===t.positionedLines.length)return l;const c=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=function(e){const t=e[0],i=e[1],r=t*i;return r>0?[t,-i]:r<0?[-t,i]:0===t?[i,t]:[i,-t]}(i);let h=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)h-=e.lineOffset;const d=t.positionedLines.length,p=h/d;let f=t.top-i[1];for(let e=0;eHf&&de(`${e.layerIds[0]}: Value for "text-size" is >= ${Vf}. Reduce your "text-size".`)):"composite"===y.kind&&(v=[gp*f.compositeTextSizes[0].evaluate(a,{},m)*f.textScaleFactor,gp*f.compositeTextSizes[1].evaluate(a,{},m)*f.textScaleFactor],(v[0]>Hf||v[1]>Hf)&&de(`${e.layerIds[0]}: Value for "text-size" is >= ${Vf}. Reduce your "text-size".`)),e.addSymbols(e.text,_,v,l,s,a,u,t,i,c.lineStartIndex,c.lineLength,p,A,m,g,!1);for(const t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*_.length}function $f(e){for(const t in e)return e[t];return null}function Zf(e,t,i,r,n,o,s,a,l,c){let u=s.top,h=s.bottom,d=s.left,p=s.right;const f=s.collisionPadding;if(f&&(d-=f[0],u-=f[1],p+=f[2],h+=f[3]),l){const e=new V(d,u),t=new V(p,u),i=new V(d,h),r=new V(p,h),n=Z(l);let o=new V(0,0);c&&(o=new V(c[0],c[1])),e._rotateAround(n,o),t._rotateAround(n,o),i._rotateAround(n,o),r._rotateAround(n,o),d=Math.min(e.x,t.x,i.x,r.x),p=Math.max(e.x,t.x,i.x,r.x),u=Math.min(e.y,t.y,i.y,r.y),h=Math.max(e.y,t.y,i.y,r.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,d,u,p,h,a,r,n,o),e.length-1}function qf(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function Kf(e,t,i,r){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])y&&(v(e,c,r,n,a,l),v(c,i,a,l,o,s))}v(h,d,r,o,n,o),v(d,p,n,o,n,s),v(p,f,n,s,r,s),v(f,h,r,s,r,o),A-=y,m-=y,g+=y,_+=y;const x=1/Math.max(g-A,_-m);return{scale:x,x:A*x,y:m*x,x2:g*x,y2:_*x,projection:t}}function Yf(e,{x:t,y:i},r=0){return new V(((t-r)*e.scale-e.x)*Xi,(i*e.scale-e.y)*Xi)}const Jf=U.mat4.identity(new Float32Array(16));class eA{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new cl(0,0)}projectTilePoint(e,t,i){return{x:e,y:t,z:0}}locationPoint(e,t,i,r=!0){return e._coordinatePoint(e.locationCoordinate(t,i),r)}pixelsPerMeter(e,t){return ml(1,e)*t}pixelSpaceConversion(e,t,i){return 1}farthestPixelDistance(e){return Wf(e,e.pixelsPerMeter)}pointCoordinate(e,t,i,r){const n=e.horizonLineFromTop(!1),o=new V(t,Math.max(n,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(o,r))}pointCoordinate3D(e,t,i){const r=new V(t,i);if(e.elevation)return e.elevation.pointCoordinate(r);{const t=this.pointCoordinate(e,r.x,r.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const i=e.horizonLineFromTop();return t.y0?t<-cA+i&&(t=-cA+i):t>cA-i&&(t=cA-i);const o=n/Math.pow(uA(t),r);let s=o*Math.sin(r*e),a=n-o*Math.cos(r*e);return s=.5*(s/Math.PI+.5),a=.5*(a/Math.PI+.5),{x:s,y:this.southernCenter?a:1-a,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:i,f:r}=this,n=r-t,o=Math.sign(n),s=Math.sign(i)*Math.sqrt(e*e+n*n);let a=Math.atan2(e,Math.abs(n))*o;n*i<0&&(a-=Math.PI*Math.sign(e)*o);const l=J(q(a/i)+this.center[0],-180,180),c=J(q(2*Math.atan(Math.pow(r/s,1/i))-cA),-vl,vl);return new cl(l,this.southernCenter?-c:c)}}class dA extends eA{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:fl(e),y:Al(t),z:0}}unproject(e,t){const i=gl(e),r=_l(t);return new cl(i,r)}}const pA=Z(vl);class fA extends eA{project(e,t){const i=(t=Z(t))*t,r=i*i;return{x:.5*((e=Z(e))*(.8707-.131979*i+r*(r*(.003971*i-.001529*r)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+r*(.028874*i-.044475-.005916*r)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,r=25,n=0,o=i*i;do{o=i*i;const e=o*o;n=(i*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-t)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),i=J(i-n,-pA,pA)}while(Math.abs(n)>1e-6&&--r>0);o=i*i;const s=J(q(e/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),a=q(i);return new cl(s,a)}}const AA=Z(vl);class mA extends eA{project(e,t){t=Z(t),e=Z(e);const i=Math.cos(t),r=2/Math.PI,n=Math.acos(i*Math.cos(e/2)),o=Math.sin(n)/n,s=.5*(e*r+2*i*Math.sin(e/2)/o)||0,a=.5*(t+Math.sin(t)/o)||0;return{x:.5*(s/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}}unproject(e,t){let i=e=(2*e-.5)*Math.PI,r=t=(2*(1-t)-1)*Math.PI,n=25;const o=1e-6;let s=0,a=0;do{const n=Math.cos(r),o=Math.sin(r),l=2*o*n,c=o*o,u=n*n,h=Math.cos(i/2),d=Math.sin(i/2),p=2*h*d,f=d*d,A=1-u*h*h,m=A?1/A:0,g=A?Math.acos(n*h)*Math.sqrt(1/A):0,_=.5*(2*g*n*d+2*i/Math.PI)-e,y=.5*(g*o+r)-t,v=.5*m*(u*f+g*n*h*c)+1/Math.PI,x=m*(p*l/4-g*o*d),b=.125*m*(l*d-g*o*u*p),w=.5*m*(c*h+g*f*n)+.5,T=x*b-w*v;s=(y*x-_*w)/T,a=(_*b-y*v)/T,i=J(i-s,-Math.PI,Math.PI),r=J(r-a,-AA,AA)}while((Math.abs(s)>o||Math.abs(a)>o)&&--n>0);return new cl(q(i),q(r))}}class gA extends eA{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Z(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:i,cosPhi:r}=this;return{x:Z(e)*r*i+.5,y:-Math.sin(Z(t))/r*i+.5,z:0}}unproject(e,t){const{scale:i,cosPhi:r}=this,n=-(t-.5)/i,o=J(q((e-.5)/i)/r,-180,180),s=Math.asin(J(n*r,-1,1)),a=J(q(s),-vl,vl);return new cl(o,a)}}class _A extends dA{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,i){const r=Rc(e,t,i),n=Uc(Ic(i));return U.vec3.transformMat4(r,r,n),{x:r[0],y:r[1],z:r[2]}}locationPoint(e,t,i){const r=sl(t.lat,t.lng),n=U.vec3.normalize([],r),o=i?e._centerAltitude+i:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude,s=ml(1,0)*Xi*o;U.vec3.scaleAndAdd(r,r,n,s);const a=U.mat4.identity(new Float64Array(16));return U.mat4.multiply(a,e.pixelMatrix,e.globeMatrix),U.vec3.transformMat4(r,r,a),new V(r[0],r[1])}pixelsPerMeter(e,t){return ml(1,0)*t}pixelSpaceConversion(e,t,i){const r=ml(1,e)*t,n=Et(ml(1,45)*t,r,i);return this.pixelsPerMeter(e,t)/n}createTileMatrix(e,t,i){const r=Nc(Ic(i.canonical));return U.mat4.multiply(new Float64Array(16),e.globeMatrix,r)}createInversionMatrix(e,t){const{center:i}=e,r=Uc(Ic(t));return U.mat4.rotateY(r,r,Z(i.lng)),U.mat4.rotateX(r,r,Z(i.lat)),U.mat4.scale(r,r,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(r)}pointCoordinate(e,t,i,r){return Sc(e,t,i,!0)||new Bl(0,0)}pointCoordinate3D(e,t,i){const r=this.pointCoordinate(e,t,i,0);return[r.x,r.y,r.z]}isPointAboveHorizon(e,t){return!Sc(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const i=e.cameraToCenterDistance,r=e._centerAltitude*t,n=e._camera,o=e._camera.forward(),s=U.vec3.add([],U.vec3.scale([],o,-i),[0,0,r]),a=e.worldSize/(2*Math.PI),l=[0,0,-a],c=e.width/e.height,u=Math.tan(e.fovAboveCenter),h=U.vec3.scale([],n.up(),u),d=U.vec3.scale([],n.right(),u*c),p=U.vec3.normalize([],U.vec3.add([],U.vec3.add([],o,h),d)),f=[];let A;if(new gc(s,p).closestPointOnSphere(l,a,f)){const t=U.vec3.add([],f,l),i=U.vec3.sub([],t,s);A=Math.cos(e.fovAboveCenter)*U.vec3.length(i)}else{const e=U.vec3.sub([],s,l),t=U.vec3.sub([],l,s);U.vec3.normalize(t,t);const i=U.vec3.length(e)-a;A=Math.sqrt(i*(i+2*a));const r=Math.acos(A/(a+i))-Math.acos(U.vec3.dot(o,t));A*=Math.cos(r)}return 1.01*A}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=Hc(e.zoom);if(i>0){const r=Wf(e,ml(1,e.center.lat)*e.worldSize),n=e.worldSize/(2*Math.PI),o=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Et(t,r+n*(1-Math.cos(o)),Math.pow(i,10))}return t}upVector(e,t,i){return Rc(t,i,e,1)}upVectorScale(e){return{metersToTile:Bc(Dc(Ic(e)))}}}function yA(e){const t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new dA(e);case"equirectangular":return new lA(e);case"naturalEarth":return new fA(e);case"equalEarth":return new aA(e);case"winkelTripel":return new mA(e);case"albers":return i?new gA(e):new tA(e);case"lambertConformalConic":return i?new gA(e):new hA(e);case"globe":return new _A(e)}throw new Error(`Invalid projection name: ${e.name}`)}const vA=sh.VectorTileFeature.types,xA=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function bA(e,t,i,r,n,o,s,a,l,c,u,h,d){const p=a?Math.min(Hf,Math.round(a[0])):0,f=a?Math.min(Hf,Math.round(a[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),o,s,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function wA(e,t,i){e.emplaceBack(t,i)}function TA(e,t,i,r,n,o,s){e.emplaceBack(t,i,r,n,o,s)}function BA(e,t,i,r,n){e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n)}function CA(e){for(const t of e.sections)if(To(t.text))return!0;return!1}class SA{constructor(e){this.layoutVertexArray=new ks,this.indexArray=new Vs,this.programConfigurations=e,this.segments=new _a,this.dynamicLayoutVertexArray=new Rs,this.opacityVertexArray=new Ds,this.placedSymbolArray=new sa,this.iconTransitioningVertexArray=new Os,this.globeExtVertexArray=new zs,this.zOffsetVertexArray=new Bs}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}upload(e,t,i,r,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ap.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,cp.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,xA,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,hp.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,lp.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,up.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}co(SA,"SymbolBuffers");class EA{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new _a,this.collisionVertexArray=new js,this.collisionVertexArrayExt=new Rs}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,dp.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,pp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}co(EA,"CollisionBuffers");class MA{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=U.mat4.identity([]),this.placementViewportMatrix=U.mat4.identity([]);const t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=yp(this.zoom,t["text-size"]),this.iconSizeData=yp(this.zoom,t["icon-size"]);const i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==r.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=i.get("text-writing-mode").map((e=>Up[e])),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new SA(new Ga(this.layers,{zoom:this.zoom,lut:this.lut},(e=>e.startsWith("text")||e.startsWith("symbol")))),this.icon=new SA(new Ga(this.layers,{zoom:this.zoom,lut:this.lut},(e=>e.startsWith("icon")||e.startsWith("symbol")))),this.glyphOffsetArray=new ca,this.lineVertexArray=new ua,this.symbolInstances=new la}calculateGlyphDependencies(e,t,i,r,n){for(const i of e){const e=i.codePointAt(0);if(void 0===e)break;if(t[e]=!0,r&&n&&e<=65535){const e=Tp[i];e&&(t[e.charCodeAt(0)]=!0)}}}updateFootprints(e,t){}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!$h(this.activeReplacements,i)&&(this.activeReplacements=i,!0)}populate(e,t,i,r){const n=this.layers[0],o=n.layout,s="globe"===this.projection.name,a=o.get("text-font"),l=o.get("text-field"),c=o.get("icon-image"),[u,h]=o.get("icon-size-scale-range"),d=J(t.scaleFactor||1,u,h),p=("constant"!==l.value.kind||l.value.value instanceof Jt&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),f="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,A=o.get("symbol-sort-key");if(this.features=[],!p&&!f)return;const m=t.iconDependencies,g=t.glyphDependencies,_=t.availableImages,y=new Do(this.zoom);for(const{feature:t,id:l,index:c,sourceLayerIndex:u}of e){const e=n._featureFilter.needGeometry,h=kl(t,e);if(!n._featureFilter.filter(y,h,i))continue;if(e||(h.geometry=Fl(t,i,r)),s&&1!==t.type&&i.z<=5){const e=h.geometry,t=.98078528056,r=(e,r)=>{const n=Rc(e.x,e.y,i,1),o=Rc(r.x,r.y,i,1);return U.vec3.dot(n,o)=0;for(const i of v.sections)if(i.image){const e=i.image.getPrimary().scaleSelf(this.pixelRatio),t=e.id.toString(),r=m.get(t)||[];r.push(e),m.set(t,r)}else{const r=mo(v.toString()),n=i.fontStack||e,o=g[n]=g[n]||{};this.calculateGlyphDependencies(i.text,o,t,this.allowVerticalPlacement,r)}}}if("line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},r=[];let n=0;function o(t){r.push(e[t]),n++}function s(e,t,n){const o=i[e];return delete i[e],i[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function a(e,i,n){const o=t[i];return delete t[i],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(e,t,i){const r=i?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let c=0;ce.geometry))}(this.features)),"hd-road-markup"===o.get("symbol-elevation-reference")){if(this.elevationType="road",t.elevationFeatures){!this.elevationFeatures&&t.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const e of t.elevationFeatures)this.elevationFeatureIdToIndex.set(e.id,this.elevationFeatures.length),this.elevationFeatures.push(e)}}else o.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,i,r,n,o,s){this.text.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s),this.icon.programConfigurations.updatePaintArrays(e,t,n,i,r,o,s)}updateRoadElevation(){if("road"!==this.elevationType||!this.elevationFeatures)return;if(this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let e=!1;for(let t=0;t{i+=t,i>e.length&&e.resize(i);for(let n=-t;n<0;n++)e.emplace(n+i,r)},t=(e,t,i)=>{r+=t,r>e.length&&e.resize(r);for(let n=-t;n<0;n++)e.emplace(n+r,i)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let i=0,r=0;for(let i=0;i0;if((n>0||o>0)&&(e(this.text.zOffsetVertexArray,n,a),e(this.text.zOffsetVertexArray,o,a)),l){const{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:i}=r;e>=0&&t(this.icon.zOffsetVertexArray,s,a),i>=0&&t(this.icon.zOffsetVertexArray,r.numVerticalIconVertices,a)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=yA(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:e,y:i}of t)this.lineVertexArray.emplaceBack(e,i);return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A){const m=e.indexArray,g=e.layoutVertexArray,_=e.globeExtVertexArray,y=e.segments.prepareSegment(4*t.length,g,m,this.canOverlap?o.sortKey:void 0),v=this.glyphOffsetArray.length,x=y.vertexLength,b=this.allowVerticalPlacement&&s===Up.vertical?Math.PI/2:0,w=o.text&&o.text.sections;for(let r=0;r=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:r),o=vp(this.textSizeData,e,n)/mp;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,t,i){const r=this.icon.placedSymbolArray.get(i),n=vp(this.iconSizeData,e,r);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,t,i,r){e.emplaceBack(t,-i,-i,r),e.emplaceBack(t,i,-i,r),e.emplaceBack(t,i,i,r),e.emplaceBack(t,-i,i,r)}_updateTextDebugCollisionBoxes(e,t,i,r,n,o,s){for(let s=r;s0}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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;tr[e]-r[t]||n[t]-n[e])),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;ethis.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset))}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:i,centerJustifiedTextSymbolIndex:r,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:a}=t;i>=0&&this.addIndicesForPlacedSymbol(this.text,i),r>=0&&r!==i&&this.addIndicesForPlacedSymbol(this.text,r),n>=0&&n!==r&&n!==i&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let IA,PA,LA;co(MA,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),MA.addDynamicAttributes=BA;class FA{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:zt,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}co(FA,"FormatSectionOverride",{omit:["defaultValue"]});const kA=()=>LA||(LA={layout:IA||(IA=new Ko({"symbol-placement":new $o(Wo.layout_symbol["symbol-placement"]),"symbol-spacing":new $o(Wo.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new $o(Wo.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Zo(Wo.layout_symbol["symbol-sort-key"]),"symbol-z-order":new $o(Wo.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new $o(Wo.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new $o(Wo.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new $o(Wo.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new $o(Wo.layout_symbol["icon-ignore-placement"]),"icon-optional":new $o(Wo.layout_symbol["icon-optional"]),"icon-rotation-alignment":new $o(Wo.layout_symbol["icon-rotation-alignment"]),"icon-size":new Zo(Wo.layout_symbol["icon-size"]),"icon-size-scale-range":new $o(Wo.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Zo(Wo.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Zo(Wo.layout_symbol["icon-text-fit-padding"]),"icon-image":new Zo(Wo.layout_symbol["icon-image"]),"icon-rotate":new Zo(Wo.layout_symbol["icon-rotate"]),"icon-padding":new $o(Wo.layout_symbol["icon-padding"]),"icon-keep-upright":new $o(Wo.layout_symbol["icon-keep-upright"]),"icon-offset":new Zo(Wo.layout_symbol["icon-offset"]),"icon-anchor":new Zo(Wo.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new $o(Wo.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new $o(Wo.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new $o(Wo.layout_symbol["text-rotation-alignment"]),"text-field":new Zo(Wo.layout_symbol["text-field"]),"text-font":new Zo(Wo.layout_symbol["text-font"]),"text-size":new Zo(Wo.layout_symbol["text-size"]),"text-size-scale-range":new $o(Wo.layout_symbol["text-size-scale-range"]),"text-max-width":new Zo(Wo.layout_symbol["text-max-width"]),"text-line-height":new Zo(Wo.layout_symbol["text-line-height"]),"text-letter-spacing":new Zo(Wo.layout_symbol["text-letter-spacing"]),"text-justify":new Zo(Wo.layout_symbol["text-justify"]),"text-radial-offset":new Zo(Wo.layout_symbol["text-radial-offset"]),"text-variable-anchor":new $o(Wo.layout_symbol["text-variable-anchor"]),"text-anchor":new Zo(Wo.layout_symbol["text-anchor"]),"text-max-angle":new $o(Wo.layout_symbol["text-max-angle"]),"text-writing-mode":new $o(Wo.layout_symbol["text-writing-mode"]),"text-rotate":new Zo(Wo.layout_symbol["text-rotate"]),"text-padding":new $o(Wo.layout_symbol["text-padding"]),"text-keep-upright":new $o(Wo.layout_symbol["text-keep-upright"]),"text-transform":new Zo(Wo.layout_symbol["text-transform"]),"text-offset":new Zo(Wo.layout_symbol["text-offset"]),"text-allow-overlap":new $o(Wo.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new $o(Wo.layout_symbol["text-ignore-placement"]),"text-optional":new $o(Wo.layout_symbol["text-optional"]),visibility:new $o(Wo.layout_symbol.visibility)})),paint:PA||(PA=new Ko({"icon-opacity":new Zo(Wo.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Zo(Wo.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Zo(Wo.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Zo(Wo.paint_symbol["text-emissive-strength"]),"icon-color":new Zo(Wo.paint_symbol["icon-color"]),"icon-halo-color":new Zo(Wo.paint_symbol["icon-halo-color"]),"icon-halo-width":new Zo(Wo.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Zo(Wo.paint_symbol["icon-halo-blur"]),"icon-translate":new $o(Wo.paint_symbol["icon-translate"]),"icon-translate-anchor":new $o(Wo.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Zo(Wo.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Zo(Wo.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Zo(Wo.paint_symbol["text-occlusion-opacity"]),"text-color":new Zo(Wo.paint_symbol["text-color"],{runtimeType:Ut,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Zo(Wo.paint_symbol["text-halo-color"]),"text-halo-width":new Zo(Wo.paint_symbol["text-halo-width"]),"text-halo-blur":new Zo(Wo.paint_symbol["text-halo-blur"]),"text-translate":new $o(Wo.paint_symbol["text-translate"]),"text-translate-anchor":new $o(Wo.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new $o(Wo.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new $o(Wo.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new $o(Wo.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new $o(Wo.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Zo(Wo.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Zo({type:"string",default:"default","property-type":"data-driven"})}))},LA);class zA extends ms{constructor(e,t,i,r){super(e,kA(),t,i,r),this._colorAdjustmentMatrix=U.mat4.identity([]),this.hasInitialOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,t){super.recalculate(e,t),"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"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const i=this.layout.get("text-writing-mode");if(i){const e=[];for(const t of i)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,t,i,r){return this._saturation===e&&this._contrast===t&&this._brightnessMin===i&&this._brightnessMax===r||(this._colorAdjustmentMatrix=function(e,t,i,r){e=we(e),t=be(t);const n=U.mat4.create(),o=e/3,s=1-2*o,a=[s,o,o,0,o,s,o,0,o,o,s,0,0,0,0,1],l=.5-.5*t,c=r-i;return U.mat4.multiply(n,[c,0,0,0,0,c,0,0,0,0,c,0,i,i,i,1],[t,0,0,0,0,t,0,0,0,0,t,0,l,l,l,1]),U.mat4.multiply(n,n,a),n}(e,t,i,r),this._saturation=e,this._contrast=t,this._brightnessMin=i,this._brightnessMax=r),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,i,r){const n=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Xn(o.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,((t,i)=>i in e?String(e[i]):""))}(t.properties,n)}createBucket(e){return new MA(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of kA().paint.overridableProperties){if(!zA.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new FA(t),r=new Wn(i,t.property.specification,this.scope,this.options);let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new Jn("source",r):new eo("composite",r,t.value.zoomStops,t.value._interpolationType),this.paint._values[e]=new Ho(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&zA.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),r=kA().paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof Jt)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{n||(t instanceof si&&ni(t.value)===Vt?o(t.value.sections):t instanceof ui?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,t,i){return{config:new Ha(this,{zoom:t,lut:i}),overrideFog:!1}}}let RA,DA,OA,UA;var NA=vs([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function QA(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function jA(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class VA{constructor(e,t,i,r){this.context=e,this.format=i,this.useMipmap=r&&r.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:r&&r.premultiply})}update(e,t){const i=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,r=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:n}=this,{gl:o}=n,{x:s,y:a}=t&&t.position?t.position:{x:0,y:0},l=s+i,c=a+r;!this.size||this.size[0]===l&&this.size[1]===c||(o.bindTexture(o.TEXTURE_2D,null),o.deleteTexture(this.texture),this.texture=o.createTexture(),this.size=null),o.bindTexture(o.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA8&&(!t||!1!==t.premultiply));const u=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&l>0&&c>0){const e=this.useMipmap?Math.floor(Math.log2(Math.max(l,c)))+1:1;o.texStorage2D(o.TEXTURE_2D,e,this.format,l,c),this.size=[l,c]}if(this.size)if(u)o.texSubImage2D(o.TEXTURE_2D,0,s,a,QA(this.format),jA(this.format),e);else{const t=e.data;t&&o.texSubImage2D(o.TEXTURE_2D,0,s,a,i,r,QA(this.format),jA(this.format),t)}this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(e,t,i=!1){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!i?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,i,r){const{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),t!==this.magFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap?e===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,i),this.wrapS=i),r!==this.wrapT&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrapT=r)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class HA{constructor(e,t){this.context=e,this.texture=t}bind(e,t){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_2D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}}function GA(e,t,i,r,n,o,s,a){const l=[e,t,1,i,r,1,n,o,1],c=[s,a,1],u=U.mat3.adjoint([],l),[h,d,p]=U.vec3.transformMat3(c,c,u);return U.mat3.multiply(l,l,[h,0,0,0,d,0,0,0,p])}function $A(e,t,i,r,n,o,s,a){const l=function(e,t,i,r,n,o,s,a){const l=GA(0,0,1,0,1,1,0,1),c=GA(e,t,i,r,n,o,s,a),u=U.mat3.adjoint([],l);return U.mat3.multiply(c,c,u)}(e,t,i,r,n,o,s,a);return[l[2]/l[8]/Xi,l[5]/l[8]/Xi]}function ZA(e){return[e[0],Math.min(Math.max(e[1],-vl),vl)]}class qA extends xt{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(r),this.options=t,this._dirty=!1}load(e,t){if(this._loaded=t||!1,this.fire(new gt("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=lt(this.map._requestManager.transformRequest(this.url,Je.Image),((t,i)=>{this._imageRequest=null,this._loaded=!0,t?this.fire(new _t(t)):i&&(this.image=i instanceof HTMLImageElement?ke.getImageData(i):i,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new HA(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new gt("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof HA||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let t=e[0][1],i=e[0][1];for(const r of e)r[1]>i&&(i=r[1]),r[1]vl?this.onNorthPole=!0:r<-vl&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const t=e.map(Bl.fromLngLat);this.tileID=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);const o=Math.max(r-t,n-i),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),a=Math.pow(2,s);let l=Math.floor((t+r)/2*a);return l>1&&(l-=1),new ac(s,l,Math.floor((i+n)/2*a))}(t),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new gt("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const t=Xf(new ac(0,0,0),this.map.transform.projection),i=[t.projection.project(this.coordinates[0][0],this.coordinates[0][1]),t.projection.project(this.coordinates[1][0],this.coordinates[1][1]),t.projection.project(this.coordinates[2][0],this.coordinates[2][1]),t.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){const t=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[1].x,n=e[2].y-e[1].y,o=e[3].x-e[2].x,s=e[3].y-e[2].y,a=e[0].x-e[3].x,l=e[0].y-e[3].y,c=t*n-r*i,u=r*s-o*n,h=o*l-a*s,d=a*i-t*l;return c>0&&u>0&&h>0&&d>0||c<0&&u<0&&h<0&&d<0}(i))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const r=Xf(this.tileID,this.map.transform.projection),[n,o,s,a]=this.coordinates.map((e=>{const t=r.projection.project(e[0],e[1]);return Yf(r,t)._round()}));this.perspectiveTransform=$A(n.x,n.y,o.x,o.y,s.x,s.y,a.x,a.y);const l=this._boundsArray=new Ts;l.emplaceBack(n.x,n.y,0,0),l.emplaceBack(o.x,o.y,Xi,0),l.emplaceBack(a.x,a.y,0,Xi),l.emplaceBack(s.x,s.y,Xi,Xi),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(l,NA.members),this.boundsSegments=_a.simpleSegment(0,0,4,2);const c=[],u=[ZA((h=this.coordinates)[0]),ZA(h[1]),ZA(h[2]),ZA(h[3])];var h;const[d,p,f,A]=function(e){let t=e[0][0],i=t,r=e[0][1],n=r;for(let o=1;oi&&(i=e[o][0]),e[o][1]n&&(n=e[o][1]);return[t,r,i-t,n-r]}(u);{const r=new Ts,[n,o,s,a]=function(e){let t=e[0].x,i=t,r=e[0].y,n=r;for(let o=1;oi&&(i=e[o].x),e[o].yn&&(n=e[o].y);return[t,r,i-t,n-r]}(i),l=e=>[(e.x-n)/s,(e.y-o)/a],[u,h,m,g]=i.map(l),_=function(e,t,i,r,n,o,s,a){const l=GA(0,0,1,0,1,1,0,1),c=GA(e,t,i,r,n,o,s,a),u=U.mat3.adjoint([],c);return U.mat3.multiply(l,l,u)}(u[0],u[1],h[0],h[1],m[0],m[1],g[0],g[1]);this.elevatedGlobePerspectiveTransform=$A(u[0],u[1],h[0],h[1],m[0],m[1],g[0],g[1]);const y=(e,t)=>{c.push(e.lng);const i=Math.round((e.lng-d)/f*Xi),n=Math.round((e.lat-p)/A*Xi),o=l(t),s=U.vec3.transformMat3([],[o[0],o[1],1],_),a=Math.round(s[0]/s[2]*Xi),u=Math.round(s[1]/s[2]*Xi);r.emplaceBack(i,n,a,u)},v=i[3].x-i[0].x,x=i[3].y-i[0].y,b=i[2].x-i[1].x,w=i[2].y-i[1].y;for(let e=0;e<65;e++){const r=e/64,n=[i[0].x+r*v,i[0].y+r*x],o=[i[1].x+r*b,i[1].y+r*w],s=o[0]-n[0],a=o[1]-n[1];for(let e=0;e<65;e++){const i=e/64,r={x:n[0]+s*i,y:n[1]+a*i,z:0};y(t.projection.unproject(r.x,r.y),r)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(r,NA.members)}{this.maxLongitudeTriangleSize=0;let t=[],i=new Vs;const r=(e,r,n)=>{i.emplaceBack(e,r,n);const o=c[e],s=c[r],a=c[n],l=Math.min(Math.min(o,s),a),u=Math.max(Math.max(o,s),a)-l;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),t.push(l+u/2)};for(let e=0;e<64;e++)for(let t=0;t<64;t++){const i=65*e+t,n=i+1,o=i+65,s=o+1;r(i,o,n),r(n,o,s)}[t,i]=function(e,t){const i=Array.from({length:e.length},((e,t)=>t));i.sort(((t,i)=>e[t]-e[i]));const r=[],n=new Vs;for(let o=0;o{o.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:t.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},a=.51*this.maxLongitudeTriangleSize;if(Math.abs(i[0]-r)<=a){const e=xe(i,0,i.length,r+a);return e===i.length||s(e,ve(i,e+1,i.length,r+360-a)-e),o}r0){const i=function(e,t){const i=t.worldSize,r=ml(1,0)*i*bl(t.center.lat,t.zoom)/Qc(i),n=ml(1,t.center.lat)*i,o=U.mat4.identity([]);return U.mat4.rotateY(o,o,Z(t.center.lng)),U.mat4.rotateX(o,o,Z(t.center.lat)),U.mat4.translate(o,o,[0,0,Xa]),U.mat4.scale(o,o,[r,r,r*n]),U.mat4.translate(o,o,[t.point.x-.5*i,t.point.y-.5*i,0]),U.mat4.multiply(o,o,e),U.mat4.multiply(o,t.globeMatrix,o)}(e,t);return function(e,t,i){const r=(e,t,i)=>{const r=U.vec3.length(e),n=U.vec3.length(t),o=Pc(e,t,i);return U.vec3.scale(o,o,1/U.vec3.length(o)*Et(r,n,i))},n=r([e[0],e[1],e[2]],[t[0],t[1],t[2]],i),o=r([e[4],e[5],e[6]],[t[4],t[5],t[6]],i),s=r([e[8],e[9],e[10]],[t[8],t[9],t[10]],i),a=Pc([e[12],e[13],e[14]],[t[12],t[13],t[14]],i);return[n[0],n[1],n[2],0,o[0],o[1],o[2],0,s[0],s[1],s[2],0,a[0],a[1],a[2],1]}(n,i,r)}return n}function fm(e,t,i,r){const n=Tc.projectAabbCorners(r,i);let o=Number.MAX_VALUE,s=-1;for(let e=0;enew V(n[e][0],n[e][1]);let l;switch(s){case 0:case 6:l=[a(1),a(5),a(4),a(7),a(3),a(2),a(1)];break;case 1:case 7:l=[a(0),a(4),a(5),a(6),a(2),a(3),a(0)];break;case 3:case 5:l=[a(1),a(0),a(4),a(7),a(6),a(2),a(1)];break;default:l=[a(1),a(5),a(6),a(7),a(3),a(0),a(1)]}if(Ol(e,l))return o}const Am=vs([{name:"a_pos_3f",components:3,type:"Float32"}]),mm=vs([{name:"a_color_3f",components:3,type:"Float32"}]),gm=vs([{name:"a_color_4f",components:4,type:"Float32"}]),_m=vs([{name:"a_uv_2f",components:2,type:"Float32"}]),ym=vs([{name:"a_normal_3f",components:3,type:"Float32"}]),vm=vs([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),xm=vs([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),bm={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class wm{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function Tm(e,t){const i=-1===e.indexOf("://");try{return new URL(e,i&&t?"http://example.com":void 0),!0}catch(e){return!1}}class Bm{constructor(e,t){this.feature=e,this.instancedDataOffset=t,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Cm{constructor(){this.instancedDataArray=new Js,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class Sm{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0}updateFootprints(e,t){}populate(e,t,i,r){this.tileToMeter=Tl(i);const n=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:o,id:s,index:a,sourceLayerIndex:l}of e){const e=null!=s?s:o.properties&&o.properties.hasOwnProperty("id")?o.properties.id:void 0,c=kl(o,n);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),c,i))continue;const u={id:e,sourceLayerIndex:l,index:a,geometry:n?c.geometry:Fl(o,i,r),properties:o.properties,type:o.type,patterns:{}},h=this.addFeature(u,u.geometry,c);h&&t.featureIndex.insert(o,u.geometry,a,l,this.index,this.instancesPerModel[h].instancedDataArray.length,Xi/32)}this.lookup=null}update(e,t,i,r){for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t in e)i.idToFeaturesIndex.hasOwnProperty(t)&&(this.evaluate(i.features[i.idToFeaturesIndex[t]],e[t],i,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t of i.features){const r=this.layers[0],n=t.feature,o=this.canonical,s=r.paint.get("model-rotation").evaluate(n,{},o),a=r.paint.get("model-scale").evaluate(n,{},o),l=r.paint.get("model-translation").evaluate(n,{},o);U.vec3.exactEquals(t.rotation,s)&&U.vec3.exactEquals(t.scale,a)&&U.vec3.exactEquals(t.translation,l)||(this.evaluate(t,t.featureStates,i,!0),e=!0)}}return e}updateReplacement(e,t,i,r){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if($h(this.activeReplacements,n))return!1;this.activeReplacements=n;let o=!1;for(const t in this.instancesPerModel){const n=this.instancesPerModel[t],s=n.instancedDataArray;for(const t of n.features){const n=t.instancedDataOffset,a=t.instancedDataCount;for(let t=0;tXi;l=c?l-Xi:l;const u=Math.floor(l),h=s.float32[a+1];let d=!1;for(const t of this.activeReplacements)if(!jh(t,i,bm.Model,r)&&!(t.min.x>u||u>t.max.x||t.min.y>h||h>t.max.y)&&(d=Yh(Xh(u,h,e.canonical,t.footprintTileId.canonical),t.footprint),d))break;s.float32[a]=d?l+Xi:l,o=o||d!==c}}}return o}isEmpty(){for(const e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];i.instancedDataArray.length<0||0===i.instancedDataArray.length||(i.instancedDataBuffer?i.instancedDataBuffer.updateData(i.instancedDataArray):i.instancedDataBuffer=e.createVertexBuffer(i.instancedDataArray,vm.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const e in this.instancesPerModel){const t=this.instancesPerModel[e];0!==t.instancedDataArray.length&&t.instancedDataBuffer&&t.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris)for(const t of this.modelUris)e.removeModel(t,"")}addFeature(e,t,i){const r=this.layers[0],n=r.layout.get("model-id").evaluate(i,{},this.canonical);if(!n)return de(`modelId is not evaluated for layer ${r.id} and it is not going to get rendered.`),n;Tm(n,!1)&&(this.modelUris.includes(n)||this.modelUris.push(n)),this.instancesPerModel[n]||(this.instancesPerModel[n]=new Cm);const o=this.instancesPerModel[n],s=o.instancedDataArray,a=new Bm(i,s.length);for(const e of t)for(const t of e){if(t.x<0||t.x>=Xi||t.y<0||t.y>=Xi)continue;const e=(this.lookupDim-1)/Xi,i=this.lookupDim*(t.y*e|0)+t.x*e|0;if(this.lookup){if(0!==this.lookup[i])continue;this.lookup[i]=1}this.instanceCount++;const r=s.length;s.resize(r+1),o.instancesEvaluatedElevation.push(0),s.float32[16*r]=t.x,s.float32[16*r+1]=t.y}return a.instancedDataCount=o.instancedDataArray.length-a.instancedDataOffset,a.instancedDataCount>0&&(e.id&&(o.idToFeaturesIndex[e.id]=o.features.length),o.features.push(a),this.evaluate(a,{},o,!1)),n}getModelUris(){return this.modelUris}evaluate(e,t,i,r){const n=this.layers[0],o=e.feature,s=this.canonical,a=e.rotation=n.paint.get("model-rotation").evaluate(o,t,s),l=e.scale=n.paint.get("model-scale").evaluate(o,t,s),c=e.translation=n.paint.get("model-translation").evaluate(o,t,s),u=n.paint.get("model-color").evaluate(o,t,s);u.a=n.paint.get("model-color-mix-intensity").evaluate(o,t,s);const h=[];this.maxVerticalOffset10?this.tileToMeter:Tl(s,p)),a[o+4]=c[0],a[o+5]=c[1],a[o+6]=c[2]+l,a[o+7]=h[0],a[o+8]=h[1],a[o+9]=h[2],a[o+10]=h[4],a[o+11]=h[5],a[o+12]=h[6],a[o+13]=h[8],a[o+14]=h[9],a[o+15]=h[10],i.instancesEvaluatedElevation[n]=c[2]}}}let Em,Mm;co(Sm,"ModelBucket",{omit:["layers"]}),co(Cm,"PerModelAttributes"),co(Bm,"ModelFeature");const Im=64,Pm={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Lm(e,t,i,r,n,o,s,a,l,c=!1){const u=i.zoom,h=i.project(r),d=bl(r.lat,u),p=1/d;U.mat4.identity(e),U.mat4.translate(e,e,[h.x+s[0]*p,h.y+s[1]*p,s[2]]);let f=1,A=1;const m=i.worldSize;if(c){if("mercator"===i.projection.name){let e=0;i.elevation&&(e=i.elevation.getAtPointOrZero(new Bl(h.x/m,h.y/m),0));const t=U.vec4.transformMat4([],[h.x,h.y,e,1],i.projMatrix)[3]/i.cameraToCenterDistance;f=t,A=t*bl(i.center.lat,u)}else if("globe"===i.projection.name){const t=pm(e,i),n=U.mat4.multiply([],i.projMatrix,t),o=[0,0,0,1];U.vec4.transformMat4(o,o,n);const s=o[3]/i.cameraToCenterDistance,a=Hc(u),l=i.projection.pixelsPerMeter(r.lat,m)*bl(r.lat,u),c=i.projection.pixelsPerMeter(i.center.lat,m)*bl(i.center.lat,u);f=s/Et(l,xl(i.center.lat),a),A=s*d/l,f*=c,A*=c}}else f=p;U.mat4.scale(e,e,[f,f,A]);const g=[...e],_=t.orientation,y=[];if(hm(y,[_[0]+n[0],_[1]+n[1],_[2]+n[2]],o),U.mat4.multiply(e,g,y),a&&i.elevation){let n=0;const o=[];if(l&&i.elevation){n=function(e,t,i,r,n){const o=t.elevation;if(!o)return 0;const s=Tc.projectAabbCorners(i,r),a=ml(1,n.lat)*t.worldSize,l=function(e,t){const i=[0,0,1],r=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const n of r){const r=e[n.corners[0]],o=e[n.corners[1]],s=e[n.corners[2]],a=[o[0]-r[0],o[1]-r[1],t*(o[2]-r[2])],l=U.vec3.cross(a,a,[s[0]-r[0],s[1]-r[1],t*(s[2]-r[2])]);U.vec3.normalize(l,l),n.dotProductWithUp=U.vec3.dot(l,i)}return r.sort(((e,t)=>e.dotProductWithUp-t.dotProductWithUp)),r[0].corners}(s,a),c=s[l[0]],u=s[l[1]],h=s[l[2]],d=s[l[3]],p=o.getAtPointOrZero(new Bl(c[0]/t.worldSize,c[1]/t.worldSize),0),f=o.getAtPointOrZero(new Bl(u[0]/t.worldSize,u[1]/t.worldSize),0),A=o.getAtPointOrZero(new Bl(h[0]/t.worldSize,h[1]/t.worldSize),0),m=o.getAtPointOrZero(new Bl(d[0]/t.worldSize,d[1]/t.worldSize),0),g=(p+m)/2,_=(f+A)/2;return g>_?f=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function km(e,t,i){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,Am.members,!1,!0),e.normalArray&&(e.normalBuffer=t.createVertexBuffer(e.normalArray,ym.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,_m.members,!1,!0)),e.colorArray&&(e.colorBuffer=t.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?mm:gm).members,!1,!0)),e.featureArray&&(e.pbrBuffer=t.createVertexBuffer(e.featureArray,xm.members,!0)),e.segments=_a.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const r=e.material;r.pbrMetallicRoughness.baseColorTexture&&Fm(r.pbrMetallicRoughness.baseColorTexture,t),r.pbrMetallicRoughness.metallicRoughnessTexture&&Fm(r.pbrMetallicRoughness.metallicRoughnessTexture,t),r.normalTexture&&Fm(r.normalTexture,t),r.occlusionTexture&&Fm(r.occlusionTexture,t,i),r.emissionTexture&&Fm(r.emissionTexture,t)}function zm(e,t,i){if(e.meshes)for(const r of e.meshes)km(r,t,i);if(e.children)for(const r of e.children)zm(r,t,i)}function Rm(e){if(e.meshes)for(const t of e.meshes)t.indexArray.destroy(),t.vertexArray.destroy(),t.colorArray&&t.colorArray.destroy(),t.normalArray&&t.normalArray.destroy(),t.texcoordArray&&t.texcoordArray.destroy(),t.featureArray&&t.featureArray.destroy();if(e.children)for(const t of e.children)Rm(t)}function Dm(e){if(e.meshes)for(const i of e.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((t=i.material).pbrMetallicRoughness.baseColorTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),t.pbrMetallicRoughness.metallicRoughnessTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),t.normalTexture&&t.normalTexture.gfxTexture&&t.normalTexture.gfxTexture.destroy(),t.emissionTexture&&t.emissionTexture.gfxTexture&&t.emissionTexture.gfxTexture.destroy(),t.occlusionTexture&&t.occlusionTexture.gfxTexture&&t.occlusionTexture.gfxTexture.destroy()));var t;if(e.children)for(const t of e.children)Dm(t)}class Om{constructor(e,t,i){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=i}static create(e,t,i){const r=i||e.findDEMTileFor(t);if(!r||!r.dem)return;const n=r.dem,o=r.tileID,s=1<e.fqid)),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.modelTraits|=Pm.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,r&&(this.modelTraits|=Pm.HasMapboxMeshFeatures),n&&(this.modelTraits|=Pm.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=o,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const e of t)this.nodesInfo.push(new Hm(e)),jm(e,s.featureIndexArray.length,s.grid),s.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,s.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,t){for(const i of this.getNodesInfo()){const r=i.node;r.footprint&&t.push({footprint:r.footprint,id:e})}}update(e){const t=0!==Object.keys(e).length;if(t&&!this.stateDependentLayers.length)return;const i=t?this.stateDependentLayers:this.layers;if(!H(e,this.states))for(const t of i)this.evaluate(t,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const t=this.getNodesInfo();for(const i of t){const t=i.node;this.uploaded?this.updatePbrBuffer(t):zm(t,e,!0)}for(const e of t)Rm(e.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let t=!1;if(!e.meshes)return t;for(const i of e.meshes)i.pbrBuffer&&(i.pbrBuffer.updateData(i.featureArray),t=!0);return t}needsReEvaluation(e,t,i){const r=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;if(!this.uploaded||this.dirty||r.name!==this.projection.name||$m(i.paint.get("model-color").value,o)||$m(i.paint.get("model-color-mix-intensity").value,o)||$m(i.paint.get("model-roughness").value,o)||$m(i.paint.get("model-emissive-strength").value,o)||$m(i.paint.get("model-height-based-emissive-strength-multiplier").value,o)){this.projection=r,this.brightness=n;const e=this.getNodesInfo();for(const t of e)t.state=null;return!0}return!1}evaluateScale(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const i=this.getNodesInfo(),r=this.id.canonical;for(const e of i){const i=e.feature;e.evaluatedScale=t.paint.get("model-scale").evaluate(i,{},r)}}evaluate(e,t){const i=this.getNodesInfo();for(const r of i){if(!r.node.meshes)continue;const i=r.feature,n=t&&t[i.id];if(H(n,r.state))continue;r.state=structuredClone(n);const o=r.node.meshes&&r.node.meshes[0].featureData,s=r.evaluatedColor[2],a=r.evaluatedRMEA[2],l=this.id.canonical;if(r.hasTranslucentParts=!1,o){for(let t=0;t=e)continue;const h=Um[c],d=Math.abs(h);d>a&&(s=h,a=d,l=n,u=t)}if(a>.1){const o=1-(e+.5*Math.abs(l*u))/c;let a=t._dem.get(r,i)+s*o;const h=t._dem.get(r+l,i+u),d=t._dem.get(r-l,i-u,!0);(a-h)*(a-d)>0&&(a=(h+d)/2),Um[n]=t._dem.set(r,i,a),Nm[n]=e}}}}}s&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=ke.now())}setFilter(e){this.filter=e?es(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter((e=>this.filter.filter(new Do(this.id.overscaledZ),e.feature,this.id.canonical))):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)Rm(t.node),Dm(t.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped()),r=this.getNodesInfo();for(let e=0;ee.footprint===t.footprint))}}getHeightAtTileCoord(e,t){const i=this.getNodesInfo(),r=[],n=[0,0,0],o=U.mat4.identity([]);for(let s=0;sc.max[0]||t>c.max[1])continue;if(!0===a.node.hidden)return{height:1/0,maxHeight:a.feature.properties.height,hidden:!1,verticalScale:a.evaluatedScale[2]};U.mat4.invert(o,a.node.matrix),n[0]=e,n[1]=t,U.vec3.transformMat4(n,n,o);const u=(n[0]-l.aabb.min[0])/(l.aabb.max[0]-l.aabb.min[0])*Im|0,h=Math.min(63,(n[1]-l.aabb.min[1])/(l.aabb.max[1]-l.aabb.min[1])*Im|0)*Im+Math.min(63,u),d=l.heightmap[h];if(!(d<0&&a.node.footprint)){if(a.hiddenByReplacement)return;return{height:d,maxHeight:a.feature.properties.height,hidden:!1,verticalScale:a.evaluatedScale[2]}}if(a.node.footprint.grid.query(new V(e,t),new V(e,t),r),r.length>0)return{height:void 0,maxHeight:a.feature.properties.height,hidden:a.hiddenByReplacement,verticalScale:a.evaluatedScale[2]}}}}function $m(e,t){return!e.isLightConstant&&t}function Zm(e,t,i,r,n,o,s,a){let l=(61440&t|(61440&t)>>4)>>8,c=(3840&t|(3840&t)>>4)>>4,u=240&t|(240&t)>>4;i[3]>0&&(l=Et(l,255*i[0],i[3]),c=Et(c,255*i[1],i[3]),u=Et(u,255*i[2],i[3]));const h=l<<8|c,d=u<<8|Math.floor(255*r[3]),p=function(e){const t=J(e,0,2);return Math.min(Math.round(.5*t*255),255)}(r[2])<<8|15*r[0]<<4|15*r[1],f=J(n[0],0,1),A=J(n[1],0,1),m=J(n[2],0,1),g=J(n[3],0,1);let _,y,v,x;if(f!==A&&s!==o&&A!==f){const e=s-o;y=1/(e*(A-f)),v=-(o+e*f)/(e*(A-f));const t=J(n[4],-1,1);x=Math.pow(10,t),_=255*m<<8|255*g}else _=65535,y=0,v=1,x=1;if(e.emplaceBack(h,d,p,_,y,v,x),a){const e=a.length;a.clear();for(let t=0;t>16&65535,a=o?t>>16&65535:65535&t,l=(15&a)<8?15&a:0,c=e.evaluatedRMEA[l],u=e.evaluatedColor[l],h=e.emissionHeightBasedParams[l];let d;if(s&&2===l&&r.lights&&(d=new ea,d.resize(10*r.lights.length)),Zm(i.featureArray,n,u,c,h,i.aabb.min[2],i.aabb.max[2],d),d&&s){s=!1;const e=r.meshes[r.lightMeshIndex];e.featureArray=d,e.featureArray._trim()}}i.featureArray._trim(),n++}}function Km(e,t,i,r){const n=1<e.polygon)).flat());const m=p?a:null,[g,_]=function(e,t,i,r,n,o,s,a,l,c,u){return"globe"===e.projection.name?function(e,t,i,r,n,o,s,a,l,c,u){const h=[],d=[],p=e.projection.upVectorScale(u,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],A=[0,0,0,1],m=(e,t,i,r)=>{e[0]=t,e[1]=i,e[2]=r,e[3]=1},g=Sd();i>0&&(i+=g),r+=g;for(const g of t){const t=[],_=[];for(const h of g){const d=h.x+n.x,g=h.y+n.y,y=e.projection.projectTilePoint(d,g,u),v=e.projection.upVector(u,h.x,h.y);let x=i,b=r;if(s){const e=kd(d,g,i,r,s,a,l,c);x+=e.base,b+=e.top}0!==i?m(f,y.x+v[0]*p*x,y.y+v[1]*p*x,y.z+v[2]*p*x):m(f,y.x,y.y,y.z),m(A,y.x+v[0]*p*b,y.y+v[1]*p*b,y.z+v[2]*p*b),U.vec3.transformMat4(f,f,o),U.vec3.transformMat4(A,A,o),t.push(new Rh(f[0],f[1],f[2])),_.push(new Rh(A[0],A[1],A[2]))}h.push(t),d.push(_)}return[h,d]}(e,t,i,r,n,o,s,a,l,c,u):s?function(e,t,i,r,n,o,s,a,l){const c=[],u=[],h=[0,0,0,1];for(const d of e){const e=[],p=[];for(const c of d){const u=c.x+r.x,d=c.y+r.y,f=kd(u,d,t,i,o,s,a,l);h[0]=u,h[1]=d,h[2]=f.base,h[3]=1,U.vec4.transformMat4(h,h,n),h[3]=Math.max(h[3],1e-5);const A=new Rh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=u,h[1]=d,h[2]=f.top,h[3]=1,U.vec4.transformMat4(h,h,n),h[3]=Math.max(h[3],1e-5);const m=new Rh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(A),p.push(m)}c.push(e),u.push(p)}return[c,u]}(t,i,r,n,o,s,a,l,c):function(e,t,i,r,n){const o=[],s=[],a=n[8]*t,l=n[9]*t,c=n[10]*t,u=n[11]*t,h=n[8]*i,d=n[9]*i,p=n[10]*i,f=n[11]*i;for(const t of e){const e=[],i=[];for(const o of t){const t=o.x+r.x,s=o.y+r.y,A=n[0]*t+n[4]*s+n[12],m=n[1]*t+n[5]*s+n[13],g=n[2]*t+n[6]*s+n[14],_=n[3]*t+n[7]*s+n[15],y=A+a,v=m+l,x=g+c,b=Math.max(_+u,1e-5),w=A+h,T=m+d,B=g+p,C=Math.max(_+f,1e-5);e.push(new Rh(y/b,v/b,x/b)),i.push(new Rh(w/C,T/C,B/C))}o.push(e),s.push(i)}return[o,s]}(t,i,r,n,o)}(o,r,h,u,c,s,m,d,f,o.center.lat,e.tileID.canonical),y=e.queryGeometry;return function(e,t,i){let r=1/0;Nl(i,t)&&(r=Fd(i,t[0]));for(let n=0;n{if(op)return op;const e=rp();return op=new np(e.paint.properties["line-width"].specification),op.useIntegerZoom=!0,op})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new $d(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,t,i){const r=ep(this);return{config:new Ha(this,{zoom:t,lut:i}),defines:r,overrideFog:!1}}queryRadius(e){const t=e,i=sp(Yl("line-width",this,t),Yl("line-gap-width",this,t)),r=Yl("line-offset",this,t);return i/2+Math.abs(r)+Jl(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,r,n,o){if(e.queryGeometry.isAboveHorizon)return!1;const s=ec(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),a=e.pixelToTileUnitsFactor/2*sp(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=function(e,t){const i=[],r=new V(0,0);for(let n=0;n=3)for(let t=0;t{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(){this._channel=void 0,this._callback=()=>{}}}class Ym{constructor(){this.tasks={},this.taskQueue=[],ae(["process"],this),this.invoker=new Xm(this.process),this.nextId=0}add(e,t){const i=this.nextId++,r=function({type:e,isSymbolTile:t,zoom:i}){return i=i||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-i:"maybePrepare"===e&&t?400-i:500:200-i:100-i}(t);if(0===r){try{e()}finally{}return null}return this.tasks[i]={fn:e,metadata:t,priority:r,id:i},this.taskQueue.push(i),this.invoker.trigger(),{cancel:()=>{delete this.tasks[i]}}}process(){try{if(this.taskQueue=this.taskQueue.filter((e=>!!this.tasks[e])),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let i=0;i{i&&delete this.callbacks[s],this.target.postMessage({id:s,type:"",targetMapId:r,sourceMapId:this.mapId})}}}receive(e){const t=e.data;if(!t)return;const i=t.id;if(i&&(!t.targetMapId||this.mapId===t.targetMapId))if(""===t.type){const e=this.cancelCallbacks[i];delete this.cancelCallbacks[i],e&&e.cancel()}else if(t.mustQueue||me()){const e=this.callbacks[i],r=this.scheduler.add((()=>this.processTask(i,t)),e&&e.metadata||{type:"message"});r&&(this.cancelCallbacks[i]=r)}else this.processTask(i,t)}processTask(e,t){if(delete this.cancelCallbacks[e],""===t.type){const i=this.callbacks[e];delete this.callbacks[e],i&&(t.error?i(fo(t.error)):i(null,fo(t.data)))}else{const i=new Set,r=t.hasCallback?(t,r)=>{this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:t?po(t):null,data:po(r,i)},i)}:()=>{},n=fo(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,n,r);else if(this.parent.getWorkerSource){const e=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,e[0],n.source,n.scope)[e[1]](n,r)}else r(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var eg={workerUrl:"",workerClass:null,workerParams:void 0};const tg="mapboxgl_preloaded_worker_pool";class ig{constructor(){this.active={}}acquire(e,t=ig.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[tg]}numActive(){return Object.keys(this.active).length}}ig.workerCount=2;class rg{constructor(e,t,i="Worker",r=ig.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=oe();const n=this.workerPool.acquire(this.id,r);for(let e=0;e{this.ready=!0}))}broadcast(e,t,i){ie(this.actors,((i,r)=>{i.send(e,t,r)}),i=i||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((e=>{e.remove()})),this.actors=[],this.workerPool.release(this.id)}}let ng,og;function sg(){return ng||(ng=new ig),ng}rg.Actor=Jm;const ag=new Ct(0,0,0);var lg=(e=>(e[e.PATH_RULE_UNSPECIFIED=0]="PATH_RULE_UNSPECIFIED",e[e.PATH_RULE_NON_ZERO=1]="PATH_RULE_NON_ZERO",e[e.PATH_RULE_EVEN_ODD=2]="PATH_RULE_EVEN_ODD",e))(lg||{}),cg=(e=>(e[e.LINE_CAP_UNSPECIFIED=0]="LINE_CAP_UNSPECIFIED",e[e.LINE_CAP_BUTT=1]="LINE_CAP_BUTT",e[e.LINE_CAP_ROUND=2]="LINE_CAP_ROUND",e[e.LINE_CAP_SQUARE=3]="LINE_CAP_SQUARE",e))(cg||{}),ug=(e=>(e[e.LINE_JOIN_UNSPECIFIED=0]="LINE_JOIN_UNSPECIFIED",e[e.LINE_JOIN_MITER=1]="LINE_JOIN_MITER",e[e.LINE_JOIN_MITER_CLIP=2]="LINE_JOIN_MITER_CLIP",e[e.LINE_JOIN_ROUND=3]="LINE_JOIN_ROUND",e[e.LINE_JOIN_BEVEL=4]="LINE_JOIN_BEVEL",e))(ug||{}),hg=(e=>(e[e.PAINT_ORDER_UNSPECIFIED=0]="PAINT_ORDER_UNSPECIFIED",e[e.PAINT_ORDER_FILL_AND_STROKE=1]="PAINT_ORDER_FILL_AND_STROKE",e[e.PAINT_ORDER_STROKE_AND_FILL=2]="PAINT_ORDER_STROKE_AND_FILL",e))(hg||{}),dg=(e=>(e[e.PATH_COMMAND_UNSPECIFIED=0]="PATH_COMMAND_UNSPECIFIED",e[e.PATH_COMMAND_MOVE=1]="PATH_COMMAND_MOVE",e[e.PATH_COMMAND_LINE=2]="PATH_COMMAND_LINE",e[e.PATH_COMMAND_QUAD=3]="PATH_COMMAND_QUAD",e[e.PATH_COMMAND_CUBIC=4]="PATH_COMMAND_CUBIC",e[e.PATH_COMMAND_CLOSE=5]="PATH_COMMAND_CLOSE",e))(dg||{}),pg=(e=>(e[e.MASK_TYPE_UNSPECIFIED=0]="MASK_TYPE_UNSPECIFIED",e[e.MASK_TYPE_LUMINANCE=1]="MASK_TYPE_LUMINANCE",e[e.MASK_TYPE_ALPHA=2]="MASK_TYPE_ALPHA",e))(pg||{});function fg(e,t,i){1===e&&t.icons.push(function(e,t){return function(e){if(e.usvg_tree.height||(e.usvg_tree.height=e.usvg_tree.width),!e.metadata)return e;const{metadata:t}=e;if(t.content_area){const{content_area:i}=t;null==i.top&&(i.top=i.left),null==i.width&&(i.width=e.usvg_tree.width),null==i.height&&(i.height=i.width)}return t.stretch_x&&t.stretch_x.length&&Ag(t,"x"),t.stretch_y&&t.stretch_y.length&&Ag(t,"y"),e}(e.readFields(mg,{name:void 0},t))}(i,i.readVarint()+i.pos))}function Ag(e,t){const i=[],r=e[`stretch_${t}`];let n=null;for(let e=0;e>16&255)/255,(e>>8&255)/255,(255&e)/255,1)}function Mg(e,t,i){1===e?(t.rgb_color=Eg(i.readVarint()),t.paint="rgb_color"):2===e?(t.linear_gradient_idx=i.readVarint(),t.paint="linear_gradient_idx"):3===e?(t.radial_gradient_idx=i.readVarint(),t.paint="radial_gradient_idx"):5===e?i.readPackedFloat(t.dasharray):6===e?t.dashoffset=i.readFloat():7===e?t.miterlimit=i.readFloat():8===e?t.opacity=i.readVarint():9===e?t.width=i.readFloat():10===e?t.linecap=i.readVarint():11===e&&(t.linejoin=i.readVarint())}function Ig(e,t,i){1===e?t.transform=Tg(i,i.readVarint()+i.pos):2===e?t.spread_method=i.readVarint():3===e?t.stops.push(Pg(i,i.readVarint()+i.pos)):4===e?t.x1=i.readFloat():5===e?t.y1=i.readFloat():6===e?t.x2=i.readFloat():7===e&&(t.y2=i.readFloat())}function Pg(e,t){return e.readFields(Lg,{offset:0,opacity:255,rgb_color:ag},t)}function Lg(e,t,i){1===e?t.offset=i.readFloat():2===e?t.opacity=i.readVarint():3===e&&(t.rgb_color=Eg(i.readVarint()))}function Fg(e,t,i){1===e?t.transform=Tg(i,i.readVarint()+i.pos):2===e?t.spread_method=i.readVarint():3===e?t.stops.push(Pg(i,i.readVarint()+i.pos)):4===e?t.cx=i.readFloat():5===e?t.cy=i.readFloat():6===e?t.r=i.readFloat():7===e?t.fx=i.readFloat():8===e?t.fy=i.readFloat():9===e&&(t.fr=i.readFloat())}function kg(e,t,i){1===e?t.transform=Tg(i,i.readVarint()+i.pos):2===e?t.clip_path_idx=i.readVarint():3===e&&t.children.push(xg(i,i.readVarint()+i.pos))}function zg(e,t,i){1===e?t.left=t.top=i.readFloat():2===e?t.width=t.height=i.readFloat():3===e?t.top=i.readFloat():4===e?t.height=i.readFloat():5===e?t.mask_type=i.readVarint():6===e?t.mask_idx=i.readVarint():7===e&&t.children.push(xg(i,i.readVarint()+i.pos))}class Rg{static calculate(e={},t=[]){const i=new Map,r=new Map;if(0===Object.keys(e).length)return i;t.forEach((e=>{r.set(e.name,e.rgb_color||new Ct(0,0,0))}));for(const[t,n]of Object.entries(e))r.has(t)?i.set(r.get(t).toStringPremultipliedAlpha(),n):console.warn(`Ignoring unknown image variable "${t}"`);return i}}function Dg(e,t=255,i){const r=t/255,n=e.toStringPremultipliedAlpha(),o=i.has(n)?i.get(n).clone():e.clone();return o.a*=r,o.toString()}function Og(e,t){if(!Fe()){const i=document.createElement("canvas");return i.width=e,i.height=t,i}return new OffscreenCanvas(e,t)}function Ug(e,t){const i=Rg.calculate(t.params,e.metadata?e.metadata.variables:[]),r=e.usvg_tree,n=r.width,o=r.height,s=t.transform?t.transform:new DOMMatrix,a=Math.max(1,Math.round(n*s.a)),l=Math.max(1,Math.round(o*s.d)),c=new DOMMatrix([a/n,0,0,l/o,0,0]),u=Og(a,l).getContext("2d");return Ng(u,c,r,r,i),u.getImageData(0,0,a,l)}function Ng(e,t,i,r,n){for(const o of r.children)Qg(e,t,i,o,n)}function Qg(e,t,i,r,n){r.group?(e.save(),function(e,t,i,r,n){const o=null!=r.mask_idx?i.masks[r.mask_idx]:null,s=null!=r.clip_path_idx?i.clip_paths[r.clip_path_idx]:null;if(r.transform&&(t=Wg(r.transform).preMultiplySelf(t)),!function(e,t,i){return 255!==e.opacity||t||i}(r,null!=s,null!=o))return void Ng(e,t,i,r,n);const a=Og(e.canvas.width,e.canvas.height),l=a.getContext("2d");Ng(l,t,i,r,n),s&&qg(l,t,i,s),o&&Kg(l,t,i,o,n),e.globalAlpha=r.opacity/255,e.drawImage(a,0,0)}(e,t,i,r.group,n),e.restore()):r.path&&(e.save(),function(e,t,i,r,n){const o=Xg(r);e.setTransform(t),r.paint_order===hg.PAINT_ORDER_FILL_AND_STROKE?(jg(e,i,r,o,n),Hg(e,i,r,o,n)):(Hg(e,i,r,o,n),jg(e,i,r,o,n))}(e,t,i,r.path,n),e.restore())}function jg(e,t,i,r,n){const o=i.fill;if(!o)return;const s=o.opacity/255;switch(o.paint){case"rgb_color":e.fillStyle=Dg(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":e.fillStyle=Gg(e,t.linear_gradients[o.linear_gradient_idx],s,n);break;case"radial_gradient_idx":e.fillStyle=$g(e,t.radial_gradients[o.radial_gradient_idx],s,n)}e.fill(r,Vg(i))}function Vg(e){return e.rule===lg.PATH_RULE_NON_ZERO?"nonzero":e.rule===lg.PATH_RULE_EVEN_ODD?"evenodd":void 0}function Hg(e,t,i,r,n){const o=i.stroke;if(!o)return;e.lineWidth=o.width,e.miterLimit=o.miterlimit,e.setLineDash(o.dasharray),e.lineDashOffset=o.dashoffset;const s=o.opacity/255;switch(o.paint){case"rgb_color":e.strokeStyle=Dg(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":e.strokeStyle=Gg(e,t.linear_gradients[o.linear_gradient_idx],s,n);break;case"radial_gradient_idx":e.strokeStyle=$g(e,t.radial_gradients[o.radial_gradient_idx],s,n)}switch(o.linejoin){case ug.LINE_JOIN_MITER_CLIP:case ug.LINE_JOIN_MITER:e.lineJoin="miter";break;case ug.LINE_JOIN_ROUND:e.lineJoin="round";break;case ug.LINE_JOIN_BEVEL:e.lineJoin="bevel"}switch(o.linecap){case cg.LINE_CAP_BUTT:e.lineCap="butt";break;case cg.LINE_CAP_ROUND:e.lineCap="round";break;case cg.LINE_CAP_SQUARE:e.lineCap="square"}e.stroke(r)}function Gg(e,t,i,r){if(1===t.stops.length){const e=t.stops[0];return Dg(e.rgb_color,e.opacity*i,r)}const n=Wg(t.transform),{x1:o,y1:s,x2:a,y2:l}=t,c=n.transformPoint(new DOMPoint(o,s)),u=n.transformPoint(new DOMPoint(a,l)),h=e.createLinearGradient(c.x,c.y,u.x,u.y);for(const e of t.stops)h.addColorStop(e.offset,Dg(e.rgb_color,e.opacity*i,r));return h}function $g(e,t,i,r){if(1===t.stops.length){const e=t.stops[0];return Dg(e.rgb_color,e.opacity*i,r)}const n=Wg(t.transform),{fx:o,fy:s,cx:a,cy:l}=t,c=n.transformPoint(new DOMPoint(o,s)),u=n.transformPoint(new DOMPoint(a,l)),h=e.createRadialGradient(c.x,c.y,0,u.x,u.y,t.r*((n.a+n.d)/2));for(const e of t.stops)h.addColorStop(e.offset,Dg(e.rgb_color,e.opacity*i,r));return h}function Zg(e,t,i,r){const n=r.transform?Wg(r.transform).preMultiplySelf(t):t,o=Og(e.canvas.width,e.canvas.height),s=o.getContext("2d");for(const e of r.children)if(e.group)Zg(s,n,i,e.group);else if(e.path){const t=e.path,i=new Path2D;i.addPath(Xg(t),n),s.fill(i,Vg(t))}const a=null!=r.clip_path_idx?i.clip_paths[r.clip_path_idx]:null;a&&qg(s,n,i,a),e.globalCompositeOperation="source-over",e.drawImage(o,0,0)}function qg(e,t,i,r){const n=Og(e.canvas.width,e.canvas.height);Zg(n.getContext("2d"),t,i,r),e.globalCompositeOperation="destination-in",e.drawImage(n,0,0)}function Kg(e,t,i,r,n){if(0===r.children.length)return;const o=null!=r.mask_idx?i.masks[r.mask_idx]:null;o&&Kg(e,t,i,o,n);const s=e.canvas.width,a=e.canvas.height,l=Og(s,a),c=l.getContext("2d"),u=r.width,h=r.height,d=r.left,p=r.top,f=new Path2D,A=new Path2D;A.rect(d,p,u,h),f.addPath(A,t),c.clip(f);for(const e of r.children)Qg(c,t,i,e,n);const m=c.getImageData(0,0,s,a),g=m.data;if(r.mask_type===pg.MASK_TYPE_LUMINANCE)for(let e=0;et[s])return null}else{const a=1/r[s];let l=(e[s]-i[s])*a,c=(t[s]-i[s])*a;if(l>c){const e=l;l=c,c=e}if(l>n&&(n=l),co)return null}return n}function i_(e,t,i,r,n,o,s,a,l,c,u){const h=r-e,d=n-t,p=o-i,f=s-e,A=a-t,m=l-i,g=u[1]*m-u[2]*A,_=u[2]*f-u[0]*m,y=u[0]*A-u[1]*f,v=h*g+d*_+p*y;if(Math.abs(v)<1e-15)return null;const x=1/v,b=c[0]-e,w=c[1]-t,T=c[2]-i,B=(b*g+w*_+T*y)*x;if(B<0||B>1)return null;const C=w*p-T*d,S=T*h-b*p,E=b*d-w*h,M=(u[0]*C+u[1]*S+u[2]*E)*x;return M<0||B+M>1?null:(f*C+A*S+m*E)*x}function r_(e,t,i){return(e-t)/(i-t)}function n_(e,t,i,r,n,o,s,a,l){const c=1<{const o=r?1:0,s=(e+1)*i-o,a=t*i,l=(t+1)*i-o;n[0]=e*i,n[1]=a,n[2]=s,n[3]=l};let s=new e_(r);const a=[];for(let t=0;t=1;r/=2){const e=i[i.length-1];s=new e_(r);for(let t=0;t0;){const{idx:a,t:p,nodex:f,nodey:A,depth:m}=d.pop();if(this.leaves[a]){n_(f,A,m,e,t,i,r,u,h);const a=1<=e[2])return p}continue}let g=0;for(let d=0;d=l[c[i]]&&(c.splice(i,0,d),t=!0);t||(c[g]=d),g++}}for(let e=0;e=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const i=[0,0,0,0],r=h_.getUnpackVector(t);let n=Math.floor((e+r[3])/r[2]);return i[2]=n%256,n=Math.floor(n/256),i[1]=n%256,n=Math.floor(n/256),i[0]=n,i}getPixels(){return new pu({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-t*this.dim,l=-i*this.dim;for(let t=o;t=1;r--){const n=1===r?1:0,o=2===r?1:0;for(let r=0;r>>1^-(1&e[t]);return e}function b_(e,t){switch(t){case"uint32":return e;case"uint16":for(let t=0;t>4|(61440&i)>>8|(240&r)<<4|61440&r,e[t+1]=15&i|(3840&i)>>4|(15&r)<<8|(3840&r)<<4}return e;case"uint8":for(let t=0;t>6|(192&r)>>4|(192&n)>>2|192&o,e[t+1]=(48&i)>>4|(48&r)>>2|48&n|(48&o)<<2,e[t+2]=(12&i)>>2|12&r|(12&n)<<2|(12&o)<<4,e[t+3]=3&i|(3&r)<<2|(3&n)<<4|(3&o)<<6}return e;default:throw new Error(`Invalid pixel format, "${t}"`)}}co(h_,"DEMData"),co(o_,"DemMinMaxQuadTree",{omit:["dem"]});var w_=Uint8Array,T_=Uint16Array,B_=Int32Array,C_=new w_([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),S_=new w_([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),E_=new w_([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),M_=function(e,t){for(var i=new T_(31),r=0;r<31;++r)i[r]=t+=1<>1|(21845&z_)<<1;k_[z_]=((65280&(R_=(61680&(R_=(52428&R_)>>2|(13107&R_)<<2))>>4|(3855&R_)<<4))>>8|(255&R_)<<8)>>1}var D_=function(e,t,i){for(var r=e.length,n=0,o=new T_(t);n>l]=c;return s},O_=new w_(288);for(z_=0;z_<144;++z_)O_[z_]=8;for(z_=144;z_<256;++z_)O_[z_]=9;for(z_=256;z_<280;++z_)O_[z_]=7;for(z_=280;z_<288;++z_)O_[z_]=8;var U_=new w_(32);for(z_=0;z_<32;++z_)U_[z_]=5;var N_=D_(O_,9),Q_=D_(U_,5),j_=function(e){for(var t=e[0],i=1;it&&(t=e[i]);return t},V_=function(e,t,i){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&i},H_=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},G_=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],$_=function(e,t,i){var r=new Error(t||G_[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,$_),!i)throw r;return r},Z_=new w_(0),q_="undefined"!=typeof TextDecoder&&new TextDecoder;try{q_.decode(Z_,{stream:!0})}catch(e){}const K_={gzip_data:"gzip"};class W_ extends Error{constructor(e){super(e),this.name="MRTError"}}const X_={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Y_={uint32:1,uint16:2,uint8:4},J_={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let ey;class ty{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new W_(`Layer '${e}' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),i=new DataView(e);if(13!==t[0])throw new W_("File is not a valid MRT.");return i.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),i=this.getHeaderLength(e);if(t.length= ${i} but got buffer of length ${t.length}`);const r=function(e){return e.readFields(d_,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0)}(new ey(t.subarray(0,i)));if(!isNaN(this.x)&&(this.x!==r.x||this.y!==r.y||this.z!==r.z))throw new W_(`Invalid attempt to parse header ${r.z}/${r.x}/${r.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=r.x,this.y=r.y,this.z=r.z;for(const e of r.layers)this.layers[e.name]=new iy(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],i=this.getLayer(e.layerName);for(let r of e.blockIndices){const n=i.dataIndex[r],o=n.firstByte-e.firstByte,s=n.lastByte-e.firstByte;if(i._blocksInProgress.has(r))continue;const a={layerName:i.name,firstByte:o,lastByte:s,pixelFormat:i.pixelFormat,blockIndex:r,blockShape:[n.bands.length].concat(i.bandShape),buffer:i.buffer,codec:n.codec.codec,filters:n.filters.map((e=>e.filter))};i._blocksInProgress.add(r),t.push(a)}return new ry(t,(()=>{t.forEach((e=>i._blocksInProgress.delete(e.blockIndex)))}),((e,r)=>{if(t.forEach((e=>i._blocksInProgress.delete(e.blockIndex))),e)throw e;r.forEach((e=>{this.getLayer(e.layerName).processDecodedData(e)}))}))}}class iy{constructor({version:e,name:t,units:i,tileSize:r,pixelFormat:n,buffer:o,dataIndex:s},a){if(this.version=e,1!==this.version)throw new W_(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=i,this.tileSize=r,this.buffer=o,this.pixelFormat=X_[n],this.dataIndex=s,this.bandShape=[r+2*o,r+2*o,Y_[this.pixelFormat]],this._decodedBlocks=new Yg(a?a.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return Y_[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map((({bands:e})=>e)).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[i,r]of this.dataIndex.entries()){for(const[n,o]of r.bands.entries())if(o===e)return{bandIndex:t+n,blockIndex:i,blockBandIndex:n};t+=r.bands.length}break;case"number":for(const[i,r]of this.dataIndex.entries()){if(e>=t&&ethis.cacheSize)throw new W_(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:i,blockIndices:r}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:i}=this.getBlockForBand(e);if(t<0)throw new W_(`Band not found: ${JSON.stringify(e)}`);const r=this._decodedBlocks.get(t.toString());if(!r)throw new W_(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const n=this.dataIndex[t],o=this.bandShape.reduce(((e,t)=>e*t),1),s=i*o,a=r.subarray(s,s+o);return{data:a,bytes:new Uint8Array(a.buffer).subarray(a.byteOffset,a.byteOffset+a.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:n.offset,scale:n.scale}}}ty.setPbf=function(e){ey=e};class ry{constructor(e,t,i){this.tasks=e,this._onCancel=t,this._onComplete=i,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}ty.performDecoding=function(e,t){const i=new Uint8Array(e);return Promise.all(t.tasks.map((e=>{const{layerName:t,firstByte:r,lastByte:n,pixelFormat:o,blockShape:s,blockIndex:a,filters:l,codec:c}=e,u=i.subarray(r,n+1),h=new Uint32Array(s[0]*s[1]*s[2]);let d;if("gzip_data"!==c)throw new W_(`Unhandled codec: ${c}`);return d=function(e,t){if(!globalThis.DecompressionStream&&"gzip_data"===t)return Promise.resolve(((o=function(e){31==e[0]&&139==e[1]&&8==e[2]||$_(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[i++]);return i+(2&t)}(n=e))+8>n.length&&$_(6,"invalid gzip data"),function(e,t,i){var r=e.length;if(!r||t.f&&!t.l)return i||new w_(0);var n=!i,o=n||2!=t.i,s=t.i;n&&(i=new w_(3*r));var a,l,c=function(e){var t=i.length;if(e>t){var r=new w_(Math.max(2*t,e));r.set(i),i=r}},u=t.f||0,h=t.p||0,d=t.b||0,p=t.l,f=t.d,A=t.m,m=t.n,g=8*r;do{if(!p){u=V_(e,h,1);var _=V_(e,h+1,3);if(h+=3,!_){var y=e[(I=4+((h+7)/8|0))-4]|e[I-3]<<8,v=I+y;if(v>r){s&&$_(0);break}o&&c(d+y),i.set(e.subarray(I,v),d),t.b=d+=y,t.p=h=8*v,t.f=u;continue}if(1==_)p=N_,f=Q_,A=9,m=5;else if(2==_){var x=V_(e,h,31)+257,b=V_(e,h+10,15)+4,w=x+V_(e,h+5,31)+1;h+=14;for(var T=new w_(w),B=new w_(19),C=0;C>4)<16)T[C++]=I;else{var L=0,F=0;for(16==I?(F=3+V_(e,h,3),h+=2,L=T[C-1]):17==I?(F=3+V_(e,h,7),h+=3):18==I&&(F=11+V_(e,h,127),h+=7);F--;)T[C++]=L}}var k=T.subarray(0,x),z=T.subarray(x);A=j_(k),m=j_(z),p=D_(k,A),f=D_(z,m)}else $_(1);if(h>g){s&&$_(0);break}}o&&c(d+131072);for(var R=(1<>4;if((h+=15&L)>g){s&&$_(0);break}if(L||$_(2),U<256)i[d++]=U;else{if(256==U){O=h,p=null;break}var N=U-254;U>264&&(N=V_(e,h,(1<<(V=C_[C=U-257]))-1)+P_[C],h+=V);var Q=f[H_(e,h)&D],j=Q>>4;if(Q||$_(3),h+=15&Q,z=F_[j],j>3){var V=S_[j];z+=H_(e,h)&(1<g){s&&$_(0);break}o&&c(d+131072);var H=d+N;if(da.length)&&(l=a.length),new w_(a.subarray(0,l))):i.subarray(0,d)}(n.subarray(o,-8),{i:2},new w_(((i=n)[(r=i.length)-4]|i[r-3]<<8|i[r-2]<<16|i[r-1]<<24)>>>0))));var i,r,n,o;const s=K_[t];if(!s)throw new Error(`Unhandled codec: ${t}`);const a=new globalThis.DecompressionStream(s);return new Response(new Blob([e]).stream().pipeThrough(a)).arrayBuffer().then((e=>new Uint8Array(e)))}(u,c).then((e=>(function(e,t){e.readFields(__,t)}(new ey(e),h),new J_[o](h.buffer)))),d.then((e=>{for(let t=l.length-1;t>=0;t--)switch(l[t]){case"delta_filter":v_(e,s);break;case"zigzag_filter":x_(e);break;case"bitshuffle_filter":b_(e,o);break;default:throw new W_(`Unhandled filter "${l[t]}"`)}return{layerName:t,blockIndex:a,data:e}})).catch((e=>{throw e}))})))},co(ry,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),co(ty,"MapboxRasterTile"),co(iy,"MapboxRasterLayer",{omit:["_blocksInProgress"]});let ny,oy,sy,ay,ly,cy=null;function uy(){return me()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:oy||Te.DRACO_URL}function hy(){if(me()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(ay)return ay;const e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if("object"!=typeof WebAssembly)throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return ay=WebAssembly.validate(e)?Te.MESHOPT_SIMD_URL:Te.MESHOPT_URL,ay}const dy={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},py={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},fy={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Ay(e,t,i){const r=i.json.bufferViews.length,n=i.buffers.length;t.bufferView=r,i.json.bufferViews[r]={buffer:n,byteLength:e.byteLength},i.buffers[n]=e}const my="KHR_draco_mesh_compression";function gy(e,t){const i=e.extensions&&e.extensions[my];if(!i)return;const r=new sy.Decoder,n=Ty(t,i.bufferView),o=new sy.Mesh;if(!r.DecodeArrayToMesh(n,n.byteLength,o))throw new Error("Failed to decode Draco mesh");const s=t.json.accessors[e.indices],a=dy[s.componentType],l=s.count*a.BYTES_PER_ELEMENT,c=sy._malloc(l);a===Uint16Array?r.GetTrianglesUInt16Array(o,l,c):r.GetTrianglesUInt32Array(o,l,c),Ay(sy.memory.buffer.slice(c,c+l),s,t),sy._free(c);for(const n of Object.keys(i.attributes)){const s=r.GetAttributeByUniqueId(o,i.attributes[n]),a=t.json.accessors[e.attributes[n]],l=py[a.componentType],c=a.count*fy[a.type]*dy[a.componentType].BYTES_PER_ELEMENT,u=sy._malloc(c);r.GetAttributeDataArrayForAllPoints(o,s,sy[l],c,u),Ay(sy.memory.buffer.slice(u,u+c),a,t),sy._free(u)}r.destroy(),o.destroy(),delete e.extensions[my]}const _y="EXT_meshopt_compression";function yy(e,t){if(!e.extensions||!e.extensions[_y])return;const i=e.extensions[_y],r=new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),n=new Uint8Array(i.count*i.byteStride);ly.decodeGltfBuffer(n,i.count,i.byteStride,r,i.mode,i.filter),e.buffer=t.buffers.length,e.byteOffset=0,t.buffers[e.buffer]=n.buffer,delete e.extensions[_y]}const vy=1179937895,xy=new TextDecoder("utf8");function by(e,t){return new URL(e,t).href}function wy(e,t,i,r){return fetch(by(e.uri,r)).then((e=>e.arrayBuffer())).then((e=>{t.buffers[i]=e}))}function Ty(e,t){const i=e.json.bufferViews[t];return new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function By(e,t,i,r){if(e.uri){const n=by(e.uri,r);return fetch(n).then((e=>e.blob())).then((e=>createImageBitmap(e))).then((e=>{t.images[i]=e}))}if(void 0!==e.bufferView){const r=Ty(t,e.bufferView),n=new Blob([r],{type:e.mimeType});return createImageBitmap(n).then((e=>{t.images[i]=e}))}}function Cy(e,t=0,i){const r={json:null,images:[],buffers:[]};if(new Uint32Array(e,t,1)[0]===vy){const i=new Uint32Array(e,t);let n=2;const o=(i[n++]>>2)-3,s=i[n++]>>2;if(n++,r.json=JSON.parse(xy.decode(i.subarray(n,n+s))),n+=s,n{const e=[],t=a&&a.includes(my),n=a&&a.includes(_y);if(t&&e.push(function(){if(!sy)return null!=ny?ny:(ny=function(e){let t,i=null;function r(){t=new Uint8Array(i.buffer)}function n(){throw new Error("Unexpected Draco error.")}const o={a:{a:n,d:function(e,i,r){return t.copyWithin(e,i,i+r)},c:function(e){const n=t.length,o=Math.max(e>>>0,Math.ceil(1.2*n)),s=Math.ceil((o-n)/65536);try{return i.grow(s),r(),!0}catch(e){return!1}},b:n}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,o):e.then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,o)))).then((e=>{const{Rb:n,Qb:o,P:s,T:a,X:l,Ja:c,La:u,Qa:h,Va:d,Wa:p,eb:f,jb:A,f:m,e:g,yb:_,zb:y,Ab:v,Bb:x,Db:b,Gb:w}=e.instance.exports;i=g;const T=(()=>{let e=0,i=0,r=0,s=0;return a=>{r&&(n(s),n(e),i+=r,r=e=0),e||(i+=128,e=o(i));const l=a.length+7&-8;let c=e;l>=i&&(r=l,c=s=o(l));for(let e=0;e{sy=e,ny=void 0})))}()),n&&e.push(function(){if(ly)return;const e=function(e){let t;const i=WebAssembly.instantiateStreaming(e,{}).then((e=>{t=e.instance,t.exports.__wasm_call_ctors()})),r={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:i,supported:!0,decodeGltfBuffer(e,i,o,s,a,l){!function(e,t,i,r,n,o,s){const a=e.exports.sbrk,l=r+3&-4,c=a(l*n),u=a(o.length),h=new Uint8Array(e.exports.memory.buffer);h.set(o,u);const d=t(c,r,n,u,o.length);if(0===d&&s&&s(c,l,n),i.set(h.subarray(c,c+r*n)),a(c-a(0)),0!==d)throw new Error(`Malformed buffer data: ${d}`)}(t,t.exports[n[a]],e,i,o,s,t.exports[r[l]])}}}(fetch(hy()));return e.ready.then((()=>{ly=e}))}()),o)for(let t=0;t{if(t&&s)for(const{primitives:e}of s)for(const t of e)gy(t,r);if(n&&s&&l)for(const e of l)yy(e,r);return r}))}))}function Sy(e,t){const i=e.json.bufferViews[t.bufferView],r=dy[t.componentType];return new r(e.buffers[i.buffer],(t.byteOffset||0)+(i.byteOffset||0),t.count*(i.byteStride&&i.byteStride!==fy[t.type]*r.BYTES_PER_ELEMENT?i.byteStride/r.BYTES_PER_ELEMENT:fy[t.type]))}function Ey(e,t,i,r){const n=dy[t.componentType],o=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(n),s=e.json.bufferViews[t.bufferView],a=s.byteStride?s.byteStride/n.BYTES_PER_ELEMENT:fy[t.type],l=i.float32,c=l.length/i.capacity;for(let e=0,i=0;e0){for(let n=0;n0){o.texcoordArray=new Ws;const e=t.json.accessors[n.TEXCOORD_0];o.texcoordArray.resize(e.count);const i=Sy(t,e);Ey(t,e,o.texcoordArray,i)}if(void 0!==n._FEATURE_ID_RGBA4444){const e=t.json.accessors[n._FEATURE_ID_RGBA4444];t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression")&&(o.featureData=Sy(t,e))}void 0!==n._FEATURE_RGBA4444&&(o.featureData=new Uint32Array(Sy(t,t.json.accessors[n._FEATURE_RGBA4444]).buffer));const h=e.material;return o.material=function(e,t){const{emissiveFactor:i=[0,0,0],alphaMode:r="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:s,emissiveTexture:a,doubleSided:l}=e,{baseColorFactor:c=[1,1,1,1],metallicFactor:u=1,roughnessFactor:h=1,baseColorTexture:d,metallicRoughnessTexture:p}=e.pbrMetallicRoughness||{},f=s?t[s.index]:void 0;if(s&&s.extensions&&s.extensions.KHR_texture_transform&&f){const e=s.extensions.KHR_texture_transform;f.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Ct(...c),metallicFactor:u,roughnessFactor:h,baseColorTexture:d?t[d.index]:void 0,metallicRoughnessTexture:p?t[p.index]:void 0},doubleSided:l,emissiveFactor:i,alphaMode:r,alphaCutoff:n,normalTexture:o?t[o.index]:void 0,occlusionTexture:f,emissionTexture:a?t[a.index]:void 0,defined:void 0===e.defined}}(void 0!==h?t.json.materials[h]:{defined:!1},i),o}function Iy(e,t,i){const{matrix:r,rotation:n,translation:o,scale:s,mesh:a,extras:l,children:c}=e,u={};if(u.matrix=r||U.mat4.fromRotationTranslationScale([],n||[0,0,0,1],o||[0,0,0],s||[1,1,1]),void 0!==a){u.meshes=i[a];const e=u.anchor=[0,0];for(const t of u.meshes){const{min:i,max:r}=t.aabb;e[0]+=i[0]+r[0],e[1]+=i[1]+r[1]}e[0]=Math.floor(e[0]/u.meshes.length/2),e[1]=Math.floor(e[1]/u.meshes.length/2)}if(l&&(l.id&&(u.id=l.id),l.lights&&(u.lights=function(e){if(!e.length)return[];const t=function(e){const t=atob(e),i=new Uint8Array(t.length);for(let e=0;e1&&r[r.length-1].equals(r[0])&&r.pop();let n=0;for(let e=0;e0&&r.reverse();const o=yu(r.flatMap((e=>[e.x,e.y])),[]);return 0===o.length?null:{vertices:r,indices:o}}function Fy(e,t){const i=[],r=[];let n=0;const o=[];for(const s of e){n=i.length;const e=s.vertexArray.float32,a=s.indexArray.uint16;for(let r=0;r0&&([r[e+1],r[e+2]]=[r[e+2],r[e+1]])}return{vertices:i,indices:r}}function ky(e){const t=function(e,t){const i=[],r=WebGL2RenderingContext;if(e.json.textures)for(const n of e.json.textures){const o={magFilter:r.LINEAR,minFilter:r.NEAREST,wrapS:r.REPEAT,wrapT:r.REPEAT};void 0!==n.sampler&&Object.assign(o,e.json.samplers[n.sampler]),i.push({image:t[n.source],sampler:o,uploaded:!1})}return i}(e,e.images),i=function(e,t){const i=[];for(const r of e.json.meshes){const n=[];for(const i of r.primitives)n.push(My(i,e,t));i.push(n)}return i}(e,t),{scenes:r,scene:n,nodes:o}=e.json,s=r?r[n||0].nodes:o,a=[];for(const t of s)a.push(Iy(o[t],e,i));return function(e,t,i){const r={},n=new Set;for(let o=0;o0){const t=Array.from(n.values()).sort(((e,t)=>e-t));for(let i=t.length-1;i>=0;i--)e.splice(t[i],1)}}(a,s,e.json.nodes),a}function zy(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);const t=e.vertexArray.float32,i=e.aabb.min[0]-1,r=e.aabb.min[1]-1,n=Im/(e.aabb.max[0]-i+2),o=Im/(e.aabb.max[1]-r+2);for(let s=0;se.heightmap[c*Im+l]&&(e.heightmap[c*Im+l]=a)}}function Ry(e,t){const i={};i.indexArray=new Vs,i.indexArray.reserve(4*e.length),i.vertexArray=new Is,i.vertexArray.reserve(10*e.length),i.colorArray=new Rs,i.vertexArray.reserve(10*e.length);let r=0;for(const n of e){const e=Math.min(10,Math.max(4,1.3*n.height))*t,o=[-n.normal[1],n.normal[0],0],s=Math.min(.29,.1*n.width/n.depth),a=n.width-2*n.depth*t*(s+.01),l=U.vec3.scaleAndAdd([],n.pos,o,a/2),c=U.vec3.scaleAndAdd([],n.pos,o,-a/2),u=[l[0],l[1],l[2]+n.height],h=[c[0],c[1],c[2]+n.height],d=U.vec3.scaleAndAdd([],n.normal,o,s);U.vec3.scale(d,d,e);const p=U.vec3.scaleAndAdd([],n.normal,o,-s);U.vec3.scale(p,p,e),U.vec3.add(d,l,d),U.vec3.add(p,c,p),l[2]+=.1,c[2]+=.1,i.vertexArray.emplaceBack(d[0],d[1],d[2]),i.vertexArray.emplaceBack(p[0],p[1],p[2]),i.vertexArray.emplaceBack(l[0],l[1],l[2]),i.vertexArray.emplaceBack(c[0],c[1],c[2]),i.vertexArray.emplaceBack(u[0],u[1],u[2]),i.vertexArray.emplaceBack(h[0],h[1],h[2]),i.vertexArray.emplaceBack(l[0],l[1],l[2]),i.vertexArray.emplaceBack(c[0],c[1],c[2]),i.vertexArray.emplaceBack(d[0],d[1],d[2]),i.vertexArray.emplaceBack(p[0],p[1],p[2]);const f=a/e/2;i.colorArray.emplaceBack(-f-s,-1,f,.8),i.colorArray.emplaceBack(f+s,-1,f,.8),i.colorArray.emplaceBack(-f,0,f,1.3),i.colorArray.emplaceBack(f,0,f,1.3),i.colorArray.emplaceBack(f+s,-.8,f,.7),i.colorArray.emplaceBack(f+s,-.8,f,.7),i.colorArray.emplaceBack(0,0,f,1.3),i.colorArray.emplaceBack(0,0,f,1.3),i.colorArray.emplaceBack(f+s,-1.2,f,.8),i.colorArray.emplaceBack(f+s,-1.2,f,.8),i.indexArray.emplaceBack(6+r,4+r,8+r),i.indexArray.emplaceBack(7+r,9+r,5+r),i.indexArray.emplaceBack(0+r,1+r,2+r),i.indexArray.emplaceBack(1+r,3+r,2+r),r+=10}const n={defined:!0,emissiveFactor:[0,0,0]},o={};return o.baseColorFactor=Ct.white,n.pbrMetallicRoughness=o,i.material=n,i.aabb=new Tc([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}class Dy{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t=0&&r[3]>=0&&l.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new sh.VectorTile(new Fp(this.rawTileData)).layers,this.sourceLayerCoder=new Dy(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t){const{tilespaceGeometry:i,transform:r,tileTransform:n,pixelPosMatrix:o,availableImages:s}=t;this.loadVTLayers(),this.serializedLayersCache.clear();const a=i.bufferedTilespaceBounds,l=this.grid.query(a.min.x,a.min.y,a.max.x,a.max.y,((e,t,r,n)=>ql(i.bufferedTilespaceGeometry,e,t,r,n)));l.sort(jy);let c=null;r.elevation&&l.length>0&&(c=Om.create(r.elevation,this.tileID));const u={};let h;for(let t=0;t(p||(p=Fl(e,this.tileID.canonical,n)),t.queryIntersectsFeature(i,e,s,p,this.z,r,o,c,a))))}return u}loadMatchingFeature(e,t,i,r,n){const{featureIndex:o,bucketIndex:s,sourceLayerIndex:a,layoutVertexArrayOffset:l}=t,c=this.bucketLayerIDs[s],u=i.layers,h=Object.keys(u);if(h.length&&!function(e,t){for(let i=0;i=0)return!0;return!1}(h,c))return;const d=i.sourceCache,p=this.sourceLayerCoder.decode(a),f=this.vtLayers[p].feature(o),A=this.getId(f,p);for(let t=0;t`${e.key}: ${e.message}`)).join(", ")}`);this.promoteIdExpression=e.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new mi),i=this.promoteIdExpression.evaluate({zoom:0},e)}else i=e.properties[r];"boolean"==typeof i&&(i=Number(i))}return i}}function Qy(e,t,i,r,n){return le(e,((e,o)=>{const s=t instanceof Go?t.get(o):null;return s&&s.evaluate?s.evaluate(i,r,n):s}))}function jy(e,t){return t-e}co(Ny,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const Vy=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Hy{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=Vy[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new Hy(s,o,n,e)}constructor(e,t=64,i=Float64Array,r){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=Vy.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Gy(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:s}=this,a=[0,n.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=s){for(let s=h;s<=u;s++){const a=o[2*s],c=o[2*s+1];a>=e&&a<=i&&c>=t&&c<=r&&l.push(n[s])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=i&&f>=t&&f<=r&&l.push(n[d]),(0===c?e<=p:t<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?i>=p:r>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,s=[0,r.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=o){for(let i=h;i<=u;i++)Ky(n[2*i],n[2*i+1],e,t)<=l&&a.push(r[i]);continue}const d=h+u>>1,p=n[2*d],f=n[2*d+1];Ky(p,f,e,t)<=l&&a.push(r[d]),(0===c?e-i<=p:t-i<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?e+i>=p:t+i>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return a}}function Gy(e,t,i,r,n,o){if(n-r<=i)return;const s=r+n>>1;$y(e,t,s,r,n,o),Gy(e,t,i,r,s-1,1-o),Gy(e,t,i,s+1,n,1-o)}function $y(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const s=n-r+1,a=i-r+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);$y(e,t,i,Math.max(r,Math.floor(i-a*c/s+u)),Math.min(n,Math.floor(i+(s-a)*c/s+u)),o)}const s=t[2*i+o];let a=r,l=n;for(Zy(e,t,r,i),t[2*n+o]>s&&Zy(e,t,r,n);as;)l--}t[2*r+o]===s?Zy(e,t,r,l):(l++,Zy(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Zy(e,t,i,r){qy(e,i,r),qy(t,2*i,2*r),qy(t,2*i+1,2*r+1)}function qy(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Ky(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}e.$=gi,e.A=gt,e.B=ei,e.C=ps,e.D=rg,e.E=xt,e.F=2,e.G=df,e.H=uf,e.I=bt,e.J=class extends wm{},e.K=di,e.L=Lt,e.M=Xo,e.N=Qn,e.O=On,e.P=V,e.Q=Nn,e.R=Je,e.S=Xn,e.T=VA,e.U=Yo,e.V=wm,e.W=to,e.X=Yn,e.Y=Lr,e.Z=kr,e._=Pr,e.a=function(e){return Te.API_CDN_URL_REGEX.test(e)},e.a$=kl,e.a0=Bt,e.a1=Jo,e.a2=jn,e.a3=Un,e.a4=function(e){const t=e.value;let i=[];if(!t)return i;const r=di(t);return"string"!==r?(i=i.concat([new wm(e.key,t,`string expected, "${r}" found`)]),i):(Tm(t,!0)||(i=i.concat([new wm(e.key,t,`invalid url "${t}"`)])),i)},e.a5=Wo,e.a6=No,e.a7=Ko,e.a8=$o,e.a9=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return Ae(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Et(e.x,t.x,i),y:Et(e.y,t.y,i),z:Et(e.z,t.z,i),azimuthal:Et(e.azimuthal,t.azimuthal,i),polar:Et(e.polar,t.polar,i)}}},e.aA=function(e,t){const i={};for(let r=0;r{r(e,i)}),t):r(e,i),()=>{}}return n.callbacks.push(r),n.cancel||(n.cancel=i(((i,r)=>{n.result=[i,r];for(const e of n.callbacks)this.scheduler?this.scheduler.add((()=>{e(i,r)}),t):e(i,r);setTimeout((()=>delete this.entries[e]),3e3)}))),()=>{n.result||(n.callbacks=n.callbacks.filter((e=>e!==r)),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}},e.aE=function(e,t,i){const r=JSON.stringify(e.request);return e.data&&(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(t=>{const r=rt(e.request,((e,r,n,o)=>{e?t(e):r&&t(null,{vectorTile:i?void 0:new sh.VectorTile(new Fp(r)),rawData:r,cacheControl:n,expires:o})}));return()=>{r.cancel(),t()}}),t)},e.aF=function(e){Ge++,Ge>Ue&&(e.getActor().send("enforceCacheSizeLimit",Oe),Ge=0)},e.aG=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.aH=cc,e.aI=WA,e.aJ=im,e.aK=qA,e.aL=function(e,t){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){t(null,i)};for(let t=0;t{}}},e.aM=HA,e.aN=function(e){return fetch(e).then((e=>e.arrayBuffer())).then((t=>Cy(t,0,e)))},e.aO=ky,e.aP=class{constructor(e,t,i,r){this.id=e,this.position=null!=t?new cl(t[0],t[1]):new cl(0,0),this.orientation=null!=i?i:[0,0,0],this.nodes=r,this.uploaded=!1,this.aabb=new Tc([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,t){if(U.mat4.multiply(e.matrix,t,e.matrix),e.meshes)for(const t of e.meshes){const i=Tc.applyTransformFast(t.aabb,e.matrix);this.aabb.encapsulate(i)}if(e.children)for(const t of e.children)this._applyTransformations(t,e.matrix)}computeBoundsAndApplyParent(){const e=U.mat4.identity([]);for(const t of this.nodes)this._applyTransformations(t,e)}computeModelMatrix(e,t,i,r,n,o,s=!1){Lm(this.matrix,this,e.transform,this.position,t,i,r,n,o,s)}upload(e){if(!this.uploaded){for(const t of this.nodes)zm(t,e);for(const e of this.nodes)Rm(e);this.uploaded=!0}}destroy(){for(const e of this.nodes)Dm(e)}},e.aQ=ae,e.aR=Xf,e.aS=gl,e.aT=_l,e.aU=Ts,e.aV=Vs,e.aW=oe,e.aX=na,e.aY=MA,e.aZ=function(){Ro.isLoading()||Ro.isLoaded()||"deferred"!==ko()||zo()},e.a_=es,e.aa=Do,e.ab=eo,e.ac=Bl,e.ad=U,e.ae=ee,e.af=Go,e.ag=Hc,e.ah=Et,e.ai=Xi,e.aj=Mt,e.ak=Z,e.al=Ct,e.am=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return function([e,t]){const i=Ae([1,e,t]);return{x:i.x,y:i.y,z:i.z}}(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Et(e.x,t.x,i),y:Et(e.y,t.y,i),z:Et(e.z,t.z,i)}}},e.an=function(e,t,i=0,r=!0){const n=new V(i,i),o=e.sub(n),s=t.add(n),a=[o,new V(s.x,o.y),s,new V(o.x,s.y)];return r&&a.push(o.clone()),a},e.ao=function(e,t){const i=[];for(let r=0;rn&&(r+=(e[i]-n)*(e[i]-n)),t[i]0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!$c(e,new cl(e.center.lat,90)),r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!$c(e,new cl(e.center.lat,-90))]},e.b_=function(e,t){const{scale:i}=e.tileTransform,r=i*Xi/(e.tileSize*Math.pow(2,t.zoom-e.tileID.overscaledZ+e.tileID.canonical.z));return U.mat2.scale(new Float32Array(4),t.inverseAdjustmentMatrix,[r,r])},e.ba=NA,e.bb=function(e,t){const i=Hc(t.zoom);if(0===i)return Ic(e);const r=kc(e),n=zc(r),o=fl(r.getWest())*t.worldSize,s=fl(r.getEast())*t.worldSize,a=Al(r.getNorth())*t.worldSize,l=Al(r.getSouth())*t.worldSize,c=[o,a,0],u=[s,a,0],h=[o,l,0],d=[s,l,0],p=U.mat4.invert([],t.globeMatrix);return U.vec3.transformMat4(c,c,p),U.vec3.transformMat4(u,u,p),U.vec3.transformMat4(h,h,p),U.vec3.transformMat4(d,d,p),n[0]=Pc(n[0],h,i),n[1]=Pc(n[1],d,i),n[2]=Pc(n[2],u,i),n[3]=Pc(n[3],c,i),Tc.fromPoints(n)},e.bc=Uc,e.bd=Rc,e.be=Pc,e.bf=ws,e.bg=fc,e.bh=ty,e.bi=Fp,e.bj=rt,e.bk=function(e,t){const i=[];for(const r in e)r in t||i.push(r);return i},e.bl=ie,e.bm=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.bn=H,e.bo=function(e,t){const{x:i,y:r}=e.point,n=Vc(i,r,e.worldSize/e._pixelsPerMercatorPixel,0,0);return U.mat4.multiply(n,n,Nc(Ic(t)))},e.bp=xp,e.bq=Up,e.br=vp,e.bs=function(e,t,i,r,n){const o=5*t+2;e.float32[o+0]=i,e.float32[o+1]=r,e.float32[o+2]=n},e.bt=BA,e.bu=cf,e.bv=Ol,e.bw=mp,e.bx=jh,e.by=bm,e.bz=Xh,e.c=Ce,e.c$=ep,e.c0=om,e.c1=function(e){const t=om(e,!0);return U.mat2.invert([],[t[0],t[1],t[4],t[5]])},e.c2=_c,e.c3=function(e){const{x:t,y:i}=e.point,{lng:r,lat:n}=e._center;return Vc(t,i,e.worldSize,r,n)},e.c4=q,e.c5=uc,e.c6=Ya,e.c7=function(e){const t=Math.round((e+45+360)%360/90)%4;return K[t]},e.c8=45,e.c9=It,e.cA=La,e.cB=class extends Ca{constructor(e){super(e),this.current=za}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<9;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},e.cC=W,e.cD=function(e,t,i){const r=Hc(i.zoom),n=e.style.map._antialias,o=e.terrain&&e.terrain.exaggeration()>0;return 0===r&&!n&&!o},e.cE=function(e){const t=e.pixelsPerMeter,i=t/ml(1,e.center.lat),r=U.mat4.identity(new Float64Array(16));return U.mat4.translate(r,r,[e.point.x,e.point.y,0]),U.mat4.scale(r,r,[i,i,t]),Float32Array.from(r)},e.cF=kc,e.cG=function(e){const t=vl-5;e=J(e,-t,t)/t*90;const i=Math.pow(Math.abs(Math.sin(Z(e))),3);return Math.round(i*(il.length-1))},e.cH=function(e,t,i,r){const n=t.getNorth(),o=t.getSouth(),s=t.getWest(),a=t.getEast(),l=1<0){const e=180/r;U.mat3.multiply(p,p,[e/c+1,0,0,0,e/u+1,0,-.5*e/h,.5*e/d,1])}return p[2]=l,p[5]=e.x,p[8]=e.y,p},e.cI=Ic,e.cJ=function(e,t,i){const r=U.mat4.identity(new Float64Array(16)),n=(t/(1<1)return!1;const i=t.getSource().maxzoom,r=1<1)return t;const n=r.getSource().maxzoom,o=1<{const o=this.getAtTileOffset(e,n.x,n.y),s=r.upVector(e.canonical,n.x,n.y),a=r.upVectorScale(e.canonical,t,i).metersToTile;return U.vec3.scale(s,s,o*a),s}}getForTilePoints(e,t,i,r){if(this.isUsingMockSource())return!1;const n=Om.create(this,e,r);return!!n&&(t.forEach((e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],i)})),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const i=t.dem.tree,r=t.tileID,n=1<({u_camera_to_center_distance:new Ea(e),u_extrude_scale:new Da(e),u_device_pixel_ratio:new Ea(e),u_matrix:new ka(e),u_inv_rot_matrix:new ka(e),u_merc_center:new Ma(e),u_tile_id:new Ia(e),u_zoom_transition:new Ea(e),u_up_dir:new Ia(e),u_emissive_strength:new Ea(e)}),e.cU=e=>({u_matrix:new ka(e),u_pixels_to_tile_units:new Da(e),u_device_pixel_ratio:new Ea(e),u_width_scale:new Ea(e),u_floor_width_scale:new Ea(e),u_units_to_pixels:new Ma(e),u_dash_image:new Sa(e),u_gradient_image:new Sa(e),u_image_height:new Ea(e),u_texsize:new Ma(e),u_tile_units_to_pixels:new Ea(e),u_alpha_discard_threshold:new Ea(e),u_trim_offset:new Ma(e),u_trim_fade_range:new Ma(e),u_trim_color:new Pa(e),u_emissive_strength:new Ea(e),u_zbias_factor:new Ea(e),u_tile_to_meter:new Ea(e)}),e.cV=e=>({u_matrix:new ka(e),u_texsize:new Ma(e),u_pixels_to_tile_units:new Da(e),u_device_pixel_ratio:new Ea(e),u_width_scale:new Ea(e),u_floor_width_scale:new Ea(e),u_image:new Sa(e),u_units_to_pixels:new Ma(e),u_tile_units_to_pixels:new Ea(e),u_alpha_discard_threshold:new Ea(e),u_trim_offset:new Ma(e),u_trim_fade_range:new Ma(e),u_trim_color:new Pa(e),u_emissive_strength:new Ea(e),u_zbias_factor:new Ea(e),u_tile_to_meter:new Ea(e)}),e.cW=Qs,e.cX=Ap,e.cY=bp,e.cZ=Xc,e.c_=(e,t,i,r,n,o)=>{const s=e.transform,a="globe"===s.projection.name;let l;if("map"===o.paint.get("circle-pitch-alignment"))if(a){const e=jc(s.zoom,t.canonical)*s._pixelsPerMercatorPixel;l=Float32Array.from([e,0,0,e])}else l=s.calculatePixelsToTileUnitsMatrix(i);else l=new Float32Array([s.pixelsToGLUnits[0],0,0,s.pixelsToGLUnits[1]]);const c={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(s.projection),u_matrix:e.translatePosMatrix(t.projMatrix,i,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:ke.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:Wc,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:o.paint.get("circle-emissive-strength")};if(a){c.u_inv_rot_matrix=r,c.u_merc_center=n,c.u_tile_id=[t.canonical.x,t.canonical.y,1<0?Math.acos(i/r)*$:0;let o=0!==e||0!==t?Math.atan2(-t,-e)*$+90:0;return o<0&&(o+=360),[r,o,n]},e.cd=Tl,e.ce=Tc,e.cf=Ae,e.cg=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.ch=function(e,t){return e.readFields(fg,{icons:[]},t)},e.ci=function(e){return e({pluginStatus:Mo,pluginURL:Io}),Fo.on("pluginStateChange",e),e},e.cj=sg,e.ck=vf,e.cl=yf,e.cm=tt,e.cn=Po,e.co=Re,e.cp=mt,e.cq=ue,e.cr=function(e){const t=e.indexOf(ds);return t>=0?e.slice(0,t):e},e.cs=function(e){return e.indexOf(ds)>=0},e.ct=function(e){const t=e.indexOf(ds);return t>=0?e.slice(t+1):""},e.cu=function(e){const t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},e.cv=function(e,t,i,r){return"custom"===e.type?new rm(e,t):new Wm[e.type](e,t,i,r)},e.cw=ce,e.cx=class extends Uy{constructor(e,t){super(e._vectorTileFeature,e._z,e._x,e._y,e.id),e.state&&(this.state=Object.assign({},e.state)),this.target=t.target,this.namespace=t.namespace,t.properties&&(this.properties=t.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=e.source,this.sourceLayer=e.sourceLayer,this.layer=e.layer)}toJSON(){const e=super.toJSON();return e.target=this.target,e.namespace=this.namespace,e}},e.cy=Fo,e.cz=it,e.d=function(e){return Te.API_TILEJSON_REGEX.test(e)},e.d$=Dy,e.d0=ti,e.d1=(e,t,i,r,n,o,s,a)=>{const l=e.transform,c=l.pitch<15?Xd(.07,.7,J((14-l.zoom)/5,0,1)):.07,u="none"===i.paint.get("line-trim-color-use-theme").constantOr("default");return{u_matrix:Jd(e,t,i,r),u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:l.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:n,u_width_scale:o,u_floor_width_scale:s,u_image:0,u_tile_units_to_pixels:Yd(t,l),u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:a,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(u?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:c,u_tile_to_meter:Tl(t.tileID.canonical,0)}},e.d2=(e,t,i,r,n,o,s,a,l)=>{const c=e.transform,u=c.calculatePixelsToTileUnitsMatrix(t),h="none"===i.paint.get("line-trim-color-use-theme").constantOr("default"),d=c.pitch<15?Xd(.07,.7,J((14-c.zoom)/5,0,1)):.07;return{u_matrix:Jd(e,t,i,r),u_pixels_to_tile_units:u,u_device_pixel_ratio:o,u_width_scale:s,u_floor_width_scale:a,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:tp(i)&&t.lineAtlasTexture?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Yd(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:l,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(h?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:d,u_tile_to_meter:Tl(t.tileID.canonical,0)}},e.d3=se,e.d4=fu,e.d5=yl,e.d6=Sd,e.d7=hc,e.d8=yd,e.d9=ad,e.dA=Qh,e.dB=X,e.dC=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},e.dD=Y,e.dE=wl,e.dF=sl,e.dG=function([e,t,i]){const r=Math.hypot(e,t,i),n=Math.atan2(e,i),o=.5*Math.PI-Math.acos(-t/r);return new cl(q(n),q(o))},e.dH=cm,e.dI=function(e){const t=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==_e){const t=e.navigator?e.navigator.userAgent:null;_e=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return _e}(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.dJ=function(e,t){Oe=e,Ue=t},e.dK=$c,e.dL=Gc,e.dM=function(e){const t=[0,0,0],i=U.mat4.identity(new Float64Array(16));return U.mat4.multiply(i,e.pixelMatrix,e.globeMatrix),U.vec3.transformMat4(t,t,i),new V(t[0],t[1])},e.dN=function(e,t,i=!1){if(Mo===Bo||Mo===Co||Mo===So)throw new Error("setRTLTextPlugin cannot be called multiple times.");Io=ke.resolveURL(e),Mo=Bo,Eo=t,Lo(),i||zo()},e.dO=ko,e.dP=function(){sg().acquire(tg)},e.dQ=function(){const e=ng;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(tg),ng=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()"))},e.dR=ig,e.dS=function(e){const t=Ve();if(!t)return;const i=t.delete(De);e&&i.catch(e).then((()=>e()))},e.dT=eg,e.dU=uy,e.dV=function(e){oy=ke.resolveURL(e),cy||(cy=new rg(sg(),new xt)),cy.broadcast("setDracoUrl",oy)},e.dW=hy,e.dX=function(e){ay=ke.resolveURL(e),cy||(cy=new rg(sg(),new xt)),cy.broadcast("setMeshoptUrl",ay)},e.dY=co,e.dZ=hu,e.d_=_f,e.da=450,e.db=7,e.dc=KA,e.dd=vs,e.de=ta,e.df=256,e.dg=Nc,e.dh=Is,e.di=$s,e.dj=Zs,e.dk=function(e,t,i,r,n){return J((e-t)/(i-t)*(n-r)+r,r,n)},e.dl=En,e.dm=bl,e.dn=class{constructor(e,t,i,r){this.context=e,this.format=r,this.size=i,this.texture=e.gl.createTexture();const[n,o,s]=this.size,{gl:a}=e;a.bindTexture(a.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1),a.texImage3D(a.TEXTURE_3D,0,this.format,n,o,s,0,QA(this.format),jA(this.format),t.data)}bind(e,t){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_3D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},e.dp=pm,e.dq=[1,1,1],e.dr=Om,e.ds=Pm,e.dt=Os,e.du=Ws,e.dv=al,e.dw=Ks,e.dx=qs,e.dy=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new V(1/0,1/0),max:new V(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,t=!1){const i=Zh(new V(0,0),new V(Xi,Xi),e),r=[];if(t&&!Gh(i,this._globalClipBounds))return r;for(const t of this._activeRegions){if(t.hiddenByOverlap)continue;if(!Gh(i,t))continue;const n=qh(t.min,t.max,e);r.push({min:n.min,max:n.max,sourceId:this._sourceIds[t.priority],footprint:t.footprint,footprintTileId:t.tileId,order:t.order,clipMask:t.clipMask,clipScope:t.clipScope})}return r}setSources(e){this._setSources(e.map((e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const t=[];for(const i of e.cache.getVisibleCoordinates()){const r=e.cache.getTile(i).buckets[e.layer];r&&r.updateFootprints(i.toUnwrapped(),t)}return t},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope}))))}_addSource(e){const t=e.getFootprints();if(0===t.length)return;const i=e.getOrder(),r=e.getClipMask(),n=e.getClipScope();for(const e of t){if(!e.footprint)continue;const t=Zh(e.footprint.min,e.footprint.max,e.id);this._activeRegions.push({min:t.min,max:t.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:e.id,footprint:e.footprint,order:i,clipMask:r,clipScope:n})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort(((e,t)=>e.priority-t.priority||Vh(e.min,t.min)||Vh(e.max,t.max)||e.order-t.order||e.clipMask-t.clipMask||function(e,t){const i=(e,t)=>e+t;return e.length-t.length||e.reduce(i,"").localeCompare(t.reduce(i,""))}(e.clipScope,t.clipScope)));let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let t=0;for(;!e&&t!==this._activeRegions.length;){const i=this._activeRegions[t],r=this._prevRegions[t];e=i.priority!==r.priority||!Hh(i,r)||i.order!==r.order||i.clipMask!==r.clipMask||!H(i.clipScope,r.clipScope),++t}}if(e){++this._updateTime;for(const e of this._activeRegions)e.order!==Qh&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,e.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,e.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,e.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,e.max.y));const e=e=>{const t=this._activeRegions;if(e>=t.length)return e;const i=t[e].priority;for(;e1){let t=0,i=e(t);for(;t!==i;){let r=t;const n=t;for(;r!==i;){const e=this._activeRegions[r];e.hiddenByOverlap=!1;for(let t=0;t=0;t--)this._addSource(e[t]);this._computeReplacement()}},e.dz=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const e of this._poleSegments)e.destroy();for(const e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,t){const i=new bs,r=new Vs,n=[],o=e+1+2,s=t[0]+1,a=t[0]+1+(1+t.length),l=(e,t,i)=>{let r=e===o-1?e-2:0===e?e:e-1;return r+=i?24575:0,[r,t]};for(let e=0;ee.id-t.id)),r.sort(((e,t)=>e.id-t.id||e.idx-t.idx)),r=r.filter(((e,t,i)=>t===i.findIndex((t=>t.id===e.id&&t.idx===e.idx))));const s=new Array;let a=0;const l=r.length;for(const e of n){if(e.constantHeight){s.push(new fh(e.id,e.bounds,e.constantHeight));continue}for(;a!==l&&r[a].ide*mp))}let x=y?"center":c.get("text-justify").evaluate(s,{},o);const b="point"===_,T=b?c.get("text-max-width").evaluate(s,{},o)*mp:1/0,B=o=>{e.allowVerticalPlacement&&mo(r)&&(A.vertical=jp(m,t,i,n,a,T,h,g,o,f,w,Up.vertical,!0,p,d,l))};if(!y&&v){const e="auto"===x?v.map((e=>Nf(e))):[x];let r=!1;for(let o=0;o=0||!mo(r)){const e=jp(m,t,i,n,a,T,h,g,x,f,w,Up.horizontal,!1,p,d,l);e&&(A.horizontal[x]=e)}B(b?"left":x)}}let T,B,C,S,E,M=!1;if(s.icon&&s.icon.hasPrimary()){const t=Rf(s.icon,e.iconSizeData,u["icon-size"],o,e.zoom,s,l,h.iconScaleFactor);T=t.iconPrimary,B=t.iconSecondary;const i=T.toString(),a=r.get(i);a&&(C=c.get("icon-offset").evaluate(s,{},o),S=c.get("icon-anchor").evaluate(s,{},o),E=c.get("icon-text-fit").evaluate(s,{},o),g=Yp(n.get(i),B?n.get(B.toString()):void 0,C,S),M=a.sdf,void 0===e.sdfIcons?e.sdfIcons=a.sdf:e.sdfIcons!==a.sdf&&de("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(a.pixelRatio!==e.pixelRatio||0!==c.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}x=x||!(!s.icon||!s.icon.hasSecondary());const I=$f(A.horizontal)||A.vertical;e.iconsInText||(e.iconsInText=!!I&&I.iconsInText);const P=p*h.textScaleFactor/mp,{defaultShapedIcon:L,verticallyShapedIcon:F}=Qf(e,g,c,s,o,A,P,C,E);g=L,b.push({feature:s,shapedTextOrientations:A,shapedText:I,shapedIcon:g,iconPrimary:T,iconSecondary:B,iconOffset:C,iconAnchor:S,verticallyShapedIcon:F,layoutTextSize:p,layoutIconSize:f,textOffset:w,isSDFIcon:M,iconTextFit:E})}return{featureData:b,sizes:h,hasAnySecondaryIcon:x,textAlongLine:y,symbolPlacement:_}},e.ea=ff,e.eb=function(e,t,i,r,n,o,s,a,l,c){const{featureData:u,hasAnySecondaryIcon:h,sizes:d,textAlongLine:p,symbolPlacement:f}=t;for(const t of u){const{shapedIcon:i,verticallyShapedIcon:o,feature:u,shapedTextOrientations:A,shapedText:m,layoutTextSize:g,textOffset:_,isSDFIcon:y,iconPrimary:v,iconSecondary:x,iconTextFit:b,iconOffset:w}=t;Df(i,c.iconPositions,v,x),Df(o,c.iconPositions,v,x),Of(A,c.iconPositions),(m||i)&&jf(e,u,A,i,o,l,d,g,0,_,y,r,n,s,a,h,b,w,p,f)}i&&e.generateCollisionDebugBuffers(o,e.collisionBoxArray,d.textScaleFactor)},e.ec=sh,e.ed=h_,e.ee=j,e.ef=oh,e.eg=Lp,e.eh=t,e.ei=function(e){let t=0;if(new Uint32Array(e,0,1)[0]!==vy){const i=new Uint32Array(e,0,7),[,,r,n,o,s]=i;t=i.byteLength+n+o+s+o,(r!==e.byteLength||t>=e.byteLength)&&de("Invalid b3dm header information.")}return Cy(e,t)},e.ej=function(e,t){const i=ky(e);for(const e of i){for(const t of e.meshes)zy(t);e.lights&&(e.lightMeshIndex=e.meshes.length,e.meshes.push(Ry(e.lights,t)))}return i},e.ek=Gm,e.el=Jm,e.em=Ro,e.en=function(e){He(),null!=Qe&&Qe.then((t=>{t.keys().then((i=>{for(let r=0;r"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""))},e.k=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(Number("0x"+t)))))},e.l=re,e.m=$e,e.n=function(e,t){return it(re(e,{type:"json"}),t)},e.o=lt,e.p=function(e,t){return it(re(e,{method:"POST"}),t)},e.q=ke,e.r=du,e.s=function(e){try{const t=self[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}},e.t=Fe,e.u=function(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()},e.v=function(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e.w=de,e.x=function(){return og||(og=new ig),og},e.y=Jg,e.z=_t})),r(["./shared"],(function(e){function t(e){const t=e?e.url.toString():void 0;return t?performance.getEntriesByName(t):[]}function i(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const r of e)t+=`${i(r)},`;return`${t}]`}let t="{";for(const r of Object.keys(e).sort())t+=`${r}:${i(e[r])},`;return`${t}}`}function r(t){let r="";for(const n of e.bm)("model"!==t.type||"minzoom"!==n&&"maxzoom"!==n)&&(r+=`/${i(t[n])}`);return r}class n{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,n,o){this._options=o;for(const i of t)this._layerConfigs[i.id]=i,(this._layers[i.id]=e.cv(i,this.scope,null,this._options)).compileFilter(o),this.keyCache[i.id]&&delete this.keyCache[i.id];for(const e of n)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const s=function(e,t){const n={};for(let o=0;othis._layers[e.id])),i=t[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const o=i.sourceLayer||"_geojsonTileLayer";let s=n[o];s||(s=n[o]=[]),s.push(t)}}}const o=1*e.d_;class s{constructor(t){const i={},r=[];for(const e in t){const n=t[e],s=i[e]={};for(const e in n.glyphs){const t=n.glyphs[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i=t.metrics.localGlyph?o:1,a={x:0,y:0,w:t.bitmap.width+2*i,h:t.bitmap.height+2*i};r.push(a),s[e]=a}}const{w:n,h:s}=e.H(r),a=new e.dZ({width:n||1,height:s||1});for(const r in t){const n=t[r];for(const t in n.glyphs){const s=n.glyphs[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const l=i[r][t],c=s.metrics.localGlyph?o:1;e.dZ.copy(s.bitmap,a,{x:0,y:0},{x:l.x+c,y:l.y+c},s.bitmap)}}this.image=a,this.positions=i}}e.dY(s,"GlyphAtlas");class a{constructor(t){this.tileID=new e.aH(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.lut=t.lut,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.scope=t.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.request&&t.request.collectResourceTiming,this.promoteId=t.promoteId,this.isSymbolTile=t.isSymbolTile,this.tileTransform=e.aR(t.tileID.canonical,t.projection),this.projection=t.projection,this.worldview=t.worldview,this.localizableLayerIds=t.localizableLayerIds,this.brightness=t.brightness,this.extraShadowCaster=!!t.extraShadowCaster,this.tessellationStep=t.tessellationStep,this.scaleFactor=t.scaleFactor}parse(t,i,r,n,o){this.status="parsing",this.data=t,this.collisionBoxArray=new e.aX;const a=new e.d$(Object.keys(t.layers).sort()),c=new e.e0(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h=new e.e1(256,256),d={featureIndex:c,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:h,availableImages:r,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},p=i.familiesBySource[this.source];for(const i in p){const n=t.layers[i];if(!n)continue;let o=!1,s=!1,h=!1;for(const e of p[i])"symbol"===e[0].type?o=!0:s=!0,e[0].is3D()&&"model"!==e[0].type&&(h=!0);if(this.extraShadowCaster&&!h)continue;if(!0===this.isSymbolTile&&!o)continue;if(!1===this.isSymbolTile&&!s)continue;1===n.version&&e.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const f=a.encode(i),A=[];let m=!1;for(let t=0,r=0;t=i.maxzoom||"none"!==i.visibility&&(l(t,this.zoom,d.brightness,r),(u[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:f,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(A,d,this.tileID.canonical,this.tileTransform),c.bucketLayerIDs.push(t.map((t=>e.C(t.id,t.scope))))))}}let f,A,m,g,_,y;h.trim();const v={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},x=()=>{if(f)return this.status="done",o(f);if(this.extraShadowCaster)this.status="done",o(null,{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:d.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(A&&m&&g){const t=new s(A),i=new Map;for(const[t,r]of m.entries()){const{imagePosition:n}=e.e7(t,r,e.e8);i.set(t,n)}const o={};for(const n in u){const s=u[n];s instanceof e.aY&&(l(s.layers,this.zoom,d.brightness,r),o[n]=e.e9(s,A,t.positions,m,i,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio))}const a={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(n,m,_,(()=>{a.iconsPending=!1,b(o,t,a)})),this.rasterizeIfNeeded(n,g,y,(()=>{a.patternsPending=!1,b(o,t,a)}))}},b=(t,i,n,s)=>{if(n.iconsPending||n.patternsPending)return;const a=new e.ea(m,g,this.lut);for(const i in u){const n=u[i];if(i in t)e.eb(n,t[i],this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,m,a);else if(n.hasPattern&&(n instanceof e.b2||n instanceof e.b3||n instanceof e.d8)){l(n.layers,this.zoom,d.brightness,r);const e=Object.fromEntries(a.patternPositions);n.addFeatures(d,this.tileID.canonical,e,r,this.tileTransform,this.brightness)}}this.status="done",o(null,{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:h,imageAtlas:a,brightness:d.brightness})};if(!this.extraShadowCaster){const t=e.e5(d.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(t).length?n.send("getGlyphs",{uid:this.uid,stacks:t,scope:this.scope},((e,t)=>{f||(f=e,A=t,x())}),void 0,!1,v):A={};const i=Array.from(d.iconDependencies.keys()).map((t=>e.I.parse(t)));i.length?n.send("getImages",{images:i,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},((e,t)=>{f||(f=e,m=new Map,_=this.updateImageMapAndGetImageTaskQueue(m,t,d.iconDependencies),x())}),void 0,!1,v):(m=new Map,_=new Map);const r=Array.from(d.patternDependencies.keys()).map((t=>e.I.parse(t)));r.length?n.send("getImages",{images:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},((e,t)=>{f||(f=e,g=new Map,y=this.updateImageMapAndGetImageTaskQueue(g,t,d.patternDependencies),x())}),void 0,!1,v):(g=new Map,y=new Map)}if(d.elevationFeatures&&d.elevationFeatures.length>0){const t=[];for(const i of Object.values(u))if(i instanceof e.b3){const e=i.getUnevaluatedPortalGraph();e&&t.push(e)}const i=e.e6.evaluate(t);for(const t of Object.values(u))t instanceof e.b3&&t.setEvaluatedPortalGraph(i)}x()}rasterizeIfNeeded(e,t,i,r){Array.from(t.values()).some((e=>e.usvg))?this.rasterize(e,t,i,r):r()}updateImageMapAndGetImageTaskQueue(e,t,i){const r=new Map;for(const n of t.keys()){const o=i.get(n)||[];for(const i of o){const n=i.toString(),o=t.get(i.id.toString());o.usvg?r.has(n)||(r.set(n,i),e.set(n,Object.assign({},o))):e.set(n,o)}}return r}rasterize(e,t,i,r){this.rasterizeTask=e.send("rasterizeImages",{scope:this.scope,tasks:i},((e,i)=>{if(!e)for(const[e,r]of i.entries()){const i=Object.assign(t.get(e),{data:r});t.set(e,i)}r()}))}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function l(t,i,r,n){const o=new e.aa(i,{brightness:r});for(const e of t)e.recalculate(o,n)}class c extends e.E{constructor(t,i,r,n,o,s){super(),this.actor=t,this.layerIndex=i,this.availableImages=r,this.loadVectorData=o||e.aE,this.loading={},this.loaded={},this.deduped=new e.aD(t.scheduler),this.isSpriteLoaded=n,this.scheduler=t.scheduler,this.brightness=s}loadTile(i,r){const n=i.uid,o=i&&i.request,s=o&&o.collectResourceTiming,l=this.loading[n]=new a(i);l.abort=this.loadVectorData(i,((a,c)=>{const u=!this.loading[n];if(delete this.loading[n],l.cancelRasterize(),u||a||!c)return l.status="done",u||(this.loaded[n]=l),r(a);const h=c.rawData,d={};c.expires&&(d.expires=c.expires),c.cacheControl&&(d.cacheControl=c.cacheControl),l.vectorTile=c.vectorTile||new e.ec.VectorTile(new e.bi(h));const p=()=>{l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.actor,((i,n)=>{if(i||!n)return r(i);const a={};if(s){const e=t(o);e.length>0&&(a.resourceTiming=JSON.parse(JSON.stringify(e)))}r(null,e.l({rawTileData:h.slice(0)},n,d,a))}))};this.isSpriteLoaded?p():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(p,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):p()})),this.loaded=this.loaded||{},this.loaded[n]=l}))}reloadTile(t,i){const r=this.loaded,n=t.uid;if(r&&r[n]){const o=r[n];o.scaleFactor=t.scaleFactor,o.showCollisionBoxes=t.showCollisionBoxes,o.projection=t.projection,o.brightness=t.brightness,o.tileTransform=e.aR(t.tileID.canonical,t.projection),o.extraShadowCaster=t.extraShadowCaster,o.lut=t.lut;const s=(e,t)=>{const r=o.reloadCallback;r&&(delete o.reloadCallback,o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,r)),i(e,t)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}else i(null,void 0)}abortTile(e,t){const i=e.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t()}}class u{loadTile(t,i){const{uid:r,encoding:n,rawImageData:o,padding:s}=t,a=ImageBitmap&&o instanceof ImageBitmap?this.getImageData(o,s):o;i(null,new e.ed(r,a,n,s<1))}reloadTile(e,t){t(null,null)}abortTile(e,t){t()}removeTile(e,t){t()}getImageData(e,t){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(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}e.bh.setPbf(e.bi);class h{constructor(t){this._mrt=new e.bh(t.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=t.uid,this.tileID=t.tileID,this.source=t.source}parse(t,i){const r=this._mrt;this.status="parsing",this._entireBuffer=t;try{r.parseHeader(t),this._isHeaderLoaded=!0;const n=[];for(const i in r.layers){const o=r.getLayer(i),s=o.getDataRange(o.getBandList()),a=r.createDecodingTask(s),l=t.slice(s.firstByte,s.lastByte+1),c=e.bh.performDecoding(l,a).then((e=>a.complete(null,e))).catch((e=>a.complete(e,null)));n.push(c)}Promise.allSettled(n).then((()=>i(null,r)))}catch(e){i(e)}}}class d{constructor(e){this.actor=e,this.loading={},this.loaded={}}loadTile(t,i){const r=t.uid,n=t.request,o=this.loading[r]=new h(t),{cancel:s}=e.bj(n,((e,t,n,s)=>{const a=!this.loading[r];if(delete this.loading[r],a||e||!t)return o.status="done",a||(this.loaded[r]=o),i(e);o.parse(t,((e,t)=>{if(e||!t)return i(e);i(null,t,n,s)})),this.loaded[r]=o}));o.abort=s}reloadTile(e,t){t(null,void 0)}abortTile(e,t){const i=e.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=e.uid;this.loaded[i]&&delete this.loaded[i],t()}decodeRasterArray({task:t,buffer:i},r){e.bh.performDecoding(i,t).then((e=>r(null,e))).catch((e=>r(e)))}}const p=e.ec.VectorTileFeature.prototype.toGeoJSON;class f{constructor(t){this._feature=t,this.extent=e.ai,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const i of this._feature.geometry)t.push([new e.P(i[0],i[1])]);return t}{const t=[];for(const i of this._feature.geometry){const r=[];for(const t of i)r.push(new e.P(t[0],t[1]));t.push(r)}return t}}toGeoJSON(e,t,i){return p.call(this,e,t,i)}}class A{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.ai,this.length=t.length,this._features=t}feature(e){return new f(this._features[e])}}const m=64/4096,g=128;class _{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],t){for(const i of e){const e=i.id;if(null==e)continue;let r=this.features.get(e);r&&this.updateCache(r,t),i.geometry?(r=v(i),this.updateCache(r,t),this.features.set(e,r)):this.features.delete(e),this.updateCache(r,t)}}updateCache(e,t){for(const{canonical:i,uid:r}of Object.values(t)){const{z:n,x:o,y:s}=i;y(e,Math.pow(2,n),o,s)&&delete t[r]}}getTile(e,t,i){const r=Math.pow(2,e),n=[];for(const e of this.features.values())y(e,r,t,i)&&n.push(T(e,r,t,i));return{features:n}}getFeatures(){return[...this.features.values()]}}function y({minX:e,minY:t,maxX:i,maxY:r},n,o,s){return e<(o+1+m)/n&&t<(s+1+m)/n&&i>(o-m)/n&&r>(s-m)/n}function v(e){const{id:t,geometry:i,properties:r}=e;if(!i)return;if("GeometryCollection"===i.type)throw new Error("GeometryCollection not supported in dynamic mode.");const{type:n,coordinates:o}=i,s={id:t,type:1,geometry:[],tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},a=s.geometry;if("Point"===n)x(o,a,s);else if("MultiPoint"===n)for(const e of o)x(e,a,s);else if("LineString"===n)s.type=2,b(o,a,s);else if("MultiLineString"===n)s.type=2,w(o,a,s);else if("Polygon"===n)s.type=3,w(o,a,s,!0);else{if("MultiPolygon"!==n)throw new Error("Input data is not a valid GeoJSON object.");s.type=3;for(const e of o)w(e,a,s,!0)}return s}function x([t,i],r,n){const o=e.av(t);let s=e.aC(i);s=s<0?0:s>1?1:s,r.push(o,s),n.minX=Math.min(n.minX,o),n.minY=Math.min(n.minY,s),n.maxX=Math.max(n.maxX,o),n.maxY=Math.max(n.maxY,s)}function b(e,t,i,r=!1,n=!1){const o=[];for(const t of e)x(t,o,i);t.push(o),r&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t0===t)for(let t=0,i=e.length;t=a&&d>=a||(u>=a?(h+=Math.round(A*((a-u)/f)),u=a):d>=a&&(p=h+Math.round(A*((a-u)/f)),d=a),h>=a&&p>=a||(h>=a?(u+=Math.round(f*((a-h)/A)),h=a):p>=a&&(d=u+Math.round(f*((a-h)/A)),p=a),l&&u===l[l.length-1][0]&&h===l[l.length-1][1]||(l=[[u,h]],o.push(l)),l.push([d,p])))))}}var C,S,E,M={exports:{}},I=function(){if(E)return M.exports;E=1;var t=e.eg(),i=function(){if(S)return C;S=1;var t=e.ee(),i=e.ef().VectorTileFeature;function r(e,t){this.options=t||{},this.features=e,this.length=e.length}function n(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}return C=r,r.prototype.feature=function(e){return new n(this.features[e],this.options.extent)},n.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var i=0;i>31}function c(e,t){for(var i=e.loadGeometry(),r=e.type,n=0,o=0,s=i.length,c=0;ce},F=Math.fround||(k=new Float32Array(1),e=>(k[0]=+e,k[0]));var k;const z=3,R=5,D=6;class O{constructor(e){this.options=Object.assign(Object.create(L),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let t=0;t=i;e--){const i=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){const e=this.getClusters([i,r,180,o],t),s=this.getClusters([-180,r,n,o],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(Q(i),j(o),Q(n),j(r)),l=s.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+R]>1?U(l,t,this.clusterProps):this.points[l[t+z]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(t*this.stride>=o.length)throw new Error(r);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=n.within(o[t*this.stride],o[t*this.stride+1],s),l=[];for(const t of a){const i=t*this.stride;o[i+4]===e&&l.push(o[i+R]>1?U(o,i,this.clusterProps):this.points[o[i+z]])}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,i){const r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){const r=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/n,c=(i+1+a)/n,u={features:[]};return this._addTileFeatures(r.range((t-a)/n,l,(t+1+a)/n,c),r.data,t,i,n,u),0===t&&this._addTileFeatures(r.range(1-a/n,l,1,c),r.data,n,i,n,u),t===n-1&&this._addTileFeatures(r.range(0,l,a/n,c),r.data,-1,i,n,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,r,n){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?n+o.point_count<=r?n+=o.point_count:n=this._appendLeaves(e,o.cluster_id,i,r,n):n1;let l,c,u;if(a)l=N(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+z]];l=i.properties;const[r,n]=i.geometry.coordinates;c=Q(r),u=j(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(u*n-r))]],tags:l};let d;d=a||this.options.generateId?t[e+z]:this.points[t[e+z]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:r,reduce:n,minPoints:o}=this.options,s=i/(r*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let i=0;it&&(p+=a[i+R])}if(p>d&&p>=o){let e,o=r*d,s=u*d,f=-1;const A=(i/c<<5)+(t+1)+this.points.length;for(const r of h){const l=r*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+R];o+=a[l]*u,s+=a[l+1]*u,a[l+4]=A,n&&(e||(e=this._map(a,i,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(a,l)))}a[i+4]=A,l.push(o/p,s/p,1/0,A,-1,p),n&&l.push(f)}else{for(let e=0;e1)for(const e of h){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+R]>1){const r=this.clusterProps[e[t+D]];return i?Object.assign({},r):r}const r=this.points[e[t+z]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function U(e,t,i){return{type:"Feature",id:e[t+z],properties:N(e,t,i),geometry:{type:"Point",coordinates:[(r=e[t],360*(r-.5)),V(e[t+1])]}};var r}function N(e,t,i){const r=e[t+R],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+D],s=-1===o?{}:Object.assign({},i[o]);return Object.assign(s,{cluster:!0,cluster_id:e[t+z],point_count:r,point_count_abbreviated:n})}function Q(e){return e/360+.5}function j(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function V(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function H(e,t,i,r){let n=r;const o=t+(i-t>>1);let s,a=i-t;const l=e[t],c=e[t+1],u=e[i],h=e[i+1];for(let r=t+3;rn)s=r,n=t;else if(t===n){const e=Math.abs(r-o);er&&(s-t>3&&H(e,t,s,r),e[s+2]=n,i-s>3&&H(e,s,i,r))}function G(e,t,i,r,n,o){let s=n-i,a=o-r;if(0!==s||0!==a){const l=((e-i)*s+(t-r)*a)/(s*s+a*a);l>1?(i=n,r=o):l>0&&(i+=s*l,r+=a*l)}return s=e-i,a=t-r,s*s+a*a}function $(e,t,i,r){const n={id:e??null,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)Z(n,i);else if("Polygon"===t)Z(n,i[0]);else if("MultiLineString"===t)for(const e of i)Z(n,e);else if("MultiPolygon"===t)for(const e of i)Z(n,e[0]);return n}function Z(e,t){for(let i=0;i0&&(s+=r?(n*l-a*o)/2:Math.sqrt(Math.pow(a-n,2)+Math.pow(l-o,2))),n=a,o=l}const a=t.length-3;t[2]=1,H(t,0,a,i),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function X(e,t,i,r){for(let n=0;n1?1:i}function ee(e,t,i,r,n,o,s,a){if(r/=t,o>=(i/=t)&&s=r)return null;const l=[];for(const t of e){const e=t.geometry;let o=t.type;const s=0===n?t.minX:t.minY,c=0===n?t.maxX:t.maxY;if(s>=i&&c=r)continue;let u=[];if("Point"===o||"MultiPoint"===o)te(e,u,i,r,n);else if("LineString"===o)ie(e,u,i,r,n,!1,a.lineMetrics);else if("MultiLineString"===o)ne(e,u,i,r,n,!1);else if("Polygon"===o)ne(e,u,i,r,n,!0);else if("MultiPolygon"===o)for(const t of e){const e=[];ne(t,e,i,r,n,!0),e.length&&u.push(e)}if(u.length){if(a.lineMetrics&&"LineString"===o){for(const e of u)l.push($(t.id,o,e,t.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===u.length?(o="LineString",u=u[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===u.length?"Point":"MultiPoint"),l.push($(t.id,o,u,t.tags))}}return l.length?l:null}function te(e,t,i,r,n){for(let o=0;o=i&&s<=r&&oe(t,e[o],e[o+1],e[o+2])}}function ie(e,t,i,r,n,o,s){let a=re(e);const l=0===n?se:ae;let c,u,h=e.start;for(let d=0;di&&(u=l(a,p,f,m,g,i),s&&(a.start=h+c*u)):_>r?y=i&&(u=l(a,p,f,m,g,i),v=!0),y>r&&_<=r&&(u=l(a,p,f,m,g,r),v=!0),!o&&v&&(s&&(a.end=h+c*u),t.push(a),a=re(e)),s&&(h+=c)}let d=e.length-3;const p=e[d],f=e[d+1],A=0===n?p:f;A>=i&&A<=r&&oe(a,p,f,e[d+2]),d=a.length-3,o&&d>=3&&(a[d]!==a[0]||a[d+1]!==a[1])&&oe(a,a[0],a[1],a[2]),a.length&&t.push(a)}function re(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ne(e,t,i,r,n,o){for(const s of e)ie(s,t,i,r,n,o,!1)}function oe(e,t,i,r){e.push(t,i,r)}function se(e,t,i,r,n,o){const s=(o-t)/(r-t);return oe(e,o,i+(n-i)*s,1),s}function ae(e,t,i,r,n,o){const s=(o-i)/(n-i);return oe(e,t+(r-t)*s,o,1),s}function le(e,t){const i=[];for(let r=0;r0&&t.size<(n?s:r))return void(i.numPoints+=t.length/3);const a=[];for(let e=0;es)&&(i.numSimplified++,a.push(t[e],t[e+1])),i.numPoints++;n&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t0===t)for(let t=0,i=e.length;t24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let r=0;r1&&console.time("creation"),d=this.tiles[h]=de(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==n){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(i!==o>>e||r!==s>>e)continue}}if(d.source=null,0===e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,A=.5+p,m=1+p;let g=null,_=null,y=null,v=null,x=ee(e,u,i-p,i+A,0,d.minX,d.maxX,l),b=ee(e,u,i+f,i+m,0,d.minX,d.maxX,l);e=null,x&&(g=ee(x,u,r-p,r+A,1,d.minY,d.maxY,l),_=ee(x,u,r+f,r+m,1,d.minY,d.maxY,l),x=null),b&&(y=ee(b,u,r-p,r+A,1,d.minY,d.maxY,l),v=ee(b,u,r+f,r+m,1,d.minY,d.maxY,l),b=null),c>1&&console.timeEnd("clipping"),a.push(g||[],t+1,2*i,2*r),a.push(_||[],t+1,2*i,2*r+1),a.push(y||[],t+1,2*i+1,2*r),a.push(v||[],t+1,2*i+1,2*r+1)}}getTile(e,t,i){e=+e,t=+t,i=+i;const r=this.options,{extent:n,debug:o}=r;if(e<0||e>24)return null;const s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);let l,c=e,u=t,h=i;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[ge(c,u,h)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,u,h),console.time("drilling down")),this.splitTile(l.source,c,u,h,e,t,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?ue(this.tiles[a],n):null):null}}function ge(e,t,i){return 32*((1<{if(s||!a)return r(s);if("object"!=typeof a)return r(new Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));{try{if(i.filter){const t=e.X(i.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(", "));a.features=a.features.filter((e=>t.value.evaluate({zoom:0},e)))}i.dynamic?("Feature"===a.type&&(a={type:"FeatureCollection",features:[a]}),i.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(a.features,this.loaded),i.cluster&&(a.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=i.cluster?new O(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;const r={},n={},o={accumulated:null,zoom:0},s={properties:null},a=Object.keys(i);for(const t of a){const[o,s]=i[t],a=e.X(s),l=e.X("string"==typeof o?[o,["accumulated"],["get",t]]:o);r[t]=a.value,n[t]=l.value}return t.map=e=>{s.properties=e;const t={};for(const e of a)t[e]=r[e].evaluate(o,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)o.accumulated=e[t],e[t]=n[t].evaluate(o,s)},t}(i)).load(a.features):i.dynamic?this._dynamicIndex:function(e,t){return new me(e,t)}(a,i.geojsonVtOptions)}catch(e){return r(e)}const s={};if(o){const e=t(n);e&&(s.resourceTiming={},s.resourceTiming[i.source]=JSON.parse(JSON.stringify(e)))}r(null,s)}}))}reloadTile(e,t){const i=this.loaded;return i&&i[e.uid]?e.partial?t(null,void 0):super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,i){if(t.request)e.n(t.request,i);else{if("string"!=typeof t.data)return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return i(null,JSON.parse(t.data))}catch(e){return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class ve{constructor(t,i){this.tileID=new e.aH(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=t.projection,this.brightness=i}parse(t,i,r,n){this.status="parsing";const o=new e.aH(r.tileID.overscaledZ,r.tileID.wrap,r.tileID.canonical.z,r.tileID.canonical.x,r.tileID.canonical.y),s=[],a=i.familiesBySource[r.source],l=new e.e0(o,r.promoteId);return l.bucketLayerIDs=[],l.is3DTile=!0,e.ei(t).then((t=>{if(!t)return n(new Error("Could not parse tile"));const i=e.ej(t,1/e.cd(r.tileID.canonical)),c=t.json.extensionsUsed&&t.json.extensionsUsed.includes("MAPBOX_mesh_features")||t.json.asset.extras&&t.json.asset.extras.MAPBOX_mesh_features,u=t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression"),h=new e.aa(this.zoom,{brightness:this.brightness});for(const t in a)for(const r of a[t]){const t=r[0];l.bucketLayerIDs.push(r.map((t=>e.C(t.id,t.scope)))),t.recalculate(h,[]);const n=new e.ek(r,i,o,c,u,this.brightness,l);c||(n.needsUpload=!0),s.push(n),n.evaluate(t)}this.status="done",n(null,{buckets:s,featureIndex:l,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})})).catch((e=>n(new Error(e.message))))}}class xe{constructor(e,t,i,r,n,o){this.actor=e,this.layerIndex=t,this.availableImages=i,this.brightness=o,this.loading={},this.loaded={}}loadTile(t,i){const r=t.uid,n=this.loading[r]=new ve(t,this.brightness);e.bj(t.request,((e,o)=>{const s=!this.loading[r];return delete this.loading[r],s||e?(n.status="done",s||(this.loaded[r]=n),i(e)):o&&0!==o.byteLength?void n.parse(o,this.layerIndex,t,((e,t)=>{n.status="done",this.loaded=this.loaded||{},this.loaded[r]=n,e||!t?i(e):i(null,t)})):(n.status="done",this.loaded[r]=n,i())}))}reloadTile(e,t){const i=this.loaded,r=e.uid;if(i&&i[r]){const n=i[r];n.projection=e.projection,n.brightness=e.brightness;const o=(i,r)=>{n.reloadCallback&&(delete n.reloadCallback,this.loadTile(e,t)),t(i,r)};"parsing"===n.status?n.reloadCallback=o:"done"===n.status&&this.loadTile(e,t)}}abortTile(e,t){const i=e.uid;this.loading[i]&&delete this.loading[i],t()}removeTile(e,t){const i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t()}}class be{constructor(t){this.self=t,this.actor=new e.el(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.imageRasterizer=new e.y,this.projections={},this.defaultProjection=e.bP({name:"mercator"}),this.workerSourceTypes={vector:c,geojson:ye,"raster-dem":u,"raster-array":d,"batched-model":xe},this.workerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.em.isParsed())throw new Error("RTL text plugin already registered.");e.em.applyArabicShaping=t.applyArabicShaping,e.em.processBidirectionalText=t.processBidirectionalText,e.em.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(e,t,i){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],i()}checkIfReady(e,t,i){i()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,{scope:i,isLoaded:r}){if(this.isSpriteLoaded[t]||(this.isSpriteLoaded[t]={}),this.isSpriteLoaded[t][i]=r,this.workerSources[t]&&this.workerSources[t][i])for(const n in this.workerSources[t][i]){const o=this.workerSources[t][i][n];for(const t in o){const i=o[t];i instanceof c&&(i.isSpriteLoaded=r,i.fire(new e.A("isSpriteLoaded")))}}}setImages(e,{scope:t,images:i},r){if(this.availableImages[e]||(this.availableImages[e]={}),this.availableImages[e][t]=i,this.workerSources[e]&&this.workerSources[e][t]){for(const r in this.workerSources[e][t]){const n=this.workerSources[e][t][r];for(const e in n)n[e].availableImages=i}r()}else r()}setProjection(t,i){this.projections[t]=e.bP(i)}setBrightness(e,t,i){this.brightness=t,i()}setLayers(e,t,i){this.getLayerIndex(e,t.scope).replace(t.layers,t.options),i()}updateLayers(e,t,i){this.getLayerIndex(e,t.scope).update(t.layers,t.removedIds,t.options),i()}loadTile(e,t,i){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).loadTile(t,i)}decodeRasterArray(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).decodeRasterArray(t,i)}reloadTile(e,t,i){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).reloadTile(t,i)}abortTile(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).abortTile(t,i)}removeTile(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).removeTile(t,i)}removeSource(e,t,i){if(!(this.workerSources[e]&&this.workerSources[e][t.scope]&&this.workerSources[e][t.scope][t.type]&&this.workerSources[e][t.scope][t.type][t.source]))return;const r=this.workerSources[e][t.scope][t.type][t.source];delete this.workerSources[e][t.scope][t.type][t.source],void 0!==r.removeSource?r.removeSource(t,i):i()}loadWorkerSource(e,t,i){try{this.self.importScripts(t.url),i()}catch(e){i(e.toString())}}syncRTLPluginState(t,i,r){try{e.em.setState(i);const t=e.em.getPluginURL();if(e.em.isLoaded()&&!e.em.isParsed()&&null!=t){this.self.importScripts(t);const i=e.em.isParsed();r(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),i)}}catch(e){r(e.toString())}}setDracoUrl(e,t){this.dracoUrl=t}getAvailableImages(e,t){this.availableImages[e]||(this.availableImages[e]={});let i=this.availableImages[e][t];return i||(i=[]),i}getLayerIndex(e,t){this.layerIndexes[e]||(this.layerIndexes[e]={});let i=this.layerIndexes[e][t];return i||(i=this.layerIndexes[e][t]=new n,i.scope=t),i}getWorkerSource(e,t,i,r){const n=this.workerSources;return n[e]||(n[e]={}),n[e][r]||(n[e][r]={}),n[e][r][t]||(n[e][r][t]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),n[e][r][t][i]||(n[e][r][t][i]=new this.workerSourceTypes[t]({send:(t,i,r,n,o,s)=>{this.actor.send(t,i,r,e,o,s)},scheduler:this.actor.scheduler},this.getLayerIndex(e,r),this.getAvailableImages(e,r),this.isSpriteLoaded[e][r],void 0,this.brightness)),n[e][r][t][i]}rasterizeImages(e,t,i){const r=new Map;for(const[i,{image:n,imageVariant:o}]of t.tasks.entries()){const s=this.imageRasterizer.rasterize(o,n,t.scope,e);r.set(i,s)}i(void 0,r)}removeRasterizedImages(e,t,i){this.imageRasterizer.removeImagesFromCacheByIds(t.imageIds,t.scope,e),i()}enforceCacheSizeLimit(t,i){e.en(i)}getWorkerPerformanceMetrics(e,t,i){i(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new be(self)),be})),r(["./shared"],(function(e){var t="3.11.1";const i={create:"create",load:"load",fullLoad:"fullLoad"},r={mark(e){performance.mark(e)},measure(e,t,i){performance.measure(e,t,i)}};function n(t){const i=t.name.split("?")[0];return e.a(i)&&i.includes("mapbox-gl.js")?"javascript":e.a(i)&&i.includes("mapbox-gl.css")?"css":e.b(i)?"fontRange":e.c(i)?"sprite":e.i(i)?"style":e.d(i)?"tilejson":"other"}var o,s={},a=function(){if(o)return s;function e(e){return!t(e)}function t(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,i=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(i);try{t=new Worker(r),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(r),e}()?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var i=t.getImageData(0,0,1,1);return i&&i.width===e.width}()?(void 0===i[r=t&&t.failIfMajorPerformanceCaveat]&&(i[r]=function(t){var i,r=function(t){var i=document.createElement("canvas"),r=Object.create(e.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,i.getContext("webgl2",r)}(t);if(!r)return!1;try{i=r.createShader(r.VERTEX_SHADER)}catch(e){return!1}return!(!i||r.isContextLost())&&(r.shaderSource(i,"void main() {}"),r.compileShader(i),!0===r.getShaderParameter(i,r.COMPILE_STATUS))}(r)),i[r]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var r}o=1,s.supported=e,s.notSupportedReason=t;var i={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},s}();function l(e,t,i){const r=document.createElement(e);return null!=t&&(r.className=t),i&&i.appendChild(r),r}function c(e,t,i){const r=document.createElementNS("http://www.w3.org/2000/svg",e);for(const e of Object.keys(t))r.setAttributeNS(null,e,String(t[e]));return i&&i.appendChild(r),r}const u="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,h=u&&void 0!==u.userSelect?"userSelect":"WebkitUserSelect";let d;function p(){u&&h&&(d=u[h],u[h]="none")}function f(){u&&h&&(u[h]=d)}function A(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",A,!0)}function m(){window.addEventListener("click",A,!0),window.setTimeout((()=>{window.removeEventListener("click",A,!0)}),0)}function g(e,t){const i=e.getBoundingClientRect();return v(e,i,t)}function _(e,t){const i=e.getBoundingClientRect(),r=[];for(let n=0;nthis._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(i,r){if(!e.f(i))return i;const n=B(i);return n.params.push(`sdk=js-${t}`),n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeGlyphsURL(t,i){if(!e.f(t))return t;const r=B(t);return r.path=`/fonts/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeModelURL(t,i){if(!e.f(t))return t;const r=B(t);return r.path=`/models/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeSourceURL(t,i,r,n){if(!e.f(t))return t;const o=B(t);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),r&&o.params.push(`language=${r}`),n&&o.params.push(`worldview=${n}`),this._makeAPIURL(o,this._customAccessToken||i)}normalizeIconsetURL(t,i){const r=B(t);return e.f(t)?(r.path=`/styles/v1${r.path}/iconset.pbf`,this._makeAPIURL(r,this._customAccessToken||i)):C(r)}normalizeSpriteURL(t,i,r,n){const o=B(t);return e.f(t)?(o.path=`/styles/v1${o.path}/sprite${i}${r}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${i}${r}`,C(o))}normalizeTileURL(t,i,r){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!e.f(t))return t;const n=B(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${i||r&&"raster"!==n.authority&&512===r?"@2x":""}${e.m.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${e.e.RASTER_URL_PREFIX}${n.path}`:"rasterarrays"===n.authority?n.path=`/${e.e.RASTERARRAYS_URL_PREFIX}${n.path}`:"3dtiles"===n.authority?n.path=`/${e.e.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${e.e.TILE_URL_VERSION}${n.path}`);const o=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||e.e.ACCESS_TOKEN;return e.e.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,o)}canonicalizeTileURL(t,i){const r=B(t);if(!r.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!r.path.match(/\.[\w]+$/))return t;let n="mapbox://";r.path.match(/^\/raster\/v1\//)?n+=`raster/${r.path.replace(`/${e.e.RASTER_URL_PREFIX}/`,"")}`:r.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${r.path.replace(`/${e.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${r.path.replace(`/${e.e.TILE_URL_VERSION}/`,"")}`;let o=r.params;return i&&(o=o.filter((e=>!e.match(/^access_token=/)))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(t,i){const r=!!i&&e.f(i),n=[];for(const i of t.tiles||[])e.h(i)?n.push(this.canonicalizeTileURL(i,r)):n.push(i);return n}_makeAPIURL(t,i){const r="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=B(e.e.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,"http"===t.protocol){const e=t.params.indexOf("secure");e>=0&&t.params.splice(e,1)}if("/"!==n.path&&(t.path=`${n.path}${t.path}`),!e.e.REQUIRE_ACCESS_TOKEN)return C(t);if(i=i||e.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!i)throw new Error(`An API access token is required to use Mapbox GL. ${r}`);if("s"===i[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${r}`)}return t.params=t.params.filter((e=>-1===e.indexOf("access_token"))),t.params.push(`access_token=${i||""}`),C(t)}}const T=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function B(e){const t=e.match(T);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function C(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const S="mapbox.eventData";function E(t){if(!t)return null;const i=t.split(".");if(!i||3!==i.length)return null;try{return JSON.parse(e.j(i[1]))}catch(e){return null}}class M{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const i=E(e.e.ACCESS_TOKEN);let r="";return r=i&&i.u?e.k(i.u):e.e.ACCESS_TOKEN||"",t?`${S}.${t}:${r}`:`${S}:${r}`}fetchEventData(){const t=e.s("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{const e=localStorage.getItem(i);e&&(this.eventData=JSON.parse(e));const t=localStorage.getItem(r);t&&(this.anonId=t)}catch(t){e.w("Unable to read from LocalStorage")}}saveEventData(){const t=e.s("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid"),n=this.anonId;if(t&&n)try{localStorage.setItem(r,n),Object.keys(this.eventData).length>=1&&localStorage.setItem(i,JSON.stringify(this.eventData))}catch(t){e.w("Unable to write to LocalStorage")}}processRequests(e){}postEvent(t,i,r,n){if(!e.e.EVENTS_URL)return;const o=B(e.e.EVENTS_URL);o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(t).toISOString()},a=i?e.l(s,i):s,l={url:C(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=e.p(l,(e=>{this.pendingRequest=null,r(e),this.saveEventData(),this.processRequests(n)}))}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}const I=new class extends M{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(t,i){e.e.EVENTS_URL&&e.e.ACCESS_TOKEN&&Array.isArray(t)&&t.some((t=>e.f(t)||e.h(t)))&&this.queueRequest(Date.now(),i)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const r=E(e.e.ACCESS_TOKEN),n=r?r.u:e.e.ACCESS_TOKEN;let o=n!==this.eventData.tokenU;e.v(this.anonId)||(this.anonId=e.u(),o=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(s),i=(s-this.eventData.lastSuccess)/864e5;o=o||i>=1||i<-1||e.getDate()!==t.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:x,"enabled.telemetry":!1,userId:this.anonId},(e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)}),i):this.processRequests()}},P=I.postTurnstileEvent.bind(I),L=new class extends M{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,i,r,n){this.skuToken=i,this.errorCb=n,e.e.EVENTS_URL&&(r||e.e.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(b)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;const{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),e.v(this.anonId)||(this.anonId=e.u()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:x,skuToken:this.skuToken,userId:this.anonId},(e=>{e?this.errorCb(e):r&&(this.success[r]=!0)}),i))}remove(){this.errorCb=null}},F=L.postMapLoadEvent.bind(L),k=new class extends M{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(t){let i=this.mapInstanceIdMap.get(t);return i||(i=e.u(),this.mapInstanceIdMap.set(t,i)),i}getEventId(e){const t=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,t+1),t}postStyleLoadEvent(t,i){const{map:r,style:n,importedStyles:o}=i;if(!e.e.EVENTS_URL||!t&&!e.e.ACCESS_TOKEN)return;const s=this.getMapInstanceId(r),a={mapInstanceId:s,eventId:this.getEventId(s),style:n};o.length&&(a.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:a},t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:t,payload:i}=this.queue.shift();this.postEvent(t,i,(()=>{}),e)}},z=k.postStyleLoadEvent.bind(k),R=new class extends M{constructor(){super("gljs.performance")}postPerformanceEvent(t,i){e.e.EVENTS_URL&&(t||e.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:i},t)}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:o,performanceData:s}=this.queue.shift(),a=function(r){const o=performance.getEntriesByType("resource"),s=performance.getEntriesByType("mark"),a=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const r of e[i]){const e=`${i}ResolveRangeMin`,n=`${i}ResolveRangeMax`,o=`${i}RequestCount`,s=`${i}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,r.startTime),t[n]=Math.max(t[n]||-1/0,r.responseEnd);const a=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==r.transferSize&&0===r.transferSize&&a(s),a(o)}return t}(function(e,t){const i={};if(e)for(const r of e){const e=t(r);void 0===i[e]&&(i[e]=[]),i[e].push(r)}return i}(o,n)),l=window.devicePixelRatio,c=navigator.connection||navigator.mozConnection||navigator.webkitConnection,u=c?c.effectiveType:void 0,h={counters:[],metadata:[],attributes:[]},d=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const e in a)d(h.counters,e,a[e]);if(r.interactionRange[0]!==1/0&&r.interactionRange[1]!==-1/0&&(d(h.counters,"interactionRangeMin",r.interactionRange[0]),d(h.counters,"interactionRangeMax",r.interactionRange[1])),s)for(const e of Object.keys(i)){const t=i[e],r=s.find((e=>e.name===t));r&&d(h.counters,t,r.startTime)}return d(h.counters,"visibilityHidden",r.visibilityHidden),d(h.attributes,"style",function(t){if(t)for(const i of t){const t=i.name.split("?")[0];if(e.i(t)){const e=t.split("/").slice(-2);if(2===e.length)return`mapbox://styles/${e[0]}/${e[1]}`}}}(o)),d(h.attributes,"terrainEnabled",r.terrainEnabled?"true":"false"),d(h.attributes,"fogEnabled",r.fogEnabled?"true":"false"),d(h.attributes,"projection",r.projection),d(h.attributes,"zoom",r.zoom),d(h.metadata,"devicePixelRatio",l),d(h.metadata,"connectionEffectiveType",u),d(h.metadata,"navigatorUserAgent",navigator.userAgent),d(h.metadata,"screenWidth",window.screen.width),d(h.metadata,"screenHeight",window.screen.height),d(h.metadata,"windowWidth",window.innerWidth),d(h.metadata,"windowHeight",window.innerHeight),d(h.metadata,"mapWidth",r.width/l),d(h.metadata,"mapHeight",r.height/l),d(h.metadata,"webglRenderer",r.renderer),d(h.metadata,"webglVendor",r.vendor),d(h.metadata,"sdkVersion",t),d(h.metadata,"sdkIdentifier","mapbox-gl-js"),h}(s);for(const e of a.metadata);for(const e of a.counters);for(const e of a.attributes);this.postEvent(o,a,(()=>{}),r)}},D=R.postPerformanceEvent.bind(R),O=new class extends M{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,i,r,n){if(!e.e.API_URL||!e.e.SESSION_PATH)return;const o=B(e.e.API_URL+e.e.SESSION_PATH);o.params.push(`sku=${i||""}`),o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);const s={url:C(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=e.g(s,(e=>{this.pendingRequest=null,r(e),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(t,i,r,n){this.skuToken=i,this.errorCb=n,e.e.SESSION_PATH&&e.e.API_URL&&(r||e.e.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(b)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();t&&this.success[t]||this.getSession(i,this.skuToken,(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e)}remove(){this.errorCb=null}},U=O.getSessionAPI.bind(O),N=new Set;function Q(e,t){t?N.add(e):N.delete(e)}class j{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,t){this._updatedSourceCaches[e]=t,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){const t=e.scope;this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._updatedLayers[t].add(e.id),this.setDirty()}removeLayer(e){const t=e.scope;this._removedLayers[t]=this._removedLayers[t]||{},this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._removedLayers[t][e.id]=e,this._updatedLayers[t].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){const e={};for(const t in this._updatedLayers)e[t]=e[t]||{},e[t].updatedIds=Array.from(this._updatedLayers[t].values());for(const t in this._removedLayers)e[t]=e[t]||{},e[t].removedIds=Object.keys(this._removedLayers[t]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(e){return this._updatedImages[e]?Array.from(this._updatedImages[e].values()):[]}updateImage(t,i){this._updatedImages[i]=this._updatedImages[i]||new Set,this._updatedImages[i].add(e.I.toString(t)),this.setDirty()}resetUpdatedImages(e){this._updatedImages[e]&&this._updatedImages[e].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function V(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class H extends e.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,"raster"!==t&&e.t()&&(this.imageRasterizerDispatcher=new e.D(e.x(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new e.r({width:1,height:1}))}removeScope(e){this.loaded.delete(e),this.imageProviders.delete(e),this.images.delete(e),this.updatedImages.delete(e),this.callbackDispatchedThisFrame.delete(e),this.patterns.delete(e),this.atlasImage.delete(e);const t=this.atlasTexture.get(e);t&&(t.destroy(),this.atlasTexture.delete(e))}addImageProvider(e,t){this.imageProviders.has(t)||this.imageProviders.set(t,new Map),this.imageProviders.get(t).set(e.id,e)}removeImageProvider(e,t){this.imageProviders.has(t)&&this.imageProviders.get(t).delete(e)}getPendingImageProviders(){const e=[];for(const t of this.imageProviders.values())for(const i of t.values())i.hasPendingRequests()&&e.push(i);return e}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new e.y),this._imageRasterizer}isLoaded(){for(const e of this.loaded.keys())if(!this.loaded.get(e))return!1;return!0}setLoaded(e,t){if(this.loaded.get(t)!==e&&(this.loaded.set(t,e),e)){for(const{ids:e,callback:i}of this.requestors)this._notify(e,t,i);this.requestors=[]}}hasImage(e,t){return!!this.getImage(e,t)}getImage(e,t){return this.images.get(t).get(e.toString())}addImage(e,t,i){this._validate(e,i)&&this.images.get(t).set(e.toString(),i)}_validate(t,i){let r=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new e.z(new Error(`Image "${t.name}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let i=0;for(const r of e){if(r[0]e.I.from(t)))}getImages(e,t,i){const r=[],n=[],o=this.imageProviders.get(t);for(const i of e){if(!i.iconsetId){r.push(i);continue}const e=o.get(i.iconsetId);e&&(this.getImage(i,t)?n.push(i):e.addPendingRequest(i))}if(0===r.length)return void this._notify(n,t,i);let s=!0;const a=!!this.loaded.get(t),l=this.images.get(t);if(!a)for(const e of r)l.has(e.toString())||(s=!1);a||s?this._notify(r,t,i):this.requestors.push({ids:r,scope:t,callback:i})}rasterizeImages({scope:e,tasks:t},i){const r=new Map;for(const[i,n]of t.entries()){const t=this.getImage(n.id,e);t&&r.set(i,{image:t,imageVariant:n})}this._rasterizeImages(e,r,i)}_rasterizeImages(t,i,r){if(e.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImages",{tasks:i,scope:t},r);else{const e=new Map;for(const[r,{image:n,imageVariant:o}]of i.entries())e.set(r,this.imageRasterizer.rasterize(o,n,t,0));r(void 0,e)}}getUpdatedImages(e){return this.updatedImages.get(e)||new Set}_notify(t,i,r){const n=this.images.get(i),o=new Map;for(const i of t){const t=n.get(i.toString());if(!t){if(i.iconsetId)continue;e.w(`Image "${i.name}" 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.`),this.fire(new e.A("styleimagemissing",{id:i.name}));continue}const r={data:t.usvg?null:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,usvg:t.usvg,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)};t.usvg&&Object.assign(r,{width:t.icon.usvg_tree.width,height:t.icon.usvg_tree.height}),o.set(e.I.toString(i),r)}r(null,o)}getPixelSize(e){const{width:t,height:i}=this.atlasImage.get(e);return{width:t,height:i}}getPattern(t,i,r){const n=t.toString(),o=this.patterns.get(i),s=o.get(n),a=this.getImage(t,i);if(!a)return null;if(s){if(s.position.version===a.version)return s.position;s.position.version=a.version}else{if(a.usvg&&!a.data){const o=this.getPatternInFlightId(n,i);if(this.patternsInFlight.has(o))return null;this.patternsInFlight.add(o);const s=new e.B(t).scaleSelf(e.q.devicePixelRatio),l=new Map([[s.toString(),{image:a,imageVariant:s}]]);return this._rasterizeImages(i,l,((e,t)=>this.storePatternImage(s,i,a,r,t))),null}this.storePattern(t,i,a)}return this._updatePatternAtlas(i,r),o.get(n).position}getPatternInFlightId(t,i){return e.C(t,i)}hasPatternsInFlight(){return 0!==this.patternsInFlight.size}storePatternImage(e,t,i,r,n){const o=e.toString(),s=n?n.get(o):void 0;s&&(i.data=s,this.storePattern(e.id,t,i),this._updatePatternAtlas(t,r),this.patternsInFlight.delete(this.getPatternInFlightId(e.id.toString(),t)))}storePattern(t,i,r){const n={w:r.data.width+2*e.F,h:r.data.height+2*e.F,x:0,y:0},o=new e.G(n,r,e.F);this.patterns.get(i).set(t.toString(),{bin:n,position:o})}bind(t,i){const r=t.gl;let n=this.atlasTexture.get(i);n?this.dirty&&(n.update(this.atlasImage.get(i)),this.dirty=!1):(n=new e.T(t,this.atlasImage.get(i),r.RGBA8),this.atlasTexture.set(i,n)),n.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(t,i){const r=this.patterns.get(t),n=Array.from(r.values()).map((({bin:e})=>e)),{w:o,h:s}=e.H(n),a=this.atlasImage.get(t);a.resize({width:o||1,height:s||1});const l=this.images.get(t);for(const[t,{bin:n,position:o}]of r.entries()){let r=o.padding;const s=n.x+r,c=n.y+r,u=l.get(t).data,h=u.width,d=u.height;r=r>1?r-1:r,e.r.copy(u,a,{x:0,y:0},{x:s,y:c},{width:h,height:d},i),e.r.copy(u,a,{x:0,y:d-r},{x:s,y:c-r},{width:h,height:r},i),e.r.copy(u,a,{x:0,y:0},{x:s,y:c+d},{width:h,height:r},i),e.r.copy(u,a,{x:h-r,y:0},{x:s-r,y:c},{width:r,height:d},i),e.r.copy(u,a,{x:0,y:0},{x:s+h,y:c},{width:r,height:d},i),e.r.copy(u,a,{x:h-r,y:d-r},{x:s-r,y:c-r},{width:r,height:r},i),e.r.copy(u,a,{x:0,y:d-r},{x:s+h,y:c-r},{width:r,height:r},i),e.r.copy(u,a,{x:0,y:0},{x:s+h,y:c+d},{width:r,height:r},i),e.r.copy(u,a,{x:h-r,y:0},{x:s-r,y:c+d},{width:r,height:r},i)}this.dirty=!0}beginFrame(){for(const e of this.images.keys())this.callbackDispatchedThisFrame.set(e,new Set)}dispatchRenderCallbacks(e,t){const i=this.images.get(t);for(const r of e){if(this.callbackDispatchedThisFrame.get(t).has(r.toString()))continue;this.callbackDispatchedThisFrame.get(t).add(r.toString());const e=i.get(r.toString());V(e)&&this.updateImage(r,t,e)}}}function G(t){const i=t.key,r=t.value,n=t.valueSpec||{},o=t.objectElementValidators||{},s=t.style,a=t.styleSpec;let l=[];const c=e.K(r);if("object"!==c)return[new e.V(i,r,`object expected, ${c} found`)];for(const t in r){const c=t.split(".")[0];let u;o[c]?u=o[c]:n[c]?u=pe:o["*"]?u=o["*"]:n["*"]&&(u=pe),u?l=l.concat(u({key:(i?`${i}.`:i)+t,value:r[t],valueSpec:n[c]||n["*"],style:s,styleSpec:a,object:r,objectKey:t},r)):l.push(new e.J(i,r[t],`unknown property "${t}"`))}for(const t in n)o[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&l.push(new e.V(i,r,`missing required property "${t}"`));return l}function $(t){const i=t.value,r=t.valueSpec,n=t.style,o=t.styleSpec,s=t.key,a=t.arrayElementValidator||pe;if("array"!==e.K(i))return[new e.V(s,i,`array expected, ${e.K(i)} found`)];if(r.length&&i.length!==r.length)return[new e.V(s,i,`array length ${r.length} expected, length ${i.length} found`)];if(r["min-length"]&&i.lengtho)return[new e.V(i,r,`${r} is greater than the maximum value ${o}`)]}return[]}function q(t){const i=t.valueSpec,r=e.M(t.value.type);let n,o,s,a={};const l="categorical"!==r&&void 0===t.value.property,c=!l,u="array"===e.K(t.value.stops)&&"array"===e.K(t.value.stops[0])&&"object"===e.K(t.value.stops[0][0]),h=G({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new e.V(t.key,t.value,'identity function may not have a "stops" property')];let i=[];const n=t.value;return i=i.concat($({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:d})),"array"===e.K(n)&&0===n.length&&i.push(new e.V(t.key,n,"array must have at least one stop")),i},default:function(e){return pe({key:e.key,value:e.value,valueSpec:i,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===r&&l&&h.push(new e.V(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||h.push(new e.V(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!e.N(t.valueSpec)&&h.push(new e.V(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(c&&!e.O(t.valueSpec)?h.push(new e.V(t.key,t.value,"property functions not supported")):l&&!e.Q(t.valueSpec)&&h.push(new e.V(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||h.push(new e.V(t.key,t.value,'"property" property is required')),h;function d(t){let r=[];const n=t.value,l=t.key;if("array"!==e.K(n))return[new e.V(l,n,`array expected, ${e.K(n)} found`)];if(2!==n.length)return[new e.V(l,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==e.K(n[0]))return[new e.V(l,n,`object expected, ${e.K(n[0])} found`)];if(void 0===n[0].zoom)return[new e.V(l,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new e.V(l,n,"object stop key must have value")];const i=e.M(n[0].zoom);if("number"!=typeof i)return[new e.V(l,n[0].zoom,"stop zoom values must be numbers")];if(s&&s>i)return[new e.V(l,n[0].zoom,"stop zoom values must appear in ascending order")];i!==s&&(s=i,o=void 0,a={}),r=r.concat(G({key:`${l}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Z,value:p}}))}else r=r.concat(p({key:`${l}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return e.S(e.U(n[1]))?r.concat([new e.V(`${l}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(pe({key:`${l}[1]`,value:n[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const l=e.K(t.value),c=e.M(t.value),u=null!==t.value?t.value:s;if(n){if(l!==n)return[new e.V(t.key,u,`${l} stop domain type must match previous stop domain type ${n}`)]}else n=l;if("number"!==l&&"string"!==l&&"boolean"!==l&&"number"!=typeof c&&"string"!=typeof c&&"boolean"!=typeof c)return[new e.V(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==l&&"categorical"!==r){let n=`number expected, ${l} found`;return e.O(i)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e.V(t.key,u,n)]}return"categorical"!==r||"number"!==l||"number"==typeof c&&isFinite(c)&&Math.floor(c)===c?"categorical"!==r&&"number"===l&&"number"==typeof c&&"number"==typeof o&&void 0!==o&&cnew e.V(`${t.key}${i.key}`,t.value,i.message)));const r=i.value.expression||i.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new e.V(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&&!e.Y(r))return[new e.V(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return W(r,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!e.Z(r,["zoom","feature-state"]))return[new e.V(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!e._(r))return[new e.V(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function W(t,i){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(i.valueSpec&&i.valueSpec.expression)for(const e of i.valueSpec.expression.parameters)r.delete(e);if(0===r.size)return[];const n=[];return t instanceof e.$&&r.has(t.name)?[new e.V(i.key,i.value,`["${t.name}"] expression is not supported in a filter for a ${i.object.type} layer with id: ${i.object.id}`)]:(t.eachChild((e=>{n.push(...W(e,i))})),n)}function X(t){const i=t.key,r=t.value,n=t.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(e.M(r))&&o.push(new e.V(i,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(e.M(r))&&o.push(new e.V(i,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),o}function Y(t){return e.a1(e.U(t.value))?K(e.L({},t,{expressionContext:"filter",valueSpec:t.styleSpec[`filter_${t.layerType||"fill"}`]})):J(t)}function J(t){const i=t.value,r=t.key;if("array"!==e.K(i))return[new e.V(r,i,`array expected, ${e.K(i)} found`)];const n=t.styleSpec;let o,s=[];if(i.length<1)return[new e.V(r,i,"filter array must have at least 1 element")];switch(s=s.concat(X({key:`${r}[0]`,value:i[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),e.M(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===e.M(i[1])&&s.push(new e.V(r,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":3!==i.length&&s.push(new e.V(r,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(o=e.K(i[1]),"string"!==o&&s.push(new e.V(`${r}[1]`,i[1],`string expected, ${o} found`)));for(let a=2;a{t in r&&i.push(new e.V(n,r[t],`"${t}" is prohibited for ref layers`))})),o.layers.forEach((i=>{e.M(i.id)===l&&(t=i)})),t?t.ref?i.push(new e.V(n,r.ref,"ref cannot reference another ref layer")):a=e.M(t.type):"string"==typeof l&&i.push(new e.V(n,r.ref,`ref layer "${l}" not found`))}else if("background"!==a&&"sky"!==a&&"slot"!==a)if(r.source){const t=o.sources&&o.sources[r.source],s=t&&e.M(t.type);t?"vector"===s&&"raster"===a?i.push(new e.V(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==a?i.push(new e.V(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?i.push(new e.V(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==s||["raster","raster-particle"].includes(a)?"line"!==a||!r.paint||!r.paint["line-gradient"]&&!r.paint["line-trim-offset"]||"geojson"===s&&t.lineMetrics?"raster-particle"===a&&"raster-array"!==s&&i.push(new e.V(n,r.source,`layer "${r.id}" requires a 'raster-array' source.`)):i.push(new e.V(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):i.push(new e.V(n,r.source,"raster-array source can only be used with layer type 'raster'.")):i.push(new e.V(n,r,`layer "${r.id}" must specify a "source-layer"`)):i.push(new e.V(n,r.source,`source "${r.source}" not found`))}else i.push(new e.V(n,r,'missing required property "source"'));return i=i.concat(G({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>pe({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:t=>Y(e.L({layerType:a},t)),layout:t=>G({layer:r,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>ie(e.L({layerType:a},t))}}),paint:t=>G({layer:r,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>te(e.L({layerType:a,layer:r},t))}})}})),i}function ne(t){const i=t.value,r=t.key,n=e.K(i);return"string"!==n?[new e.V(r,i,`string expected, ${n} found`)]:[]}const oe={promoteId:function t({key:i,value:r}){if("string"===e.K(r))return ne({key:i,value:r});if(Array.isArray(r)){const t=[],n=e.U(r),o=e.X(n);return"error"===o.result&&o.value.forEach((r=>{t.push(new e.V(`${i}${r.key}`,null,`${r.message}`))})),e.Z(o.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||t.push(new e.V(`${i}`,null,"promoteId expression should be only feature dependent")),t}{const e=[];for(const n in r)e.push(...t({key:`${i}.${n}`,value:r[n]}));return e}}};function se(t){const i=t.value,r=t.key,n=t.styleSpec,o=t.style;if(!i.type)return[new e.V(r,i,'"type" is required')];const s=e.M(i.type);let a=[];switch(["vector","raster","raster-dem","raster-array"].includes(s)&&(i.url||i.tiles||a.push(new e.J(r,i,'Either "url" or "tiles" is required.'))),s){case"vector":case"raster":case"raster-dem":case"raster-array":return a=a.concat(G({key:r,value:i,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:oe})),a;case"geojson":if(a=G({key:r,value:i,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:oe}),i.cluster)for(const e in i.clusterProperties){const[t,n]=i.clusterProperties[e],o="string"==typeof t?[t,["accumulated"],["get",e]]:t;a.push(...K({key:`${r}.${e}.map`,value:n,expressionContext:"cluster-map"})),a.push(...K({key:`${r}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return G({key:r,value:i,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return G({key:r,value:i,valueSpec:n.source_image,style:o,styleSpec:n});case"canvas":return[new e.V(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return X({key:`${r}.type`,value:i.type,valueSpec:{values:ae(n)},style:o,styleSpec:n})}}function ae(e){return e.source.reduce(((t,i)=>{const r=e[i];return"enum"===r.type.type&&(t=t.concat(Object.keys(r.type.values))),t}),[])}function le(t){const i=t.value,r=t.styleSpec,n=r.light,o=t.style;let s=[];const a=e.K(i);if(void 0===i)return s;if("object"!==a)return s=s.concat([new e.V("light",i,`object expected, ${a} found`)]),s;for(const t in i){const a=t.match(/^(.*)-transition$/),l=t.match(/^(.*)-use-theme$/);s=s.concat(l&&n[l[1]]?pe({key:t,value:i[t],valueSpec:{type:"string"},style:o,styleSpec:r}):a&&n[a[1]]&&n[a[1]].transition?pe({key:t,value:i[t],valueSpec:r.transition,style:o,styleSpec:r}):n[t]?pe({key:t,value:i[t],valueSpec:n[t],style:o,styleSpec:r}):[new e.V(t,i[t],`unknown property "${t}"`)])}return s}function ce(t){const i=t.value;let r=[];if(!i)return r;const n=e.K(i);if("object"!==n)return r=r.concat([new e.V("light-3d",i,`object expected, ${n} found`)]),r;const o=t.styleSpec,s=o["light-3d"],a=t.key,l=t.style,c=t.style.lights;for(const t of["type","id"])if(!(t in i))return r=r.concat([new e.V("light-3d",i,`missing property ${t} on light`)]),r;if(i.type&&c)for(let n=0;n[],array:$,boolean:function(t){const i=t.value,r=t.key,n=e.K(i);return"boolean"!==n?[new e.V(r,i,`boolean expected, ${n} found`)]:[]},number:Z,color:function(t){const i=t.key,r=t.value,n=e.K(r);return"string"!==n?[new e.V(i,r,`color expected, ${n} found`)]:null===e.a0.parseCSSColor(r)?[new e.V(i,r,`color expected, "${r}" found`)]:[]},enum:X,filter:Y,function:q,layer:re,object:G,source:se,model:e.a4,light:le,"light-3d":ce,terrain:ue,fog:he,string:ne,formatted:function(e){return 0===ne(e).length?[]:K(e)},resolvedImage:function(e){return 0===ne(e).length?[]:K(e)},projection:function(t){const i=t.value,r=t.styleSpec,n=r.projection,o=t.style;let s=[];const a=e.K(i);if("object"===a)for(const e in i)s=s.concat(pe({key:e,value:i[e],valueSpec:n[e],style:o,styleSpec:r}));else"string"!==a&&(s=s.concat([new e.V("projection",i,`object or string expected, ${a} found`)]));return s},import:function(t){const{value:i,styleSpec:r}=t,{data:n,...o}=i;Object.defineProperty(o,"__line__",{value:i.__line__,enumerable:!1});let s=G(e.L({},t,{value:o,valueSpec:r.import}));return""===e.M(o.id)&&s.push(new e.V(`${t.key}.id`,o,"import id can't be an empty string")),n&&(s=s.concat(Ae(n,r,{key:`${t.key}.data`}))),s},iconset:function(t){const i=t.value,r=t.key,n=t.styleSpec,o=t.style;if(!i.type)return[new e.V(r,i,'"type" is required')];const s=e.M(i.type);let a=[];if(a=a.concat(G({key:r,value:i,valueSpec:n[`iconset_${s}`],style:o,styleSpec:n})),"source"===s&&i.source){const t=o.sources&&o.sources[i.source],n=t&&e.M(t.type);t?"raster-array"!==n&&a.push(new e.V(r,i.source,`iconset cannot be used with a source of type ${String(n)}, it only be used with a "raster-array" source type`)):a.push(new e.V(r,i.source,`source "${i.source}" not found`))}return a}};function pe(t,i=!1){const r=t.value,n=t.valueSpec,o=t.styleSpec;if(n.expression&&e.a2(e.M(r)))return q(t);if(n.expression&&e.S(e.U(r)))return K(t);if(n.type&&de[n.type]){const r=de[n.type](t);return!0===i&&r.length>0&&"array"===e.K(t.value)?K(t):r}return G(e.L({},t,{valueSpec:n.type?o[n.type]:n}))}function fe(t){const i=t.value,r=t.key,n=ne(t);return n.length||(-1===i.indexOf("{fontstack}")&&n.push(new e.V(r,i,'"glyphs" url must include a "{fontstack}" token')),-1===i.indexOf("{range}")&&n.push(new e.V(r,i,'"glyphs" url must include a "{range}" token'))),n}function Ae(t,i=e.a5,r={}){return pe({key:r.key||"",value:t,valueSpec:i.$root,styleSpec:i,style:t,objectElementValidators:{glyphs:fe,"*":()=>[]}})}function me(t,i=e.a5){return Me(Ae(t,i))}const ge=e=>Me(se(e)),_e=e=>Me(le(e)),ye=e=>Me(ce(e)),ve=e=>Me(ue(e)),xe=e=>Me(he(e)),be=t=>Me(function(t){const i=t.value,r=t.style,n=t.styleSpec,o=n.snow;let s=[];const a=e.K(i);if(void 0===i)return s;if("object"!==a)return s=s.concat([new e.V("snow",i,`object expected, ${a} found`)]),s;for(const t in i){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&o[a[1]]&&o[a[1]].transition?pe({key:t,value:i[t],valueSpec:n.transition,style:r,styleSpec:n}):o[t]?pe({key:t,value:i[t],valueSpec:o[t],style:r,styleSpec:n}):[new e.J(t,i[t],`unknown property "${t}"`)])}return s}(t)),we=t=>Me(function(t){const i=t.value,r=t.style,n=t.styleSpec,o=n.rain;let s=[];const a=e.K(i);if(void 0===i)return s;if("object"!==a)return s=s.concat([new e.V("rain",i,`object expected, ${a} found`)]),s;for(const t in i){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&o[a[1]]&&o[a[1]].transition?pe({key:t,value:i[t],valueSpec:n.transition,style:r,styleSpec:n}):o[t]?pe({key:t,value:i[t],valueSpec:o[t],style:r,styleSpec:n}):[new e.J(t,i[t],`unknown property "${t}"`)])}return s}(t)),Te=e=>Me(re(e)),Be=e=>Me(Y(e)),Ce=e=>Me(te(e)),Se=e=>Me(ie(e)),Ee=t=>Me(e.a4(t));function Me(e){return e.slice().sort(((e,t)=>e.line&&t.line?e.line-t.line:0))}function Ie(t,i){let r=!1;if(i&&i.length)for(const n of i)n instanceof e.J?e.w(n.message):(t.fire(new e.z(new Error(n.message))),r=!0);return r}let Pe;class Le extends e.E{constructor(t,i="flat"){super(),this._transitionable=new e.a6(Pe||(Pe=new e.a7({anchor:new e.a8(e.a5.light.anchor),position:new e.a9(e.a5.light.position),color:new e.a8(e.a5.light.color),intensity:new e.a8(e.a5.light.intensity)}))),this.setLight(t,i),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t,i={}){this._validate(_e,e,i)||(this._transitionable.setTransitionOrValue(e),this.id=t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Ie(this,t.call(me,e.l({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}}let Fe=class extends e.E{constructor(t,i,r,n){super(),this.scope=r,this._transitionable=new e.a6(new e.a7({source:new e.a8(e.a5.terrain.source),exaggeration:new e.a8(e.a5.terrain.exaggeration)}),r,n),this._transitionable.setTransitionOrValue(t,n),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=i}get(){return this._transitionable.serialize()}set(e,t){this._transitionable.setTransitionOrValue(e,t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(t){return this._transitioning.possiblyEvaluate(new e.aa(t)).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const t=this._transitionable._values.exaggeration;if(!t)return null;const i=t.value.expression;if(!i)return null;let r=-1,n=-1,o=1;for(const t of i.zoomStops)o=i.evaluate(new e.aa(t)),o>.01?(r=t,n=-1):n=t;return o<.01&&r>0&&n>r?[r,n]:null}isZoomDependent(){const t=this._transitionable._values.exaggeration;return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof e.ab}};const ke=45,ze=65,Re=.05;function De(t,i,r,n){const o=e.ae(ke,ze,r),[s,a]=Oe(t,n);let l=1-Math.min(1,Math.exp((i-s)/(a-s)*-6));return l*=l*l,l=Math.min(1,1.00747*l),l*o*t.alpha}function Oe(e,t){const i=.5/Math.tan(.5*t);return[e.range[0]+i,e.range[1]+i]}function Ue(t,i,r,n,o){const s=e.ad.vec3.transformMat4([],[i,r,n],o.mercatorFogMatrix);return De(t,e.ad.vec3.length(s),o.pitch,o._fov)}function Ne(t,i,r,n,o,s,a){const l=[[r,n,0],[o,n,0],[o,s,0],[r,s,0]];let c=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(const t of l){const r=e.ad.vec3.transformMat4([],t,i),n=e.ad.vec3.length(r);c=Math.min(c,n),u=Math.max(u,n)}return[De(t,c,a.pitch,a._fov),De(t,u,a.pitch,a._fov)]}class Qe extends e.E{constructor(t,i,r,n){super();const o=new e.a7({range:new e.a8(e.a5.fog.range),color:new e.a8(e.a5.fog.color),"color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new e.a8(e.a5.fog["high-color"]),"high-color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new e.a8(e.a5.fog["space-color"]),"space-color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new e.a8(e.a5.fog["horizon-blend"]),"star-intensity":new e.a8(e.a5.fog["star-intensity"]),"vertical-range":new e.a8(e.a5.fog["vertical-range"])});this._transitionable=new e.a6(o,r,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this._transform=i,this.properties=new e.af(o),this.scope=r}get state(){const t=this._transform,i="globe"===t.projection.name,r=e.ag(t.zoom),n=this.properties.get("range"),o=[.5,3];return{range:i?[e.ah(o[0],n[0],r),e.ah(o[1],n[1],r)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,i,r={}){if(this._validate(xe,t,r))return;const n=e.l({},t);for(const t of Object.keys(e.a5.fog))void 0===n[t]&&(n[t]=e.a5.fog[t].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,i)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const i=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.ae(ke,ze,t))*i.a}getOpacityAtLatLng(t,i){return this._transform.projection.supportsFog?function(t,i,r){const n=e.ac.fromLngLat(i),o=r.elevation?r.elevation.getAtPointOrZero(n):0;return Ue(t,n.x,n.y,o,r)}(this.state,t,i):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const i=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Ne(this.state,i,0,0,e.ai,e.ai,this._transform)}getOpacityForBounds(e,t,i,r,n){return this._transform.projection.supportsFog?Ne(this.state,e,t,i,r,n,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?Oe(this.state,e):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const i=[4,5,6,7];for(const r of i){const i=t.points[r];let n;if(i[2]>=0)n=i;else{const o=t.points[r-4];n=e.aj(o,i,o[2]/(o[2]-i[2]))}if(Ue(this.state,n[0],n[1],0,this._transform)>=Re)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Ie(this,t.call(me,e.l({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}}let je,Ve,He,Ge,$e=class extends e.E{constructor(t,i,r,n){super();const o=je||(je=new e.a7({density:new e.a8(e.a5.snow.density),intensity:new e.a8(e.a5.snow.intensity),color:new e.a8(e.a5.snow.color),opacity:new e.a8(e.a5.snow.opacity),vignette:new e.a8(e.a5.snow.vignette),"vignette-color":new e.a8(e.a5.snow["vignette-color"]),"center-thinning":new e.a8(e.a5.snow["center-thinning"]),direction:new e.a8(e.a5.snow.direction),"flake-size":new e.a8(e.a5.snow["flake-size"])}));this._transitionable=new e.a6(o,r,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.af(o),this.scope=r}get state(){const t=this.properties.get("opacity"),i=this.properties.get("color"),r=this.properties.get("direction"),n=e.ak(r[0]),o=-Math.max(e.ak(r[1]),.01),s=[Math.cos(n)*Math.cos(o),Math.sin(n)*Math.cos(o),Math.sin(o)],a=this.properties.get("vignette"),l=this.properties.get("vignette-color");return l.a=a,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.al(i.r,i.g,i.b,i.a*t),direction:s,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:l}}get(){return this._transitionable.serialize()}set(t,i,r={}){if(this._validate(be,t,r))return;const n=e.l({},t);for(const t of Object.keys(e.a5.snow))void 0===n[t]&&(n[t]=e.a5.snow[t].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Ie(this,t.call(me,e.l({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}},Ze=class extends e.E{constructor(t,i,r,n){super();const o=Ve||(Ve=new e.a7({density:new e.a8(e.a5.rain.density),intensity:new e.a8(e.a5.rain.intensity),color:new e.a8(e.a5.rain.color),opacity:new e.a8(e.a5.rain.opacity),vignette:new e.a8(e.a5.rain.vignette),"vignette-color":new e.a8(e.a5.rain["vignette-color"]),"center-thinning":new e.a8(e.a5.rain["center-thinning"]),direction:new e.a8(e.a5.rain.direction),"droplet-size":new e.a8(e.a5.rain["droplet-size"]),"distortion-strength":new e.a8(e.a5.rain["distortion-strength"])}));this._transitionable=new e.a6(o,r,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.af(o),this.scope=r}get state(){const t=this.properties.get("opacity"),i=this.properties.get("color"),r=this.properties.get("direction"),n=e.ak(r[0]),o=-Math.max(e.ak(r[1]),.01),s=[Math.cos(n)*Math.cos(o),Math.sin(n)*Math.cos(o),Math.sin(o)],a=this.properties.get("vignette-color");return a.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.al(i.r,i.g,i.b,i.a*t),direction:s,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:a}}get(){return this._transitionable.serialize()}set(t,i,r={}){if(this._validate(we,t,r))return;const n=e.l({},t);for(const t of Object.keys(e.a5.rain))void 0===n[t]&&(n[t]=e.a5.rain[t].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&Ie(this,t.call(me,e.l({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}};class qe extends e.E{constructor(t,i,r,n){super(),this.scope=r,this._options=t,this.properties=new e.af(i),this._transitionable=new e.a6(i,r,new Map(n)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,t){this._options=e,this._transitionable.setTransitionOrValue(e.properties,t)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}class Ke{constructor(e,t,i,r){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=i,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,r)}static createFromScreenPoints(t,i){let r,n;if(t instanceof e.P||"number"==typeof t[0]){const o=e.P.convert(t);r=[o],n=i.isPointAboveHorizon(o)}else{const o=e.P.convert(t[0]),s=e.P.convert(t[1]);r=[o,s],n=e.an(o,s).every((e=>i.isPointAboveHorizon(e)))}return new Ke(r,i.getCameraPoint(),n,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.an(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.an(i,r,0,!1);return this.cameraPoint.y>r.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x=r.x?n[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(n[3]=this.cameraPoint)),e.ao(n,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.an(i,r,t),o=this.cameraPoint.clone();switch(3*((o.y>i.y)+(o.y>r.y))+((o.x>i.x)+(o.x>r.x))){case 0:n[0]=o,n[4]=o.clone();break;case 1:n.splice(1,0,o);break;case 2:n[1]=o;break;case 3:n.splice(4,0,o);break;case 5:n.splice(2,0,o);break;case 6:n[3]=o;break;case 7:n.splice(3,0,o);break;case 8:n[2]=o}return n}containsTile(t,i,r,n=0){const o=t.queryPadding/i._pixelsPerMercatorPixel+1,s=r?this._bufferedCameraMercator(o,i):this._bufferedScreenMercator(o,i);let a=t.tileID.wrap+(s.unwrapped?n:0);const l=s.polygon.map((i=>e.ap(t.tileTransform,i,a)));if(!e.aq(l,0,0,e.ai,e.ai))return;a=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);const c=this.screenGeometryMercator.polygon.map((i=>e.ar(t.tileTransform,i,a))),u=c.map((t=>new e.P(t[0],t[1]))),h=i.getFreeCameraOptions().position||new e.ac(0,0,0),d=e.ar(t.tileTransform,h,a),p=c.map((t=>{const i=e.ad.vec3.sub(t,t,d);return e.ad.vec3.normalize(i,i),new e.as(d,i)})),f=e.at(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(A=e.au(l),A.min.x=e.ay(A.min.x,0,e.ai),A.min.y=e.ay(A.min.y,0,e.ai),A.max.x=e.ay(A.max.x,0,e.ai),A.max.y=e.ay(A.max.y,0,e.ai),A),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:f};var A}_bufferedScreenMercator(e,t){const i=Ye(e);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[i]=r,r}}_bufferedCameraMercator(e,t){const i=Ye(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[i]=r,r}}_projectAndResample(t,i){const r=function(t,i){const r=e.ad.mat4.multiply([],i.pixelMatrix,i.globeMatrix),n=[0,-e.az,0,1],o=[0,e.az,0,1],s=[0,0,0,1];e.ad.vec4.transformMat4(n,n,r),e.ad.vec4.transformMat4(o,o,r),e.ad.vec4.transformMat4(s,s,r);const a=new e.P(n[0]/n[3],n[1]/n[3]),l=new e.P(o[0]/o[3],o[1]/o[3]),c=e.aw(t,a)&&n[3]1?We(t.slice(0,d),i):[],A=dnew e.P(Xe(t.x),t.y))),A=A.map((t=>new e.P(Xe(t.x),t.y)));const m=[...f];0===m.length&&m.push(A[A.length-1]);const g=e.ah(m[m.length-1].y,(0===A.length?f[0]:A[0]).y,p);let _;return _=c?[new e.P(0,g),new e.P(0,0),new e.P(1,0),new e.P(1,g)]:[new e.P(1,g),new e.P(1,1),new e.P(0,1),new e.P(0,g)],m.push(..._),0===A.length?m.push(f[0]):m.push(...A),{polygon:m.map((t=>new e.ac(t.x,t.y))),unwrapped:!1}}(t,i);if(r)return r;const n=function(t,i){let r=!1,n=-1/0,o=0;for(let e=0;en&&(n=t[e].x,o=e);for(let e=0;e.5&&(n.x{e.x-=1})),{polygon:t,unwrapped:r}}(We(t,i).map((t=>new e.P(Xe(t.x),t.y))),i);return{polygon:n.polygon.map((t=>new e.ac(t.x,t.y))),unwrapped:n.unwrapped}}}function We(t,i){return e.ax(t,(e=>{const t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y}),1/256)}function Xe(e){return e<0?1+e%1:e%1}function Ye(e){return 100*e|0}function Je(t,i,r,n,o){const s=function(r,n){if(r)return o(r);if(n){if(t.url&&n.tiles&&t.tiles&&delete t.tiles,n.variants){if(!Array.isArray(n.variants))return o(new Error("variants must be an array"));for(const t of n.variants){if(null==t||"object"!=typeof t||t.constructor!==Object)return o(new Error("variant must be an object"));if(!Array.isArray(t.capabilities))return o(new Error("capabilities must be an array"));if(1===t.capabilities.length&&"meshopt"===t.capabilities[0]){n=e.l(n,t);break}}}const r=e.aA(e.l({},n,t),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);r.tiles=i.canonicalizeTileset(r,t.url),o(null,r)}},a=function(e,t,i){if(!e)return null;if(!t&&!i)return e;i=i||e.worldview_default;const r=Object.values(e.language||{});if(0===r.length)return null;const n=Object.values(e.worldview||{});if(0===n.length)return null;const o=r.every((e=>e===t)),s=n.every((e=>e===i));return o&&s?e:t in(e.language_options||{})||i in(e.worldview_options||{})?null:e.language_options&&e.worldview_options?e:null}(t.data,r,n);return a?e.q.frame((()=>s(null,a))):t.url?e.n(i.transformRequest(i.normalizeSourceURL(t.url,null,r,n),e.R.Source),s):e.q.frame((()=>{const{data:e,...i}=t;s(null,i)}))}class et{constructor(t,i,r){this.bounds=e.aB.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),r=Math.floor(e.av(this.bounds.getWest())*i),n=Math.floor(e.aC(this.bounds.getNorth())*i),o=Math.ceil(e.av(this.bounds.getEast())*i),s=Math.ceil(e.aC(this.bounds.getSouth())*i);return t.x>=r&&t.x=n&&t.y{if(this._tileJSONRequest=null,this._loaded=!0,n)i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),r&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new e.z(n));else if(o){if(e.l(this,o),this.hasWorldviews=!!o.worldview_options,o.worldview_default&&(this.worldviewDefault=o.worldview_default),o.vector_layers){this.vectorLayers=o.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const e of o.vector_layers)this.vectorLayerIds.push(e.id),o.worldview&&o.worldview[e.source]&&this.localizableLayerIds.add(e.id)}o.bounds&&(this.tileBounds=new et(o.bounds,this.minzoom,this.maxzoom)),P(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}t&&t(n)}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.C(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}loadTile(t,i){const r=t.tileID.canonical.url(this.tiles,this.scheme),n=this.map._requestManager.normalizeTileURL(r),o=this.map._requestManager.transformRequest(n,e.R.Tile),s=this.map.style?this.map.style.getLut(this.scope):null,a=s?{image:s.image.clone()}:null,l={request:o,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:a,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor()};if(this.hasWorldviews&&e.f(r)&&(l.worldview=this.map.getWorldview()||this.worldviewDefault,l.localizableLayerIds=this.localizableLayerIds),l.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=i:t.request=t.actor.send("reloadTile",l,c.bind(this));else if(t.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",l,c.bind(this),void 0,!0);else{const i=e.aE.call({deduped:this._deduped},l,((e,i)=>{e||!i?c.call(this,e):(l.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},t.actor&&t.actor.send("loadTile",l,c.bind(this),void 0,!0))}),!0);t.request={cancel:i}}function c(r,n){return delete t.request,t.aborted?i(null):r&&404!==r.status?i(r):(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),e.aF(this.dispatcher),i(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(e,t){e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class it extends e.E{constructor(t,i,r,n){super(),this.id=t,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.l({type:"raster"},i),e.l(this,e.aA(i,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"})),this._tileJSONRequest=Je(this._options,this.map._requestManager,null,null,((i,r)=>{this._tileJSONRequest=null,this._loaded=!0,i?this.fire(new e.z(i)):r&&(e.l(this,r),r.raster_layers&&(this.rasterLayers=r.raster_layers,this.rasterLayerIds=this.rasterLayers.map((e=>e.id))),r.bounds&&(this.tileBounds=new et(r.bounds,this.minzoom,this.maxzoom)),P(r.tiles),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(i)}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.C(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const r=e.q.devicePixelRatio>=2,n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),r,this.tileSize);t.request=e.o(this.map._requestManager.transformRequest(n,e.R.Tile),((r,n,o,s)=>(delete t.request,t.aborted?(t.state="unloaded",i(null)):r?(t.state="errored",i(r)):n?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s}),t.setTexture(n,this.map.painter),t.state="loaded",e.aF(this.dispatcher),void i(null)):i(null))))}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t&&t()}unloadTile(t,i){t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),i&&i()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class rt extends it{constructor(t,i,r,n){super(t,i,r,n),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._options=e.l({type:"raster-array"},i)}triggerRepaint(e){const t=this.map.painter._terrain,i=this.map.style.getSourceCache(this.id);t&&t.enabled&&i&&t._clearRenderCacheForTile(i.id,e.tileID),this.map.triggerRepaint()}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),n=this.map._requestManager.transformRequest(r,e.R.Tile),o={request:n,uid:t.uid,tileID:t.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=n,t.actor||(t.actor=this.dispatcher.getActor());const s=(e,r,n,o)=>{if(delete t.request,t.aborted)return t.state="unloaded",i(null);if(e){if("AbortError"===e.name)return;return t.state="errored",i(e)}if(this.map._refreshExpiredTiles&&r&&t.setExpiryData({cacheControl:n,expires:o}),this.partial)t.state="empty";else{if(!r)return i(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=r}i(null)};t.request=this.partial?t.fetchHeader(void 0,s.bind(this)):t.actor.send("loadTile",o,s.bind(this),void 0,!0)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,i){const r=t.texture;r&&r instanceof e.T?(t.destroy(!0),this.map.painter.saveTileTexture(r)):(t.destroy(),t.flushQueues(),t._isHeaderLoaded=!1,delete t._mrt,delete t.textureDescriptor),t.fbo&&(t.fbo.destroy(),delete t.fbo),delete t.request,delete t.requestParams,delete t.neighboringTiles,t.state="unloaded"}prepareTile(t,i,r){t._isHeaderLoaded&&("empty"!==t.state&&(t.state="reloading"),t.fetchBand(i,r,((i,r)=>{if(i)return t.state="errored",this.fire(new e.z(i)),void this.triggerRepaint(t);r&&(t._isHeaderLoaded=!0,t.setTexture(r,this.map.painter),t.state="loaded",this.triggerRepaint(t))})))}getInitialBand(e){if(!this.rasterLayers)return 0;const t=this.rasterLayers.find((({id:t})=>t===e)),i=t&&t.fields,r=i&&i.bands&&i.bands;return r?r[0]:0}getTextureDescriptor(t,i,r){if(!t)return;const n=i.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!n)return;let o=null;i instanceof e.aI?o=i.paint.get("raster-array-band"):i instanceof e.aJ&&(o=i.paint.get("raster-particle-array-band"));const s=o||this.getInitialBand(n);if(null!=s)if(t.textureDescriptor){if(!t.updateNeeded(n,s)||r)return Object.assign({},t.textureDescriptor,{texture:t.texture})}else this.prepareTile(t,n,s)}getImages(t,i){const r=new Map;for(const n of t)for(const t of i){const[i,o]=t.split("/"),s=n.getLayer(i);if(!s)continue;if(!s.hasBand(o)||!s.hasDataForBand(o))continue;const{bytes:a,tileSize:l,buffer:c}=s.getBandView(o),u=l+2*c,h={data:new e.r({width:u,height:u},a),pixelRatio:2,sdf:!1,usvg:!1,version:0};r.set(t,h)}return r}}const nt={vector:tt,raster:it,"raster-dem":class extends it{constructor(t,i,r,n){super(t,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=e.l({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,r){e&&(t.state="errored",i(e)),r&&(t.dem=r,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",i(null))}t.request=e.o(this.map._requestManager.transformRequest(r,e.R.Tile),function(r,o,s,a){if(delete t.request,t.aborted)t.state="unloaded",i(null);else if(r)t.state="errored",i(r);else if(o){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:s,expires:a});const i=ImageBitmap&&o instanceof ImageBitmap&&e.t(),r=1-(o.width-e.aG(o.width))/2;r<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=i?o:e.q.getImageData(o,r),c={uid:t.uid,tileID:t.tileID,source:this.id,type:this.type,scope:this.scope,rawImageData:l,encoding:this.encoding,padding:r};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadTile",c,n.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(t){const i=t.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?t.wrap-1:t.wrap,s=(i.x+1+r)%r,a=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.aH(t.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new e.aH(t.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new e.aH(t.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new e.aH(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.aH(t.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1{if(this._loaded=!0,this._pendingLoad=null,i)this.fire(new e.z(i));else{const i={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&r&&r.resourceTiming&&r.resourceTiming[this.id]&&(i.resourceTiming=r.resourceTiming[this.id]),t&&(this._partialReload=!0),this.fire(new e.A("data",i)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(t),this._coalesce=!1)}))}loaded(){return this._loaded}reload(){const t=e.C(this.id,this.scope);this.map.style.clearSource(t),this._updateWorkerData()}loadTile(t,i){const r=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const n=this.map.style?this.map.style.getLut(this.scope):null,o=n?{image:n.image.clone()}:null,s=this._partialReload,a={type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:o,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,scaleFactor:this.map.getScaleFactor(),partial:s};t.request=this.actor.send(r,a,((e,n)=>s&&!n?(t.state="loaded",i(null)):(delete t.request,t.destroy(),t.aborted?i(null):e?i(e):(t.loadVectorData(n,this.map.painter,"reloadTile"===r),i(null)))),void 0,"loadTile"===r)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e,t){this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}onRemove(e){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.l({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends e.aK{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const i of t.urls)this.urls.push(this.map._requestManager.transformRequest(i,e.R.Source).url);e.aL(this.urls,((t,i)=>{this._loaded=!0,t?this.fire(new e.z(t)):i&&(this.video=i,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;ti.end(0)?this.fire(new e.z(new e.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.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 e.T(t,this.video,i.RGBA8),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.aK,model:class extends e.E{constructor(e,t,i,r){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const t=[];for(const i in this._options.models){const r=this._options.models[i],n=e.aN(this.map._requestManager.transformRequest(r.uri,e.R.Model).url).then((t=>{if(!t)return;const n=e.aO(t),o=new e.aP(i,r.position,r.orientation,n);o.computeBoundsAndApplyParent(),this.models.push(o)})).catch((t=>{this.fire(new e.z(new Error(`Could not load model ${i} from ${r.uri}: ${t.message}`)))}));t.push(n)}return Promise.allSettled(t).then((()=>{this._loaded=!0,this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"}))})).catch((t=>{this.fire(new e.z(new Error(`Could not load models: ${t.message}`)))}))}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,t){}serialize(){return{type:"model"}}},"batched-model":class extends e.E{constructor(e,t,i,r){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=i,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(r)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.C(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(t){this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,r=this.map.getWorldview();this._tileJSONRequest=Je(this._options,this.map._requestManager,i,r,((n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),r&&2!==r.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new e.z(n))):o&&(e.l(this,o),o.bounds&&(this.tileBounds=new et(o.bounds,this.minzoom,this.maxzoom)),P(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(n)}))}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(r,e.R.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:e.q.devicePixelRatio,promoteId:this.promoteId};if(t.actor&&"expired"!==t.state)if("loading"===t.state)t.reloadCallback=i;else{if(t.buckets){const e=Object.values(t.buckets);for(const t of e)t.dirty=!0;return void(t.state="loaded")}t.request=t.actor.send("reloadTile",n,o.bind(this))}else t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",n,o.bind(this),void 0,!0);function o(e,r){return t.aborted?i(null):e&&404!==e.status?i(e):(this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadModelData(r,this.map.painter),t.state="loaded",void i(null))}}serialize(){return e.l({},this._options)}},canvas:class extends e.aK{constructor(t,i,r,n){super(t,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new e.z(new e.V(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.z(new e.V(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.z(new e.V(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.z(new e.V(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.z(new e.V(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}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 e.z(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(e){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context;this.texture?!t&&!this._playing||this.texture instanceof e.aM||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(i,this.canvas,i.gl.RGBA8,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.E{constructor(t,i,r,n){super(),this.id=t,this.type="custom",this._dataType="raster",this._dispatcher=r,this._implementation=i,this.setEventedParent(n),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new et(this._implementation.bounds,this.minzoom,this.maxzoom)),i.update=this._update.bind(this),i.clearTiles=this._clearTiles.bind(this),i.coveringTiles=this._coveringTiles.bind(this),e.l(this,e.aA(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.aA(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(t){this.map=t,this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:r}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:r})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,t){const{x:i,y:r,z:n}=e.tileID.canonical,o=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:i,y:r,z:n},{signal:o.signal})).then(function(i){return delete e.request,e.aborted?(e.state="unloaded",t(null)):void 0===i?(e.state="errored",t(null)):null===i?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",t(null)):function(e){return e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof ImageBitmap||e instanceof HTMLImageElement}(i)?(this.loadTileData(e,i),e.state="loaded",void t(null)):(e.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch((i=>{"AbortError"!==i.name&&(e.state="errored",t(i))})),e.request.cancel=()=>o.abort()}loadTileData(e,t){e.setTexture(t,this.map.painter)}unloadTile(t,i){if(t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),this._implementation.unloadTile){const{x:e,y:i,z:r}=t.tileID.canonical;this._implementation.unloadTile({x:e,y:i,z:r})}i&&i()}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z})))}_clearTiles(){const t=e.C(this.id,this.scope);this.map.style.clearSource(t)}_update(){this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}}},ot=function(t,i,r,n){const o=new nt[i.type](t,i,r,n);if(o.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);return e.aQ(["load","abort","unload","serialize","prepare"],o),o};function st(e,t,i=""){return`${i}:${t.id||""}:${t.layer.id}:${function(e){if("layerId"in e)return`layer:${e.layerId}`;{const{featuresetId:t,importId:i}=e;return`featureset:${t}${i?`:import:${i}`:""}`}}(e.target)}`}function at(e,t,i,r=""){if(e.uniqueFeatureID){const n=st(e,t,r);if(i.has(n))return!0;i.add(n)}return!1}function lt(e,t,i,r,n=!1){const o=t.sourceCache.transform,s=t.sourceCache.tilesIn(e,t.has3DLayers,n);s.sort(ht);const a=[];for(const e of s){const s=e.tile.queryRenderedFeatures(t,e,i,r,o,n);Object.keys(s).length&&a.push({wrappedTileID:e.tile.tileID.wrapped().key,queryResults:s})}return 0===a.length?{}:function(e){const t={},i={};for(const r of e){const e=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in e){const r=e[i],n=o[i]=o[i]||{},s=t[i]=t[i]||[];for(const e of r)n[e.featureIndex]||(n[e.featureIndex]=!0,s.push(e))}}return t}(a)}function ct(e,t,i,r,n){const o={},s=r.queryRenderedSymbols(e),a=[];for(const e of Object.keys(s).map(Number))a.push(n[e]);a.sort(ht);for(const e of a){const r=e.featureIndex.lookupSymbolFeatures(s[e.bucketInstanceId],e.bucketIndex,e.sourceLayerIndex,t,i);for(const t in r){const i=o[t]=o[t]||[],n=r[t];n.sort(((t,i)=>{const r=e.featureSortOrder;if(r){const e=r.indexOf(t.featureIndex);return r.indexOf(i.featureIndex)-e}return i.featureIndex-t.featureIndex}));for(const e of n)i.push(e)}}return o}function ut(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],n={};for(let e=0;et.getLayer(e))).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.fqid]=r}}return i}const pt=32,ft=33,At=new Uint16Array(8184);for(let e=0;e<2046;e++){let t=e+2,i=0,r=0,n=0,o=0,s=0,a=0;for(1&t?n=o=s=pt:i=r=a=pt;(t>>=1)>1;){const e=i+n>>1,l=r+o>>1;1&t?(n=i,o=r,i=s,r=a):(i=n,r=o,n=s,o=a),s=e,a=l}const l=4*e;At[l+0]=i,At[l+1]=r,At[l+2]=n,At[l+3]=o}const mt=new Uint16Array(2178),gt=new Uint8Array(1089),_t=new Uint16Array(1089);function yt(e){return 0===e?-.03125:32===e?.03125:0}const vt={type:2,extent:e.ai,loadGeometry:()=>[[new e.P(0,0),new e.P(e.ai+1,0),new e.P(e.ai+1,e.ai+1),new e.P(0,e.ai+1),new e.P(0,0)]]};class xt{constructor(t,i,r,n,o){this.tileID=t,this.uid=e.aW(),this.uses=0,this.tileSize=i,this.tileZoom=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(t){const i=t+this.timeAdded;ie)t=!1;else if(i)if(this.expirationTime0&&!i;f&&!a.stateDependentLayers.length&&!i||a.update(d,u,n,p,f?a.stateDependentLayers:a.layers,i,o),(a instanceof e.b2||a instanceof e.b3)&&t._terrain&&t._terrain.enabled&&h&&a.uploadPending()&&t._terrain._clearRenderCacheForTile(h.id,this.tileID);const A=t&&t.style&&t.style.getOwnLayer(s);A&&(this.queryPadding=Math.max(this.queryPadding,A.queryRadius(a)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;e--){const t=4*e,i=At[t+0],r=At[t+1],n=At[t+2],o=At[t+3],s=i+n>>1,a=r+o>>1,l=s+a-r,c=a+i-s,u=r*ft+i,h=o*ft+n,d=a*ft+s,p=Math.hypot((mt[2*u+0]+mt[2*h+0])/2-mt[2*d+0],(mt[2*u+1]+mt[2*h+1])/2-mt[2*d+1])>=16;gt[d]=gt[d]||(p?1:0),e<1022&&(gt[d]=gt[d]||gt[(r+c>>1)*ft+(i+l>>1)]||gt[(o+c>>1)*ft+(n+l>>1)])}const o=new e.aU,s=new e.aV;let a=0;function l(t,i){const r=i*ft+t;return 0===_t[r]&&(o.emplaceBack(mt[2*r+0],mt[2*r+1],t*e.ai/pt,i*e.ai/pt),_t[r]=++a),_t[r]-1}function c(e,t,i,r,n,o){const a=e+i>>1,u=t+r>>1;if(Math.abs(e-n)+Math.abs(t-o)>1&>[u*ft+a])c(n,o,e,t,a,u),c(i,r,n,o,a,u);else{const a=l(e,t),c=l(i,r),u=l(n,o);s.emplaceBack(a,c,u)}}return c(0,0,pt,pt,pt,0),c(pt,pt,0,0,0,pt),{vertices:o,indices:s}}(this.tileID.canonical,i);n=t.vertices,o=t.indices}else{n=new e.aU,o=new e.aV;for(const{x:e,y:t}of r)n.emplaceBack(e,t,0,0);const t=e.b9(n.int16,void 0,4);for(let e=0;e0&&(l=e.ad.mat4.invert(new Float64Array(16),i.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,n,i,s,l,a),this._makeGlobeTileDebugTextBuffer(t,n,i,s,l,a)}_globePoint(t,i,r,n,o,s,a){let l=e.bd(t,i,r);if(s){const o=1<.5?d=-1:h<-.5&&(d=1);let p=(t/e.ai+r.x)/o+d,f=(i/e.ai+r.y)/o;p=(p-c)*n._pixelsPerMercatorPixel+c,f=(f-u)*n._pixelsPerMercatorPixel+u;const A=[p*n.worldSize,f*n.worldSize,0];e.ad.vec3.transformMat4(A,A,s),l=e.be(l,A,a)}return e.ad.vec3.transformMat4(l,l,o)}_makeGlobeTileDebugBorderBuffer(t,i,r,n,o,s){const a=new e.b5,l=new e.b6,c=new e.bf,u=(e,t,u,h,d)=>{const p=(u-e)/(d-1),f=(h-t)/(d-1),A=a.length;for(let u=0;uh*e+t;for(let e=0;e{if(e)i(e);else try{const e=r.getHeaderLength(n);if(e>t)return void(this.request=this.fetchHeader(e,i));r.parseHeader(n),this._isHeaderLoaded=!0;let a=0;for(const e of Object.values(r.layers))a=Math.max(a,e.dataIndex[e.dataIndex.length-1].lastByte);n.byteLength>=a&&(this.entireBuffer=n),i(null,this.entireBuffer||n,o,s)}catch(e){i(e)}})),this.request}fetchBand(t,i,r){const n=this._mrt;if(!this._isHeaderLoaded||!n)return void r(new Error("Tile header is not ready"));const o=this.actor;if(!o)return void r(new Error("Can't fetch tile band without an actor"));let s;const a=(e,n)=>{s.complete(e,n),e?r(e):(this.updateTextureDescriptor(t,i),r(null,this.textureDescriptor&&this.textureDescriptor.img))},l=(e,t)=>{if(e)return r(e);const i=o.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:t,task:s},a,void 0,!0);this._workQueue.push((()=>{i&&i.cancel(),s.cancel()}))},c=n.getLayer(t);if(!c)return void r(new Error(`Unknown sourceLayer "${t}"`));if(c.hasDataForBand(i))return this.updateTextureDescriptor(t,i),void r(null,this.textureDescriptor?this.textureDescriptor.img:null);const u=c.getDataRange([i]);if(s=n.createDecodingTask(u),!s||s.tasks.length)if(this.flushQueues(),this.entireBuffer)l(null,this.entireBuffer.slice(u.firstByte,u.lastByte+1));else{const t=Object.assign({},this.requestParams,{headers:{Range:`bytes=${u.firstByte}-${u.lastByte}`}}),i=e.bj(t,l);this._fetchQueue.push((()=>{i.cancel(),s.cancel()}))}else r(null)}updateNeeded(e,t){return(!this.textureDescriptor||this.textureDescriptor.band!==t||this.textureDescriptor.layer!==e)&&"errored"!==this.state}updateTextureDescriptor(t,i){if(!this._mrt)return;const r=this._mrt.getLayer(t);if(!r||!r.hasBand(i)||!r.hasDataForBand(i))return;const{bytes:n,tileSize:o,buffer:s,offset:a,scale:l}=r.getBandView(i),c=o+2*s,u=new e.r({width:c,height:c},n),h=this.texture;h&&h instanceof e.T&&h.update(u,{premultiply:!1}),this.textureDescriptor={layer:t,band:i,img:u,buffer:s,offset:a,tileSize:o,format:r.pixelFormat,mix:[l,256*l,65536*l,16777216*l]}}}class wt{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){const r=e.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:t,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(e,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const r of this.data[i])e(r.value)||t.push(r);for(const e of t)this.remove(e.value.tileID,e)}}class Tt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,i,r){const n=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},e.l(this.stateChanges[t][n],r),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==n&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][n]){this.deletedStates[t][n]={};for(const e in this.state[t][n])r[e]||(this.deletedStates[t][n][e]=null)}else for(const e in r)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][e]&&delete this.deletedStates[t][n][e]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(t,i){const r=this.state[t]||{},n=this.stateChanges[t]||{},o=this.deletedStates[t];if(null===o)return{};if(void 0!==i){const t=String(i),s=e.l({},r[t],n[t]);if(o){const e=o[i];if(null===e)return{};for(const t in e)delete s[t]}return s}const s=e.l({},r,n);if(o)for(const e in o)delete s[e];return s}initializeTileState(e,t){e.refreshFeatureState(t)}coalesceChanges(t,i){const r={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const i={};for(const r in this.stateChanges[t])this.state[t][r]||(this.state[t][r]={}),e.l(this.state[t][r],this.stateChanges[t][r]),i[r]=this.state[t][r];r[t]=i}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const i={};if(null===this.deletedStates[t])for(const e in this.state[t])i[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else if(this.state[t][e])for(const i of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][i];i[e]=this.state[t][e]}r[t]=r[t]||{},e.l(r[t],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const e in t)t[e].refreshFeatureState(i)}}class Bt extends e.E{constructor(e,t,i){super(),this.id=e,this._onlySymbols=i,t.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),t.on("error",(()=>{this._sourceErrored=!0})),this._source=t,this._tiles={},this._cache=new wt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Tt,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles)if(!this._tiles[e].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(Ct).map((e=>e.key))}getRenderableIds(t,i){const r=[];for(const e in this._tiles)this._isIdRenderable(+e,t,i)&&r.push(this._tiles[e]);return t?r.sort(((t,i)=>{const r=t.tileID,n=i.tileID,o=new e.P(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),s=new e.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-n.overscaledZ||s.y-o.y||s.x-o.x})).map((e=>e.tileID.key)):r.map((e=>e.tileID)).sort(Ct).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())&&(i||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}_tileLoaded(t,i,r,n){if(n)if(t.state="errored",404!==n.status)this._source.fire(new e.z(n,{tile:t}));else{if(this._source.fire(new e.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=e.q.now(),"expired"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),"raster-dem"===this._source.type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new e.A("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const t=this.getRenderableIds();for(let r=0;r1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>i)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>t+1;){const e=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[e.key],o&&o.hasData()&&(s=e)}let a=s;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]){r[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),r=this._getLoadedTile(t);if(r)return r}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const i=Math.ceil(e.width/t)+1,r=Math.ceil(e.height/t)+1,n=Math.floor(i*r*5),o="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,n):n,s="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(t,i,r,n){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!r)return;this.updateCacheSize(t,i),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const o="batched-model"===this._source.type;let s,a=this._source.maxzoom;const l=this.map&&this.map.painter?this.map.painter._terrain:null;if(l&&l.sourceCache===this&&l.attenuationRange()){const e=l.attenuationRange()[0],t=Math.floor(e)-Math.log2(l.getDemUpscale());a>t&&(a=t)}if(this.used||this.usedForTerrain){if(this._source.tileID)s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new e.aH(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)));else if(0!==this.tileCoverLift){const n=t.clone();n.tileCoverLift=this.tileCoverLift,s=n.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:a,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.minzoom<=1&&"globe"===t.projection.name&&(s.push(new e.aH(1,0,1,0,0)),s.push(new e.aH(1,0,1,1,0)),s.push(new e.aH(1,0,1,0,1)),s.push(new e.aH(1,0,1,1,1)))}else if(s=t.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:a,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.hasTile){const e=this._source.hasTile.bind(this._source);s=s.filter((t=>e(t)))}}else s=[];if(s.length>0&&this.castsShadows&&n&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!St(this._source.type)){const e=t.coveringZoomLevel({tileSize:i||this._source.tileSize,roundZoom:this._source.roundZoom&&!r}),a=Math.min(e,this._source.maxzoom);if(o){const e=t.extendTileCover(s,a);for(const t of e)s.push(t)}else{const e=t.extendTileCover(s,a,n);for(const t of e)this._shadowCasterTiles[t.key]=!0,s.push(t)}}const c=this._updateRetainedTiles(s);if(St(this._source.type)&&0!==s.length){const t={},i={},r=Object.keys(c);for(const n of r){const r=c[n],o=this._tiles[n];if(!o||o.fadeEndTime&&o.fadeEndTime<=e.q.now())continue;const s=this.findLoadedParent(r,Math.max(r.overscaledZ-Bt.maxOverzooming,this._source.minzoom));s&&(this._addTile(s.tileID),t[s.tileID.key]=s.tileID),i[n]=r}const n=s[s.length-1].overscaledZ;for(const e in this._tiles){const t=this._tiles[e];if(c[e]||!t.hasData())continue;let r=t.tileID;for(;r.overscaledZ>n;){r=r.scaledTo(r.overscaledZ-1);const n=this._tiles[r.key];if(n&&n.hasData()&&i[r.key]){c[e]=t.tileID;break}}}for(const e in t)c[e]||(this._coveredTiles[e]=!0,c[e]=t[e])}for(const e in c)this._tiles[e].clearFadeHold();const u=e.bk(this._tiles,c);for(const e of u){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const i={},r=e.reduce(((e,t)=>Math.min(e,t.overscaledZ)),1/0),n=e[0].overscaledZ,o=Math.max(n-Bt.maxOverzooming,this._source.minzoom),s=Math.max(n+Bt.maxUnderzooming,this._source.minzoom),a={};for(const i of e){const e=this._addTile(i);t[i.key]=i,e.hasData()||r=this._source.maxzoom){const e=r.children(this._source.maxzoom)[0],i=this.getTile(e);if(i&&i.hasData()){t[e.key]=e;continue}}else{const e=r.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let n=e.wasRequested();for(let s=r.overscaledZ-1;s>=o;--s){const o=r.scaledTo(s);if(i[o.key])break;if(i[o.key]=!0,e=this.getTile(o),!e&&n&&(e=this._addTile(o)),e&&(t[o.key]=o,n=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;r=e}for(const e of t)this._loadedParentTiles[e]=i}}_addTile(t){let i=this._tiles[t.key];if(i)return!0!==i.isExtraShadowCaster||!!this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const r=Boolean(i);if(!r){const e=this.map?this.map.painter:null,r=this._source.tileSize*t.overscaleFactor();i="raster-array"===this._source.type?new bt(t,r,this.transform.tileZoom,e,this._isRaster):new xt(t,r,this.transform.tileZoom,e,this._isRaster),this._loadTile(i,this._tileLoaded.bind(this,i,t.key,i.state))}return i?(i.uses++,this._tiles[t.key]=i,r||this._source.fire(new e.A("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i):null}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state||"empty"===t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,i,r){const n=[],o=this.transform;if(!o)return n;const s="globe"===o.projection.name,a=e.av(o.center.lng);for(const l in this._tiles){const c=this._tiles[l];if(r&&c.clearQueryDebugViz(),c.holdingForFade())continue;let u;if(s){const t=c.tileID.canonical;if(0===t.z){const i=[Math.abs(e.ay(a,...Et(t,-1))-a),Math.abs(e.ay(a,...Et(t,1))-a)];u=[0,2*i.indexOf(Math.min(...i))-1]}else{const i=[Math.abs(e.ay(a,...Et(t,-1))-a),Math.abs(e.ay(a,...Et(t,0))-a),Math.abs(e.ay(a,...Et(t,1))-a)];u=[i.indexOf(Math.min(...i))-1]}}else u=[0];for(const e of u){const r=t.containsTile(c,o,i,e);r&&n.push(r)}}return n}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,t){const i=this.getRenderableIds(e,t).map((e=>this._tiles[e].tileID)),r="globe"===this.transform.projection.name;for(const e of i)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped()),e.expandedProjMatrix=r?this.transform.calculateProjMatrix(e.toUnwrapped(),!1,!0):e.projMatrix;return i}sortCoordinatesByDistance(e){const t=e.slice(),i=this.transform._camera.position,r=this.transform._camera.forward(),n={};for(const e of t){const t=1/(1<n[e.key]-n[t.key])),t}hasTransition(){if(this._source.hasTransition())return!0;if(St(this._source.type))for(const t in this._tiles){const i=this._tiles[t];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=e.q.now())return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,i){const r=this._tiles[e];r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter((i=>!i.hasDependency(e,t)))}_preloadTiles(t,i){if(!this._sourceLoaded){const e=()=>{this._sourceLoaded&&(this._source.off("data",e),this._preloadTiles(t,i))};return void this._source.on("data",e)}const r=new Map,n=Array.isArray(t)?t:[t],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize;for(const e of n){const t=e.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)r.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1)}const a=Array.from(r.values());e.bl(a,((e,t)=>{const i=new xt(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(i,(e=>{"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),t(e,i)}))}),i)}}function Ct(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function St(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function Et(e,t){const i=1<0:"model"===i.type&&(r=!i.isHidden(e)&&i.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!r&&t.visible,t.visible=r}}updateZOffset(e,t){this.currentBuildingBuckets=[];for(const e of this.layers){const i=e.layer,r=this.style.getLayerSourceCache(i);let n=1;"fill-extrusion"===i.type&&(n=e.visible?i.paint.get("fill-extrusion-vertical-scale"):0);let o=r?r.getTile(t):null;if(!o&&r&&t.canonical.z>r.getSource().minzoom){let e=t.scaledTo(Math.min(r.getSource().maxzoom,t.overscaledZ-1));for(;e.overscaledZ>=r.getSource().minzoom&&(o=r.getTile(e),!o&&0!==e.overscaledZ);)e=e.scaledTo(e.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:o?o.getBucket(i):null,tileID:o?o.tileID:t,verticalScale:n})}e.hasAnyZOffset=!1;let i=!1;for(let r=0;r{e in i&&(r[e]=i[e])})),r}function Pt(e){e=e.slice();const t=Object.create(null);for(let i=0;i0?(n-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}class Qt{constructor(e,t,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;ethis.width||r<0||t>this.height)return!n&&[];const s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return!0;for(let e=0;e0:s}_queryCircle(e,t,i,r,n){const o=e-i,s=e+i,a=t-i,l=t+i;if(s<0||o>this.width||l<0||a>this.height)return!r&&[];const c=[];return this._forEachCell(o,a,s,l,this._queryCellCircle,c,{hitTest:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),r?c.length>0:c}query(e,t,i,r,n){return this._query(e,t,i,r,!1,n)}hitTest(e,t,i,r,n){return this._query(e,t,i,r,!0,n)}hitTestCircle(e,t,i,r){return this._queryCircle(e,t,i,!0,r)}_queryCell(e,t,i,r,n,o,s,a){const l=s.seenUids,c=this.boxCells[n];if(null!==c){const n=this.bboxes;for(const u of c)if(!l.box[u]){l.box[u]=!0;const c=4*u;if(e<=n[c+2]&&t<=n[c+3]&&i>=n[c+0]&&r>=n[c+1]&&(!a||a(this.boxKeys[u]))){if(s.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[u],x1:n[c],y1:n[c+1],x2:n[c+2],y2:n[c+3]})}}}const u=this.circleCells[n];if(null!==u){const n=this.circles;for(const c of u)if(!l.circle[c]){l.circle[c]=!0;const u=3*c;if(this._circleAndRectCollide(n[u],n[u+1],n[u+2],e,t,i,r)&&(!a||a(this.circleKeys[c]))){if(s.hitTest)return o.push(!0),!0;{const e=n[u],t=n[u+1],i=n[u+2];o.push({key:this.circleKeys[c],x1:e-i,y1:t-i,x2:e+i,y2:t+i})}}}}}_queryCellCircle(e,t,i,r,n,o,s,a){const l=s.circle,c=s.seenUids,u=this.boxCells[n];if(null!==u){const e=this.bboxes;for(const t of u)if(!c.box[t]){c.box[t]=!0;const i=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(this.boxKeys[t])))return o.push(!0),!0}}const h=this.circleCells[n];if(null!==h){const e=this.circles;for(const t of h)if(!c.circle[t]){c.circle[t]=!0;const i=3*t;if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(this.circleKeys[t])))return o.push(!0),!0}}}_forEachCell(e,t,i,r,n,o,s,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(n.call(this,e,t,i,r,this.xCellCount*l+d,o,s,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,n,o){const s=r-e,a=n-t,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(e,t,i,r,n,o,s){const a=(o-r)/2,l=Math.abs(e-(r+a));if(l>a+i)return!1;const c=(s-n)/2,u=Math.abs(t-(n+c));if(u>c+i)return!1;if(l<=a||u<=c)return!0;const h=l-a,d=u-c;return h*h+d*d<=i*i}}const jt={unknown:0,flipRequired:1,flipNotRequired:2},Vt=Math.tan(85*Math.PI/180);function Ht(t,i,r,n,o,s,a){const l=e.ad.mat4.create();if(r)if("globe"===s.name){const t=e.bo(o,i);e.ad.mat4.multiply(l,l,t)}else{const t=e.ad.mat2.invert([],a);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],n||e.ad.mat4.rotateZ(l,l,o.angle)}else e.ad.mat4.multiply(l,o.labelPlaneMatrix,t);return l}function Gt(e,t,i,r,n,o,s){const a=Ht(e,t,i,r,n,o,s);return"globe"===o.name&&i||(a[2]=a[6]=a[10]=a[14]=0),a}function $t(t,i,r,n,o,s,a){if(r){if("globe"===s.name){const l=Ht(t,i,r,n,o,s,a);return e.ad.mat4.invert(l,l),e.ad.mat4.multiply(l,t,l),l}{const i=e.ad.mat4.clone(t),r=e.ad.mat4.identity([]);return r[0]=a[0],r[1]=a[1],r[4]=a[2],r[5]=a[3],e.ad.mat4.multiply(i,i,r),n||e.ad.mat4.rotateZ(i,i,-o.angle),i}}return o.glCoordMatrix}function Zt(t,i,r,n){const o=[t,i,r,1];r?e.ad.vec4.transformMat4(o,o,n):ni(o,o,n);const s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function qt(e,t){return Math.min(.5+e/t*.5,1.5)}function Kt(e,t){const i=e[0]/e[3],r=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&r>=-t[1]&&r<=t[1]}function Wt(t,i,r,n,o,s,a,l,c,u){const h=r.transform,d=n?t.textSizeData:t.iconSizeData,p=e.bp(d,r.transform.zoom),f="globe"===h.projection.name,A=[256/r.width*2+1,256/r.height*2+1],m=n?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;m.clear();let g=null;f&&(g=n?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const _=t.lineVertexArray,y=n?t.text.placedSymbolArray:t.icon.placedSymbolArray,v=r.transform.width/r.transform.height;let x,b=!1;for(let n=0;nMath.abs(r)?{useVertical:!0}:t===e.bq.vertical?n>0?{needsFlipping:!0}:null:i!==jt.unknown&&function(e,t){return 0===e||Math.abs(t/e)>Vt}(r,n)?i===jt.flipRequired?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null}function Jt(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v){const x=i/24,b=t.lineOffsetX*x,w=t.lineOffsetY*x,{lineStartIndex:T,glyphStartIndex:B,numGlyphs:C,segment:S,writingMode:E,flipState:M}=t,I=T+t.lineLength,P=t=>{if(h){const[i,r,n]=t.up,o=u.length;e.bs(h,o+0,i,r,n),e.bs(h,o+1,i,r,n),e.bs(h,o+2,i,r,n),e.bs(h,o+3,i,r,n)}const[i,r,n]=t.point;e.bt(u,i,r,n,t.angle)};if(C>1){const e=Xt(x,l,b,w,r,d,p,t,c,s,f,m,!1,g,_,y,v);if(!e)return{notEnoughRoom:!0};if(n&&!r){let[i,r,n]=e.first.point,[o,s,l]=e.last.point;[i,r]=Zt(i,r,n,a),[o,s]=Zt(o,s,l,a);const c=Yt(E,M,(o-i)*A,s-r);if(t.flipState=c&&c.needsFlipping?jt.flipRequired:jt.flipNotRequired,c)return c}P(e.first);for(let e=B+1;e0?s:ti(p,n,i,1,o,void 0,g,_.canonical),l=Yt(E,M,(a[0]-i[0])*A,a[1]-i[1]);if(t.flipState=l&&l.needsFlipping?jt.flipRequired:jt.flipNotRequired,l)return l}const i=ii(x*l.getoffsetX(B),b,w,r,d,p,S,T,I,c,s,f,m,!1,!1,g,_,y,v);if(!i)return{notEnoughRoom:!0};P(i)}return{}}function ei(e,t,i,r,n){const{x:o,y:s,z:a}=r.projectTilePoint(e.x,e.y,t);if(!n)return Zt(o,s,a,i);const[l,c,u]=n(e);return Zt(o+l,s+c,a+u,i)}function ti(t,i,r,n,o,s,a,l){const c=ei(t.sub(i)._unit()._add(t),l,o,a,s);return e.ad.vec3.sub(c,r,c),e.ad.vec3.normalize(c,c),e.ad.vec3.scaleAndAdd(c,r,c,n)}function ii(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y){const v=n?t-i:t+i;let x=v>0?1:-1,b=0;n&&(x*=-1,b=Math.PI),x<0&&(b+=Math.PI);let w=l+a+(x>0?0:1)|0,T=o,B=o,C=0,S=0;const E=Math.abs(v),M=[],I=[];let P=s,L=P,F=e.ad.vec3.zero([]);const k=()=>ti(L,P,B,E-C+1,h,p,m,g.canonical);for(;C+S<=E;){if(w+=x,w=c)return null;if(B=T,L=P,M.push(B),f&&I.push(L),P=new e.P(u.getx(w),u.gety(w)),T=d[w],!T){const e=ei(P,g.canonical,h,m,p);T=e[3]>0?d[w]=e:k()}C+=S;const t=e.ad.vec3.sub([],T,B),i=e.ad.vec3.distance(B,T);if(r&&i>0&&S>0&&e.ad.vec3.dot(F,t)/(S*i)0,p),A=o*f.perspectiveRatio,m=(i.x1*t+r.x-i.padding)*A+f.point.x,g=(i.y1*t+r.y-i.padding)*A+f.point.y,_=(i.x2*t+r.x+i.padding)*A+f.point.x,y=(i.y2*t+r.y+i.padding)*A+f.point.y,v=f.perspectiveRatio<=.55||f.occluded;return!this.isInsideGrid(m,g,_,y)||!n&&this.grid.hitTest(m,g,_,y,a)||v?{box:[],offscreen:!1,occluded:f.occluded}:{box:[m,g,_,y],offscreen:this.isOffscreen(m,g,_,y),occluded:!1}}placeCollisionCircles(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A){const m=[],g=this.transform.elevation,_=t.getProjection(),y=g?g.getAtTileOffsetFunc(A,this.transform.center.lat,this.transform.worldSize,_):null,v=new e.P(r.tileAnchorX,r.tileAnchorY);let{x:x,y:b,z:w}=_.projectTilePoint(v.x,v.y,A.canonical);if(y){const[e,t,i]=y(v);x+=e,b+=t,w+=i}const T="globe"===_.name,B=this.projectAndGetPerspectiveRatio(a,x,b,w,A,T||!!g||this.transform.pitch>0,_),{perspectiveRatio:C}=B,S=(h?s/C:s*C)/e.bw,E=Zt(x,b,w,l),M=r.lineOffsetX*S,I=r.lineOffsetY*S,P=e.ak(t.layers[0].layout.get("text-max-angle")),L=Math.cos(P),F=B.signedDistanceFromCamera>0?Xt(S,o,M,I,!1,E,v,r,n,l,{},g&&!h?y:null,h&&!!g,_,A,h,L):null;let k=!1,z=!1,R=!0;if(F&&!B.occluded){const t=.5*p*C+f,r=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new Nt,{first:s,last:a}=F,l=s.path.length;let h=[];for(let e=l-1;e>=1;e--)h.push(s.path[e]);for(let e=1;e(y&&!T&&(i=y(re[3]<=0))&&(h=[]));let g=[];if(h.length>0){let t=1/0,i=-1/0,o=1/0,s=-1/0;for(const e of h)t=Math.min(t,e[0]),o=Math.min(o,e[1]),i=Math.max(i,e[0]),s=Math.max(s,e[1]);i>=r.x&&t<=n.x&&s>=r.y&&o<=n.y&&(g=[h.map((t=>new e.P(t[0],t[1])))],(tn.x||on.y)&&(g=e.bu(g,r.x,r.y,n.x,n.y)))}for(const e of g){o.reset(e,.25*t);let r=0;r=o.length<=.5*t?1:Math.ceil(o.paddedLength/A)+1;for(let e=0;e0){if(e.ad.vec4.transformMat4(l,l,t),this.fogState&&o&&"globe"!==a.name){const t=function(t,i,r,n,o,s){const a=s.calculateFogTileMatrix(o),l=[i,r,n];return e.ad.vec3.transformMat4(l,l,a),De(t,e.ad.vec3.length(l),s.pitch,s._fov)}(this.fogState,i,r,n,o.toUnwrapped(),this.transform);c=t>.9}}else ni(l,l,t);const u=l[3];return{point:new e.P((l[0]/u+1)/2*this.transform.width+oi,(-l[1]/u+1)/2*this.transform.height+oi),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/u*.5,1.5),signedDistanceFromCamera:u,occluded:s&&l[2]>u||c}}isOffscreen(e,t,i,r){return i=this.screenRightBoundary||rthis.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e=0&&te.collisionGroupID===t}}return this.collisionGroups[e]}}function mi(t,i,r,n,o){const{horizontalAlign:s,verticalAlign:a}=e.bD(t),l=-(s-.5)*i,c=-(a-.5)*r,u=e.bC(t,n);return new e.P(l+u[0]*o,c+u[1]*o)}function gi(t,i,r,n,o){const s=new e.P(t,i);return r&&s._rotate(n?o:-o),s}class _i{constructor(e,t,i,r,n,o){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new si(this.transform,n),this.buildingIndex=o,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new Ai(i),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,i,r,n,o=1){const s=r.getBucket(i),a=r.latestFeatureIndex;if(!s||!a||i.fqid!==s.layerIds[0])return;const l=s.layers[0].layout,c=s.layers[0].paint,u=r.collisionBoxArray,h=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),d=r.tileSize/e.ai,p=r.tileID.toUnwrapped();this.transform.setProjection(s.projection);const f=(A=r.tileID,m=s.getProjection(),g=this.transform,m.name===this.projection?g.calculateProjMatrix(A.toUnwrapped()):ai(g,m,A));var A,m,g;const _="map"===l.get("text-pitch-alignment"),y="map"===l.get("text-rotation-alignment");i.compileFilter(i.options);const v=i.dynamicFilter(),x=i.dynamicFilterNeedsFeature(),b=this.transform.calculatePixelsToTileUnitsMatrix(r),w=Gt(f,r.tileID.canonical,_,y,this.transform,s.getProjection(),b);let T=null;if(_){const t=$t(f,r.tileID.canonical,_,y,this.transform,s.getProjection(),b);T=e.ad.mat4.multiply([],this.transform.labelPlaneMatrix,t)}let B=null;v&&r.latestFeatureIndex&&(B={unwrappedTileID:p,dynamicFilter:v,dynamicFilterNeedsFeature:x}),this.retainedQueryData[s.bucketInstanceId]=new fi(s.bucketInstanceId,a,s.sourceLayerIndex,s.index,r.tileID);const[C,S]=s.layers[0].layout.get("text-size-scale-range"),E=e.ay(o,C,S),[M,I]=l.get("icon-size-scale-range"),P=e.ay(o,M,I),L={bucket:s,layout:l,paint:c,posMatrix:f,textLabelPlaneMatrix:w,labelToScreenMatrix:T,clippingData:B,scale:h,textPixelRatio:d,holdingForFade:r.holdingForFade(),collisionBoxArray:u,partiallyEvaluatedTextSize:e.bp(s.textSizeData,this.transform.zoom,E),partiallyEvaluatedIconSize:e.bp(s.iconSizeData,this.transform.zoom,P),collisionGroup:this.collisionGroups.get(s.sourceID),latestFeatureIndex:r.latestFeatureIndex};if(n)for(const e of s.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=e;t.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:L})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:L})}attemptAnchorPlacement(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g){const{textOffset0:_,textOffset1:y,crossTileID:v}=h,x=[_,y],b=mi(e,i,r,x,n),w=this.collisionIndex.placeCollisionBox(p,n,t,gi(b.x,b.y,o,s,this.transform.angle),u,a,l,c.predicate);if(A){const e=p.getSymbolInstanceIconSize(g,this.transform.zoom,h.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(p,e,A,gi(b.x,b.y,o,s,this.transform.angle),u,a,l,c.predicate).box.length)return}if(w.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[v]&&this.prevPlacement.placements[v]&&this.prevPlacement.placements[v].text&&(t=this.prevPlacement.variableOffsets[v].anchor),this.variableOffsets[v]={textOffset:x,width:i,height:r,anchor:e,textScale:n,prevAnchor:t},this.markUsedJustification(p,e,h,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,h),this.placedOrientations[v]=f),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(t,i,r,n,o=1){const{bucket:s,layout:a,paint:l,posMatrix:c,textLabelPlaneMatrix:u,labelToScreenMatrix:h,clippingData:d,textPixelRatio:p,holdingForFade:f,collisionBoxArray:A,partiallyEvaluatedTextSize:m,partiallyEvaluatedIconSize:g,collisionGroup:_,latestFeatureIndex:y}=t.parameters,v=a.get("text-optional"),x=a.get("icon-optional"),b=a.get("text-allow-overlap"),w=a.get("icon-allow-overlap"),T="map"===a.get("text-rotation-alignment"),B="map"===a.get("text-pitch-alignment"),C=l.get("symbol-z-offset"),S="sea"===a.get("symbol-elevation-reference"),[E,M]=a.get("text-size-scale-range"),[I,P]=a.get("icon-size-scale-range"),L=e.ay(o,E,M),F=e.ay(o,I,P);this.transform.setProjection(s.projection);let k=b&&(w||!s.hasIconData()||x),z=w&&(b||!s.hasTextData()||v);const R=!C.isConstant();!s.collisionArrays&&A&&s.deserializeCollisionBoxes(A),r&&n&&s.updateCollisionDebugBuffers(this.transform.zoom,A,L,F);const D=(t,n,l)=>{const{crossTileID:A,numVerticalGlyphVertices:E}=t;let M=null;if(d&&d.dynamicFilterNeedsFeature||R){const e=this.retainedQueryData[s.bucketInstanceId];M=y.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.sourceLayerIndex,layoutVertexArrayOffset:0})}if(d&&!(0,d.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},M,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new e.P(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(d.unwrappedTileID)))return this.placements[A]=new di(!1,!1,!1,!0),void i.add(A);const I=C.evaluate(M,{});if(i.has(A))return;if(f)return void(this.placements[A]=new di(!1,!1,!1));let P=!1,L=!1,F=!0,D=!1,O=!1,U=null,N={box:null,offscreen:null,occluded:null},Q={box:null,offscreen:null,occluded:null},j=null,V=null,H=null,G=0,$=0,Z=0;l.textFeatureIndex?G=l.textFeatureIndex:t.useRuntimeCollisionCircles&&(G=t.featureIndex),l.verticalTextFeatureIndex&&($=l.verticalTextFeatureIndex);const q=e=>{e.tileID=this.retainedQueryData[s.bucketInstanceId].tileID;const i=this.transform.elevation;e.elevation=S?I:I+(i?i.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0),e.elevation+=t.zOffset},K=l.textBox;if(K){q(K);const i=i=>{let r=e.bq.horizontal;if(s.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[A];e&&(this.placedOrientations[A]=e,r=e,this.markUsedOrientation(s,r,t))}return r},r=(t,i)=>{if(s.allowVerticalPlacement&&E>0&&l.verticalTextBox){for(const r of s.writingModes)if(r===e.bq.vertical?(N=i(),Q=N):N=t(),N&&N.box&&N.box.length)break}else N=t()};if(a.get("text-variable-anchor")){let o=a.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[A]){const e=this.prevPlacement.variableOffsets[A];o.indexOf(e.anchor)>0&&(o=o.filter((t=>t!==e.anchor)),o.unshift(e.anchor))}const u=(e,i,r)=>{const a=s.getSymbolInstanceTextSize(m,t,this.transform.zoom,n),l=(e.x2-e.x1)*a+2*e.padding,u=(e.y2-e.y1)*a+2*e.padding,h=t.hasIconTextFit&&!w?i:null;h&&q(h);let d={box:[],offscreen:!1,occluded:!1};const f=b?2*o.length:o.length;for(let i=0;i=o.length,t,n,s,r,h,m,g);if(f&&(d=f.placedGlyphBoxes,d&&d.box&&d.box.length)){P=!0,U=f.shift;break}}return d};r((()=>u(K,l.iconBox,e.bq.horizontal)),(()=>{const t=l.verticalTextBox;return t&&q(t),s.allowVerticalPlacement&&!(N&&N.box&&N.box.length)&&E>0&&t?u(t,l.verticalIconBox,e.bq.vertical):{box:null,offscreen:null,occluded:null}})),N&&(P=N.box,F=N.offscreen,D=N.occluded);const h=i(!(!N||!N.box));if(!P&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[A];e&&(this.variableOffsets[A]=e,this.markUsedJustification(s,e.anchor,t,h))}}else{const a=(i,r)=>{const a=s.getSymbolInstanceTextSize(m,t,this.transform.zoom,n,o),l=this.collisionIndex.placeCollisionBox(s,a,i,new e.P(0,0),b,p,c,_.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(s,r,t),this.placedOrientations[A]=r),l};r((()=>a(K,e.bq.horizontal)),(()=>{const t=l.verticalTextBox;return s.allowVerticalPlacement&&E>0&&t?(q(t),a(t,e.bq.vertical)):{box:null,offscreen:null,occluded:null}})),i(!!(N&&N.box&&N.box.length))}}if(j=N,P=j&&j.box&&j.box.length>0,F=j&&j.offscreen,D=j&&j.occluded,t.useRuntimeCollisionCircles){const i=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),n=e.br(s.textSizeData,m,i),o=a.get("text-padding");V=this.collisionIndex.placeCollisionCircles(s,b,i,s.lineVertexArray,s.glyphOffsetArray,n,c,u,h,r,B,_.predicate,t.collisionCircleDiameter*n/e.bw,o,this.retainedQueryData[s.bucketInstanceId].tileID),P=b||V.circles.length>0&&!V.collisionDetected,F=F&&V.offscreen,D=V.occluded}if(l.iconFeatureIndex&&(Z=l.iconFeatureIndex),l.iconBox){const i=i=>{q(i);const r=t.hasIconTextFit&&U?gi(U.x,U.y,T,B,this.transform.angle):new e.P(0,0),n=s.getSymbolInstanceIconSize(g,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(s,n,i,r,w,p,c,_.predicate)};Q&&Q.box&&Q.box.length&&l.verticalIconBox?(H=i(l.verticalIconBox),L=H.box.length>0):(H=i(l.iconBox),L=H.box.length>0),F=F&&H.offscreen,O=H.occluded}const W=v||0===t.numHorizontalGlyphVertices&&0===E,X=x||0===t.numIconVertices;if(W||X?X?W||(L=L&&P):P=L&&P:L=P=L&&P,P&&j&&j.box&&this.collisionIndex.insertCollisionBox(j.box,a.get("text-ignore-placement"),s.bucketInstanceId,Q&&Q.box&&$?$:G,_.ID),L&&H&&this.collisionIndex.insertCollisionBox(H.box,a.get("icon-ignore-placement"),s.bucketInstanceId,Z,_.ID),V&&(P&&this.collisionIndex.insertCollisionCircles(V.circles,a.get("text-ignore-placement"),s.bucketInstanceId,G,_.ID),r)){const e=s.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new pi);for(let e=0;e=0;--e){const i=t[e];D(s.symbolInstances.get(i),i,s.collisionArrays[i])}s.hasAnyZOffset&&e.w(`${s.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(s.hasAnyZOffset){const e=s.getSortedIndexesByZOffset();for(let t=0;t=0&&(t.text.placedSymbolArray.get(o).crossTileID=h>=0&&o!==h?0:c),s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=h>=0&&s!==h?0:c),a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=h>=0&&a!==h?0:c),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=h>=0&&l!==h?0:c)}markUsedOrientation(t,i,r){const n=i===e.bq.horizontal||i===e.bq.horizontalOnly?i:0,o=i===e.bq.vertical?i:0,{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=r,u=t.text.placedSymbolArray;s>=0&&(u.get(s).placedOrientation=n),a>=0&&(u.get(a).placedOrientation=n),l>=0&&(u.get(l).placedOrientation=n),c>=0&&(u.get(c).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=n[e];o?(this.opacities[e]=new hi(o,r,t.text,t.icon,null,t.clipped),i=i||t.text!==o.text.placed||t.icon!==o.icon.placed):(this.opacities[e]=new hi(null,r,t.text,t.icon,t.skipFade,t.clipped),i=i||t.text||t.icon)}for(const e in n){const t=n[e];if(!this.opacities[e]){const n=new hi(t,r,!1,!1);n.isHidden()||(this.opacities[e]=n,i=i||t.text.placed||t.icon.placed)}}for(const e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(const e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t,i,r){const n=new Set;for(const o of t){const t=o.getBucket(e);t&&o.latestFeatureIndex&&e.fqid===t.layerIds[0]&&(this.updateBucketOpacities(t,n,o,o.collisionBoxArray,i,r,o.tileID,e.scope),"offset"===t.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(t,o.tileID),"road"===t.elevationType&&t.updateRoadElevation(),t.updateZOffset())}}updateBucketOpacities(t,i,r,n,o,s,a,l){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const c=t.layers[0].layout,u=t.layers[0].paint,h=!!t.layers[0].dynamicFilter(),d=new hi(null,0,!1,!1,!0),p=c.get("text-allow-overlap"),f=c.get("icon-allow-overlap"),A=c.get("text-variable-anchor"),m="map"===c.get("text-rotation-alignment"),g="map"===c.get("text-pitch-alignment"),_=u.get("symbol-z-offset"),y="sea"===c.get("symbol-elevation-reference"),v=!_.isConstant(),x=new hi(null,0,p&&(f||!t.hasIconData()||c.get("icon-optional")),f&&(p||!t.hasTextData()||c.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const b=(e,t,i)=>{for(let r=0;r0||p>0,F=T>0,k=this.placedOrientations[f],z=k===e.bq.vertical,R=k===e.bq.horizontal||k===e.bq.horizontalOnly;!L&&!F||P.isHidden()||w++;let D=!1;if((L||F)&&s)for(const i of t.activeReplacements){if(e.bx(i,o,e.by.Symbol,l))continue;if(i.min.x>B||B>i.max.x||i.min.y>C||C>i.max.y)continue;const t=e.bz(B,C,a.canonical,i.footprintTileId.canonical);if(D=e.bA(t,i.footprint),D)break}if(L){const e=D?Ei:Si(P.text);b(t.text,u,z?Ei:e),b(t.text,p,R?Ei:e);const i=P.text.isHidden(),{leftJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:n,rightJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:s}=c,a=t.text.placedSymbolArray,l=i||z?1:0;r>=0&&(a.get(r).hidden=l),n>=0&&(a.get(n).hidden=l),o>=0&&(a.get(o).hidden=l),s>=0&&(a.get(s).hidden=i||R?1:0);const h=this.variableOffsets[f];h&&this.markUsedJustification(t,h.anchor,c,k);const d=this.placedOrientations[f];d&&(this.markUsedJustification(t,"left",c,d),this.markUsedOrientation(t,d,c))}if(F){const e=D?Ei:Si(P.icon),{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:r}=c,n=t.icon.placedSymbolArray,o=P.icon.isHidden()?1:0;i>=0&&(b(t.icon,T,z?Ei:e),n.get(i).hidden=o),r>=0&&(b(t.icon,c.numVerticalIconVertices,R?Ei:e),n.get(r).hidden=o)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[n];if(i){let r=new e.P(0,0),n=!0;if(i.textBox||i.verticalTextBox){if(A){const e=this.variableOffsets[f];e?(r=mi(e.anchor,e.width,e.height,e.textOffset,e.textScale),m&&r._rotate(g?this.transform.angle:-this.transform.angle)):n=!1}h&&(n=!P.clipped),i.textBox&&yi(t.textCollisionBox.collisionVertexArray,P.text.placed,!n||z,M,y,r.x,r.y),i.verticalTextBox&&yi(t.textCollisionBox.collisionVertexArray,P.text.placed,!n||R,M,y,r.x,r.y)}const o=n&&Boolean(!R&&i.verticalIconBox);i.iconBox&&yi(t.iconCollisionBox.collisionVertexArray,P.icon.placed,o,M,y,c.hasIconTextFit?r.x:0,c.hasIconTextFit?r.y:0),i.verticalIconBox&&yi(t.iconCollisionBox.collisionVertexArray,P.icon.placed,!o,M,y,c.hasIconTextFit?r.x:0,c.hasIconTextFit?r.y:0)}}}if(t.fullyClipped=0===w,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function yi(e,t,i,r,n,o,s){e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0),e.emplaceBack(t?1:0,i?1:0,o||0,s||0,r,n?1:0)}const vi=Math.pow(2,25),xi=Math.pow(2,24),bi=Math.pow(2,17),wi=Math.pow(2,16),Ti=Math.pow(2,9),Bi=Math.pow(2,8),Ci=Math.pow(2,1);function Si(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*vi+t*xi+i*bi+t*wi+i*Ti+t*Bi+i*Ci+t}const Ei=0;class Mi{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,t,i,r,n,o){const s=this._bucketParts;for(;this._currentTileIndexe.sortKey-t.sortKey)));this._currentPartIndex{const t=e.q.now()-s;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const s=i[t[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){const t=s,i=t.layout.get("symbol-z-elevate"),l=void 0!==t.layout.get("symbol-sort-key").constantOr(1),c=t.layout.get("symbol-z-order"),u="viewport-y"===c||"auto"===c&&!("viewport-y"!==c&&l),h=t.layout.get("text-allow-overlap")||t.layout.get("icon-allow-overlap")||t.layout.get("text-ignore-placement")||t.layout.get("icon-ignore-placement"),d=u&&h,p=this._inProgressLayer=this._inProgressLayer||new Mi(t),f=e.C(s.source,s.scope);if(p.continuePlacement(i||d?n[f]:r[f],this.placement,this._showCollisionBoxes,s,a,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Pi=512/e.ai/2;class Li{constructor(t,i,r){this.tileID=t,this.bucketInstanceId=r,this.index=new e.bE(i.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const n=t.canonical.x*e.ai,o=t.canonical.y*e.ai;for(let e=0;ee.overscaledZ)for(const i in n){const o=n[i];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,r)}else{const o=n[e.scaledTo(Number(i)).key];o&&o.findMatches(t.symbolInstances,e,r)}}for(let e=0;e{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}const Ri=771;class Di{constructor(e,t,i,r){this.blendFunction=e,this.blendColor=t,this.mask=i,this.blendEquation=r}}Di.Replace=[1,0,1,0],Di.disabled=new Di(Di.Replace,e.al.transparent,[!1,!1,!1,!1]),Di.unblended=new Di(Di.Replace,e.al.transparent,[!0,!0,!0,!0]),Di.alphaBlended=new Di([1,Ri,1,Ri],e.al.transparent,[!0,!0,!0,!0]),Di.alphaBlendedNonPremultiplied=new Di([770,Ri,770,Ri],e.al.transparent,[!0,!0,!0,!0]),Di.multiply=new Di([774,0,774,0],e.al.transparent,[!0,!0,!0,!0]);class Oi{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}Oi.ReadOnly=!1,Oi.ReadWrite=!0,Oi.disabled=new Oi(519,Oi.ReadOnly,[0,1]);const Ui=7680;class Ni{constructor(e,t,i,r,n,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}Ni.disabled=new Ni({func:519,mask:0},0,0,Ui,Ui,Ui);const Qi=1029,ji=2305;class Vi{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}function Hi(t,i){const r=e.bG(t,3);e.ad.mat4.fromQuat(t,i),e.bI(t,3,r)}function Gi(t,i){const r=e.ad.quat.identity([]);return e.ad.quat.rotateZ(r,r,-i),e.ad.quat.rotateX(r,r,-t),r}function $i(t,i){const r=[t[0],t[1],0],n=[i[0],i[1],0];if(e.ad.vec3.length(r)>=1e-15){const t=e.ad.vec3.normalize([],r);e.ad.vec3.scale(n,t,e.ad.vec3.dot(n,t)),i[0]=n[0],i[1]=n[1]}const o=e.ad.vec3.cross([],i,t);if(e.ad.vec3.len(o)<1e-15)return null;const s=Math.atan2(-o[1],o[0]);return Gi(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),s)}Vi.disabled=new Vi(!1,Qi,ji),Vi.backCCW=new Vi(!0,Qi,ji),Vi.backCW=new Vi(!0,Qi,2304),Vi.frontCW=new Vi(!0,1028,2304),Vi.frontCCW=new Vi(!0,1028,ji);class Zi{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(t){if(t){const i=t instanceof e.ac?t:new e.ac(t[0],t[1],t[2]);this._renderWorldCopies&&(i.x=e.bF(i.x,0,1)),this._position=i}else this._position=null}lookAtPoint(t,i){if(this.orientation=null,!this.position)return;const r=this.position,n=this._elevation?this._elevation.getAtPointOrZero(e.ac.fromLngLat(t)):0,o=e.ac.fromLngLat(t,n),s=[o.x-r.x,o.y-r.y,o.z-r.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=$i(s,i)}setPitchBearing(t,i){this.orientation=Gi(e.ak(t),e.ak(-i))}}class qi{constructor(t,i){this._transform=e.ad.mat4.identity([]),this.orientation=i,this.position=t}get mercatorPosition(){const t=this.position;return new e.ac(t[0],t[1],t[2])}get position(){const t=e.bG(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var i;t&&e.bI(this._transform,3,[(i=t)[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.ad.quat.identity([]),t&&Hi(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=Gi(e,t),Hi(this._transform,this._orientation)}forward(){const t=e.bG(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=e.bG(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=e.bG(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,i){const r=new Float64Array(16);return e.ad.mat4.invert(r,this.getWorldToCamera(t,i)),r}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,i,r){const n=this.position;e.ad.vec3.scale(n,n,-t);const o=new Float64Array(16);return e.ad.mat4.fromScaling(o,[r,r,r]),e.ad.mat4.translate(o,o,n),o[10]*=i,o}getWorldToCamera(t,i){const r=new Float64Array(16),n=new Float64Array(4),o=this.position;return e.ad.quat.conjugate(n,this._orientation),e.ad.vec3.scale(o,o,-t),e.ad.mat4.fromQuat(r,n),e.ad.mat4.translate(r,r,o),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=i,r[9]*=i,r[10]*=i,r[11]*=i,r}getCameraToClipPerspective(t,i,r,n){const o=new Float64Array(16);return e.ad.mat4.perspective(o,t,i,r,n),o}getCameraToClipOrthographic(t,i,r,n,o,s){const a=new Float64Array(16);return e.ad.mat4.ortho(a,t,i,r,n,o,s),a}getDistanceToElevation(t,i=!1){const r=0===t?0:e.bH(t,i?e.aT(this.position[1]):this.position[1]),n=this.forward();return(r-this.position[2])/n[2]}clone(){return new qi([...this.position],[...this.orientation])}}const Ki={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Wi{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=r}interpolate(t,i,r){return null!=i.top&&null!=t.top&&(this.top=e.ah(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.ah(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=e.ah(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=e.ah(t.right,i.right,r)),this}getCenter(t,i){const r=e.ay((this.left+t-this.right)/2,0,t),n=e.ay((this.top+i-this.bottom)/2,0,i);return new e.P(r,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Wi(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Xi=15;class Yi{constructor(t,i,r,n,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=r??0,this._maxPitch=n??60,this.setProjection(s),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new e.bO(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Wi,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new qi,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const e=new Yi(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e._allowWorldUnderZoom=this._allowWorldUnderZoom,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!t||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const i=this._elevation;t||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&i.exaggeration()&&this._centerAltitudeValidForExaggeration!==i.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*i.exaggeration(),this._centerAltitudeValidForExaggeration=i.exaggeration()):(this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=i.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop();let n=0,o=0;for(let s=0;s{const l=e.c5(i,t,r,o,s);a.has(l)||(n.push(new e.aH(t,i,r,o,s)),a.add(l))};for(let e=0;e0,f=a.y+10,m=n.wrap-(p?0:1),g=n.wrap+(d?0:1),_=p?a.x-1:h-1,y=d?a.x+1:0;if(o)r[0]<0?(l(c,g,a.z,y,a.y),r[1]<0&&f&&(l(c,u,a.z,a.x,a.y+1),l(c,g,a.z,y,a.y+1)),r[1]>0&&A&&(l(c,u,a.z,a.x,a.y-1),l(c,g,a.z,y,a.y-1))):r[0]>0?(l(c,m,a.z,_,a.y),r[1]<0&&f&&(l(c,u,a.z,a.x,a.y+1),l(c,m,a.z,_,a.y+1)),r[1]>0&&A&&(l(c,u,a.z,a.x,a.y-1),l(c,m,a.z,_,a.y-1))):r[1]<0&&f?l(c,u,a.z,a.x,a.y+1):A&&l(c,u,a.z,a.x,a.y-1);else{const e=n.visibleQuadrants;1&e&&(l(c,m,a.z,_,a.y),A&&(l(c,u,a.z,a.x,a.y-1),l(c,m,a.z,_,a.y-1))),2&e&&(l(c,g,a.z,y,a.y),A&&(l(c,u,a.z,a.x,a.y-1),l(c,g,a.z,y,a.y-1))),4&e&&(l(c,m,a.z,_,a.y),f&&(l(c,u,a.z,a.x,a.y+1),l(c,m,a.z,_,a.y+1))),8&e&&(l(c,g,a.z,y,a.y),f&&(l(c,u,a.z,a.x,a.y+1),l(c,g,a.z,y,a.y+1)))}}const c=[];for(const e of n)n.some((t=>e.isChildOf(t)))||c.push(e);if(n=c.filter((e=>!t.some((t=>!!(e.overscaledZ{const t=e.canonical.x+.5-r[0],i=e.canonical.y+.5-r[1];return t*t+i*it.maxzoom&&(i=t.maxzoom);const a=this.locationCoordinate(this.center),l=this.center.lat,c=1<{const i=1/4e4,r=new e.ac(t.x+i,t.y,t.z),n=new e.ac(t.x,t.y+i,t.z),o=t.toLngLat(),s=r.toLngLat(),a=n.toLngLat(),l=this.locationCoordinate(o),c=this.locationCoordinate(s),u=this.locationCoordinate(a),h=Math.hypot(c.x-l.x,c.y-l.y),d=Math.hypot(u.x-l.x,u.y-l.y);return Math.sqrt(h*d)*w/i},B=t=>{const i=x,r=b;return{aabb:e.bV(this,c,0,0,0,t,r,i,this.projection),zoom:0,x:0,y:0,minZ:r,maxZ:i,wrap:t,fullyVisible:!1}},C=[];let S=[];const E=i,M=t.reparseOverscaled?r:i,I=(m-this._centerAltitude)*A,P=e=>{if(!this._elevation||!e.tileID||!s)return;const t=this._elevation.getMinMaxForTile(e.tileID),i=e.aabb;t?(i.min[2]=t.min,i.max[2]=t.max,i.center[2]=(i.min[2]+i.max[2])/2):(e.shouldSplit=F(e),e.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude))},L=(e,t)=>{if(.707*t{if(t.zoom=.9)return!0}else if(o&&(a=t.aabb.distanceZ(g)*A),this.projection.isReprojectedInTileSpace&&r<=5){const i=Math.pow(2,t.zoom),r=T(new e.ac((t.x+.5)/i,(t.y+.5)/i));c=r>.85?1:r}if(!s){const e=Math.sqrt(i*i+n*n+a*a);let r=(1<0;){const r=C.pop(),n=r.x,a=r.y;let l=r.fullyVisible;const d=()=>"globe"===this.projection.name&&(0===r.y||r.y===(1<>1),d={aabb:s?r.aabb.quadrant(t):e.bV(this,c,r.zoom+1,i,u,r.wrap,r.minZ,r.maxZ,this.projection),zoom:r.zoom+1,x:i,y:u,wrap:r.wrap,fullyVisible:l,tileID:void 0,shouldSplit:void 0,minZ:r.minZ,maxZ:r.maxZ};o&&!h&&(d.tileID=new e.aH(r.zoom+1===E?M:r.zoom+1,r.wrap,r.zoom+1,i,u),P(d)),C.push(d)}else{const o=r.zoom===E?M:r.zoom;if(t.minzoom&&t.minzoom>o)continue;let s=0;if(!l){let i=_?r.aabb.intersectsPrecise(p):r.aabb.intersectsPreciseFlat(p);if(0===i&&d()){const t=new e.bT(r.zoom,n,a);i=e.bU(this,c,t,!0).intersectsPrecise(p)}if(0===i)continue;if(t.calculateQuadrantVisibility)if(p.containsPoint(r.aabb.center))s=15;else for(let e=0;e<4;e++)0!==r.aabb.quadrant(e).intersects(p)&&(s|=1<{const o=[0,0,0,1],s=[e.ai,e.ai,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());e.ad.vec4.transformMat4(o,o,a),e.ad.vec4.transformMat4(s,s,a);const l=e.ad.vec4.min([],o,s),c=e.ad.vec4.max([],o,s),u=e.bW(l,c);if(0===u)return!0;let h=!1;const d=this._elevation;if(d&&u>i&&0!==r){const i=this.calculateProjMatrix(n.tileID.toUnwrapped());let o;t.isTerrainDEM||(o=d.getMinMaxForTile(n.tileID)),o||(o={min:b,max:x});const s=e.c7(this.rotation),a=[s[0]*e.ai,s[1]*e.ai,o.max];e.ad.vec3.transformMat4(a,a,i),h=(1-a[1])*this.height*.5e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const i=e.ay(t.lat,-e.bX,e.bX),r=this.projection.project(t.lng,i);return new e.P(r.x*this.worldSize,r.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.bH(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,i){let r,n;const o=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;r=(i.x-o.x)/e,n=(i.y-o.y)/e}else{const e=this.pointCoordinate(i),t=this.pointCoordinate(o);r=e.x-t.x,n=e.y-t.y}const s=this.locationCoordinate(t);this.setLocation(new e.ac(s.x-r,s.y-n))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e,t){return this.projection.locationPoint(this,e,t)}locationPoint3D(e,t){return this.projection.locationPoint(this,e,t,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e,t){return this.coordinateLocation(this.pointCoordinate3D(e,t))}locationCoordinate(t,i){const r=i?e.bH(i,t.lat):void 0,n=this.projection.project(t.lng,t.lat);return new e.ac(n.x,n.y,r)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,i){const r=null!=i?i:this._centerAltitude,n=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.ad.vec4.transformMat4(n,n,this.pixelMatrixInverse),e.ad.vec4.transformMat4(o,o,this.pixelMatrixInverse);const s=o[3];e.ad.vec4.scale(n,n,1/n[3]),e.ad.vec4.scale(o,o,1/s);const a=n[2],l=o[2];return{p0:n,p1:o,t:a===l?0:(r-a)/(l-a)}}screenPointToMercatorRay(t){const i=[t.x,t.y,0,1],r=[t.x,t.y,1,1];return e.ad.vec4.transformMat4(i,i,this.pixelMatrixInverse),e.ad.vec4.transformMat4(r,r,this.pixelMatrixInverse),e.ad.vec4.scale(i,i,1/i[3]),e.ad.vec4.scale(r,r,1/r[3]),i[2]=e.bH(i[2],this._center.lat)*this.worldSize,r[2]=e.bH(r[2],this._center.lat)*this.worldSize,e.ad.vec4.scale(i,i,1/this.worldSize),e.ad.vec4.scale(r,r,1/this.worldSize),new e.as([i[0],i[1],i[2]],e.ad.vec3.normalize([],e.ad.vec3.sub([],r,i)))}rayIntersectionCoordinate(t){const{p0:i,p1:r,t:n}=t,o=e.bH(i[2],this._center.lat),s=e.bH(r[2],this._center.lat);return new e.ac(e.ah(i[0],r[0],n)/this.worldSize,e.ah(i[1],r[1],n)/this.worldSize,e.ah(o,s,n))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t,i){if(!this.elevation)return this.pointCoordinate(t,i);let r=this.projection.pointCoordinate3D(this,t.x,t.y);if(r)return new e.ac(r[0],r[1],r[2]);let n=0,o=this.horizonLineFromTop();if(t.y>o)return this.pointCoordinate(t,i);const s=.02*o,a=t.clone();for(let t=0;t<10&&o-n>s;t++){a.y=e.ah(n,o,.66);const t=this.projection.pointCoordinate3D(this,a.x,a.y);t?(o=a.y,r=t):n=a.y}return r?new e.ac(r[0],r[1],r[2]):this.pointCoordinate(t)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=e.bY)return!this.isPointAboveHorizon(t);const i=this.pointCoordinate(t);return i.y>=0&&i.y<=1}_coordinatePoint(t,i){const r=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,n=[t.x*this.worldSize,t.y*this.worldSize,r+t.toAltitude(),1];return e.ad.vec4.transformMat4(n,n,this.pixelMatrix),n[3]>0?new e.P(n[0]/n[3],n[1]/n[3]):new e.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:i}=this._edgeInsets,r=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,o=this.pointLocation3D(new e.P(i,t)),s=this.pointLocation3D(new e.P(n,t)),a=this.pointLocation3D(new e.P(n,r)),l=this.pointLocation3D(new e.P(i,r));let c=Math.min(o.lng,s.lng,a.lng,l.lng),u=Math.max(o.lng,s.lng,a.lng,l.lng),h=Math.min(o.lat,s.lat,a.lat,l.lat),d=Math.max(o.lat,s.lat,a.lat,l.lat);const p=Math.pow(2,-this.zoom)/16*270,f="globe"===this.projection.name?1:4,A=(t,i,r,n,o)=>{const s=(t+r)/2,a=(i+n)/2,l=new e.P(s,a),{lng:m,lat:g}=this.pointLocation3D(l),_=Math.max(0,c-m,h-g,m-u,g-d);c=Math.min(c,m),u=Math.max(u,m),h=Math.min(h,g),d=Math.max(d,g),(op)&&(A(t,i,s,a,o+1),A(s,a,r,n,o+1))};if(A(i,t,n,t,1),A(n,t,n,r,1),A(n,r,i,r,1),A(i,r,i,t,1),"globe"===this.projection.name){const[t,i]=e.bZ(this);t?(d=90,u=180,c=-180):i&&(h=-90,u=180,c=-180)}return new e.aB(new e.bO(c,h),new e.bO(u,d))}_getBoundsRectangular(t,i){const{top:r,left:n}=this._edgeInsets,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,a=new e.P(n,r),l=new e.P(s,r),c=new e.P(s,o),u=new e.P(n,o);let h=this.pointCoordinate(a,t),d=this.pointCoordinate(l,t);const p=this.pointCoordinate(c,i),f=this.pointCoordinate(u,i),A=(e,t)=>(t.y-e.y)/(t.x-e.x);return h.y>1&&d.y>=0?h=new e.ac((1-f.y)/A(f,h)+f.x,1):h.y<0&&d.y<=1&&(h=new e.ac(-f.y/A(f,h)+f.x,0)),d.y>1&&h.y>=0?d=new e.ac((1-p.y)/A(p,d)+p.x,1):d.y<0&&h.y<=1&&(d=new e.ac(-p.y/A(p,d)+p.x,0)),(new e.aB).extend(this.coordinateLocation(h)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(p))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce(((e,t)=>{if(t.dem){const i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0])}return e}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-e.bX,this.maxLat=e.bX,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLngh&&(a=h-c),h-ut&&(s=t-l),t-e{for(let o=0;o<16;o++)t[o]=e.ah(i[o],r[o],n)})(a,a,l,e.c9(this.pitch>=Xi?1:this.pitch/Xi))}else a=l;const c=e.ad.mat4.mul([],l,s);let u=e.ad.mat4.mul([],a,s);if(this.projection.isReprojectedInTileSpace){const t=this.locationCoordinate(this.center),i=e.ad.mat4.identity([]);e.ad.mat4.translate(i,i,[t.x*this.worldSize,t.y*this.worldSize,0]),e.ad.mat4.multiply(i,i,e.c0(this)),e.ad.mat4.translate(i,i,[-t.x*this.worldSize,-t.y*this.worldSize,0]),e.ad.mat4.multiply(u,u,i),e.ad.mat4.multiply(c,c,i),this.inverseAdjustmentMatrix=e.c1(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.ad.mat4.scale([],u,[this.worldSize,this.worldSize,this.worldSize/o,1]),this.projMatrix=u,this.invProjMatrix=e.ad.mat4.invert(new Float64Array(16),this.projMatrix),i){const i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);i[8]=2*-t.x/this.width,i[9]=2*t.y/this.height,this.expandedFarZProjMatrix=e.ad.mat4.mul([],i,s)}else this.expandedFarZProjMatrix=this.projMatrix;const h=e.ad.mat4.invert([],a);this.frustumCorners=e.c2.fromInvProjectionMatrix(h,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!i);const d=new Float32Array(16);e.ad.mat4.identity(d),e.ad.mat4.scale(d,d,[1,-1,1]),e.ad.mat4.rotateX(d,d,this._pitch),e.ad.mat4.rotateZ(d,d,this.angle);const p=e.ad.mat4.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.ad.mat4.clone(p);const f=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;p[8]=2*-t.x/this.width,p[9]=2*(t.y+f)/this.height,this.skyboxMatrix=e.ad.mat4.multiply(d,p,d);const A=this.point,m=A.x,g=A.y,_=this.width%2/2,y=this.height%2/2,v=Math.cos(this.angle),x=Math.sin(this.angle),b=m-Math.round(m)+v*_+x*y,w=g-Math.round(g)+v*y+x*_,T=new Float64Array(u);if(e.ad.mat4.translate(T,T,[b>.5?b-1:b,w>.5?w-1:w,0]),this.alignedProjMatrix=T,u=e.ad.mat4.create(),e.ad.mat4.scale(u,u,[this.width/2,-this.height/2,1]),e.ad.mat4.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=e.ad.mat4.create(),e.ad.mat4.scale(u,u,[1,-1,1]),e.ad.mat4.translate(u,u,[-1,-1,0]),e.ad.mat4.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.pixelMatrix=e.ad.mat4.multiply(new Float64Array(16),this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},u=e.ad.mat4.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=u,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.c3(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.ad.vec3.transformMat4(t,t,s),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=u;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,r=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,o=[t,t,i];e.ad.vec3.scale(o,o,n),e.ad.vec3.scale(r,r,-1),e.ad.vec3.multiply(r,r,o);const s=e.ad.mat4.create();e.ad.mat4.translate(s,s,r),e.ad.mat4.scale(s,s,o),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,n)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),r=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[r.x/this.worldSize-i[0]*n,r.y/this.worldSize-i[1]*n,e/this.worldSize*this._centerAltitude-i[2]*n]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=this._camera.position[2],n=t[2];let o=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(o=Math.min((i-r)/n,1)),this._camera.position=e.ad.vec3.scaleAndAdd([],this._camera.position,t,o),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,i=this._camera.forward(),{pitch:r,bearing:n}=this._camera.getPitchBearing(),o=e.bH(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.ak(this._maxPitch)),a=Math.max((t[2]-o)/Math.cos(r),s),l=this._zoomFromMercatorZ(a);e.ad.vec3.scaleAndAdd(t,t,i,a),this._pitch=e.ay(r,e.ak(this.minPitch),e.ak(this.maxPitch)),this.angle=e.bF(n,-Math.PI,Math.PI),this._setZoom(e.ay(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.ac(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(t){let i=0,r=e.bY,n=0,o=1/0;for(;r-i>1e-6&&r>i;){const e=i+.5*(r-i),s=this.tileSize*Math.pow(2,e),a=this.getCameraToCenterDistance(this.projection,e,s),l=this.scaleZoom(a/(t*this.tileSize)),c=Math.abs(e-l);cc||i.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.c4(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(t,i){const r=e.ad.vec3.length(e.ad.vec3.sub([],this._camera.position,t)),n=this._zoomFromMercatorZ(r)+i;return r-this._mercatorZfromZoom(n)}getCameraPoint(){if("globe"===this.projection.name){const t=function([t,i,r],n){const o=[t,i,r,1];e.ad.vec4.transformMat4(o,o,n);const s=o[3]=Math.max(o[3],1e-6);return o[0]/=s,o[1]/=s,o[2]/=s,o}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}}getCameraToCenterDistance(t,i=this.zoom,r=this.worldSize){const n=e.b$(t,i,this.width,this.height,1024),o=t.pixelSpaceConversion(this.center.lat,r,n);let s=.5/Math.tan(.5*this._fov)*this.height*o;return this.isOrthographic&&(s=e.ah(1,s,e.c9(this.pitch>=Xi?1:this.pitch/Xi))),s}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.ad.mat4.multiply(t,t,this.globeMatrix),t}getFrustum(t){return e.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,"meters"===this.projection.zAxisUnit)}}const Ji=(t,i)=>{if(i>0&&t.terrain&&e.w("Cutoff is currently disabled on terrain"),i<=0||t.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const r=t.transform,n=Math.max(Math.abs(r._zoom-(t.minCutoffZoom-1)),1),o=r.isLODDisabled(!1)?e.ae(60,45,r.pitch):e.ae(30,15,r.pitch),s=r._farZ-r._nearZ,a=i*r.height,l=((1-(c=o))*r.cameraToCenterDistance+c*(r._farZ+a))*n;var c;return{shouldRenderCutoff:o<1,uniformValues:{u_cutoff_params:[r._nearZ,r._farZ,(l-r._nearZ)/s,(l-a-r._nearZ)/s]}}},er={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class tr{constructor(e,t){this.aabb=e,this.lastCascade=t}}class ir{add(e,t){const i=this.receivers[e.key];void 0!==i?(i.aabb.min[0]=Math.min(i.aabb.min[0],t.min[0]),i.aabb.min[1]=Math.min(i.aabb.min[1],t.min[1]),i.aabb.min[2]=Math.min(i.aabb.min[2],t.min[2]),i.aabb.max[0]=Math.max(i.aabb.max[0],t.max[0]),i.aabb.max[1]=Math.max(i.aabb.max[1],t.max[1]),i.aabb.max[2]=Math.max(i.aabb.max[2],t.max[2])):this.receivers[e.key]=new tr(t,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(t,i,r){const n=e.ce.fromPoints(t.points);let o=0;for(const t in this.receivers){const s=this.receivers[t];if(!s)continue;if(!n.intersectsAabb(s.aabb))continue;s.aabb.min=n.closestPoint(s.aabb.min),s.aabb.max=n.closestPoint(s.aabb.max);const a=s.aabb.getCorners();for(let t=0;t1||s[1]<-1||s[1]>1){n=!1;break}}if(s.lastCascade=t,o=Math.max(o,t),n)break}}return o+1}}class rr{constructor(e){this.painter=e,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new ir,this._depthMode=new Oi(e.context.gl.LEQUAL,Oi.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,e.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},(()=>{this.painter.style.map.triggerRepaint()})),e.tp.registerParameter(er,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),e.tp.registerParameter(er,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),e.tp.registerParameter(er,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),e.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,i){const r=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!i||!i.properties)return;const n=i.properties.get("shadow-intensity");if(!i.shadowsEnabled()||n<=0)return;if(this._shadowLayerCount=r.style.order.reduce(((e,i)=>{const n=r.style._mergedLayers[i];return e+(n.hasShadowPass()&&!n.isHidden(t.zoom)?1:0)}),0),this._enabled=this._shadowLayerCount>0,!this.enabled)return;const o=r.context,s=er.shadowMapResolution,a=er.shadowMapResolution;if(0===this._cascades.length||er.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let t=0;te.dem)).forEach((e=>{const t=e.dem.tree;i[0]=Math.min(i[0],t.minimums[0]),i[1]=Math.max(i[1],t.maximums[0])})),1e4!==i[0]&&(l=(i[1]-i[0])*e.exaggeration())}const c=1.5*t.cameraToCenterDistance,u=3*c,h=new Float64Array(16);for(let i=0;i=0)return{};const o=function(t,i,r){const n=r/(1<0&&(e.ad.vec3.add(o[1],o[1],[n[0]*s,0,0]),e.ad.vec3.add(o[2],o[2],[n[0]*s,0,0])),n[1]<0?(e.ad.vec3.add(o[0],o[0],[0,n[1]*s,0]),e.ad.vec3.add(o[1],o[1],[0,n[1]*s,0])):n[1]>0&&(e.ad.vec3.add(o[2],o[2],[0,n[1]*s,0]),e.ad.vec3.add(o[3],o[3],[0,n[1]*s,0]));const a={};return a.vertices=o,a.planes=[nr(o[1],o[0],o[4]),nr(o[2],o[1],o[5]),nr(o[3],o[2],o[6]),nr(o[0],o[3],o[7])],a}addShadowReceiver(t,i,r){this._receivers.add(t,e.ce.fromTileIdAndHeight(t,i,r))}getMaxCascadeForTile(e){const t=this._receivers.get(e);return t&&t.lastCascade?t.lastCascade:0}}function nr(t,i,r){const n=e.ad.vec3.sub([],r,i),o=e.ad.vec3.sub([],t,i),s=e.ad.vec3.cross([],n,o),a=e.ad.vec3.length(s);return 0===a?[0,0,1,0]:(e.ad.vec3.scale(s,s,1/a),[s[0],s[1],s[2],-e.ad.vec3.dot(s,i)])}function or(t){const i=t.properties.get("direction"),r=e.cc(i.x,i.y,i.z);r[2]=e.ay(r[2],0,75);const n=e.cf([r[0],r[1],r[2]]);return e.ad.vec3.fromValues(n.x,n.y,n.z)}function sr(t,i,r){const n="none"===i.properties.get("color-use-theme"),o=i.properties.get("color"),s=i.properties.get("intensity"),a=i.properties.get("direction"),l=[a.x,a.y,a.z],c="none"===r.properties.get("color-use-theme"),u=r.properties.get("color"),h=r.properties.get("intensity"),d=Math.max(e.ad.vec3.dot([0,0,1],l),0),p=[0,0,0];e.ad.vec3.scale(p,u.toRenderColor(c?null:t.getLut(i.scope)).toArray01Linear().slice(0,3),h);const f=[0,0,0];return e.ad.vec3.scale(f,o.toRenderColor(n?null:t.getLut(r.scope)).toArray01Linear().slice(0,3),d*s),e.cg([p[0]>0?p[0]/(p[0]+f[0]):0,p[1]>0?p[1]/(p[1]+f[1]):0,p[2]>0?p[2]/(p[2]+f[2]):0])}function ar(t,i,r,n,o,s){const a=t.zoom,l=t.scale,c=t.worldSize,u=1/c,h=t.aspect,d=Math.sqrt(1+h*h)*Math.tan(.5*t.fovX),p=d*d,f=n-r,A=n+r;let m,g;p>f/A?(m=n,g=n*d):(m=.5*A*(1+p),g=.5*Math.sqrt(f*f+2*(n*n+r*r)*p+A*A*p*p));const _=t.projection.pixelsPerMeter(t.center.lat,c),y=t._camera.getCameraToWorldMercator(),v=[0,0,-m*u];e.ad.vec3.transformMat4(v,v,y);let x=g*u;const b=t._edgeInsets;if(!(0===b.left&&0===b.top&&0===b.right&&0===b.bottom||b.left===b.right&&b.top===b.bottom)){const i=t._camera.getWorldToCamera(t.worldSize,"meters"===t.projection.zAxisUnit?_:1),o=t._camera.getCameraToClipPerspective(t._fov,t.width/t.height,r,n);o[8]=2*-t.centerOffset.x/t.width,o[9]=2*t.centerOffset.y/t.height;const s=new Float64Array(16);e.ad.mat4.mul(s,o,i);const u=new Float64Array(16);e.ad.mat4.invert(u,s);const h=e.bR.fromInvProjectionMatrix(u,c,a,!0);for(const i of h.points){const r=((w=i)[0]/=l,w[1]/=l,w[2]=e.bH(w[2],t._center.lat),w);x=Math.max(x,e.ad.vec3.len(e.ad.vec3.subtract([],v,r)))}}var w;x*=o/(o-1);const T=Math.acos(i[2]),B=Math.atan2(-i[0],-i[1]),C=new qi;C.position=v,C.setPitchBearing(T,B);const S=C.getWorldToCamera(c,_),E=x*c,M=Math.min(t._mercatorZfromZoom(17)*c*-2,-2*E),I=C.getCameraToClipOrthographic(-E,E,-E,E,M,(E+s*_)/i[2]),P=new Float64Array(16);e.ad.mat4.multiply(P,I,S);const L=e.ad.vec3.fromValues(Math.floor(1e6*v[0])/1e6*c,Math.floor(1e6*v[1])/1e6*c,0),F=.5*o,k=[0,0,0];e.ad.vec3.transformMat4(k,L,P),e.ad.vec3.scale(k,k,F);const z=[Math.floor(k[0]),Math.floor(k[1]),Math.floor(k[2])],R=[0,0,0];e.ad.vec3.sub(R,k,z),e.ad.vec3.scale(R,R,-1/F);const D=new Float64Array(16);return e.ad.mat4.identity(D),e.ad.mat4.translate(D,D,R),e.ad.mat4.multiply(P,D,P),[P,E]}class lr extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.modelUris={"":{}},this.numModelsLoading={}}loadModel(t,i){return e.aN(this.requestManager.transformRequest(i,e.R.Model).url).then((i=>{if(!i)return;const r=e.aO(i),n=new e.aP(t,void 0,void 0,r);return n.computeBoundsAndApplyParent(),n})).catch((r=>{if(r&&404===r.status)return null;this.fire(new e.z(new Error(`Could not load model ${t} from ${i}: ${r.message}`)))}))}load(t,i,r={keepNumReferences:!1}){this.models[i]||(this.models[i]={});const n=Object.keys(t);this.numModelsLoading[i]=(this.numModelsLoading[i]||0)+n.length;const o=[];for(const e of n)o.push(this.loadModel(e,t[e]));Promise.allSettled(o).then((t=>{for(let e=0;e{this.fire(new e.z(new Error(`Could not load models: ${t.message}`)))}))}isLoaded(){for(const e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,t){return!!this.getModel(e,t)}getModel(e,t){return this.models[t]||(this.models[t]={}),this.models[t][e]?this.models[t][e].model:void 0}addModel(e,t,i){this.models[i]||(this.models[i]={}),this.modelUris[i]||(this.modelUris[i]={}),this.hasModel(e,i)&&this.models[i][e].numReferences++,this.modelUris[i][e]=this.requestManager.normalizeModelURL(t),this.load({[e]:this.modelUris[i][e]},i)}addModels(e,t){this.models[t]||(this.models[t]={}),this.modelUris[t]||(this.modelUris[t]={});const i=this.modelUris[t];for(const r in e)this.models[t][r]={},i[r]=this.requestManager.normalizeModelURL(e[r]);this.load(i,t,{keepNumReferences:!0})}reloadModels(e){this.load(this.modelUris[e],e)}addModelsFromBucket(e,t){this.models[t]||(this.models[t]={}),this.modelUris[t]||(this.modelUris[t]={});const i={};for(const r of e)this.hasModel(r,t)?this.models[t][r].numReferences++:(this.modelUris[t][r]=this.requestManager.normalizeModelURL(r),i[r]=this.modelUris[t][r]);this.load(i,t)}removeModel(e,t){if(this.models[t]&&this.models[t][e]&&(this.models[t][e].numReferences--,0===this.models[t][e].numReferences)){const i=this.models[t][e].model;delete this.models[t][e],delete this.modelUris[t][e],i.destroy()}}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,t){this.models[t]||(this.models[t]={});for(const i in this.models[t])this.models[t][i].model&&this.models[t][i].model.upload(e.context)}}const cr=new e.a7({data:new e.a8(e.a5.colorTheme.data)}),ur={"mbx-indoor-active-floorplans":{default:["literal",[]]},"mbx-indoor-underground":{default:["literal",!1]},"mbx-indoor-loaded-levels":{default:["literal",[]]},"mbx-indoor-level-height":{default:["literal",{}]},"mbx-indoor-level-base":{default:["literal",{}]},"mbx-indoor-level-selected":{default:["literal",{}]},"mbx-indoor-level-overlapped":{default:["literal",{}]}};function hr(e){return e=e||{},Object.assign(e,ur)}class dr extends e.E{constructor(t){super(),this.mergeFloors=!0,this._scope=void 0,this._queryFeatureSetId=void 0,this._buildingEntryFeatureSetId=void 0,this._selectedFloorplan=void 0,this._indoorData=void 0,this._selectedLevel=void 0,this._floorplanStates={},e.aQ(["_onLoad","_onMove","_checkFloorplanVisible"],this),this._map=t,this._checkFloorplanVisible(!0),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=void 0}_onLoad(){this._map.style.forEachFragmentStyle((t=>{t.stylesheet.indoor&&(this._queryFeatureSetId?this.fire(new e.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._queryFeatureSetId=t.stylesheet.indoor.floorplanFeaturesetId,this._buildingEntryFeatureSetId=t.stylesheet.indoor.buildingFeaturesetId,this._scope=t.scope))})),this._queryFeatureSetId&&this._buildingEntryFeatureSetId&&this._map.addInteraction("mbx-indoor-buildingclick",{type:"click",target:{featuresetId:this._buildingEntryFeatureSetId,importId:this._scope},handler:e=>(e.feature&&e.feature.properties.floorplan&&this.selectFloorplan(e.feature.properties.floorplan),!0)}),this._checkFloorplanVisible(!0)}_onMove(){this._checkFloorplanVisible(!1)}_checkFloorplanVisible(t){if(!this._queryFeatureSetId)return;if(!this._map.isStyleLoaded())return;if(this._map.transform.zoom<13)return;this._indoorData&&!function(e,t){const[i,r]=e,{center:n,radius:o}=t,[s,a]=n,l=Math.abs(i-s);return Math.sqrt((l>180?360-l:l)**2+(r-a)**2)<=o}([this._map.getCenter().lng,this._map.getCenter().lat],this._indoorData.circumCircle)&&(this._indoorData=void 0,this._selectedFloorplan=void 0,this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",["literal",[]]),this.fire(new e.A("floorplangone")));const i={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},r=new e.P(this._map.transform.width/2,this._map.transform.height/2),n=[new e.P(0,0),new e.P(this._map.transform.width,this._map.transform.height)],o=this._map.queryRenderedFeatures(t?n:r,i);o.length>0&&(this._selectedFloorplan&&o[0].properties.id===this._selectedFloorplan.properties.id||(this._selectedFloorplan=o[0],this._floorplanSelected(!1)))}_floorplanSelected(t){this._indoorData=JSON.parse(this._selectedFloorplan.properties["indoor-data"]),this._indoorData.id=this._selectedFloorplan.properties.id,this._indoorData.circumCircle=function(e){const[[t,i],[r,n]]=e,o=(r-t+360)%360,s=o>180?360-o:o;return{center:[(t+s/2+360)%360,(i+n)/2],radius:Math.sqrt(s**2+(n-i)**2)/2}}(this._indoorData.extent),this._floorplanStates[this._indoorData.id]||(this._floorplanStates[this._indoorData.id]={});const i=this._floorplanStates[this._indoorData.id].selectedBuilding,r=this._floorplanStates[this._indoorData.id].selectedLevel;let n;if(this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",this._indoorData.floorplanIDs),this._selectedLevel)for(const e of this._indoorData.levels)e.id===this._selectedLevel.id&&(n=e.id);if(this.fire(new e.A("floorplanselected",{buildings:this._indoorData.buildings,levels:this._indoorData.levels,selectedLevelId:n})),i){const e=this._indoorData.buildings.find((e=>e.id===i));this._buildingSelected(e,!1)}else this._indoorData.buildings.length>0&&this._buildingSelected(this._indoorData.buildings[0],!1);if(r){const e=this._indoorData.levels.find((e=>e.id===r));this._updateLevels(e,t)}else t&&this._indoorData["default-levels"].length>0&&this.selectLevel(this._indoorData["default-levels"][0])}_buildingSelected(t,i){i&&t&&t.extent&&this._map.fitBounds(t.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),this._floorplanStates[this._indoorData.id].selectedBuilding=t?t.id:void 0;const r=this._indoorData.levels.filter((e=>t.levels.includes(e.id)));this.fire(new e.A("buildingselected",{buildingId:t.id,levels:r}))}_levelSelected(t){if("overview"===t)this._updateLevels(void 0,!0);else{const e=this._indoorData.levels.find((e=>e.id===t));this._updateLevels(e,!0)}this.fire(new e.A("levelselected",{levelId:"overview"===t?void 0:t}))}_updateLevels(e,t){if(!e)return this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",[]]),this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._floorplanStates[this._indoorData.id].selectedLevel=void 0,void(t&&this._indoorData.extent&&this._map.fitBounds(this._indoorData.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}));function i(e){const t=e.indexOf("/floor/");if(-1===t)return e;const i=t+7,r=e.indexOf("/",i);return-1===r?e.slice(i):e.slice(i,r)}this._selectedLevel=e,this._floorplanStates[this._indoorData.id].selectedLevel=e?e.id:void 0;const r=[],n={},o={},s={},a={};for(const t of this._indoorData.levels)if(r.push(t.id),n[t.id]=t.height,o[t.id]=t.base,e){if(this.mergeFloors){const r=i(e.id),n=i(t.id);s[t.id]=n===r?"true":"false"}else s[t.id]=t.id===e.id?"true":"false";a[t.id]=t.base=1?{pitch:this._map.getPitch(),bearing:this._map.getBearing()}:{pitch:this._map.getPitch(),bearing:this._map.getBearing(),zoom:i})}}selectFloorplan(t){const i={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},r=[new e.P(0,0),new e.P(this._map.transform.width,this._map.transform.height)],n=this._map.queryRenderedFeatures(r,i);if(n.length>0)for(const e of n)if(JSON.parse(e.properties["indoor-data"]).floorplanIDs.includes(t)){this._selectedFloorplan=e,this._floorplanSelected(!0);break}}selectBuilding(e){const t=this._indoorData.buildings.find((t=>t.id===e));this._buildingSelected(t,!0)}selectLevel(e){this._levelSelected(e)}}function pr(t){if(!t.metadata||!t.metadata.content_area)return;const i=e.q.devicePixelRatio,{left:r,top:n,width:o,height:s}=t.metadata.content_area,a=r*i,l=n*i;return[a,l,a+o*i,l+s*i]}function fr(t){if(t)return t.map((([t,i])=>[t*e.q.devicePixelRatio,i*e.q.devicePixelRatio]))}class Ar{constructor(e,t,i){this.id=e,this.scope=t,this.sourceCache=i,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(e){this.missingRequests.has(e.name)||this.pendingRequests.has(e.name)||this.pendingRequests.add(e.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const i=this.sourceCache.getVisibleCoordinates();if(0===i.length)return t;const r=this.sourceCache.getSource();if(!(r instanceof rt))return t;const n=i.map((e=>this.sourceCache.getTile(e))),o=r.getImages(n,Array.from(this.pendingRequests));for(const[i,r]of o)t.set(e.I.from({name:i,iconsetId:this.id}),r),this.pendingRequests.delete(i);for(const e of this.pendingRequests)this.missingRequests.add(e);return this.pendingRequests.clear(),t}}const mr=(e,t)=>Ie(e,t&&t.filter((e=>"source.canvas"!==e.identifier))),gr=e.aA(Lt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),_r=e.aA(Lt,["setCenter","setZoom","setBearing","setPitch"]),yr=new Set(["background","sky","slot","custom"]),vr={version:8,layers:[],sources:{}},xr={duration:300,delay:0};class br extends e.E{constructor(t,i={}){super(),this.map=t,this.scope=i.scope||"",this.globalId=null,this.fragments=[],this.importDepth=i.importDepth||0,this.importsCache=i.importsCache||new Map,this.resolvedImports=i.resolvedImports||new Set,this.transition=e.l({},xr),this._buildingIndex=new Mt(this),this.crossTileSymbolIndex=new zi,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=i.styleChanges||new j,this.dispatcher=i.dispatcher?i.dispatcher:new e.D(e.cj(),this),i.imageManager?this.imageManager=i.imageManager:(this.imageManager=new H(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=i.glyphManager?i.glyphManager:new e.ck(t._requestManager,i.localFontFamily?e.cl.all:i.localIdeographFontFamily?e.cl.ideographs:e.cl.none,i.localFontFamily||i.localIdeographFontFamily),i.modelManager?this.modelManager=i.modelManager:(this.modelManager=new lr(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this.options=i.configOptions?i.configOptions:new Map,this._configDependentLayers=i.configDependentLayers?i.configDependentLayers:new Set,this._config=i.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:i.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=i.initialConfig,this.dispatcher.broadcast("setReferrer",e.cm());const r=this;this._rtlTextPluginCallback=br.registerForPluginStateChange((t=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},((t,i)=>{if(e.cn(t),i&&i.every((e=>e)))for(const e in r._sourceCaches){const t=r._sourceCaches[e],i=t.getSource().type;"vector"!==i&&"geojson"!==i||t.reload()}}))})),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getOwnSource(e.sourceId);if(t&&t.vectorLayerIds)for(const e in this._layers){const i=this._layers[e];i.source===t.id&&this._validateLayer(i)}}))}load(e){return e?("string"==typeof e?this.loadURL(e):this.loadJSON(e),this):this}_getGlobalId(t){if(!t)return null;if("string"==typeof t){if(e.f(t))return t;const i=e.co(t);if(!i.startsWith("http"))try{return new URL(i,location.href).toString()}catch(e){return i}return i}return`json://${e.cp(JSON.stringify(t))}`}_diffStyle(t,i,r){this.globalId=this._getGlobalId(t);const n=(e,t)=>{try{t(null,this.setState(e,r))}catch(e){t(e,!1)}};if("string"==typeof t){const r=this.map._requestManager.normalizeStyleURL(t),o=this.map._requestManager.transformRequest(r,e.R.Style);e.n(o,((t,r)=>{t?this.fire(new e.z(t)):r&&n(r,i)}))}else"object"==typeof t&&n(t,i)}loadURL(t,i={}){this.fire(new e.A("dataloading",{dataType:"style"}));const r="boolean"==typeof i.validate?i.validate:!e.f(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,i.accessToken),this.resolvedImports.add(t);const n=this.importsCache.get(t);if(n)return this._load(n,r);const o=this.map._requestManager.transformRequest(t,e.R.Style);this._request=e.n(o,((i,n)=>{if(this._request=null,i)this.fire(new e.z(i));else if(n)return this.importsCache.set(t,n),this._load(n,r)}))}loadJSON(t,i={}){this.fire(new e.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=e.q.frame((()=>{this._request=null,this._load(t,!1!==i.validate)}))}loadEmpty(){this.fire(new e.A("dataloading",{dataType:"style"})),this._load(vr,!1)}_loadImports(t,i,r){if(this.importDepth>=4)return e.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const n=[];for(const e of t){const t=this._createFragmentStyle(e),o=new Promise((e=>{t.once("style.import.load",e),t.once("error",e)})).then((()=>this.mergeAll()));if(n.push(o),this.resolvedImports.has(e.url)){t.loadEmpty();continue}const s=e.data||this.importsCache.get(e.url);s?(t.loadJSON(s,{validate:i}),this._isInternalStyle(s)&&(t.globalId=null)):e.url?t.loadURL(e.url,{validate:i}):t.loadEmpty();const a={style:t,id:e.id,config:e.config};if(r){const e=this.fragments.findIndex((({id:e})=>e===r));this.fragments=this.fragments.slice(0,e).concat(a).concat(this.fragments.slice(e))}else this.fragments.push(a)}return Promise.allSettled(n)}getImportGlobalIds(e=this,t=new Set){for(const i of e.fragments)i.style.globalId&&t.add(i.style.globalId),this.getImportGlobalIds(i.style,t);return[...t.values()]}_createFragmentStyle(t){const i=this.scope?e.C(t.id,this.scope):t.id;let r;const n=this._initialConfig&&this._initialConfig[i];(t.config||n)&&(r=e.l({},t.config,n));const o=new br(this.map,{scope:i,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:r,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers});return o.setEventedParent(this.map,{style:o}),o}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}_load(t,i){const r=t.indoor?hr(t.schema):t.schema;if(this._isInternalStyle(t)){const r=e.l({},vr,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(r,i)}if(this.updateConfig(this._config,r),i&&mr(this,me(t)))return;this._loaded=!0,this.stylesheet=e.cq(t);const n=()=>{for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const e in t.iconsets)this.addIconset(e,t.iconsets[e]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.setGlyphsUrl(t.glyphs);const r=Pt(this.stylesheet.layers);if(this._order=r.map((e=>e.id)),this.stylesheet.light&&e.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){const e=this.stylesheet.lights[0];this.light=new Le(e.properties,e.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Le(this.stylesheet.light)),this._layers={};for(const t of r){const i=e.cv(t,this.scope,this._styleColorTheme.lut,this.options);0!==i.configDependencies.size&&this._configDependentLayers.add(i.fqid),i.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=i;const r=this.getOwnLayerSourceCache(i),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();r&&i.canCastShadows()&&n&&(r.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const n=this.stylesheet.terrain;n&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(n,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.A("data",{dataType:"style"}));const o=this.isRootStyle();t.imports?this._loadImports(t.imports,i).then((()=>{this._reloadImports(),this.fire(new e.A(o?"style.load":"style.import.load"))})):(this._reloadImports(),this.fire(new e.A(o?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(o){const t=this._evaluateColorThemeData(o);this._loadColorTheme(t).then((()=>{n()})).catch((t=>{e.w(`Couldn't load color theme from the stylesheet: ${t}`),n()}))}else this._styleColorTheme.lut=null,n()}isRootStyle(){return 0===this.importDepth}mergeAll(){let t,i,r,n,o,s,a,l,c,u;const h={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((e=>{if(e.stylesheet){if(null!=e.light&&(t=e.light),e.stylesheet.lights)for(const t of e.stylesheet.lights)"ambient"===t.type&&null!=e.ambientLight&&(i=e.ambientLight),"directional"===t.type&&null!=e.directionalLight&&(r=e.directionalLight);n=this._prioritizeTerrain(n,e.terrain,e.stylesheet.terrain),e.stylesheet.fog&&null!=e.fog&&(o=e.fog),e.stylesheet.snow&&null!=e.snow&&(s=e.snow),e.stylesheet.rain&&null!=e.rain&&(a=e.rain),null!=e.stylesheet.camera&&(u=e.stylesheet.camera),null!=e.stylesheet.projection&&(l=e.stylesheet.projection),null!=e.stylesheet.transition&&(c=e.stylesheet.transition),h[e.scope]=e._styleColorTheme}})),this.light=t,this.ambientLight=i,this.directionalLight=r,this.fog=o,this.snow=s,this.rain=a,this._styleColorThemeForScope=h,null===n?delete this.terrain:this.terrain=n,this.camera=u||{"camera-projection":"perspective"},this.projection=l||{name:"mercator"},this.transition=e.l({},xr,c),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(e){const t=i=>{for(const e of i.fragments)t(e.style);e(i)};t(this)}_prioritizeTerrain(e,t,i){const r=e&&0===e.drapeRenderMode;return null===i?t&&0===t.drapeRenderMode?t:r?e:null:null!=t&&(!e||r||t&&1===t.drapeRenderMode)?t:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((t=>{e=this._prioritizeTerrain(e,t.terrain,t.stylesheet.terrain)})),null===e?delete this.terrain:this.terrain=e}mergeProjection(){let e;this.forEachFragmentStyle((t=>{null!=t.stylesheet.projection&&(e=t.stylesheet.projection)})),this.projection=e||{name:"mercator"}}mergeSources(){const t={},i={},r={};this.forEachFragmentStyle((n=>{for(const i in n._sourceCaches){const r=e.C(i,n.scope);t[r]=n._sourceCaches[i]}for(const t in n._otherSourceCaches){const r=e.C(t,n.scope);i[r]=n._otherSourceCaches[t]}for(const t in n._symbolSourceCaches){const i=e.C(t,n.scope);r[i]=n._symbolSourceCaches[t]}})),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=i,this._mergedSymbolSourceCaches=r}mergeLayers(){const t={},i=[],r={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle((r=>{for(const n of r._order){const o=r._layers[n];if("slot"===o.type){const i=e.cr(n);if(t[i])continue;t[i]=[]}o.slot&&t[o.slot]?t[o.slot].push(o):i.push(o)}})),this._mergedOrder=[];const n=(i=[])=>{for(const o of i)if("slot"===o.type){const i=e.cr(o.id);t[i]&&n(t[i]),this._mergedSlots.push(i)}else{const t=e.C(o.id,o.scope);this._mergedOrder.push(t),r[t]=o,o.is3D(!!this.terrain)&&(this._has3DLayers=!0),"circle"===o.type&&(this._hasCircleLayers=!0),"symbol"===o.type&&(this._hasSymbolLayers=!0),"clip"===o.type&&(this._clipLayerPresent=!0)}};n(i),this._mergedOrder.sort(((e,t)=>{const i=r[e],n=r[t];return i.hasInitialOcclusionOpacityProperties?n.is3D(!!this.terrain)?1:0:i.is3D(!!this.terrain)&&n.hasInitialOcclusionOpacityProperties?-1:0})),this._mergedLayers=r,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=e.l({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(t,i,r){const n=e.l({},i);for(const t of Object.keys(e.a5.colorTheme))void 0===n[t]&&(n[t]=e.a5.colorTheme[t].default);const o=new e.a6(cr,t,new Map(r));return o.setTransitionOrValue(n,r),o.untransitioned().possiblyEvaluate(new e.aa(0))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const i=this._styleColorTheme.lutLoadingCorrelationID;return new Promise(((r,n)=>{const o="data:image/png;base64,";if(!t||0===t.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void r();let s=t;s.startsWith(o)||(s=o+s);const a=e.I.from("mapbox-reserved-lut"),l=new Image;l.src=s,l.onerror=()=>{this._styleColorTheme.lutLoading=!1,n(new Error("Failed to load image data"))},l.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==i)return void r();this._styleColorTheme.lutLoading=!1;const{width:o,height:s,data:c}=e.q.getImageData(l);if(s>32)return void n(new Error("The height of the image must be less than or equal to 32 pixels."));if(o!==s*s)return void n(new Error("The width of the image must be equal to the height squared."));this.getImage(a,this.scope)&&this.removeImage(a,this.scope),this.addImage(a,this.scope,{data:new e.r({width:o,height:s},c),pixelRatio:1,sdf:!1,usvg:!1,version:0});const u=this.imageManager.getImage(a,this.scope);u?(this._styleColorTheme.lut={image:u.data,data:t},r()):n(new Error("Missing LUT image."))}}))}getLut(e){const t=this._styleColorThemeForScope[e];return t?t.lut:null}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(t,i,r){let n,o,s;const a=e.q.devicePixelRatio>1?"@2x":"";let l=e.n(i.transformRequest(i.normalizeSpriteURL(t,a,".json"),e.R.SpriteJSON),((e,t)=>{l=null,s||(s=e,n=t,u())})),c=e.o(i.transformRequest(i.normalizeSpriteURL(t,a,".png"),e.R.SpriteImage),((e,t)=>{c=null,s||(s=e,o=t,u())}));function u(){if(s)r(s);else if(n&&o){const t=e.q.getImageData(o),i={};for(const r in n){const{width:o,height:s,x:a,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p}=n[r],f=new e.r({width:o,height:s});e.r.copy(t,f,{x:a,y:l},{x:0,y:0},{width:o,height:s},null),i[r]={data:f,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p,usvg:!1}}r(null,i)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(t,this.map._requestManager,((t,i)=>{if(this._spriteRequest=null,t)this.fire(new e.z(t));else if(i){const t=new Map;for(const r in i)t.set(e.I.from(r),i[r]);this.addImages(t,this.scope)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.A("data",{dataType:"style"}))}))}addIconset(t,i){if("sprite"===i.type)return void this._loadSprite(i.url);const r=this.getOwnSourceCache(i.source);if(!r)return void this.fire(new e.z(new Error(`Source "${i.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const n=r.getSource();if("raster-array"!==n.type)return void this.fire(new e.z(new Error(`Source "${i.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));n.partial=!1;const o=new Ar(t,this.scope,r);this.imageManager.addImageProvider(o,this.scope)}removeIconset(e){this.imageManager.removeImageProvider(e,this.scope)}_loadIconset(t){if(!e.f(t)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(t);const i="auto"===this.map._spriteFormat;var r,n;this._spriteRequest=(n=(r,n)=>{if(this._spriteRequest=null,r)i?this._loadSprite(t):this.fire(new e.z(r));else if(n){const t=new Map;for(const i in n)t.set(e.I.from(i),n[i]);this.addImages(t,this.scope)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.A("data",{dataType:"style"}))},e.bj((r=this.map._requestManager).transformRequest(r.normalizeIconsetURL(t),e.R.Iconset),((t,i)=>{if(t)return void n(t);const r={},o=e.ch(new e.bi(i));for(const t of o.icons){const i={version:1,pixelRatio:e.q.devicePixelRatio,content:pr(t),stretchX:t.metadata?fr(t.metadata.stretch_x_areas):void 0,stretchY:t.metadata?fr(t.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:t};r[t.name]=i}n(null,r)})))}_validateLayer(t){const i=this.getOwnSource(t.source);if(!i)return;const r=t.sourceLayer;r&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new e.z(new Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded())return!1;if(this.imageManager.hasPatternsInFlight())return!1;if(!this.modelManager.isLoaded())return!1;if(this._styleColorTheme.lutLoading)return!1;for(const{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map(((e,t)=>{const i=this.fragments[t];return i&&i.style&&(e.data=i.style.serialize()),e}))}_serializeSources(){const e={};for(const t in this._sourceCaches){const i=this._sourceCaches[t].getSource();e[i.id]||(e[i.id]=i.serialize())}return e}_serializeLayers(e){const t=[];for(const i of e){const e=this._layers[i];e&&"custom"!==e.type&&t.push(e.serialize())}return t}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions())return!0;if(this.hasFogTransition())return!0;if(this.hasSnowTransition())return!0;if(this.hasRainTransition())return!0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(e){return e?this.order:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const i=this.getOwnLayer(t);if(i)return i;this.fire(new e.z(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const i=this.getOwnSource(t);if(i)return i;this.fire(new e.z(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(e,t){const i=this.map.painter;if(i)for(let r=e.minzoom||0;r<(e.maxzoom||25.5);r++){const r=e.getProgramIds();if(r)for(const n of r){const r=e.getDefaultProgramParams(n,t.zoom,this._styleColorTheme.lut);r&&(i.style=this,this.fog&&(i._fogVisible=!0,r.overrideFog=!0,i.getOrCreateProgram(n,r)),i._fogVisible=!1,r.overrideFog=!1,i.getOrCreateProgram(n,r),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(r.overrideRtt=!0,i.getOrCreateProgram(n,r)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const i=this.calculateLightsBrightness();t.brightness=i||0,i!==this._brightness&&(this._brightness=i,this.dispatcher.broadcast("setBrightness",i));const r=this._changes.isDirty();let n=!1;if(this._changes.isDirty()){const e=this._changes.getLayerUpdatesByScope();for(const t in e){const{updatedIds:i,removedIds:r}=e[t];(i||r)&&(this._updateWorkerLayers(t,i,r),n=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const o={};for(const e in this._mergedSourceCaches){const t=this._mergedSourceCaches[e];o[e]=t.used,t.used=!1,t.tileCoverLift=0}for(const e of this._mergedOrder){const i=this._mergedLayers[e];if(i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)){const e=this.getLayerSourceCache(i);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,i.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback((()=>{this.precompilePrograms(i,t)})):this.precompilePrograms(i,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&n&&this.mergeLayers();const s=this.imageManager.getPendingImageProviders();for(const e of s)e.sourceCache.used=!0;for(const t in o){const i=this._mergedSourceCaches[t];o[t]!==i.used&&i.getSource().fire(new e.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:i.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),r&&this.fire(new e.A("data",{dataType:"style"}))}updateImageProviders(){const e=this.imageManager.getPendingImageProviders();for(const t of e){const e=t.resolvePendingRequests();this.addImages(e,t.scope)}}_updateTilesForChangedImages(){const e={};for(const t in this._mergedSourceCaches){const i=this._mergedSourceCaches[t].getSource().scope;e[i]=e[i]||this._changes.getUpdatedImages(i),0!==e[i].length&&this._mergedSourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e[i])}for(const t in e)this._changes.resetUpdatedImages(t)}_updateWorkerLayers(e,t,i){const r=this.getFragmentStyle(e);r&&this.dispatcher.broadcast("updateLayers",{layers:t?r._serializeLayers(t):[],scope:e,removedIds:i||[],options:r.options})}setState(t,i){if(this._checkLoaded(),mr(this,me(t)))return!1;(t=e.cq(t)).layers=Pt(t.layers);const r=function(t,i){if(!t)return[{command:Lt.setStyle,args:[i]}];let r=[];try{if(!e.bn(t.version,i.version))return[{command:Lt.setStyle,args:[i]}];if(e.bn(t.center,i.center)||r.push({command:Lt.setCenter,args:[i.center]}),e.bn(t.zoom,i.zoom)||r.push({command:Lt.setZoom,args:[i.zoom]}),e.bn(t.bearing,i.bearing)||r.push({command:Lt.setBearing,args:[i.bearing]}),e.bn(t.pitch,i.pitch)||r.push({command:Lt.setPitch,args:[i.pitch]}),e.bn(t.sprite,i.sprite)||r.push({command:Lt.setSprite,args:[i.sprite]}),e.bn(t.glyphs,i.glyphs)||r.push({command:Lt.setGlyphs,args:[i.glyphs]}),e.bn(t.imports,i.imports)||function(t=[],i=[],r){i=i||[];const n=(t=t||[]).map(Ot),o=i.map(Ot),s=t.reduce(Ut,{}),a=i.reduce(Ut,{}),l=n.slice();let c,u,h,d;for(c=0,u=0;c{e.source&&n[e.source]?r.push({command:Lt.removeLayer,args:[e.id]}):s.push(e)}));let a=t.terrain;a&&n[a.source]&&(r.push({command:Lt.setTerrain,args:[void 0]}),a=void 0),r=r.concat(o),e.bn(a,i.terrain)||r.push({command:Lt.setTerrain,args:[i.terrain]}),function(t,i,r){i=i||[];const n=(t=t||[]).map(Ot),o=i.map(Ot),s=t.reduce(Ut,{}),a=i.reduce(Ut,{}),l=n.slice(),c=Object.create(null);let u,h,d,p,f,A,m;for(u=0,h=0;u!(e.command in _r)));if(0===r.length)return!1;const n=r.filter((e=>!(e.command in gr)));if(n.length>0)throw new Error(`Unimplemented: ${n.map((e=>e.command)).join(", ")}.`);const o=[];return r.forEach((e=>{o.push(this[e.command].apply(this,e.args))})),i&&Promise.all(o).then(i),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(e){const t=this.getFragmentStyle(e);t&&(t._availableImages=t.imageManager.listImages(e),t.dispatcher.broadcast("setImages",{scope:e,images:t._availableImages}))}addImages(t,i){for(const[r,n]of t.entries()){if(this.getImage(r,i))return this.fire(new e.z(new Error(`An image with the name "${r.name}" already exists.`)));this.imageManager.addImage(r,i,n),this._changes.updateImage(r,i)}return this._updateWorkerImages(i),this.fire(new e.A("data",{dataType:"style"})),this}addImage(t,i,r){return this.getImage(t,i)?this.fire(new e.z(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,i,r),this._changes.updateImage(t,i),this._updateWorkerImages(i),this.fire(new e.A("data",{dataType:"style"})),this)}updateImage(t,i,r,n=!1){this.imageManager.updateImage(t,i,r),n&&(this._changes.updateImage(t,i),this._updateWorkerImages(i),this.fire(new e.A("data",{dataType:"style"})))}getImage(e,t){return this.imageManager.getImage(e,t)}removeImage(t,i){return this.getImage(t,i)?(this.imageManager.removeImage(t,i),this._changes.updateImage(t,i),this._updateWorkerImages(i),this.fire(new e.A("data",{dataType:"style"})),this):this.fire(new e.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(e,t,i={}){return this._checkLoaded(),this._validate(Ee,`models.${e}`,t,null,i)||(this.modelManager.addModel(e,t,this.scope),this._changes.setDirty()),this}hasModel(e){return this.modelManager.hasModel(e,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope),this):this.fire(new e.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,i,r={}){if(this._checkLoaded(),void 0!==this.getOwnSource(t))throw new Error(`There is already a source with ID "${t}".`);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(ge,`sources.${t}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=ot(t,i,this.dispatcher,this);n.scope=this.scope,n.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(n.id),source:n.serialize(),sourceId:n.id})));const o=t=>{const i=(t?"symbol:":"other:")+n.id,r=e.C(i,this.scope),o=this._sourceCaches[i]=new Bt(r,n,t);(t?this._symbolSourceCaches:this._otherSourceCaches)[n.id]=o,o.onAdd(this.map)};o(!1),"vector"!==i.type&&"geojson"!==i.type||o(!0),n.onAdd&&n.onAdd(this.map),r.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const i=this.getOwnSource(t);if(!i)throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.z(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new e.z(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const i=Object.entries(this.stylesheet.iconsets).find((([e,i])=>"source"===i.type&&i.source===t));if(i)return this.fire(new e.z(new Error(`Source "${t}" cannot be removed while iconset "${i[0]}" is using it.`)))}const r=this.getOwnSourceCaches(t);for(const t of r){const i=e.cr(t.id);delete this._sourceCaches[i],this._changes.discardSourceCacheUpdate(t.id),t.fire(new e.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:t.getSource().id})),t.setEventedParent(null),t.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getOwnSource(e).setData(t),this._changes.setDirty()}getOwnSource(e){const t=this.getOwnSourceCache(e);return t&&t.getSource()}getOwnSources(){const e=[];for(const t in this._otherSourceCaches){const i=this.getOwnSourceCache(t);i&&e.push(i.getSource())}return e}areTilesLoaded(){const e=this._mergedSourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const i=this._getTransitionParameters();for(const r of t){if(this._validate(ye,"lights",r))return;switch(r.type){case"ambient":if(this.ambientLight){const e=this.ambientLight;e.set(r),e.updateTransitions(i)}else this.ambientLight=new qe(r,He||(He=new e.a7({color:new e.a8(e.a5.properties_light_ambient.color),"color-use-theme":new e.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.a8(e.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const e=this.directionalLight;e.set(r),e.updateTransitions(i)}else this.directionalLight=new qe(r,Ge||(Ge=new e.a7({direction:new e.am(e.a5.properties_light_directional.direction),color:new e.a8(e.a5.properties_light_directional.color),"color-use-theme":new e.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.a8(e.a5.properties_light_directional.intensity),"cast-shadows":new e.a8(e.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new e.a8(e.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new e.a8(e.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const r=new e.aa(this.z||0,i);this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,i=this.ambientLight;if(!t||!i)return;const r=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),n=t.properties.get("color").toRenderColor(null).toArray01(),o=t.properties.get("intensity"),s=t.properties.get("direction"),a=1-e.cc(s.x,s.y,s.z)[2]/90,l=r(n)*o*a,c=i.properties.get("color").toRenderColor(null).toArray01(),u=i.properties.get("intensity"),h=r(c)*u;return Number(((l+h)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(!t)return this;if(e.cs(t)){const i=e.ct(t),r=this.fragments.find((({id:e})=>e===i));if(!r)throw new Error(`Style import '${t}' not found`);const n=e.cr(t);return r.style.getFragmentStyle(n)}{const e=this.fragments.find((({id:e})=>e===t));return e?e.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const i={},r=(e,t="")=>`${e}::${t}`;this._featuresetSelectors={};for(const n in t){const o=this._featuresetSelectors[n]=[];for(const s of t[n].selectors){if(s.featureNamespace){const t=this.getOwnLayer(s.layer);if(!t){e.w(`Layer is undefined for selector: ${s.layer}`);continue}const o=r(t.source,t.sourceLayer);if(o in i&&i[o]!==s.featureNamespace){e.w(`"featureNamespace ${s.featureNamespace} of featureset ${n}'s selector is not associated to the same source, skip this selector`);continue}i[o]=s.featureNamespace}let t;if(s.properties)for(const i in s.properties){const r=e.X(s.properties[i]);"success"===r.result&&(t=t||{},t[i]=r.value)}o.push({layerId:s.layer,namespace:s.featureNamespace,properties:t,uniqueFeatureID:s._uniqueFeatureID})}}}getFeaturesetDescriptors(e){const t=this.getFragmentStyle(e);if(!t||!t.stylesheet.featuresets)return[];const i=[];for(const e in t.stylesheet.featuresets)i.push({featuresetId:e,importId:t.scope?t.scope:void 0});return i}getFeaturesetLayers(t,i){const r=this.getFragmentStyle(i),n=r.stylesheet.featuresets;if(!n||!n[t])return this.fire(new e.z(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const o=[];for(const e of n[t].selectors){const t=r.getOwnLayer(e.layer);t&&o.push(t)}return o}getConfigProperty(t,i){const r=this.getFragmentStyle(t);if(!r)return null;const n=e.C(i,r.scope),o=r.options.get(n),s=o?o.value||o.default:null;return s?s.serialize():null}setConfigProperty(t,i,r){const n=this.getFragmentStyle(t);if(!n)return;const o=n.stylesheet.indoor?hr(n.stylesheet.schema):n.stylesheet.schema;if(!o||!o[i])return;const s=e.X(r);if("success"!==s.result)return void mr(this,s.value);const a=s.value.expression,l=e.C(i,n.scope),c=n.options.get(l);if(!c)return;let u;const{minValue:h,maxValue:d,stepValue:p,type:f,values:A}=o[i],m=e.X(o[i].default);"success"===m.result&&(u=m.value.expression),u?(this.options.set(l,Object.assign({},c,{value:a,default:u,minValue:h,maxValue:d,stepValue:p,type:f,values:A})),this.updateConfigDependencies(i)):this.fire(new e.z(new Error(`No schema defined for the config option "${i}" in the "${t}" fragment.`)))}getConfig(t){const i=this.getFragmentStyle(t);if(!i)return null;const r=i.stylesheet.schema;if(!r)return null;const n={};for(const t in r){const r=e.C(t,i.scope),o=i.options.get(r),s=o?o.value||o.default:null;n[t]=s?s.serialize():null}return n}setConfig(e,t){const i=this.getFragmentStyle(e);i&&(i.updateConfig(t,i.stylesheet.schema),this.updateConfigDependencies())}getSchema(e){const t=this.getFragmentStyle(e);return t?t.stylesheet.schema:null}setSchema(e,t){const i=this.getFragmentStyle(e);i&&(i.stylesheet.schema=t,i.updateConfig(i._config,t),this.updateConfigDependencies())}updateConfig(t,i){if(this._config=t,t||i)if(i)for(const r in i){let n,o;const s=e.X(i[r].default);if("success"===s.result&&(n=s.value.expression),t&&void 0!==t[r]){const i=e.X(t[r]);"success"===i.result&&(o=i.value.expression)}const{minValue:a,maxValue:l,stepValue:c,type:u,values:h}=i[r];if(n){const t=e.C(r,this.scope);this.options.set(t,{default:n,value:o,minValue:a,maxValue:l,stepValue:c,type:u,values:h})}else this.fire(new e.z(new Error(`No schema defined for config option "${r}".`)))}else this.fire(new e.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(e){for(const t of this._configDependentLayers){const i=this.getLayer(t);if(i){if(e&&!i.configDependencies.has(e))continue;i.possiblyEvaluateVisibility(),this._updateLayer(i)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle((e=>{const t=e._styleColorTheme.colorThemeOverride?e._styleColorTheme.colorThemeOverride:e._styleColorTheme.colorTheme;if(t){const i=e._evaluateColorThemeData(t);(!e._styleColorTheme.lut&&""!==i||e._styleColorTheme.lut&&i!==e._styleColorTheme.lut.data)&&e.setColorTheme(t)}})),this._changes.setDirty()}addLayer(t,i,r={}){this._checkLoaded();const n=t.id;if(this._layers[n])return void this.fire(new e.z(new Error(`Layer with id "${n}" already exists on this map`)));let o;if("custom"===t.type){if(mr(this,e.cu(t)))return;o=e.cv(t,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof t.source&&(this.addSource(n,t.source),t=e.cq(t),t=e.l(t,{source:n})),this._validate(Te,`layers.${n}`,t,{arrayIndex:-1},r))return;o=e.cv(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid);let s=this._order.length;if(i){const t=this._order.indexOf(i);if(-1===t)return void this.fire(new e.z(new Error(`Layer with id "${i}" does not exist on this map.`)));o.slot===this._layers[i].slot?s=t:e.w(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=o;const a=this.getOwnLayerSourceCache(o),l=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&o.canCastShadows()&&l&&(a.castsShadows=!0);const c=this._changes.getRemovedLayer(o);if(c&&o.source&&a&&"custom"!==o.type){this._changes.discardLayerRemoval(o);const t=e.C(o.source,o.scope);c.type!==o.type?this._changes.updateSourceCache(t,"clear"):(this._changes.updateSourceCache(t,"reload"),a.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),o.scope=this.scope,this.mergeLayers()}moveLayer(t,i){this._checkLoaded();const r=this._checkLayer(t);if(!r)return;if(t===i)return;const n=this._order.indexOf(t);this._order.splice(n,1);let o=this._order.length;if(i){const t=this._order.indexOf(i);if(-1===t)return void this.fire(new e.z(new Error(`Layer with id "${i}" does not exist on this map.`)));r.slot===this._layers[i].slot?o=t:e.w(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(o,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(e){this._checkLoaded();const t=this._checkLayer(e);if(!t)return;t.setEventedParent(null);const i=this._order.indexOf(e);this._order.splice(i,1),delete this._layers[e],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(t.fqid),this._changes.removeLayer(t);const r=this.getOwnLayerSourceCache(t);if(r&&r.castsShadows){let e=!1;for(const i in this._layers)if(this._layers[i].source===t.source&&this._layers[i].canCastShadows()){e=!0;break}r.castsShadows=e}t.onRemove&&t.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(e,t,i){this._checkLoaded();const r=this._checkLayer(e);r&&(r.minzoom===t&&r.maxzoom===i||(null!=t&&(r.minzoom=t),null!=i&&(r.maxzoom=i),this._updateLayer(r)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(e,t){this._checkLoaded();const i=this._checkLayer(e);i&&i.slot!==t&&(i.slot=t,this._updateLayer(i))}setFilter(t,i,r={}){this._checkLoaded();const n=this._checkLayer(t);if(n&&!e.bn(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(Be,`layers.${n.id}.filter`,i,{layerType:n.type},r)||(n.filter=e.cq(i),this._updateLayer(n)))}getFilter(t){const i=this._checkLayer(t);if(i)return e.cq(i.filter)}setLayoutProperty(t,i,r,n={}){this._checkLoaded();const o=this._checkLayer(t);if(o&&!e.bn(o.getLayoutProperty(i),r)){if(null!=r&&(!n||!1!==n.validate)&&mr(o,Se.call(me,{key:`layers.${t}.layout.${i}`,layerType:o.type,objectKey:i,value:r,styleSpec:e.a5,style:{glyphs:!0,sprite:!0}})))return;o.setLayoutProperty(i,r),0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),this._updateLayer(o)}}getLayoutProperty(e,t){const i=this._checkLayer(e);if(i)return i.getLayoutProperty(t)}setPaintProperty(t,i,r,n={}){this._checkLoaded();const o=this._checkLayer(t);if(!o)return;if(e.bn(o.getPaintProperty(i),r))return;if(null!=r&&(!n||!1!==n.validate)&&mr(o,Ce.call(me,{key:`layers.${t}.paint.${i}`,layerType:o.type,objectKey:i,value:r,styleSpec:e.a5})))return;const s=o.setPaintProperty(i,r);0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),s&&this._updateLayer(o),this._changes.updatePaintProperties(o)}getPaintProperty(e,t){const i=this._checkLayer(e);if(i)return i.getPaintProperty(t)}setFeatureState(t,i){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:e,importId:r}=t.target,n=this.getFragmentStyle(r),o=n.getFeaturesetLayers(e);for(const{source:e,sourceLayer:r}of o)n.setFeatureState({id:t.id,source:e,sourceLayer:r},i)}else if("layerId"in t.target){const{layerId:e}=t.target,r=this.getLayer(e);this.setFeatureState({id:t.id,source:r.source,sourceLayer:r.sourceLayer},i)}return}const r=t.source,n=t.sourceLayer,o=this._checkSource(r);if(!o)return;const s=o.type;if("geojson"===s&&n)return void this.fire(new e.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!n)return void this.fire(new e.z(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===t.id&&this.fire(new e.z(new Error("The feature id parameter must be provided.")));const a=this.getOwnSourceCaches(r);for(const e of a)e.setFeatureState(n,t.id,i)}removeFeatureState(t,i){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:e,importId:r}=t.target,n=this.getFragmentStyle(r),o=n.getFeaturesetLayers(e);for(const{source:e,sourceLayer:r}of o)n.removeFeatureState({id:t.id,source:e,sourceLayer:r},i)}else if("layerId"in t.target){const{layerId:e}=t.target,r=this.getLayer(e);this.removeFeatureState({id:t.id,source:r.source,sourceLayer:r.sourceLayer},i)}return}const r=t.source,n=this._checkSource(r);if(!n)return;const o=n.type,s="vector"===o?t.sourceLayer:void 0;if("vector"===o&&!s)return void this.fire(new e.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(i&&"string"!=typeof t.id&&"number"!=typeof t.id)return void this.fire(new e.z(new Error("A feature id is required to remove its specific state property.")));const a=this.getOwnSourceCaches(r);for(const e of a)e.removeFeatureState(s,t.id,i)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let i;if("featuresetId"in t.target){const{featuresetId:r,importId:n}=t.target,o=this.getFragmentStyle(n),s=o.getFeaturesetLayers(r);for(const{source:r,sourceLayer:n}of s){const s=o.getFeatureState({id:t.id,source:r,sourceLayer:n});if(s&&!i)i=s;else if(!e.bn(i,s))return void this.fire(new e.z(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:e}=t.target,r=this.getLayer(e);i=this.getFeatureState({id:t.id,source:r.source,sourceLayer:r.sourceLayer})}return i}const i=t.source,r=t.sourceLayer,n=this._checkSource(i);if(n){if("vector"!==n.type||r)return void 0===t.id&&this.fire(new e.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(i)[0].getFeatureState(r,t.id);this.fire(new e.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=e.l({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return e.l({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),i=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return e.cw({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:i,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},(e=>void 0!==e))}_updateFilteredLayers(e){for(const t of Object.values(this._mergedLayers))e(t)&&this._updateLayer(t)}_updateLayer(t){this._changes.updateLayer(t);const i=this.getLayerSourceCache(t),r=e.C(t.source,t.scope),n=this._changes.getUpdatedSourceCaches();t.source&&!n[r]&&i&&"raster"!==i.getSource().type&&(this._changes.updateSourceCache(r,"reload"),i.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>this._mergedLayers[e].is3D(!!this.terrain),i=this.order,r={},n=[];for(let o=i.length-1;o>=0;o--){const s=i[o];if(t(s)){r[s]=o;for(const t of e){const e=t[s];if(e)for(const t of e)n.push(t)}}}n.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const o=[];for(let s=i.length-1;s>=0;s--){const a=i[s];if(t(a))for(let e=n.length-1;e>=0;e--){const t=n[e].feature;if(t.layer&&r[t.layer.id]{if(yr.has(e.type))return;const t=this.getOwnLayerSourceCache(e),i=o[t.id]=o[t.id]||{sourceCache:t,layers:{},has3DLayers:!1};e.is3D(!!this.terrain)&&(i.has3DLayers=!0),i.layers[e.fqid]=i.layers[e.fqid]||{styleLayer:e,targets:[]},i.layers[e.fqid].targets.push({filter:n})};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new e.z(new Error("parameters.layers must be an Array."))),[];for(const t of i.layers){const i=this._layers[t];if(!i)return this.fire(new e.z(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];s(i)}}else for(const e in this._layers)s(this._layers[e]);const a=this._queryRenderedFeatures(t,o,r),l=this._flattenAndSortRenderedFeatures(a),c=[];for(const t of l)e.ct(t.layer.id)===this.scope&&c.push(t);return c}queryRenderedFeatureset(t,i,r){let n;i&&!Array.isArray(i)&&i.filter&&(this._validate(Be,"queryRenderedFeatures.filter",i.filter,null,i),n=e.a_(i.filter));const o="mock",s=[];if(i&&i.target)s.push(Object.assign({},i,{targetId:o,filter:n}));else{const e=this.getFeaturesetDescriptors();for(const t of e)s.push({targetId:o,filter:n,target:t});for(const{style:e}of this.fragments){const t=e.getFeaturesetDescriptors();for(const e of t)s.push({targetId:o,filter:n,target:e})}}const a=this.queryRenderedTargets(t,s,r),l=[],c=new Set;for(const t of a)for(const i of t.variants[o])at(i,t,c)||l.push(new e.cx(t,i));return l}queryRenderedTargets(t,i,r){const n={},o=(e,t,i,r)=>{const o=n[t.id]=n[t.id]||{sourceCache:t,layers:{},has3DLayers:!1};if(o.layers[e.fqid]=o.layers[e.fqid]||{styleLayer:e,targets:[]},e.is3D(!!this.terrain)&&(o.has3DLayers=!0),!r)return i.uniqueFeatureID=!1,void o.layers[e.fqid].targets.push(i);o.layers[e.fqid].targets.push(Object.assign({},i,{namespace:r.namespace,properties:r.properties,uniqueFeatureID:r.uniqueFeatureID}))};for(const t of i)if("featuresetId"in t.target){const{featuresetId:i,importId:r}=t.target,n=this.getFragmentStyle(r);if(!n||!n._featuresetSelectors)continue;const s=n._featuresetSelectors[i];if(!s){this.fire(new e.z(new Error(`The featureset '${i}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const e of s){const i=n.getOwnLayer(e.layerId);i&&!yr.has(i.type)&&o(i,n.getOwnLayerSourceCache(i),t,e)}}else if("layerId"in t.target){const{layerId:e}=t.target,i=this.getLayer(e);if(!i||yr.has(i.type))continue;o(i,this.getLayerSourceCache(i),t)}const s=this._queryRenderedFeatures(t,n,r);return this._flattenAndSortRenderedFeatures(s)}_queryRenderedFeatures(e,t,i){const r=[],n=!!this.map._showQueryGeometry,o=Ke.createFromScreenPoints(e,i);for(const e in t){const s=lt(o,t[e],this._availableImages,i,n);Object.keys(s).length&&r.push(s)}if(this.placement)for(const e in t){if(!t[e].sourceCache._onlySymbols)continue;const i=ct(o.screenGeometry,t[e],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData);Object.keys(i).length&&r.push(i)}return r}querySourceFeatures(e,t){const i=t&&t.filter;i&&this._validate(Be,"querySourceFeatures.filter",i,null,t);let r=[];const n=this.getOwnSourceCaches(e);for(const e of n)r=r.concat(ut(e,t));return r}addSourceType(e,t,i){return br.getSourceType(e)?i(new Error(`A source type called "${e}" already exists.`)):(br.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},i):i(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,i,r={}){this._checkLoaded();const n=this.light.getLight();let o=!1;for(const i in t)if(!e.bn(t[i],n[i])){o=!0;break}if(!o)return;const s=this._getTransitionParameters();this.light.setLight(t,i,r),this.light.updateTransitions(s)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&e.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,i=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===i&&delete this.terrain,null===t?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let r=t;const n=null==t.source;if(1===i){if(this.disableElevatedTerrain)return;if("object"==typeof r.source){const t="terrain-dem-src";this.addSource(t,r.source),r=e.cq(r),r=e.l(r,{source:t})}const t=e.l({},r),i={};if(this.terrain&&n){t.source=this.terrain.get().source;const e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(i.style=e.serialize())}if(this._validate(ve,"terrain",t,i))return}if(!this.terrain||this.terrain.scope!==this.scope&&!n||this.terrain&&i!==this.terrain.drapeRenderMode){if(!r)return;this._createTerrain(r,i),this.fire(new e.A("data",{dataType:"style"}))}else{const i=this.terrain,n=i.get();for(const t of Object.keys(e.a5.terrain))!r.hasOwnProperty(t)&&e.a5.terrain[t].default&&(r[t]=e.a5.terrain[t].default);for(const r in t)if(!e.bn(t[r],n[r])){i.set(t,this.options),this.stylesheet.terrain=t;const r=this._getTransitionParameters({duration:0});i.updateTransitions(r),this.fire(new e.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new Qe(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_createSnow(e){const t=this.snow=new $e(e,this.map.transform,this.scope,this.options);this.stylesheet.snow=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_createRain(e){const t=this.rain=new Ze(e,this.map.transform,this.scope,this.options);this.stylesheet.rain=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const e of this.map._markers)e._evaluateOpacity()}))}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog;if(!e.bn(i.get(),t)){i.set(t,this.options),this.stylesheet.fog=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const i=this.snow;if(!e.bn(i.get(),t)){i.set(t,this.options),this.stylesheet.snow=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const i=this.rain;if(!e.bn(i.get(),t)){i.set(t,this.options),this.stylesheet.rain=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles()},i=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!i)return this._styleColorTheme.lut=null,void t();const r=this._evaluateColorThemeData(i);this._loadColorTheme(r).then((()=>{this.fire(new e.A("colorthemeset")),t()})).catch((t=>{e.w(`Couldn't set color theme: ${t}`)}))}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&e.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(e,t){const i=this.getFragmentStyle(e);i&&(i._styleColorTheme.colorThemeOverride=t,i._reloadColorTheme())}_getTransitionParameters(t){return{now:e.q.now(),transition:e.l(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const e=[],t=[];for(const i of this._mergedOrder)this.isLayerDraped(this._mergedLayers[i])?e.push(i):t.push(i);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const i=this.terrain=new Fe(e,t,this.scope,this.options);1===t&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(t,i,r,n,o={}){if(o&&!1===o.validate)return!1;const s=e.l({},this.serialize());return mr(this,t.call(me,e.l({key:i,style:s,value:r,styleSpec:e.a5},n)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.cy.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._mergedLayers)this._mergedLayers[e].setEventedParent(null);for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(e){const t=this.getSourceCaches(e);for(const e of t)e.clearTiles()}clearSources(){for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}reloadSource(e){const t=this.getSourceCaches(e);for(const e of t)e.resume(),e.reload()}reloadSources(){for(const e of this.getSources())e.reload&&e.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle((e=>{e.modelManager.reloadModels(e.scope)}))}updateSources(e){let t;this.directionalLight&&(t=or(this.directionalLight));for(const i in this._mergedSourceCaches)this._mergedSourceCaches[i].update(e,void 0,void 0,t)}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}_updatePlacement(t,i,r,n,o,s,a=!1){let l=!1,c=!1;const u={},h={};for(const t of this._mergedOrder){const r=this._mergedLayers[t];if("symbol"!==r.type)continue;const n=e.C(r.source,r.scope);let o=u[n];if(!o){const e=this.getLayerSourceCache(r);if(!e)continue;const t=e.getRenderableIds(!0).map((t=>e.getTileByID(t)));h[n]=t.slice(),o=u[n]=t.sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const s=this.crossTileSymbolIndex.addLayer(r,o,i.center.lng,i.projection);l=l||s}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),a=a||this._layerOrderChanged||0===n,this._layerOrderChanged&&this.fire(new e.A("neworder")),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.q.now(),i.zoom))&&(this.pauseablePlacement=new Ii(i,this._mergedOrder,a,r,n,o,this.placement,this.fog&&i.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,u,h,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.q.now()),c=!0),l&&this.pauseablePlacement.placement.setStale()),c||l){this._buildingIndex.onNewFrame(i.zoom);for(let t=0;te===t.id)))return void this.fire(new e.z(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!i)return r.push(t),this._loadImports([t],!0);const n=r.findIndex((({id:e})=>e===i));return-1===n&&this.fire(new e.z(new Error(`Import with id "${i}" does not exist on this map.`))),this.stylesheet.imports=r.slice(0,n).concat(t).concat(r.slice(n)),this._loadImports([t],!0,i)}updateImport(t,i){this._checkLoaded();const r=this.stylesheet.imports||[],n=this.getImportIndex(t);return-1===n?this:"string"==typeof i?(this.setImportUrl(t,i),this):(i.url&&i.url!==r[n].url&&this.setImportUrl(t,i.url),e.bn(i.config,r[n].config)||this.setImportConfig(t,i.config,i.data.schema),e.bn(i.data,r[n].data)||this.setImportData(t,i.data),this)}moveImport(e,t){this._checkLoaded();let i=this.stylesheet.imports||[];const r=this.getImportIndex(e);if(-1===r)return this;const n=this.getImportIndex(t);if(-1===n)return this;const o=i[r],s=this.fragments[r];return i=i.filter((({id:t})=>t!==e)),this.fragments=this.fragments.filter((({id:t})=>t!==e)),this.stylesheet.imports=i.slice(0,n).concat(o).concat(i.slice(n)),this.fragments=this.fragments.slice(0,n).concat(s).concat(this.fragments.slice(n)),this.mergeLayers(),this}setImportUrl(e,t){this._checkLoaded();const i=this.stylesheet.imports||[],r=this.getImportIndex(e);if(-1===r)return this;i[r].url=t;const n=this.fragments[r];return n.style=this._createFragmentStyle(i[r]),n.style.on("style.import.load",(()=>this.mergeAll())),n.style.loadURL(t),this}setImportData(e,t){this._checkLoaded();const i=this.getImportIndex(e),r=this.stylesheet.imports||[];return-1===i?this:t?(this.fragments[i].style.setState(t),this._reloadImports(),this):(delete r[i].data,this.setImportUrl(e,r[i].url))}setImportConfig(e,t,i){this._checkLoaded();const r=this.getImportIndex(e),n=this.stylesheet.imports||[];if(-1===r)return this;t?n[r].config=t:delete n[r].config;const o=this.fragments[r];i&&o.style.stylesheet&&(o.style.stylesheet.schema=i);const s=o.style.stylesheet&&o.style.stylesheet.schema;return o.config=t,o.style.updateConfig(t,s),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();const t=this.stylesheet.imports||[],i=this.getImportIndex(e);-1!==i&&(t.splice(i,1),this.fragments[i].style._remove(),this.fragments.splice(i,1),this._reloadImports())}getImportIndex(t){const i=(this.stylesheet.imports||[]).findIndex((e=>e.id===t));return-1===i&&this.fire(new e.z(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),i}getLayer(e){return this._mergedLayers[e]}getSources(){const e=[];for(const t in this._mergedOtherSourceCaches){const i=this._mergedOtherSourceCaches[t];i&&e.push(i.getSource())}return e}getSource(e,t){const i=this.getSourceCache(e,t);return i&&i.getSource()}getLayerSource(e){const t=this.getLayerSourceCache(e);return t&&t.getSource()}getSourceCache(t,i){const r=e.C(t,i);return this._mergedOtherSourceCaches[r]}getLayerSourceCache(t){const i=e.C(t.source,t.scope);return"symbol"===t.type?this._mergedSymbolSourceCaches[i]:this._mergedOtherSourceCaches[i]}getSourceCaches(e){if(null==e)return Object.values(this._mergedSourceCaches);const t=[];return this._mergedOtherSourceCaches[e]&&t.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&t.push(this._mergedSymbolSourceCaches[e]),t}updateSourceCaches(){const e=this._changes.getUpdatedSourceCaches();for(const t in e){const i=e[t];"reload"===i?this.reloadSource(t):"clear"===i&&this.clearSource(t)}}updateLayers(e){const t=this._changes.getUpdatedPaintProperties();for(const i of t){const t=this.getLayer(i);t&&t.updateTransitions(e)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(e){this.stylesheet.glyphs=e,this.glyphManager.setURL(e,this.scope)}getImages(t,i,r){this.imageManager.getImages(i.images,i.scope,r),this._updateTilesForChangedImages();const n=t=>{if(t){const r=i.images.map((t=>e.I.toString(t)));t.setDependencies(i.tileID.key,i.type,r)}},o=e.C(i.source,i.scope);n(this._mergedOtherSourceCaches[o]),n(this._mergedSymbolSourceCaches[o])}rasterizeImages(e,t,i){this.imageManager.rasterizeImages(t,i)}getGlyphs(e,t,i){this.glyphManager.getGlyphs(t.stacks,t.scope,i)}getResource(t,i,r){return e.cz(i,r)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const i=this.getOwnSourceCaches(t);return 0===i.length?(this.fire(new e.z(new Error(`There is no source with ID '${t}'`))),!1):i.every((e=>e.loaded()))}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(e,t){if(!this._clipLayerPresent&&"fill-extrusion"!==e.type)return!1;const i="fill-extrusion"===e.type&&"building"===e.sourceLayer;if(e.is3D(!!this.terrain)){if(i||t&&"batched-model"===t.type)return!0;if("model"===e.type)return!0}else if("symbol"===e.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach((e=>{e.style._remove()})),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}br.getSourceType=function(e){return nt[e]},br.setSourceType=function(e,t){nt[e]=t},br.registerForPluginStateChange=e.ci;var wr="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",Tr="\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color,float height) {\n#ifdef INDICATOR_CUTOUT\nfloat verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",Br="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\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(\nunpack_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 vec2 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 (units_to_pixels*pos+offset)/pattern_size;}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) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}",Cr="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Sr="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif//DEPTH_OCCLUSION",Er="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",Mr="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",Ir="#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",Pr="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",Lr="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif//RENDER_SHADOWS",Fr="#ifdef RENDER_SHADOWS\n#ifdef DEPTH_TEXTURE\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\n#else\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\n#endif\nuniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_1,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_0,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;\n#ifdef TEXTURE_GATHER\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\n#else\nhighp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\n);\n#endif\nvec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return clamp(mix(lerpx.x,lerpx.y,f.y),0.0,1.0);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {\n#ifdef SHADOWS_SINGLE_CASCADE\nlight_view_pos0.xyz/=light_view_pos0.w;vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\n#else\nlight_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";const kr=[];Nr(wr,kr),Nr(Br,kr),Nr(Tr,kr);const zr={"_prelude_fog.vertex.glsl":Er,"_prelude_terrain.vertex.glsl":Sr,"_prelude_shadow.vertex.glsl":Lr,"_prelude_fog.fragment.glsl":Mr,"_prelude_shadow.fragment.glsl":Fr,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif//LIGHTING_3D_MODE","_prelude_raster_array.glsl":Ir,"_prelude_raster_particle.glsl":Pr},Rr={};Qr("",Sr),Qr(Mr,Er),Qr(Fr,Lr),Qr(Ir,""),Qr(Pr,"");const Dr=Qr(Tr,Br),Or=wr;var Ur={background:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),backgroundPattern:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),circle:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in 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\nuniform float u_emissive_strength;void 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 blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? \nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\n#ifdef ELEVATED_ROADS\nin float a_circle_z_offset;\n#endif\nout vec3 v_data;out 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\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void 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);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\n#ifdef ELEVATED_ROADS\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:Qr("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Qr('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in 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);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout 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;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:Qr("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Qr("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}'),collisionCircle:Qr("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in 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);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out 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_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-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(\n0.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:Qr("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),elevatedStructuresDepth:Qr("void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=vec4(0.);\n#endif\n}","in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Qr("#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#endif\nglFragColor=vec4(1.0,0.0,0.0,1.0);}","in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}"),elevatedStructures:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvoid main() {vec3 color=vec3(241.0/255.0,236.0/255.0,225.0/255.0);\n#ifdef LIGHTING_3D_MODE\nvec3 normal=normalize(v_normal);\n#ifdef RENDER_SHADOWS\nfloat shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#else\ncolor=apply_lighting(color,normal);\n#endif\nif (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_height);\n#endif\nglFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;\n#endif\nvoid main() {v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(v_normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fill:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=opacity;\n#ifdef INDICATOR_CUTOUT\nif (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=z_offset;\n#endif\n}'),fillOutline:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\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);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,h);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionDepth:Qr("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,height);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:Qr('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:Qr("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:Qr("precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(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);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),line:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset > 0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)\nin vec3 a_z_offset_width;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec3 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\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 border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\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 border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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;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;\n#ifdef VARIABLE_LINE_WIDTH\nfloat left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\noffset=-1.0*offset*u_width_scale;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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),0.001);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),linePattern:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nuniform float u_emissive_strength;\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset > 0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_z_offset);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec3 a_z_offset_width;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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;vec2 pos=floor(a_pos_normal*0.5);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=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\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=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),raster:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:Qr("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:Qr("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Qr('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Qr('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\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\n#pragma mapbox: initialize lowp float emissive_strength\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform 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_elevation_from_sea;uniform bool u_pitch_with_map;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 vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\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\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\n#ifdef PROJECTED_POS_ON_VIEWPORT\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\n#else\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); \n#endif\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+(u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#else\nz+=u_pitch_with_map ? (u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=e;\n#endif\n}'),terrainRaster:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:Qr("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:Qr('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',Cr),skyboxGradient:Qr('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',Cr),skyboxCapture:Qr("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nhighp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:Qr('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:Qr('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor,v_position_height.w);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:Qr("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:Qr("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),snowParticle:Qr("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"),rainParticle:Qr("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"),vignette:Qr("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Qr("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function Nr(e,t){const i=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let e of i)if(e=e.trim(),"#"===e[0]&&e.includes("if")&&!e.includes("endif")){e=e.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const i=e.split(" ");for(const e of i)t.includes(e)||t.push(e)}}function Qr(e,t){const i=/#include\s+"([^"]+)"/g,r=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let n=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);n&&(n=n.map((e=>{const t=e.split(" ");return t[t.length-1]})),n=[...new Set(n)]);const o={},s=[],a=[];if(e=e.replace(i,((e,t)=>(a.push(t),""))),(t=t.replace(i,((e,t)=>(s.push(t),"")))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let l=[...kr];Nr(e,l),Nr(t,l);for(const e of[...s,...a])zr[e]||console.error(`Undefined include: ${e}`),Rr[e]||(Rr[e]=[],Nr(zr[e],Rr[e])),l=[...l,...Rr[e]];return{fragmentSource:e=e.replace(r,((e,t,i,r,n)=>(o[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"initialize"===t?`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n in ${i} ${r} ${n};\n#endif\n`:"initialize-attribute"===t?"":void 0))),vertexSource:t=t.replace(r,((e,t,i,r,n)=>{const s="float"===r?"vec2":r,a=n.match(/color/)?"color":s;return"define-attribute-vertex-shader-only"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\nin ${i} ${r} a_${n};\n#endif\n`:o[n]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${s} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"initialize"===t?"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n in ${i} ${r} a_${n};\n out ${i} ${r} ${n};\n#endif\n`:"initialize-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n ${n} = a_${n};\n#endif\n`:void 0:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${s} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"define-instanced"===t?"mat4"===a?`\n#ifdef INSTANCED_ARRAYS\nin vec4 a_${n}0;\nin vec4 a_${n}1;\nin vec4 a_${n}2;\nin vec4 a_${n}3;\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef INSTANCED_ARRAYS\nin ${i} ${s} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"initialize-attribute-custom"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n ${i} ${r} ${n} = a_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:n,usedDefines:l,vertexIncludes:s,fragmentIncludes:a}}class jr{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,i,r,n,o,s,a){this.context=e;let l=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!l&&e{const o=r.paint.get("hillshade-shadow-color"),s="none"===r.paint.get("hillshade-shadow-color-use-theme").constantOr("default"),a=r.paint.get("hillshade-highlight-color"),l="none"===r.paint.get("hillshade-highlight-color-use-theme").constantOr("default"),c=r.paint.get("hillshade-accent-color"),u="none"===r.paint.get("hillshade-accent-color-use-theme").constantOr("default"),h=r.paint.get("hillshade-emissive-strength");let d=e.ak(r.paint.get("hillshade-illumination-direction"));if("viewport"===r.paint.get("hillshade-illumination-anchor"))d-=t.transform.angle;else if(t.style&&t.style.enable3dLights()&&t.style.directionalLight){const i=t.style.directionalLight.properties.get("direction"),r=e.cc(i.x,i.y,i.z);d=e.ak(r[1])}const p=!t.options.moving;return{u_matrix:n||t.transform.calculateProjMatrix(i.tileID.toUnwrapped(),p),u_image:0,u_latrange:Vr(0,i.tileID),u_light:[r.paint.get("hillshade-exaggeration"),d],u_shadow:o.toRenderColor(s?null:r.lut),u_highlight:a.toRenderColor(l?null:r.lut),u_emissive_strength:h,u_accent:c.toRenderColor(u?null:r.lut)}})(t,r,n,t.terrain?i.projMatrix:null);t.uploadCommonUniforms(l,d,i.toUnwrapped());const{tileBoundsBuffer:f,tileBoundsIndexBuffer:A,tileBoundsSegments:m}=t.getTileBoundsBuffers(r);d.draw(t,c.TRIANGLES,o,s,a,Vi.disabled,p,n.id,f,A,m)}function Gr(t,i,r){if(!i.needsDEMTextureUpload)return;const n=t.context,o=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(r.stride);const s=r.getPixels();i.demTexture?i.demTexture.update(s,{premultiply:!1}):i.demTexture=new e.T(n,s,o.R32F,{premultiply:!1}),i.needsDEMTextureUpload=!1}function $r(t,i,r){const n=t.context,o=n.gl;if(!i.dem)return;const s=i.dem;if(n.activeTexture.set(o.TEXTURE1),Gr(t,i,s),!i.demTexture)return;i.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE);const a=s.dim;n.activeTexture.set(o.TEXTURE0);let l=i.hillshadeFBO;if(!l){const t=new e.T(n,{width:a,height:a,data:null},o.RGBA8);t.bind(o.LINEAR,o.CLAMP_TO_EDGE),l=i.hillshadeFBO=n.createFramebuffer(a,a,!0,"renderbuffer"),l.colorAttachment.set(t.texture)}n.bindFramebuffer.set(l.framebuffer),n.viewport.set([0,0,a,a]);const{tileBoundsBuffer:c,tileBoundsIndexBuffer:u,tileBoundsSegments:h}=t.getMercatorTileBoundsBuffers(),d=[];t.linearFloatFilteringSupported()&&d.push("TERRAIN_DEM_FLOAT_FORMAT"),t.getOrCreateProgram("hillshadePrepare",{defines:d}).draw(t,o.TRIANGLES,Oi.disabled,Ni.disabled,Di.unblended,Vi.disabled,((t,i)=>{const r=i.stride,n=e.ad.mat4.create();return e.ad.mat4.ortho(n,0,e.ai,-e.ai,0,0,1),e.ad.mat4.translate(n,n,[0,-e.ai,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ}})(i.tileID,s),r.id,c,u,h),i.needsHillshadePrepare=!1}class Zr{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class qr extends Zr{getDefault(){return e.al.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Kr extends Zr{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Wr extends Zr{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Xr extends Zr{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Yr extends Zr{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Jr extends Zr{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class en extends Zr{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class tn extends Zr{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class rn extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class nn extends Zr{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class on extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class sn extends Zr{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class an extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class ln extends Zr{getDefault(){const e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class cn extends Zr{getDefault(){return e.al.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class un extends Zr{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class hn extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class dn extends Zr{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class pn extends Zr{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let fn=class extends Zr{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class An extends Zr{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class mn extends Zr{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class gn extends Zr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class _n extends Zr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class yn extends Zr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class vn extends Zr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class xn extends Zr{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class bn extends Zr{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class wn extends Zr{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Tn extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Bn extends Zr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Cn extends Zr{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class Sn extends Cn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class En extends Cn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,this.attachment(),t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Mn extends Cn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,this.attachment(),t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class In extends En{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Pn=(e,t,i)=>({u_matrix:e,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:i}),Ln=(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(r),u_merc_matrix:i,u_zoom_transition:n,u_merc_center:o,u_image0:0,u_frustum_tl:s,u_frustum_tr:a,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:u,u_globe_radius:h,u_viewport:d,u_grid_matrix:A?Float32Array.from(A):new Float32Array(9),u_skirt_height:p,u_far_z_cutoff:f});function Fn(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const kn=new class{constructor(){this.operations={}}newMorphing(e,t,i,r,n){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==i.tileID.key&&(t.queued=i)}else this.operations[e]={startTime:r,phase:0,duration:n,from:t,to:i,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},zn={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Rn(e,t,i){if(0===t)return 0;const r=t<1&&514===i?.25/t:1;return 6*Math.pow(1.5,22-e)*Math.max(t,1)*r}function Dn(e,t){const i=1<({u_matrix:e});function Un(t,i,r,n,o){if(o>0){const s=e.q.now(),a=(s-t.timeAdded)/o,l=i?(s-i.timeAdded)/o:-1,c=r.getSource(),u=n.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),d=h&&t.refreshedUponExpiration?1:e.ay(h?a:1-l,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}class Nn extends Bt{constructor(t){const i={type:"raster-dem",maxzoom:t.transform.maxZoom},r=new e.D(e.cj(),null),n=ot("mock-dem",i,r,t.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class Qn extends Bt{constructor(t){const i=ot("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new e.D(e.cj(),null),t.style);super("proxy",i,!1),i.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,t,i){if(e.freezeTileCoverage)return;this.transform=e;const r=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((t,i)=>{if(t[i.key]="",!this._tiles[i.key]){const t=new xt(i,this._source.tileSize*i.overscaleFactor(),e.tileZoom);t.state="loaded",this._tiles[i.key]=t}return t}),{});for(const e in this._tiles)e in r||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const i=Object.values(t);this.renderCachePool.push(...i),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach((e=>e.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class jn extends e.aH{constructor(e,t,i){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=i}}class Vn extends e.cK{constructor(t,i){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},(()=>{this._style.map.triggerRepaint()})),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},(()=>{this._style.map.triggerRepaint()})),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",(()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()})),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[r,n,o]=function(){const t=new e.b5,i=new e.aV,r=131;t.reserve(17161),i.reserve(33800);const n=e.ai/128,o=e.ai+n/2,s=o+n;for(let i=-n;io||i<0||i>o?24575:0,s=e.ay(Math.round(r),0,e.ai),a=e.ay(Math.round(i),0,e.ai);t.emplaceBack(s+n,a)}const a=(e,t)=>{const n=t*r+e;i.emplaceBack(n+1,n,n+r),i.emplaceBack(n+r,n+r+1,n+1)};for(let e=1;e<129;e++)for(let t=1;t<129;t++)a(t,e);return[0,129].forEach((e=>{for(let t=0;t<130;t++)a(t,e),a(e,t)})),[t,i,32768]}(),s=t.context;this.gridBuffer=s.createVertexBuffer(r,e.b7.members),this.gridIndexBuffer=s.createIndexBuffer(n),this.gridSegments=e.b8.simpleSegment(0,0,r.length,n.length),this.gridNoSkirtSegments=e.b8.simpleSegment(0,0,r.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Qn(i.map),this.orthoMatrix=e.ad.mat4.create(),e.ad.mat4.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.ai,0,e.ai,0,1);const a=s.gl;this._overlapStencilMode=new Ni({func:a.GEQUAL,mask:255},0,255,a.KEEP,a.KEEP,a.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=i,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Nn(i.map),this._pendingGroundEffectLayers=[]}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",(()=>{this._clearLineLayersFromRenderCache()}))}update(t,i,r){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const n=t.terrain.properties,o=0===t.terrain.drapeRenderMode,s=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.q.now();const a=t.terrain&&t.terrain.scope,l=n.get("source"),c=o?this._mockSourceCache:t.getSourceCache(l,a);if(!c)return void e.w(`Couldn't find terrain source "${l}".`);if(this.sourceCache=c,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=s?this.calculateExaggeration(i):n.get("exaggeration"),!i.projection.requiresDraping&&s&&0===this._exaggeration)return void this._disable();this.enabled=!0;const u=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(i,t,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,u(),this._initializing=!0),u(),i.updateElevation(!0,r),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0,this._previousZoom=i.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const i=this._previousCameraAltitude,r=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=r;const n=null!=i?r-i:Number.MAX_VALUE;if(Math.abs(n)<2)return this._exaggeration;const o=t.zoom,s=this._style.terrain;if(!this._previousUpdateTimestamp)return s.getExaggeration(o);let a=o-this._previousZoom;const l=this._previousUpdateTimestamp;let c=o;null!=this._evaluationZoom&&(c=this._evaluationZoom,Math.abs(o-c)>.5&&(a=.5*(o-c+a)),a*n<0&&(c+=a)),this._evaluationZoom=c;const u=s.getExaggeration(c),h=u===s.getExaggeration(Math.max(0,c-.1));if(h&&Math.abs(u-this._exaggeration)<.01)return u;let d=Math.min(.1,.00375*(this._updateTimestamp-l));return(h||u<.1||Math.abs(a)<1e-4)&&(d=Math.min(.2,4*d)),e.ah(this._exaggeration,u,d)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach((e=>e.fb.destroy())),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,r=this.painter.transform;this._initializing&&(this._initializing=0===r._centerAltitude&&-1===this.getAtPointOrZero(e.ac.fromLngLat(r.center),-1),this._emptyDEMTextureDirty=!this._initializing);const n=this.proxyCoords=i.getIds().map((e=>{const t=i.getTileByID(e).tileID;return t.projMatrix=r.calculateProjMatrix(t.toUnwrapped()),t}));!function(t,i){const r=i.transform.pointCoordinate(i.transform.getCameraPoint()),n=new e.P(r.x,r.y);t.sort(((t,i)=>{if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;const r=new e.P(t.canonical.x+(1<{this.proxyToSource[e.key]={}})),this.terrainTileForTile={};const s=this._style._mergedSourceCaches;for(const e in s){const i=s[e];if(!i.used)continue;if(i!==this.sourceCache&&this.resetTileLookupCache(i.id),this._setupProxiedCoordsForOrtho(i,t[e],o),i.usedForTerrain)continue;const r=t[e];i.getSource().reparseOverscaled&&this._assignTerrainTiles(r)}this.proxiedCoords[i.id]=n.map((e=>new jn(e,e.key,this.orthoMatrix))),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1;const a={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const i=t.tileID.key;i in a||(this._visibleDemTiles.push(t),a[i]=i)}}_assignTerrainTiles(e){this._initializing||e.forEach((e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)}))}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const i in this.terrainTileForTile){const r=this.terrainTileForTile[i],n=r.dem;!n||r.demTexture&&!r.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),Gr(this.painter,r,n))}}_prepareDemTileUniforms(e,t,i,r){if(!t||null==t.demTexture)return!1;const n=e.tileID.canonical,o=Math.pow(2,t.tileID.canonical.z-n.z),s=r||"";return i[`u_dem_tl${s}`]=[n.x*o%1,n.y*o%1],i[`u_dem_scale${s}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let e=0;const t=this._visibleDemTiles.reduce(((t,i)=>{if(!i.dem)return t;const r=i.dem.tree.minimums[0];return r>0&&e++,t+r}),0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);const r=this._getLoadedAreaMinimum(),n=new e.cL({width:1,height:1},new Float32Array([r]));this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(n,{premultiply:!1}):o=this._emptyDEMTexture=new e.T(t,n,i.R32F,{premultiply:!1}),o}setupElevationDraw(t,i,r){const n=this.painter.context,o=n.gl,s={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};s.u_exaggeration=this.exaggeration();let a=null,l=null,c=1;if(r&&r.morphing&&this._useVertexMorphing){const e=r.morphing.srcDemTile,i=r.morphing.dstDemTile;c=r.morphing.phase,e&&i&&(this._prepareDemTileUniforms(t,e,s,"_prev")&&(l=e),this._prepareDemTileUniforms(t,i,s)&&(a=i))}const u=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?o.LINEAR:o.NEAREST;let h=null;var d;if(this.enabled?l&&a?(h=a.demTexture,n.activeTexture.set(o.TEXTURE4),l.demTexture.bind(u(l),o.CLAMP_TO_EDGE),s.u_dem_lerp=c):(a=this.terrainTileForTile[t.tileID.key],h=this._prepareDemTileUniforms(t,a,s)?a.demTexture:this.emptyDEMTexture):h=this.emptyDEMTexture,n.activeTexture.set(o.TEXTURE2),h&&(s.u_dem_size=1===(d=h).size[0]?1:d.size[0]-2,h.bind(u(a),o.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(r&&r.useDepthForOcclusion,i,s),r&&r.useMeterToDem&&a){const t=(1<{if(c===i)return;const r=[zn[i],"PROJECTION_GLOBE_VIEW"];h&&r.push("CUSTOM_ANTIALIASING");const n=t.isTileAffectedByFog(e);l=t.getOrCreateProgram("globeRaster",{defines:r,overrideFog:n}),c=i},p=t.colorModeForRenderPass(),f=new Oi(a.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D);kn.update(o);const A=e.cE(u),m=[e.av(u.center.lng),e.aC(u.center.lat)],g=t.globeSharedBuffers,_=[u.width*e.q.devicePixelRatio,u.height*e.q.devicePixelRatio],y=Float32Array.from(u.globeMatrix),v={useDenormalizedUpVectorScale:!0};{const u=t.transform,h=Rn(u.zoom,i.exaggeration(),i.sourceCache._source.tileSize);c=-1;const x=a.TRIANGLES;for(const c of n){const n=r.getTile(c),b=Ni.disabled,w=i.prevTerrainTileForTile[c.key],T=i.terrainTileForTile[c.key];Fn(w,T)&&kn.newMorphing(c.key,w,T,o,250),s.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const B=kn.getMorphValuesForProxy(c.key),C=B?1:0;B&&e.L(v,{morphing:{srcDemTile:B.from,dstDemTile:B.to,phase:e.cC(B.phase)}});const S=e.cF(c.canonical),E=e.cG(S.getCenter().lat),M=e.cH(c.canonical,S,E,u.worldSize/u._pixelsPerMercatorPixel),I=e.bc(e.cI(c.canonical)),P=Ln(u.expandedFarZProjMatrix,y,A,I,e.ag(u.zoom),m,u.frustumCorners.TL,u.frustumCorners.TR,u.frustumCorners.BR,u.frustumCorners.BL,u.globeCenterInViewSpace,u.globeRadius,_,h,u._farZ,M);if(d(c,C),l&&(i.setupElevationDraw(n,l,v),t.uploadCommonUniforms(s,l,c.toUnwrapped()),g)){const[e,i,r]=g.getGridBuffers(E,0!==h);l.draw(t,x,f,b,p,Vi.backCCW,P,"globe_raster",e,i,r)}}}if(g&&(t.renderDefaultNorthPole||t.renderDefaultSouthPole)){const o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];h&&o.push("CUSTOM_ANTIALIASING"),l=t.getOrCreateProgram("globeRaster",{defines:o});for(const o of n){const{x:n,y:c,z:h}=o.canonical,d=0===c,A=c===(1<e.draw(t,a.TRIANGLES,f,Ni.disabled,p,Vi.disabled,Ln(u.expandedFarZProjMatrix,g,g,T,0,m,u.frustumCorners.TL,u.frustumCorners.TR,u.frustumCorners.BR,u.frustumCorners.BL,u.globeCenterInViewSpace,u.globeRadius,_,0,u._farZ),"globe_pole_raster",i,b,w);i.setupElevationDraw(c,l,v),t.uploadCommonUniforms(s,l,o.toUnwrapped()),d&&t.renderDefaultNorthPole&&B(l,y),A&&t.renderDefaultSouthPole&&(g=e.ad.mat4.scale(e.ad.mat4.create(),g,[1,-1,1]),B(l,x))}}}}(t,i,r,n,o);else{const s=t.context,a=s.gl;let l,c;const u=t.shadowRenderer,h=Ji(t,t.longestCutoffRange),d=e=>{if(c===e)return;const i=[];i.push(zn[e]),h.shouldRenderCutoff&&i.push("RENDER_CUTOFF"),u&&(i.push("RENDER_SHADOWS","DEPTH_TEXTURE"),u.useNormalOffset&&i.push("NORMAL_OFFSET")),l=t.getOrCreateProgram("terrainRaster",{defines:i}),c=e},p=t.colorModeForRenderPass(),f=new Oi(a.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D);kn.update(o);const A=t.transform,m=Rn(A.zoom,i.exaggeration(),i.sourceCache._source.tileSize);let g=[0,0,0];if(u){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(g=sr(t.style,e,i))}{c=-1;const _=a.TRIANGLES,[y,v]=[i.gridIndexBuffer,i.gridSegments];for(const c of n){const n=r.getTile(c),x=Ni.disabled,b=i.prevTerrainTileForTile[c.key],w=i.terrainTileForTile[c.key];Fn(b,w)&&kn.newMorphing(c.key,b,w,o,250),s.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const T=kn.getMorphValuesForProxy(c.key),B=T?1:0;let C;T&&(C={morphing:{srcDemTile:T.from,dstDemTile:T.to,phase:e.cC(T.phase)}});const S=Pn(c.projMatrix,Dn(c.canonical,A.renderWorldCopies)?m/10:m,g);if(d(B),!l)continue;i.setupElevationDraw(n,l,C);const E=c.toUnwrapped();u&&u.setupShadows(E,l),t.uploadCommonUniforms(s,l,E,null,h),l.draw(t,_,f,x,p,Vi.backCCW,S,"terrain_raster",i.gridBuffer,y,v)}}}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const i=this.painter,r=this.painter.context,n=this.proxySourceCache,o=this.proxiedCoords[n.id],s=this._drapedRenderBatches.shift(),a=i.style.order,l=[];let c=0;for(const u of o){const o=n.getTileByID(u.proxyTileKey),h=n.proxyCachedFBO[u.key]?n.proxyCachedFBO[u.key][t]:void 0,d=void 0!==h?n.renderCache[h]:this.pool[c++],p=void 0!==h;if(o.texture=d.tex,p&&!d.dirty){l.push(o.tileID);continue}let f;r.bindFramebuffer.set(d.fb.framebuffer),this.renderedToTile=!1,d.dirty&&(r.clear({color:e.al.transparent,stencil:0}),d.dirty=!1);for(let e=s.start;e<=s.end;++e){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const n=i.style.getLayerSourceCache(t),o=n?this.proxyToSource[u.key][n.id]:[u];if(!o)continue;const s=o;r.viewport.set([0,0,d.fb.width,d.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(d,o,t,n),f=n?n.id:null),i.renderLayer(i,n,t,s)}if(0===this._drapedRenderBatches.length)for(const e of this._pendingGroundEffectLayers){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const n=i.style.getLayerSourceCache(t),o=n?this.proxyToSource[u.key][n.id]:[u];if(!o)continue;const s=o;r.viewport.set([0,0,d.fb.width,d.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(d,o,t,n),f=n?n.id:null),i.renderLayer(i,n,t,s)}this.renderedToTile?(d.dirty=!0,l.push(o.tileID)):p||--c,5===c&&(c=0,this.renderToBackBuffer(l))}return this.renderToBackBuffer(l),this.renderingToTexture=!1,r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),s.end+1}postRender(){}isLayerOrderingCorrect(e){const t=e.order.length;let i=-1,r=t;for(let n=0;ni}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter((e=>e.dem)).forEach((t=>{e=Math.min(e,t.dem.tree.minimums[0])})),0===e?e:(e-30)*this._exaggeration}raycast(e,t,i){if(!this._visibleDemTiles)return null;const r=this._visibleDemTiles.filter((e=>e.dem)).map((r=>{const n=r.tileID,o=1<(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)));for(const n of r){if(null==n.t)return null;const r=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,e,t,i);if(null!=r)return r}return null}_createFBO(){const t=this.painter.context,i=t.gl,r=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);const n=new e.T(t,{width:r[0],height:r[1],data:null},i.RGBA8);n.bind(i.LINEAR,i.CLAMP_TO_EDGE);const o=t.createFramebuffer(r[0],r[1],!0,null);return o.colorAttachment.set(n.texture),o.depthAttachment=new In(t,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:o,tex:n,dirty:!1}}_initFBOPool(){for(;this.pool.length{const t=this._style._mergedLayers[e],i=t.isHidden(this.painter.transform.zoom);return"hillshade"===t.type||"custom"===t.type?!i&&t.shouldRedrape():!i&&t.hasTransition()}))}_clearLineLayersFromRenderCache(){let t=!1;for(const e of this._style.getSources())if(e instanceof tt){t=!0;break}if(!t)return;const i={};for(let t=0;te>t.end))||e.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=r}_setupRenderCache(e){const t=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,t.renderCache.length>t.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let i=0;i=0;n--){const o=i[n];if(t.getTileByID(o.key),void 0!==t.proxyCachedFBO[o.key]){const i=e[o.key],n=this.proxyToSource[o.key];let s=0;for(const e in n){const t=n[e],o=i[e];if(!o||o.length!==t.length||t.some(((t,i)=>t!==o[i]||r[e]&&r[e].hasOwnProperty(t.key)))){s=-1;break}++s}for(const e in t.proxyCachedFBO[o.key])t.renderCache[t.proxyCachedFBO[o.key][e]].dirty=s<0||s!==Object.values(i).length}}const n=[...this._drapedRenderBatches];n.sort(((e,t)=>t.end-t.start-(e.end-e.start)));for(const e of n)for(const r of i){if(t.proxyCachedFBO[r.key])continue;let i=t.renderCachePool.pop();void 0===i&&t.renderCache.length<50&&(i=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==i&&(t.proxyCachedFBO[r.key]={},t.proxyCachedFBO[r.key][e.start]=i,t.renderCache[i].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,i,r){if(!r||!this._sourceTilesOverlap[r.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const n=this.painter.context,o=n.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let s;if(i.isTileClipped())s=t.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);s=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+s>255&&(n.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=s,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):Ni.disabled}_renderTileClippingMasks(e,t){const i=this.painter,r=this.painter.context,n=r.gl;i._tileClippingMaskIDs={},r.setColorMode(Di.disabled),r.setDepthMode(Oi.disabled);const o=i.getOrCreateProgram("clippingMask");for(const r of e){const e=i._tileClippingMaskIDs[r.key]=--t;o.draw(i,n.TRIANGLES,Oi.disabled,new Ni({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),Di.disabled,Vi.disabled,On(r.projMatrix),"$clipping",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments)}}pointCoordinate(t){const i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;const r=[t.x,t.y,1,1];e.ad.vec4.transformMat4(r,r,i.pixelMatrixInverse),e.ad.vec4.scale(r,r,1/r[3]),r[0]/=i.worldSize,r[1]/=i.worldSize;const n=i._camera.position,o=e.bH(1,i.center.lat),s=[n[0],n[1],n[2]/o,0],a=e.ad.vec3.subtract([],r.slice(0,3),s);e.ad.vec3.normalize(a,a);const l=this.raycast(s,a,this._exaggeration);return null!==l&&l?(e.ad.vec3.scaleAndAdd(s,s,a,l),s[3]=s[2],s[2]*=o,s):null}_setupProxiedCoordsForOrtho(t,i,r){if(t.getSource()instanceof e.aK)return this._setupProxiedCoordsForImageSource(t,i,r);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const n=this.proxiedCoords[t.id]=[],o=this.proxyCoords;for(let e=0;et.overscaledZ-e.overscaledZ))}_setupProxiedCoordsForImageSource(t,i,r){if(!t.getSource().loaded())return;const n=this.proxiedCoords[t.id]=[],o=this.proxyCoords,s=t.getSource(),a=s.tileID;if(!a)return;const l=new e.P(a.x,a.y)._div(1<(e.min.x=Math.min(e.min.x,t.x-l.x),e.min.y=Math.min(e.min.y,t.y-l.y),e.max.x=Math.max(e.max.x,t.x-l.x),e.max.y=Math.max(e.max.y,t.y-l.y),e)),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=(t,i)=>{const r=t.wrap+t.canonical.x/(1<s+c.max.x||n+oa+c.max.y};for(let e=0;ee.key===i.tileID.key));if(e)return e}if(i.tileID.key!==t.key){const r=t.canonical.z-i.tileID.canonical.z;let o,s,a;n=e.ad.mat4.create();const l=i.tileID.wrap-t.wrap<0?(o=e.ai>>r,s=o*((i.tileID.canonical.x<=n){const r=t.canonical.z-n;i.getSource().reparseOverscaled?(a=Math.max(t.canonical.z+2,i.transform.tileZoom),s=new e.aH(a,t.wrap,n,t.canonical.x>>r,t.canonical.y>>r)):0!==r&&(a=n,s=new e.aH(a,t.wrap,n,t.canonical.x>>r,t.canonical.y>>r))}s.key!==t.key&&(c.push(s.key),r=i.getTile(s))}const u=e=>{c.forEach((t=>{n[t]=e})),c.length=0};for(a-=1;a>=l&&(!r||!r.hasData());a--){r&&u(r.tileID.key);const e=s.calculateScaledKey(a);if(r=i.getTileByID(e),r&&r.hasData())break;const t=n[e];if(null===t)break;void 0===t?c.push(e):r=i.getTileByID(t)}return u(r?r.tileID.key:null),r&&r.hasData()?r:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}}function Hn(t,i,r){const n=function(t,i,r){const n=e.ad.vec3.dot(i,t),o=e.ad.vec3.dot(r,[.2126,.7152,.0722]),s=(e,t,i)=>(1-i)*e+i*t,a=s(1-.3*Math.min(o,1),1,Math.min(n+1,1));return s(.92,1,Math.asin(e.ay(i[2],-1,1))/Math.PI+.5)*a}(t,[0,0,1],i),o=[0,0,0];e.ad.vec3.scale(o,r.slice(0,3),n);const s=[0,0,0];e.ad.vec3.scale(s,i.slice(0,3),t[2]);const a=[0,0,0];return e.ad.vec3.add(a,o,s),e.cg(a)}const Gn=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],$n=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class Zn{static cacheKey(e,t,i,r){let n=`${t}${r?r.cacheKey:""}`;for(const t of i)e.usedDefines.includes(t)&&(n+=`/${t}`);return n}constructor(t,i,r,n,o,s){const a=t.gl;this.program=a.createProgram(),this.configuration=n,this.name=i,this.fixedDefines=[...s];const l=n?n.getBinderAttributes():[],c=(r.staticAttributes||[]).concat(l);let u=n?n.defines():[];u=u.concat(s.map((e=>`#define ${e}`)));const h="#version 300 es\n";let d=h+u.concat("precision mediump float;",Or,Dr.fragmentSource).join("\n");for(const e of r.fragmentIncludes)d+=`\n${zr[e]}`;d+=`\n${r.fragmentSource}`;let p=h+u.concat("precision highp float;",Or,Dr.vertexSource).join("\n");for(const e of r.vertexIncludes)p+=`\n${zr[e]}`;this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&-1!==r.vertexSource.indexOf("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&(p+="\nuniform int u_instanceID;\n"),p+=`\n${r.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(p=p.replaceAll("gl_InstanceID","u_instanceID"));const f=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(f,d),a.compileShader(f),a.attachShader(this.program,f);const A=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(A,p),a.compileShader(A),a.attachShader(this.program,A),this.attributes={},this.numAttributes=c.length;for(let e=0;e({u_instanceID:new e.bN(t)}))(t)),(s.includes("TERRAIN")||-1!==i.indexOf("symbol")||-1!==i.indexOf("circle"))&&(this.terrainUniforms=(t=>({u_dem:new e.bN(t),u_dem_prev:new e.bN(t),u_dem_tl:new e.bK(t),u_dem_scale:new e.bM(t),u_dem_tl_prev:new e.bK(t),u_dem_scale_prev:new e.bM(t),u_dem_size:new e.bM(t),u_dem_lerp:new e.bM(t),u_exaggeration:new e.bM(t),u_depth:new e.bN(t),u_depth_size_inv:new e.bK(t),u_depth_range_unpack:new e.bK(t),u_occluder_half_size:new e.bM(t),u_occlusion_depth_offset:new e.bM(t),u_meter_to_dem:new e.bM(t),u_label_plane_matrix_inv:new e.bJ(t)}))(t)),s.includes("GLOBE")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.bL(t),u_tile_tr_up:new e.bL(t),u_tile_br_up:new e.bL(t),u_tile_bl_up:new e.bL(t),u_tile_up_scale:new e.bM(t)}))(t)),s.includes("FOG")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.bJ(t),u_fog_range:new e.bK(t),u_fog_color:new e.cb(t),u_fog_horizon_blend:new e.bM(t),u_fog_vertical_limit:new e.bK(t),u_fog_temporal_offset:new e.bM(t),u_frustum_tl:new e.bL(t),u_frustum_tr:new e.bL(t),u_frustum_br:new e.bL(t),u_frustum_bl:new e.bL(t),u_globe_pos:new e.bL(t),u_globe_radius:new e.bM(t),u_globe_transition:new e.bM(t),u_is_globe:new e.bN(t),u_viewport:new e.bK(t)}))(t)),s.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(t=>({u_cutoff_params:new e.cb(t)}))(t)),s.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(t=>({u_lighting_ambient_color:new e.bL(t),u_lighting_directional_dir:new e.bL(t),u_lighting_directional_color:new e.bL(t),u_ground_radiance:new e.bL(t)}))(t)),s.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(t=>({u_light_matrix_0:new e.bJ(t),u_light_matrix_1:new e.bJ(t),u_fade_range:new e.bK(t),u_shadow_normal_offset:new e.bL(t),u_shadow_intensity:new e.bM(t),u_shadow_texel_size:new e.bM(t),u_shadow_map_resolution:new e.bM(t),u_shadow_direction:new e.bL(t),u_shadow_bias:new e.bL(t),u_shadowmap_0:new e.bN(t),u_shadowmap_1:new e.bN(t)}))(t))}}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const i=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const i=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const i=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setCutoffUniformValues(e,t){if(!this.cutoffUniforms)return;const i=this.cutoffUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setLightsUniformValues(e,t){if(!this.lightsUniforms)return;const i=this.lightsUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setShadowUniformValues(e,t){if(this.failedToCreate||!this.shadowUniforms)return;const i=this.shadowUniforms;e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}_drawDebugWireframe(t,i,r,n,o,s,a,l,c,u){const h=t.options.wireframe;if(!1===h.terrain&&!1===h.layers2D&&!1===h.layers3D)return;const d=t.context;if(!(()=>!(!h.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!h.layers2D||t._terrain&&t._terrain.renderingToTexture||!Gn.includes(this.name))||!(!h.layers3D||!$n.includes(this.name)))())return;const p=d.gl,f=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,o,d);if(!f)return;const A=[...this.fixedDefines];A.push("DEBUG_WIREFRAME");const m=t.getOrCreateProgram(this.name,{config:this.configuration,defines:A});d.program.set(m.program);const g=(e,t,i)=>{if(t[e]&&i[e])for(const r in t[e])i[e][r]&&i[e][r].set(i.program,r,t[e][r].current)};c&&c.setUniforms(m.program,d,m.binderUniforms,a,{zoom:l}),g("fixedUniforms",this,m),g("terrainUniforms",this,m),g("globeUniforms",this,m),g("fogUniforms",this,m),g("lightsUniforms",this,m),g("shadowUniforms",this,m),f.bind(),d.setColorMode(new Di([p.ONE,p.ONE_MINUS_SRC_ALPHA,p.ZERO,p.ONE],e.al.transparent,[!0,!0,!0,!1])),d.setDepthMode(new Oi(i.func===p.LESS?p.LEQUAL:i.func,Oi.ReadOnly,i.range)),d.setStencilMode(Ni.disabled);const _=3*s.primitiveLength*2,y=3*s.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const e=u||1;for(let t=0;t1?p.drawElementsInstanced(p.LINES,_,p.UNSIGNED_SHORT,y,u):p.drawElements(p.LINES,_,p.UNSIGNED_SHORT,y);o.bind(),d.program.set(this.program),d.setDepthMode(i),d.setStencilMode(r),d.setColorMode(n)}checkUniforms(e,t,i){if(this.fixedDefines.includes(t))for(const r of Object.keys(i))if(!i[r].initialized)throw new Error(`Program '${this.name}', from draw '${e}': uniform ${r} not set but required by ${t} being defined`)}draw(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A){const m=e.context,g=m.gl;if(this.failedToCreate)return;m.program.set(this.program),m.setDepthMode(i),m.setStencilMode(r),m.setColorMode(n),m.setCullFace(o);for(const e of Object.keys(this.fixedUniforms))this.fixedUniforms[e].set(this.program,e,s[e]);p&&p.setUniforms(this.program,m,this.binderUniforms,h,{zoom:d});const _={[g.POINTS]:1,[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[t];this.checkUniforms(a,"RENDER_SHADOWS",this.shadowUniforms);const y=A&&A>0?1:void 0;for(const o of u.get()){const s=o.vaos||(o.vaos={});if((s[a]||(s[a]=new jr)).bind(m,this,l,p?p.getPaintVertexBuffers():[],c,o.vertexOffset,f||[],y),this.forceManualRenderingForInstanceIDShaders){const e=A||1;for(let i=0;i1?g.drawElementsInstanced(t,o.primitiveLength*_,g.UNSIGNED_SHORT,o.primitiveOffset*_*2,A):c?g.drawElements(t,o.primitiveLength*_,g.UNSIGNED_SHORT,o.primitiveOffset*_*2):g.drawArrays(t,o.vertexOffset,o.vertexLength);t===g.TRIANGLES&&c&&this._drawDebugWireframe(e,i,r,n,c,o,h,d,p,A)}}}function qn(t,i){const r=Math.pow(2,i.tileID.overscaledZ),n=i.tileSize*Math.pow(2,t.transform.tileZoom)/r,o=n*(i.tileID.canonical.x+i.tileID.wrap*r),s=n*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.at(i,1,t.transform.tileZoom),u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}const Kn={terrain:0,flat:1},Wn=e.ad.mat4.create(),Xn=(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_)=>{const y=i.style.light,v=y.properties.get("position"),x=[v.x,v.y,v.z],b=e.ad.mat3.create();"viewport"===y.properties.get("anchor")&&(e.ad.mat3.fromRotation(b,-i.transform.angle),e.ad.vec3.transformMat3(x,x,b));const w=y.properties.get("color"),T=i.transform,B={u_matrix:t,u_lightpos:x,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[w.r,w.g,w.b],u_vertical_gradient:+r,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Wn,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Kn[u],u_base_type:Kn[h],u_ao:o,u_edge_radius:s,u_width_scale:a,u_flood_light_color:A,u_vertical_scale:m,u_flood_light_intensity:g,u_ground_shadow_factor:_};return"globe"===T.projection.name&&(B.u_tile_id=[l.canonical.x,l.canonical.y,1<({u_matrix:e,u_edge_radius:t,u_width_scale:i,u_vertical_scale:r,u_height_type:Kn[n],u_base_type:Kn[o]}),Jn=(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g)=>{const _=Xn(t,i,r,n,o,s,a,l,u,h,d,p,f,A,m,g,1,[0,0,0]),y={u_height_factor:-Math.pow(2,l.overscaledZ)/c.tileSize/8};return e.l(_,qn(i,c),y)},eo=(e,t)=>({u_matrix:e,u_emissive_strength:t}),to=(t,i,r,n)=>e.l(eo(t,i),qn(r,n)),io=(e,t,i)=>({u_matrix:e,u_world:i,u_emissive_strength:t}),ro=(t,i,r,n,o)=>e.l(to(t,i,r,n),{u_world:o}),no=(e,t,i,r,n)=>({u_matrix:e,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:i,u_height_scale:r,u_reset_depth:n}),oo=(t,i,r,n)=>{const o=e.ai/r.tileSize;return{u_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(n),u_extrude_scale:[i.pixelsToGLUnits[0]/o,i.pixelsToGLUnits[1]/o]}},so=(e,t,i=1)=>({u_matrix:e,u_color:t.toRenderColor(null),u_overlay:0,u_overlay_scale:i}),ao=e.ad.mat4.create(),lo=(t,i,r,n,o,s,a)=>{const l=t.transform,c="globe"===l.projection.name,u=c?e.cO(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:e.at(r,1,s),h={u_matrix:i.projMatrix,u_extrude_scale:u,u_intensity:a,u_inv_rot_matrix:ao,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){h.u_inv_rot_matrix=n,h.u_merc_center=o,h.u_tile_id=[i.canonical.x,i.canonical.y,1<({u_matrix:t,u_normalize_matrix:i,u_globe_matrix:r,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:s,u_scale_parent:u,u_fade_t:h.mix,u_opacity:h.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:e.cP(d.paint.get("raster-saturation")),u_contrast_factor:e.cQ(d.paint.get("raster-contrast")),u_spin_weights:po(d.paint.get("raster-hue-rotate")),u_perspective_transform:p,u_raster_elevation:f,u_zoom_transition:a,u_merc_center:l,u_cutoff_params:c,u_colorization_mix:co(e.cR,m,_),u_colorization_offset:uo(e.cR,g,_),u_color_ramp:A,u_texture_offset:[v/(y+2*v),y/(y+2*v)],u_texture_res:[y+2*v,y+2*v],u_emissive_strength:x});function po(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const fo=.05,Ao=(e,t,i,r,n,o,s,a,l,c,u,h)=>({u_matrix:e,u_normalize_matrix:t,u_globe_matrix:i,u_merc_matrix:r,u_grid_matrix:n,u_tl_parent:o,u_scale_parent:c,u_fade_t:u.mix,u_opacity:u.opacity,u_image0:0,u_image1:1,u_raster_elevation:h,u_zoom_transition:s,u_merc_center:a,u_cutoff_params:l}),mo=(e,t,i,r,n,o,s,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_tile_offset:i,u_velocity:r,u_color_ramp:o,u_velocity_res:n,u_max_speed:s,u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[fo,fo]}),go=(e,t,i,r,n,o,s,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_velocity:i,u_velocity_res:r,u_max_speed:n,u_speed_factor:o,u_reset_rate:s,u_rand_seed:Math.random(),u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[fo,fo]}),_o=e.ad.mat4.create(),yo=(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b)=>{const w=o.transform,T={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:w.getCameraToCenterDistance(y),u_rotate_symbol:+r,u_aspect_ratio:w.width/w.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+u,u_elevation_from_sea:c?1:0,u_pitch_with_map:+n,u_texsize:h,u_texsize_icon:d,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:_o,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:_o,u_up_vector:[0,-1,0],u_color_adj_mat:v,u_icon_transition:x||0,u_gamma_scale:n?o.transform.getCameraToCenterDistance(y)*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.q.devicePixelRatio,u_is_halo:+p,u_scale_factor:b||1};return"globe"===y.name&&(T.u_tile_id=[f.canonical.x,f.canonical.y,1<({u_matrix:e,u_emissive_strength:t,u_opacity:i,u_color:r}),xo=(t,i,r,n,o,s,a,l,c)=>e.l(function(t,i,r,n,o,s){const{width:a,height:l}=n.imageManager.getPixelSize(i),c=Math.pow(2,s.tileID.overscaledZ),u=s.tileSize*Math.pow(2,n.transform.tileZoom)/c,h=u*(s.tileID.canonical.x+s.tileID.wrap*c),d=u*s.tileID.canonical.y;return{u_image:0,u_pattern_tl:r.tl,u_pattern_br:r.br,u_texsize:[a,l],u_pattern_size:r.displaySize,u_pattern_units_to_pixels:o?[n.transform.width,-1*n.transform.height]:[1/e.at(s,1,n.transform.tileZoom),1/e.at(s,1,n.transform.tileZoom)],u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(0,s,a,n,l,c),{u_matrix:t,u_emissive_strength:i,u_opacity:r}),bo=new Float32Array(e.ad.mat4.identity([])),wo=(t,i,r,n,o,s,a,l,c,u,h,d,p,f=[0,0,0],A)=>{const m=o.style.light,g=m.properties.get("position"),_=[-g.x,-g.y,g.z],y=e.ad.mat3.create();"viewport"===m.properties.get("anchor")&&(e.ad.mat3.fromRotation(y,-o.transform.angle),e.ad.vec3.transformMat3(_,_,y));const v="MASK"===h.alphaMode,x=m.properties.get("color").toRenderColor(null),b=p.paint.get("model-ambient-occlusion-intensity"),w=p.paint.get("model-color").constantOr(e.al.white).toRenderColor(null),T=p.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:t,u_lighting_matrix:i,u_normal_matrix:r,u_node_matrix:n||bo,u_lightpos:_,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[x.r,x.g,x.b],u_camera_pos:f,u_opacity:s,u_baseTextureIsAlpha:0,u_alphaMask:+v,u_alphaCutoff:h.alphaCutoff,u_baseColorFactor:[a.r,a.g,a.b,a.a],u_emissiveFactor:[l[0],l[1],l[2],1],u_metallicFactor:c,u_roughnessFactor:u,u_baseColorTexture:Ki.BaseColor,u_metallicRoughnessTexture:Ki.MetallicRoughness,u_normalTexture:Ki.Normal,u_occlusionTexture:Ki.Occlusion,u_emissionTexture:Ki.Emission,u_lutTexture:Ki.LUT,u_color_mix:[w.r,w.g,w.b,T],u_aoIntensity:b,u_emissive_strength:d,u_occlusionTextureTransform:A||[0,0,0,0]}},To=(e,t=bo,i=bo)=>({u_matrix:e,u_instance:t,u_node_matrix:i}),Bo={fillExtrusion:t=>({u_matrix:new e.bJ(t),u_lightpos:new e.bL(t),u_lightintensity:new e.bM(t),u_lightcolor:new e.bL(t),u_vertical_gradient:new e.bM(t),u_opacity:new e.bM(t),u_edge_radius:new e.bM(t),u_width_scale:new e.bM(t),u_ao:new e.bK(t),u_height_type:new e.bN(t),u_base_type:new e.bN(t),u_tile_id:new e.bL(t),u_zoom_transition:new e.bM(t),u_inv_rot_matrix:new e.bJ(t),u_merc_center:new e.bK(t),u_up_dir:new e.bL(t),u_height_lift:new e.bM(t),u_flood_light_color:new e.bL(t),u_vertical_scale:new e.bM(t),u_flood_light_intensity:new e.bM(t),u_ground_shadow_factor:new e.bL(t)}),fillExtrusionDepth:t=>({u_matrix:new e.bJ(t),u_edge_radius:new e.bM(t),u_width_scale:new e.bM(t),u_vertical_scale:new e.bM(t),u_height_type:new e.bN(t),u_base_type:new e.bN(t)}),fillExtrusionPattern:t=>({u_matrix:new e.bJ(t),u_lightpos:new e.bL(t),u_lightintensity:new e.bM(t),u_lightcolor:new e.bL(t),u_vertical_gradient:new e.bM(t),u_height_factor:new e.bM(t),u_edge_radius:new e.bM(t),u_width_scale:new e.bM(t),u_ao:new e.bK(t),u_height_type:new e.bN(t),u_base_type:new e.bN(t),u_tile_id:new e.bL(t),u_zoom_transition:new e.bM(t),u_inv_rot_matrix:new e.bJ(t),u_merc_center:new e.bK(t),u_up_dir:new e.bL(t),u_height_lift:new e.bM(t),u_image:new e.bN(t),u_texsize:new e.bK(t),u_pixel_coord_upper:new e.bK(t),u_pixel_coord_lower:new e.bK(t),u_tile_units_to_pixels:new e.bM(t),u_opacity:new e.bM(t)}),fillExtrusionGroundEffect:t=>({u_matrix:new e.bJ(t),u_opacity:new e.bM(t),u_ao_pass:new e.bM(t),u_meter_to_tile:new e.bM(t),u_ao:new e.bK(t),u_flood_light_intensity:new e.bM(t),u_flood_light_color:new e.bL(t),u_attenuation:new e.bM(t),u_edge_radius:new e.bM(t),u_fb:new e.bN(t),u_fb_size:new e.bM(t),u_dynamic_offset:new e.bM(t)}),fill:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t)}),fillPattern:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t),u_image:new e.bN(t),u_texsize:new e.bK(t),u_pixel_coord_upper:new e.bK(t),u_pixel_coord_lower:new e.bK(t),u_tile_units_to_pixels:new e.bM(t)}),fillOutline:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t),u_world:new e.bK(t)}),fillOutlinePattern:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t),u_world:new e.bK(t),u_image:new e.bN(t),u_texsize:new e.bK(t),u_pixel_coord_upper:new e.bK(t),u_pixel_coord_lower:new e.bK(t),u_tile_units_to_pixels:new e.bM(t)}),elevatedStructures:t=>({u_matrix:new e.bJ(t)}),elevatedStructuresDepthReconstruct:t=>({u_matrix:new e.bJ(t),u_camera_pos:new e.bL(t),u_depth_bias:new e.bM(t),u_height_scale:new e.bM(t),u_reset_depth:new e.bM(t)}),circle:e.cT,collisionBox:t=>({u_matrix:new e.bJ(t),u_camera_to_center_distance:new e.bM(t),u_extrude_scale:new e.bK(t)}),collisionCircle:t=>({u_matrix:new e.bJ(t),u_inv_matrix:new e.bJ(t),u_camera_to_center_distance:new e.bM(t),u_viewport_size:new e.bK(t)}),debug:t=>({u_color:new e.cA(t),u_matrix:new e.bJ(t),u_overlay:new e.bN(t),u_overlay_scale:new e.bM(t)}),clippingMask:t=>({u_matrix:new e.bJ(t)}),heatmap:t=>({u_extrude_scale:new e.bM(t),u_intensity:new e.bM(t),u_matrix:new e.bJ(t),u_inv_rot_matrix:new e.bJ(t),u_merc_center:new e.bK(t),u_tile_id:new e.bL(t),u_zoom_transition:new e.bM(t),u_up_dir:new e.bL(t)}),heatmapTexture:t=>({u_image:new e.bN(t),u_color_ramp:new e.bN(t),u_opacity:new e.bM(t)}),hillshade:t=>({u_matrix:new e.bJ(t),u_image:new e.bN(t),u_latrange:new e.bK(t),u_light:new e.bK(t),u_shadow:new e.cA(t),u_highlight:new e.cA(t),u_emissive_strength:new e.bM(t),u_accent:new e.cA(t)}),hillshadePrepare:t=>({u_matrix:new e.bJ(t),u_image:new e.bN(t),u_dimension:new e.bK(t),u_zoom:new e.bM(t)}),line:e.cU,linePattern:e.cV,raster:t=>({u_matrix:new e.bJ(t),u_normalize_matrix:new e.bJ(t),u_globe_matrix:new e.bJ(t),u_merc_matrix:new e.bJ(t),u_grid_matrix:new e.cB(t),u_tl_parent:new e.bK(t),u_scale_parent:new e.bM(t),u_fade_t:new e.bM(t),u_opacity:new e.bM(t),u_image0:new e.bN(t),u_image1:new e.bN(t),u_brightness_low:new e.bM(t),u_brightness_high:new e.bM(t),u_saturation_factor:new e.bM(t),u_contrast_factor:new e.bM(t),u_spin_weights:new e.bL(t),u_perspective_transform:new e.bK(t),u_raster_elevation:new e.bM(t),u_zoom_transition:new e.bM(t),u_merc_center:new e.bK(t),u_cutoff_params:new e.cb(t),u_colorization_mix:new e.cb(t),u_colorization_offset:new e.bM(t),u_color_ramp:new e.bN(t),u_texture_offset:new e.bK(t),u_texture_res:new e.bK(t),u_emissive_strength:new e.bM(t)}),rasterParticle:t=>({u_matrix:new e.bJ(t),u_normalize_matrix:new e.bJ(t),u_globe_matrix:new e.bJ(t),u_merc_matrix:new e.bJ(t),u_grid_matrix:new e.cB(t),u_tl_parent:new e.bK(t),u_scale_parent:new e.bM(t),u_fade_t:new e.bM(t),u_opacity:new e.bM(t),u_image0:new e.bN(t),u_image1:new e.bN(t),u_raster_elevation:new e.bM(t),u_zoom_transition:new e.bM(t),u_merc_center:new e.bK(t),u_cutoff_params:new e.cb(t)}),rasterParticleTexture:t=>({u_texture:new e.bN(t),u_opacity:new e.bM(t)}),rasterParticleDraw:t=>({u_particle_texture:new e.bN(t),u_particle_texture_side_len:new e.bM(t),u_tile_offset:new e.bK(t),u_velocity:new e.bN(t),u_color_ramp:new e.bN(t),u_velocity_res:new e.bK(t),u_max_speed:new e.bM(t),u_uv_offset:new e.bK(t),u_data_scale:new e.bK(t),u_data_offset:new e.bM(t),u_particle_pos_scale:new e.bM(t),u_particle_pos_offset:new e.bK(t)}),rasterParticleUpdate:t=>({u_particle_texture:new e.bN(t),u_particle_texture_side_len:new e.bM(t),u_velocity:new e.bN(t),u_velocity_res:new e.bK(t),u_max_speed:new e.bM(t),u_speed_factor:new e.bM(t),u_reset_rate:new e.bM(t),u_rand_seed:new e.bM(t),u_uv_offset:new e.bK(t),u_data_scale:new e.bK(t),u_data_offset:new e.bM(t),u_particle_pos_scale:new e.bM(t),u_particle_pos_offset:new e.bK(t)}),symbol:t=>({u_is_size_zoom_constant:new e.bN(t),u_is_size_feature_constant:new e.bN(t),u_size_t:new e.bM(t),u_size:new e.bM(t),u_camera_to_center_distance:new e.bM(t),u_rotate_symbol:new e.bN(t),u_aspect_ratio:new e.bM(t),u_fade_change:new e.bM(t),u_matrix:new e.bJ(t),u_label_plane_matrix:new e.bJ(t),u_coord_matrix:new e.bJ(t),u_is_text:new e.bN(t),u_elevation_from_sea:new e.bN(t),u_pitch_with_map:new e.bN(t),u_texsize:new e.bK(t),u_texsize_icon:new e.bK(t),u_texture:new e.bN(t),u_texture_icon:new e.bN(t),u_gamma_scale:new e.bM(t),u_device_pixel_ratio:new e.bM(t),u_tile_id:new e.bL(t),u_zoom_transition:new e.bM(t),u_inv_rot_matrix:new e.bJ(t),u_merc_center:new e.bK(t),u_camera_forward:new e.bL(t),u_tile_matrix:new e.bJ(t),u_up_vector:new e.bL(t),u_ecef_origin:new e.bL(t),u_is_halo:new e.bN(t),u_icon_transition:new e.bM(t),u_color_adj_mat:new e.bJ(t),u_scale_factor:new e.bM(t)}),background:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t),u_opacity:new e.bM(t),u_color:new e.cA(t)}),backgroundPattern:t=>({u_matrix:new e.bJ(t),u_emissive_strength:new e.bM(t),u_opacity:new e.bM(t),u_image:new e.bN(t),u_pattern_tl:new e.bK(t),u_pattern_br:new e.bK(t),u_texsize:new e.bK(t),u_pattern_size:new e.bK(t),u_pixel_coord_upper:new e.bK(t),u_pixel_coord_lower:new e.bK(t),u_pattern_units_to_pixels:new e.bK(t)}),terrainRaster:t=>({u_matrix:new e.bJ(t),u_image0:new e.bN(t),u_skirt_height:new e.bM(t),u_ground_shadow_factor:new e.bL(t)}),skybox:t=>({u_matrix:new e.bJ(t),u_sun_direction:new e.bL(t),u_cubemap:new e.bN(t),u_opacity:new e.bM(t),u_temporal_offset:new e.bM(t)}),skyboxGradient:t=>({u_matrix:new e.bJ(t),u_color_ramp:new e.bN(t),u_center_direction:new e.bL(t),u_radius:new e.bM(t),u_opacity:new e.bM(t),u_temporal_offset:new e.bM(t)}),skyboxCapture:t=>({u_matrix_3f:new e.cB(t),u_sun_direction:new e.bL(t),u_sun_intensity:new e.bM(t),u_color_tint_r:new e.cb(t),u_color_tint_m:new e.cb(t),u_luminance:new e.bM(t)}),globeRaster:t=>({u_proj_matrix:new e.bJ(t),u_globe_matrix:new e.bJ(t),u_normalize_matrix:new e.bJ(t),u_merc_matrix:new e.bJ(t),u_zoom_transition:new e.bM(t),u_merc_center:new e.bK(t),u_image0:new e.bN(t),u_grid_matrix:new e.cB(t),u_skirt_height:new e.bM(t),u_far_z_cutoff:new e.bM(t),u_frustum_tl:new e.bL(t),u_frustum_tr:new e.bL(t),u_frustum_br:new e.bL(t),u_frustum_bl:new e.bL(t),u_globe_pos:new e.bL(t),u_globe_radius:new e.bM(t),u_viewport:new e.bK(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.bL(t),u_frustum_tr:new e.bL(t),u_frustum_br:new e.bL(t),u_frustum_bl:new e.bL(t),u_horizon:new e.bM(t),u_transition:new e.bM(t),u_fadeout_range:new e.bM(t),u_color:new e.cb(t),u_high_color:new e.cb(t),u_space_color:new e.cb(t),u_temporal_offset:new e.bM(t),u_horizon_angle:new e.bM(t)}),model:t=>({u_matrix:new e.bJ(t),u_lighting_matrix:new e.bJ(t),u_normal_matrix:new e.bJ(t),u_node_matrix:new e.bJ(t),u_lightpos:new e.bL(t),u_lightintensity:new e.bM(t),u_lightcolor:new e.bL(t),u_camera_pos:new e.bL(t),u_opacity:new e.bM(t),u_baseColorFactor:new e.cb(t),u_emissiveFactor:new e.cb(t),u_metallicFactor:new e.bM(t),u_roughnessFactor:new e.bM(t),u_baseTextureIsAlpha:new e.bN(t),u_alphaMask:new e.bN(t),u_alphaCutoff:new e.bM(t),u_baseColorTexture:new e.bN(t),u_metallicRoughnessTexture:new e.bN(t),u_normalTexture:new e.bN(t),u_occlusionTexture:new e.bN(t),u_emissionTexture:new e.bN(t),u_lutTexture:new e.bN(t),u_color_mix:new e.cb(t),u_aoIntensity:new e.bM(t),u_emissive_strength:new e.bM(t),u_occlusionTextureTransform:new e.cb(t)}),modelDepth:t=>({u_matrix:new e.bJ(t),u_instance:new e.bJ(t),u_node_matrix:new e.bJ(t)}),groundShadow:t=>({u_matrix:new e.bJ(t),u_ground_shadow_factor:new e.bL(t)}),stars:t=>({u_matrix:new e.bJ(t),u_up:new e.bL(t),u_right:new e.bL(t),u_intensity_multiplier:new e.bM(t)}),snowParticle:t=>({u_modelview:new e.bJ(t),u_projection:new e.bJ(t),u_time:new e.bM(t),u_cam_pos:new e.bL(t),u_velocityConeAperture:new e.bM(t),u_velocity:new e.bM(t),u_horizontalOscillationRadius:new e.bM(t),u_horizontalOscillationRate:new e.bM(t),u_boxSize:new e.bM(t),u_billboardSize:new e.bM(t),u_simpleShapeParameters:new e.bK(t),u_screenSize:new e.bK(t),u_thinningCenterPos:new e.bK(t),u_thinningShape:new e.bL(t),u_thinningAffectedRatio:new e.bM(t),u_thinningParticleOffset:new e.bM(t),u_particleColor:new e.cb(t),u_direction:new e.bL(t)}),rainParticle:t=>({u_modelview:new e.bJ(t),u_projection:new e.bJ(t),u_time:new e.bM(t),u_cam_pos:new e.bL(t),u_texScreen:new e.bN(t),u_velocityConeAperture:new e.bM(t),u_velocity:new e.bM(t),u_boxSize:new e.bM(t),u_rainDropletSize:new e.bK(t),u_distortionStrength:new e.bM(t),u_rainDirection:new e.bL(t),u_color:new e.cb(t),u_screenSize:new e.bK(t),u_thinningCenterPos:new e.bK(t),u_thinningShape:new e.bL(t),u_thinningAffectedRatio:new e.bM(t),u_thinningParticleOffset:new e.bM(t),u_shapeDirectionalPower:new e.bM(t),u_shapeNormalPower:new e.bM(t),u_mode:new e.bM(t)}),vignette:t=>({u_vignetteShape:new e.bL(t),u_vignetteColor:new e.cb(t)}),occlusion:t=>({u_matrix:new e.bJ(t),u_anchorPos:new e.bL(t),u_screenSizePx:new e.bK(t),u_occluderSizePx:new e.bK(t),u_color:new e.cb(t)})};class Co{constructor(e,t,i,r){this.id=Co.uniqueIdxCounter,Co.uniqueIdxCounter++,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||r||t.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=Co.uniqueIdxCounter,Co.uniqueIdxCounter++;const t=this.context.gl;this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Co.uniqueIdxCounter=0;const So={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Eo{constructor(e,t,i,r,n,o){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.instanceCount=o,this.context=e;const s=e.gl;this.buffer=s.createBuffer(),e.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||n||t.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i0&&e.vertexAttribDivisor(n,i)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Mo{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;const o=this.framebuffer=e.gl.createFramebuffer();r&&(this.colorAttachment=new Sn(e,o)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new En(e,o):new Mn(e,o))}destroy(){const e=this.context.gl;if(this.colorAttachment){const t=this.colorAttachment.get();t&&e.deleteTexture(t)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}else{const t=this.depthAttachment.get();t&&e.deleteTexture(t)}e.deleteFramebuffer(this.framebuffer)}}class Io{constructor(e,t){this.gl=e,this.clearColor=new qr(this),this.clearDepth=new Kr(this),this.clearStencil=new Wr(this),this.colorMask=new Xr(this),this.depthMask=new Yr(this),this.stencilMask=new Jr(this),this.stencilFunc=new en(this),this.stencilOp=new tn(this),this.stencilTest=new rn(this),this.depthRange=new nn(this),this.depthTest=new on(this),this.depthFunc=new sn(this),this.blend=new an(this),this.blendFunc=new ln(this),this.blendColor=new cn(this),this.blendEquation=new un(this),this.cullFace=new hn(this),this.cullFaceSide=new dn(this),this.frontFace=new pn(this),this.program=new fn(this),this.activeTexture=new An(this),this.viewport=new mn(this),this.bindFramebuffer=new gn(this),this.bindRenderbuffer=new _n(this),this.bindTexture=new yn(this),this.bindVertexBuffer=new vn(this),this.bindElementBuffer=new xn(this),this.bindVertexArrayOES=new bn(this),this.pixelStoreUnpack=new wn(this),this.pixelStoreUnpackPremultiplyAlpha=new Tn(this),this.pixelStoreUnpackFlipY=new Bn(this),this.options=t?Object.assign({},t):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=t&&!!t.forceManualRenderingForInstanceIDShaders||this.renderer&&-1!==this.renderer.indexOf("PowerVR"),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxPointSize=e.getParameter(e.ALIASED_POINT_SIZE_RANGE)[1]}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.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t,i){return new Co(this,e,t,i)}createVertexBuffer(e,t,i,r,n){return new Eo(this,e,t,i,r,n)}createRenderbuffer(e,t,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new Mo(this,e,t,i,r)}clear({color:e,depth:t,stencil:i,colorMask:r}){const n=this.gl;let o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set(r||[!0,!0,!0,!0])),void 0!==t&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(t){e.bn(t.blendFunction,Di.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Po;function Lo(t,i,r,n,o,s,a){const l=t.context,c=l.gl,u=t.transform,h=t.getOrCreateProgram("collisionBox"),d=[];let p=0,f=0;for(let l=0;l0){const t=e.ad.mat4.create(),i=y;e.ad.mat4.mul(t,g.placementInvProjMatrix,u.glCoordMatrix),e.ad.mat4.mul(t,t,g.placementViewportMatrix),d.push({circleArray:x,circleOffset:f,transform:i,invTransform:t,projection:g.getProjection()}),p+=x.length/4,f=p}v&&(t.terrain&&t.terrain.setupElevationDraw(m,h),h.draw(t,c.LINES,Oi.disabled,Ni.disabled,t.colorModeForRenderPass(),Vi.disabled,oo(y,u,m,g.getProjection()),r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,u.zoom,null,[v.collisionVertexBuffer,v.collisionVertexBufferExt]))}if(!a||!d.length)return;const A=t.getOrCreateProgram("collisionCircle"),m=new e.cW;m.resize(4*p),m._trim();let g=0;for(const e of d)for(let t=0;t=0&&(A[v.associatedIconIndex]={x:B,y:C,z:S,angle:L})}else ri(w,p)}if(h){f.clear();const i=t.icon.placedSymbolArray;for(let t=0;t{B.depthOcclusionForSymbolsAndCircles&&(r.hasInitialOcclusionOpacityProperties||t.terrain)&&(e.push("DEPTH_D24"),e.push("DEPTH_OCCLUSION"))},N=()=>{const i=C&&"point"!==r.layout.get("symbol-placement"),a=[];U(a);const c=i||L,h=r.paint.get("icon-image-cross-fade").constantOr(0);t.terrainRenderModeElevated()&&E&&a.push("PITCH_WITH_MAP_TERRAIN"),d&&(a.push("PROJECTION_GLOBE_VIEW"),c&&a.push("PROJECTED_POS_ON_VIEWPORT")),h>0&&a.push("ICON_TRANSITION"),s.icon.zOffsetVertexBuffer&&a.push("Z_OFFSET"),0===_&&0===y&&0===v&&1===x||a.push("COLOR_ADJUSTMENT"),s.sdfIcons&&a.push("RENDER_SDF");const g=s.icon.programConfigurations.get(r.id),w=t.getOrCreateProgram("symbol",{config:g,defines:a}),S=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],M=s.iconSizeData,I=e.bp(M,B.zoom),P=E||0!==B.pitch,k=Ht(f,n.tileID.canonical,E,C,B,s.getProjection(),A),R=$t(f,n.tileID.canonical,E,C,B,s.getProjection(),A),N=t.translatePosMatrix(R,n,l,u,!0),Q=t.translatePosMatrix(f,n,l,u),j=c?Fo:k,V=C&&!E&&!i;let H=D;!z&&!B.mercatorFromTransition||C||(H=ko(B));const G=d?H:D,$=r.getColorAdjustmentMatrix(_,y,v,x),Z=yo(M.kind,I,V,E,t,Q,j,N,b,!1,S,[0,0],!0,o,p,F,O,G,s.getProjection(),$,h),q=n.imageAtlasTexture?n.imageAtlasTexture:null,K=1!==r.layout.get("icon-size").constantOr(0)||s.iconsNeedLinear,W=s.sdfIcons||t.options.rotating||t.options.zooming||K||P?T.LINEAR:T.NEAREST,X=s.sdfIcons&&0!==r.paint.get("icon-halo-width").constantOr(1),Y=t.terrain&&E&&i?e.ad.mat4.invert(e.ad.mat4.create(),k):Fo;if(i&&s.icon){const e=B.elevation,i=e?e.getAtTileOffsetFunc(o,B.center.lat,B.worldSize,s.getProjection()):null,r=Gt(f,n.tileID.canonical,E,C,B,s.getProjection(),A);Wt(s,f,t,!1,r,R,E,m,i,o)}return{program:w,buffers:s.icon,uniformValues:Z,atlasTexture:q,atlasTextureIcon:null,atlasInterpolation:W,atlasInterpolationIcon:null,isSDF:s.sdfIcons,hasHalo:X,tile:n,labelPlaneMatrixInv:Y}},Q=()=>{const i=S&&"point"!==r.layout.get("symbol-placement"),a=[],l=i||k||L;t.terrainRenderModeElevated()&&M&&a.push("PITCH_WITH_MAP_TERRAIN"),d&&(a.push("PROJECTION_GLOBE_VIEW"),l&&a.push("PROJECTED_POS_ON_VIEWPORT")),s.text.zOffsetVertexBuffer&&a.push("Z_OFFSET"),s.iconsInText&&a.push("RENDER_TEXT_AND_SYMBOL"),a.push("RENDER_SDF"),U(a);const u=s.text.programConfigurations.get(r.id),m=t.getOrCreateProgram("symbol",{config:u,defines:a});let _,y=[0,0],v=null;const x=s.textSizeData;s.iconsInText&&(y=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],v=n.imageAtlasTexture?n.imageAtlasTexture:null,_=M||0!==B.pitch||t.options.rotating||t.options.zooming||"composite"===x.kind||"camera"===x.kind?T.LINEAR:T.NEAREST);const w=n.glyphAtlasTexture?n.glyphAtlasTexture.size:[0,0],C=r.layout.get("text-size-scale-range"),E=e.ay(t.scaleFactor,C[0],C[1]),I=e.bp(x,B.zoom,E),P=Ht(f,n.tileID.canonical,M,S,B,s.getProjection(),A),R=$t(f,n.tileID.canonical,M,S,B,s.getProjection(),A),N=t.translatePosMatrix(R,n,c,h,!0),Q=t.translatePosMatrix(f,n,c,h),j=l?Fo:P,V=S&&!M&&!i;let H=D;!z&&!B.mercatorFromTransition||S||(H=ko(B));const G=yo(x.kind,I,V,M,t,Q,j,N,b,!0,w,y,!0,o,p,F,O,d?H:D,s.getProjection(),null,null,E),$=n.glyphAtlasTexture?n.glyphAtlasTexture:null,Z=T.LINEAR,q=0!==r.paint.get("text-halo-width").constantOr(1),K=t.terrain&&M&&i?e.ad.mat4.invert(e.ad.mat4.create(),P):Fo;if(i&&s.text){const e=B.elevation,i=e?e.getAtTileOffsetFunc(o,B.center.lat,B.worldSize,s.getProjection()):null,r=Gt(f,n.tileID.canonical,M,S,B,s.getProjection(),A);Wt(s,f,t,!0,r,R,M,g,i,o)}return{program:m,buffers:s.text,uniformValues:G,atlasTexture:$,atlasTextureIcon:v,atlasInterpolation:Z,atlasInterpolationIcon:_,isSDF:!0,hasHalo:q,tile:n,labelPlaneMatrixInv:K}},j=s.icon.segments.get().length,V=s.text.segments.get().length,H=j&&!a.onlyText?N():null,G=V&&!a.onlyIcons?Q():null,$=r.paint.get("icon-opacity").constantOr(1),Z=r.paint.get("text-opacity").constantOr(1);if(I&&s.canOverlap){P=!0;const t=$&&!a.onlyText?s.icon.segments.get():[],i=Z&&!a.onlyIcons?s.text.segments.get():[];for(const i of t)R.push({segments:new e.b8([i]),sortKey:i.sortKey,state:H});for(const t of i)R.push({segments:new e.b8([t]),sortKey:t.sortKey,state:G})}else a.onlyText||R.push({segments:$?s.icon.segments:new e.b8([]),sortKey:0,state:H}),a.onlyIcons||R.push({segments:Z?s.text.segments:new e.b8([]),sortKey:0,state:G})}P&&R.sort(((e,t)=>e.sortKey-t.sortKey));for(const e of R){const i=e.state;if(i)if(t.terrain?t.terrain.setupElevationDraw(i.tile,i.program,{useDepthForOcclusion:B.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:i.labelPlaneMatrixInv}):t.setupDepthForOcclusion(B.depthOcclusionForSymbolsAndCircles,i.program),w.activeTexture.set(T.TEXTURE0),i.atlasTexture&&i.atlasTexture.bind(i.atlasInterpolation,T.CLAMP_TO_EDGE,!0),i.atlasTextureIcon&&(w.activeTexture.set(T.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,T.CLAMP_TO_EDGE,!0)),t.uploadCommonLightUniforms(t.context,i.program),i.hasHalo){const n=i.uniformValues;n.u_is_halo=1,Oo(i.buffers,e.segments,r,t,i.program,L,o,s,n,2),n.u_is_halo=0}else{if(i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Oo(i.buffers,e.segments,r,t,i.program,L,o,s,n,1)),n.u_is_halo=0}Oo(i.buffers,e.segments,r,t,i.program,L,o,s,i.uniformValues,1)}}}function Oo(e,t,i,r,n,o,s,a,l,c){const u=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer];n.draw(r,r.context.gl.TRIANGLES,o,s,a,Vi.disabled,l,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),u,c)}function Uo(t,i){const r=1<=Xi?1:i/Xi))),2*r}(t.transform),u=t.transform.getFreeCameraOptions().position,h="elevatedStructuresDepthReconstruct",d=t.getOrCreateProgram(h,{defines:["DEPTH_RECONSTRUCTION"]}),p=t.getOrCreateProgram(h);for(const e of n){const n=i.getTile(e),h=n.getBucket(r);if(!h)continue;const f=h.elevatedStructures;if(!f)continue;const A=h.elevationBufferData.heightRange,m=Uo(e.toUnwrapped(),u),g=t.translatePosMatrix(e.projMatrix,n,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));let _,y,v,x;if("initialize"===o){if(!A||A.min>=1||0===f.depthSegments.segments[0].primitiveLength)continue;_=no(g,m,c,1,0),y=a,v=f.depthSegments,x=d}else if("reset"===o){if(!A||A.min>=0||0===f.maskSegments.segments[0].primitiveLength)continue;_=no(g,m,0,0,1),y=l,v=f.maskSegments,x=d}else if("geometry"===o){if(0===f.depthSegments.segments[0].primitiveLength)continue;_=no(g,m,c,1,0),y=a,v=f.depthSegments,x=p}x.draw(t,s.TRIANGLES,y,Ni.disabled,Di.disabled,Vi.disabled,_,r.id,f.vertexBuffer,f.indexBuffer,v,r.paint,t.transform.zoom)}}function Qo(t,i,r){const{painter:n,sourceCache:o,layer:s,coords:a,colorMode:l,elevationType:c,terrainEnabled:u,pass:h}=t,d=n.context.gl,p=s.paint.get("fill-pattern");let f=c;"road"!==c||i&&!u||(f="none");const A="road"===f,m=new Oi(n.context.gl.LEQUAL,Oi.ReadWrite,n.depthRangeFor3D),g=p&&p.constantOr(1),_=(t,c)=>{let u,h,_,y,v;c?(h=g&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=d.LINES):(h=g?"fillPattern":"fill",u=d.TRIANGLES);for(const x of a){const a=o.getTile(x);if(g&&!a.patternsLoaded())continue;const b=a.getBucket(s);if(!b)continue;const w=i?b.elevationBufferData:b.bufferData;if(w.isEmpty())continue;n.prepareDrawTile();const T=w.programConfigurations.get(s.id),B=n.isTileAffectedByFog(x),C=[],S=[];A&&(C.push("ELEVATED_ROADS"),S.push(w.elevatedLayoutVertexBuffer));const E=n.getOrCreateProgram(h,{config:T,overrideFog:B,defines:C});g&&(n.context.activeTexture.set(d.TEXTURE0),a.imageAtlasTexture&&a.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),T.updatePaintBuffers());const M=p.constantOr(null);if(M&&a.imageAtlas){const t=a.imageAtlas,i=e.d0.from(M).getPrimary().scaleSelf(e.q.devicePixelRatio).toString(),r=t.patternPositions.get(i);r&&T.setConstantPatternPositions(r)}const I=n.translatePosMatrix(x.projMatrix,a,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor")),P=s.paint.get("fill-emissive-strength");if(c){y=w.lineIndexBuffer,v=w.lineSegments;const e=n.terrain&&n.terrain.renderingToTexture?n.terrain.drapeBufferSize:[d.drawingBufferWidth,d.drawingBufferHeight];_="fillOutlinePattern"===h&&g?ro(I,P,n,a,e):io(I,P,e)}else y=w.indexBuffer,v=w.triangleSegments,_=g?to(I,P,n,a):eo(I,P);n.uploadCommonUniforms(n.context,E,x.toUnwrapped()),E.draw(n,u,"none"!==f?m:t,r||n.stencilModeForClipping(x),l,Vi.disabled,_,s.id,w.layoutVertexBuffer,y,v,s.paint,n.transform.zoom,T,S)}};n.renderPass===h&&_(n.depthModeForSublayer(1,"opaque"===n.renderPass?Oi.ReadWrite:Oi.ReadOnly),!1),"none"===f&&"translucent"===n.renderPass&&s.paint.get("fill-antialias")&&_(n.depthModeForSublayer(s.getPaintProperty("fill-outline-color")?2:0,Oi.ReadOnly),!0)}function jo(t,i,r,n,o,s,a,l){r.resetLayerRenderingStats(t);const c=t.context,u=c.gl,h=t.transform,d=r.paint.get("fill-extrusion-pattern"),p=d.constantOr(1),f=r.paint.get("fill-extrusion-opacity"),A=t.style.enable3dLights(),m=r.paint.get(A&&!p?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),g=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),m],_=r.layout.get("fill-extrusion-edge-radius"),y=_>0&&!r.paint.get("fill-extrusion-rounded-roof"),v=y?0:_,x="globe"===h.projection.name?e.d6():0,b="globe"===h.projection.name,w=b?e.ag(h.zoom):0,T=[e.av(h.center.lng),e.aC(h.center.lat)],B="none"===r.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),C=r.paint.get("fill-extrusion-flood-light-color").toRenderColor(B?null:r.lut).toArray01().slice(0,3),S=r.paint.get("fill-extrusion-flood-light-intensity"),E=r.paint.get("fill-extrusion-vertical-scale"),M=0!==r.paint.get("fill-extrusion-line-width").constantOr(1),I=r.paint.get("fill-extrusion-height-alignment"),P=r.paint.get("fill-extrusion-base-alignment"),L=Ji(t,r.paint.get("fill-extrusion-cutoff-fade-range")),F=[];let k;b&&F.push("PROJECTION_GLOBE_VIEW"),g[0]>0&&F.push("FAUX_AO"),y&&F.push("ZERO_ROOF_RADIUS"),l&&F.push("HAS_CENTROID"),S>0&&F.push("FLOOD_LIGHT"),L.shouldRenderCutoff&&F.push("RENDER_CUTOFF"),M&&F.push("RENDER_WALL_MODE");const z="shadow"===t.renderPass,R=t.shadowRenderer,D=z&&!!R;t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!0);let O=[0,0,0];if(R){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(O=sr(t.style,e,i)),z||(F.push("RENDER_SHADOWS","DEPTH_TEXTURE"),R.useNormalOffset&&F.push("NORMAL_OFFSET")),k=F.concat(["SHADOWS_SINGLE_CASCADE"])}const U=D?"fillExtrusionDepth":p?"fillExtrusionPattern":"fillExtrusion",N=r.getLayerRenderingStats();for(const A of n){const n=i.getTile(A),m=n.getBucket(r);if(!m||m.projection.name!==h.projection.name)continue;let _=!1;R&&(_=0===R.getMaxCascadeForTile(A.toUnwrapped()));const y=t.isTileAffectedByFog(A),B=m.programConfigurations.get(r.id),D=t.getOrCreateProgram(U,{config:B,defines:_?k:F,overrideFog:y});if(t.terrain&&t.terrain.setupElevationDraw(n,D,{useMeterToDem:!0}),!m.centroidVertexBuffer){const e=D.attributes.a_centroid_pos;void 0!==e&&u.vertexAttrib2f(e,0,0)}!z&&R&&R.setupShadows(n.tileID.toUnwrapped(),D,"vector-tile",n.tileID.overscaledZ),p&&(t.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),B.updatePaintBuffers());const Q=d.constantOr(null);if(Q&&n.imageAtlas){const t=n.imageAtlas,i=e.d0.from(Q).getPrimary().scaleSelf(e.q.devicePixelRatio),r=t.patternPositions.get(i.toString());r&&B.setConstantPatternPositions(r)}const j=r.paint.get("fill-extrusion-vertical-gradient"),V=1/m.tileToMeter;let H;if(z&&R){if(qo(n.tileID,m,t))continue;const e=R.calculateShadowPassMatrixFromTile(n.tileID.toUnwrapped());H=Yn(e,v,V,E,I,P)}else{const e=t.translatePosMatrix(A.expandedProjMatrix,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),i=h.projection.createInversionMatrix(h,A.canonical);H=p?Jn(e,t,j,f,g,v,V,A,n,x,I,P,w,T,i,C,E):Xn(e,t,j,f,g,v,V,A,x,I,P,w,T,i,C,E,S,O)}t.uploadCommonUniforms(c,D,A.toUnwrapped(),null,L);let G=m.segments;if("mercator"===h.projection.name&&!z&&(G=m.getVisibleSegments(n.tileID,t.terrain,t.transform.getFrustum(0)),!G.get().length))continue;if(N)if(z)for(const e of G.get())N.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(const e of G.get())N.numRenderedVerticesInTransparentPass+=e.primitiveLength;const $=[];(t.terrain||l)&&$.push(m.centroidVertexBuffer),b&&$.push(m.layoutVertexExtBuffer),M&&$.push(m.wallVertexBuffer),D.draw(t,c.gl.TRIANGLES,o,s,a,Vi.backCCW,H,r.id,m.layoutVertexBuffer,m.indexBuffer,G,r.paint,t.transform.zoom,B,$)}t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!1)}function Vo(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y){const v=t.context,x=v.gl,b=t.transform,w=t.transform.zoom,T=[],B=Ji(t,r.paint.get("fill-extrusion-cutoff-fade-range"));"clear"===u?(T.push("CLEAR_SUBPASS"),y&&(T.push("CLEAR_FROM_TEXTURE"),v.activeTexture.set(x.TEXTURE0),y.bind(x.LINEAR,x.CLAMP_TO_EDGE))):"sdf"===u&&T.push("SDF_SUBPASS"),g&&T.push("HAS_CENTROID"),B.shouldRenderCutoff&&T.push("RENDER_CUTOFF");const C=r.layout.get("fill-extrusion-edge-radius"),S=(e,i,n,u,_)=>{const x=i.programConfigurations.get(r.id),b=t.isTileAffectedByFog(e),S=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:x,defines:T,overrideFog:b}),E=((e,t,i,r,n,o,s,a,l,c,u)=>({u_matrix:t,u_opacity:i,u_ao_pass:r?1:0,u_meter_to_tile:n,u_ao:o,u_flood_light_intensity:s,u_flood_light_color:a,u_attenuation:l,u_edge_radius:c,u_fb:0,u_fb_size:u,u_dynamic_offset:1}))(0,u,h,c,_,[d,p*_],f,A,m,w>=17?0:C*_,y?y.size[0]:0),M=[];g&&M.push(i.hiddenByLandmarkVertexBuffer),t.uploadCommonUniforms(v,S,e.toUnwrapped(),null,B),S.draw(t,v.gl.TRIANGLES,o,s,a,l,E,r.id,i.vertexBuffer,i.indexBuffer,n,r.paint,w,x,M)};for(const o of n){const n=i.getTile(o),s=n.getBucket(r);if(!s||s.projection.name!==b.projection.name||!s.groundEffect||s.groundEffect&&!s.groundEffect.hasData())continue;const a=s.groundEffect,l=1/s.tileToMeter;{const e=t.translatePosMatrix(o.projMatrix,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),i=a.getDefaultSegment();S(o,a,i,e,l)}if(_)for(let s=0;s<4;s++){const a=e.d7[s](o),c=i.getTile(a);if(!c)continue;const u=c.getBucket(r);if(!u||u.projection.name!==b.projection.name||!u.groundEffect||u.groundEffect&&!u.groundEffect.hasData())continue;const h=u.groundEffect;let d,p;0===s?(d=[-e.ai,0,0],p=1):1===s?(d=[e.ai,0,0],p=0):2===s?(d=[0,-e.ai,0],p=3):(d=[0,e.ai,0],p=2);const f=h.regionSegments[p];if(!f)continue;const A=new Float32Array(16);e.ad.mat4.translate(A,o.projMatrix,d),S(o,h,f,t.translatePosMatrix(A,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),l)}}}function Ho(t,i,r,n,o,s,a){0===n.centroidVertexArray.length&&n.createCentroidsBuffer();const l=s?s.findDEMTileFor(r):null;if(!(l&&l.dem||a))return;s&&l&&l.dem&&n.selfDEMTileTimestamp!==l.dem._timestamp&&(n.borderDoneWithNeighborZ=[-1,-1,-1,-1],n.selfDEMTileTimestamp=l.dem._timestamp);const c=t=>new e.P(Math.ceil((t+e.da)*e.db),0),u=e=>{const t=i.getSource().minzoom,r=e=>{const t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(o)},n=[0,-1,1];for(const i of n){if(e.overscaledZ+i(h[0]=Math.min(t.min.y,i.min.y),h[1]=Math.max(t.max.y,i.max.y),h[2]=e.ai-i.min.x>t.max.x?i.min.x-e.ai:t.max.x,h),p=(t,i)=>(h[0]=Math.min(t.min.x,i.min.x),h[1]=Math.max(t.max.x,i.max.x),h[2]=e.ai-i.min.y>t.max.y?i.min.y-e.ai:t.max.y,h),f=[(e,t)=>d(e,t),(e,t)=>d(t,e),(e,t)=>p(e,t),(e,t)=>p(t,e)],A=(t,i,n,o,a,c,u)=>{if(!s)return 0;const h=[[c?n:t,c?t:n,0],[c?n:i,c?i:n,0]],d=u<0?e.ai+u:u,p=[c?d:(t+i)/2,c?(t+i)/2:d,0];return 0===n&&u<0||0!==n&&u>0?s.getForTilePoints(a,[p],!0,o):h.push(p),s.getForTilePoints(r,h,!0,l),Math.max(h[0][2],h[1][2],p[2])/s.exaggeration()};for(let t=0;t<4;t++){const i=n.borderFeatureIndices[t];if(0===i.length)continue;const o=e.d7[t](r),l=u(o);if(!(l&&l instanceof e.d8))continue;const h=s?s.findDEMTileFor(o):null;if(!(h&&h.dem||a))continue;if(s&&h&&h.dem&&n.borderDEMTileTimestamp[t]!==h.dem._timestamp&&(n.borderDoneWithNeighborZ[t]=-1,n.borderDEMTileTimestamp[t]=h.dem._timestamp),n.borderDoneWithNeighborZ[t]===l.canonical.z)continue;0===l.centroidVertexArray.length&&l.createCentroidsBuffer();const d=(t<2?1:5)-t,p=l.borderDoneWithNeighborZ[d]!==n.canonical.z,_=l.borderFeatureIndices[d];let y=0;if(n.canonical.z!==l.canonical.z){for(const e of i)n.showCentroid(n.featuresOnBorder[e]);if(p)for(const e of _)l.showCentroid(l.featuresOnBorder[e]);n.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[d]=n.canonical.z}for(const r of i){const i=n.featuresOnBorder[r],s=n.centroidData[i.centroidDataIndex],u=i.borders[t];let p;for(;y<_.length;){p=l.featuresOnBorder[_[y]];const e=p.borders[d];if(e[1]>u[0]+3||e[0]>u[0]-3)break;l.showCentroid(p),y++}if(p&&y<_.length){const r=y;let v=0;for(;!(p.borders[d][0]>u[1]-3)&&(v++,++y!==_.length);)p=l.featuresOnBorder[_[y]];p=l.featuresOnBorder[_[r]];let x=!1;if(v>=1){const e=p.borders[d];Math.abs(u[0]-e[0])<3&&Math.abs(u[1]-e[1])<3&&(v=1,x=!0,y=r+1)}else if(0===v){n.showCentroid(i);continue}const b=l.centroidData[p.centroidDataIndex];a&&x&&(((m=s).flags|(g=b).flags)&e.d9?(m.flags|=e.d9,g.flags|=e.d9):(m.flags&=~e.d9,g.flags&=~e.d9));const w=i.intersectsCount()>1||p.intersectsCount()>1;if(v>1)y=r,s.centroidXY=b.centroidXY=new e.P(0,0);else if(h&&h.dem&&!w){const i=f[t](s,b),r=t%2?e.ai-1:0,n=A(i[0],Math.min(e.ai-1,i[1]),r,h,o,t<2,i[2]);s.centroidXY=b.centroidXY=c(n)}else w?s.centroidXY=b.centroidXY=new e.P(0,0):(s.centroidXY=n.encodeBorderCentroid(i),b.centroidXY=l.encodeBorderCentroid(p));n.writeCentroidToBuffer(s),l.writeCentroidToBuffer(b)}else n.showCentroid(i)}n.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[d]=n.canonical.z}var m,g;(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(t)}const Go=[1,0,0],$o=[0,1,0],Zo=[0,0,1];function qo(t,i,r){const n=r.transform,o=r.shadowRenderer;if(!o)return!0;const s=t.toUnwrapped(),a=n.tileSize*o._cascades[r.currentShadowCascade].scale;let l=i.maxHeight;if(n.elevation){const e=n.elevation.getMinMaxForTile(t);e&&(l+=e.max)}const c=[...o.shadowDirection];c[2]=-c[2];const u=o.computeSimplifiedTileShadowVolume(s,l,a,c);if(!u)return!1;const h=[Go,$o,Zo,c,[c[0],0,c[2]],[0,c[1],c[2]]],d="globe"===n.projection.name,p=n.scaleZoom(a),f=e.bR.fromInvProjectionMatrix(n.invProjMatrix,n.worldSize,p,!d),A=o.getCurrentCascadeFrustum();return 0===f.intersectsPrecise(u.vertices,u.planes,h)||0===A.intersectsPrecise(u.vertices,u.planes,h)}function Ko(t){return[t[0]*e.dc,t[1]*e.dc,t[2]*e.dc,0]}function Wo(t,i,r,n,o,s,a,l,c){const u=n.getSource(),h=r.globeSharedBuffers;if(!h)return;let d,p,f;if(i&&(d=n.getTile(i)),u instanceof e.aK?(p=u.texture,f=e.cJ(0,0,r.transform)):d&&i&&(p=d.texture,f=e.cJ(i.canonical.z,i.canonical.x,r.transform)),!p||!f)return;t||(f=e.ad.mat4.scale(e.ad.mat4.create(),f,[1,-1,1]));const A=r.context,m=A.gl,g="nearest"===o.paint.get("raster-resampling")?m.NEAREST:m.LINEAR,_=r.colorModeForDrapableLayerRenderPass(s),y=a.defines;y.push("GLOBE_POLES");const v=new Oi(m.LEQUAL,Oi.ReadWrite,r.depthRangeFor3D),x=Float32Array.from(r.transform.expandedFarZProjMatrix),b=Float32Array.from(e.bc(e.cI(new e.bT(0,0,0))));r.terrain&&r.terrain.prepareDrawTile(),A.activeTexture.set(m.TEXTURE0),p.bind(g,m.CLAMP_TO_EDGE),A.activeTexture.set(m.TEXTURE1),p.bind(g,m.CLAMP_TO_EDGE),"useMipmap"in p&&A.extTextureFilterAnisotropic&&r.transform.pitch>20&&m.texParameterf(m.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const[w,T,B,C]=i?h.getPoleBuffers(i.canonical.z,!1):h.getPoleBuffers(0,!0),S=o.paint.get("raster-elevation");let E;t?(E=w,r.renderDefaultNorthPole=0!==S):(E=T,r.renderDefaultSouthPole=0!==S);const M=Ko(a.mix),I=((e,t,i,r,n,o,s,a,l,c,u,h,d)=>ho(e,t,i,new Float32Array(16),new Float32Array(9),[0,0],r,[0,0],[0,0,0,0],1,{opacity:1,mix:0},o,[0,0]||[0,0],a,2,c,u,h,1,0,d))(x,b,f,e.ag(r.transform.zoom),0,o,0,S,0,M,a.offset,a.range,s),P=r.getOrCreateProgram("raster",{defines:y});r.uploadCommonUniforms(A,P,null),P.draw(r,m.TRIANGLES,v,c,_,l,I,o.id,E,B,C)}function Xo(e){const t=e._nearZ,i=e.projection.farthestPixelDistance(e),r=i-t,n=.2*e.height,o=t+n;return[t,i,(o-n-t)/r,(o-t)/r]}function Yo(e,t,i,r){if(e)return t instanceof rt&&e instanceof bt?t.getTextureDescriptor(e,i,!0):{texture:e.texture,mix:Ko(r.mix),offset:r.offset,buffer:0,tileSize:1}}var Jo=e.dd([{name:"a_index",type:"Int16",components:1}]);class es{constructor(t,i,r,n){const o={width:r[0],height:r[1],data:null},s=t.gl;this.targetColorTexture=new e.T(t,o,s.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new e.T(t,o,s.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(i,n),this.lastInvalidatedAt=0}updateParticleTexture(t,i){if(this.particleTextureDimension===i.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const r=this.context.gl,n=i.width*i.height;this.particleTexture0=new e.T(this.context,i,r.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new e.T(this.context,i,r.RGBA8,{premultiply:!1,useMipmap:!1});const o=new e.de;o.reserve(n);for(let e=0;e0){const t=e.bb(r.canonical,c),i=e.dg(t);p=e.ad.mat4.multiply(new Float32Array(16),c.globeMatrix,i),e.ad.mat4.multiply(p,c.projMatrix,p)}const f=e.ad.mat4.create();f[12]+=2*o/(e.q.devicePixelRatio*c.width),f[13]+=2*s/(e.q.devicePixelRatio*c.height),e.ad.mat4.multiply(p,f,p);const A=t.getOrCreateProgram("debug",{defines:d}),m=i.getTileByID(r.key);t.terrain&&t.terrain.setupElevationDraw(m,A);const g=Oi.disabled,_=Ni.disabled,y=t.colorModeForRenderPass(),v="$debug";l.activeTexture.set(u.TEXTURE0),t.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),h?m._makeGlobeTileDebugBuffers(t.context,c):m._makeDebugTileBoundsBuffers(t.context,c.projection);const x=m._tileDebugBuffer||t.debugBuffer,b=m._tileDebugIndexBuffer||t.debugIndexBuffer,w=m._tileDebugSegments||t.debugSegments;if(A.draw(t,u.LINE_STRIP,g,_,y,Vi.disabled,so(p,n),v,x,b,w,null,null,null,[m._globeTileDebugBorderBuffer]),a){const e=m.latestRawTileData,i=Math.floor((e&&e.byteLength||0)/1024);let n=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(n+=` => ${r.overscaledZ}`),n+=` ${m.state}`,n+=` ${i}kb`,function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,n)}const T=i.getTile(r).tileSize,B=512/Math.min(T,512)*(r.overscaledZ/c.zoom)*.5,C=m._tileDebugTextBuffer||t.debugBuffer,S=m._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,E=m._tileDebugTextSegments||t.debugSegments;A.draw(t,u.TRIANGLES,g,_,Di.alphaBlended,Vi.disabled,so(p,e.al.transparent,B),v,C,S,E,null,null,null,[m._globeTileDebugTextBuffer])}function cs(e,t,i,r){hs(e,0,t+i/2,e.transform.width,i,r)}function us(e,t,i,r){hs(e,t-i/2,0,i,e.transform.height,r)}function hs(t,i,r,n,o,s){const a=t.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.q.devicePixelRatio,r*e.q.devicePixelRatio,n*e.q.devicePixelRatio,o*e.q.devicePixelRatio),a.clear({color:s}),l.disable(l.SCISSOR_TEST)}const ds=e.dd([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:ps}=ds;function fs(e,t,i,r){e.emplaceBack(t,i,r)}class As{constructor(t){this.vertexArray=new e.dh,this.indices=new e.aV,fs(this.vertexArray,-1,-1,1),fs(this.vertexArray,1,-1,1),fs(this.vertexArray,-1,1,1),fs(this.vertexArray,1,1,1),fs(this.vertexArray,-1,-1,-1),fs(this.vertexArray,1,-1,-1),fs(this.vertexArray,-1,1,-1),fs(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,ps),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.b8.simpleSegment(0,0,36,12)}}function ms(t,i,r,n,o,s){const a=t.context.gl,l=i.paint.get("sky-atmosphere-color"),c=i.paint.get("sky-atmosphere-halo-color"),u=i.paint.get("sky-atmosphere-sun-intensity"),h=((e,t,i,r,n)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[r.r,r.g,r.b,r.a],u_color_tint_m:[n.r,n.g,n.b,n.a],u_luminance:5e-5}))(e.ad.mat3.fromMat4(e.ad.mat3.create(),n),o,u,l,c);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+s,i.skyboxTexture,0),r.draw(t,a.TRIANGLES,Oi.disabled,Ni.disabled,Di.unblended,Vi.frontCW,h,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const gs=e.dd([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class _s{constructor(t){const i=new e.di;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const r=new e.aV;r.emplaceBack(0,1,2),r.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(i,gs.members),this.indexBuffer=t.createIndexBuffer(r),this.segments=e.b8.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const ys=e.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class vs{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class xs{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Di([1,Ri,1,Ri],e.al.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Di([1,0,1,0],e.al.transparent,[!1,!1,!1,!0]),this.params=new vs,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},(()=>{this.updateNeeded=!0})),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0})),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0}))}update(t){const i=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new _s(i);const t=this.params.sizeRange,r=this.params.intensityRange,n=function(t){const i=e.dl(30),r=[];for(let n=0;n{const i="globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];e&&i.push("ALPHA_PASS");const l=t.getOrCreateProgram("globeAtmosphere",{defines:i}),c=((e,t,i,r,n,o,s,a,l,c,u,h)=>({u_frustum_tl:e,u_frustum_tr:t,u_frustum_br:i,u_frustum_bl:r,u_horizon:n,u_transition:o,u_fadeout_range:s,u_color:a,u_high_color:l,u_space_color:c,u_temporal_offset:u,u_horizon_angle:h}))(o.frustumCorners.TL,o.frustumCorners.TR,o.frustumCorners.BR,o.frustumCorners.BL,o.frustumCorners.horizon,a,m,u,d,f,_,x);t.uploadCommonUniforms(r,l);const h=this.atmosphereBuffer;h&&l.draw(t,n.TRIANGLES,s,Ni.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Vi.backCW,c,e?"atmosphere_glow_alpha":"atmosphere_glow",h.vertexBuffer,h.indexBuffer,h.segments)};b(!1),b(!0)}drawStars(t,i){const r=e.ay(i.properties.get("star-intensity"),0,1);if(0===r)return;const n=t.context,o=n.gl,s=t.transform,a=t.getOrCreateProgram("stars"),l=e.ad.quat.identity([]);e.ad.quat.rotateX(l,l,-s._pitch),e.ad.quat.rotateZ(l,l,-s.angle),e.ad.quat.rotateX(l,l,e.ak(s._center.lat)),e.ad.quat.rotateY(l,l,-e.ak(s._center.lng));const c=e.ad.mat4.fromQuat(new Float32Array(16),l),u=e.ad.mat4.multiply([],s.starsProjMatrix,c),h=e.ad.mat3.fromMat4([],c),d=e.ad.mat3.invert([],h),p=[0,1,0];e.ad.vec3.transformMat3(p,p,d),e.ad.vec3.scale(p,p,this.params.sizeMultiplier);const f=[1,0,0];e.ad.vec3.transformMat3(f,f,d),e.ad.vec3.scale(f,f,this.params.sizeMultiplier);const A=(m=p,g=f,_=r,{u_matrix:Float32Array.from(u),u_up:m,u_right:g,u_intensity_multiplier:_});var m,g,_;t.uploadCommonUniforms(n,a),this.starsVx&&this.starsIdx&&a.draw(t,o.TRIANGLES,Oi.disabled,Ni.disabled,this.colorModeAlphaBlendedWriteRGB,Vi.disabled,A,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function bs(t,i){const r=[...t],n=i.cameraWorldSizeForFog/i.worldSize,o=e.ad.mat4.identity([]);return e.ad.mat4.scale(o,o,[n,n,1]),e.ad.mat4.multiply(r,o,r),e.ad.mat4.multiply(r,i.worldToFogMatrix,r),r}function ws(t,i,r,n,o){const s=r.material,a=n.context,{baseColorTexture:l,metallicRoughnessTexture:c}=s.pbrMetallicRoughness,{normalTexture:u,occlusionTexture:h,emissionTexture:d}=s;function p(e,i,r){if(e&&(t.push(i),a.activeTexture.set(a.gl.TEXTURE0+r),e.gfxTexture)){const{minFilter:t,magFilter:i,wrapS:r,wrapT:n}=e.sampler;e.gfxTexture.bindExtraParam(t,i,r,n)}}p(l,"HAS_TEXTURE_u_baseColorTexture",Ki.BaseColor),p(c,"HAS_TEXTURE_u_metallicRoughnessTexture",Ki.MetallicRoughness),p(u,"HAS_TEXTURE_u_normalTexture",Ki.Normal),p(h,"HAS_TEXTURE_u_occlusionTexture",Ki.Occlusion),p(d,"HAS_TEXTURE_u_emissionTexture",Ki.Emission),o&&(o.texture||(o.texture=new e.dn(n.context,o.image,[o.image.height,o.image.height,o.image.height],a.gl.RGBA8)),a.activeTexture.set(a.gl.TEXTURE0+Ki.LUT),o.texture&&o.texture.bind(a.gl.LINEAR,a.gl.CLAMP_TO_EDGE),t.push("APPLY_LUT_ON_GPU")),r.texcoordBuffer&&(t.push("HAS_ATTRIBUTE_a_uv_2f"),i.push(r.texcoordBuffer)),r.colorBuffer&&(t.push(12===r.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),i.push(r.colorBuffer)),r.normalBuffer&&(t.push("HAS_ATTRIBUTE_a_normal_3f"),i.push(r.normalBuffer)),r.pbrBuffer&&(t.push("HAS_ATTRIBUTE_a_pbr"),t.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),i.push(r.pbrBuffer)),"OPAQUE"!==s.alphaMode&&"MASK"!==s.alphaMode||t.push("UNPREMULT_TEXTURE_IN_SHADER"),s.defined||t.push("DIFFUSE_SHADED");const f=n.shadowRenderer;f&&(t.push("RENDER_SHADOWS","DEPTH_TEXTURE"),f.useNormalOffset&&t.push("NORMAL_OFFSET"))}function Ts(t,i,r,n,o,s){const a=r.paint.get("model-opacity").constantOr(1),l=i.context,c=new Oi(i.context.gl.LEQUAL,Oi.ReadWrite,i.depthRangeFor3D),u=i.transform,h=t.mesh,d=h.material,p=d.pbrMetallicRoughness,f=i.style.fog;let A;A="pixels"===i.transform.projection.zAxisUnit?[...t.nodeModelMatrix]:e.ad.mat4.multiply([],n.zScaleMatrix,t.nodeModelMatrix),e.ad.mat4.multiply(A,n.negCameraPosMatrix,A);const m=e.ad.mat4.invert([],A);e.ad.mat4.transpose(m,m);const g="none"===r.paint.get("model-color-use-theme").constantOr("default"),_=r.paint.get("model-emissive-strength").constantOr(0),y=wo(new Float32Array(t.worldViewProjection),new Float32Array(A),new Float32Array(m),null,i,a,p.baseColorFactor.toRenderColor(null),d.emissiveFactor,p.metallicFactor,p.roughnessFactor,d,_,r),v={defines:[]},x=[],b=i.shadowRenderer;b&&(b.useNormalOffset=!1),ws(v.defines,x,h,i,g?null:r.lut);let w=null;if(f){const e=bs(t.nodeModelMatrix,i.transform);if(w=new Float32Array(e),"globe"!==u.projection.name){const t=h.aabb.min,i=h.aabb.max,[r,n]=f.getOpacityForBounds(e,t[0],t[1],i[0],i[1]);v.overrideFog=r>=Re||n>=Re}}const T=Ji(i,r.paint.get("model-cutoff-fade-range"));T.shouldRenderCutoff&&v.defines.push("RENDER_CUTOFF");const B=i.getOrCreateProgram("model",v);i.uploadCommonUniforms(l,B,null,w,T),"shadow"!==i.renderPass&&b&&b.setupShadowsFromMatrix(t.nodeModelMatrix,B),B.draw(i,l.gl.TRIANGLES,c,o,s,h.material.doubleSided?Vi.disabled:Vi.backCCW,y,r.id,h.vertexBuffer,h.indexBuffer,h.segments,r.paint,i.transform.zoom,void 0,x)}function Bs(t,i,r,n,o,s,a){let l;l="globe"===t.projection.name?e.dp(r,t):[...r],e.ad.mat4.multiply(l,l,i.matrix);const c=e.ad.mat4.multiply([],n,l);if(i.meshes)for(const r of i.meshes){if("BLEND"!==r.material.alphaMode){a.push({mesh:r,depth:0,modelIndex:o,worldViewProjection:c,nodeModelMatrix:l});continue}const i=e.ad.vec3.transformMat4([],r.centroid,c);!t.isOrthographic&&i[2]<=0||s.push({mesh:r,depth:i[2],modelIndex:o,worldViewProjection:c,nodeModelMatrix:l})}if(i.children)for(const e of i.children)Bs(t,e,r,n,o,s,a)}function Cs(e,t,i,r){const n=i.shadowRenderer;if(!n)return;const o=n.getShadowPassDepthMode(),s=n.getShadowPassColorMode(),a=n.calculateShadowPassMatrixFromMatrix(t),l=To(a);i.getOrCreateProgram("modelDepth",{defines:i._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(i,i.context.gl.TRIANGLES,o,Ni.disabled,s,Vi.backCCW,l,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,void 0)}function Ss(t,i,r){const n=i.updateZoomBasedPaintProperties(),o=function(t,i,r){let n,o,s,a=t.terrain?t.terrain.exaggeration():0;if(t.terrain&&a>0){const i=t.terrain,o=i.findDEMTileFor(r);o&&o.dem?n=e.dr.create(i,r,o):a=0}if(0===a&&(i.terrainElevationMin=0,i.terrainElevationMax=0),a===i.validForExaggeration&&(0===a||n&&n._demTile&&n._demTile.tileID===i.validForDEMTile.id&&n._dem._timestamp===i.validForDEMTile.timestamp))return!1;for(const e in i.instancesPerModel){const t=i.instancesPerModel[e];for(let e=0;eu&&(u=e.max)}const h=e.ay(n.x,s,a)-n.x,d=e.ay(n.y,l,c)-n.y,p=e.bH(u,i.center.lat)-n.z;return i._zoomFromMercatorZ(Math.sqrt(h*h+d*d+p*p))}function Is(e,t,i,r,n,o,s){const a=e.context,l="shadow"===e.renderPass,c=e.shadowRenderer,u=l&&c?c.getShadowPassDepthMode():new Oi(a.gl.LEQUAL,Oi.ReadWrite,e.depthRangeFor3D),h=e.isTileAffectedByFog(o);if(i.meshes)for(const d of i.meshes){const p=["MODEL_POSITION_ON_GPU"],f=[];let A,m,g;r.instancedDataArray.length>20&&p.push("INSTANCED_ARRAYS");const _=Ji(e,t.paint.get("model-cutoff-fade-range"));if(_.shouldRenderCutoff&&p.push("RENDER_CUTOFF"),l&&c)A=e.getOrCreateProgram("modelDepth",{defines:p}),m=To(s.shadowTileMatrix,s.shadowTileMatrix,Float32Array.from(i.matrix)),g=c.getShadowPassColorMode();else{ws(p,f,d,e,"none"===t.paint.get("model-color-use-theme").constantOr("default")?null:t.lut),A=e.getOrCreateProgram("model",{defines:p,overrideFog:h});const r=d.material,l=r.pbrMetallicRoughness,u=t.paint.get("model-opacity").constantOr(1),y=t.paint.get("model-emissive-strength").constantOr(0);m=wo(o.expandedProjMatrix,Float32Array.from(i.matrix),new Float32Array(16),null,e,u,l.baseColorFactor.toRenderColor(null),r.emissiveFactor,l.metallicFactor,l.roughnessFactor,r,y,t,n),c&&(s.shadowUniformsInitialized?A.setShadowUniformValues(a,c.getShadowUniformValues()):(c.setupShadows(o.toUnwrapped(),A,"model-tile",o.overscaledZ),s.shadowUniformsInitialized=!0)),g=_.shouldRenderCutoff||u<1||"OPAQUE"!==r.alphaMode?Di.alphaBlended:Di.unblended}e.uploadCommonUniforms(a,A,o.toUnwrapped(),null,_);const y=d.material.doubleSided?Vi.disabled:Vi.backCCW;if(r.instancedDataArray.length>20)f.push(r.instancedDataBuffer),A.draw(e,a.gl.TRIANGLES,u,Ni.disabled,g,y,m,t.id,d.vertexBuffer,d.indexBuffer,d.segments,t.paint,e.transform.zoom,void 0,f,r.instancedDataArray.length);else{const i=l?"u_instance":"u_normal_matrix";for(let n=0;nc[1]?a:c,s[0]=r.max[0],a=e.ad.vec4.transformMat4(e.ad.vec4.create(),s,o),l=a[1]c[1]?a:c,s[1]=r.min[1],a=e.ad.vec4.transformMat4(e.ad.vec4.create(),s,o),l=a[1]c[1]?a:c;const u=e.ay(n[0],0,1),h=100*i.pixelsPerMeter*e.ay(n[1],0,1),d=e.ay(n[2],0,1),p=e.ad.vec4.lerp(e.ad.vec4.create(),l,c,u),f=Math.tan(.5*i.fovX),A=-p[2]*f;if(0===h)return p[1]<-Math.abs(A)?d:1;const m=(-Math.abs(A)-p[1])/h,g=(e,t,i)=>(1-i)*e+i*t,_=e.ay(g(1,d,m),d,1);return g(1,_,e.ay((i.pitch-20)/20,0,1))}class zs{}class Rs{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,i,r){{const e=this._storage.get(i.id);if(e)return e.lastUsedFrameIdx=t,e.buf}const n=r.gl,o=n.getBufferParameter(n.ELEMENT_ARRAY_BUFFER,n.BUFFER_SIZE),s=new ArrayBuffer(o),a=new Int16Array(s);n.getBufferSubData(n.ELEMENT_ARRAY_BUFFER,0,new Int16Array(s));const l=new e.dt;for(let e=0;e30&&(i.buf.destroy(),this._storage.delete(t))}destroy(){for(const[e,t]of this._storage)t.buf.destroy(),this._storage.delete(e)}}class Ds{constructor(e){this.occluderSize=30,this.depthOffset=-1e-4,e.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),e.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const Os=e.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Us{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class Ns{constructor(e,t){this.revealStart=11,this.revealRange=2,e.registerParameter(this,[...t,"Reveal"],"revealStart",{min:0,max:17,step:.05}),e.registerParameter(this,[...t,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const Qs=e.dd([{type:"Float32",name:"a_pos_2f",components:2}]);class js{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,i){const r=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const i=new e.du,r=new e.aV;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1),r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(i,Qs.members),this.vignetteIdx=t.context.createIndexBuffer(r)}const n=e.b8.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,r);const e={u_vignetteShape:(o={vignetteShape:[i.start,i.range,Math.pow(10,i.fadePower)],vignetteColor:[i.color.r,i.color.g,i.color.b,i.color.a*i.strength]}).vignetteShape,u_vignetteColor:o.vignetteColor};r.draw(t,t.context.gl.TRIANGLES,Oi.disabled,Ni.disabled,Di.alphaBlended,Vi.disabled,e,"vignette",this.vignetteVx,this.vignetteIdx,n)}var o}}class Vs{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,i){const r=t.getFreeCameraOptions().position,n=r.toAltitude(),o=r.toLngLat(),s=e.ak(o.lng),a=e.ak(o.lat),l=t.pixelsPerMeter/i,c=s*e.dv,u=e.dv*Math.log(Math.tan(Math.PI/4+a/2));if(void 0===this._offsetXPrev)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const e=-this._offsetYPrev+u,t=-this._elevationPrev+n;this._accumulatedOffsetX+=(-this._offsetXPrev+c)*l,this._accumulatedOffsetY+=e*l,this._accumulatedElevation+=t*l,this._offsetXPrev=c,this._offsetYPrev=u,this._elevationPrev=n}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Hs(e,t){return[-(e[0]-Math.floor(e[0]/t)*t),-(e[1]-Math.floor(e[1]/t)*t),-(e[2]-Math.floor(e[2]/t)*t)]}function Gs(t){const i=e.dl(1323123451230),r=[];for(let n=0;nr)return;const n=$s(0,1,i.revealStart,i.revealStart+i.revealRange,r);if(!this.particlesVx||!this.particlesIdx)return;const o=structuredClone(this._params);let s=[-o.direction.x,o.direction.y,-100];e.ad.vec3.normalize(s,s);const a=structuredClone(this._vignetteParams);a.strength*=n,o.overrideStyleParameters||(o.intensity=t.style.rain.state.density,o.timeFactor=t.style.rain.state.intensity,o.color=structuredClone(t.style.rain.state.color),s=structuredClone(t.style.rain.state.direction),o.screenThinning.intensity=t.style.rain.state.centerThinning,o.dropletSizeX=t.style.rain.state.dropletSize[0],o.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],o.distortionStrength=100*t.style.rain.state.distortionStrength,a.strength=1,a.color=structuredClone(t.style.rain.state.vignetteColor));const l=this.updateOnRender(t,o.timeFactor),c=t.context,u=c.gl,h=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new e.T(c,{width:t.width,height:t.height,data:null},u.RGBA8)),o.distortionStrength>0&&(c.activeTexture.set(u.TEXTURE0),this.screenTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.copyTexSubImage2D(u.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const d=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(c,d),c.activeTexture.set(u.TEXTURE0),this.screenTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const p=[o.color.r,o.color.g,o.color.b,o.color.a],f=(i,r)=>{const n=Hs(this._movement.getPosition(),i),a=o.dropletSizeX,c=o.dropletSizeX*o.dropletSizeYScale,f=t.width/2,A=t.height/2,m=$s(0,o.screenThinning.start,0,1,o.screenThinning.intensity),g=$s(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),_=$s(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),y=(v={modelview:l.modelviewMatrix,projection:l.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:n,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,boxSize:i,rainDropletSize:[a,c],distortionStrength:o.distortionStrength,rainDirection:s,color:p,screenSize:[h.width,h.height],thinningCenterPos:[f,A],thinningShape:[m,g,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:_,shapeDirectionalPower:o.shapeDirPower,shapeNormalPower:o.shapeNormalPower,mode:r?0:1},{u_modelview:Float32Array.from(v.modelview),u_projection:Float32Array.from(v.projection),u_time:v.time,u_cam_pos:v.camPos,u_texScreen:0,u_velocityConeAperture:v.velocityConeAperture,u_velocity:v.velocity,u_boxSize:v.boxSize,u_rainDropletSize:v.rainDropletSize,u_distortionStrength:v.distortionStrength,u_rainDirection:v.rainDirection,u_color:v.color,u_screenSize:v.screenSize,u_thinningCenterPos:v.thinningCenterPos,u_thinningShape:v.thinningShape,u_thinningAffectedRatio:v.thinningAffectedRatio,u_thinningParticleOffset:v.thinningParticleOffset,u_shapeDirectionalPower:v.shapeDirectionalPower,u_shapeNormalPower:v.shapeNormalPower,u_mode:v.mode});var v;const x=Math.round(o.intensity*this.particlesCount),b=e.b8.simpleSegment(0,0,4*x,2*x);d.draw(t,u.TRIANGLES,Oi.disabled,Ni.disabled,Di.alphaBlended,Vi.disabled,y,"rain_particles",this.particlesVx,this.particlesIdx,b)};o.distortionStrength>0&&f(o.boxSize,!0),f(o.boxSize,!1),this._vignette.draw(t,a)}}const Ks=e.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class Ws extends Zs{constructor(e){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new Ns(e.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const i=t.context;if(!this.particlesVx){const t=Gs(this.particlesCount),r=new e.dx,n=new e.aV;let o=0;const s=e.dl(1323123451230);for(let e=0;es)return;const a=$s(0,1,o.revealStart,o.revealStart+o.revealRange,s);n.strength*=a,i.overrideStyleParameters||(i.intensity=t.style.snow.state.density,i.timeFactor=t.style.snow.state.intensity,i.color=structuredClone(t.style.snow.state.color),r=structuredClone(t.style.snow.state.direction),i.screenThinning.intensity=t.style.snow.state.centerThinning,i.billboardSize=2.79*t.style.snow.state.flakeSize,n.strength=1,n.color=structuredClone(t.style.snow.state.vignetteColor));const l=this.updateOnRender(t,i.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const c=t.context,u=c.gl,h=t.transform,d=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(c,d),((i,n,o)=>{const s=Hs(this._movement.getPosition(),i),a=h.width/2,c=h.height/2,p=$s(0,o.screenThinning.start,0,1,o.screenThinning.intensity),f=$s(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),A=$s(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),m=(g={modelview:l.modelviewMatrix,projection:l.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:s,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,horizontalOscillationRadius:o.horizontalOscillationRadius,horizontalOscillationRate:o.horizontalOscillationRate,boxSize:i,billboardSize:1*o.billboardSize,simpleShapeParameters:[o.shapeFadeStart,o.shapeFadePower],screenSize:[h.width,h.height],thinningCenterPos:[a,c],thinningShape:[p,f,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:A,color:[o.color.r,o.color.g,o.color.b,o.color.a],direction:r},{u_modelview:Float32Array.from(g.modelview),u_projection:Float32Array.from(g.projection),u_time:g.time,u_cam_pos:g.camPos,u_velocityConeAperture:g.velocityConeAperture,u_velocity:g.velocity,u_horizontalOscillationRadius:g.horizontalOscillationRadius,u_horizontalOscillationRate:g.horizontalOscillationRate,u_boxSize:g.boxSize,u_billboardSize:g.billboardSize,u_simpleShapeParameters:g.simpleShapeParameters,u_screenSize:g.screenSize,u_thinningCenterPos:g.thinningCenterPos,u_thinningShape:g.thinningShape,u_thinningAffectedRatio:g.thinningAffectedRatio,u_thinningParticleOffset:g.thinningParticleOffset,u_particleColor:g.color,u_direction:g.direction});var g;const _=Math.round(o.intensity*this.particlesCount),y=e.b8.simpleSegment(0,0,4*_,2*_);this.particlesVx&&this.particlesIdx&&d.draw(t,u.TRIANGLES,Oi.disabled,Ni.disabled,Di.alphaBlended,Vi.disabled,m,"snow_particles",this.particlesVx,this.particlesIdx,y)})(i.boxSize,0,i),this._vignette.draw(t,n)}}const Xs={symbol:function(t,i,r,n,o){if("translucent"!==t.renderPass)return;const s=Ni.disabled,a=t.colorModeForRenderPass(),l=r.layout.get("text-variable-anchor"),c=r.layout.get("text-size-scale-range"),u=e.ay(t.scaleFactor,c[0],c[1]);l&&function(t,i,r,n,o,s,a,l){const c=i.transform,u="map"===o,h="map"===s;for(const i of t){const t=n.getTile(i),o=t.getBucket(r);if(!o||!o.text||!o.text.segments.get().length)continue;const s=e.bp(o.textSizeData,c.zoom,l),d=ci(i,o.getProjection(),c),p=c.calculatePixelsToTileUnitsMatrix(t),f=Ht(d,t.tileID.canonical,h,u,c,o.getProjection(),p),A=o.hasIconTextFit()&&o.hasIconData();if(s){const r=Math.pow(2,c.zoom-t.tileID.overscaledZ);Ro(o,u,h,a,e.cY,c,f,i,r,s,A)}}}(n,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),o,u);const h=0!==r.paint.get("icon-opacity").constantOr(1),d=0!==r.paint.get("text-opacity").constantOr(1);void 0!==r.layout.get("symbol-sort-key").constantOr(1)&&(h||d)?Do(t,i,r,n,s,a):(h&&Do(t,i,r,n,s,a,{onlyIcons:!0}),d&&Do(t,i,r,n,s,a,{onlyText:!0})),i.map.showCollisionBoxes&&(Lo(t,i,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),Lo(t,i,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(t,i,r,n){if("translucent"!==t.renderPass)return;const o=r.paint.get("circle-opacity"),s=r.paint.get("circle-stroke-width"),a=r.paint.get("circle-stroke-opacity"),l=void 0!==r.layout.get("circle-sort-key").constantOr(1),c=r.paint.get("circle-emissive-strength");if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const u=t.context,h=u.gl,d=t.transform,p=t.depthModeForSublayer(0,Oi.ReadOnly),f=Ni.disabled,A=t.colorModeForDrapableLayerRenderPass(c),m="globe"===d.projection.name,g=[e.av(d.center.lng),e.aC(d.center.lat)],_=[];for(let o=0;oe.sortKey-t.sortKey));const y={useDepthForOcclusion:d.depthOcclusionForSymbolsAndCircles};for(const e of _){const{programConfiguration:i,program:n,layoutVertexBuffer:o,globeExtVertexBuffer:s,indexBuffer:a,uniformValues:l,tile:c}=e.state,m=e.segments;t.terrain&&t.terrain.setupElevationDraw(c,n,y),t.uploadCommonUniforms(u,n,c.tileID.toUnwrapped()),n.draw(t,h.TRIANGLES,p,f,A,Vi.disabled,l,r.id,o,a,m,r.paint,d.zoom,i,[s])}},heatmap:function(t,i,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const o=t.context,s=o.gl,a=Ni.disabled,l=new Di([s.ONE,s.ONE,s.ONE,s.ONE],e.al.transparent,[!0,!0,!0,!0]);!function(e,t,i,r){const n=e.gl,o=t.width*r,s=t.height*r;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,o,s]);let a=i.heatmapFbo;if(!a||a&&(a.width!==o||a.height!==s)){a&&a.destroy();const t=n.createTexture();n.bindTexture(n.TEXTURE_2D,t),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),a=i.heatmapFbo=e.createFramebuffer(o,s,!0,null),function(e,t,i,r,n,o){const s=e.gl;s.texImage2D(s.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?s.RGBA16F:s.RGBA,n,o,0,s.RGBA,e.extRenderToTextureHalfFloat?s.HALF_FLOAT:s.UNSIGNED_BYTE,null),r.colorAttachment.set(i)}(e,0,t,a,o,s)}else n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)}(o,t,r,"globe"===t.transform.projection.name?.5:.25),o.clear({color:e.al.transparent});const c=t.transform,u="globe"===c.projection.name,h=u?["PROJECTION_GLOBE_VIEW"]:[],d=u?Vi.frontCCW:Vi.disabled,p=[e.av(c.center.lng),e.aC(c.center.lat)];for(let e=0;e({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}(t,r))},line:function(t,i,r,n){if("translucent"!==t.renderPass)return;const o=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;const a=r.paint.get("line-emissive-strength"),l=r.paint.get("line-occlusion-opacity"),c=r.layout.get("line-elevation-reference"),u="meters"===r.layout.get("line-width-unit"),h="sea"===c,d=t.context,p=d.gl;if(r.hasElevatedBuckets&&"globe"===t.transform.projection.name)return;const f=r.layout.get("line-cross-slope"),A=void 0!==f,m=f<1,g=t.colorModeForDrapableLayerRenderPass(a),_=t.terrain&&t.terrain.renderingToTexture,y=_?1:e.q.devicePixelRatio,v=r.paint.get("line-dasharray"),x=v.constantOr(1),b=r.layout.get("line-cap"),w=v.constantOr(null),T=b.constantOr(null),B=r.paint.get("line-pattern"),C=B.constantOr(1),S=B.constantOr(null),E=r.paint.get("line-opacity").constantOr(1);let M=!C&&1!==E||t.depthOcclusion&&l>0&&l<1;const I=r.paint.get("line-gradient"),P=C?"linePattern":"line",L=e.c$(r);let F;if(_&&t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(M=!1),0!==l&&t.depthOcclusion){const t=r.paint._values["line-opacity"];t&&t.value&&"constant"===t.value.kind?F=t.value:e.w(`Occlusion opacity for layer ${r.id} is supported only when line-opacity isn't data-driven.`)}"constant"!==s.value.kind&&!1===s.value.isLineProgressConstant&&L.push("VARIABLE_LINE_WIDTH");const k=(n,o,s,a,c,f)=>{for(const A of n){const n=i.getTile(A);if(C&&!n.patternsLoaded())continue;const m=n.getBucket(r);if(!m)continue;if(m.hasZOffset&&!c||!m.hasZOffset&&c)continue;t.prepareDrawTile();const v=m.programConfigurations.get(r.id),b=t.isTileAffectedByFog(A),B=t.getOrCreateProgram(P,{config:v,defines:o,overrideFog:b,overrideRtt:!c&&void 0});if(S&&n.imageAtlas){const t=e.d0.from(S).getPrimary().scaleSelf(y).toString(),i=n.imageAtlas.patternPositions.get(t);i&&v.setConstantPatternPositions(i)}if(!C&&w&&T&&n.lineAtlas){const e=n.lineAtlas.getDash(w,T);e&&v.setConstantPatternPositions(e)}let[L,k]=r.paint.get("line-trim-offset");if("round"===T||"square"===T){const e=1;L!==k&&(0===L&&(L-=e),1===k&&(k+=e))}const z=_?A.projMatrix:null,R=u?1/m.tileToMeter/e.at(n,1,t.transform.zoom):1,D=u?1/m.tileToMeter/e.at(n,1,Math.floor(t.transform.zoom)):1,O=C?e.d1(t,n,r,z,y,R,D,[L,k]):e.d2(t,n,r,z,m.lineClipsArray.length,y,R,D,[L,k]);if(I){const n=m.gradients[r.id];let o=n.texture;if(r.gradientVersion!==n.version){let s=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,n=A.canonical.z===r?Math.ceil(1<{null!=F&&(F.value=E*l),B.draw(t,p.TRIANGLES,s,e,g,Vi.disabled,O,r.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,r.paint,t.transform.zoom,v,[m.layoutVertexBuffer2,m.patternVertexBuffer,m.zOffsetVertexBuffer]),null!=F&&(F.value=E)};if(M&&!c){const e=t.stencilModeForClipping(A).ref;0===e&&_&&d.clear({stencil:0});const i={func:p.EQUAL,mask:255};O.u_alpha_discard_threshold=.8,U(new Ni(i,e,255,p.KEEP,p.KEEP,p.INVERT)),O.u_alpha_discard_threshold=0,U(new Ni(i,e,255,p.KEEP,p.KEEP,p.KEEP))}else O.u_alpha_discard_threshold=M&&c&&f?.8:0,U(c?a:t.stencilModeForClipping(A))}};if(r.hasNonElevatedBuckets){const i=!_&&t.terrain;0!==l&&i?e.w(`Occlusion opacity for layer ${r.id} is supported on terrain only if the layer has line-z-offset enabled.`):i?e.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${r.id}.`):k(n,L,t.depthModeForSublayer(0,Oi.ReadOnly),Ni.disabled,!1,!0)}if(r.hasElevatedBuckets){L.push("ELEVATED"),A&&L.push(m?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),h&&L.push("ELEVATION_REFERENCE_SEA");const e=M?t.stencilModeFor3D():Ni.disabled,i=new Oi(t.depthOcclusion?p.GREATER:p.LEQUAL,Oi.ReadOnly,t.depthRangeFor3D);t.forceTerrainMode=!0,k(n,L,i,e,!0,!0),M&&k(n,L,i,e,!0,!1),t.forceTerrainMode=!1}M&&(t.resetStencilClippingMasks(),_&&d.clear({stencil:0})),0===l||t.depthOcclusion||_||t.layersWithOcclusionOpacity.push(t.currentLayer)},fill:function(t,i,r,n){const o=r.paint.get("fill-color"),s=r.paint.get("fill-opacity");if(0===s.constantOr(1))return;const a=r.paint.get("fill-emissive-strength"),l=t.colorModeForDrapableLayerRenderPass(a),c=r.paint.get("fill-pattern"),u=t.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===o.constantOr(e.al.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";let h="none";"none"!==r.layout.get("fill-elevation-reference")?h="road":0!==r.paint.get("fill-z-offset").constantOr(1)&&(h="offset");const d=!(!t.terrain||!t.terrain.enabled),p={painter:t,sourceCache:i,layer:r,coords:n,colorMode:l,elevationType:h,terrainEnabled:d,pass:u};if("offset"!==h){if(Qo(p,!1),"road"===h){const e=!d&&"translucent"===t.renderPass;e&&No(t,i,r,n,"geometry"),Qo(p,!0,Ni.disabled),e&&function(e){const{painter:t,sourceCache:i,layer:r,coords:n,colorMode:o}=e,s=t.context.gl,a=new Oi(t.context.gl.LEQUAL,Oi.ReadOnly,t.depthRangeFor3D);for(const e of n){const n=i.getTile(e),l=n.getBucket(r);if(!l)continue;const c=l.elevatedStructures;if(!c||!c.renderableSegments||0===c.renderableSegments.segments[0].primitiveLength)continue;t.prepareDrawTile();const u=l.bufferData.programConfigurations.get(r.id),h=t.isTileAffectedByFog(e),d=t.getOrCreateProgram("elevatedStructures",{config:u,overrideFog:h,defines:["NORMAL_OFFSET"]}),p={u_matrix:t.translatePosMatrix(e.projMatrix,n,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"))};t.uploadCommonUniforms(t.context,d,e.toUnwrapped()),d.draw(t,s.TRIANGLES,a,Ni.disabled,o,Vi.backCCW,p,r.id,c.vertexBuffer,c.indexBuffer,c.renderableSegments,r.paint,t.transform.zoom,u,[c.vertexBufferNormal])}}(p)}}else Qo(p,!1,t.stencilModeFor3D())},"fill-extrusion":function(t,i,r,n){const o=r.paint.get("fill-extrusion-opacity"),s=t.context,a=s.gl,l=t.terrain,c=l&&l.renderingToTexture;if(0===o)return;const u=t.conflationActive&&t.style.isLayerClipped(r,i.getSource()),h=t.style.order.indexOf(r.fqid);if(u&&function(e,t,i,r,n){for(const o of r){const r=t.getTile(o).getBucket(i);r&&(r.updateReplacement(o,e.replacementSource,n),r.uploadCentroid(e.context))}}(t,i,r,n,h),l||u)for(const e of n){const n=i.getTile(e).getBucket(r);n&&Ho(t.context,i,e,n,r,l,u)}if("shadow"===t.renderPass&&t.shadowRenderer){const s=t.shadowRenderer;if(l&&o<.65&&r._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.ab)return;const a=s.getShadowPassDepthMode(),c=s.getShadowPassColorMode();jo(t,i,r,n,a,Ni.disabled,c,u)}else if("translucent"===t.renderPass){const h=!r.paint.get("fill-extrusion-pattern").constantOr(1),d=r.paint.get("fill-extrusion-color").constantOr(e.al.white);if(!c&&0!==d.a){const e=new Oi(t.context.gl.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D);1===o&&h?jo(t,i,r,n,e,Ni.disabled,Di.unblended,u):(jo(t,i,r,n,e,Ni.disabled,Di.disabled,u),jo(t,i,r,n,e,t.stencilModeFor3D(),t.colorModeForRenderPass(),u),t.resetStencilClippingMasks())}if(t.style.enable3dLights()&&h&&(!l&&"globe"!==t.transform.projection.name||c)){const o=r.paint.get("fill-extrusion-opacity"),h=r.paint.get("fill-extrusion-ambient-occlusion-intensity"),d=r.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),p=r.paint.get("fill-extrusion-flood-light-intensity"),f="none"===r.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),A=r.paint.get("fill-extrusion-flood-light-color").toRenderColor(f?null:r.lut).toArray01().slice(0,3),m=h>0&&d>0,g=p>0,_=(e,t,i)=>(1-i)*e+i*t,y=s=>{const l=t.depthModeForSublayer(1,Oi.ReadOnly,a.LEQUAL,!0),c=r.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),f=_(.1,3,c),m=t._showOverdrawInspector;if(!m){const c=new Ni({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),m=new Di([a.ONE,a.ONE,a.ONE,a.ONE],e.al.transparent,[!1,!1,!1,!0],a.MIN);Vo(t,i,r,n,l,c,m,Vi.disabled,s,"sdf",o,h,d,p,A,f,u,!1)}{const c=m?Ni.disabled:new Ni({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),g=m?t.colorModeForRenderPass():new Di([a.ONE_MINUS_DST_ALPHA,a.DST_ALPHA,a.ONE,a.ONE],e.al.transparent,[!0,!0,!0,!0]);Vo(t,i,r,n,l,c,g,Vi.disabled,s,"color",o,h,d,p,A,f,u,!1)}};if(c){const c=(s,l,c)=>{const f=t.depthModeForSublayer(1,Oi.ReadOnly,a.LEQUAL,!1),m=r.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),g=_(.1,3,m);{const c=new Di([a.ONE,a.ONE,a.ONE,a.ONE],e.al.transparent,[!1,!1,!1,!0]);Vo(t,i,r,n,f,Ni.disabled,c,Vi.disabled,s,"clear",o,h,d,p,A,g,u,l)}{const c=new Ni({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),m=new Di([a.ONE,a.ONE,a.ONE,a.ONE],e.al.transparent,[!1,!1,!1,!0],a.MIN);Vo(t,i,r,n,f,c,m,Vi.disabled,s,"sdf",o,h,d,p,A,g,u,l)}{const c=s?a.ZERO:a.ONE_MINUS_DST_ALPHA,m=new Ni({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),_=new Di([c,a.DST_ALPHA,a.ONE_MINUS_DST_ALPHA,a.ZERO],e.al.transparent,[!0,!0,!0,!0]);Vo(t,i,r,n,f,m,_,Vi.disabled,s,"color",o,h,d,p,A,g,u,l)}{const m=new Di([a.ONE,a.ONE,a.ONE,s?a.ZERO:a.ONE],e.al.transparent,[!1,!1,!1,!0],s?a.FUNC_ADD:a.MAX);Vo(t,i,r,n,f,Ni.disabled,m,Vi.disabled,s,"clear",o,h,d,p,A,g,u,l,c)}};if(m||g){let i;if(t.prepareDrawTile(),l){const t=l.drapeBufferSize[0],r=l.drapeBufferSize[1];i=l.framebufferCopyTexture,i&&(!i||i.size[0]===t&&i.size[1]===r)||(i&&i.destroy(),i=l.framebufferCopyTexture=new e.T(s,new e.r({width:t,height:r}),a.RGBA8)),i.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.copyTexSubImage2D(a.TEXTURE_2D,0,0,0,0,0,t,r)}m&&c(!0,!1,i),g&&c(!1,!0,i)}}else m&&y(!0),g&&y(!1),(m||g)&&t.resetStencilClippingMasks()}}},hillshade:function(e,t,i,r){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;if(e.style.disableElevatedTerrain)return;const n=e.context,o=e.terrain&&e.terrain.renderingToTexture,[s,a]="translucent"!==e.renderPass||o?[{},r]:e.stencilConfigForOverlap(r);for(const r of a){const n=t.getTile(r);if(n.needsHillshadePrepare&&"offscreen"===e.renderPass)$r(e,n,i);else if("translucent"===e.renderPass){const t=e.depthModeForSublayer(0,Oi.ReadOnly),a=i.paint.get("hillshade-emissive-strength"),l=e.colorModeForDrapableLayerRenderPass(a),c=o&&e.terrain?e.terrain.stencilModeForRTTOverlap(r):s[r.overscaledZ];Hr(e,r,n,i,t,c,l)}}n.viewport.set([0,0,e.width,e.height]),e.resetStencilClippingMasks()},raster:function(t,i,r,n,o,s){if("translucent"!==t.renderPass)return;if(0===r.paint.get("raster-opacity"))return;const a="globe"===t.transform.projection.name,l=0!==r.paint.get("raster-elevation"),c=l&&a;if(t.renderElevatedRasterBackface&&!c)return;const u=t.context,h=u.gl,d=i.getSource(),p=function(t,i,r,n){const o=i.paint.get("raster-color"),s="raster-array"===t.type,a=[],l=i.paint.get("raster-resampling"),c=i.paint.get("raster-color-mix");let u=i.paint.get("raster-color-range");const h=[c[0],c[1],c[2],0],d=c[3];let p="nearest"===l?n.NEAREST:n.LINEAR;if(s&&(a.push("RASTER_ARRAY"),o||a.push("RASTER_COLOR"),"linear"===l&&a.push("RASTER_ARRAY_LINEAR"),p=n.NEAREST,!u&&t.rasterLayers)){const e=t.rasterLayers.find((({id:e})=>e===i.sourceLayer));e&&e.fields&&e.fields.range&&(u=e.fields.range)}if(u=u||[0,1],o){a.push("RASTER_COLOR"),r.activeTexture.set(n.TEXTURE2),i.updateColorRamp(u);let t=i.colorRampTexture;t||(t=i.colorRampTexture=new e.T(r,i.colorRamp,n.RGBA8)),t.bind(n.LINEAR,n.CLAMP_TO_EDGE)}return{mix:h,range:u,offset:d,defines:a,resampling:p}}(d,r,u,h);if(d instanceof e.aK&&!n.length&&!a)return;const f=r.paint.get("raster-emissive-strength"),A=t.colorModeForDrapableLayerRenderPass(f),m=t.terrain&&t.terrain.renderingToTexture,g=!t.options.moving,_="nearest"===r.paint.get("raster-resampling")?h.NEAREST:h.LINEAR;if(d instanceof e.aK&&!n.length&&(d.onNorthPole||d.onSouthPole)){const e=l?t.stencilModeFor3D():Ni.disabled;return void Wo(!!d.onNorthPole,null,t,i,r,f,p,Vi.disabled,e)}if(!n.length)return;const[y,v]=d instanceof e.aK||m?[{},n]:t.stencilConfigForOverlap(n),x=v[v.length-1].overscaledZ;c&&p.defines.push("PROJECTION_GLOBE_VIEW"),l&&p.defines.push("RENDER_CUTOFF");const b=(n,o,v)=>{for(const b of n){const n=b.toUnwrapped(),w=i.getTile(b);if(m&&(!w||!w.hasData()))continue;u.activeTexture.set(h.TEXTURE0);const T=Yo(w,d,r,p);if(!T||!T.texture)continue;const{texture:B,mix:C,offset:S,tileSize:E,buffer:M}=T;let I,P;m?(I=Oi.disabled,P=b.projMatrix):l?(I=new Oi(h.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D),P=a?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(n,g)):(I=t.depthModeForSublayer(b.overscaledZ-x,1===r.paint.get("raster-opacity")?Oi.ReadWrite:Oi.ReadOnly,h.LESS),P=t.transform.calculateProjMatrix(n,g));const L=t.terrain&&m?t.terrain.stencilModeForRTTOverlap(b):y[b.overscaledZ],F=s?0:r.paint.get("raster-fade-duration");w.registerFadeDuration(F);const k=i.findLoadedParent(b,0),z=Un(w,k,i,t.transform,F);let R,D;t.terrain&&t.terrain.prepareDrawTile(),u.activeTexture.set(h.TEXTURE0),B.bind(_,h.CLAMP_TO_EDGE),u.activeTexture.set(h.TEXTURE1),k?(k.texture&&k.texture.bind(_,h.CLAMP_TO_EDGE),R=Math.pow(2,k.tileID.overscaledZ-w.tileID.overscaledZ),D=[w.tileID.canonical.x*R%1,w.tileID.canonical.y*R%1]):B.bind(_,h.CLAMP_TO_EDGE),"useMipmap"in B&&u.extTextureFilterAnisotropic&&t.transform.pitch>20&&h.texParameterf(h.TEXTURE_2D,u.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u.extTextureFilterAnisotropicMax);const O=t.transform;let U;const N=l?Xo(O):[0,0,0,0];let Q,j,V,H,G,$=0;if(c&&d instanceof e.aK&&d.coordinates.length>3)Q=Float32Array.from(e.bc(e.cI(new e.bT(0,0,0)))),j=Float32Array.from(O.globeMatrix),V=Float32Array.from(e.cE(O)),H=[e.av(O.center.lng),e.aC(O.center.lat)],U=d.elevatedGlobePerspectiveTransform,G=d.elevatedGlobeGridMatrix||new Float32Array(9);else if(c){const t=e.cF(b.canonical);$=e.cG(t.getCenter().lat),Q=Float32Array.from(e.bc(e.cI(b.canonical))),j=Float32Array.from(O.globeMatrix),V=Float32Array.from(e.cE(O)),H=[e.av(O.center.lng),e.aC(O.center.lat)],U=[0,0],G=Float32Array.from(e.cH(b.canonical,t,$,O.worldSize/O._pixelsPerMercatorPixel))}else U=d instanceof e.aK?d.perspectiveTransform:[0,0],Q=new Float32Array(16),j=new Float32Array(9),V=new Float32Array(16),H=[0,0],G=new Float32Array(9);const Z=ho(P,Q,j,V,G,D||[0,0],e.ag(t.transform.zoom),H,N,R||1,z,r,U,l?r.paint.get("raster-elevation"):0,2,C,S,p.range,E,M,f),q=t.isTileAffectedByFog(b),K=t.getOrCreateProgram("raster",{defines:p.defines,overrideFog:q});if(t.uploadCommonUniforms(u,K,n),d instanceof e.aK){const i=d.elevatedGlobeVertexBuffer,n=d.elevatedGlobeIndexBuffer;if(m||!a)d.boundsBuffer&&d.boundsSegments&&K.draw(t,h.TRIANGLES,I,Ni.disabled,A,Vi.disabled,Z,r.id,d.boundsBuffer,t.quadTriangleIndexBuffer,d.boundsSegments);else if(i&&n){const s=O.zoom<=e.c6?d.elevatedGlobeSegments:d.getSegmentsForLongitude(O.center.lng);s&&K.draw(t,h.TRIANGLES,I,Ni.disabled,A,o,Z,r.id,i,n,s)}}else if(c){I=new Oi(h.LEQUAL,Oi.ReadOnly,t.depthRangeFor3D);const e=t.globeSharedBuffers;if(e){const[i,n,s]=e.getGridBuffers($,!1);K.draw(t,h.TRIANGLES,I,v||L,t.colorModeForRenderPass(),o,Z,r.id,i,n,s)}}else{const{tileBoundsBuffer:e,tileBoundsIndexBuffer:i,tileBoundsSegments:n}=t.getTileBoundsBuffers(w);K.draw(t,h.TRIANGLES,I,L,A,Vi.disabled,Z,r.id,e,i,n)}}if(!(d instanceof e.aK)&&c)for(const e of n){const n=e.canonical.y===(1<>>16,2654435769),((e=Math.imul(e^e>>>16,2654435769))>>>0)/4294967296},n=1/1.1;for(let e=0;ee.d7[t](n)));f.push(n);const A=n.canonical.x,m=n.canonical.y;for(const e of f){const o=i.getTile(l?e.wrapped():e);if(!o)continue;const a=o.rasterParticleState;if(!a)continue;const u=e.canonical.x+(1<e.tileID))),f&&(u.activeTexture.set(h.TEXTURE0),t.imageManager.bind(t.context,r.scope)),c){const i=t.getOrCreateProgram(v,{overrideFog:!1,overrideRtt:!0}),n=new Float32Array(e.ad.mat4.identity([])),u=new e.aH(0,0,0,0,0),d=f?xo(n,l,a,t,0,r.scope,A,c,{tileID:u,tileSize:p}):vo(n,l,a,o.toRenderColor(s?null:r.lut));i.draw(t,h.TRIANGLES,_,g,y,Vi.disabled,d,r.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments)}else for(const e of b){const m=t.isTileAffectedByFog(e),b=t.getOrCreateProgram(v,{overrideFog:m}),w=e.toUnwrapped(),T=n?e.projMatrix:t.transform.calculateProjMatrix(w);t.prepareDrawTile();const B=i?i.getTile(e):x?x[e.key]:new xt(e,p,d.zoom,t),C=f?xo(T,l,a,t,0,r.scope,A,c,{tileID:e,tileSize:p}):vo(T,l,a,o.toRenderColor(s?null:r.lut));t.uploadCommonUniforms(u,b,w);const{tileBoundsBuffer:S,tileBoundsIndexBuffer:E,tileBoundsSegments:M}=t.getTileBoundsBuffers(B);b.draw(t,h.TRIANGLES,_,g,y,Vi.disabled,C,r.id,S,E,M)}},sky:function(t,i,r){const n=t._atmosphere?e.ag(t.transform.zoom):1,o=r.paint.get("sky-opacity")*n;if(0===o)return;const s=t.context,a=r.paint.get("sky-type"),l=new Oi(s.gl.LEQUAL,Oi.ReadOnly,[0,1]),c=t.frameCounter/1e3%1;"atmosphere"===a?"offscreen"===t.renderPass?r.needsSkyboxCapture(t)&&(function(t,i){const r=t.context,n=r.gl;let o=i.skyboxFbo;if(!o){o=i.skyboxFbo=r.createFramebuffer(32,32,!0,null),i.skyboxGeometry=new As(r),i.skyboxTexture=r.gl.createTexture(),n.bindTexture(n.TEXTURE_CUBE_MAP,i.skyboxTexture),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,n.LINEAR);for(let e=0;e<6;++e)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,n.RGBA,32,32,0,n.RGBA,n.UNSIGNED_BYTE,null)}r.bindFramebuffer.set(o.framebuffer),r.viewport.set([0,0,32,32]);const s=i.getCenter(t,!0),a=t.getOrCreateProgram("skyboxCapture"),l=new Float64Array(16);e.ad.mat4.identity(l),e.ad.mat4.rotateY(l,l,.5*-Math.PI),ms(t,i,a,l,s,0),e.ad.mat4.identity(l),e.ad.mat4.rotateY(l,l,.5*Math.PI),ms(t,i,a,l,s,1),e.ad.mat4.identity(l),e.ad.mat4.rotateX(l,l,.5*-Math.PI),ms(t,i,a,l,s,2),e.ad.mat4.identity(l),e.ad.mat4.rotateX(l,l,.5*Math.PI),ms(t,i,a,l,s,3),e.ad.mat4.identity(l),ms(t,i,a,l,s,4),e.ad.mat4.identity(l),e.ad.mat4.rotateY(l,l,Math.PI),ms(t,i,a,l,s,5),r.viewport.set([0,0,t.width,t.height])}(t,r),r.markSkyboxValid(t)):"sky"===t.renderPass&&function(e,t,i,r,n){const o=e.context,s=o.gl,a=e.transform,l=e.getOrCreateProgram("skybox");o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,t.skyboxTexture);const c=((e,t,i,r,n)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:r,u_temporal_offset:n}))(a.skyboxMatrix,t.getCenter(e,!1),0,r,n);e.uploadCommonUniforms(o,l),l.draw(e,s.TRIANGLES,i,Ni.disabled,e.colorModeForRenderPass(),Vi.backCW,c,"skybox",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}(t,r,l,o,c):"gradient"===a&&"sky"===t.renderPass&&function(t,i,r,n,o){const s=t.context,a=s.gl,l=t.transform,c=t.getOrCreateProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new As(s)),s.activeTexture.set(a.TEXTURE0);let u=i.colorRampTexture;u||(u=i.colorRampTexture=new e.T(s,i.colorRamp,a.RGBA8)),u.bind(a.LINEAR,a.CLAMP_TO_EDGE);const h=((t,i,r,n,o)=>({u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.ak(r),u_opacity:n,u_temporal_offset:o}))(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get("sky-gradient-radius"),n,o);t.uploadCommonUniforms(s,c),c.draw(t,a.TRIANGLES,r,Ni.disabled,t.colorModeForRenderPass(),Vi.backCW,h,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,r,l,o,c)},debug:function(t,i,r,n,o,s){for(let a=0;a{a&&(a.useNormalOffset=!0,l||(a.enabled=!0))},u=i.getSource();if("light-beam"===t.renderPass&&"batched-model"!==u.type)return;if("vector"===u.type||"geojson"===u.type)return function(t,i,r,n,o){const s=t.transform;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D models for ${s.projection.name} projection is not yet implemented`);const a=s.getFreeCameraOptions().position;if(!t.modelManager)return;const l=t.modelManager;r.modelManager=l;const c=t.shadowRenderer;if(!r._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const u=r._unevaluatedLayout._values["model-id"],h=Object.assign({},r.layout.get("model-id").parameters),d=t.style.order.indexOf(r.fqid);for(const p of n){const n=i.getTile(p).getBucket(r);if(!n||n.projection.name!==s.projection.name)continue;const f=n.getModelUris();f&&!n.modelsRequested&&(l.addModelsFromBucket(f,o),n.modelsRequested=!0);const A=Ms(p,s);h.zoom=A;const m=u.possiblyEvaluate(h);if(Ss(t,n,p),Es.shadowUniformsInitialized=!1,Es.useSingleShadowCascade=!!c&&0===c.getMaxCascadeForTile(p.toUnwrapped()),"shadow"===t.renderPass&&c){if(1===t.currentShadowCascade&&n.isInsideFirstShadowMapFrustum)continue;const i=s.calculatePosMatrix(p.toUnwrapped(),s.worldSize);if(Es.tileMatrix.set(i),Es.shadowTileMatrix=Float32Array.from(c.calculateShadowPassMatrixFromMatrix(i)),Es.aabb.min.fill(0),Es.aabb.max[0]=Es.aabb.max[1]=e.ai,Es.aabb.max[2]=0,Ls(n,Es,t,r.scope))continue}const g=1<0&&t.style.isLayerClipped(r,i.getSource())&&n.updateReplacement(p,t.replacementSource,d,o)&&(n.uploaded=!1,n.upload(t.context));for(let e in n.instancesPerModel){const i=n.instancesPerModel[e];i.features.length>0&&(e=m.evaluate(i.features[0].feature,{}));const s=l.getModel(e,o);if(s&&s.uploaded)for(const e of s.nodes)Is(t,r,e,i,_,p,Es)}}}(t,i,r,n,"vector"===u.type?r.scope:""),void c();if(!u.loaded())return;if("batched-model"===u.type)return function(t,i,r,n){r.resetLayerRenderingStats(t);const o=t.context,s=t.transform,a=t.style.fog,l=t.shadowRenderer;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D landmark models for ${s.projection.name} projection is not yet implemented`);const c=t.transform.getFreeCameraOptions().position,u=e.ad.vec3.scale([],[c.x,c.y,c.z],t.transform.worldSize),h=e.ad.vec3.negate([],u),d=e.ad.mat4.identity([]),p=e.dm(s.center.lat,s.zoom),f=e.ad.mat4.fromScaling([],[1,1,1/p]);e.ad.mat4.translate(d,d,h);const A=r.paint.get("model-opacity").constantOr(1),m=new Oi(o.gl.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D),g=new Oi(o.gl.LEQUAL,Oi.ReadOnly,t.depthRangeFor3D),_=new e.ce([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),y="shadow"===t.renderPass,v=y&&l?l.getCurrentCascadeFrustum():s.getFrustum(s.scaleZoom(s.worldSize)),x=r.paint.get("model-front-cutoff"),b=x[2]<1,w=Ji(t,r.paint.get("model-cutoff-fade-range")),T=r.getLayerRenderingStats();(function(e,t,i,r){const n=e.terrain?e.terrain.exaggeration():0,o=e.transform.zoom;for(const s of r){const r=t.getTile(s).getBucket(i);r&&(r.setFilter(i.filter),e.conflationActive&&r.updateReplacement(s,e.replacementSource),r.evaluateScale(e,i),e.terrain&&n>0&&r.elevationUpdate(e.terrain,n,s,i.source),r.needsReEvaluation(e,o,i)&&r.evaluate(i))}})(t,i,r,n),function(){let c,h,B;b?(c=n.length-1,h=-1,B=-1):(c=0,h=n.length,B=1);const C=new Float64Array(16),S=e.ad.vec3.create(),E=new e.P(0,0);for(let M=c;M!==h;M+=B){const c=n[M],h=i.getTile(c).getBucket(r);if(!h||!h.uploaded)continue;let B=!1;l&&(B=0===l.getMaxCascadeForTile(c.toUnwrapped()));const I=s.calculatePosMatrix(c.toUnwrapped(),s.worldSize),P=h.modelTraits;!y&&b&&(e.ad.mat4.invert(C,I),e.ad.vec3.transformMat4(S,u,C),E.x=S[0],E.y=S[1]);const L=[];h.setFilter(r.filter);for(const i of h.getNodesInfo()){if(i.hiddenByReplacement)continue;if(!i.node.meshes)continue;const r=i.node;let n=0;t.terrain&&r.elevation&&(n=r.elevation*t.terrain.exaggeration());const o=(()=>{const t=i.aabb;return _.min=[...t.min],_.max=[...t.max],_.min[2]+=n,_.max[2]+=n,e.ad.vec3.transformMat4(_.min,_.min,I),e.ad.vec3.transformMat4(_.max,_.max,I),_})(),a=i.evaluatedScale;if(a[0]<=1&&a[1]<=1&&a[2]<=1&&0===o.intersects(v))continue;if(!y&&b){const t=1/6;i.cameraCollisionOpacity=u[0]>o.min[0]&&u[0]o.min[1]&&u[1]!b||1===e.opacity&&1===t.opacity?e.deptht.depth?-1:1));for(const i of L){const n=i.nodeInfo,c=n.node;let u=e.ad.mat4.multiply([],f,i.tileModelMatrix);e.ad.mat4.multiply(u,d,u);const h=e.ad.mat4.invert([],u);e.ad.mat4.transpose(h,h),e.ad.mat4.scale(h,h,Ps),u=e.ad.mat4.multiply(u,u,c.matrix);const p="light-beam"===t.renderPass,A="none"===r.paint.get("model-color-use-theme").constantOr("default"),_=P&e.ds.HasMapboxMeshFeatures,v=_?0:n.evaluatedRMEA[0][2];for(let e=0;e=Re||n>=Re}}const S=d.material;let E;S.occlusionTexture&&S.occlusionTexture.offsetScale&&(E=S.occlusionTexture.offsetScale,b.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const M=t.getOrCreateProgram("model",b);!y&&l&&l.setupShadowsFromMatrix(i.tileModelMatrix,M,l.useNormalOffset),t.uploadCommonUniforms(o,M,null,C);const I=S.pbrMetallicRoughness;I.metallicFactor=.9,I.roughnessFactor=.5;const P=wo(new Float32Array(x),new Float32Array(u),new Float32Array(h),new Float32Array(c.matrix),t,i.opacity,I.baseColorFactor.toRenderColor(null),S.emissiveFactor,I.metallicFactor,I.roughnessFactor,S,v,r,[0,0,0],E);!f&&(n.hasTranslucentParts||i.opacity<1)&&M.draw(t,o.gl.TRIANGLES,m,Ni.disabled,Di.disabled,Vi.backCCW,P,r.id,d.vertexBuffer,d.indexBuffer,d.segments,r.paint,t.transform.zoom,void 0,w),M.draw(t,o.gl.TRIANGLES,f?g:m,Ni.disabled,f||i.opacity<1||n.hasTranslucentParts?Di.alphaBlended:Di.unblended,Vi.backCCW,P,r.id,d.vertexBuffer,d.indexBuffer,d.segments,r.paint,t.transform.zoom,void 0,w)}}}}()}(t,i,r,n),void c();if("model"!==u.type)return;const h=u.getModels(),d=[],p=t.transform.getFreeCameraOptions().position,f=e.ad.vec3.scale([],[p.x,p.y,p.z],t.transform.worldSize);e.ad.vec3.negate(f,f);const A=[],m=[];let g=0;for(const i of h){const n=r.paint.get("model-rotation").constantOr(null),o=r.paint.get("model-scale").constantOr(null),s=r.paint.get("model-translation").constantOr(null);i.computeModelMatrix(t,n,o,s,!0,!0,!1);const a=e.ad.mat4.identity([]),l=e.dm(i.position.lat,t.transform.zoom),c=e.ad.mat4.fromScaling([],[1,1,1/l]);e.ad.mat4.translate(a,a,f),d.push({zScaleMatrix:c,negCameraPosMatrix:a});for(const e of i.nodes)Bs(t.transform,e,i.matrix,t.transform.expandedFarZProjMatrix,g,A,m);g++}if(A.sort(((e,t)=>t.depth-e.depth)),"shadow"!==t.renderPass){if(1===o)for(const e of m)Ts(e,t,r,d[e.modelIndex],Ni.disabled,t.colorModeForRenderPass());else{for(const e of m)Ts(e,t,r,d[e.modelIndex],Ni.disabled,Di.disabled);for(const e of m)Ts(e,t,r,d[e.modelIndex],t.stencilModeFor3D(),t.colorModeForRenderPass());t.resetStencilClippingMasks()}for(const e of A)Ts(e,t,r,d[e.modelIndex],Ni.disabled,t.colorModeForRenderPass());c()}else{for(const e of m)Cs(e.mesh,e.nodeModelMatrix,t,r);for(const e of A)Cs(e.mesh,e.nodeModelMatrix,t,r);c()}}},Ys={line:function(e,t,i){if(e.hasElevatedBuckets=!1,e.hasNonElevatedBuckets=!1,void 0!==e._unevaluatedLayout.getValue("line-elevation-reference")||void 0!==e._unevaluatedLayout.getValue("line-z-offset")){if(t){const i=t.getVisibleCoordinates();for(const r of i){const i=t.getTile(r).getBucket(e);if(i&&(i.hasZOffset?e.hasElevatedBuckets=!0:e.hasNonElevatedBuckets=!0,e.hasElevatedBuckets&&e.hasNonElevatedBuckets))break}}}else e.hasNonElevatedBuckets=!0},model:function(e,t,i){const r=t.getSource();if(!r.loaded())return;if("vector"===r.type||"geojson"===r.type)return void(i.modelManager&&i.modelManager.upload(i,"vector"===r.type?e.scope:""));if("batched-model"===r.type)return;if("model"!==r.type)return;const n=r.getModels();for(const e of n)e.upload(i.context)},raster:function(e,t,i){const r=t.getSource();if(!(r instanceof rt&&r.loaded()))return;const n=e.sourceLayer||r.rasterLayerIds&&r.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-array-band")||r.getInitialBand(n);if(null==o)return;const s=t.getIds().map((e=>t.getTileByID(e)));for(const e of s)e.updateNeeded(n,o)&&r.prepareTile(e,n,o)},"raster-particle":function(e,t,i){const r=t.getSource();if(!(r instanceof rt&&r.loaded()))return;const n=e.sourceLayer||r.rasterLayerIds&&r.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-particle-array-band")||r.getInitialBand(n);if(null==o)return;const s=t.getIds().map((e=>t.getTileByID(e)));for(const e of s)e.updateNeeded(n,o)&&r.prepareTile(e,n,o)}},Js={fill:No};class ea{constructor(t,i,r,n,o){this.context=new Io(t,i),this.transform=r,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=o,this._timeStamp=e.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const s=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const e of s)this._debugParams.enabledLayers[e]=!0;o.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},(()=>{this.style.map.triggerRepaint()})),o.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),o.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),o.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),o.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),o.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const e of s)o.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],e);this.occlusionParams=new Ds(o),this.setup(),this.numSublayers=Bt.maxUnderzooming+Bt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.dy,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new rr(this),this._wireframeDebugCache=new Rs,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const a=new e.r({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new e.T(this.context,a,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=n}updateTerrain(e,t){const i=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(i||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Vn(this,e));const r=this._terrain;this.transform.elevation=i?r:null,r.update(e,this.transform,t),this.transform.elevation&&!r.enabled&&(this.transform.elevation=null)}_updateFog(e){const t=e.fog;if(!t||"globe"===this.transform.projection.name||t.getOpacity(this.transform.pitch)<1||t.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[i,r]=t.getFovAdjustedRange(this.transform._fov);if(i>r)return void(this.transform.fogCullDistSq=null);const n=i+.78*(r-i);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(e){e&&!this._terrain&&(this._terrain=new Vn(this,this.style)),this._forceTerrainMode=e}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,i){if(this.width=t*e.q.devicePixelRatio,this.height=i*e.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._mergedLayers[e].resize()}setup(){const t=this.context,i=new e.b5;i.emplaceBack(0,0),i.emplaceBack(e.ai,0),i.emplaceBack(0,e.ai),i.emplaceBack(e.ai,e.ai),this.tileExtentBuffer=t.createVertexBuffer(i,e.b7.members),this.tileExtentSegments=e.b8.simpleSegment(0,0,4,2);const r=new e.b5;r.emplaceBack(0,0),r.emplaceBack(e.ai,0),r.emplaceBack(0,e.ai),r.emplaceBack(e.ai,e.ai),this.debugBuffer=t.createVertexBuffer(r,e.b7.members),this.debugSegments=e.b8.simpleSegment(0,0,4,5);const n=new e.b5;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,e.b7.members),this.viewportSegments=e.b8.simpleSegment(0,0,4,2);const o=new e.aU;o.emplaceBack(0,0,0,0),o.emplaceBack(e.ai,0,e.ai,0),o.emplaceBack(0,e.ai,0,e.ai),o.emplaceBack(e.ai,e.ai,e.ai,e.ai),this.mercatorBoundsBuffer=t.createVertexBuffer(o,e.ba.members),this.mercatorBoundsSegments=e.b8.simpleSegment(0,0,4,2);const s=new e.aV;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s);const a=new e.b6;for(const e of[0,1,3,2,0])a.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(a),this.emptyTexture=new e.T(t,new e.r({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=e.ad.mat4.create();const l=this.context.gl;this.stencilClearMode=new Ni({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,e.TRIANGLES,Oi.disabled,this.stencilClearMode,Di.disabled,Vi.disabled,On(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(e,t,i){if(!t||this.currentStencilSource===t.id||!e.isTileClipped()||!i||0===i.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of i)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=t.id;const r=this.context,n=r.gl;this.nextStencilID+i.length>256&&this.clearStencil(),r.setColorMode(Di.disabled),r.setDepthMode(Oi.disabled);const o=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const e of i){const i=t.getTile(e),r=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,{tileBoundsBuffer:s,tileBoundsIndexBuffer:a,tileBoundsSegments:l}=this.getTileBoundsBuffers(i);o.draw(this,n.TRIANGLES,Oi.disabled,new Ni({func:n.ALWAYS,mask:0},r,255,n.KEEP,n.KEEP,n.REPLACE),Di.disabled,Vi.disabled,On(e.projMatrix),"$clipping",s,a,l)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new Ni({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);const t=this.context.gl;return new Ni({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){const t=this.context.gl,i=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const e={};for(let i=0;ithis.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture)()&&"translucent"===this.renderPass?new Di([i.ONE,i.ONE_MINUS_SRC_ALPHA,i.CONSTANT_ALPHA,i.ONE_MINUS_SRC_ALPHA],new e.al(0,0,0,void 0===t?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(e,t,i,r=!1){if(this.depthOcclusion)return new Oi(this.context.gl.GREATER,Oi.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!r)return Oi.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Oi(i||this.context.gl.LEQUAL,t,[n,n])}opaquePassEnabledForLayer(){return this.currentLayerthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce(((e,t)=>e+t/this._fpsHistory.length),0))}render(t,i){const r=e.q.now();this._dt=r-this._timeStamp,this._timeStamp=r,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=i;const n=this.style._mergedLayers,o=!(!this.terrain||!this.terrain.enabled),s=()=>this.style._getOrder(o).filter((e=>{const t=n[e];return!(t.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[t.type]}));let a=s(),l=!1,c=!1;for(const e of a){const t=n[e];"circle"===t.type&&(l=!0),"symbol"===t.type&&(t.hasInitialOcclusionOpacityProperties?c=!0:l=!0)}let u=a.map((e=>n[e]));const h=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.q.now()),this.imageManager.beginFrame();let d=0,p=!1;for(const e in h){const t=h[e];t.used&&(t.prepare(this.context),t.getSource().usedInConflation&&++d)}let f=!1;for(const e of u)e.isHidden(this.transform.zoom)||("clip"===e.type&&(f=!0),this.prepareLayer(e));const A={},m={},g={},_={},y={};for(const e in h){const t=h[e];A[e]=t.getVisibleCoordinates(),m[e]=A[e].slice().reverse(),g[e]=t.getVisibleCoordinates(!0).reverse(),_[e]=t.getShadowCasterCoordinates(),y[e]=t.sortCoordinatesByDistance(A[e])}const v=e=>{const t=this.style.getLayerSourceCache(e);return t&&t.used?t.getSource():null};if(d||f||this._clippingActiveLastFrame){const t=[],i=[];let r=0;for(const e of u)this.isSourceForClippingOrConflation(e,v(e))&&(t.push(e),i.push(r)),r++;if(t&&(f||t.length>1)||this._clippingActiveLastFrame){f=!1;const r=[];for(let n=0;n0){const e=v(t);e&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom)),t.minzoom&&(this.minCutoffZoom=Math.max(t.minzoom,this.minCutoffZoom))}t.is3D(o)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=e),this._lastOcclusionLayer=e)}const x=this.style&&this.style.fog;x?(this._fogVisible=0!==x.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=x.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(g),this.opaquePassCutoff=0,a=s(),u=a.map((e=>n[e])));const b=this._shadowRenderer;if(b){b.updateShadowParameters(this.transform,this.style.directionalLight);for(const e in h)for(const t of A[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(t)||e),b.addShadowReceiver(t.toUnwrapped(),e.min,e.max)}}"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.dz(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new xs(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const w=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),T=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(w&&!this._snow&&(this._snow=new Ws(this)),!w&&this._snow&&(this._snow.destroy(),delete this._snow),T&&!this._rain&&(this._rain=new qs(this)),!T&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),!N.has(this.context.gl))return;this.renderPass="offscreen";for(const e of u){const i=t.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const r=i?m[i.id]:void 0;("custom"===e.type||"raster"===e.type||"raster-particle"===e.type||e.isSky()||r&&r.length)&&this.renderLayer(this,i,e,r)}this.depthRangeFor3D=[0,1-(u.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,_)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const B="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),C=(()=>{if(i.showOverdrawInspector)return e.al.black;const t=this.style.fog;if(t&&this.transform.projection.supportsFog){const i=this.style.getLut(t.scope);if(!B){const r="none"===t.properties.get("color-use-theme"),n=t.properties.get("color").toRenderColor(r?null:i).toArray01();return new e.al(...n)}if(B){const r="none"===t.properties.get("space-color-use-theme"),n=t.properties.get("space-color").toRenderColor(r?null:i).toArray01();return new e.al(...n)}}return e.al.transparent})();if(this.context.clear({color:C,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&B&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const e=u[this.currentLayer],i=t.getLayerSourceCache(e);if(e.isSky())continue;const r=i?(e.is3D(o)?y:m)[i.id]:void 0;this._renderTileClippingMasks(e,i,r),this.renderLayer(this,i,e,r)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&B&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.ag(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer{for(this.currentLayer=0;this.currentLayer0&&e.hasShadowPass()&&0==--E&&(b.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=e;this.currentLayer++){const e=u[this.currentLayer];if(!e.hasLightBeamPass())continue;const i=t.getLayerSourceCache(e);this.renderLayer(this,i,e,i?m[i.id]:void 0)}this.currentLayer=e,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const e=this.currentLayer;this.depthOcclusion=!0;for(const e of this.layersWithOcclusionOpacity){this.currentLayer=e;const i=u[this.currentLayer],r=t.getLayerSourceCache(i),n=r?m[r.id]:void 0;this.terrain||this._renderTileClippingMasks(i,r,r?A[r.id]:void 0),this.renderLayer(this,r,i,n)}this.depthOcclusion=!1,this.currentLayer=e,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let i=null;u.forEach((e=>{const r=t.getLayerSourceCache(e);r&&!e.isHidden(this.transform.zoom)&&r.getVisibleCoordinates().length&&(!i||i.getSource().maxzoom0?t.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,t,i){const r=void 0===i?this.terrain&&this.terrain.renderingToTexture:i,n=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(n.push("LIGHTING_3D_MODE"),n.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):r||n.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass&&(this._shadowMapDebug||n.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(n.push("TERRAIN"),this.linearFloatFilteringSupported()&&n.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&n.push("GLOBE"),!this._fogVisible||r||void 0!==t&&!t||n.push("FOG","FOG_DITHERING"),r&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}getOrCreateProgram(e,t){this.cache=this.cache||{};const i=t&&t.defines||[],r=t&&t.config,n=this.currentGlobalDefines(e,t&&t.overrideFog,t&&t.overrideRtt).concat(i),o=Zn.cacheKey(Ur[e],e,n,r);return this.cache[o]||(this.cache[o]=new Zn(this.context,e,Ur[e],r,Bo[e],n)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,i){if(this.style.enable3dLights()){const r=this.style.directionalLight,n=this.style.ambientLight;if(r&&n){const o=((t,i,r)=>{const n=t.properties.get("direction"),o="none"===t.properties.get("color-use-theme"),s=t.properties.get("color").toRenderColor(o?null:r.getLut(t.scope)).toArray01(),a=t.properties.get("intensity"),l="none"===i.properties.get("color-use-theme"),c=i.properties.get("color").toRenderColor(l?null:r.getLut(i.scope)).toArray01(),u=i.properties.get("intensity"),h=[n.x,n.y,n.z],d=e.cN(c,u),p=e.cN(s,a);return{u_lighting_ambient_color:d,u_lighting_directional_dir:h,u_lighting_directional_color:p,u_ground_radiance:Hn(h,p,d)}})(r,n,this.style);i.setLightsUniformValues(t,o)}}}uploadCommonUniforms(t,i,r,n,o){if(this.uploadCommonLightUniforms(t,i),this.terrain&&this.terrain.renderingToTexture)return;const s=this.style.fog;if(s){const o=s.getOpacity(this.transform.pitch),a=((t,i,r,n,o,s,a,l,c,u,h,d)=>{const p=t.transform,f="none"===i.properties.get("color-use-theme"),A=i.properties.get("color").toRenderColor(f?null:t.style.getLut(i.scope)).toArray01();A[3]=n;const m=t.frameCounter/1e3%1,[g,_]=i.properties.get("vertical-range");return{u_fog_matrix:r?p.calculateFogTileMatrix(r):d||t.identityMat,u_fog_range:i.getFovAdjustedRange(p._fov),u_fog_color:A,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(g,_),_],u_fog_temporal_offset:m,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:a,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:u,u_viewport:h,u_globe_transition:e.ag(p.zoom),u_is_globe:+("globe"===p.projection.name)}})(this,s,r,o,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.q.devicePixelRatio,this.transform.height*e.q.devicePixelRatio],n);i.setFogUniformValues(t,a)}o&&i.setCutoffUniformValues(t,o.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const e=this._backgroundTiles,t=this._backgroundTiles={},i=this.transform.coveringTiles({tileSize:512});for(const r of i)t[r.key]=e[r.key]||new xt(r,512,this.transform.tileZoom,this);return t}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,t){return!(!e.is3D(!(!this.terrain||!this.terrain.enabled))||"clip"!==e.type&&(e.minzoom&&e.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==e.sourceLayer)&&(!t||"batched-model"!==t.type)))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let t=this._cachedTileFogOpacities[e.key];return t||(this._cachedTileFogOpacities[e.key]=t=this.style.fog.getOpacityForTile(e)),t[0]>=Re||t[1]>=Re}setupDepthForOcclusion(e,t,i){const r=this.context,n=r.gl,o=!!i;var s;i||(i={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),r.activeTexture.set(n.TEXTURE3),e&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),i.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],i.u_depth_range_unpack=[2/((s=this.depthRangeFor3D)[1]-s[0]),-1-2*s[0]/(s[1]-s[0])],i.u_occluder_half_size=.5*this.occlusionParams.occluderSize,i.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),r.activeTexture.set(n.TEXTURE0),o||t.setTerrainUniformValues(r,i)}}function ta(e,t){let i=!1,r=null;const n=()=>{r=null,i&&(e(),r=setTimeout(n,t),i=!1)};return()=>(i=!0,r||n(),r)}class ia{constructor(t){this._hashName=t&&encodeURIComponent(t),e.aQ(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=ta(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const e=this._map;if(!e)return"";const t=ra(e);if(this._hashName){const e=this._hashName;let i=!1;const r=location.hash.slice(1).split("&").map((r=>{const n=r.split("=")[0];return n===e?(i=!0,`${n}=${t}`):r})).filter((e=>e));return i||r.push(`${e}=${t}`),`#${r.join("&")}`}return`#${t}`}_getCurrentHash(){const e=location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((e=>e.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some((e=>isNaN(e)))){const i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function ra(e,t){const i=e.getCenter(),r=Math.round(100*e.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),s=Math.round(i.lng*o)/o,a=Math.round(i.lat*o)/o,l=e.getBearing(),c=e.getPitch();let u=t?`/${s}/${a}/${r}`:`${r}/${a}/${s}`;return(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),u}const na={linearity:.3,easing:e.dB(0,0,.3,1)},oa=e.l({deceleration:2500,maxSpeed:1400},na),sa=e.l({deceleration:20,maxSpeed:1400},na),aa=e.l({deceleration:1e3,maxSpeed:360},na),la=e.l({deceleration:1e3,maxSpeed:90},na);class ca{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.q.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=e.q.now();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const o=ha(i.pan.mag(),r,e.l({},oa,t||{}));n.offset=i.pan.mult(o.amount/i.pan.mag()),n.center=this._map.transform.center,ua(n,o)}if(i.zoom){const e=ha(i.zoom,r,sa);n.zoom=this._map.transform.zoom+e.amount,ua(n,e)}if(i.bearing){const t=ha(i.bearing,r,aa);n.bearing=this._map.transform.bearing+e.ay(t.amount,-179,179),ua(n,t)}if(i.pitch){const e=ha(i.pitch,r,la);n.pitch=this._map.transform.pitch+e.amount,ua(n,e)}if(n.zoom||n.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function ua(e,t){(!e.duration||e.durationi.unproject(e))),a=o.reduce(((e,t,i,r)=>e.add(t.div(r.length))),new e.P(0,0));super(t,{points:o,point:a,lngLats:s,lngLat:i.unproject(a),originalEvent:r}),this._defaultPrevented=!1}}class fa extends e.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}}class Aa{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new fa(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new da(e.type,this._map,e))}mouseup(e){this._map.fire(new da(e.type,this._map,e))}preclick(t){const i=e.l({},t);i.type="preclick",this._map.fire(new da(i.type,this._map,i))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new da(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new da(e.type,this._map,e))}mouseover(e){this._map.fire(new da(e.type,this._map,e))}mouseout(e){this._map.fire(new da(e.type,this._map,e))}touchstart(e){return this._firePreventable(new pa(e.type,this._map,e))}touchmove(e){this._map.fire(new pa(e.type,this._map,e))}touchend(e){this._map.fire(new pa(e.type,this._map,e))}touchcancel(e){this._map.fire(new pa(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ma{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new da(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new da("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new da(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ga{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(p(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t,r=this._startPos,n=this._lastPos;if(!r||!n||n.equals(i)||!this._box&&i.dist(r){this._box&&(this._box.style.transform=`translate(${o}px,${a}px)`,this._box.style.width=s-o+"px",this._box.style.height=c-a+"px")}))}mouseupWindow(t,i){if(!this._active)return;const r=this._startPos,n=i;if(r&&0===t.button){if(this.reset(),m(),r.x!==n.x||r.y!==n.y)return this._map.fire(new e.A("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(r,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),f(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.A(t,{originalEvent:i}))}}function _a(e,t){const i={};for(let r=0;rthis.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=_a(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const r=_a(i,t);for(const e in this.touches){const t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class va{constructor(e){this.singleTap=new ya(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const r=this.singleTap.touchend(e,t,i);if(r){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class xa{constructor(){this._zoomIn=new va({numTouches:1,numTaps:2}),this._zoomOut=new va({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i);return r?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(r)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const ba={0:1,2:2},wa={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Ta{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const i=y(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}mousemoveWindow(e,t){const i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const i=ba[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)0&&(this._active=!0);const n=_a(r,i),o=new e.P(0,0),s=new e.P(0,0);let a=0;for(const e in n){const t=n[e],i=this._touches[e];i&&(o._add(t),s._add(t.sub(i)),a++,n[e]=t)}if(this._touches=n,a{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")}),500)}}class Ma{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,i){return{}}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){const r=this._firstTwoTouches;if(!r)return;e.preventDefault();const[n,o]=r,s=Ia(i,t,n),a=Ia(i,t,o);if(!s||!a)return;const l=this._aroundCenter?null:s.add(a).div(2);return this._move([s,a],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[r,n]=this._firstTwoTouches,o=Ia(i,t,r),s=Ia(i,t,n);o&&s||(this._active&&m(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Ia(e,t,i){for(let r=0;rMath.abs(e.x)}class Ra extends Ma{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,za(e[0].sub(e[1]))&&(this._valid=!1)}_move(t,i,r){const n=this._lastPoints;if(!n)return;const o=t[0].sub(n[0]),s=t[1].sub(n[1]);return this._map._cooperativeGestures&&!e.dC()&&r.touches.length<3||(this._valid=this.gestureBeginsVertically(o,s,r.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+s.y)/2*-.5})}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,n=t.mag()>=2;if(!r&&!n)return;if(!r||!n)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return za(e)&&za(t)&&o}}const Da={panStep:100,bearingStep:15,pitchStep:10};class Oa{constructor(){const e=Da;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:s=>{const a=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:Ua,zoom:t?Math.round(a)+t*(e.shiftKey?2:1):a,bearing:s.getBearing()+i*this._bearingStep,pitch:s.getPitch()+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.getCenter()},{originalEvent:e})}}}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 Ua(e){return e*(2-e)}const Na=4.000244140625,Qa=1/450;class ja{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._handler=i,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Qa,e.aQ(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.dC()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const r=e.q.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%Na==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=g(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;"wheel"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const i=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>Na?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==r&&(r=1/r);const n=i(),o=Math.pow(2,n),s="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(s*r))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const r="number"==typeof this._targetZoom?this._targetZoom:i(),n=this._startZoom,o=this._easing;let s,a=!1;if("wheel"===this._type&&n&&o){const t=Math.min((e.q.now()-this._lastWheelEventTime)/200,1),i=o(t);s=e.ah(n,r,i),t<1?this._frameId||(this._frameId=!0):a=!0}else s=r,a=!0;this._active=!0,a&&(this._active=!1,this._finishTimeout=window.setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200));let l=s-i();return l*this._lastDelta<0&&(l=0),{noInertia:!0,needsRenderFrame:!a,zoomDelta:l,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.dD;if(this._prevEase){const t=this._prevEase,r=(e.q.now()-t.start)/t.duration,n=t.easing(r+.01)-t.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=e.dB(o,s,.25,1)}return this._prevEase={start:e.q.now(),duration:t,easing:i},i}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")}),200)}}class Va{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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 Ha{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ga{constructor(){this._tap=new va({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $a{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Za{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,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 qa{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-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 Ka=e=>e.zoom||e.drag||e.pitch||e.rotate;class Wa extends e.A{}class Xa{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,i){const r=e.ad.vec3.sub([],i,t);this.radius=e.ad.vec3.length(r[2]<0?e.ad.vec3.div([],r,this.constants):[r[0],r[1],0])}projectRay(t){e.ad.vec3.div(t,t,this.constants),e.ad.vec3.normalize(t,t),e.ad.vec3.mul(t,t,this.constants);const i=e.ad.vec3.scale([],t,this.radius);if(i[2]>0){const t=e.ad.vec3.scale([],[0,0,1],e.ad.vec3.dot(i,[0,0,1])),r=e.ad.vec3.scale([],e.ad.vec3.normalize([],[i[0],i[1],0]),this.radius),n=e.ad.vec3.add([],i,e.ad.vec3.scale([],e.ad.vec3.sub([],e.ad.vec3.add([],r,t),i),2));i[0]=n[0],i[1]=n[1]}return i}}function Ya(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Ja{constructor(t,i){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ca(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Xa,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),e.aQ(["handleEvent","handleWindowEvent"],this);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,t,i]of this._listeners){const r=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(t,r,i)}}destroy(){for(const[e,t,i]of this._listeners){const r=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(t,r,i)}}_addDefaultHandlers(e){const t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new Aa(t,e));const r=t.boxZoom=new ga(t,e);this._add("boxZoom",r);const n=new xa,o=new Ha;t.doubleClickZoom=new Va(o,n),this._add("tapZoom",n),this._add("clickZoom",o);const s=new Ga;this._add("tapDragZoom",s);const a=t.touchPitch=new Ra(t);this._add("touchPitch",a);const l=new Ca(e),c=new Sa(e);t.dragRotate=new Za(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new Ba(e),h=new Ea(t,e);t.dragPan=new $a(i,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const d=new ka,p=new La;t.touchZoomRotate=new qa(i,p,d,s),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new ma(t));const f=t.scrollZoom=new ja(t,this);this._add("scrollZoom",f,["mousePan"]);const A=t.keyboard=new Oa;this._add("keyboard",A);for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[i]&&t[i].enable(e[i])}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ka(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,t,i){for(const r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}handleEvent(e,t){this._updatingCamera=!0;const i="renderFrame"===e.type,r=i?void 0:e,n={needsRenderFrame:!1},o={},s={},a=e.touches?this._getMapTouches(e.touches):void 0,l=a?_(this._el,a):i?void 0:g(this._el,e);for(const{handlerName:i,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;this._blockedByActive(s,u,i)?c.reset():c[t||e.type]&&(h=c[t||e.type](e,l,a),this.mergeHandlerResult(n,o,h,i,r),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||c.isActive())&&(s[i]=c)}const c={};for(const e in this._previousActiveHandlers)s[e]||(c[e]=r);this._previousActiveHandlers=s,(Object.keys(c).length||Ya(n))&&(this._changes.push([n,o,c]),this._triggerRenderFrame()),(Object.keys(s).length||Ya(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=n;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(t,i,r,n,o){if(!r)return;e.l(t,r);const s={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){const t={},i={},r={};for(const[n,o,s]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.aroundCoord&&(t.aroundCoord=n.aroundCoord),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),e.l(i,o),e.l(r,s);this._updateMapTransform(t,i,r),this._changes=[]}_updateMapTransform(t,i,r){const n=this._map,o=n.transform,s=e=>[e.x,e.y,e.z];if((()=>{const e=this._eventsInProgress.drag;return e&&!this._handlersById[e.handlerName].isActive()})()&&!Ya(t)){const e=o.zoom;o.cameraElevationReference="sea",null!=this._originalZoom&&o._orthographicProjectionAtLowPitch&&"globe"!==o.projection.name&&0===o.pitch?(o.cameraElevationReference="ground",o.zoom=this._originalZoom):(o.recenterOnTerrain(),o.cameraElevationReference="ground"),e!==o.zoom&&this._map._update(!0)}if(o._isCameraConstrained&&n._stop(!0),!Ya(t))return void this._fireEvents(i,r,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,aroundCoord:d,pinchAround:p}=t;o._isCameraConstrained&&(l>0&&(l=0),o._isCameraConstrained=!1),void 0!==p&&(h=p),(l||(e=>i[e]&&!this._eventsInProgress[e])("drag"))&&h&&(this._dragOrigin=s(o.pointCoordinate3D(h)),this._originalZoom=o.zoom,this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",n._stop(!0),h=h||n.transform.centerPoint,c&&(o.bearing+=c),u&&(o.pitch+=u),o._updateCameraState();const f=[0,0,0];if(a)if("mercator"===o.projection.name){const e=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h).dir),t=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h.sub(a)).dir);f[0]=t[0]-e[0],f[1]=t[1]-e[1]}else{const t=o.pointCoordinate(h);if("globe"===o.projection.name){a=a.rotate(-o.angle);const i=o._pixelsPerMercatorPixel/o.worldSize;f[0]=-a.x*e.dE(e.aT(t.y))*i,f[1]=-a.y*e.dE(o.center.lat)*i}else{const e=o.pointCoordinate(h.sub(a));t&&e&&(f[0]=e.x-t.x,f[1]=e.y-t.y)}}const A=o.zoom,m=[0,0,0];if(l){const t=s(d||o.pointCoordinate3D(h)),i={dir:e.ad.vec3.normalize([],e.ad.vec3.sub([],t,o._camera.position))};if(i.dir[2]<0){const r=o.zoomDeltaToMovement(t,l);e.ad.vec3.scale(m,i.dir,r)}}const g=e.ad.vec3.add(f,f,m);o._translateCameraConstrained(g),l&&Math.abs(o.zoom-A)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}_fireEvents(t,i,r){const n=Ka(this._eventsInProgress),o=Ka(t),s={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in s)this._fireEvent(e,s[e]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const a={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=i[t]||r,a[`${e}end`]=l)}for(const e in a)this._fireEvent(e,a[e]);const c=Ka(this._eventsInProgress);if(r&&(n||o)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new Wa("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const el="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class tl extends e.E{constructor(t,i){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._respectPrefersReducedMotion=!1!==i.respectPrefersReducedMotion,e.aQ(["_renderFrameCallback"],this)}getCenter(){return new e.bO(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,i,r){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.l({offset:t},i),r)}panTo(t,i,r){return this.easeTo(e.l({center:t},i),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,i,r){return this.easeTo(e.l({zoom:t},i),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,i,r){return this.easeTo(e.l({bearing:t},i),r)}resetNorth(t,i){return this.rotateTo(0,e.l({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.l({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):r/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,i,r,n,o,s){const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=n,a.pitch=o;const c=e.bO.convert(i),u=e.bO.convert(r),h=.5*(c.lat+u.lat),d=.5*(c.lng+u.lng),p=e.dF(h,d),f=e.ad.vec3.normalize([],p),A=e.ad.vec3.normalize([],e.ad.vec3.cross([],f,[0,1,0])),m=e.ad.vec3.cross([],A,f),g=[A[0],A[1],A[2],0,m[0],m[1],m[2],0,f[0],f[1],f[2],0,0,0,0,1],_=[p,e.dF(c.lat,c.lng),e.dF(u.lat,c.lng),e.dF(u.lat,u.lng),e.dF(c.lat,u.lng),e.dF(h,c.lng),e.dF(h,u.lng),e.dF(c.lat,d),e.dF(u.lat,d)];let y=e.ce.fromPoints(_.map((t=>[e.ad.vec3.dot(A,t),e.ad.vec3.dot(m,t),e.ad.vec3.dot(f,t)])));const v=e.ad.vec3.transformMat4([],y.center,g);0===e.ad.vec3.squaredLength(v)&&e.ad.vec3.set(v,0,0,1),e.ad.vec3.normalize(v,v),e.ad.vec3.scale(v,v,e.az),a.center=e.dG(v);const x=a.getWorldToCameraMatrix(),b=e.ad.mat4.invert(new Float64Array(16),x);y=e.ce.applyTransform(y,e.ad.mat4.multiply([],x,g));const w=this._extendAABB(y,a,l,n);if(!w)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");y=w,e.ad.vec3.transformMat4(v,v,x);const T=.5*(y.max[2]-y.min[2]),B=this._minimumAABBFrustumDistance(a,y),C=e.ad.vec3.scale([],[0,0,1],T),S=e.ad.vec3.add(C,v,C),E=B+(0===a.pitch?0:e.ad.vec3.distance(v,S)),M=a.globeCenterInViewSpace,I=e.ad.vec3.sub([],v,[M[0],M[1],M[2]]);e.ad.vec3.normalize(I,I),e.ad.vec3.scale(I,I,E);const P=e.ad.vec3.add([],v,I);e.ad.vec3.transformMat4(P,P,b);const L=e.dv/e.az,F=e.ad.vec3.length(P),k=e.bH(Math.max(F*L-e.dv,Number.EPSILON),0),z=Math.min(a.zoomFromMercatorZAdjusted(k),l.maxZoom);return z>.5*(e.c6+e.bY)?(a.setProjection({name:"mercator"}),a.zoom=z,this._cameraForBounds(a,i,r,n,o,s)):{center:a.center,zoom:z,bearing:n,pitch:o}}_extendAABB(t,i,r,n){const o=.5*((r.padding.left||0)+(r.padding.right||0)),s=.5*((r.padding.top||0)+(r.padding.bottom||0)),a=s,l=o,c=o,u=s,h=i.width-(l+c),d=i.height-(a+u),p=e.ad.vec3.sub([],t.max,t.min),f=Math.min(h/p[0],d/p[1]),A=Math.min(i.scaleZoom(i.scale*f),r.maxZoom);if(isNaN(A))return null;const m=i.scale/i.zoomScale(A),g=new e.ce([t.min[0]-l*m,t.min[1]-u*m,t.min[2]],[t.max[0]+c*m,t.max[1]+a*m,t.max[2]]),_=("number"==typeof r.offset.x&&"number"==typeof r.offset.y?new e.P(r.offset.x,r.offset.y):e.P.convert(r.offset)).rotate(-e.ak(n));return g.center[0]-=_.x*m,g.center[1]+=_.y*m,g}queryTerrainElevation(t,i){const r=this.transform.elevation;return r?(i=e.l({},{exaggerated:!0},i),r.getAtPoint(e.ac.fromLngLat(t),null,i.exaggerated)):null}_cameraForBounds(t,i,r,n,o,s){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,r,n,o,s);const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=n,a.pitch=o;const c=e.bO.convert(i),u=e.bO.convert(r),h=new e.bO(c.lng,u.lat),d=new e.bO(u.lng,c.lat),p=a.project(c),f=a.project(u),A=this.queryTerrainElevation(c),m=this.queryTerrainElevation(u),g=this.queryTerrainElevation(h),_=this.queryTerrainElevation(d),y=[[p.x,p.y,Math.min(A||0,m||0,g||0,_||0)],[f.x,f.y,Math.max(A||0,m||0,g||0,_||0)]];let v=e.ce.fromPoints(y);const x=a.getWorldToCameraMatrix(),b=e.ad.mat4.invert(new Float64Array(16),x);v=e.ce.applyTransform(v,x);const w=this._extendAABB(v,a,l,n);if(!w)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v=w;const T=.5*e.ad.vec3.sub([],v.max,v.min)[2],B=this._minimumAABBFrustumDistance(a,v),C=[0,0,1,0];e.ad.vec4.transformMat4(C,C,x),e.ad.vec4.normalize(C,C);const S=e.ad.vec3.scale([],C,B+T),E=e.ad.vec3.add([],v.center,S);e.ad.vec3.transformMat4(v.center,v.center,b),e.ad.vec3.transformMat4(E,E,b);const M=a.unproject(new e.P(v.center[0],v.center[1])),I=e.dH(a.projection,M),P=Math.pow(2,I),L=Math.min(a._zoomFromMercatorZ(E[2]*a.pixelsPerMeter*P/a.worldSize),l.maxZoom);return a.mercatorFromTransition&&L<.5*(e.c6+e.bY)?(a.setProjection({name:"globe"}),a.zoom=L,this._cameraForBounds(a,i,r,n,o,s)):{center:M,zoom:L,bearing:n,pitch:o}}fitBounds(e,t,i){const r=this.cameraForBounds(e,t);return this._fitInternal(r,t,i)}fitScreenCoordinates(t,i,r,n,o){const s=e.P.convert(t),a=e.P.convert(i),l=new e.P(Math.min(s.x,a.x),Math.min(s.y,a.y)),c=new e.P(Math.max(s.x,a.x),Math.max(s.y,a.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(s,a))return this;const u=this.transform.pointLocation3D(l),h=this.transform.pointLocation3D(c),d=this.transform.pointLocation3D(new e.P(l.x,c.y)),p=this.transform.pointLocation3D(new e.P(c.x,l.y)),f=[Math.min(u.lng,h.lng,d.lng,p.lng),Math.min(u.lat,h.lat,d.lat,p.lat)],A=[Math.max(u.lng,h.lng,d.lng,p.lng),Math.max(u.lat,h.lat,d.lat,p.lat)],m=n&&n.pitch?n.pitch:this.getPitch(),g=this._cameraForBounds(this.transform,f,A,r,m,n);return this._fitInternal(g,n,o)}_fitInternal(t,i,r){return t?(i=e.l(t,i)).linear?this.easeTo(i,r):this.flyTo(i,r):this}jumpTo(t,i){this.stop();const r=t.preloadOnly?this.transform.clone():this.transform;let n=!1,o=!1,s=!1;"zoom"in t&&r.zoom!==+t.zoom&&(n=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=e.bO.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(o=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(s=!0,r.pitch=+t.pitch);const a="number"==typeof t.padding?this._extendPadding(t.padding):t.padding;if(null!=t.padding&&!r.isPaddingEqual(a))if(!1===t.retainPadding){const e=r.clone();e.padding=a,r.setLocationAtPoint(r.center,e.centerPoint)}else r.padding=a;return t.preloadOnly?(this._preloadTiles(r),this):(this.fire(new e.A("movestart",i)).fire(new e.A("move",i)),n&&this.fire(new e.A("zoomstart",i)).fire(new e.A("zoom",i)).fire(new e.A("zoomend",i)),o&&this.fire(new e.A("rotatestart",i)).fire(new e.A("rotate",i)).fire(new e.A("rotateend",i)),s&&this.fire(new e.A("pitchstart",i)).fire(new e.A("pitch",i)).fire(new e.A("pitchend",i)),this.fire(new e.A("moveend",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(el),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,i){const r=this.transform;if(!r.projection.supportsFreeCamera)return e.w(el),this;this.stop();const n=r.zoom,o=r.pitch,s=r.bearing;r.setFreeCameraOptions(t);const a=n!==r.zoom,l=o!==r.pitch,c=s!==r.bearing;return this.fire(new e.A("movestart",i)).fire(new e.A("move",i)),a&&this.fire(new e.A("zoomstart",i)).fire(new e.A("zoom",i)).fire(new e.A("zoomend",i)),c&&this.fire(new e.A("rotatestart",i)).fire(new e.A("rotate",i)).fire(new e.A("rotateend",i)),l&&this.fire(new e.A("pitchstart",i)).fire(new e.A("pitch",i)).fire(new e.A("pitchend",i)),this.fire(new e.A("moveend",i)),this}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.l({offset:[0,0],duration:500,easing:e.dD},t)).animate||this._prefersReducedMotion(t))&&(t.duration=0);const r=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?+t.zoom:n,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:s,h=this._extendPadding(t.padding),d=e.P.convert(t.offset);let p,f,A;if("globe"===r.projection.name){const i=e.ac.fromLngLat(r.center),n=d.rotate(-r.angle);i.x+=n.x/r.worldSize,i.y+=n.y/r.worldSize;const o=i.toLngLat(),s=e.bO.convert(t.center||o);this._normalizeCenter(s),p=r.centerPoint.add(n),f=new e.P(i.x,i.y).mult(r.worldSize),A=new e.P(e.av(s.lng),e.aC(s.lat)).mult(r.worldSize).sub(f)}else{p=r.centerPoint.add(d);const i=r.pointLocation(p),n=e.bO.convert(t.center||i);this._normalizeCenter(n),f=r.project(i),A=r.project(n).sub(f)}const m=r.zoomScale(l-n);let g,_;t.around&&(g=e.bO.convert(t.around),_=r.locationPoint(g));const y=this._zooming||l!==n,v=this._rotating||o!==c,x=this._pitching||u!==s,b=!r.isPaddingEqual(h),w=!1===t.retainPadding?r.clone():r,T=r=>T=>{if(y&&(r.zoom=e.ah(n,l,T)),v&&(r.bearing=e.ah(o,c,T)),x&&(r.pitch=e.ah(s,u,T)),b&&(w.interpolatePadding(a,h,T),p=w.centerPoint.add(d)),g)r.setLocationAtPoint(g,_);else{const e=r.zoomScale(r.zoom-n),t=l>n?Math.min(2,m):Math.max(.5,m),i=Math.pow(t,1-T),o=r.unproject(f.add(A.mult(T*i)).mult(e));r.setLocationAtPoint(r.renderWorldCopies?o.wrap():o,p)}return t.preloadOnly||this._fireMoveEvents(i),r};if(t.preloadOnly){const e=this._emulate(T,t.duration,r);return this._preloadTiles(e),this}const B={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=y,this._rotating=v,this._pitching=x,this._padding=b,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,B),this._ease(T(r),(e=>{"sea"===r.cameraElevationReference&&r.recenterOnTerrain(),this._afterEase(i,e)}),t),this}_prepareEase(t,i,r={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),i||r.moving||this.fire(new e.A("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.A("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.A("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new e.A("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.A("move",t)),this._zooming&&this.fire(new e.A("zoom",t)),this._rotating&&this.fire(new e.A("rotate",t)),this._pitching&&this.fire(new e.A("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const r=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new e.A("zoomend",t)),n&&this.fire(new e.A("rotateend",t)),o&&this.fire(new e.A("pitchend",t)),this.fire(new e.A("moveend",t))}flyTo(t,i){if(this._prefersReducedMotion(t)){const r=e.aA(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(r,i)}this.stop(),t=e.l({offset:[0,0],speed:1.2,curve:1.42,easing:e.dD},t);const r=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?e.ay(+t.zoom,r.minZoom,r.maxZoom):n,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:s,h=this._extendPadding(t.padding),d=r.zoomScale(l-n),p=e.P.convert(t.offset);let f=r.centerPoint.add(p);const A=r.pointLocation(f),m=e.bO.convert(t.center||A);this._normalizeCenter(m);const g=r.project(A),_=r.project(m).sub(g);let y=t.curve;const v=Math.max(r.width,r.height),x=v/d,b=_.mag();if("minZoom"in t){const i=e.ay(Math.min(t.minZoom,n,l),r.minZoom,r.maxZoom),o=v/r.zoomScale(i-n);y=Math.sqrt(o/b*2)}const w=y*y;function T(e){const t=(x*x-v*v+(e?-1:1)*w*w*b*b)/(2*(e?x:v)*w*b);return Math.log(Math.sqrt(t*t+1)-t)}function B(e){return(Math.exp(e)-Math.exp(-e))/2}function C(e){return(Math.exp(e)+Math.exp(-e))/2}const S=T(0);let E=function(e){return C(S)/C(S+y*e)},M=function(e){return v*((C(S)*(B(t=S+y*e)/C(t))-B(S))/w)/b;var t},I=(T(1)-S)/y;if(Math.abs(b)<1e-6||!isFinite(I)){if(Math.abs(v-x)<1e-6)return this.easeTo(t,i);const e=xt.maxDuration&&(t.duration=0);const P=o!==c,L=u!==s,F=!r.isPaddingEqual(h),k=!1===t.retainPadding?r.clone():r,z=r=>d=>{const A=d*I,y=1/E(A);r.zoom=1===d?l:n+r.scaleZoom(y),P&&(r.bearing=e.ah(o,c,d)),L&&(r.pitch=e.ah(s,u,d)),F&&(k.interpolatePadding(a,h,d),f=k.centerPoint.add(p));const v=1===d?m:r.unproject(g.add(_.mult(M(A))).mult(y));return r.setLocationAtPoint(r.renderWorldCopies?v.wrap():v,f),r._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(i),r};if(t.preloadOnly){const e=this._emulate(z,t.duration,r);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=P,this._pitching=L,this._padding=F,this._prepareEase(i,!1),this._ease(z(r),(()=>this._afterEase(i)),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,i,r){!1===r.animate||0===r.duration?(t(1),i()):(this._easeStart=e.q.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.q.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,i){t=e.bF(t,-180,180);const r=Math.abs(t-i);return Math.abs(t-360-i)180?-360:i<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&e.q.prefersReducedMotion&&!(t&&t.essential)}_emulate(e,t,i){const r=Math.ceil(15*t/1e3),n=[],o=e(i.clone());for(let e=0;e<=r;e++){const t=o(e/r);n.push(t.clone())}return n}_preloadTiles(e,t){}}class il{constructor(t={}){this.options=t,e.aQ(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact,i=e._getUIString("AttributionControl.ToggleAttribution");this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=l("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",i);const r=l("span","mapboxgl-ctrl-icon",this._compactButton);return r.setAttribute("aria-hidden","true"),r.setAttribute("title",i),this._innerContainer=l("div","mapboxgl-ctrl-attrib-inner",this._container),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.e.ACCESS_TOKEN}];if(t){const r=i.reduce(((e,t,r)=>(t.value&&(e+=`${t.key}=${t.value}${re.length-t.length)),e=e.filter(((t,i)=>{for(let r=i+1;r=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class rl{constructor(){e.aQ(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=l("div","mapboxgl-ctrl");const t=l("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(const t in e){const i=e[t].getSource();if(i.hasOwnProperty("mapbox_logo")&&!i.mapbox_logo)return!1}return!0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}class nl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class ol{constructor(e){this.jumpTo(e)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const i=e.cC((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i}}const sl={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class al extends e.A{constructor(e,t,i,r){const{point:n,lngLat:o,originalEvent:s,target:a}=e;super(e.type,{point:n,lngLat:o,originalEvent:s,target:a}),this.preventDefault=()=>{e.preventDefault()},this.id=t,this.interaction=i,this.feature=r}}class ll{constructor(e){this.map=e,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(t,i){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const r=i.filter;let n=i.type;r&&this.filters.set(t,e.a_(r)),"mouseover"===n&&(n="mouseenter"),"mouseout"===n&&(n="mouseleave");const o=this.interactionsByType.get(n)||new Map;"mouseenter"===n||"mouseleave"===n?(0===this.delegatedInteractions.size&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,i)):0===o.size&&this.map.on(n,this.handleType),0===o.size&&this.interactionsByType.set(n,o),o.set(t,i),this.typeById.set(t,n)}get(e){const t=this.typeById.get(e);if(!t)return;const i=this.interactionsByType.get(t);return i?i.get(e):void 0}remove(e){const t=this.typeById.get(e);if(!t)return;this.typeById.delete(e),this.filters.delete(e);const i=this.interactionsByType.get(t);i&&(i.delete(e),"mouseenter"===t||"mouseleave"===t?(this.delegatedInteractions.delete(e),0===this.delegatedInteractions.size&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):0===i.size&&this.map.off(t,this.handleType))}queryTargets(e,t){const i=[];for(const[e,r]of t)r.target&&i.push({targetId:e,target:r.target,filter:this.filters.get(e)});return this.map.style.queryRenderedTargets(e,i,this.map.transform)}handleMove(e){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const t=this.queryTargets(e.point,Array.from(this.delegatedInteractions).reverse());t.length&&(e.type="mouseenter",this.handleType(e,t));const i=new Map;for(const[e,{feature:t}]of this.prevHoveredFeatures)this.hoveredFeatures.has(e)||i.set(t.id,t);i.size&&(e.type="mouseleave",this.handleType(e,Array.from(i.values())))}handleOut(e){const t=Array.from(this.hoveredFeatures.values()).map((({feature:e})=>e));t.length&&(e.type="mouseleave",this.handleType(e,t)),this.hoveredFeatures.clear()}handleType(t,i){const r=Array.from(this.interactionsByType.get(t.type)).reverse(),n=!!i;i=i||this.queryTargets(t.point,r);const o="mouseenter"===t.type;let s=!1;const a=new Set;for(const l of i){for(const[i,c]of r){if(!c.target)continue;const r=l.variants?l.variants[i]:null;if(r){for(const u of r){if(at(u,l,a,i))continue;const r=new e.cx(l,u),h=st(u,l,i);n&&(r.state=this.map.getFeatureState(r));const d=o?this.prevHoveredFeatures.get(h):null,p=new al(t,i,c,r),f=d?d.stop:c.handler(p);if(o&&this.hoveredFeatures.set(h,{feature:l,stop:f}),!1!==f){s=!0;break}}if(s)break}}if(s)break}if(!s)for(const[e,i]of r){const{handler:r,target:n}=i;if(!n&&!1!==r(new al(t,e,i,null)))break}}}function cl(t,i){if(Array.isArray(t)&&Array.isArray(i)){const e=new Set(t),r=new Set(i);return e.size===r.size&&t.every((e=>r.has(e)))}return e.bn(t,i)}const ul={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},hl={showCompass:!0,showZoom:!0,visualizePitch:!1};class dl{constructor(t,i,r=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new Ca({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,r&&(this.mousePitch=new Sa({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.aQ(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchmove",this.touchmove),i.addEventListener("touchend",this.touchend),i.addEventListener("touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),p()}move(e,t){const i=this.map,r=this.mouseRotate.mousemoveWindow(e,t),n=r&&r.bearingDelta;if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){const r=this.mousePitch.mousemoveWindow(e,t),n=r&&r.pitchDelta;n&&i.setPitch(i.getPitch()+n)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){f(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(e.l({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),g(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,g(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=_(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=_(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)r.width||i.y>r.height;r.locationPoint3D(n).distSqr(i)180;){const e=r.locationPoint3D(t);if(e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}const fl={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%)"},Al={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class ml extends e.E{constructor(t,i){super(),(t instanceof HTMLElement||i)&&(t=e.l({element:t},i)),e.aQ(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:r="center",color:n="#3FB1CE",scale:o=1,draggable:s=!1,clickTolerance:a=0,rotation:l=Al.rotation,rotationAlignment:c=Al.rotationAlignment,pitchAlignment:u=Al.pitchAlignment,occludedOpacity:h=Al.occludedOpacity,altitude:d=Al.altitude}=t||{};this._anchor=r,this._color=n,this._scale=o,this._draggable=s,this._clickTolerance=a,this._rotation=l,this._rotationAlignment=c,this._pitchAlignment=u,this._occludedOpacity=h,this._altitude=d,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=e.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()}));const p=this._element.classList;for(const e in fl)p.remove(`mapboxgl-marker-anchor-${e}`);p.add(`mapboxgl-marker-anchor-${this._anchor}`);const f=t&&t.className?t.className.trim().split(/\s+/):[];p.add(...f),this._popup=null}_createDefaultMarker(){const e=l("div"),t=c("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},e);if(0===this._altitude){const e=c("radialGradient",{id:"shadowGradient"},c("defs",{},t));c("stop",{offset:"10%","stop-opacity":.4},e),c("stop",{offset:"100%","stop-opacity":.05},e),c("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},t)}return c("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},t),c("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},t),c("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},t),e}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.bO.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(e){return e===this._altitude||(this._defaultMarker&&(0===this._altitude&&0!==e||0!==this._altitude&&0===e)&&(this._element=this._createDefaultMarker()),this._altitude=e||Al.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,r=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,e._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return!1;const i=e.unproject(t,this._altitude),r=e.getFreeCameraOptions();if(!r.position)return!1;const n=r.position.toLngLat();return n.distanceTo(i)<.9*n.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)return void this._clearFadeTimer();const r=t.unproject(i,this._altitude);let n;t._showingGlobe()&&e.dK(t.transform,this._lngLat)?n=0:(n=1-t._queryFogOpacity(r),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(n*=this._occludedOpacity)),this._element.style.opacity=`${n}`,this._element.style.pointerEvents=n>0?"auto":"none",this._popup&&this._popup._setOpacity(n),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n translate(${e.x}px,${e.y}px)\n ${fl[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `}_calculateXYTransform(){const t=this._pos,i=this._map,r=this.getPitchAlignment();if(!i||!t||"map"!==r)return"";if(!i._showingGlobe()){const e=i.getPitch();return e?`rotateX(${e}deg)`:""}const n=e.c4(e.dL(i.transform,this._lngLat)),o=t.sub(e.dM(i.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";const a=n/s;return`rotateX(${-o.y*a}deg) rotateY(${o.x*a}deg)`}_calculateZTransform(){const t=this._pos,i=this._map;if(!i||!t)return"";let r=0;const n=this.getRotationAlignment();if("map"===n)if(i._showingGlobe()){const t=i.project(new e.bO(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),n=i.project(new e.bO(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(t);r=e.c4(Math.atan2(n.y,n.x))-90}else r=-i.getBearing();else if("horizon"===n){const n=e.ae(4,6,i.getZoom()),o=e.dM(i.transform);o.y+=n*i.transform.height;const s=t.sub(o),a=e.c4(Math.atan2(s.y,s.x));r=(a>90?a-270:a+90)*(1-n)}return r+=this._rotation,r?`rotateZ(${r}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);const t=this._map;t&&(t.transform.renderWorldCopies&&(this._lngLat=pl(this._lngLat,this._pos,t.transform)),this._pos=t.project(this._lngLat,this._altitude),!0===e?this._updateFrameId=requestAnimationFrame((()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())})):this._pos=this._pos.round(),t._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(t._showingGlobe()||t.getTerrain()||t.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))})))}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(t){const i=this._map;if(!i)return;const r=this._pointerdownPos,n=this._positionDelta;if(r&&n){if(!this._isDragging){const e=this._clickTolerance||i._clickTolerance;if(t.point.dist(r)t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.dI(window)&&(t.antialias=!1,e.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Yi(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies,null,null),t),this._repaint=!!t.repaint,this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._collectResourceTiming=t.collectResourceTiming,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new nl,this._domRenderTaskQueue=new nl,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.aW(),this._locale=e.l({},sl,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._tessellationStep=t.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=t.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new ol(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=t.scaleFactor,this._requestManager=new w(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,this._contextCreateOptions=t.contextCreateOptions?Object.assign({},t.contextCreateOptions):{},"string"==typeof t.container){const e=document.getElementById(t.container);if(!e)throw new Error(`Container '${t.container.toString()}' not found.`);this._container=e}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(this._container.childNodes.length>0&&e.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._spriteFormat=t.spriteFormat,e.aQ(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new Us),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},(()=>{this._update()})),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},(()=>{this.setScaleFactor(this._scaleFactor)})),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");if(this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Ja(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,(t.style||!t.testMode)&&this.setStyle(t.style||e.e.DEFAULT_STYLE,{config:t.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),this.indoor=new dr(this),t.hash&&(this._hash=new ia("string"==typeof t.hash&&t.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==n.center&&null==n.zoom||(this.transform._unmodified=!1),this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch});const i=t.bounds;i&&(this.resize(),this.fitBounds(i,e.l({},t.fitBoundsOptions,{duration:0})))}this.resize(),t.attributionControl&&this.addControl(new il({customAttribution:t.customAttribution})),this._logoControl=new rl,this.addControl(this._logoControl,t.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.A(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.A(`${t.dataType}dataloading`,t))})),this._interactions=new ll(this)}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=t.onAdd(this);this._controls.push(t);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const i=!this._moving;return i&&this.fire(new e.A("movestart",t)).fire(new e.A("move",t)),this.fire(new e.A("resize",t)),i&&this.fire(new e.A("moveend",t)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.aB.convert(t)),this._update()}setMinZoom(t){if((t=t??-2)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.A("zoomstart")).fire(new e.A("zoom")).fire(new e.A("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=t??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.A("pitchstart")).fire(new e.A("pitch")).fire(new e.A("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(e){return this._scaleFactor=e,this.painter.scaleFactor=e,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers((e=>"symbol"===e.type)),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map((e=>"auto"===e?navigator.language:e)):e}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const e of this._controls)e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const t=this.transform,i=t.projection.name;let r;"globe"===i&&t.zoom>=e.bY?(t.setMercatorFromTransition(),r=!0):"mercator"===i&&t.zoom=e.bY?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),i&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(t,i){return this.transform.locationPoint3D(e.bO.convert(t),i)}unproject(t,i){return this.transform.pointLocation3D(e.P.convert(t),i)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,t,i){const r=e=>{let i=[];if(Array.isArray(t)){const r=t.filter((e=>this.getLayer(e)));i=r.length?this.queryRenderedFeatures(e,{layers:r}):[]}else i=this.queryRenderedFeatures(e,{target:t});return i};if("mouseenter"===e||"mouseover"===e){let n=!1;const o=t=>{const o=r(t.point);o.length?n||(n=!0,i.call(this,new da(e,this,t.originalEvent,{features:o}))):n=!1};return{listener:i,targets:t,delegates:{mousemove:o,mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1;const o=t=>{r(t.point).length?n=!0:n&&(n=!1,i.call(this,new da(e,this,t.originalEvent)))},s=t=>{n&&(n=!1,i.call(this,new da(e,this,t.originalEvent)))};return{listener:i,targets:t,delegates:{mousemove:o,mouseout:s}}}{const n=e=>{const t=r(e.point);t.length&&(e.features=t,i.call(this,e),delete e.features)};return{listener:i,targets:t,delegates:{[e]:n}}}}on(e,t,i){if("function"==typeof t||void 0===i)return super.on(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r);for(const e in r.delegates)this.on(e,r.delegates[e]);return this}once(e,t,i){if("function"==typeof t||void 0===i)return super.once(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._createDelegatedListener(e,t,i);for(const e in r.delegates)this.once(e,r.delegates[e]);return this}off(e,t,i){if("function"==typeof t||void 0===i)return super.off(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const r=this._delegatedListeners?this._delegatedListeners[e]:void 0;return r&&(e=>{for(let r=0;r{r?(e.w(`Unable to perform style diff: ${String(r.message||r.error||r)}. Rebuilding the style from scratch.`),this._updateStyle(t,i)):n&&this._update(!0)}),(()=>{this._postStyleLoadEvent()})),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(t,i))}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(t,i){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),t){const r=e.l({},i);i&&i.config&&(r.initialConfig=i.config,delete r.config),this.style=new br(this,r).load(t),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new br(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.w("There is no style added to the map."),!1)}_isValidId(t){return null==t?(this.fire(new e.z(new Error("IDs can't be empty."))),!1):!e.cs(t)||(this.fire(new e.z(new Error(`IDs can't contain special symbols: "${t}".`))),!1)}_isTargetValid(e){return"featuresetId"in e?this._isValidId("importId"in e?e.importId:e.featuresetId):"layerId"in e&&this._isValidId(e.layerId)}_areTargetsValid(e){if(Array.isArray(e)){for(const t of e)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(e)}addSource(e,t){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(t,i,{pixelRatio:r=1,sdf:n=!1,stretchX:o,stretchY:s,content:a}={}){this._lazyInitEmptyStyle();const l=e.I.from(t);if(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap){const{width:t,height:c,data:u}=e.q.getImageData(i);this.style.addImage(l,this.style.scope,{data:new e.r({width:t,height:c},u),pixelRatio:r,stretchX:o,stretchY:s,content:a,sdf:n,version:0,usvg:!1})}else if(void 0===i.width||void 0===i.height)this.fire(new e.z(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`")));else{const{width:c,height:u}=i,h=i;this.style.addImage(l,this.style.scope,{data:new e.r({width:c,height:u},new Uint8Array(h.data)),pixelRatio:r,stretchX:o,stretchY:s,content:a,sdf:n,usvg:!1,version:0,userImage:h}),h.onAdd&&h.onAdd(this,t)}}updateImage(t,i){this._lazyInitEmptyStyle();const r=e.I.from(t),n=this.style.getImage(r,this.style.scope);if(!n)return void this.fire(new e.z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap?e.q.getImageData(i):i,{width:s,height:a,data:l}=o;if(void 0===s||void 0===a)return void this.fire(new e.z(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(s!==(n.usvg?n.icon.usvg_tree.width:n.data.width)||a!==(n.usvg?n.icon.usvg_tree.height:n.data.height))return void this.fire(new e.z(new Error(`The width and height of the updated image (${s}, ${a})\n must be that same as the previous version of the image\n (${n.data.width}, ${n.data.height})`)));const c=!(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap);let u=!1;n.usvg?(n.data=new e.r({width:s,height:a},new Uint8Array(l)),n.usvg=!1,n.icon=void 0,u=!0):n.data.replace(l,c),this.style.updateImage(r,this.style.scope,n,u)}hasImage(t){return t?!!this.style&&!!this.style.getImage(e.I.from(t),this.style.scope):(this.fire(new e.z(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(e.I.from(t),this.style.scope)}loadImage(t,i){e.o(this._requestManager.transformRequest(t,e.R.Image),((t,r)=>{i(t,r instanceof HTMLImageElement?e.q.getImageData(r):r)}))}listImages(){return this.style.listImages().map((e=>e.name))}addModel(e,t){this._lazyInitEmptyStyle(),this.style.addModel(e,t)}hasModel(t){return t?this.style.hasModel(t):(this.fire(new e.z(new Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,t){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)):this}getSlot(e){const t=this.getLayer(e);return t&&t.slot||null}setSlot(e,t){return this.style.setSlot(e,t),this.style.mergeLayers(),this._update(!0)}addImport(e,t){return this.style.addImport(e,t),this}updateImport(e,t){return"string"!=typeof t&&t.id!==e?(this.removeImport(e),this.addImport(t)):(this.style.updateImport(e,t),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,t){return this.style.moveImport(e,t),this._update(!0)}moveLayer(e,t){return this._isValidId(e)?(this.style.moveLayer(e,t),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){if(!this._isValidId(e))return null;const t=this.style.getOwnLayer(e);return t?"custom"===t.type?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(e,t,i){return this._isValidId(e)?(this.style.setLayerZoomRange(e,t,i),this._update(!0)):this}setFilter(e,t,i={}){return this._isValidId(e)?(this.style.setFilter(e,t,i),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setPaintProperty(e,t,i,r),this._update(!0)):this}getPaintProperty(e,t){return this._isValidId(e)?this.style.getPaintProperty(e,t):null}setLayoutProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,t,i,r),this._update(!0)):this}getLayoutProperty(e,t){return this._isValidId(e)?this.style.getLayoutProperty(e,t):null}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(e){return this.style.setGlyphsUrl(e),this._update(!0)}getSchema(e){return this.style.getSchema(e)}setSchema(e,t){return this.style.setSchema(e,t),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,t){return this.style.setConfig(e,t),this._update(!0)}getConfigProperty(e,t){return this.style.getConfigProperty(e,t)}setConfigProperty(e,t,i){return this.style.setConfigProperty(e,t,i),this._update(!0)}getFeaturesetDescriptors(e){return this.style.getFeaturesetDescriptors(e)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){const t=e[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(e){return this._lazyInitEmptyStyle(),this.style.setSnow(e),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(e){return this._lazyInitEmptyStyle(),this.style.setRain(e),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),this._update(!0)}setImportColorTheme(e,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(e,t),this._update(!0)}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.bO.convert(t),this.transform):0}setFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.setFeatureState(e,t),this._update())}removeFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.removeFeatureState(e,t),this._update())}getFeatureState(e){return e.source&&!this._isValidId(e.source)?null:this.style.getFeatureState(e)}_updateContainerDimensions(){if(!this._container)return;const e=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let i,r,n,o=this._container;for(;o&&(!r||!n);){const e=window.getComputedStyle(o).transform;e&&"none"!==e&&(i=e.match(/matrix.*\((.+)\)/)[1].split(", "),i[0]&&"0"!==i[0]&&"1"!==i[0]&&(r=i[0]),i[3]&&"0"!==i[3]&&"1"!==i[3]&&(n=i[3])),o=o.parentElement}this._containerWidth=r?Math.abs(e/r):e,this._containerHeight=n?Math.abs(t/n):t}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=l("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=l("div","mapboxgl-canvas-container",e);this._canvas=l("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=l("div","mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach((e=>{r[e]=l("div",`mapboxgl-ctrl-${e}`,i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i){const r=e.q.devicePixelRatio||1;this._canvas.width=r*Math.ceil(t),this._canvas.height=r*Math.ceil(i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const t=e.l({},a.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl2",t);i?(Q(i,!0),this.painter=new ea(i,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp),this.on("data",(e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)})),e.m.testSupport(i)):this.fire(new e.z(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.A("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style.reloadModels(),this.style.clearSources(),this._update(),this.fire(new e.A("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(t){let n;this.fire(new e.A("renderstart")),++this._frameId;const o=this.painter.context.extTimerQuery,s=e.q.now(),a=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(n=a.createQuery(),a.beginQuery(o.TIME_ELAPSED_EXT,n)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();const l=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=this.transform.pitch,r=e.q.now(),n=new e.aa(t,{now:r,fadeDuration:l,pitch:i,transition:this.style.transition});this.style.update(n)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let c=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),c=this._updateAverageElevation(s),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):c=this._updateAverageElevation(s);const u=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),u&&(this._placementDirty=u.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,r.mark(i.load),this.fire(new e.A("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),n){const t=e.q.now()-s;a.endQuery(o.TIME_ELAPSED_EXT),setTimeout((()=>{const i=a.getQueryParameter(n,a.QUERY_RESULT)/1e6;a.deleteQuery(n),this.fire(new e.A("gpu-timing-frame",{cpuTime:t,gpuTime:i}))}),50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(t);this.fire(new e.A("gpu-timing-layer",{layerTimes:i}))}),50)}if(this.listens("gpu-timing-deferred-render")){const t=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const i=this.painter.queryGpuTimeDeferredRender(t);this.fire(new e.A("gpu-timing-deferred-render",{gpuTime:i}))}),50)}const h=this._sourcesDirty||this._styleDirty||this._placementDirty||c;if(h||this._repaint)this.triggerRepaint();else{const t=this.idle();if(t&&(c=this._updateAverageElevation(s,!0)),c)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.A("speedindexcompleted",{speedIndex:t})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0,r.mark(i.fullLoad),this._performanceMetricsCollection&&D(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const i=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);const r=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(r||(t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let n=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;const o=Math.abs(t-n);if(o>1){if(this._isInitialLoad||r)return this._averageElevation.jumpTo(n),i(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),i(n)}return!!this._averageElevation.isEasing(e)&&i(this._averageElevation.getValue(e))}_authenticate(){U(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(t=>{if(t&&(t.message===b||401===t.status)){const t=this.painter.context.gl;Q(t,!1),this._logoControl instanceof rl&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.z(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),F(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_postStyleLoadEvent(){this.style.globalId&&z(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const i=this.painter.context.gl,r=i.createFramebuffer();function n(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);const t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,r),this._canvasPixelComparison(n(e),t.canvasCopies.map(n),t.timeStamps)}_canvasPixelComparison(e,t,i){let r=i[1]-i[0];const n=e.length/4;for(let o=0;o{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)})))}_preloadTiles(t){const i=this.style?this.style.getSourceCaches():[];return e.bl(i,((e,i)=>e._preloadTiles(t,i)),(()=>{this.triggerRepaint()})),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,this._tp.refreshUI(),e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,this._tp.refreshUI(),e&&this._update())}_setCacheLimits(t,i){e.dJ(t,i)}get version(){return t}},NavigationControl:class{constructor(t={}){this.options=e.l({},hl,t),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(e.aQ(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(e=>{this._map&&this._map.zoomIn({},{originalEvent:e})})),l("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(e=>{this._map&&this._map.zoomOut({},{originalEvent:e})})),l("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.aQ(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))})),this._compassIcon=l("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),i=t===e.getMaxZoom(),r=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=t)}))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new dl(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const i=l("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends e.E{constructor(t={}){super();const i=navigator.geolocation;this.options=e.l({geolocation:i},gl,t),e.aQ(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=ta(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){const t=(t=!!this.options.geolocation)=>{this._supportsGeolocation=t,e(t)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then((e=>t("denied"!==e.state))).catch((()=>t())):t()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitudet.getEast()||i.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.A("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.A("geolocate",t)),this._finish()}}_updateCamera(t){const i=new e.bO(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,n=this._map.getBearing(),o=e.l({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(r),o,{geolocateSource:!0})}_updateMarker(t){if(t){const i=new e.bO(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map.transform,i=e.bH(1,t._center.lat)*t.worldSize,r=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${r}px`,this._circleElement.style.height=`${r}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.A("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=l("button","mapboxgl-ctrl-geolocate",this._container),l("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=l("div","mapboxgl-user-location"),this._dotElement.appendChild(l("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(l("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new ml({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=l("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ml({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",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.A("trackuserlocationend")))}))}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const e=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};"undefined"!=typeof DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((t=>{"granted"===t&&e()})).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:il,ScaleControl:class{constructor(t={}){this.options=e.l({},_l,t),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.aQ(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,r=t._containerWidth/2-e/2,n=t.unproject([r,i]),o=t.unproject([r+e,i]),s=n.distanceTo(o);if("imperial"===this.options.unit){const t=3.2808*s;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,s/1852,"nautical-mile"):s>=1e3?this._setScale(e,s/1e3,"kilometer"):this._setScale(e,s,"meter")}_setScale(e,t,i){this._map._requestDomTask((()=>{const r=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(t),n=r/t;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==i?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:i}).format(r):`${r} ${yl[i]}`,this._container.style.width=e*n+"px"}))}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(t={}){this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w("Full screen control 'container' must be a DOM element.")),e.aQ(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=l("button","mapboxgl-ctrl-fullscreen",this._controlContainer);l("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.E{constructor(t){super(),this.options=e.l(Object.create(vl),t),this._altitude=this.options.altitude,e.aQ(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[])}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.A("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.A("close")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.bO.convert(t),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(e){return this._altitude=e,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=l("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=l("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.innerHTML='',e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,r=this._pos;if(!t||!i||!r)return"bottom";const n=i.offsetWidth,o=i.offsetHeight,s=r.xt.transform.width-n/2;if(r.y+et.transform.height-o){if(s)return"bottom-left";if(a)return"bottom-right"}return s?"left":a?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(t){const i=this._map,r=this._content;if(!i||!this._lngLat&&!this._trackPointer||!r)return;let n=this._container;if(n||(n=this._container=l("div","mapboxgl-popup",i.getContainer()),this._tip=l("div","mapboxgl-popup-tip",n),n.appendChild(r)),this.options.maxWidth&&n.style.maxWidth!==this.options.maxWidth&&(n.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=pl(this._lngLat,this._pos,i.transform)),!this._trackPointer||t){const r=this._pos=this._trackPointer&&t instanceof e.P?t:i.project(this._lngLat,this._altitude),n=bl(this.options.offset),o=this._anchor=this._getAnchor(n.y),s=bl(this.options.offset,o),a=r.add(s).round();i._requestDomTask((()=>{this._container&&o&&(this._container.style.transform=`${fl[o]} translate(${a.x}px,${a.y}px)`)}))}if(!this._marker&&i._showingGlobe()){const t=e.dK(i.transform,this._lngLat)?0:1;this._setOpacity(t)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(xl);e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:ml,Style:br,LngLat:e.bO,LngLatBounds:e.aB,Point:e.P,MercatorCoordinate:e.ac,FreeCameraOptions:Zi,Evented:e.E,config:e.e,prewarm:e.dP,clearPrewarmedResources:e.dQ,get accessToken(){return e.e.ACCESS_TOKEN},set accessToken(t){e.e.ACCESS_TOKEN=t},get baseApiUrl(){return e.e.API_URL},set baseApiUrl(t){e.e.API_URL=t},get workerCount(){return e.dR.workerCount},set workerCount(t){e.dR.workerCount=t},get maxParallelImageRequests(){return e.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.e.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.dS(t)},get workerUrl(){return e.dT.workerUrl},set workerUrl(t){e.dT.workerUrl=t},get workerClass(){return e.dT.workerClass},set workerClass(t){e.dT.workerClass=t},get workerParams(){return e.dT.workerParams},set workerParams(t){e.dT.workerParams=t},get dracoUrl(){return e.dU()},set dracoUrl(t){e.dV(t)},get meshoptUrl(){return e.dW()},set meshoptUrl(t){e.dX(t)},setNow:e.q.setNow,restoreNow:e.q.restoreNow};return wl}));var n=i;return n}();var xe=_e(ve.exports),be=e({__proto__:null,default:xe},[ve.exports]),we={exports:{}};we.exports=function(){var e={},t={};function i(i,r,n){if(t[i]=n,"index"===i){var o="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",s={};return t.shared(s),t.index(e,s),"undefined"!=typeof window&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),e}}return i("shared",["exports"],(function(e){function t(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,n;function o(){if(n)return r;function e(e,t){this.x=e,this.y=t}return n=1,r=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},r}"function"==typeof SuppressedError&&SuppressedError;var s,a,l=i(o()),c=function(){if(a)return s;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return a=1,s=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},s}(),u=i(c);let h,d;function p(){return null==h&&(h="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),h}function f(){if(null==d&&(d=!1,p())){const e=5,t=new OffscreenCanvas(e,e).getContext("2d",{willReadFrequently:!0});if(t){for(let i=0;i=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function F(e,t,i,r){const n=new u(e,t,i,r);return e=>n.solve(e)}const k=F(.25,.1,.25,1);function z(e,t,i){return Math.min(i,Math.max(t,e))}function R(e,t,i){const r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function D(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let O=1;function U(e,t,i){const r={};for(const i in e)r[i]=t.call(this,e[i],i,e);return r}function N(e,t,i){const r={};for(const i in e)t.call(this,e[i],i,e)&&(r[i]=e[i]);return r}function Q(e){return Array.isArray(e)?e.map(Q):"object"==typeof e&&e?U(e,Q):e}const j={};function V(e){j[e]||("undefined"!=typeof console&&console.warn(e),j[e]=!0)}function H(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function G(e){return"undefined"!=typeof WorkerGlobalScope&&void 0!==e&&e instanceof WorkerGlobalScope}let $=null;function Z(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}const q="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function K(e,i,r,n,o){return t(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const t=new VideoFrame(e,{timestamp:0});try{const s=null==t?void 0:t.format;if(!s||!s.startsWith("BGR")&&!s.startsWith("RGB"))throw new Error(`Unrecognized format ${s}`);const a=s.startsWith("BGR"),l=new Uint8ClampedArray(n*o*4);if(yield t.copyTo(l,function(e,t,i,r,n){const o=4*Math.max(1,0),s=(Math.max(0,i)-i)*r*4+o,a=4*r,l=Math.max(0,t),c=Math.max(0,i);return{rect:{x:l,y:c,width:Math.min(e.width,t+r)-l,height:Math.min(e.height,i+n)-c},layout:[{offset:s,stride:a}]}}(e,i,r,n,o)),a)for(let e=0;e{e.removeEventListener(t,i,r)}}}function J(e){return e/Math.PI*180}const ee={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},te={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},ie="AbortError";function re(){return new Error(ie)}const ne={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function oe(e){return ne.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const se="global-dispatcher";class ae extends Error{constructor(e,t,i,r){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=r}}const le=()=>G(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,ce=function(e,i){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){const t=oe(e.url);if(t)return t(e,i);if(G(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:se},i)}if(!(/^file:/.test(r=e.url)||/^file:/.test(le())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(e,i){return t(this,void 0,void 0,(function*(){const t=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:le(),signal:i.signal});let r,n;"json"!==e.type||t.headers.has("Accept")||t.headers.set("Accept","application/json");try{r=yield fetch(t)}catch(t){throw new ae(0,t.message,e.url,new Blob)}if(!r.ok){const t=yield r.blob();throw new ae(r.status,r.statusText,e.url,t)}n="arrayBuffer"===e.type||"image"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text();const o=yield n;if(i.signal.aborted)throw re();return{data:o,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}))}(e,i);if(G(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:se},i)}var r;return function(e,t){return new Promise(((i,r)=>{var n;const o=new XMLHttpRequest;o.open(e.method||"GET",e.url,!0),"arrayBuffer"!==e.type&&"image"!==e.type||(o.responseType="arraybuffer");for(const t in e.headers)o.setRequestHeader(t,e.headers[t]);"json"===e.type&&(o.responseType="text",(null===(n=e.headers)||void 0===n?void 0:n.Accept)||o.setRequestHeader("Accept","application/json")),o.withCredentials="include"===e.credentials,o.onerror=()=>{r(new Error(o.statusText))},o.onload=()=>{if(!t.signal.aborted)if((o.status>=200&&o.status<300||0===o.status)&&null!==o.response){let t=o.response;if("json"===e.type)try{t=JSON.parse(o.response)}catch(e){return void r(e)}i({data:t,cacheControl:o.getResponseHeader("Cache-Control"),expires:o.getResponseHeader("Expires")})}else{const t=new Blob([o.response],{type:o.getResponseHeader("Content-Type")});r(new ae(o.status,o.statusText,e.url,t))}},t.signal.addEventListener("abort",(()=>{o.abort(),r(re())})),o.send(e.body)}))}(e,i)};function ue(e){if(!e||e.indexOf("://")<=0||0===e.indexOf("data:image/")||0===e.indexOf("blob:"))return!0;const t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function he(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function de(e,t,i){if(i&&i[e]){const r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class pe{constructor(e,t={}){D(this,t),this.type=e}}class fe extends pe{constructor(e,t={}){super("error",D({error:e},t))}}class Ae{on(e,t){return this._listeners=this._listeners||{},he(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return de(e,t,this._listeners),de(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},he(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){"string"==typeof e&&(e=new pe(e,t||{}));const i=e.type;if(this.listens(i)){e.target=this;const t=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of t)i.call(this,e);const r=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const t of r)de(i,t,this._oneTimeListeners),t.call(this,e);const n=this._eventedParent;n&&(D(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(e))}else e instanceof fe&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var me={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_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 ge=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function _e(e,t){const i={};for(const t in e)"ref"!==t&&(i[t]=e[t]);return ge.forEach((e=>{e in t&&(i[e]=t[e])})),i}function ye(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Ze=[Le,Fe,ke,ze,Re,De,Qe,Oe,Ge(Ue),je,Ve,He];function qe(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!qe(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Ze)if(!qe(e,t))return null}return`Expected ${$e(e)} but found ${$e(t)} instead.`}function Ke(e,t){return t.some((t=>t.kind===e.kind))}function We(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}function Xe(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const Ye=.96422,Je=.82521,et=4/29,tt=6/29,it=3*tt*tt,rt=tt*tt*tt,nt=Math.PI/180,ot=180/Math.PI;function st(e){return(e%=360)<0&&(e+=360),e}function at([e,t,i,r]){let n,o;const s=ct((.2225045*(e=lt(e))+.7168786*(t=lt(t))+.0606169*(i=lt(i)))/1);e===t&&t===i?n=o=s:(n=ct((.4360747*e+.3850649*t+.1430804*i)/Ye),o=ct((.0139322*e+.0971045*t+.7141733*i)/Je));const a=116*s-16;return[a<0?0:a,500*(n-s),200*(s-o),r]}function lt(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ct(e){return e>rt?Math.pow(e,1/3):e/it+et}function ut([e,t,i,r]){let n=(e+16)/116,o=isNaN(t)?n:n+t/500,s=isNaN(i)?n:n-i/200;return n=1*dt(n),o=Ye*dt(o),s=Je*dt(s),[ht(3.1338561*o-1.6168667*n-.4906146*s),ht(-.9787684*o+1.9161415*n+.033454*s),ht(.0719453*o-.2289914*n+1.4052427*s),r]}function ht(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function dt(e){return e>tt?e*e*e:it*(e-et)}function pt(e){return parseInt(e.padEnd(2,e),16)/255}function ft(e,t){return At(t?e/100:e,0,1)}function At(e,t,i){return Math.min(Math.max(t,e),i)}function mt(e){return!e.some(Number.isNaN)}const gt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function _t(e,t,i){return e+i*(t-e)}function yt(e,t,i){return e.map(((e,r)=>_t(e,t[r],i)))}class vt{constructor(e,t,i,r=1,n=!0){this.r=e,this.g=t,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,i,r]))}static parse(e){if(e instanceof vt)return e;if("string"!=typeof e)return;const t=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=gt[e];if(t){const[e,i,r]=t;return[e/255,i/255,r/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let i=1;return[pt(e.slice(i,i+=t)),pt(e.slice(i,i+=t)),pt(e.slice(i,i+=t)),pt(e.slice(i,i+t)||"ff")]}if(e.startsWith("rgb")){const t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[e,i,r,n,o,s,a,l,c,u,h,d]=t,p=[n||" ",a||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[r,s,c].join(""),t="%%%"===e?100:""===e?255:0;if(t){const e=[At(+i/t,0,1),At(+o/t,0,1),At(+l/t,0,1),h?ft(+h,d):1];if(mt(e))return e}}return}}const i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[e,t,r,n,o,s,a,l,c]=i,u=[r||" ",o||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,At(+n,0,100),At(+s,0,100),l?ft(+l,c):1];if(mt(e))return function([e,t,i,r]){function n(r){const n=(r+e/30)%12,o=t*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return e=st(e),t/=100,i/=100,[n(0),n(8),n(4),r]}(e)}}}(e);return t?new vt(...t,!1):void 0}get rgb(){const{r:e,g:t,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[e/n,t/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,i,r,n]=at(e),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?st(Math.atan2(r,i)*ot):NaN,o,t,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",at(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,r]=this.rgb;return`rgba(${[e,t,i].map((e=>Math.round(255*e))).join(",")},${r})`}static interpolate(e,t,i,r="rgb"){switch(r){case"rgb":{const[r,n,o,s]=yt(e.rgb,t.rgb,i);return new vt(r,n,o,s,!1)}case"hcl":{const[r,n,o,s]=e.hcl,[a,l,c,u]=t.hcl;let h,d;if(isNaN(r)||isNaN(a))isNaN(r)?isNaN(a)?h=NaN:(h=a,1!==o&&0!==o||(d=l)):(h=r,1!==c&&0!==c||(d=n));else{let e=a-r;a>r&&e>180?e-=360:a180&&(e+=360),h=r+i*e}const[p,f,A,m]=function([e,t,i,r]){return e=isNaN(e)?0:e*nt,ut([i,Math.cos(e)*t,Math.sin(e)*t,r])}([h,null!=d?d:_t(n,l,i),_t(o,c,i),_t(s,u,i)]);return new vt(p,f,A,m,!1)}case"lab":{const[r,n,o,s]=ut(yt(e.lab,t.lab,i));return new vt(r,n,o,s,!1)}}}}vt.black=new vt(0,0,0,1),vt.white=new vt(1,1,1,1),vt.transparent=new vt(0,0,0,0),vt.red=new vt(1,0,0,1);class xt{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const bt=["bottom","center","top"];class wt{constructor(e,t,i,r,n,o){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=o}}class Tt{constructor(e){this.sections=e}static fromString(e){return new Tt([new wt(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof Tt?e:Tt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}}class Bt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Bt)return e;if("number"==typeof e)return new Bt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Bt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new Bt(yt(e.values,t.values,i))}}class Ct{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const St=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Et{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Et)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Lt(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof It||e instanceof vt||e instanceof xt||e instanceof Tt||e instanceof Bt||e instanceof Et||e instanceof Mt)return!0;if(Array.isArray(e)){for(const t of e)if(!Lt(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Lt(e[t]))return!1;return!0}return!1}function Ft(e){if(null===e)return Le;if("string"==typeof e)return ke;if("boolean"==typeof e)return ze;if("number"==typeof e)return Fe;if(e instanceof vt)return Re;if(e instanceof It)return De;if(e instanceof xt)return Ne;if(e instanceof Tt)return Qe;if(e instanceof Bt)return je;if(e instanceof Et)return He;if(e instanceof Mt)return Ve;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=Ft(t);if(i){if(i===e)continue;i=Ue;break}i=e}return Ge(i||Ue,t)}return Oe}function kt(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof vt||e instanceof It||e instanceof Tt||e instanceof Bt||e instanceof Et||e instanceof Mt?e.toString():JSON.stringify(e)}class zt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Lt(e[1]))return t.error("invalid value");const i=e[1];let r=Ft(i);const n=t.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new zt(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Rt={string:ke,number:Fe,boolean:ze,object:Oe};class Dt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in Rt)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=Rt[i],r++}else n=Ue;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],r++}i=Ge(n,o)}else{if(!Rt[n])throw new Error(`Types doesn't contain name = ${n}`);i=Rt[n]}const o=[];for(;re.outputDefined()))}}const Ot={"to-boolean":ze,"to-color":Re,"to-number":Fe,"to-string":ke};class Ut{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(!Ot[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!==e.length)return t.error("Expected one argument.");const r=Ot[i],n=[];for(let i=1;i4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Pt(t[0],t[1],t[2],t[3]),!i))return new vt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Ct(i||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const r=Bt.parse(t);if(r)return r}throw new Ct(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const r=Et.parse(t);if(r)return r}throw new Ct(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new Ct(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Tt.fromString(kt(this.args[0].evaluate(e)));case"resolvedImage":return Mt.fromString(kt(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return kt(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Nt=["Unknown","Point","LineString","Polygon"];class Qt{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?Nt[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(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=vt.parse(e)),t}}class jt{constructor(e,t,i=[],r,n=new Pe,o=[]){this.registry=e,this.path=i,this.key=i.map((e=>`[${e}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=t}parse(e,t,i,r,n={}){return t?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}_parse(e,t){function i(e,t,i){return"assert"===i?new Dt(t,[e]):"coerce"===i?new Ut(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind)if("projectionDefinition"!==e.kind||"string"!==n.kind&&"array"!==n.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==e.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind)if("variableAnchorOffsetCollection"!==e.kind||"value"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof zt)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const t=new Qt;try{r=new zt(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const r="number"==typeof e?this.path.concat(e):this.path,n=i?this.scope.concat(i):this.scope;return new jt(this.registry,this._isConstant,r,t||null,n,this.errors)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new Ie(i,e))}checkSubtype(e,t){const i=qe(e,t);return i&&this.error(i),i}}class Vt{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let r=1;r=i.length)throw new Ct(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new Ct(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class $t{constructor(e,t){this.type=ze,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Ue),r=t.parse(e[2],2,Ue);return i&&r?Ke(i.type,[ze,ke,Fe,Le,Ue])?new $t(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${$e(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!We(t,["boolean","string","number","null"]))throw new Ct(`Expected first argument to be of type boolean, string, number or null, but found ${$e(Ft(t))} instead.`);if(!We(i,["string","array"]))throw new Ct(`Expected second argument to be of type array or string, but found ${$e(Ft(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Zt{constructor(e,t,i){this.type=Fe,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Ue),r=t.parse(e[2],2,Ue);if(!i||!r)return null;if(!Ke(i.type,[ze,ke,Fe,Le,Ue]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${$e(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Fe);return n?new Zt(i,r,n):null}return new Zt(i,r)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!We(t,["boolean","string","number","null"]))throw new Ct(`Expected first argument to be of type boolean, string, number or null, but found ${$e(Ft(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),We(i,["string"])){const e=i.indexOf(t,r);return-1===e?-1:[...i.slice(0,e)].length}if(We(i,["array"]))return i.indexOf(t,r);throw new Ct(`Expected second argument to be of type array or string, but found ${$e(Ft(i))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class qt{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let s=2;sNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Ft(e)))return null}else i=Ft(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(l,s,r);if(!u)return null;r=r||u.type,o.push(u)}const s=t.parse(e[1],1,Ue);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,r);return a?"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new qt(i,r,s,n,o,a):null}evaluate(e){const t=this.input.evaluate(e);return(Ft(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Kt{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const r=[];for(let n=1;nt.outputDefined()))&&this.otherwise.outputDefined()}}class Wt{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Ue),r=t.parse(e[2],2,Fe);if(!i||!r)return null;if(!Ke(i.type,[Ge(Ue),ke,Ue]))return t.error(`Expected first argument to be of type array or string, but found ${$e(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Fe);return n?new Wt(i.type,i,r,n):null}return new Wt(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),We(t,["string"]))return[...t].slice(i,r).join("");if(We(t,["array"]))return t.slice(i,r);throw new Ct(`Expected first argument to be of type array or string, but found ${$e(Ft(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Xt(e,t){const i=e.length-1;let r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=e[a],n=e[a+1],r<=t){if(a===i||tt))throw new Ct("Input is not a number.");s=a-1}return 0}class Yt{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,Fe);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new Yt(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[Xt(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Jt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ei,ti,ii=function(){if(ti)return ei;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return ti=1,ei=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},ei}(),ri=Jt(ii);class ni{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=oi(t,e.base,i,r);else if("linear"===e.name)n=oi(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new ri(o[0],o[1],o[2],o[3]).solve(oi(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,Fe),!n)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=Re:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(r,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return Xe(a,Fe)||Xe(a,De)||Xe(a,Re)||Xe(a,je)||Xe(a,He)||Xe(a,Ge(Fe))?new ni(a,i,r,n,s):t.error(`Type ${$e(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=Xt(t,r),s=ni.interpolationFactor(this.interpolation,r,t[o],t[o+1]),a=i[o].evaluate(e),l=i[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return _t(a,l,s);case"color":return vt.interpolate(a,l,s);case"padding":return Bt.interpolate(a,l,s);case"variableAnchorOffsetCollection":return Et.interpolate(a,l,s);case"array":return yt(a,l,s);case"projectionDefinition":return It.interpolate(a,l,s)}case"interpolate-hcl":return vt.interpolate(a,l,s,"hcl");case"interpolate-lab":return vt.interpolate(a,l,s,"lab")}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function oi(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}const si={color:vt.interpolate,number:_t,padding:Bt.interpolate,variableAnchorOffsetCollection:Et.interpolate,array:yt};class ai{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of e.slice(1)){const e=t.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}if(!i)throw new Error("No output type");const o=r&&n.some((e=>qe(r,e.type)));return new ai(o?Ue:i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(e),i&&i instanceof Mt&&!i.available&&(t||(t=i.name),i=null,r===this.args.length&&(i=t)),null!==i)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function li(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function ci(e,t,i,r){return 0===r.compare(t,i)}function ui(e,t,i){const r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=ze,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,Ue);if(!o)return null;if(!li(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${$e(o.type)}'.`);let s=t.parse(e[2],2,Ue);if(!s)return null;if(!li(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${$e(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${$e(o.type)}' and '${$e(s.type)}'.`);r&&("value"===o.type.kind&&"value"!==s.type.kind?o=new Dt(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new Dt(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,Ne),!a)return null}return new n(o,s,a)}evaluate(n){const o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=Ft(o),i=Ft(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Ct(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=Ft(o),i=Ft(s);if("string"!==e.kind||"string"!==i.kind)return t(n,o,s)}return this.collator?i(n,o,s,this.collator.evaluate(n)):t(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const hi=ui("==",(function(e,t,i){return t===i}),ci),di=ui("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!ci(0,t,i,r)})),pi=ui("<",(function(e,t,i){return t",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),Ai=ui("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),mi=ui(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0}));class gi{constructor(e,t,i){this.type=Ne,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");const r=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,ze);if(!r)return null;const n=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,ze);if(!n)return null;let o=null;return i.locale&&(o=t.parse(i.locale,1,ke),!o)?null:new gi(r,n,o)}evaluate(e){return new xt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class _i{constructor(e,t,i,r,n){this.type=ke,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Fe);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parse(r.locale,1,ke),!n))return null;let o=null;if(r.currency&&(o=t.parse(r.currency,1,ke),!o))return null;let s=null;if(r["min-fraction-digits"]&&(s=t.parse(r["min-fraction-digits"],1,Fe),!s))return null;let a=null;return r["max-fraction-digits"]&&(a=t.parse(r["max-fraction-digits"],1,Fe),!a)?null:new _i(i,n,o,s,a)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class yi{constructor(e){this.type=Qe,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,Fe),!e))return null;let i=null;if(o["text-font"]&&(i=t.parse(o["text-font"],1,Ge(ke)),!i))return null;let s=null;if(o["text-color"]&&(s=t.parse(o["text-color"],1,Re),!s))return null;let a=null;if(o["vertical-align"]){if("string"==typeof o["vertical-align"]&&!bt.includes(o["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(a=t.parse(o["vertical-align"],1,ke),!a)return null}const l=r[r.length-1];l.scale=e,l.font=i,l.textColor=s,l.verticalAlign=a}else{const o=t.parse(e[i],1,Ue);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null,verticalAlign:null})}}return new yi(r)}evaluate(e){return new Tt(this.sections.map((t=>{const i=t.content.evaluate(e);return Ft(i)===Ve?new wt("",i,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new wt(kt(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class vi{constructor(e){this.type=Ve,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ke);return i?new vi(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=Mt.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class xi{constructor(e){this.type=Fe,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${$e(i.type)} instead.`):new xi(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new Ct(`Expected value to be of type string or array, but found ${$e(Ft(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const bi=8192;function wi(e,t){const i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*bi),Math.round(r*n*bi)]}function Ti(e,t){const i=Math.pow(2,t.z);return[(n=(e[0]/bi+t.x)/i,360*n-180),(r=(e[1]/bi+t.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function Bi(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Ci(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Si(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],s=e[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function Ei(e,t,i,r){return 0!=(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!ki(e,t,i,r)||!ki(i,r,e,t));var n,o}function Mi(e,t,i){for(const r of i)for(let i=0;i(n=e)[1]!=(s=a[t+1])[1]>n[1]&&n[0]<(s[0]-o[0])*(n[1]-o[1])/(s[1]-o[1])+o[0]&&(r=!r)}var n,o,s;return r}function Pi(e,t){for(const i of t)if(Ii(e,i))return!0;return!1}function Li(e,t){for(const i of e)if(!Ii(i,t))return!1;for(let i=0;i0&&a<0||s<0&&a>0}function zi(e,t,i){const r=[];for(let n=0;ni[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}Bi(t,e)}function Oi(e,t,i,r){const n=Math.pow(2,r.z)*bi,o=[r.x*bi,r.y*bi],s=[];for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];Di(r,t,i,n),s.push(r)}return s}function Ui(e,t,i,r){const n=Math.pow(2,r.z)*bi,o=[r.x*bi,r.y*bi],s=[];for(const i of e){const e=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];Bi(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=n/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of s)for(const r of e)Di(r,t,i,n)}var a;return s}class Ni{constructor(e,t){this.type=ze,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Lt(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const i of t.features){const{type:t,coordinates:r}=i.geometry;"Polygon"===t&&e.push(r),"MultiPolygon"===t&&e.push(...r)}if(e.length)return new Ni(t,{type:"MultiPolygon",coordinates:e})}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Ni(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Ni(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=zi(t.coordinates,r,n),s=Oi(e.geometry(),i,r,n);if(!Ci(i,r))return!1;for(const e of s)if(!Ii(e,o))return!1}if("MultiPolygon"===t.type){const o=Ri(t.coordinates,r,n),s=Oi(e.geometry(),i,r,n);if(!Ci(i,r))return!1;for(const e of s)if(!Pi(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=zi(t.coordinates,r,n),s=Ui(e.geometry(),i,r,n);if(!Ci(i,r))return!1;for(const e of s)if(!Li(e,o))return!1}if("MultiPolygon"===t.type){const o=Ri(t.coordinates,r,n),s=Ui(e.geometry(),i,r,n);if(!Ci(i,r))return!1;for(const e of s)if(!Fi(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Qi=class{constructor(e=[],t=(e,t)=>et?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e=0)break;t[e]=t[r],e=r}t[e]=n}};function ji(e,t,i=0,r=e.length-1,n=Hi){for(;r>i;){if(r-i>600){const o=r-i+1,s=t-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);ji(e,t,Math.max(i,Math.floor(t-s*l/o+c)),Math.min(r,Math.floor(t+(o-s)*l/o+c)),n)}const o=e[t];let s=i,a=r;for(Vi(e,i,t),n(e[r],o)>0&&Vi(e,i,r);s0;)a--}0===n(e[i],o)?Vi(e,i,a):(a++,Vi(e,a,r)),a<=t&&(i=a+1),t<=a&&(r=a-1)}}function Vi(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Hi(e,t){return et?1:0}function Gi(e,t){if(e.length<=1)return[e];const i=[];let r,n;for(const t of e){const e=Zi(t);0!==e&&(t.area=Math.abs(e),void 0===n&&(n=e<0),n===e<0?(r&&i.push(r),r=[t]):r.push(t))}if(r&&i.push(r),t>1)for(let e=0;e1?(l=e[a+1][0],c=e[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;p180;)e-=360;return e}}function Yi(e,t){return t[0]-e[0]}function Ji(e){return e[1]-e[0]+1}function er(e,t){return e[1]>=e[0]&&e[1]e[1])return[null,null];const i=Ji(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===i)return[e,null];const r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function ir(e,t){if(!er(t,e.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)Bi(i,e[r]);return i}function rr(e){const t=[1/0,1/0,-1/0,-1/0];for(const i of e)for(const e of i)Bi(t,e);return t}function nr(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function or(e,t,i){if(!nr(e)||!nr(t))return NaN;let r=0,n=0;return e[2]t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]=r)return r;if(Ci(n,o)){if(dr(e,t))return 0}else if(dr(t,e))return 0;let s=1/0;for(const r of e)for(let e=0,n=r.length,o=n-1;e0;){const n=s.pop();if(n[0]>=o)continue;const l=n[1],c=t?50:100;if(Ji(l)<=c){if(!er(l,e.length))return NaN;if(t){const t=hr(e,l,i,r);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const n=ur(e[t],i,r);if(o=Math.min(o,n),0===o)return 0}}else{const i=tr(l,t);fr(s,o,r,e,a,i[0]),fr(s,o,r,e,a,i[1])}}return o}function gr(e,t,i,r,n,o=1/0){let s=Math.min(o,n.distance(e[0],i[0]));if(0===s)return s;const a=new Qi([[0,[0,e.length-1],[0,i.length-1]]],Yi);for(;a.length>0;){const o=a.pop();if(o[0]>=s)continue;const l=o[1],c=o[2],u=t?50:100,h=r?50:100;if(Ji(l)<=u&&Ji(c)<=h){if(!er(l,e.length)&&er(c,i.length))return NaN;let o;if(t&&r)o=lr(e,l,i,c,n),s=Math.min(s,o);else if(t&&!r){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=sr(i[e],t,n),s=Math.min(s,o),0===s)return s}else if(!t&&r){const t=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(o=sr(e[i],t,n),s=Math.min(s,o),0===s)return s}else o=cr(e,l,i,c,n),s=Math.min(s,o)}else{const o=tr(l,t),u=tr(c,r);Ar(a,s,n,e,i,o[0],u[0]),Ar(a,s,n,e,i,o[0],u[1]),Ar(a,s,n,e,i,o[1],u[0]),Ar(a,s,n,e,i,o[1],u[1])}}return s}function _r(e){return"MultiPolygon"===e.type?e.coordinates.map((e=>({type:"Polygon",coordinates:e}))):"MultiLineString"===e.type?e.coordinates.map((e=>({type:"LineString",coordinates:e}))):"MultiPoint"===e.type?e.coordinates.map((e=>({type:"Point",coordinates:e}))):[e]}class yr{constructor(e,t){this.type=Fe,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Lt(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new yr(t,t.features.map((e=>_r(e.geometry))).flat());if("Feature"===t.type)return new yr(t,_r(t.geometry));if("type"in t&&"coordinates"in t)return new yr(t,_r(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>Ti([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new Xi(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,gr(r,!1,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,gr(r,!1,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,mr(r,!1,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>Ti([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new Xi(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,gr(r,!0,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,gr(r,!0,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,mr(r,!0,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){const i=e.geometry();if(0===i.length||0===i[0].length)return NaN;const r=Gi(i,0).map((t=>t.map((t=>t.map((t=>Ti([t.x,t.y],e.canonical))))))),n=new Xi(r[0][0][0][1]);let o=1/0;for(const e of t)for(const t of r){switch(e.type){case"Point":o=Math.min(o,mr([e.coordinates],!1,t,n,o));break;case"LineString":o=Math.min(o,mr(e.coordinates,!0,t,n,o));break;case"Polygon":o=Math.min(o,pr(t,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const vr={"==":hi,"!=":di,">":fi,"<":pi,">=":mi,"<=":Ai,array:Dt,at:Gt,boolean:Dt,case:Kt,coalesce:ai,collator:gi,format:yi,image:vi,in:$t,"index-of":Zt,interpolate:ni,"interpolate-hcl":ni,"interpolate-lab":ni,length:xi,let:Vt,literal:zt,match:qt,number:Dt,"number-format":_i,object:Dt,slice:Wt,step:Yt,string:Dt,"to-boolean":Ut,"to-color":Ut,"to-number":Ut,"to-string":Ut,var:Ht,within:Ni,distance:yr};class xr{constructor(e,t,i,r){this.name=e,this.type=t,this._evaluate=i,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],r=xr.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let a=null;for(const[r,o]of s){a=new jt(t.registry,Cr,t.path,null,t.scope);const s=[];let l=!1;for(let t=1;t{return t=e,Array.isArray(t)?`(${t.map($e).join(", ")})`:`(${$e(t.type)}...)`;var t})).join(" | "),r=[];for(let i=1;i{i=t?i&&Cr(e):i&&e instanceof zt})),!!i&&Sr(e)&&Mr(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Sr(e){if(e instanceof xr){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Ni)return!1;if(e instanceof yr)return!1;let t=!0;return e.eachChild((e=>{t&&!Sr(e)&&(t=!1)})),t}function Er(e){if(e instanceof xr&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!Er(e)&&(t=!1)})),t}function Mr(e,t){if(e instanceof xr&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!Mr(e,t)&&(i=!1)})),i}function Ir(e){return{result:"success",value:e}}function Pr(e){return{result:"error",value:e}}function Lr(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function Fr(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function kr(e){return!!e.expression&&e.expression.interpolated}function zr(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Rr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Dr(e){return e}function Or(e,t){const i="color"===t.type,r=e.stops&&"object"==typeof e.stops[0][0],n=r||!(r||void 0!==e.property),o=e.type||(kr(t)?"exponential":"interval");if(i||"padding"===t.type){const r=i?vt.parse:Bt.parse;(e=Me({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],r(e[1])]))),e.default=r(e.default?e.default:t.default)}if(e.colorSpace&&"rgb"!==(s=e.colorSpace)&&"hcl"!==s&&"lab"!==s)throw new Error(`Unknown color space: "${e.colorSpace}"`);var s;let a,l,c;if("exponential"===o)a=jr;else if("interval"===o)a=Qr;else if("categorical"===o){a=Nr,l=Object.create(null);for(const t of e.stops)l[t[0]]=t[1];c=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);a=Vr}if(r){const i={},r=[];for(let t=0;te[0])),evaluate:({zoom:i},r)=>jr({stops:n,base:e.base},t,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ni.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:i})=>a(e,t,i,l,c)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[e.property]:void 0;return void 0===n?Ur(e.default,t.default):a(e,t,n,l,c)}}}function Ur(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function Nr(e,t,i,r,n){return Ur(typeof i===n?r[i]:void 0,e.default,t.default)}function Qr(e,t,i){if("number"!==zr(i))return Ur(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const n=Xt(e.stops.map((e=>e[0])),i);return e.stops[n][1]}function jr(e,t,i){const r=void 0!==e.base?e.base:1;if("number"!==zr(i))return Ur(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const o=Xt(e.stops.map((e=>e[0])),i),s=function(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[o][0],e.stops[o+1][0]),a=e.stops[o][1],l=e.stops[o+1][1],c=si[t.type]||Dr;return"function"==typeof a.evaluate?{evaluate(...t){const i=a.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==i&&void 0!==r)return c(i,r,s,e.colorSpace)}}:c(a,l,s,e.colorSpace)}function Vr(e,t,i){switch(t.type){case"color":i=vt.parse(i);break;case"formatted":i=Tt.fromString(i.toString());break;case"resolvedImage":i=Mt.fromString(i.toString());break;case"padding":i=Bt.parse(i);break;default:zr(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0)}return Ur(i,e.default,t.default)}xr.register(vr,{error:[{kind:"error"},[ke],(e,[t])=>{throw new Ct(t.evaluate(e))}],typeof:[ke,[Ue],(e,[t])=>$e(Ft(t.evaluate(e)))],"to-rgba":[Ge(Fe,4),[Re],(e,[t])=>{const[i,r,n,o]=t.evaluate(e).rgb;return[255*i,255*r,255*n,o]}],rgb:[Re,[Fe,Fe,Fe],br],rgba:[Re,[Fe,Fe,Fe,Fe],br],has:{type:ze,overloads:[[[ke],(e,[t])=>wr(t.evaluate(e),e.properties())],[[ke,Oe],(e,[t,i])=>wr(t.evaluate(e),i.evaluate(e))]]},get:{type:Ue,overloads:[[[ke],(e,[t])=>Tr(t.evaluate(e),e.properties())],[[ke,Oe],(e,[t,i])=>Tr(t.evaluate(e),i.evaluate(e))]]},"feature-state":[Ue,[ke],(e,[t])=>Tr(t.evaluate(e),e.featureState||{})],properties:[Oe,[],e=>e.properties()],"geometry-type":[ke,[],e=>e.geometryType()],id:[Ue,[],e=>e.id()],zoom:[Fe,[],e=>e.globals.zoom],"heatmap-density":[Fe,[],e=>e.globals.heatmapDensity||0],"line-progress":[Fe,[],e=>e.globals.lineProgress||0],accumulated:[Ue,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Fe,Br(Fe),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[Fe,Br(Fe),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:Fe,overloads:[[[Fe,Fe],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[Fe],(e,[t])=>-t.evaluate(e)]]},"/":[Fe,[Fe,Fe],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[Fe,[Fe,Fe],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[Fe,[],()=>Math.LN2],pi:[Fe,[],()=>Math.PI],e:[Fe,[],()=>Math.E],"^":[Fe,[Fe,Fe],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[Fe,[Fe],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))],log2:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Fe,[Fe],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Fe,[Fe],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Fe,[Fe],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Fe,[Fe],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Fe,[Fe],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Fe,[Fe],(e,[t])=>Math.atan(t.evaluate(e))],min:[Fe,Br(Fe),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[Fe,Br(Fe),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[Fe,[Fe],(e,[t])=>Math.abs(t.evaluate(e))],round:[Fe,[Fe],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[Fe,[Fe],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Fe,[Fe],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ze,[ke,Ue],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[ze,[Ue],(e,[t])=>e.id()===t.value],"filter-type-==":[ze,[ke],(e,[t])=>e.geometryType()===t.value],"filter-<":[ze,[ke,Ue],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r{const i=e.id(),r=t.value;return typeof i==typeof r&&i":[ze,[ke,Ue],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[ze,[Ue],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[ze,[ke,Ue],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[ze,[Ue],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[ze,[ke,Ue],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[ze,[Ue],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[ze,[Ue],(e,[t])=>t.value in e.properties()],"filter-has-id":[ze,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[ze,[Ge(ke)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ze,[Ge(Ue)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ze,[ke,Ge(Ue)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ze,[ke,Ge(Ue)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:ze,overloads:[[[ze,ze],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Br(ze),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:ze,overloads:[[[ze,ze],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Br(ze),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[ze,[ze],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ze,[ke],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[ke,[ke],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[ke,[ke],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[ke,Br(Ue),(e,t)=>t.map((t=>kt(t.evaluate(e)))).join("")],"resolved-locale":[ke,[Ne],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Hr{constructor(e,t){var i;this.expression=e,this._warningHistory={},this._evaluator=new Qt,this._defaultValue=t?"color"===(i=t).type&&Rr(i.default)?new vt(0,0,0,0):"color"===i.type?vt.parse(i.default)||null:"padding"===i.type?Bt.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?Et.parse(i.default)||null:"projectionDefinition"===i.type?It.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,o){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Ct(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function Gr(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in vr}function $r(e,t){const i=new jt(vr,Cr,[],t?function(e){const t={color:Re,string:ke,number:Fe,enum:ke,boolean:ze,formatted:Qe,padding:je,projectionDefinition:De,resolvedImage:Ve,variableAnchorOffsetCollection:He};return"array"===e.type?Ge(t[e.value]||Ue,e.length):t[e.type]}(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?Ir(new Hr(r,t)):Pr(i.errors)}class Zr{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Er(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}}class qr{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Er(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?ni.interpolationFactor(this.interpolationType,e,t,i):0}}function Kr(e,t){const i=$r(e,t);if("error"===i.result)return i;const r=i.value.expression,n=Sr(r);if(!n&&!Lr(t))return Pr([new Ie("","data expressions not supported")]);const o=Mr(r,["zoom"]);if(!o&&!Fr(t))return Pr([new Ie("","zoom expressions not supported")]);const s=Xr(r);return s||o?s instanceof Ie?Pr([s]):s instanceof ni&&!kr(t)?Pr([new Ie("",'"interpolate" expressions cannot be used with this property')]):Ir(s?new qr(n?"camera":"composite",i.value,s.labels,s instanceof ni?s.interpolation:void 0):new Zr(n?"constant":"source",i.value)):Pr([new Ie("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Wr{constructor(e,t){this._parameters=e,this._specification=t,Me(this,Or(this._parameters,this._specification))}static deserialize(e){return new Wr(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Xr(e){let t=null;if(e instanceof Vt)t=Xr(e.result);else if(e instanceof ai){for(const i of e.args)if(t=Xr(i),t)break}else(e instanceof Yt||e instanceof ni)&&e.input instanceof xr&&"zoom"===e.input.name&&(t=e);return t instanceof Ie||e.eachChild((e=>{const i=Xr(e);i instanceof Ie?t=i:!t&&i?t=new Ie("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new Ie("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function Yr(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Yr(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const Jr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function en(e){if(null==e)return{filter:()=>!0,needGeometry:!1};Yr(e)||(e=nn(e));const t=$r(e,Jr);if("error"===t.result)throw new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return{filter:(e,i,r)=>t.value.evaluate(e,i,{},r),needGeometry:rn(e)}}function tn(e,t){return et?1:0}function rn(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t"===t||"<="===t||">="===t?on(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(nn))):"all"===t?["all"].concat(e.slice(1).map(nn)):"none"===t?["all"].concat(e.slice(1).map(nn).map(ln)):"in"===t?sn(e[1],e.slice(2)):"!in"===t?ln(sn(e[1],e.slice(2))):"has"===t?an(e[1]):"!has"!==t||ln(an(e[1]));var i}function on(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function sn(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(tn)]]:["filter-in-small",e,["literal",t]]}}function an(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function ln(e){return["!",e]}function cn(e){const t=typeof e;if("number"===t||"boolean"===t||"string"===t||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const i of e)t+=`${cn(i)},`;return`${t}]`}const i=Object.keys(e).sort();let r="{";for(let t=0;tr.maximum?[new Ee(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function gn(e){const t=e.valueSpec,i=dn(e.value.type);let r,n,o,s={};const a="categorical"!==i&&void 0===e.value.property,l=!a,c="array"===zr(e.value.stops)&&"array"===zr(e.value.stops[0])&&"object"===zr(e.value.stops[0][0]),u=fn({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new Ee(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(An({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===zr(r)&&0===r.length&&t.push(new Ee(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&a&&u.push(new Ee(e.key,e.value,'missing required property "property"')),"identity"===i||e.value.stops||u.push(new Ee(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!kr(e.valueSpec)&&u.push(new Ee(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Lr(e.valueSpec)?u.push(new Ee(e.key,e.value,"property functions not supported")):a&&!Fr(e.valueSpec)&&u.push(new Ee(e.key,e.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==e.value.property||u.push(new Ee(e.key,e.value,'"property" property is required')),u;function h(e){let i=[];const r=e.value,a=e.key;if("array"!==zr(r))return[new Ee(a,r,`array expected, ${zr(r)} found`)];if(2!==r.length)return[new Ee(a,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==zr(r[0]))return[new Ee(a,r,`object expected, ${zr(r[0])} found`)];if(void 0===r[0].zoom)return[new Ee(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new Ee(a,r,"object stop key must have value")];if(o&&o>dn(r[0].zoom))return[new Ee(a,r[0].zoom,"stop zoom values must appear in ascending order")];dn(r[0].zoom)!==o&&(o=dn(r[0].zoom),n=void 0,s={}),i=i.concat(fn({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:mn,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return Gr(pn(r[1]))?i.concat([new Ee(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(e.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const a=zr(e.value),l=dn(e.value),c=null!==e.value?e.value:o;if(r){if(a!==r)return[new Ee(e.key,c,`${a} stop domain type must match previous stop domain type ${r}`)]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new Ee(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let r=`number expected, ${a} found`;return Lr(t)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ee(e.key,c,r)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==n&&lnew Ee(`${e.key}${t.key}`,e.value,t.message)));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new Ee(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!Er(i))return[new Ee(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!Er(i))return[new Ee(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Mr(i,["zoom","feature-state"]))return[new Ee(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Sr(i))return[new Ee(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function yn(e){const t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(dn(i))&&n.push(new Ee(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(dn(i))&&n.push(new Ee(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function vn(e){return Yr(pn(e.value))?_n(Me({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xn(e)}function xn(e){const t=e.value,i=e.key;if("array"!==zr(t))return[new Ee(i,t,`array expected, ${zr(t)} found`)];const r=e.styleSpec;let n,o=[];if(t.length<1)return[new Ee(i,t,"filter array must have at least 1 element")];switch(o=o.concat(yn({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),dn(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===dn(t[1])&&o.push(new Ee(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new Ee(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=zr(t[1]),"string"!==n&&o.push(new Ee(`${i}[1]`,t[1],`string expected, ${n} found`)));for(let s=2;s{e in i&&t.push(new Ee(r,i[e],`"${e}" is prohibited for ref layers`))})),n.layers.forEach((t=>{dn(t.id)===a&&(e=t)})),e?e.ref?t.push(new Ee(r,i.ref,"ref cannot reference another ref layer")):s=dn(e.type):t.push(new Ee(r,i.ref,`ref layer "${a}" not found`))}else if("background"!==s)if(i.source){const e=n.sources&&n.sources[i.source],o=e&&dn(e.type);e?"vector"===o&&"raster"===s?t.push(new Ee(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===s?t.push(new Ee(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==s?t.push(new Ee(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==s?t.push(new Ee(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&e.lineMetrics||t.push(new Ee(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ee(r,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new Ee(r,i.source,`source "${i.source}" not found`))}else t.push(new Ee(r,i,'missing required property "source"'));return t=t.concat(fn({key:r,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"}),filter:vn,layout:e=>fn({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Tn(Me({layerType:s},e))}}),paint:e=>fn({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>wn(Me({layerType:s},e))}})}})),t}function Cn(e){const t=e.value,i=e.key,r=zr(t);return"string"!==r?[new Ee(i,t,`string expected, ${r} found`)]:[]}const Sn={promoteId:function({key:e,value:t}){if("string"===zr(t))return Cn({key:e,value:t});{const i=[];for(const r in t)i.push(...Cn({key:`${e}.${r}`,value:t[r]}));return i}}};function En(e){const t=e.value,i=e.key,r=e.styleSpec,n=e.style,o=e.validateSpec;if(!t.type)return[new Ee(i,t,'"type" is required')];const s=dn(t.type);let a;switch(s){case"vector":case"raster":return a=fn({key:i,value:t,valueSpec:r[`source_${s.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:Sn,validateSpec:o}),a;case"raster-dem":return a=function(e){var t;const i=null!==(t=e.sourceName)&&void 0!==t?t:"",r=e.value,n=e.styleSpec,o=n.source_raster_dem,s=e.style;let a=[];const l=zr(r);if(void 0===r)return a;if("object"!==l)return a.push(new Ee("source_raster_dem",r,`object expected, ${l} found`)),a;const c="custom"===dn(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const t in r)!c&&u.includes(t)?a.push(new Ee(t,r[t],`In "${i}": "${t}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[t]?a=a.concat(e.validateSpec({key:t,value:r[t],valueSpec:o[t],validateSpec:e.validateSpec,style:s,styleSpec:n})):a.push(new Ee(t,r[t],`unknown property "${t}"`));return a}({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:o}),a;case"geojson":if(a=fn({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:Sn}),t.cluster)for(const e in t.clusterProperties){const[r,n]=t.clusterProperties[e],o="string"==typeof r?[r,["accumulated"],["get",e]]:r;a.push(..._n({key:`${i}.${e}.map`,value:n,expressionContext:"cluster-map"})),a.push(..._n({key:`${i}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return fn({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return fn({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new Ee(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return yn({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Mn(e){const t=e.value,i=e.styleSpec,r=i.light,n=e.style;let o=[];const s=zr(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new Ee("light",t,`object expected, ${s} found`)]),o;for(const s in t){const a=s.match(/^(.*)-transition$/);o=o.concat(a&&r[a[1]]&&r[a[1]].transition?e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i}):r[s]?e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i}):[new Ee(s,t[s],`unknown property "${s}"`)])}return o}function In(e){const t=e.value,i=e.styleSpec,r=i.sky,n=e.style,o=zr(t);if(void 0===t)return[];if("object"!==o)return[new Ee("sky",t,`object expected, ${o} found`)];let s=[];for(const o in t)s=s.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i}):[new Ee(o,t[o],`unknown property "${o}"`)]);return s}function Pn(e){const t=e.value,i=e.styleSpec,r=i.terrain,n=e.style;let o=[];const s=zr(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new Ee("terrain",t,`object expected, ${s} found`)]),o;for(const s in t)o=o.concat(r[s]?e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i}):[new Ee(s,t[s],`unknown property "${s}"`)]);return o}function Ln(e){let t=[];const i=e.value,r=e.key;if(Array.isArray(i)){const n=[],o=[];for(const s in i)i[s].id&&n.includes(i[s].id)&&t.push(new Ee(r,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),n.push(i[s].id),i[s].url&&o.includes(i[s].url)&&t.push(new Ee(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),o.push(i[s].url),t=t.concat(fn({key:`${r}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return Cn({key:r,value:i})}const Fn={"*":()=>[],array:An,boolean:function(e){const t=e.value,i=e.key,r=zr(t);return"boolean"!==r?[new Ee(i,t,`boolean expected, ${r} found`)]:[]},number:mn,color:function(e){const t=e.key,i=e.value,r=zr(i);return"string"!==r?[new Ee(t,i,`color expected, ${r} found`)]:vt.parse(String(i))?[]:[new Ee(t,i,`color expected, "${i}" found`)]},constants:hn,enum:yn,filter:vn,function:gn,layer:Bn,object:fn,source:En,light:Mn,sky:In,terrain:Pn,projection:function(e){const t=e.value,i=e.styleSpec,r=i.projection,n=e.style,o=zr(t);if(void 0===t)return[];if("object"!==o)return[new Ee("projection",t,`object expected, ${o} found`)];let s=[];for(const o in t)s=s.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i}):[new Ee(o,t[o],`unknown property "${o}"`)]);return s},projectionDefinition:function(e){const t=e.key;let i=e.value;i=i instanceof String?i.valueOf():i;const r=zr(i);return"array"!==r||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(i)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(i)?["array","string"].includes(r)?[]:[new Ee(t,i,`projection expected, invalid type "${r}" found`)]:[new Ee(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Cn,formatted:function(e){return 0===Cn(e).length?[]:_n(e)},resolvedImage:function(e){return 0===Cn(e).length?[]:_n(e)},padding:function(e){const t=e.key,i=e.value;if("array"===zr(i)){if(i.length<1||i.length>4)return[new Ee(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let o=0;o[]}})),e.constants&&(i=i.concat(hn({key:"constants",value:e.constants}))),On(i)}function Dn(e){return function(t){return e({...t,validateSpec:kn})}}function On(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function Un(e){return function(...t){return On(e.apply(this,t))}}Rn.source=Un(Dn(En)),Rn.sprite=Un(Dn(Ln)),Rn.glyphs=Un(Dn(zn)),Rn.light=Un(Dn(Mn)),Rn.sky=Un(Dn(In)),Rn.terrain=Un(Dn(Pn)),Rn.layer=Un(Dn(Bn)),Rn.filter=Un(Dn(vn)),Rn.paintProperty=Un(Dn(wn)),Rn.layoutProperty=Un(Dn(Tn));const Nn=Rn,Qn=Nn.light,jn=Nn.sky,Vn=Nn.paintProperty,Hn=Nn.layoutProperty;function Gn(e,t){let i=!1;if(t&&t.length)for(const r of t)e.fire(new fe(new Error(r.message))),i=!0;return i}class $n{constructor(e,t,i){const r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(i=n[2]);for(let e=0;e=c[l+0]&&r>=c[l+1])?(s[h]=!0,o.push(n[h])):s[h]=!1}}}}_forEachCell(e,t,i,r,n,o,s,a){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(i),h=this._convertToCellCoord(r);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++){const c=this.d*l+d;if((!a||a(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&n.call(this,e,t,i,r,c,o,s,a))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=3+this.cells.length+1+1;let i=0;for(let e=0;e=0)continue;const o=e[r];n[r]=Zn[i].shallow.indexOf(r)>=0?o:Yn(o,t)}e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(n.$name=i),n}function Jn(e){if(Xn(e))return e;if(Array.isArray(e))return e.map(Jn);if("object"!=typeof e)throw new Error("can't deserialize object of type "+typeof e);const t=Wn(e)||"Object";if(!Zn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:i}=Zn[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);const r=Object.create(i.prototype);for(const i of Object.keys(e)){if("$name"===i)continue;const n=e[i];r[i]=Zn[t].shallow.indexOf(i)>=0?n:Jn(n)}return r}class eo{constructor(){this.first=!0}update(e,t){const i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoome>=128&&e<=255,"Hangul Jamo":e=>e>=4352&&e<=4607,Khmer:e=>e>=6016&&e<=6143,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Kanbun:e=>e>=12688&&e<=12703,"CJK Strokes":e=>e>=12736&&e<=12783,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Hangul Syllables":e=>e>=44032&&e<=55215,"Private Use Area":e=>e>=57344&&e<=63743,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function io(e){for(const t of e)if(lo(t.charCodeAt(0)))return!0;return!1}function ro(e){for(const t of e)if(!so(t.charCodeAt(0)))return!1;return!0}function no(e){const t=e.map((e=>{try{return new RegExp(`\\p{sc=${e}}`,"u").source}catch(e){return null}})).filter((e=>e));return new RegExp(t.join("|"),"u")}const oo=no(["Arab","Dupl","Mong","Ougr","Syrc"]);function so(e){return!oo.test(String.fromCodePoint(e))}const ao=no(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function lo(e){return!(746!==e&&747!==e&&(e<4352||!(to["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||to["CJK Compatibility"](e)||to["CJK Strokes"](e)||!(!to["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||to["Enclosed CJK Letters and Months"](e)||to["Ideographic Description Characters"](e)||to.Kanbun(e)||to.Katakana(e)&&12540!==e||!(!to["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!to["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||to["Vertical Forms"](e)||to["Yijing Hexagram Symbols"](e)||/\p{sc=Cans}/u.test(String.fromCodePoint(e))||/\p{sc=Hang}/u.test(String.fromCodePoint(e))||ao.test(String.fromCodePoint(e)))))}function co(e){return!(lo(e)||function(e){return!!(to["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||to["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||to["Letterlike Symbols"](e)||to["Number Forms"](e)||to["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||to["Control Pictures"](e)&&9251!==e||to["Optical Character Recognition"](e)||to["Enclosed Alphanumerics"](e)||to["Geometric Shapes"](e)||to["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||to["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||to["CJK Symbols and Punctuation"](e)||to.Katakana(e)||to["Private Use Area"](e)||to["CJK Compatibility Forms"](e)||to["Small Form Variants"](e)||to["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}const uo=no(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function ho(e){return uo.test(String.fromCodePoint(e))}function po(e,t){return!(!t&&ho(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||to.Khmer(e))}function fo(e){for(const t of e)if(ho(t.charCodeAt(0)))return!0;return!1}const Ao=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Ao.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,i){return t(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;const t=e.pluginURL,r=new Promise((e=>{this.loadScriptResolve=e}));i(t);const n=new Promise((e=>setTimeout((()=>e()),this.TIMEOUT)));if(yield Promise.race([r,n]),this.isParsed()){const e={pluginStatus:"loaded",pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}};class mo{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new eo,this.transition={})}isSupportedScript(e){return function(e,t){for(const i of e)if(!po(i.charCodeAt(0),t))return!1;return!0}(e,"loaded"===Ao.getRTLTextPluginStatus())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}}class go{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(Rr(e))return new Wr(e,t);if(Gr(e)){const i=Kr(e,t);if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return i.value}{let i=e;return"color"===t.type&&"string"==typeof e?i=vt.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)?i=Et.parse(e):"projectionDefinition"===t.type&&"string"==typeof e&&(i=It.parse(e)):i=Bt.parse(e),{kind:"constant",evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class _o{constructor(e){this.property=e,this.value=new go(e,void 0)}transitioned(e,t){return new vo(this.property,this.value,t,D({},e.transition,this.transition),e.now)}untransitioned(){return new vo(this.property,this.value,null,{},0)}}class yo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Q(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new _o(this._values[e].property)),this._values[e].value=new go(this._values[e].property,null===t?void 0:Q(t))}getTransition(e){return Q(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new _o(this._values[e].property)),this._values[e].transition=Q(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const r=this.getTransition(t);void 0!==r&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){const i=new xo(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){const e=new xo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class vo{constructor(e,t,i,r,n){this.property=e,this.value=t,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(rr.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class Eo{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){if(void 0!==e.value){if("constant"===e.expression.kind){const n=e.expression.evaluate(t,null,{},i,r);return this._calculate(n,n,n,t)}return this._calculate(e.expression.evaluate(new mo(Math.floor(t.zoom-1),t)),e.expression.evaluate(new mo(Math.floor(t.zoom),t)),e.expression.evaluate(new mo(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class Mo{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class Io{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const t in e){const i=e[t];i.specification.overridable&&this.overridableProperties.push(t);const r=this.defaultPropertyValues[t]=new go(i,void 0),n=this.defaultTransitionablePropertyValues[t]=new _o(i);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}qn("DataDrivenProperty",Co),qn("DataConstantProperty",Bo),qn("CrossFadedDataDrivenProperty",So),qn("CrossFadedProperty",Eo),qn("ColorRampProperty",Mo);const Po="-transition";class Lo extends Ae{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new bo(t.layout)),t.paint)){this._transitionablePaint=new yo(t.paint);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new To(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,i={}){null!=t&&this._validate(Hn,`layers.${this.id}.layout.${e}`,e,t,i)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return e.endsWith(Po)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(null!=t&&this._validate(Vn,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(e.endsWith(Po))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const i=this._transitionablePaint._values[e],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const s=this._transitionablePaint._values[e].value;return s.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(e,o,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),N(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,i,r,n={}){return(!n||!1!==n.validate)&&Gn(this,e.call(Nn,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:me,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof wo&&Lr(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}const Fo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ko{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class zo{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ro(e,t=1){let i=0,r=0;return{members:e.map((e=>{const n=Fo[e.type].BYTES_PER_ELEMENT,o=i=Do(i,Math.max(t,n)),s=e.components||1;return r=Math.max(r,n),i+=n*s,{name:e.name,type:e.type,components:s,offset:o}})),size:Do(i,Math.max(r,t)),alignment:t}}function Do(e,t){return Math.ceil(e/t)*t}class Oo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}Oo.prototype.bytesPerElement=4,qn("StructArrayLayout2i4",Oo);class Uo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}Uo.prototype.bytesPerElement=6,qn("StructArrayLayout3i6",Uo);class No extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,e}}No.prototype.bytesPerElement=8,qn("StructArrayLayout4i8",No);class Qo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,e}}Qo.prototype.bytesPerElement=12,qn("StructArrayLayout2i4i12",Qo);class jo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=4*e,l=8*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=s,e}}jo.prototype.bytesPerElement=8,qn("StructArrayLayout2i4ub8",jo);class Vo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}Vo.prototype.bytesPerElement=8,qn("StructArrayLayout2f8",Vo);class Ho extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,n,o,s,a,l,c)}emplace(e,t,i,r,n,o,s,a,l,c,u){const h=10*e;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=n,this.uint16[h+4]=o,this.uint16[h+5]=s,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,e}}Ho.prototype.bytesPerElement=20,qn("StructArrayLayout10ui20",Ho);class Go extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,o,s,a,l,c,u,h)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=s,this.uint16[p+6]=a,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}Go.prototype.bytesPerElement=24,qn("StructArrayLayout4i4ui4i24",Go);class $o extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}$o.prototype.bytesPerElement=12,qn("StructArrayLayout3f12",$o);class Zo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Zo.prototype.bytesPerElement=4,qn("StructArrayLayout1ul4",Zo);class qo extends zo{_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(e,t,i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,r,n,o,s,a,l)}emplace(e,t,i,r,n,o,s,a,l,c){const u=10*e,h=5*e;return this.int16[u+0]=t,this.int16[u+1]=i,this.int16[u+2]=r,this.int16[u+3]=n,this.int16[u+4]=o,this.int16[u+5]=s,this.uint32[h+3]=a,this.uint16[u+8]=l,this.uint16[u+9]=c,e}}qo.prototype.bytesPerElement=20,qn("StructArrayLayout6i1ul2ui20",qo);class Ko extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,e}}Ko.prototype.bytesPerElement=12,qn("StructArrayLayout2i2i2i12",Ko);class Wo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=4*e,a=8*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[a+6]=n,this.int16[a+7]=o,e}}Wo.prototype.bytesPerElement=16,qn("StructArrayLayout2f1f2i16",Wo);class Xo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=16*e,l=4*e,c=8*e;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[c+6]=o,this.int16[c+7]=s,e}}Xo.prototype.bytesPerElement=16,qn("StructArrayLayout2ub2f2i16",Xo);class Yo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}Yo.prototype.bytesPerElement=6,qn("StructArrayLayout3ui6",Yo);class Jo extends zo{_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(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g){const _=24*e,y=12*e,v=48*e;return this.int16[_+0]=t,this.int16[_+1]=i,this.uint16[_+2]=r,this.uint16[_+3]=n,this.uint32[y+2]=o,this.uint32[y+3]=s,this.uint32[y+4]=a,this.uint16[_+10]=l,this.uint16[_+11]=c,this.uint16[_+12]=u,this.float32[y+7]=h,this.float32[y+8]=d,this.uint8[v+36]=p,this.uint8[v+37]=f,this.uint8[v+38]=A,this.uint32[y+10]=m,this.int16[_+22]=g,e}}Jo.prototype.bytesPerElement=48,qn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Jo);class es extends zo{_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(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S){const E=this.length;return this.resize(E+1),this.emplace(E,e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B,C,S,E){const M=32*e,I=16*e;return this.int16[M+0]=t,this.int16[M+1]=i,this.int16[M+2]=r,this.int16[M+3]=n,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]=u,this.uint16[M+10]=h,this.uint16[M+11]=d,this.uint16[M+12]=p,this.uint16[M+13]=f,this.uint16[M+14]=A,this.uint16[M+15]=m,this.uint16[M+16]=g,this.uint16[M+17]=_,this.uint16[M+18]=y,this.uint16[M+19]=v,this.uint16[M+20]=x,this.uint16[M+21]=b,this.uint16[M+22]=w,this.uint32[I+12]=T,this.float32[I+13]=B,this.float32[I+14]=C,this.uint16[M+30]=S,this.uint16[M+31]=E,e}}es.prototype.bytesPerElement=64,qn("StructArrayLayout8i15ui1ul2f2ui64",es);class ts extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}ts.prototype.bytesPerElement=4,qn("StructArrayLayout1f4",ts);class is extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[6*e+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}is.prototype.bytesPerElement=12,qn("StructArrayLayout1ui2f12",is);class rs extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e;return this.uint32[2*e+0]=t,this.uint16[n+2]=i,this.uint16[n+3]=r,e}}rs.prototype.bytesPerElement=8,qn("StructArrayLayout1ul2ui8",rs);class ns extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}ns.prototype.bytesPerElement=4,qn("StructArrayLayout2ui4",ns);class os extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}os.prototype.bytesPerElement=2,qn("StructArrayLayout1ui2",os);class ss extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,e}}ss.prototype.bytesPerElement=16,qn("StructArrayLayout4f16",ss);class as extends ko{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 l(this.anchorPointX,this.anchorPointY)}}as.prototype.size=20;class ls extends qo{get(e){return new as(this,e)}}qn("CollisionBoxArray",ls);class cs extends ko{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}cs.prototype.size=48;class us extends Jo{get(e){return new cs(this,e)}}qn("PlacedSymbolArray",us);class hs extends ko{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}hs.prototype.size=64;class ds extends es{get(e){return new hs(this,e)}}qn("SymbolInstanceArray",ds);class ps extends ts{getoffsetX(e){return this.float32[1*e+0]}}qn("GlyphOffsetArray",ps);class fs extends Uo{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}qn("SymbolLineVertexArray",fs);class As extends ko{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]}}As.prototype.size=12;class ms extends is{get(e){return new As(this,e)}}qn("TextAnchorOffsetArray",ms);class gs extends ko{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]}}gs.prototype.size=8;class _s extends rs{get(e){return new gs(this,e)}}qn("FeatureIndexArray",_s);class ys extends Oo{}class vs extends Oo{}class xs extends Oo{}class bs extends Qo{}class ws extends jo{}class Ts extends Vo{}class Bs extends Ho{}class Cs extends Go{}class Ss extends $o{}class Es extends Zo{}class Ms extends Ko{}class Is extends Xo{}class Ps extends Yo{}class Ls extends ns{}const Fs=Ro([{name:"a_pos",components:2,type:"Int16"}],4),{members:ks}=Fs;class zs{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,i,r){const n=this.segments[this.segments.length-1];return e>zs.MAX_VERTEX_ARRAY_LENGTH&&V(`Max vertices per segment is ${zs.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${zs.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+e>zs.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r?this.createNewSegment(t,i,r):n}createNewSegment(e,t,i){const r={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(e,t,i){return this.prepareSegment(0,e,t,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,r){return new zs([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function Rs(e,t){return 256*(e=z(Math.floor(e),0,255))+z(Math.floor(t),0,255)}zs.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,qn("SegmentVector",zs);const Ds=Ro([{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 Os,Us,Ns,Qs={exports:{}},js={exports:{}},Vs={exports:{}},Hs=function(){if(Ns)return Qs.exports;Ns=1;var e=(Os||(Os=1,js.exports=function(e,t){var i,r,n,o,s,a,l,c;for(r=e.length-(i=3&e.length),n=t,s=3432918353,a=461845907,c=0;c>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),js.exports),t=(Us||(Us=1,Vs.exports=function(e,t){for(var i,r=e.length,n=t^r,o=0;r>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),Vs.exports);return Qs.exports=e,Qs.exports.murmur3=e,Qs.exports.murmur2=t,Qs.exports}(),Gs=i(Hs);class $s{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(Zs(e)),this.positions.push(t,i,r)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const t=Zs(e);let i=0,r=this.ids.length-1;for(;i>1;this.ids[e]>=t?r=e:i=e+1}const n=[];for(;this.ids[i]===t;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(e,t){const i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return qs(i,r,0,i.length-1),t&&t.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(e){const t=new $s;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function Zs(e){const t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Gs(String(e))}function qs(e,t,i,r){for(;i>1];let o=i-1,s=r+1;for(;;){do{o++}while(e[o]n);if(o>=s)break;Ks(e,o,s),Ks(t,3*o,3*s),Ks(t,3*o+1,3*s+1),Ks(t,3*o+2,3*s+2)}s-i`u_${e}`)),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return"color"===this.type?new Js(e,t):new Xs(e,t)}}class ra{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,i,r){const n="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;n&&e.set(n)}getBinding(e,t,i){return"u_pattern"===i.substr(0,9)?new Ys(e,t):new Xs(e,t)}}class na{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,n){const o=this.paintVertexArray.length,s=this.expression.evaluate(new mo(0),t,{},r,[],n);this.paintVertexArray.resize(e),this._setPaintValue(o,e,s)}updatePaintArray(e,t,i,r){const n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(e,t,n)}_setPaintValue(e,t,i){if("color"===this.type){const r=ta(i);for(let i=e;i`u_${e}_t`)),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,t,i,r,n){const o=this.expression.evaluate(new mo(this.zoom),t,{},r,[],n),s=this.expression.evaluate(new mo(this.zoom+1),t,{},r,[],n),a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(a,e,o,s)}updatePaintArray(e,t,i,r){const n=this.expression.evaluate({zoom:this.zoom},i,r),o=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(e,t,n,o)}_setPaintValue(e,t,i,r){if("color"===this.type){const n=ta(i),o=ta(r);for(let i=e;i`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof na||i instanceof oa)for(let t=0;t!0){this.programConfigurations={};for(const r of e)this.programConfigurations[r.id]=new aa(r,t,i);this.needsUpload=!1,this._featureMap=new $s,this._bufferOffset=0}populatePaintArrays(e,t,i,r,n,o){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,r,n,o);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r){for(const n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,n,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function ca(e,t){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"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function ua(e,t,i){const r={color:{source:Vo,composite:ss},number:{source:ts,composite:Vo}},n=function(e){return{"line-pattern":{source:Bs,composite:Bs},"fill-pattern":{source:Bs,composite:Bs},"fill-extrusion-pattern":{source:Bs,composite:Bs}}[e]}(e);return n&&n[i]||r[t][i]}qn("ConstantBinder",ia),qn("CrossFadedConstantBinder",ra),qn("SourceExpressionBinder",na),qn("CrossFadedCompositeBinder",sa),qn("CompositeExpressionBinder",oa),qn("ProgramConfiguration",aa,{omit:["_buffers"]}),qn("ProgramConfigurationSet",la);const ha=Math.pow(2,14)-1,da=-ha-1;function pa(e){const t=E/e.extent,i=e.loadGeometry();for(let e=0;ei.x+1||oi.y+1)&&V("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function fa(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?pa(e):[]}}const Aa=-32768;function ma(e,t,i,r,n){e.emplaceBack(Aa+8*t+r,Aa+8*i+n)}class ga{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new vs,this.indexArray=new Ps,this.segments=new zs,this.programConfigurations=new la(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){const r=this.layers[0],n=[];let o=null,s=!1,a="heatmap"===r.type;if("circle"===r.type){const e=r;o=e.layout.get("circle-sort-key"),s=!o.isConstant(),a=a||"map"===e.paint.get("circle-pitch-alignment")}const l=a?t.subdivisionGranularity.circle:1;for(const{feature:t,id:r,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=fa(t,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),c,i))continue;const u=s?o.evaluate(c,{},i):void 0,h={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:pa(t),patterns:{},sortKey:u};n.push(h)}s&&n.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of n){const{geometry:n,index:o,sourceLayerIndex:s}=r,a=e[o].feature;this.addFeature(r,n,o,i,l),t.featureIndex.insert(a,n,o,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ks),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,r,n=1){let o;switch(n){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}const s=o.length;for(const i of t)for(const t of i){const i=t.x,r=t.y;if(i<0||i>=E||r<0||r>=E)continue;const n=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),a=n.vertexLength;for(let e=0;e1){if(ba(e,t))return!0;for(let r=0;r1?i:i.sub(t)._mult(n)._add(t))}function Ca(e,t){for(let i=0;it.y!=s.y>t.y&&t.x<(s.x-o.x)*(t.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function Ea(e,t,i){const r=i[0],n=i[2];if(e.xn.x&&t.x>n.x||e.yn.y&&t.y>n.y)return!1;const o=H(e,t,i[0]);return o!==H(e,t,i[1])||o!==H(e,t,i[2])||o!==H(e,t,i[3])}function Ma(e,t,i){const r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Ia(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Pa(e,t,i,r,n){if(!t[0]&&!t[1])return e;const o=l.convert(t)._mult(n);"viewport"===i&&o._rotate(-r);const s=[];for(let t=0;tRa(e,t,i,r)))}(l,n,s,a),d=u?c*o:c;for(const e of r)for(const t of e){const e=u?t:Ra(t,n,s,a);let i=d;const r=n.projectTileCoordinates(t.x,t.y,s,a).signedDistanceFromCamera;if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=r/n.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=n.cameraToCenterDistance/r),ya(h,e,i))return!0}return!1}}function Ra(e,t,i,r){const n=t.projectTileCoordinates(e.x,e.y,i,r).point;return new l((.5*n.x+.5)*t.width,(.5*-n.y+.5)*t.height)}class Da extends ga{}let Oa;qn("HeatmapBucket",Da,{omit:["layers"]});var Ua={get paint(){return Oa=Oa||new Io({"heatmap-radius":new Co(me.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Co(me.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Bo(me.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Mo(me.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Bo(me.paint_heatmap["heatmap-opacity"])})}};function Na(e,{width:t,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${t*i*r}`)}else n=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=n,e}function Qa(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;const n=Na({},{width:t,height:i},r);ja(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},r),e.width=t,e.height=i,e.data=n.data}function ja(e,t,i,r,n,o){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const s=e.data,a=t.data;if(s===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l{t[e.evaluationKey]=o;const s=e.expression.evaluate(t);n.data[i+r+0]=Math.floor(255*s.r/s.a),n.data[i+r+1]=Math.floor(255*s.g/s.a),n.data[i+r+2]=Math.floor(255*s.b/s.a),n.data[i+r+3]=Math.floor(255*s.a)};if(e.clips)for(let t=0,n=0;t0)for(let n=t;n=t;n-=r)o=wl(n/r|0,e[n],e[n+1],o);return o&&gl(o,o.next)&&(Tl(o),o=o.next),o}function il(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!gl(r,r.next)&&0!==ml(r.prev,r,r.next))r=r.next;else{if(Tl(r),r=t=r.prev,r===r.next)break;i=!0}}while(i||r!==t);return t}function rl(e,t,i,r,n,o,s){if(!e)return;!s&&o&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=hl(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let o=null;for(t=0;n;){t++;let s=n,a=0;for(let e=0;e0||l>0&&s;)0!==a&&(0===l||!s||n.z<=s.z)?(r=n,n=n.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=s}o.nextZ=null,i*=2}while(t>1)}(n)}(e,r,n,o);let a=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?ol(e,r,n,o):nl(e))t.push(l.i,e.i,c.i),Tl(e),e=c.next,a=c.next;else if((e=c)===a){s?1===s?rl(e=sl(il(e),t),t,i,r,n,o,2):2===s&&al(e,t,i,r,n,o):rl(il(e),t,i,r,n,o,1);break}}}function nl(e){const t=e.prev,i=e,r=e.next;if(ml(t,i,r)>=0)return!1;const n=t.x,o=i.x,s=r.x,a=t.y,l=i.y,c=r.y,u=Math.min(n,o,s),h=Math.min(a,l,c),d=Math.max(n,o,s),p=Math.max(a,l,c);let f=r.next;for(;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&fl(n,a,o,l,s,c,f.x,f.y)&&ml(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ol(e,t,i,r){const n=e.prev,o=e,s=e.next;if(ml(n,o,s)>=0)return!1;const a=n.x,l=o.x,c=s.x,u=n.y,h=o.y,d=s.y,p=Math.min(a,l,c),f=Math.min(u,h,d),A=Math.max(a,l,c),m=Math.max(u,h,d),g=hl(p,f,t,i,r),_=hl(A,m,t,i,r);let y=e.prevZ,v=e.nextZ;for(;y&&y.z>=g&&v&&v.z<=_;){if(y.x>=p&&y.x<=A&&y.y>=f&&y.y<=m&&y!==n&&y!==s&&fl(a,u,l,h,c,d,y.x,y.y)&&ml(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,v.x>=p&&v.x<=A&&v.y>=f&&v.y<=m&&v!==n&&v!==s&&fl(a,u,l,h,c,d,v.x,v.y)&&ml(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;y&&y.z>=g;){if(y.x>=p&&y.x<=A&&y.y>=f&&y.y<=m&&y!==n&&y!==s&&fl(a,u,l,h,c,d,y.x,y.y)&&ml(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;v&&v.z<=_;){if(v.x>=p&&v.x<=A&&v.y>=f&&v.y<=m&&v!==n&&v!==s&&fl(a,u,l,h,c,d,v.x,v.y)&&ml(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function sl(e,t){let i=e;do{const r=i.prev,n=i.next.next;!gl(r,n)&&_l(r,i,i.next,n)&&xl(r,n)&&xl(n,r)&&(t.push(r.i,i.i,n.i),Tl(i),Tl(i.next),i=e=n),i=i.next}while(i!==e);return il(i)}function al(e,t,i,r,n,o){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&Al(s,e)){let a=bl(s,e);return s=il(s,s.next),a=il(a,a.next),rl(s,t,i,r,n,o,0),void rl(a,t,i,r,n,o,0)}e=e.next}s=s.next}while(s!==e)}function ll(e,t){let i=e.x-t.x;return 0===i&&(i=e.y-t.y,0===i)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function cl(e,t){const i=function(e,t){let i=t;const r=e.x,n=e.y;let o,s=-1/0;if(gl(e,i))return i;do{if(gl(e,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const e=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>s&&(s=e,o=i.x=i.x&&i.x>=l&&r!==i.x&&pl(no.x||i.x===o.x&&ul(o,i)))&&(o=i,u=t)}i=i.next}while(i!==a);return o}(e,t);if(!i)return t;const r=bl(i,e);return il(r,r.next),il(i,i.next)}function ul(e,t){return ml(e.prev,e,t.prev)<0&&ml(t.next,e,e.next)<0}function hl(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function dl(e){let t=e,i=e;do{(t.x=(e-s)*(o-a)&&(e-s)*(r-a)>=(i-s)*(t-a)&&(i-s)*(o-a)>=(n-s)*(r-a)}function fl(e,t,i,r,n,o,s,a){return!(e===s&&t===a)&&pl(e,t,i,r,n,o,s,a)}function Al(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&_l(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(xl(e,t)&&xl(t,e)&&function(e,t){let i=e,r=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(ml(e.prev,e,t.prev)||ml(e,t.prev,t))||gl(e,t)&&ml(e.prev,e,e.next)>0&&ml(t.prev,t,t.next)>0)}function ml(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function gl(e,t){return e.x===t.x&&e.y===t.y}function _l(e,t,i,r){const n=vl(ml(e,t,i)),o=vl(ml(e,t,r)),s=vl(ml(i,r,e)),a=vl(ml(i,r,t));return n!==o&&s!==a||!(0!==n||!yl(e,i,t))||!(0!==o||!yl(e,r,t))||!(0!==s||!yl(i,e,r))||!(0!==a||!yl(i,t,r))}function yl(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function vl(e){return e>0?1:e<0?-1:0}function xl(e,t){return ml(e.prev,e,e.next)<0?ml(e,t,e.next)>=0&&ml(e,e.prev,t)>=0:ml(e,t,e.prev)<0||ml(e,e.next,t)<0}function bl(e,t){const i=Bl(e.i,e.x,e.y),r=Bl(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function wl(e,t,i,r){const n=Bl(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Tl(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Bl(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Cl{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const i=0|Math.round(e),r=0|Math.round(t),n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(i,r),o}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){const i=[];for(let r=0;r0?(i.push(n),i.push(s),i.push(o)):(i.push(n),i.push(o),i.push(s))}return i}(this._vertexBuffer,e);const t=[],i=e.length;for(let r=0;r=1||y<=0)||A&&(an)){c>=r&&c<=n&&o.push(i[(e+1)%3]);continue}!A&&_>0&&o.push(this._vertexToIndex(s+d*_,a+p*_));const v=s+d*Math.max(_,0),x=s+d*Math.min(y,1);f||this._generateIntraEdgeVertices(o,s,a,l,c,v,x),!A&&y<1&&o.push(this._vertexToIndex(s+d*y,a+p*y)),(A||c>=r&&c<=n)&&o.push(i[(e+1)%3]),!A&&(c<=r||c>=n)&&this._generateInterEdgeVertices(o,s,a,l,c,u,h,x,r,n)}return o}_generateIntraEdgeVertices(e,t,i,r,n,o,s){const a=r-t,l=n-i,c=0===l,u=c?Math.min(t,r):Math.min(o,s),h=c?Math.max(t,r):Math.max(o,s),d=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(h/this._granularityCellSize)-1;if(c?t=d;r--){const n=r*this._granularityCellSize;e.push(this._vertexToIndex(n,i+l*(n-t)/a))}}_generateInterEdgeVertices(e,t,i,r,n,o,s,a,l,c){const u=n-i,h=o-r,d=s-n,p=(l-n)/d,f=(c-n)/d,A=Math.min(p,f),m=Math.max(p,f),g=r+h*A;let _=Math.floor(Math.min(g,a)/this._granularityCellSize)+1,y=Math.ceil(Math.max(g,a)/this._granularityCellSize)-1,v=a=1||m<=0){const e=i-s,r=o+(t-o)*Math.min((l-s)/e,(c-s)/e);_=Math.floor(Math.min(r,a)/this._granularityCellSize)+1,y=Math.ceil(Math.max(r,a)/this._granularityCellSize)-1,v=a0?c:l;if(v)for(let t=_;t<=y;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,b));else for(let t=y;t>=_;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,b))}_generateOutline(e){const t=[];for(const i of e){const e=Ll(i,this._granularity,!0),r=this._pointArrayToIndices(e),n=[];for(let e=1;en!=(o===El)?(e.push(t),e.push(i),e.push(this._vertexToIndex(r,o)),e.push(i),e.push(this._vertexToIndex(n,o)),e.push(this._vertexToIndex(r,o))):(e.push(i),e.push(t),e.push(this._vertexToIndex(r,o)),e.push(this._vertexToIndex(n,o)),e.push(i),e.push(this._vertexToIndex(r,o)))}_fillPoles(e,t,i){const r=this._vertexBuffer,n=E,o=e.length;for(let s=2;s80*i){a=1/0,l=1/0;let t=-1/0,r=-1/0;for(let o=i;ot&&(t=i),n>r&&(r=n)}c=Math.max(t-a,r-l),c=0!==c?32767/c:0}return rl(o,s,i,a,l,c,0),s}(i,r),t=this._convertIndices(i,e);n=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let o=[];return t&&(o=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(e,t){const i=[];for(let r=0;r0?(Math.floor(_/s)+1)*s:(Math.ceil(_/s)-1)*s,t=A>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,i=Math.abs(_-e),r=Math.abs(y-t),n=Math.abs(_-u),o=Math.abs(y-h),c=d?i/m:Number.POSITIVE_INFINITY,v=p?r/g:Number.POSITIVE_INFINITY;if((n<=i||!d)&&(o<=r||!p))break;if(c=0?s-1:o-1,n=(a+1)%o,l=e[2*t[r]],c=e[2*t[n]],u=e[2*t[s]],h=e[2*t[s]+1],d=e[2*t[a]+1];let p=!1;if(lc)p=!1;else{const i=d-h,o=-(e[2*t[a]]-u),s=h((c-u)*i+(e[2*t[n]+1]-h)*o)*s&&(p=!0)}if(p){const e=t[r],n=t[s],l=t[a];e!==n&&e!==l&&n!==l&&i.push(l,n,e),s--,s<0&&(s=o-1)}else{const e=t[n],r=t[s],l=t[a];e!==r&&e!==l&&r!==l&&i.push(l,r,e),a++,a>=o&&(a=0)}if(r===n)break}}function kl(e,t,i,r,n,o,s,a,l){const c=n.length/2,u=s&&a&&l;if(czs.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,i),l=a.count,A=!0,m=!0,g=!0,u=0);const _=zl(s,r,o,a,d,A,c),y=zl(s,r,o,a,p,m,c),v=zl(s,r,o,a,f,g,c);i.emplaceBack(u+_-l,u+y-l,u+v-l),c.primitiveLength++}}(t,i,r,n,o,e),u&&function(e,t,i,r,n,o){const s=[];for(let e=0;ezs.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,i),l=a.count,f=!0,A=!0,u=0);const m=zl(s,r,o,a,n,f,c),g=zl(s,r,o,a,h,A,c);i.emplaceBack(u+m-l,u+g-l),c.primitiveLength++}}}(s,i,a,n,l,e),t.forceNewSegmentOnNextPrepare(),null==s||s.forceNewSegmentOnNextPrepare()}function zl(e,t,i,r,n,o,s){if(o){const o=r.count;return i(t[2*n],t[2*n+1]),e[n]=r.count,r.count++,s.vertexLength++,o}return e[n]}class Rl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new xs,this.indexArray=new Ps,this.indexArray2=new Ls,this.programConfigurations=new la(e.layers,e.zoom),this.segments=new zs,this.segments2=new zs,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.hasPattern=Ja("fill",this.layers,t);const r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=fa(s,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),u,i))continue;const h=n?r.evaluate(u,{},i,t.availableImages):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:pa(s),patterns:{},sortKey:h};o.push(d)}n&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:s}=r;if(this.hasPattern){const e=el("fill",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ya),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,t,i,r,n,o){for(const e of Gi(t,500)){const t=Pl(e,r,o.fill.getGranularityForZoomLevel(r.z)),i=this.layoutVertexArray;kl(((e,t)=>{i.emplaceBack(e,t)}),this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}}let Dl,Ol;qn("FillBucket",Rl,{omit:["layers","patternFeatures"]});var Ul={get paint(){return Ol=Ol||new Io({"fill-antialias":new Bo(me.paint_fill["fill-antialias"]),"fill-opacity":new Co(me.paint_fill["fill-opacity"]),"fill-color":new Co(me.paint_fill["fill-color"]),"fill-outline-color":new Co(me.paint_fill["fill-outline-color"]),"fill-translate":new Bo(me.paint_fill["fill-translate"]),"fill-translate-anchor":new Bo(me.paint_fill["fill-translate-anchor"]),"fill-pattern":new So(me.paint_fill["fill-pattern"])})},get layout(){return Dl=Dl||new Io({"fill-sort-key":new Co(me.layout_fill["fill-sort-key"])})}};class Nl extends Lo{constructor(e){super(e,Ul)}recalculate(e,t){super.recalculate(e,t);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(e){return new Rl(e)}queryRadius(){return Ia(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){return va(Pa(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),t)}isTileClipped(){return!0}}const Ql=Ro([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),jl=Ro([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Vl}=Ql;var Hl,Gl,$l,Zl,ql,Kl,Wl,Xl={};function Yl(){if(Gl)return Hl;Gl=1;var e=o();function t(e,t,r,n,o){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,e.readFields(i,this,t)}function i(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){for(var i=e.readVarint()+e.pos;e.pos>3}if(o--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(i&&l.push(i),i=[]),i.push(new e(s,a));else{if(7!==n)throw new Error("unknown command "+n);i&&i.push(i[0].clone())}}return i&&l.push(i),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;e.pos>3}if(r--,1===i||2===i)(n+=e.readSVarint())a&&(a=n),(o+=e.readSVarint())c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[s,l,a,c]},t.prototype.toGeoJSON=function(e,i,n){var o,s,a=this.extent*Math.pow(2,n),l=this.extent*e,c=this.extent*i,u=this.loadGeometry(),h=t.types[this.type];function d(e){for(var t=0;t>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}return $l=t,t.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 i=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,i,this.extent,this._keys,this._values)},$l}function ec(){return Wl||(Wl=1,Xl.VectorTile=function(){if(Kl)return ql;Kl=1;var e=Jl();function t(t,i,r){if(3===t){var n=new e(r,r.readVarint()+r.pos);n.length&&(i[n.name]=n)}}return ql=function(e,i){this.layers=e.readFields(t,{},i)},ql}(),Xl.VectorTileFeature=Yl(),Xl.VectorTileLayer=Jl()),Xl}var tc=i(ec());const ic=tc.VectorTileFeature.types,rc=Math.pow(2,13);function nc(e,t,i,r,n,o,s,a){e.emplaceBack(t,i,2*Math.floor(r*rc)+s,n*rc*2,o*rc*2,Math.round(a))}class oc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new bs,this.centroidVertexArray=new ys,this.indexArray=new Ps,this.programConfigurations=new la(e.layers,e.zoom),this.segments=new zs,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.features=[],this.hasPattern=Ja("fill-extrusion",this.layers,t);for(const{feature:r,id:n,index:o,sourceLayerIndex:s}of e){const e=this.layers[0]._featureFilter.needGeometry,a=fa(r,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),a,i))continue;const l={id:n,sourceLayerIndex:s,index:o,geometry:e?a.geometry:pa(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(el("fill-extrusion",this.layers,l,this.zoom,t)):this.addFeature(l,l.geometry,o,i,{},t.subdivisionGranularity),t.featureIndex.insert(r,l.geometry,o,s,this.index,!0)}}addFeatures(e,t,i){for(const r of this.features){const{geometry:n}=r;this.addFeature(r,n,r.index,t,i,e.subdivisionGranularity)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vl),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,jl.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,i,r,n,o){for(const i of Gi(t,500)){const t={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(t,r,e,i,o);const s=this.layoutVertexArray.length-n,a=Math.floor(t.x/t.sampleCount),l=Math.floor(t.y/t.sampleCount);for(let e=0;e{nc(c,e,t,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let i=0;for(let r=1;rzs.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const s=n.sub(o)._perp()._unit(),a=o.dist(n);i+a>32768&&(i=0),nc(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,i),nc(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,i),i+=a,nc(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,i),nc(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,i);const l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}}function sc(e,t){for(let i=0;iE)||e.y===t.y&&(e.y<0||e.y>E)}function lc(e){return e.every((e=>e.x<0))||e.every((e=>e.x>E))||e.every((e=>e.y<0))||e.every((e=>e.y>E))}let cc;qn("FillExtrusionBucket",oc,{omit:["layers","features"]});var uc={get paint(){return cc=cc||new Io({"fill-extrusion-opacity":new Bo(me["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Co(me["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Bo(me["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Bo(me["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new So(me["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Co(me["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Co(me["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Bo(me["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class hc extends Lo{constructor(e){super(e,uc)}createBucket(e){return new oc(e)}queryRadius(){return Ia(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,pixelPosMatrix:s}){const a=Pa(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("fill-extrusion-height").evaluate(t,i),u=this.paint.get("fill-extrusion-base").evaluate(t,i),h=function(e,t){const i=[];for(const r of e){const e=[r.x,r.y,0,1];T(e,e,t),i.push(new l(e[0]/e[3],e[1]/e[3]))}return i}(a,s),d=function(e,t,i,r){const n=[],o=[],s=r[8]*t,a=r[9]*t,c=r[10]*t,u=r[11]*t,h=r[8]*i,d=r[9]*i,p=r[10]*i,f=r[11]*i;for(const t of e){const e=[],i=[];for(const n of t){const t=n.x,o=n.y,A=r[0]*t+r[4]*o+r[12],m=r[1]*t+r[5]*o+r[13],g=r[2]*t+r[6]*o+r[14],_=r[3]*t+r[7]*o+r[15],y=g+c,v=_+u,x=A+h,b=m+d,w=g+p,T=_+f,B=new l((A+s)/v,(m+a)/v);B.z=y/v,e.push(B);const C=new l(x/T,b/T);C.z=w/T,i.push(C)}n.push(e),o.push(i)}return[n,o]}(r,u,c,s);return function(e,t,i){let r=1/0;va(i,t)&&(r=pc(i,t[0]));for(let n=0;ne.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new ws,this.layoutVertexArray2=new Ts,this.indexArray=new Ps,this.programConfigurations=new la(e.layers,e.zoom),this.segments=new zs,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.hasPattern=Ja("line",this.layers,t);const r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),o=[];for(const{feature:t,id:s,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=fa(t,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),c,i))continue;const u=n?r.evaluate(c,{},i):void 0,h={id:s,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:pa(t),patterns:{},sortKey:u};o.push(h)}n&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:s}=r;if(this.hasPattern){const e=el("line",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,gc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ac),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,i,r,n,o){const s=this.layers[0].layout,a=s.get("line-join").evaluate(e,{}),l=s.get("line-cap"),c=s.get("line-miter-limit"),u=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const i of t)this.addLine(i,e,a,l,c,u,r,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}addLine(e,t,i,r,n,o,s,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Ll(e,s?a.line.getGranularityForZoomLevel(s.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t=2&&e[c-1].equals(e[c-2]);)c--;let u=0;for(;u0;if(x&&t>u){const e=p.dist(f);if(e>2*h){const t=p.sub(p.sub(f)._mult(h/e)._round());this.updateDistance(f,t),this.addCurrentVertex(t,m,0,0,d),f=t}}const w=f&&A;let T=w?i:l?"butt":r;if(w&&"round"===T&&(yn&&(T="bevel"),"bevel"===T&&(y>2&&(T="flipbevel"),y100)s=g.mult(-1);else{const e=y*m.add(g).mag()/m.sub(g).mag();s._perp()._mult(e*(b?-1:1))}this.addCurrentVertex(p,s,0,0,d),this.addCurrentVertex(p,s.mult(-1),0,0,d)}else if("bevel"===T||"fakeround"===T){const e=-Math.sqrt(y*y-1),t=b?e:0,i=b?0:e;if(f&&this.addCurrentVertex(p,m,t,i,d),"fakeround"===T){const e=Math.round(180*v/Math.PI/20);for(let t=1;t2*h){const t=p.add(A.sub(p)._mult(h/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,g,0,0,d),p=t}}}}addCurrentVertex(e,t,i,r,n,o=!1){const s=t.y*r-t.x,a=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,o,!1,i,n),this.addHalfVertex(e,s,a,o,!0,-r,n),this.distance>vc/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,n,o))}addHalfVertex({x:e,y:t},i,r,n,o,s,a){const l=.5*(this.lineClips?this.scaledDistance*(vc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+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,c,this.e2),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(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}let bc,wc;qn("LineBucket",xc,{omit:["layers","patternFeatures"]});var Tc={get paint(){return wc=wc||new Io({"line-opacity":new Co(me.paint_line["line-opacity"]),"line-color":new Co(me.paint_line["line-color"]),"line-translate":new Bo(me.paint_line["line-translate"]),"line-translate-anchor":new Bo(me.paint_line["line-translate-anchor"]),"line-width":new Co(me.paint_line["line-width"]),"line-gap-width":new Co(me.paint_line["line-gap-width"]),"line-offset":new Co(me.paint_line["line-offset"]),"line-blur":new Co(me.paint_line["line-blur"]),"line-dasharray":new Eo(me.paint_line["line-dasharray"]),"line-pattern":new So(me.paint_line["line-pattern"]),"line-gradient":new Mo(me.paint_line["line-gradient"])})},get layout(){return bc=bc||new Io({"line-cap":new Bo(me.layout_line["line-cap"]),"line-join":new Co(me.layout_line["line-join"]),"line-miter-limit":new Bo(me.layout_line["line-miter-limit"]),"line-round-limit":new Bo(me.layout_line["line-round-limit"]),"line-sort-key":new Co(me.layout_line["line-sort-key"])})}};class Bc extends Co{possiblyEvaluate(e,t){return t=new mo(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=D({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}let Cc;class Sc extends Lo{constructor(e){super(e,Tc),this.gradientVersion=0,Cc||(Cc=new Bc(Tc.paint.properties["line-width"].specification),Cc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this.gradientExpression();this.stepInterpolant=!!function(e){return void 0!==e._styleExpression}(e)&&e._styleExpression.expression instanceof Yt,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=Cc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new xc(e)}queryRadius(e){const t=e,i=Ec(Ma("line-width",this,t),Ma("line-gap-width",this,t)),r=Ma("line-offset",this,t);return i/2+Math.abs(r)+Ia(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o}){const s=Pa(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,o),a=o/2*Ec(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),c=this.paint.get("line-offset").evaluate(t,i);return c&&(r=function(e,t){const i=[];for(let r=0;r=3)for(let t=0;t0?t+2*e:e}const Mc=Ro([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ic=Ro([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ro([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Pc=Ro([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ro([{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 Lc=Ro([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Fc=Ro([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function kc(e,t,i){return e.sections.forEach((e=>{e.text=function(e,t,i){const r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),Ao.applyArabicShaping&&(e=Ao.applyArabicShaping(e)),e}(e.text,t,i)})),e}Ro([{name:"triangle",components:3,type:"Uint16"}]),Ro([{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"}]),Ro([{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"}]),Ro([{type:"Float32",name:"offsetX"}]),Ro([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ro([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const zc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Rc,Dc,Oc,Uc=24,Nc={};function Qc(){return Rc||(Rc=1,Nc.read=function(e,t,i,r,n){var o,s,a=8*n-r-1,l=(1<>1,u=-7,h=i?n-1:0,d=i?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},Nc.write=function(e,t,i,r,n,o){var s,a,l,c=8*o-n-1,u=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,A=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*l-1)*Math.pow(2,n),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;e[i+p]=255&a,p+=f,a/=256,n-=8);for(s=s<0;e[i+p]=255&s,p+=f,s/=256,c-=8);e[i+p-f]|=128*A}),Nc}function jc(){if(Oc)return Dc;Oc=1,Dc=t;var e=Qc();function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var i=4294967296,r=1/i,n="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");function o(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function s(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function a(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function l(e,t){for(var i=0;i>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos>3,o=this.pos;this.type=7&r,e(n,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=g(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=g(this.buf,this.pos)+g(this.buf,this.pos+4)*i;return this.pos+=8,e},readSFixed64:function(){var e=g(this.buf,this.pos)+y(this.buf,this.pos+4)*i;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return s(e,r,t);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return s(e,r,t);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return s(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&n?function(e,t,i){return n.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var r="",n=t;n239?4:l>223?3:l>191?2:1;if(n+u>i)break;1===u?l<128&&(c=l):2===u?128==(192&(o=e[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(s=e[n+2],128==(192&(o=e[n+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(s=e[n+2],a=e[n+3],128==(192&(o=e[n+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,u=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=u}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,i){if(this.type!==t.Bytes)return e.push(this.readVarint(i));var r=o(this);for(e=e||[];this.pos127;);else if(i===t.Bytes)this.pos=this.readVarint()+this.pos;else if(i===t.Fixed32)this.pos+=4;else{if(i!==t.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,o=0;o55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&a(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i=128&&a(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,i,r){this.writeTag(e,t.Bytes),this.writeRawMessage(i,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,l,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,c,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,d,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,u,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,h,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,p,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,A,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,m,t)},writeBytesField:function(e,i){this.writeTag(e,t.Bytes),this.writeBytes(i)},writeFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeSFixed64(i)},writeVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeVarint(i)},writeSVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeSVarint(i)},writeStringField:function(e,i){this.writeTag(e,t.Bytes),this.writeString(i)},writeFloatField:function(e,i){this.writeTag(e,t.Fixed32),this.writeFloat(i)},writeDoubleField:function(e,i){this.writeTag(e,t.Fixed64),this.writeDouble(i)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},Dc}var Vc=i(jc());const Hc=3;function Gc(e,t,i){1===e&&i.readMessage($c,t)}function $c(e,t,i){if(3===e){const{id:e,bitmap:r,width:n,height:o,left:s,top:a,advance:l}=i.readMessage(Zc,{});t.push({id:e,bitmap:new Va({width:n+2*Hc,height:o+2*Hc},r),metrics:{width:n,height:o,left:s,top:a,advance:l}})}}function Zc(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}const qc=Hc;function Kc(e){let t=0,i=0;for(const r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort(((e,t)=>t.h-e.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,o=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const i=r[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,o=Math.max(o,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===i.w&&t.h===i.h){const t=r.pop();e=0&&i>=e&&nu[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const i=new iu;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}getMaxImageSize(e){let t=0,i=0;for(let r=0;r=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ru(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A){const m=iu.fromFeature(t,o);let g;d===e.al.vertical&&m.verticalizePunctuation();const{processBidirectionalText:_,processStyledBidirectionalText:y}=Ao;if(_&&1===m.sections.length){g=[];const e=_(m.toString(),du(m,u,s,i,n,f));for(const t of e){const e=new iu;e.text=t,e.sections=m.sections;for(let i=0;i=0;let c=0;for(let i=0;ic){const e=Math.ceil(o/c);n*=e/s,s=e}return{x1:r,y1:n,x2:r+o,y2:n+s}}function bu(e,t,i,r,n,o){const s=e.image;let a;if(s.content){const e=s.content,t=s.pixelRatio||1;a=[e[0]/t,e[1]/t,s.displaySize[0]-e[2]/t,s.displaySize[1]-e[3]/t]}const l=t.left*o,c=t.right*o;let u,h,d,p;"width"===i||"both"===i?(p=n[0]+l-r[3],h=n[0]+c+r[1]):(p=n[0]+(l+c-s.displaySize[0])/2,h=p+s.displaySize[0]);const f=t.top*o,A=t.bottom*o;return"height"===i||"both"===i?(u=n[1]+f-r[0],d=n[1]+A+r[2]):(u=n[1]+(f+A-s.displaySize[1])/2,d=u+s.displaySize[1]),{image:s,top:u,right:h,bottom:d,left:p,collisionPadding:a}}const wu=255,Tu=128,Bu=wu*Tu;function Cu(e,t){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new mo(e+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:r}=i;let n=0;for(;ne.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cu(this.zoom,i["text-size"]),this.iconSizeData=Cu(this.zoom,i["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),o=r.get("symbol-z-order");this.canOverlap="never"!==Su(r,"text-overlap","text-allow-overlap")||"never"!==Su(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((t=>e.al[t]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=t.sourceID}createArrays(){this.text=new Fu(new la(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new Fu(new la(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new ps,this.lineVertexArray=new fs,this.symbolInstances=new ds,this.textAnchorOffsets=new ms}calculateGlyphDependencies(e,t,i,r,n){for(let o=0;o0)&&("constant"!==s.value.kind||s.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!c&&!u)return;const d=i.iconDependencies,p=i.glyphDependencies,f=i.availableImages,A=new mo(this.zoom);for(const{feature:i,id:a,index:l,sourceLayerIndex:m}of t){const t=n._featureFilter.needGeometry,g=fa(i,t);if(!n._featureFilter.filter(A,g,r))continue;let _,y;if(t||(g.geometry=pa(i)),c){const e=n.getValueAndResolveTokens("text-field",g,r,f),t=Tt.factory(e),i=this.hasRTLText=this.hasRTLText||Lu(t);(!i||"unavailable"===Ao.getRTLTextPluginStatus()||i&&Ao.isParsed())&&(_=kc(t,n,g))}if(u){const e=n.getValueAndResolveTokens("icon-image",g,r,f);y=e instanceof Mt?e:Mt.fromString(e)}if(!_&&!y)continue;const v=this.sortFeaturesByKey?h.evaluate(g,{},r):void 0;if(this.features.push({id:a,text:_,icon:y,index:l,sourceLayerIndex:m,geometry:g.geometry,properties:i.properties,type:Eu[i.type],sortKey:v}),y&&(d[y.name]=!0),_){const t=s.evaluate(g,{},r).join(","),i="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.al.vertical)>=0;for(const e of _.sections)if(e.image)d[e.image.name]=!0;else{const r=io(_.toString()),n=e.fontStack||t,o=p[n]=p[n]||{};this.calculateGlyphDependencies(e.text,o,i,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},r=[];let n=0;function o(t){r.push(e[t]),n++}function s(e,t,n){const o=i[e];return delete i[e],i[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function a(e,i,n){const o=t[i];return delete t[i],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(e,t,i){const r=i?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let c=0;ce.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment){let i=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]);const n={};for(let r=e.segment+1;r=0;i--)n[i]={x:t[i].x,y:t[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=t[i-1].dist(t[i]));for(let e=0;e0}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(e,t){const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;tr[e]-r[t]||n[t]-n[e])),o}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach(((e,t,i)=>{e>=0&&i.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)})),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Ru,Du;qn("SymbolBucket",zu,{omit:["layers","collisionBoxArray","features","compareText"]}),zu.MAX_GLYPHS=65535,zu.addDynamicAttributes=Pu;var Ou={get paint(){return Du=Du||new Io({"icon-opacity":new Co(me.paint_symbol["icon-opacity"]),"icon-color":new Co(me.paint_symbol["icon-color"]),"icon-halo-color":new Co(me.paint_symbol["icon-halo-color"]),"icon-halo-width":new Co(me.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Co(me.paint_symbol["icon-halo-blur"]),"icon-translate":new Bo(me.paint_symbol["icon-translate"]),"icon-translate-anchor":new Bo(me.paint_symbol["icon-translate-anchor"]),"text-opacity":new Co(me.paint_symbol["text-opacity"]),"text-color":new Co(me.paint_symbol["text-color"],{runtimeType:Re,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Co(me.paint_symbol["text-halo-color"]),"text-halo-width":new Co(me.paint_symbol["text-halo-width"]),"text-halo-blur":new Co(me.paint_symbol["text-halo-blur"]),"text-translate":new Bo(me.paint_symbol["text-translate"]),"text-translate-anchor":new Bo(me.paint_symbol["text-translate-anchor"])})},get layout(){return Ru=Ru||new Io({"symbol-placement":new Bo(me.layout_symbol["symbol-placement"]),"symbol-spacing":new Bo(me.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Bo(me.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Co(me.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Bo(me.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Bo(me.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Bo(me.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Bo(me.layout_symbol["icon-ignore-placement"]),"icon-optional":new Bo(me.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Bo(me.layout_symbol["icon-rotation-alignment"]),"icon-size":new Co(me.layout_symbol["icon-size"]),"icon-text-fit":new Bo(me.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Bo(me.layout_symbol["icon-text-fit-padding"]),"icon-image":new Co(me.layout_symbol["icon-image"]),"icon-rotate":new Co(me.layout_symbol["icon-rotate"]),"icon-padding":new Co(me.layout_symbol["icon-padding"]),"icon-keep-upright":new Bo(me.layout_symbol["icon-keep-upright"]),"icon-offset":new Co(me.layout_symbol["icon-offset"]),"icon-anchor":new Co(me.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Bo(me.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Bo(me.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Bo(me.layout_symbol["text-rotation-alignment"]),"text-field":new Co(me.layout_symbol["text-field"]),"text-font":new Co(me.layout_symbol["text-font"]),"text-size":new Co(me.layout_symbol["text-size"]),"text-max-width":new Co(me.layout_symbol["text-max-width"]),"text-line-height":new Bo(me.layout_symbol["text-line-height"]),"text-letter-spacing":new Co(me.layout_symbol["text-letter-spacing"]),"text-justify":new Co(me.layout_symbol["text-justify"]),"text-radial-offset":new Co(me.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Bo(me.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Co(me.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Co(me.layout_symbol["text-anchor"]),"text-max-angle":new Bo(me.layout_symbol["text-max-angle"]),"text-writing-mode":new Bo(me.layout_symbol["text-writing-mode"]),"text-rotate":new Co(me.layout_symbol["text-rotate"]),"text-padding":new Bo(me.layout_symbol["text-padding"]),"text-keep-upright":new Bo(me.layout_symbol["text-keep-upright"]),"text-transform":new Co(me.layout_symbol["text-transform"]),"text-offset":new Co(me.layout_symbol["text-offset"]),"text-allow-overlap":new Bo(me.layout_symbol["text-allow-overlap"]),"text-overlap":new Bo(me.layout_symbol["text-overlap"]),"text-ignore-placement":new Bo(me.layout_symbol["text-ignore-placement"]),"text-optional":new Bo(me.layout_symbol["text-optional"])})}};class Uu{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Le,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}qn("FormatSectionOverride",Uu,{omit:["defaultValue"]});class Nu extends Lo{constructor(e){super(e,Ou)}recalculate(e,t){if(super.recalculate(e,t),"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 e=this.layout.get("text-writing-mode");if(e){const t=[];for(const i of e)t.indexOf(i)<0&&t.push(i);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,r){const n=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Gr(o.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,((t,i)=>e&&i in e?String(e[i]):""))}(t.properties,n)}createBucket(e){return new zu(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Ou.paint.overridableProperties){if(!Nu.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new Uu(t),r=new Hr(i,t.property.specification);let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new Zr("source",r):new qr("composite",r,t.value.zoomStops),this.paint._values[e]=new wo(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&Nu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),r=Ou.paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof Tt)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{n||(t instanceof zt&&Ft(t.value)===Qe?o(t.value.sections):t instanceof yi?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}}let Qu;var ju={get paint(){return Qu=Qu||new Io({"background-color":new Bo(me.paint_background["background-color"]),"background-pattern":new Eo(me.paint_background["background-pattern"]),"background-opacity":new Bo(me.paint_background["background-opacity"])})}};class Vu extends Lo{constructor(e){super(e,ju)}}let Hu;var Gu={get paint(){return Hu=Hu||new Io({"raster-opacity":new Bo(me.paint_raster["raster-opacity"]),"raster-hue-rotate":new Bo(me.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Bo(me.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Bo(me.paint_raster["raster-brightness-max"]),"raster-saturation":new Bo(me.paint_raster["raster-saturation"]),"raster-contrast":new Bo(me.paint_raster["raster-contrast"]),"raster-resampling":new Bo(me.paint_raster["raster-resampling"]),"raster-fade-duration":new Bo(me.paint_raster["raster-fade-duration"])})}};class $u extends Lo{constructor(e){super(e,Gu)}}class Zu extends Lo{constructor(e){super(e,{}),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}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 qu{constructor(e){this._methodToThrottle=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Ku={once:!0},Wu=6371008.8;class Xu{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Xu(R(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Wu*Math.acos(Math.min(n,1))}static convert(e){if(e instanceof Xu)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Xu(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Xu(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Yu=2*Math.PI*Wu;function Ju(e){return Yu*Math.cos(e*Math.PI/180)}function eh(e){return(180+e)/360}function th(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function ih(e,t){return e/Ju(t)}function rh(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function nh(e,t){return e*Ju(rh(t))}class oh{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=Xu.convert(e);return new oh(eh(i.lng),th(i.lat),ih(t,i.lat))}toLngLat(){return new Xu(360*this.x-180,rh(this.y))}toAltitude(){return nh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Yu*(e=rh(this.y),1/Math.cos(e*Math.PI/180));var e}}function sh(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class ah{constructor(e,t,i){if(!function(e,t,i){return!(e<0||e>25||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}(e,t,i))throw new Error(`x=${t}, y=${i}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=t,this.y=i,this.key=uh(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){const r=(o=this.y,s=this.z,a=sh(256*(n=this.x),256*(o=Math.pow(2,s)-o-1),s),l=sh(256*(n+1),256*(o+1),s),a[0]+","+a[1]+","+l[0]+","+l[1]);var n,o,s,a,l;const c=function(e,t,i){let r,n="";for(let o=e;o>0;o--)r=1<1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){const t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){const t=Math.pow(2,this.z);return new l((e.x*t-this.x)*E,(e.y*t-this.y)*E)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lh{constructor(e,t){this.wrap=e,this.canonical=t,this.key=uh(e,t.z,t.z,t.x,t.y)}}class ch{constructor(e,t,i,r,n){if(this.terrainRttPosMatrix32f=null,e= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=t,this.canonical=new ah(i,+r,+n),this.key=uh(t,e,i,r,n)}clone(){return new ch(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const t=this.canonical.z-e;return e>this.canonical.z?new ch(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ch(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?uh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):uh(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new ch(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new ch(t,this.wrap,t,i,r),new ch(t,this.wrap,t,i+1,r),new ch(t,this.wrap,t,i,r+1),new ch(t,this.wrap,t,i+1,r+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=i),i=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new Ha({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-t*this.dim,l=-i*this.dim;for(let t=o;t=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class ph{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=i,e._y=r,this.properties=e.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&(e[t]=this[t]);return e}}class fh{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new $n(E,16,0),this.grid3D=new $n(E,16,0),this.featureIndexArray=new _s,this.promoteId=t}insert(e,t,i,r,n,o){const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);const a=o?this.grid3D:this.grid;for(let e=0;e=0&&r[3]>=0&&a.insert(s,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new tc.VectorTile(new Vc(this.rawTileData)).layers,this.sourceLayerCoder=new dh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,i,r){this.loadVTLayers();const n=e.params,o=E/e.tileSize/e.scale,s=en(n.filter),a=e.queryGeometry,c=e.queryPadding*o,u=mh(a),h=this.grid.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c),d=mh(e.cameraQueryGeometry),p=this.grid3D.query(d.minX-c,d.minY-c,d.maxX+c,d.maxY+c,((t,i,r,n)=>function(e,t,i,r,n){for(const o of e)if(t<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;const o=[new l(t,i),new l(t,n),new l(r,n),new l(r,i)];if(e.length>2)for(const t of o)if(Sa(e,t))return!0;for(let t=0;t(d||(d=pa(t)),i.queryIntersectsFeature({queryGeometry:a,feature:t,featureState:r,geometry:d,zoom:this.z,transform:e.transform,pixelsToTileUnits:o,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return f}loadMatchingFeature(e,t,i,r,n,o,s,a,l,c,u){const h=this.bucketLayerIDs[t];if(o&&!h.some((e=>o.has(e))))return;const d=this.sourceLayerCoder.decode(i),p=this.vtLayers[d].feature(r);if(n.needGeometry){const e=fa(p,!0);if(!n.filter(new mo(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!n.filter(new mo(this.tileID.overscaledZ),p))return;const f=this.getId(p,d);for(let t=0;t{const s=t instanceof To?t.get(o):null;return s&&s.evaluate?s.evaluate(i,r,n):s}))}function mh(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return{minX:t,minY:i,maxX:r,maxY:n}}function gh(e,t){return t-e}function _h(e,t,i,r,n){const o=[];for(let s=0;s=r&&u.x>=r||(s.x>=r?s=new l(r,s.y+(r-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=r&&(u=new l(r,s.y+(r-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=n&&u.y>=n||(s.y>=n?s=new l(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round():u.y>=n&&(u=new l(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round()),c&&s.equals(c[c.length-1])||(c=[s],o.push(c)),c.push(u)))))}}return o}qn("FeatureIndex",fh,{omit:["rawTileData","sourceLayerCoder"]});class yh extends l{constructor(e,t,i,r){super(e,t),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new yh(this.x,this.y,this.angle,this.segment)}}function vh(e,t,i,r,n){if(void 0===t.segment||0===i)return!0;let o=t,s=t.segment+1,a=0;for(;a>-i/2;){if(s--,s<0)return!1;a-=e[s].dist(o),o=e[s]}a+=e[s].dist(e[s+1]),s++;const l=[];let c=0;for(;ar;)c-=l.shift().angleDelta;if(c>n)return!1;s++,a+=t.dist(i)}return!0}function xh(e){let t=0;for(let i=0;ic){const u=(c-l)/o,h=si.number(r.x,n.x,u),d=si.number(r.y,n.y,u),p=new yh(h,d,n.angleTo(r),i);return p._round(),!s||vh(e,p,a,s,t)?p:void 0}l+=o}}function Bh(e,t,i,r,n,o,s,a,l){const c=bh(r,o,s),u=wh(r,n),h=u*s,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h=0&&g=0&&_=0&&d+c<=u){const i=new yh(g,_,A,t);i._round(),r&&!vh(e,i,o,r,n)||p.push(i)}}h+=f}return a||p.length||s||(p=Ch(e,h/2,i,r,n,o,s,!0,l)),p}qn("Anchor",yh);const Sh=Wc;function Eh(e,t,i,r){const n=[],o=e.image,s=o.pixelRatio,a=o.paddedRect.w-2*Sh,c=o.paddedRect.h-2*Sh;let u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom};const h=o.stretchX||[[0,a]],d=o.stretchY||[[0,c]],p=(e,t)=>e+t[1]-t[0],f=h.reduce(p,0),A=d.reduce(p,0),m=a-f,g=c-A;let _=0,y=f,v=0,x=A,b=0,w=m,T=0,B=g;if(o.content&&r){const t=o.content,i=t[2]-t[0],r=t[3]-t[1];(o.textFitWidth||o.textFitHeight)&&(u=xu(e)),_=Mh(h,0,t[0]),v=Mh(d,0,t[1]),y=Mh(h,t[0],t[2]),x=Mh(d,t[1],t[3]),b=t[0]-_,T=t[1]-v,w=i-y,B=r-x}const C=u.x1,S=u.y1,E=u.x2-C,M=u.y2-S,I=(e,r,n,a)=>{const c=Ph(e.stretch-_,y,E,C),u=Lh(e.fixed-b,w,e.stretch,f),h=Ph(r.stretch-v,x,M,S),d=Lh(r.fixed-T,B,r.stretch,A),p=Ph(n.stretch-_,y,E,C),m=Lh(n.fixed-b,w,n.stretch,f),g=Ph(a.stretch-v,x,M,S),I=Lh(a.fixed-T,B,a.stretch,A),P=new l(c,h),L=new l(p,h),F=new l(p,g),k=new l(c,g),z=new l(u/s,d/s),R=new l(m/s,I/s),D=t*Math.PI/180;if(D){const e=Math.sin(D),t=Math.cos(D),i=[t,-e,e,t];P._matMult(i),L._matMult(i),k._matMult(i),F._matMult(i)}const O=e.stretch+e.fixed,U=r.stretch+r.fixed;return{tl:P,tr:L,bl:k,br:F,tex:{x:o.paddedRect.x+Sh+O,y:o.paddedRect.y+Sh+U,w:n.stretch+n.fixed-O,h:a.stretch+a.fixed-U},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:z,pixelOffsetBR:R,minFontScaleX:w/s/E,minFontScaleY:B/s/M,isSDF:i}};if(r&&(o.stretchX||o.stretchY)){const e=Ih(h,m,f),t=Ih(d,g,A);for(let i=0;i0&&(r=Math.max(10,r),this.circleDiameter=r)}else{const c=(null===(h=o.image)||void 0===h?void 0:h.content)&&(o.image.textFitWidth||o.image.textFitHeight)?xu(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};c.y1=c.y1*s-a[0],c.y2=c.y2*s+a[2],c.x1=c.x1*s-a[3],c.x2=c.x2*s+a[1];const d=o.collisionPadding;if(d&&(c.x1-=d[0]*s,c.y1-=d[1]*s,c.x2+=d[2]*s,c.y2+=d[3]*s),u){const e=new l(c.x1,c.y1),t=new l(c.x2,c.y1),i=new l(c.x1,c.y2),r=new l(c.x2,c.y2),n=u*Math.PI/180;e._rotate(n),t._rotate(n),i._rotate(n),r._rotate(n),c.x1=Math.min(e.x,t.x,i.x,r.x),c.x2=Math.max(e.x,t.x,i.x,r.x),c.y1=Math.min(e.y,t.y,i.y,r.y),c.y2=Math.max(e.y,t.y,i.y,r.y)}e.emplaceBack(t.x,t.y,c.x1,c.y1,c.x2,c.y2,i,r,n)}this.boxEndIndex=e.length}}class kh{constructor(e=[],t=(e,t)=>et?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e=0)break;t[e]=t[r],e=r}t[e]=n}}function zh(e,t=1,i=!1){let r=1/0,n=1/0,o=-1/0,s=-1/0;const a=e[0];for(let e=0;eo)&&(o=t.x),(!e||t.y>s)&&(s=t.y)}const c=Math.min(o-r,s-n);let u=c/2;const h=new kh([],Rh);if(0===c)return new l(r,n);for(let t=r;td.d||!d.d)&&(d=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,p)),r.max-d.d<=t||(u=r.h/2,h.push(new Dh(r.p.x-u,r.p.y-u,u,e)),h.push(new Dh(r.p.x+u,r.p.y-u,u,e)),h.push(new Dh(r.p.x-u,r.p.y+u,u,e)),h.push(new Dh(r.p.x+u,r.p.y+u,u,e)),p+=4)}return i&&(console.log(`num probes: ${p}`),console.log(`best distance: ${d.d}`)),d.p}function Rh(e,t){return t.max-e.max}function Dh(e,t,i,r){this.p=new l(e,t),this.h=i,this.d=function(e,t){let i=!1,r=1/0;for(let n=0;ne.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(i=!i),r=Math.min(r,Ba(e,n,a))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var Oh;e.aB=void 0,(Oh=e.aB||(e.aB={}))[Oh.center=1]="center",Oh[Oh.left=2]="left",Oh[Oh.right=3]="right",Oh[Oh.top=4]="top",Oh[Oh.bottom=5]="bottom",Oh[Oh["top-left"]=6]="top-left",Oh[Oh["top-right"]=7]="top-right",Oh[Oh["bottom-left"]=8]="bottom-left",Oh[Oh["bottom-right"]=9]="bottom-right";const Uh=7,Nh=Number.POSITIVE_INFINITY;function Qh(e,t){return t[1]!==Nh?function(e,t,i){let r=0,n=0;switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-Uh;break;case"bottom-right":case"bottom-left":case"bottom":n=-i+Uh}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}return[r,n]}(e,t[0],t[1]):function(e,t){let i=0,r=0;t<0&&(t=0);const n=t/Math.SQRT2;switch(e){case"top-right":case"top-left":r=n-Uh;break;case"bottom-right":case"bottom-left":r=-n+Uh;break;case"bottom":r=-t+Uh;break;case"top":r=t-Uh}switch(e){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=t;break;case"right":i=-t}return[i,r]}(e,t[0])}function jh(e,t,i){var r;const n=e.layout,o=null===(r=n.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(t,{},i);if(o){const e=o.values,t=[];for(let i=0;ie*Uc));r.startsWith("top")?n[1]-=Uh:r.startsWith("bottom")&&(n[1]+=Uh),t[i+1]=n}return new Et(t)}const s=n.get("text-variable-anchor");if(s){let r;r=void 0!==e._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(t,{},i)*Uc,Nh]:n.get("text-offset").evaluate(t,{},i).map((e=>e*Uc));const o=[];for(const e of s)o.push(e,Qh(e,r));return new Et(o)}return null}function Vh(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Hh(t,i,r,n,o,s,a,l,c,u,h,d){let p=s.textMaxSize.evaluate(i,{});void 0===p&&(p=a);const f=t.layers[0].layout,A=f.get("icon-offset").evaluate(i,{},h),m=$h(r.horizontal),g=a/24,_=t.tilePixelRatio*g,y=t.tilePixelRatio*p/24,v=t.tilePixelRatio*l,x=t.tilePixelRatio*f.get("symbol-spacing"),b=f.get("text-padding")*t.tilePixelRatio,w=function(e,t,i,r=1){const n=e.get("icon-padding").evaluate(t,{},i),o=n&&n.values;return[o[0]*r,o[1]*r,o[2]*r,o[3]*r]}(f,i,h,t.tilePixelRatio),T=f.get("text-max-angle")/180*Math.PI,B="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),C="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),S=f.get("symbol-placement"),M=x/2,I=f.get("icon-text-fit");let P;n&&"none"!==I&&(t.allowVerticalPlacement&&r.vertical&&(P=bu(n,r.vertical,I,f.get("icon-text-fit-padding"),A,g)),m&&(n=bu(n,m,I,f.get("icon-text-fit-padding"),A,g)));const L=h?d.line.getGranularityForZoomLevel(h.z):1,F=(l,d)=>{d.x<0||d.x>=E||d.y<0||d.y>=E||function(t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x,b,w,T,B){const C=t.addToLineVertexArray(i,r);let S,E,M,I,P=0,L=0,F=0,k=0,z=-1,R=-1;const D={};let O=Gs("");if(t.allowVerticalPlacement&&n.vertical){const e=l.layout.get("text-rotate").evaluate(x,{},T)+90;M=new Fh(c,i,u,h,d,n.vertical,p,f,A,e),a&&(I=new Fh(c,i,u,h,d,a,g,_,A,e))}if(o){const r=l.layout.get("icon-rotate").evaluate(x,{}),n="none"!==l.layout.get("icon-text-fit"),s=Eh(o,r,w,n),p=a?Eh(a,r,w,n):void 0;E=new Fh(c,i,u,h,d,o,g,_,!1,r),P=4*s.length;const f=t.iconSizeData;let A=null;"source"===f.kind?(A=[Tu*l.layout.get("icon-size").evaluate(x,{})],A[0]>Bu&&V(`${t.layerIds[0]}: Value for "icon-size" is >= ${wu}. Reduce your "icon-size".`)):"composite"===f.kind&&(A=[Tu*b.compositeIconSizes[0].evaluate(x,{},T),Tu*b.compositeIconSizes[1].evaluate(x,{},T)],(A[0]>Bu||A[1]>Bu)&&V(`${t.layerIds[0]}: Value for "icon-size" is >= ${wu}. Reduce your "icon-size".`)),t.addSymbols(t.icon,s,A,v,y,x,e.al.none,i,C.lineStartIndex,C.lineLength,-1,T),z=t.icon.placedSymbolArray.length-1,p&&(L=4*p.length,t.addSymbols(t.icon,p,A,v,y,x,e.al.vertical,i,C.lineStartIndex,C.lineLength,-1,T),R=t.icon.placedSymbolArray.length-1)}const U=Object.keys(n.horizontal);for(const r of U){const o=n.horizontal[r];if(!S){O=Gs(o.text);const e=l.layout.get("text-rotate").evaluate(x,{},T);S=new Fh(c,i,u,h,d,o,p,f,A,e)}const a=1===o.positionedLines.length;if(F+=Gh(t,i,o,s,l,A,x,m,C,n.vertical?e.al.horizontal:e.al.horizontalOnly,a?U:[r],D,z,b,T),a)break}n.vertical&&(k+=Gh(t,i,n.vertical,s,l,A,x,m,C,e.al.vertical,["vertical"],D,R,b,T));const N=S?S.boxStartIndex:t.collisionBoxArray.length,Q=S?S.boxEndIndex:t.collisionBoxArray.length,j=M?M.boxStartIndex:t.collisionBoxArray.length,H=M?M.boxEndIndex:t.collisionBoxArray.length,G=E?E.boxStartIndex:t.collisionBoxArray.length,$=E?E.boxEndIndex:t.collisionBoxArray.length,Z=I?I.boxStartIndex:t.collisionBoxArray.length,q=I?I.boxEndIndex:t.collisionBoxArray.length;let K=-1;const W=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;K=W(S,K),K=W(M,K),K=W(E,K),K=W(I,K);const X=K>-1?1:0;X&&(K*=B/Uc),t.glyphOffsetArray.length>=zu.MAX_GLYPHS&&V("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);const Y=jh(l,x,T),[J,ee]=function(t,i){const r=t.length,n=null==i?void 0:i.values;if((null==n?void 0:n.length)>0)for(let i=0;i=0?D.right:-1,D.center>=0?D.center:-1,D.left>=0?D.left:-1,D.vertical||-1,z,R,O,N,Q,j,H,G,$,Z,q,u,F,k,P,L,X,0,p,K,J,ee)}(t,d,l,r,n,o,P,t.layers[0],t.collisionBoxArray,i.index,i.sourceLayerIndex,t.index,_,[b,b,b,b],B,c,v,w,C,A,i,s,u,h,a)};if("line"===S)for(const e of _h(i.geometry,0,0,E,E)){const i=Ll(e,L),o=Bh(i,x,T,r.vertical||m,n,24,y,t.overscaling,E);for(const e of o)m&&Zh(t,m.text,M,e)||F(i,e)}else if("line-center"===S){for(const e of i.geometry)if(e.length>1){const t=Ll(e,L),i=Th(t,T,r.vertical||m,n,24,y);i&&F(t,i)}}else if("Polygon"===i.type)for(const e of Gi(i.geometry,0)){const t=zh(e,16);F(Ll(e[0],L,!0),new yh(t.x,t.y,0))}else if("LineString"===i.type)for(const e of i.geometry){const t=Ll(e,L);F(t,new yh(t[0].x,t[0].y,0))}else if("Point"===i.type)for(const e of i.geometry)for(const t of e)F([t],new yh(t.x,t.y,0))}function Gh(e,t,i,r,n,o,s,a,c,u,h,d,p,f,A){const m=function(e,t,i,r,n,o,s,a){const c=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(const e of t.positionedLines)for(const r of e.positionedGlyphs){if(!r.rect)continue;const o=r.rect||{};let h=qc+1,d=!0,p=1,f=0;const A=(n||a)&&r.vertical,m=r.metrics.advance*r.scale/2;if(a&&t.verticalizable&&(f=e.lineOffset/2-(r.imageName?-(Uc-r.metrics.width*r.scale)/2:(r.scale-1)*Uc)),r.imageName){const e=s[r.imageName];d=e.sdf,p=e.pixelRatio,h=Wc/p}const g=n?[r.x+m,r.y]:[0,0];let _=n?[0,0]:[r.x+m+i[0],r.y+i[1]-f],y=[0,0];A&&(y=_,_=[0,0]);const v=r.metrics.isDoubleResolution?2:1,x=(r.metrics.left-h)*r.scale-m+_[0],b=(-r.metrics.top-h)*r.scale+_[1],w=x+o.w/v*r.scale/p,T=b+o.h/v*r.scale/p,B=new l(x,b),C=new l(w,b),S=new l(x,T),E=new l(w,T);if(A){const e=new l(-m,m-eu),t=-Math.PI/2,i=Uc/2-m,n=new l(5-eu-i,-(r.imageName?i:0)),o=new l(...y);B._rotateAround(t,e)._add(n)._add(o),C._rotateAround(t,e)._add(n)._add(o),S._rotateAround(t,e)._add(n)._add(o),E._rotateAround(t,e)._add(n)._add(o)}if(c){const e=Math.sin(c),t=Math.cos(c),i=[t,-e,e,t];B._matMult(i),C._matMult(i),S._matMult(i),E._matMult(i)}const M=new l(0,0),I=new l(0,0);u.push({tl:B,tr:C,bl:S,br:E,tex:o,writingMode:t.writingMode,glyphOffset:g,sectionIndex:r.sectionIndex,isSDF:d,pixelOffsetTL:M,pixelOffsetBR:I,minFontScaleX:0,minFontScaleY:0})}return u}(0,i,a,n,o,s,r,e.allowVerticalPlacement),g=e.textSizeData;let _=null;"source"===g.kind?(_=[Tu*n.layout.get("text-size").evaluate(s,{})],_[0]>Bu&&V(`${e.layerIds[0]}: Value for "text-size" is >= ${wu}. Reduce your "text-size".`)):"composite"===g.kind&&(_=[Tu*f.compositeTextSizes[0].evaluate(s,{},A),Tu*f.compositeTextSizes[1].evaluate(s,{},A)],(_[0]>Bu||_[1]>Bu)&&V(`${e.layerIds[0]}: Value for "text-size" is >= ${wu}. Reduce your "text-size".`)),e.addSymbols(e.text,m,_,a,o,s,u,t,c.lineStartIndex,c.lineLength,p,A);for(const t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*m.length}function $h(e){for(const t in e)return e[t];return null}function Zh(e,t,i,r){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=qh[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new Kh(s,o,n,e)}constructor(e,t=64,i=Float64Array,r){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=qh.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Wh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:s}=this,a=[0,n.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=s){for(let s=h;s<=u;s++){const a=o[2*s],c=o[2*s+1];a>=e&&a<=i&&c>=t&&c<=r&&l.push(n[s])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=i&&f>=t&&f<=r&&l.push(n[d]),(0===c?e<=p:t<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?i>=p:r>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,s=[0,r.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=o){for(let i=h;i<=u;i++)ed(n[2*i],n[2*i+1],e,t)<=l&&a.push(r[i]);continue}const d=h+u>>1,p=n[2*d],f=n[2*d+1];ed(p,f,e,t)<=l&&a.push(r[d]),(0===c?e-i<=p:t-i<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?e+i>=p:t+i>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return a}}function Wh(e,t,i,r,n,o){if(n-r<=i)return;const s=r+n>>1;Xh(e,t,s,r,n,o),Wh(e,t,i,r,s-1,1-o),Wh(e,t,i,s+1,n,1-o)}function Xh(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const s=n-r+1,a=i-r+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);Xh(e,t,i,Math.max(r,Math.floor(i-a*c/s+u)),Math.min(n,Math.floor(i+(s-a)*c/s+u)),o)}const s=t[2*i+o];let a=r,l=n;for(Yh(e,t,r,i),t[2*n+o]>s&&Yh(e,t,r,n);as;)l--}t[2*r+o]===s?Yh(e,t,r,l):(l++,Yh(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Yh(e,t,i,r){Jh(e,i,r),Jh(t,2*i,2*r),Jh(t,2*i+1,2*r+1)}function Jh(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function ed(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}var td;e.cm=void 0,(td=e.cm||(e.cm={})).create="create",td.load="load",td.fullLoad="fullLoad";let id=null,rd=[];const nd=1e3/60,od="loadTime",sd="fullLoadTime",ad={mark(e){performance.mark(e)},frame(e){const t=e;null!=id&&rd.push(t-id),id=t},clearMetrics(){id=null,rd=[],performance.clearMeasures(od),performance.clearMeasures(sd);for(const t in e.cm)performance.clearMarks(e.cm[t])},getPerformanceMetrics(){performance.measure(od,e.cm.create,e.cm.load),performance.measure(sd,e.cm.create,e.cm.fullLoad);const t=performance.getEntriesByName(od)[0].duration,i=performance.getEntriesByName(sd)[0].duration,r=rd.length,n=1/(rd.reduce(((e,t)=>e+t),0)/r/1e3),o=rd.filter((e=>e>nd)).reduce(((e,t)=>e+(t-nd)/nd),0);return{loadTime:t,fullLoadTime:i,fps:n,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};e.$=oh,e.A=m,e.B=si,e.C=mo,e.D=Bo,e.E=Ae,e.F=jn,e.G=function(e){if(null==$){const t=e.navigator?e.navigator.userAgent:null;$=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return $},e.H=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new qu((()=>this.process())),this.subscription=Y(this.target,"message",(e=>this.receive(e)),!1),this.globalScope=G(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise(((i,r)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=t?Y(t.signal,"abort",(()=>{null==o||o.unsubscribe(),delete this.resolveRejects[n];const t={id:n,type:"",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)}),Ku):null;this.resolveRejects[n]={resolve:e=>{null==o||o.unsubscribe(),i(e)},reject:e=>{null==o||o.unsubscribe(),r(e)}};const s=[],a=Object.assign(Object.assign({},e),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Yn(e.data,s)});this.target.postMessage(a,{transfer:s})}))}receive(e){const t=e.data,i=t.id;if(!("file://"!==t.origin&&"file://"!==location.origin&&"resource://android"!==t.origin&&"resource://android"!==location.origin&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(""===t.type){delete this.tasks[i];const e=this.abortControllers[i];return delete this.abortControllers[i],void(e&&e.abort())}if(G(self)||t.mustQueue)return this.tasks[i]=t,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,t)}}process(){if(0===this.taskQueue.length)return;const e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,i){return t(this,void 0,void 0,(function*(){if(""===i.type){const t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;return void(i.error?t.reject(Jn(i.error)):t.resolve(Jn(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(e,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const t=Jn(i.data),r=new AbortController;this.abortControllers[e]=r;try{const n=yield this.messageHandlers[i.type](i.sourceMapId,t,r);this.completeTask(e,null,n)}catch(t){this.completeTask(e,t)}}))}completeTask(e,t,i){const r=[];delete this.abortControllers[e];const n={id:e,type:"",sourceMapId:this.mapId,origin:location.origin,error:t?Yn(t):null,data:Yn(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.I=Xc,e.J=se,e.K=function(){var e=new m(16);return m!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.L=function(e,t,i){var r,n,o,s,a,l,c,u,h,d,p,f,A=i[0],m=i[1],g=i[2];return t===e?(e[12]=t[0]*A+t[4]*m+t[8]*g+t[12],e[13]=t[1]*A+t[5]*m+t[9]*g+t[13],e[14]=t[2]*A+t[6]*m+t[10]*g+t[14],e[15]=t[3]*A+t[7]*m+t[11]*g+t[15]):(n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=r*A+a*m+h*g+t[12],e[13]=n*A+l*m+d*g+t[13],e[14]=o*A+c*m+p*g+t[14],e[15]=s*A+u*m+f*g+t[15]),e},e.M=function(e,t,i){var r=i[0],n=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.N=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],A=t[12],m=t[13],g=t[14],_=t[15],y=i[0],v=i[1],x=i[2],b=i[3];return e[0]=y*r+v*a+x*h+b*A,e[1]=y*n+v*l+x*d+b*m,e[2]=y*o+v*c+x*p+b*g,e[3]=y*s+v*u+x*f+b*_,e[4]=(y=i[4])*r+(v=i[5])*a+(x=i[6])*h+(b=i[7])*A,e[5]=y*n+v*l+x*d+b*m,e[6]=y*o+v*c+x*p+b*g,e[7]=y*s+v*u+x*f+b*_,e[8]=(y=i[8])*r+(v=i[9])*a+(x=i[10])*h+(b=i[11])*A,e[9]=y*n+v*l+x*d+b*m,e[10]=y*o+v*c+x*p+b*g,e[11]=y*s+v*u+x*f+b*_,e[12]=(y=i[12])*r+(v=i[13])*a+(x=i[14])*h+(b=i[15])*A,e[13]=y*n+v*l+x*d+b*m,e[14]=y*o+v*c+x*p+b*g,e[15]=y*s+v*u+x*f+b*_,e},e.O=function(e,t){const i={};for(let r=0;r{const t=window.document.createElement("video");return t.muted=!0,new Promise((i=>{t.onloadstart=()=>{i(t)};for(const i of e){const e=window.document.createElement("source");ue(i)||(t.crossOrigin="Anonymous"),e.src=i,t.appendChild(e)}}))},e.a3=Ee,e.a4=function(){return O++},e.a5=ls,e.a6=zu,e.a7=en,e.a8=fa,e.a9=ph,e.aA=function(e,t,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];const o=n?"map"===r?-e.bearingInRadians:0:"viewport"===r?e.bearingInRadians:0;if(o){const e=Math.sin(o),t=Math.cos(o);i=[i[0]*t-i[1]*e,i[0]*e+i[1]*t]}return[n?i[0]:M(t,i[0],e.zoom),n?i[1]:M(t,i[1],e.zoom)]},e.aC=Su,e.aD=Vh,e.aE=pu,e.aF=Kh,e.aG=Ro,e.aH=Sl,e.aI=ys,e.aJ=zs,e.aK=Ps,e.aL=R,e.aM=J,e.aN=nh,e.aO=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e},e.aP=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e},e.aQ=function(e){var t=new m(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.aR=function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e},e.aS=function(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e},e.aT=function(e,t){var i=t[0],r=t[1],n=t[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e},e.aU=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[0],a=i[1],l=i[2];return e[0]=n*l-o*a,e[1]=o*s-r*l,e[2]=r*a-n*s,e},e.aV=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.aW=lh,e.aX=uh,e.aY=function(e,t,i,r,n){var o,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+r)*(o=1/(r-n)),e[14]=2*n*r*o):(e[10]=-1,e[14]=-2*r),e},e.aZ=function(e){var t=new m(16);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},e.a_=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];return t!==e&&(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[0]=o*n+c*r,e[1]=s*n+u*r,e[2]=a*n+h*r,e[3]=l*n+d*r,e[4]=c*n-o*r,e[5]=u*n-s*r,e[6]=h*n-a*r,e[7]=d*n-l*r,e},e.aa=function(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,i,r,n)=>{const o=r||n;return t[i]=!o||o.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t},e.ab=function(e){return e*Math.PI/180},e.ac=function(e){return Math.pow(2,e)},e.ad=_,e.ae=z,e.af=85.051129,e.ag=ih,e.ah=function(e){return Math.log(e)/Math.LN2},e.ai=function(e){var t=e[0],i=e[1];return t*t+i*i},e.aj=function(e,t){const i=[];for(const r in e)r in t||i.push(r);return i},e.ak=function(e,t){let i=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){const{interpolationType:n,minZoom:o,maxZoom:s}=e,a=n?z(ni.interpolationFactor(n,t,o,s),0,1):0;"camera"===e.kind?r=si.number(e.minSize,e.maxSize,a):i=a}return{uSizeT:i,uSize:r}},e.am=function(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===e.kind?r/Tu:"composite"===e.kind?si.number(r/Tu,n/Tu,i):t},e.an=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],A=t[13],m=t[14],g=t[15],_=i*a-r*s,y=i*l-n*s,v=i*c-o*s,x=r*l-n*a,b=r*c-o*a,w=n*c-o*l,T=u*A-h*f,B=u*m-d*f,C=u*g-p*f,S=h*m-d*A,E=h*g-p*A,M=d*g-p*m,I=_*M-y*E+v*S+x*C-b*B+w*T;return I?(e[0]=(a*M-l*E+c*S)*(I=1/I),e[1]=(n*E-r*M-o*S)*I,e[2]=(A*w-m*b+g*x)*I,e[3]=(d*b-h*w-p*x)*I,e[4]=(l*C-s*M-c*B)*I,e[5]=(i*M-n*C+o*B)*I,e[6]=(m*v-f*w-g*y)*I,e[7]=(u*w-d*v+p*y)*I,e[8]=(s*E-a*C+c*T)*I,e[9]=(r*C-i*E-o*T)*I,e[10]=(f*b-A*v+g*_)*I,e[11]=(h*v-u*b-p*_)*I,e[12]=(a*B-s*S-l*T)*I,e[13]=(i*S-r*B+n*T)*I,e[14]=(A*y-f*x-m*_)*I,e[15]=(u*x-h*y+d*_)*I,e):null},e.ao=C,e.ap=function(e){return Math.hypot(e[0],e[1])},e.aq=function(e){return e[0]=0,e[1]=0,e},e.ar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},e.as=Pu,e.at=T,e.au=function(e,t,i,r){const n=t.y-e.y,o=t.x-e.x,s=r.y-i.y,a=r.x-i.x,c=s*o-a*n;if(0===c)return null;const u=(a*(e.y-i.y)-s*(e.x-i.x))/c;return new l(e.x+u*o,e.y+u*n)},e.av=_h,e.aw=_a,e.ax=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return[t,i,r,n]},e.ay=Uc,e.az=M,e.b=Z,e.b$=function(e,t){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=t[0],v=t[1],x=t[2],b=t[3],w=t[4],T=t[5],B=t[6],C=t[7],S=t[8],E=t[9],M=t[10],I=t[11],P=t[12],L=t[13],F=t[14],k=t[15];return Math.abs(i-y)<=A*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-v)<=A*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-x)<=A*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-b)<=A*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(s-w)<=A*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(a-T)<=A*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(l-B)<=A*Math.max(1,Math.abs(l),Math.abs(B))&&Math.abs(c-C)<=A*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(u-S)<=A*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(h-E)<=A*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(d-M)<=A*Math.max(1,Math.abs(d),Math.abs(M))&&Math.abs(p-I)<=A*Math.max(1,Math.abs(p),Math.abs(I))&&Math.abs(f-P)<=A*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(m-L)<=A*Math.max(1,Math.abs(m),Math.abs(L))&&Math.abs(g-F)<=A*Math.max(1,Math.abs(g),Math.abs(F))&&Math.abs(_-k)<=A*Math.max(1,Math.abs(_),Math.abs(k))},e.b0=function(){const e=new Float32Array(16);return _(e),e},e.b1=function(){const e=new Float64Array(16);return _(e),e},e.b2=function(){return new Float64Array(16)},e.b3=function(e,t,i){const r=new Float64Array(4);return function(e,t,i,r){var n=.5*Math.PI/180;t*=n,i*=n,r*=n;var o=Math.sin(t),s=Math.cos(t),a=Math.sin(i),l=Math.cos(i),c=Math.sin(r),u=Math.cos(r);e[0]=o*l*u-s*a*c,e[1]=s*a*u+o*l*c,e[2]=s*l*c-o*a*u,e[3]=s*l*u+o*a*c}(r,e,t-90,i),r},e.b4=function(e,t,i,r){var n,o,s,a,l,c=t[0],u=t[1],h=t[2],d=t[3],p=i[0],f=i[1],m=i[2],g=i[3];return(o=c*p+u*f+h*m+d*g)<0&&(o=-o,p=-p,f=-f,m=-m,g=-g),1-o>A?(n=Math.acos(o),s=Math.sin(n),a=Math.sin((1-r)*n)/s,l=Math.sin(r*n)/s):(a=1-r,l=r),e[0]=a*c+l*p,e[1]=a*u+l*f,e[2]=a*h+l*m,e[3]=a*d+l*g,e},e.b5=function(e){const t=new Float64Array(9);var i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y;h=(n=(r=e)[0])*(l=n+n),d=(o=r[1])*l,f=(s=r[2])*l,A=s*(c=o+o),g=(a=r[3])*l,_=a*c,y=a*(u=s+s),(i=t)[0]=1-(p=o*c)-(m=s*u),i[3]=d-y,i[6]=f+_,i[1]=d+y,i[4]=1-h-m,i[7]=A-g,i[2]=f-_,i[5]=A+g,i[8]=1-h-p;const v=J(-Math.asin(z(t[2],-1,1)));let x,b;return Math.hypot(t[5],t[8])<.001?(x=0,b=-J(Math.atan2(t[3],t[4]))):(x=J(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),b=J(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:x,pitch:v+90,bearing:b}},e.b6=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.b7=vt,e.b8=Xs,e.b9=El,e.bA=function(e){if("custom"===e.type)return new Zu(e);switch(e.type){case"background":return new Vu(e);case"circle":return new za(e);case"fill":return new Nl(e);case"fill-extrusion":return new hc(e);case"heatmap":return new Za(e);case"hillshade":return new Wa(e);case"line":return new Sc(e);case"raster":return new $u(e);case"symbol":return new Nu(e)}},e.bB=Q,e.bC=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!ye(e.version,t.version))return[{command:"setStyle",args:[t]}];ye(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),ye(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ye(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),ye(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),ye(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),ye(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),ye(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),ye(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),ye(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),ye(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),ye(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),ye(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),ye(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});const r={},n=[];!function(e,t,i,r){let n;for(n in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||be(n,i,r));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?ye(e[n],t[n])||("geojson"===e[n].type&&"geojson"===t[n].type&&Te(e,t,n)?ve(i,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):we(n,t,i,r)):xe(n,t,i))}(e.sources,t.sources,n,r);const o=[];e.layers&&e.layers.forEach((e=>{"source"in e&&r[e.source]?i.push({command:"removeLayer",args:[e.id]}):o.push(e)})),i=i.concat(n),function(e,t,i){t=t||[];const r=(e=e||[]).map(Ce),n=t.map(Ce),o=e.reduce(Se,{}),s=t.reduce(Se,{}),a=r.slice(),l=Object.create(null);let c,u,h,d,p;for(let e=0,t=0;ei?n-360:n+360;return Math.abs(n)0?s:-s},e.bt=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bu=Wu,e.bv=function(e,t){const i=I(e,2*Math.PI),r=I(t,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))},e.bw=function(){const e={},t=me.$version;for(const i in me.$root){const r=me.$root[i];if(r.required){let n=null;n="version"===i?t:"array"===r.type?[]:{},null!=n&&(e[i]=n)}}return e},e.bx=eo,e.by=le,e.bz=function(e){e=e.slice();const t=Object.create(null);for(let i=0;i"symbol"===e.type,e.c2=e=>"circle"===e.type,e.c3=e=>"heatmap"===e.type,e.c4=e=>"line"===e.type,e.c5=e=>"fill"===e.type,e.c6=e=>"fill-extrusion"===e.type,e.c7=e=>"hillshade"===e.type,e.c8=e=>"raster"===e.type,e.c9=e=>"background"===e.type,e.cA=tc,e.cB=Vc,e.cC=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return 0===e.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},e.cD=function(e,i,r,n,o){return t(this,void 0,void 0,(function*(){if(f())try{return yield K(e,i,r,n,o)}catch(e){}return function(e,t,i,r,n){const o=e.width,s=e.height;W&&X||(W=new OffscreenCanvas(o,s),X=W.getContext("2d",{willReadFrequently:!0})),W.width=o,W.height=s,X.drawImage(e,0,0,o,s);const a=X.getImageData(t,i,r,n);return X.clearRect(0,0,o,s),a.data}(e,i,r,n,o)}))},e.cE=hh,e.cF=i,e.cG=o,e.cH=ec,e.cI=jc,e.cJ=$r,e.cK=Ao,e.ca=e=>"custom"===e.type,e.cb=F,e.cc=function(e,t,i){const r=S(t.x-i.x,t.y-i.y),n=S(e.x-i.x,e.y-i.y);var o,s;return J(Math.atan2(r[0]*n[1]-r[1]*n[0],(o=r)[0]*(s=n)[0]+o[1]*s[1]))},e.cd=k,e.ce=function(e,t){return te[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)},e.cf=function(e,t){return ee[t]&&"touches"in e},e.cg=function(e){return ee[e]||te[e]},e.ch=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e},e.ci=function(e,t){const{x:i,y:r}=oh.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||i<0||i>=1)},e.cj=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.ck=class extends Uo{},e.cl=ad,e.cn=function(e){return e.message===ie},e.co=ae,e.cp=function(e,t){ne.REGISTERED_PROTOCOLS[e]=t},e.cq=function(e){delete ne.REGISTERED_PROTOCOLS[e]},e.cr=function(e,t){const i={};for(let r=0;re*Uc))}let y=a?"center":r.get("text-justify").evaluate(n,{},t.canonical);const v="point"===r.get("symbol-placement")?r.get("text-max-width").evaluate(n,{},t.canonical)*Uc:1/0,x=()=>{t.bucket.allowVerticalPlacement&&io(o)&&(f.vertical=ru(A,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,m,"left",p,g,e.al.vertical,!0,d,h))};if(!a&&_){const i=new Set;if("auto"===y)for(let e=0;e<_.values.length;e+=2)i.add(Vh(_.values[e]));else i.add(y);let r=!1;for(const n of i)if(!f.horizontal[n])if(r)f.horizontal[n]=f.horizontal[0];else{const i=ru(A,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,"center",n,p,g,e.al.horizontal,!1,d,h);i&&(f.horizontal[n]=i,r=1===i.positionedLines.length)}x()}else{"auto"===y&&(y=Vh(m));const i=ru(A,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,m,y,p,g,e.al.horizontal,!1,d,h);i&&(f.horizontal[y]=i),x(),io(o)&&a&&l&&(f.vertical=ru(A,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,m,y,p,g,e.al.vertical,!1,d,h))}}let _=!1;if(n.icon&&n.icon.name){const e=t.imageMap[n.icon.name];e&&(m=vu(t.imagePositions[n.icon.name],r.get("icon-offset").evaluate(n,{},t.canonical),r.get("icon-anchor").evaluate(n,{},t.canonical)),_=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=_:t.bucket.sdfIcons!==_&&V("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const y=$h(f.horizontal)||f.vertical;t.bucket.iconsInText=!!y&&y.iconsInText,(y||m)&&Hh(t.bucket,n,f,m,t.imageMap,o,d,p,g,_,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cx=xc,e.cy=Rl,e.cz=oc,e.d=ue,e.e=D,e.f=e=>t(void 0,void 0,void 0,(function*(){if(0===e.byteLength)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(e){throw new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),e.g=oe,e.h=e=>new Promise(((t,i)=>{const r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=q}))},r.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const n=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(n):q})),e.i=G,e.j=(e,t)=>ce(D(e,{type:"json"}),t),e.k=fe,e.l=pe,e.m=ce,e.n=(e,t)=>ce(D(e,{type:"arrayBuffer"}),t),e.o=function(e){return new Vc(e).readFields(Gc,[])},e.p=Kc,e.q=Va,e.r=Io,e.s=Y,e.t=Qn,e.u=to,e.v=me,e.w=V,e.x=Gn,e.y=Nn,e.z=function([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(i),y:e*Math.sin(t)*Math.sin(i),z:e*Math.cos(i)}}})),i("worker",["./shared"],(function(e){class t{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,i){for(const i of t){this._layerConfigs[i.id]=i;const t=this._layers[i.id]=e.bA(i);t._featureFilter=e.a7(t.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const e of i)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const r=e.cr(Object.values(this._layerConfigs),this.keyCache);for(const e of r){const t=e.map((e=>this._layers[e.id])),i=t[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const o=i.sourceLayer||"_geojsonTileLayer";let s=n[o];s||(s=n[o]=[]),s.push(t)}}}class i{constructor(t){const i={},r=[];for(const e in t){const n=t[e],o=i[e]={};for(const e in n){const t=n[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(i),o[e]={rect:i,metrics:t.metrics}}}const{w:n,h:o}=e.p(r),s=new e.q({width:n||1,height:o||1});for(const r in t){const n=t[r];for(const t in n){const o=n[+t];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const a=i[r][t].rect;e.q.copy(o.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},o.bitmap)}}this.image=s,this.positions=i}}e.cs("GlyphAtlas",i);class r{constructor(t){this.tileID=new e.Y(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,r,o,s,a){return e._(this,void 0,void 0,(function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.a5;const l=new e.ct(Object.keys(t.layers).sort()),c=new e.cu(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:o,subdivisionGranularity:a},d=r.familiesBySource[this.source];for(const i in d){const r=t.layers[i];if(!r)continue;1===r.version&&e.w(`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 e=0;e=i.maxzoom||"none"!==i.visibility&&(n(t,this.zoom,o),(u[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:s,sourceID:this.source})).populate(a,h,this.tileID.canonical),c.bucketLayerIDs.push(t.map((e=>e.id))))}}const p=e.bF(h.glyphDependencies,(e=>Object.keys(e).map(Number)));this.inFlightDependencies.forEach((e=>null==e?void 0:e.abort())),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){const e=new AbortController;this.inFlightDependencies.push(e),f=s.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}const A=Object.keys(h.iconDependencies);let m=Promise.resolve({});if(A.length){const e=new AbortController;this.inFlightDependencies.push(e),m=s.sendAsync({type:"GI",data:{icons:A,source:this.source,tileID:this.tileID,type:"icons"}},e)}const g=Object.keys(h.patternDependencies);let _=Promise.resolve({});if(g.length){const e=new AbortController;this.inFlightDependencies.push(e),_=s.sendAsync({type:"GI",data:{icons:g,source:this.source,tileID:this.tileID,type:"patterns"}},e)}const[y,v,x]=yield Promise.all([f,m,_]),b=new i(y),w=new e.cv(v,x);for(const t in u){const i=u[t];i instanceof e.a6?(n(i.layers,this.zoom,o),e.cw({bucket:i,glyphMap:y,glyphPositions:b.positions,imageMap:v,imagePositions:w.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:h.subdivisionGranularity})):i.hasPattern&&(i instanceof e.cx||i instanceof e.cy||i instanceof e.cz)&&(n(i.layers,this.zoom,o),i.addFeatures(h,this.tileID.canonical,w.patternPositions))}return this.status="done",{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:b.image,imageAtlas:w,glyphMap:this.returnDependencies?y:null,iconMap:this.returnDependencies?v:null,glyphPositions:this.returnDependencies?b.positions:null}}))}}function n(t,i,r){const n=new e.C(i);for(const e of t)e.recalculate(n,r)}class o{constructor(e,t,i){this.actor=e,this.layerIndex=t,this.availableImages=i,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(t,i){return e._(this,void 0,void 0,(function*(){const r=yield e.n(t.request,i);try{return{vectorTile:new e.cA.VectorTile(new e.cB(r.data)),rawData:r.data,cacheControl:r.cacheControl,expires:r.expires}}catch(e){const i=new Uint8Array(r.data);let n=`Unable to parse the tile at ${t.request.url}, `;throw n+=31===i[0]&&139===i[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${e.message}`,new Error(n)}}))}loadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.uid,n=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.cC(t.request),o=new r(t);this.loading[i]=o;const s=new AbortController;o.abort=s;try{const r=yield this.loadVectorTile(t,s);if(delete this.loading[i],!r)return null;const a=r.rawData,l={};r.expires&&(l.expires=r.expires),r.cacheControl&&(l.cacheControl=r.cacheControl);const c={};if(n){const e=n.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)))}o.vectorTile=r.vectorTile;const u=o.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);this.loaded[i]=o,this.fetching[i]={rawTileData:a,cacheControl:l,resourceTiming:c};try{const t=yield u;return e.e({rawTileData:a.slice(0)},t,l,c)}finally{delete this.fetching[i]}}catch(e){throw delete this.loading[i],o.status="done",this.loaded[i]=o,e}}))}reloadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.uid;if(!this.loaded||!this.loaded[i])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const r=this.loaded[i];if(r.showCollisionBoxes=t.showCollisionBoxes,"parsing"===r.status){const n=yield r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);let o;if(this.fetching[i]){const{rawTileData:t,cacheControl:r,resourceTiming:s}=this.fetching[i];delete this.fetching[i],o=e.e({rawTileData:t.slice(0)},n,r,s)}else o=n;return o}if("done"===r.status&&r.vectorTile)return r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){const e=this.loading,i=t.uid;e&&e[i]&&e[i].abort&&(e[i].abort.abort(),delete e[i])}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid]}))}}class s{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,(function*(){const{uid:i,encoding:r,rawImageData:n,redFactor:o,greenFactor:s,blueFactor:a,baseShift:l}=t,c=n.width+2,u=n.height+2,h=e.b(n)?new e.R({width:c,height:u},yield e.cD(n,-1,-1,c,u)):n,d=new e.cE(i,h,r,o,s,a,l);return this.loaded=this.loaded||{},this.loaded[i]=d,d}))}removeTile(e){const t=this.loaded,i=e.uid;t&&t[i]&&delete t[i]}}var a,l,c=function(){if(l)return a;function e(e,i){if(0!==e.length){t(e[0],i);for(var r=1;r=Math.abs(a)?i-l+a:a-l+i,i=l}i+r>=0!=!!t&&e.reverse()}return l=1,a=function t(i,r){var n,o=i&&i.type;if("FeatureCollection"===o)for(n=0;n>31}function c(e,t){for(var i=e.loadGeometry(),r=e.type,n=0,o=0,s=i.length,c=0;ce},x=Math.fround||(b=new Float32Array(1),e=>(b[0]=+e,b[0]));var b;const w=3,T=5,B=6;class C{constructor(e){this.options=Object.assign(Object.create(v),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let t=0;t=i;e--){const i=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){const e=this.getClusters([i,r,180,o],t),s=this.getClusters([-180,r,n,o],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(M(i),I(o),M(n),I(r)),l=s.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+T]>1?S(l,t,this.clusterProps):this.points[l[t+w]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(t*this.stride>=o.length)throw new Error(r);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=n.within(o[t*this.stride],o[t*this.stride+1],s),l=[];for(const t of a){const i=t*this.stride;o[i+4]===e&&l.push(o[i+T]>1?S(o,i,this.clusterProps):this.points[o[i+w]])}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,i){const r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){const r=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/n,c=(i+1+a)/n,u={features:[]};return this._addTileFeatures(r.range((t-a)/n,l,(t+1+a)/n,c),r.data,t,i,n,u),0===t&&this._addTileFeatures(r.range(1-a/n,l,1,c),r.data,n,i,n,u),t===n-1&&this._addTileFeatures(r.range(0,l,a/n,c),r.data,-1,i,n,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,r,n){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?n+o.point_count<=r?n+=o.point_count:n=this._appendLeaves(e,o.cluster_id,i,r,n):n1;let l,c,u;if(a)l=E(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+w]];l=i.properties;const[r,n]=i.geometry.coordinates;c=M(r),u=I(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(u*n-r))]],tags:l};let d;d=a||this.options.generateId?t[e+w]:this.points[t[e+w]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:r,reduce:n,minPoints:o}=this.options,s=i/(r*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let i=0;it&&(p+=a[i+T])}if(p>d&&p>=o){let e,o=r*d,s=u*d,f=-1;const A=(i/c<<5)+(t+1)+this.points.length;for(const r of h){const l=r*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+T];o+=a[l]*u,s+=a[l+1]*u,a[l+4]=A,n&&(e||(e=this._map(a,i,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(a,l)))}a[i+4]=A,l.push(o/p,s/p,1/0,A,-1,p),n&&l.push(f)}else{for(let e=0;e1)for(const e of h){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+T]>1){const r=this.clusterProps[e[t+B]];return i?Object.assign({},r):r}const r=this.points[e[t+w]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function S(e,t,i){return{type:"Feature",id:e[t+w],properties:E(e,t,i),geometry:{type:"Point",coordinates:[(r=e[t],360*(r-.5)),P(e[t+1])]}};var r}function E(e,t,i){const r=e[t+T],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+B],s=-1===o?{}:Object.assign({},i[o]);return Object.assign(s,{cluster:!0,cluster_id:e[t+w],point_count:r,point_count_abbreviated:n})}function M(e){return e/360+.5}function I(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function P(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function L(e,t,i,r){let n=r;const o=t+(i-t>>1);let s,a=i-t;const l=e[t],c=e[t+1],u=e[i],h=e[i+1];for(let r=t+3;rn)s=r,n=t;else if(t===n){const e=Math.abs(r-o);er&&(s-t>3&&L(e,t,s,r),e[s+2]=n,i-s>3&&L(e,s,i,r))}function F(e,t,i,r,n,o){let s=n-i,a=o-r;if(0!==s||0!==a){const l=((e-i)*s+(t-r)*a)/(s*s+a*a);l>1?(i=n,r=o):l>0&&(i+=s*l,r+=a*l)}return s=e-i,a=t-r,s*s+a*a}function k(e,t,i,r){const n={id:null==e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)z(n,i);else if("Polygon"===t)z(n,i[0]);else if("MultiLineString"===t)for(const e of i)z(n,e);else if("MultiPolygon"===t)for(const e of i)z(n,e[0]);return n}function z(e,t){for(let i=0;i0&&(s+=r?(n*l-a*o)/2:Math.sqrt(Math.pow(a-n,2)+Math.pow(l-o,2))),n=a,o=l}const a=t.length-3;t[2]=1,L(t,0,a,i),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function U(e,t,i,r){for(let n=0;n1?1:i}function j(e,t,i,r,n,o,s,a){if(r/=t,o>=(i/=t)&&s=r)return null;const l=[];for(const t of e){const e=t.geometry;let o=t.type;const s=0===n?t.minX:t.minY,c=0===n?t.maxX:t.maxY;if(s>=i&&c=r)continue;let u=[];if("Point"===o||"MultiPoint"===o)V(e,u,i,r,n);else if("LineString"===o)H(e,u,i,r,n,!1,a.lineMetrics);else if("MultiLineString"===o)$(e,u,i,r,n,!1);else if("Polygon"===o)$(e,u,i,r,n,!0);else if("MultiPolygon"===o)for(const t of e){const e=[];$(t,e,i,r,n,!0),e.length&&u.push(e)}if(u.length){if(a.lineMetrics&&"LineString"===o){for(const e of u)l.push(k(t.id,o,e,t.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===u.length?(o="LineString",u=u[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===u.length?"Point":"MultiPoint"),l.push(k(t.id,o,u,t.tags))}}return l.length?l:null}function V(e,t,i,r,n){for(let o=0;o=i&&s<=r&&Z(t,e[o],e[o+1],e[o+2])}}function H(e,t,i,r,n,o,s){let a=G(e);const l=0===n?q:K;let c,u,h=e.start;for(let d=0;di&&(u=l(a,p,f,m,g,i),s&&(a.start=h+c*u)):_>r?y=i&&(u=l(a,p,f,m,g,i),v=!0),y>r&&_<=r&&(u=l(a,p,f,m,g,r),v=!0),!o&&v&&(s&&(a.end=h+c*u),t.push(a),a=G(e)),s&&(h+=c)}let d=e.length-3;const p=e[d],f=e[d+1],A=0===n?p:f;A>=i&&A<=r&&Z(a,p,f,e[d+2]),d=a.length-3,o&&d>=3&&(a[d]!==a[0]||a[d+1]!==a[1])&&Z(a,a[0],a[1],a[2]),a.length&&t.push(a)}function G(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function $(e,t,i,r,n,o){for(const s of e)H(s,t,i,r,n,o,!1)}function Z(e,t,i,r){e.push(t,i,r)}function q(e,t,i,r,n,o){const s=(o-t)/(r-t);return Z(e,o,i+(n-i)*s,1),s}function K(e,t,i,r,n,o){const s=(o-i)/(n-i);return Z(e,t+(r-t)*s,o,1),s}function W(e,t){const i=[];for(let r=0;r0&&t.size<(n?s:r))return void(i.numPoints+=t.length/3);const a=[];for(let e=0;es)&&(i.numSimplified++,a.push(t[e],t[e+1])),i.numPoints++;n&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t0===t)for(let t=0,i=e.length;t24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let r=0;r1&&console.time("creation"),d=this.tiles[h]=ee(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==n){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(i!==o>>e||r!==s>>e)continue}}if(d.source=null,0===e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,A=.5+p,m=1+p;let g=null,_=null,y=null,v=null,x=j(e,u,i-p,i+A,0,d.minX,d.maxX,l),b=j(e,u,i+f,i+m,0,d.minX,d.maxX,l);e=null,x&&(g=j(x,u,r-p,r+A,1,d.minY,d.maxY,l),_=j(x,u,r+f,r+m,1,d.minY,d.maxY,l),x=null),b&&(y=j(b,u,r-p,r+A,1,d.minY,d.maxY,l),v=j(b,u,r+f,r+m,1,d.minY,d.maxY,l),b=null),c>1&&console.timeEnd("clipping"),a.push(g||[],t+1,2*i,2*r),a.push(_||[],t+1,2*i,2*r+1),a.push(y||[],t+1,2*i+1,2*r),a.push(v||[],t+1,2*i+1,2*r+1)}}getTile(e,t,i){e=+e,t=+t,i=+i;const r=this.options,{extent:n,debug:o}=r;if(e<0||e>24)return null;const s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);let l,c=e,u=t,h=i;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[oe(c,u,h)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,u,h),console.time("drilling down")),this.splitTile(l.source,c,u,h,e,t,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?Y(this.tiles[a],n):null):null}}function oe(e,t,i){return 32*((1<{s.properties=e;const t={};for(const e of a)t[e]=r[e].evaluate(o,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)o.accumulated=e[t],e[t]=n[t].evaluate(o,s)},t}(t)).load((yield this._pendingData).features):(n=yield this._pendingData,new ne(n,t.geojsonVtOptions)),this.loaded={};const i={};if(r){const e=r.finish();e&&(i.resourceTiming={},i.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}return i}catch(t){if(delete this._pendingRequest,e.cn(t))return{abandoned:!0};throw t}var n}))}getData(){return e._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(e){const t=this.loaded;return t&&t[e.uid]?super.reloadTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,i){return e._(this,void 0,void 0,(function*(){let r=yield this.loadGeoJSON(t,i);if(delete this._pendingRequest,"object"!=typeof r)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(u(r,!0),t.filter){const i=e.cJ(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));const n=r.features.filter((e=>i.value.evaluate({zoom:0},e)));r={type:"FeatureCollection",features:n}}return r}))}loadGeoJSON(t,i){return e._(this,void 0,void 0,(function*(){const{promoteId:r}=t;if(t.request){const n=yield e.j(t.request,i);return this._dataUpdateable=ae(n.data,r)?le(n.data,r):void 0,n.data}if("string"==typeof t.data)try{const e=JSON.parse(t.data);return this._dataUpdateable=ae(e,r)?le(e,r):void 0,e}catch(e){throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}if(!t.dataDiff)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${t.source}`);return function(e,t,i){var r,n,o,s;if(t.removeAll&&e.clear(),t.remove)for(const i of t.remove)e.delete(i);if(t.add)for(const r of t.add){const t=se(r,i);null!=t&&e.set(t,r)}if(t.update)for(const i of t.update){let t=e.get(i.id);if(null==t)continue;const a=!i.removeAllProperties&&((null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0||(null===(n=i.addOrUpdateProperties)||void 0===n?void 0:n.length)>0);if((i.newGeometry||i.removeAllProperties||a)&&(t=Object.assign({},t),e.set(i.id,t),a&&(t.properties=Object.assign({},t.properties))),i.newGeometry&&(t.geometry=i.newGeometry),i.removeAllProperties)t.properties={};else if((null===(o=i.removeProperties)||void 0===o?void 0:o.length)>0)for(const e of i.removeProperties)Object.prototype.hasOwnProperty.call(t.properties,e)&&delete t.properties[e];if((null===(s=i.addOrUpdateProperties)||void 0===s?void 0:s.length)>0)for(const{key:e,value:r}of i.addOrUpdateProperties)t.properties[e]=r}}(this._dataUpdateable,t.dataDiff,r),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(t){return e._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}class ue{constructor(t){this.self=t,this.actor=new e.H(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cp,this.self.removeProtocol=e.cq,this.self.registerRTLTextPlugin=t=>{e.cK.setMethods(t)},this.actor.registerMessageHandler("LDT",((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler("RDT",((t,i)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,i.source).removeTile(i)})))),this.actor.registerMessageHandler("GCEZ",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterExpansionZoom(i)})))),this.actor.registerMessageHandler("GCC",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterChildren(i)})))),this.actor.registerMessageHandler("GCL",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterLeaves(i)})))),this.actor.registerMessageHandler("LD",((e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler("GD",((e,t)=>this._getWorkerSource(e,t.type,t.source).getData())),this.actor.registerMessageHandler("LT",((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler("RT",((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler("AT",((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler("RMT",((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler("RS",((t,i)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[t]||!this.workerSources[t][i.type]||!this.workerSources[t][i.type][i.source])return;const e=this.workerSources[t][i.type][i.source];delete this.workerSources[t][i.type][i.source],void 0!==e.removeSource&&e.removeSource(i)})))),this.actor.registerMessageHandler("RM",(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t]})))),this.actor.registerMessageHandler("SR",((t,i)=>e._(this,void 0,void 0,(function*(){this.referrer=i})))),this.actor.registerMessageHandler("SRPS",((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler("IS",((t,i)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(i)})))),this.actor.registerMessageHandler("SI",((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler("UL",((t,i)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(i.layers,i.removedIds)})))),this.actor.registerMessageHandler("SL",((t,i)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(i)}))))}_setImages(t,i){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=i;for(const e in this.workerSources[t]){const r=this.workerSources[t][e];for(const e in r)r[e].availableImages=i}}))}_syncRTLPluginState(t,i){return e._(this,void 0,void 0,(function*(){return yield e.cK.syncState(i,this.self.importScripts)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let i=this.layerIndexes[e];return i||(i=this.layerIndexes[e]=new t),i}_getWorkerSource(e,t,i){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][i]){const r={sendAsync:(t,i)=>(t.targetMapId=e,this.actor.sendAsync(t,i))};switch(t){case"vector":this.workerSources[e][t][i]=new o(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][i]=new ce(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][i]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][i]}_getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new s),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new ue(self)),ue})),i("index",["exports","./shared"],(function(e,t){var i="5.4.0";function r(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let n,o;const s={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(e,i,r){const n=requestAnimationFrame((e=>{o(),i(e)})),{unsubscribe:o}=t.s(e.signal,"abort",(()=>{o(),cancelAnimationFrame(n),r(t.c())}),!1)},frameAsync(e){return new Promise(((t,i)=>{this.frame(e,t,i)}))},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){const t=window.document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0,e.width,e.height),i},resolveURL:e=>(n||(n=document.createElement("a")),n.href=e,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==o&&(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)}};class a{static testProp(e){if(!a.docStyle)return e[0];for(let t=0;t{window.removeEventListener("click",a.suppressClickInternal,!0)}),0)}static getScale(e){const t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,i,r){const n=i.boundingClientRect;return new t.P((r.clientX-n.left)/i.x-e.clientLeft,(r.clientY-n.top)/i.y-e.clientTop)}static mousePos(e,t){const i=a.getScale(e);return a.getPoint(e,i,t)}static touchPos(e,t){const i=[],r=a.getScale(e);for(let n=0;n{c&&p(c),c=null,d=!0},u.onerror=()=>{h=!0,c=null},u.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let i,r,n,o;e.resetRequestQueue=()=>{i=[],r=0,n=0,o={}},e.addThrottleControl=e=>{const t=n++;return o[t]=e,t},e.removeThrottleControl=e=>{delete o[e],a()},e.getImage=(e,r,n=!0)=>new Promise(((o,s)=>{l.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),t.e(e,{type:"image"}),i.push({abortController:r,requestParameters:e,supportImageRefresh:n,state:"queued",onError:e=>{s(e)},onSuccess:e=>{o(e)}}),a()}));const s=e=>t._(this,void 0,void 0,(function*(){e.state="running";const{requestParameters:i,supportImageRefresh:n,onError:o,onSuccess:s,abortController:l}=e,u=!1===n&&!t.i(self)&&!t.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce(((e,t)=>e&&"accept"===t),!0));r++;const h=u?c(i,l):t.m(i,l);try{const i=yield h;delete e.abortController,e.state="completed",i.data instanceof HTMLImageElement||t.b(i.data)?s(i):i.data&&s({data:yield(d=i.data,"function"==typeof createImageBitmap?t.f(d):t.h(d)),cacheControl:i.cacheControl,expires:i.expires})}catch(t){delete e.abortController,o(t)}finally{r--,a()}var d})),a=()=>{const e=(()=>{for(const e of Object.keys(o))if(o[e]())return!0;return!1})()?t.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t0;t++){const e=i.shift();e.abortController.signal.aborted?t--:s(e)}},c=(e,i)=>new Promise(((r,n)=>{const o=new Image,s=e.url,a=e.credentials;a&&"include"===a?o.crossOrigin="use-credentials":(a&&"same-origin"===a||!t.d(s))&&(o.crossOrigin="anonymous"),i.signal.addEventListener("abort",(()=>{o.src="",n(t.c())})),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,r({data:o})},o.onerror=()=>{o.onerror=o.onload=null,i.signal.aborted||n(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."))},o.src=s}))}(f||(f={})),f.resetRequestQueue();class A{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function m(e){const t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){const i=[];for(const{id:r,url:n}of e){const e=`${r}${n}`;-1===i.indexOf(e)&&(i.push(e),t.push({id:r,url:n}))}}return t}function g(e,t,i){try{const r=new URL(e);return r.pathname+=`${t}${i}`,r.toString()}catch(t){throw new Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class _{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,r)}update(e,i,r){const{width:n,height:o}=e,s=!(this.size&&this.size[0]===n&&this.size[1]===o||r),{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=[n,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.b(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,n,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:s}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.b(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,s,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,s,n,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,i){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),e!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function y(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class v extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const e=i.spriteData;i.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}addImage(e,t){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,i){let r=!0;const n=i.data||i.spriteData;return this._validateStretch(i.stretchX,n&&n.width)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,n&&n.height)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let i=0;for(const r of e){if(r[0]{let r=!0;if(!this.isLoaded())for(const t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})}))}_getImagesForIds(e){const i={};for(const r of e){let e=this.getImage(r);e||(this.fire(new t.l("styleimagemissing",{id:r})),e=this.getImage(r)),e?i[r]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.w(`Image "${r}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){const{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){const i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{const i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new t.I(i,r);this.patterns[e]={bin:i,position:n}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new _(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:r}=t.p(e),n=this.atlasImage;n.resize({width:i||1,height:r||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],r=i.x+1,o=i.y+1,s=this.getImage(e).data,a=s.width,l=s.height;t.R.copy(s,n,{x:0,y:0},{x:r,y:o},{width:a,height:l}),t.R.copy(s,n,{x:0,y:l-1},{x:r,y:o-1},{width:a,height:1}),t.R.copy(s,n,{x:0,y:0},{x:r,y:o+l},{width:a,height:1}),t.R.copy(s,n,{x:a-1,y:0},{x:r-1,y:o},{width:1,height:l}),t.R.copy(s,n,{x:0,y:0},{x:r+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.w(`Image with ID: "${i}" was not found`),y(e)&&this.updateImage(i,e)}}}const x=1e20;function b(e,t,i,r,n,o,s,a,l){for(let c=t;c-1);l++,o[l]=a,s[l]=c,s[l+1]=x}for(let a=0,l=0;a65535)throw new Error("glyphs > 65535 not supported");if(t.ranges[n])return{stack:e,id:i,glyph:r};if(!this.url)throw new Error("glyphsUrl is not set");if(!t.requests[n]){const i=T.loadGlyphRange(e,n,this.url,this.requestManager);t.requests[n]=i}const o=yield t.requests[n];for(const e in o)this._doesCharSupportLocalGlyph(+e)||(t.glyphs[+e]=o[+e]);return t.ranges[n]=!0,{stack:e,id:i,glyph:o[i]||null}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))||t.u["CJK Unified Ideographs"](e)||t.u["Hangul Syllables"](e)||t.u.Hiragana(e)||t.u.Katakana(e)||t.u["CJK Symbols and Punctuation"](e)||t.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,r){const n=this.localIdeographFontFamily;if(!n)return;if(!this._doesCharSupportLocalGlyph(r))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 T.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:t})}const s=o.draw(String.fromCharCode(r));return{id:r,bitmap:new t.q({width:s.width||60,height:s.height||60},s.data),metrics:{width:s.glyphWidth/2||24,height:s.glyphHeight/2||24,left:s.glyphLeft/2+.5||0,top:s.glyphTop/2-27.5||-8,advance:s.glyphAdvance/2||24,isDoubleResolution:!0}}}}T.loadGlyphRange=function(e,i,r,n){return t._(this,void 0,void 0,(function*(){const o=256*i,s=o+255,a=n.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${o}-${s}`),"Glyphs"),l=yield t.n(a,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${i}, ${o}-${s}`);const c={};for(const e of t.o(l.data))c[e.id]=e;return c}))},T.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=r,this.radius=i;const a=this.size=e+4*t,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${o} ${e}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,s+Math.ceil(r)),c=a+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return p;const{ctx:f,buffer:A,gridInner:m,gridOuter:g}=this;f.clearRect(A,A,a,l),f.fillText(e,A,A+s);const _=f.getImageData(A,A,a,l);g.fill(x,0,h),m.fill(0,0,h);for(let e=0;e0?e*e:0,m[r]=e<0?e*e:0}}b(g,0,0,c,u,c,this.f,this.v,this.z),b(m,A,A,a,l,c,this.f,this.v,this.z);for(let e=0;e1&&(s=e[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),u=Math.min(l,c);let h;const d=t/i*(r+1);if(s.isDash){const e=r-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=r-Math.sqrt(u*u+d*d);this.data[n+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){const i=e[t],r=e[t+1];i.zeroLength?e.splice(t,1):r&&r.isDash===i.isDash&&(r.left=i.left,e.splice(t,1))}const t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);const r=this.width*this.nextRow;let n=0,o=e[n];for(let t=0;t1&&(o=e[++n]);const i=Math.abs(t-o.left),s=Math.abs(t-o.right),a=Math.min(i,s);this.data[r+t]=Math.max(0,Math.min(255,(o.isDash?a:-a)+128))}}addDash(e,i){const r=i?7:0,n=2*r+1;if(this.nextRow+n>this.height)return t.w("LineAtlas out of space"),null;let o=0;for(let t=0;t{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[P]}numActive(){return Object.keys(this.active).length}}const F=Math.floor(s.hardwareConcurrency/2);let k,z;function R(){return k||(k=new L),k}L.workerCount=t.G(globalThis)?Math.max(Math.min(F,3),1):1;class D{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let e=0;e{e.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(const i of this.actors)i.registerMessageHandler(e,t)}}function O(){return z||(z=new D(R(),t.J),z.registerMessageHandler("GR",((e,i,r)=>t.m(i,r)))),z}function U(e,i){const r=t.K();return t.L(r,r,[1,1,0]),t.M(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.N(r,r,e.calculatePosMatrix(i.toUnwrapped())):r}function N(e,t,i,r,n,o,s){var a;const l=function(e,t,i){if(e)for(const r of e){const e=t[r];if(e&&e.source===i&&"fill-extrusion"===e.type)return!0}else for(const e in t){const r=t[e];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(null!==(a=null==n?void 0:n.layers)&&void 0!==a?a:null,t,e.id),c=o.maxPitchScaleFactor(),u=e.tilesIn(r,c,l);u.sort(Q);const h=[];for(const r of u)h.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,i,e._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,n,o,c,U(e.transform,r.tileID),s?(e,t)=>s(r.tileID,e,t):void 0)});return function(e,t){for(const i in e)for(const r of e[i])j(r,t);return e}(function(e){const t={},i={};for(const r of e){const e=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in e){const r=e[i],n=o[i]=o[i]||{},s=t[i]=t[i]||[];for(const e of r)n[e.featureIndex]||(n[e.featureIndex]=!0,s.push(e))}}return t}(h),e)}function Q(e,t){const i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function j(e,t){const i=e.feature,r=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=r}function V(e,i,r){return t._(this,void 0,void 0,(function*(){let n=e;if(e.url?n=(yield t.j(i.transformRequest(e.url,"Source"),r)).data:yield s.frameAsync(r),!n)return null;const o=t.O(t.e(n,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(o.vectorLayerIds=n.vector_layers.map((e=>e.id))),o}))}class H{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.Q?new t.Q(e.lng,e.lat):t.Q.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.Q?new t.Q(e.lng,e.lat):t.Q.convert(e),this}extend(e){const i=this._sw,r=this._ne;let n,o;if(e instanceof t.Q)n=e,o=e;else{if(!(e instanceof H))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(H.convert(e)):this.extend(t.Q.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.Q.convert(e)):this;if(n=e._sw,o=e._ne,!n||!o)return this}return i||r?(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(o.lng,r.lng),r.lat=Math.max(o.lat,r.lat)):(this._sw=new t.Q(n.lng,n.lat),this._ne=new t.Q(o.lng,o.lat)),this}getCenter(){return new t.Q((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.Q(this.getWest(),this.getNorth())}getSouthEast(){return new t.Q(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:r}=t.Q.convert(e);let n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(e){return e instanceof H?e:e?new H(e):e}static fromLngLat(e,i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*e.lat);return new H(new t.Q(e.lng-n,e.lat-r),new t.Q(e.lng+n,e.lat+r))}adjustAntiMeridian(){const e=new t.Q(this._sw.lng,this._sw.lat),i=new t.Q(this._ne.lng,this._ne.lat);return new H(e,e.lng>i.lng?new t.Q(i.lng+360,i.lat):i)}}class G{constructor(e,t,i){this.bounds=H.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),r=Math.floor(t.U(this.bounds.getWest())*i),n=Math.floor(t.S(this.bounds.getNorth())*i),o=Math.ceil(t.U(this.bounds.getEast())*i),s=Math.ceil(t.S(this.bounds.getSouth())*i);return e.x>=r&&e.x=n&&e.y{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise(((t,i)=>{e.reloadPromise={resolve:t,reject:i}}))}else e.actor=this.dispatcher.getActor(),r="LT";e.abortController=new AbortController;try{const t=yield e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t)}catch(t){if(delete e.abortController,e.aborted)return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}}))}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){const t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Z extends t.E{constructor(e,i,r,n){super(),this.id=e,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.e({type:"raster"},i),t.e(this,t.O(i,["url","scheme","tileSize"]))}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield V(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new G(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this.fire(new t.k(e))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const i=yield f.getImage(this.map._requestManager.transformRequest(t,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const t=this.map.painter.context,r=t.gl,n=i.data;e.texture=this.map.painter.getTileTexture(n.width),e.texture?e.texture.update(n,{useMipmap:!0}):(e.texture=new _(t,n,r.RGBA,{useMipmap:!0}),e.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class q extends Z{constructor(e,i,r,n){super(e,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const i=yield f.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i&&i.data){const r=i.data;this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const n=t.b(r)&&t.V()?r:yield this.readImageNow(r),o={type:this.type,uid:e.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||"expired"===e.state){e.actor=this.dispatcher.getActor();const t=yield e.actor.sendAsync({type:"LDT",data:o});e.dem=t,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}))}readImageNow(e){return t._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&t.W()){const i=e.width+2,r=e.height+2;try{return new t.R({width:i,height:r},yield t.X(e,-1,-1,i,r))}catch(e){}}return s.getImageData(e,1)}))}_getNeighboringTiles(e){const i=e.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?e.wrap-1:e.wrap,s=(i.x+1+r)%r,a=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.Y(e.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new t.Y(e.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new t.Y(e.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new t.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.Y(e.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1e.coordinates)).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return t._(this,void 0,void 0,(function*(){const e=new H,t=yield this.getData();let i;switch(t.type){case"FeatureCollection":i=t.features.map((e=>this.getCoordinatesFromGeometry(e.geometry))).flat(1/0);break;case"Feature":i=this.getCoordinatesFromGeometry(t.geometry);break;default:i=this.getCoordinatesFromGeometry(t)}if(0==i.length)return e;for(let t=0;t0&&t.e(n,{resourceTiming:r}),this.fire(new t.l("data",Object.assign(Object.assign({},n),{sourceDataType:"metadata"}))),this.fire(new t.l("data",Object.assign(Object.assign({},n),{sourceDataType:"content"})))}catch(e){if(this._pendingLoads--,this._removed)return void this.fire(new t.l("dataabort",{dataType:"source"}));this.fire(new t.k(e))}}))}loaded(){return 0===this._pendingLoads}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.actor?"RT":"LT";e.actor=this.actor;const i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const r=yield this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,"RT"===t)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return t.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class W extends t.E{constructor(e,t,i,r){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}load(e){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const t=yield f.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,this.fire(new t.k(e))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(t.$.fromLngLat);var r;return this.tileID=function(e){let i=1/0,r=1/0,n=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),r=Math.min(r,t.y),n=Math.max(n,t.x),o=Math.max(o,t.y);const s=Math.max(n-i,o-r),a=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),l=Math.pow(2,a);return new t.a1(a,Math.floor((i+n)/2*l),Math.floor((r+o)/2*l))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map((e=>this.tileID.getTilePoint(e)._round())),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new t.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new _(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let i=1/0,r=1/0,n=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),r=Math.min(r,t.y),n=Math.max(n,t.x),o=Math.max(o,t.y);const s={};for(let e=0;e<=t.a0;e++){const t=Math.pow(2,e),a=Math.floor(i*t),l=Math.floor(r*t),c=Math.floor(n*t),u=Math.floor(o*t);s[e]={minTileX:a,minTileY:l,maxTileX:c,maxTileY:u}}return s}}class X extends W{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{const e=yield t.a2(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.k(e))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;ei.end(0)?this.fire(new t.k(new t.a3(`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(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;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 _(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Y extends W{constructor(e,i,r,n){super(e,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new t.k(new t.a3(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.k(new t.a3(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.k(new t.a3(`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.k(new t.a3(`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.k(new t.a3(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}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,r=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new _(i,this.canvas,r.RGBA,{premultiply:!0});let n=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,n=!0)}n&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const J={},ee=e=>{switch(e){case"geojson":return K;case"image":return W;case"raster":return Z;case"raster-dem":return q;case"vector":return $;case"video":return X;case"canvas":return Y}return J[e]},te="RTLPluginLoaded";class ie extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=O()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((e=>{throw this.status="error",e}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,(function*(e,t=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=s.resolveURL(e),!this.url)throw new Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}))}_requestImport(){return t._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new t.l(te))}))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let re=null;function ne(){return re||(re=new ie),re}class oe{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const t=e+this.timeAdded;tt.getLayer(e))).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.id]=r}}return i}(e.buckets,null==i?void 0:i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.a6){if(this.hasSymbolBuckets=!0,!r)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.a6&&i.hasRTLText){this.hasRTLText=!0,ne().lazyLoad();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const i=this.buckets[t];i.uploadPending()&&i.upload(e)}const t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new _(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new _(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,n,o,s,a,l,c,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:a,params:s,queryPadding:this.queryPadding*l,getElevation:u},e,t,i):{}}querySourceFeatures(e,i){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),o=i&&i.sourceLayer?i.sourceLayer:"",s=n._geojsonTileLayer||n[o];if(!s)return;const a=t.a7(i&&i.filter),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let i=0;ie)t=!1;else if(i)if(this.expirationTime{this.remove(e,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const r of this.data[i])e(r.value)||t.push(r);for(const e of t)this.remove(e.value.tileID,e)}}class ae{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,r){const n=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},t.e(this.stateChanges[e][n],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==n&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][n]){this.deletedStates[e][n]={};for(const t in this.state[e][n])r[t]||(this.deletedStates[e][n][t]=null)}else for(const t in r)this.deletedStates[e]&&this.deletedStates[e][n]&&null===this.deletedStates[e][n][t]&&delete this.deletedStates[e][n][t]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,i){const r=String(i),n=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return{};for(const e in t)delete n[e]}return n}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,i){const r={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),i[r]=this.state[e][r];r[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]}r[e]=r[e]||{},t.e(r[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const t in e)e[t].setFeatureState(r,i)}}const le=89.25;function ce(e,i){const r=t.ae(i.lat,-85.051129,t.af);return new t.P(t.U(i.lng)*e,t.S(r)*e)}function ue(e,i){return new t.$(i.x/e,i.y/e).toLngLat()}function he(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.ab(90-e.pitch)),Math.tan(t.ab(le-e.pitch)))}function de(e,i){const r=e.canonical,n=i/t.ac(r.z),o=r.x+Math.pow(2,r.z)*e.wrap,s=t.ad(new Float64Array(16));return t.L(s,s,[o*n,r.y*n,0]),t.M(s,s,[n/t.Z,n/t.Z,1]),s}function pe(e,i,r,n,o){const s=t.$.fromLngLat(e,i),a=o*t.ag(1,e.lat),l=a*Math.cos(t.ab(r)),c=Math.sqrt(a*a-l*l),u=c*Math.sin(t.ab(-n)),h=c*Math.cos(t.ab(-n));return new t.$(s.x+u,s.y+h,s.z+l)}function fe(e,t,i){const r=t.intersectsFrustum(e);if(!i)return r;const n=t.intersectsPlane(i);return 0===r||0===n?0:2===r&&2===n?2:1}function Ae(e,t,i){let r=0;const n=(i-t)/10;for(let o=0;o<10;o++)r+=n*Math.pow(Math.cos(t+(o+.5)/10*(i-t)),e);return r}function me(e,i){return function(r,n,o,s,a){const l=2*((e-1)/t.ah(Math.cos(t.ab(le-a))/Math.cos(t.ab(le)))-1),c=Math.acos(o/s),u=2*Ae(l-1,0,t.ab(a/2)),h=Math.min(t.ab(le),c+t.ab(a/2)),d=Ae(l-1,Math.min(h,c-t.ab(a/2)),h),p=Math.atan(n/o),f=Math.hypot(n,o);let A=r;return A+=t.ah(s/f/Math.max(.5,Math.cos(t.ab(a/2)))),A+=l*t.ah(Math.cos(p))/2,A-=t.ah(Math.max(1,d/u/i))/2,A}}const ge=me(9.314,3);function _e(e,i){const r=(i.roundZoom?Math.round:Math.floor)(e.zoom+t.ah(e.tileSize/i.tileSize));return Math.max(0,r)}function ye(e,i){const r=e.getCameraFrustum(),n=e.getClippingPlane(),o=e.screenPointToMercatorCoordinate(e.getCameraPoint()),s=t.$.fromLngLat(e.center,e.elevation);o.z=s.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;const a=e.getCoveringTilesDetailsProvider(),l=a.allowVariableZoom(e,i),c=_e(e,i),u=i.minzoom||0,h=void 0!==i.maxzoom?i.maxzoom:e.maxZoom,d=Math.min(Math.max(0,c),h),p=Math.pow(2,d),f=[p*o.x,p*o.y,0],A=[p*s.x,p*s.y,0],m=Math.hypot(s.x-o.x,s.y-o.y),g=Math.abs(s.z-o.z),_=Math.hypot(m,g),y=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),v=[],x=[];if(e.renderWorldCopies&&a.allowWorldCopies())for(let e=1;e<=3;e++)v.push(y(-e)),v.push(y(e));for(v.push(y(0));v.length>0;){const p=v.pop(),m=p.x,y=p.y;let b=p.fullyVisible;const w={x:m,y:y,z:p.zoom},T=a.getTileAABB(w,p.wrap,e.elevation,i);if(!b){const e=fe(r,T,n);if(0===e)continue;b=2===e}const B=a.distanceToTile2d(o.x,o.y,w,T);let C=c;l&&(C=(i.calculateTileZoom||ge)(e.zoom+t.ah(e.tileSize/i.tileSize),B,g,_,e.fov)),C=(i.roundZoom?Math.round:Math.floor)(C),C=Math.max(0,C);const S=Math.min(C,h);if(p.wrap=a.getWrap(s,w,p.wrap),p.zoom>=S){if(p.zoom>1),wrap:p.wrap,fullyVisible:b})}return x.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}class ve extends t.E{constructor(e,t,i){super(),this.id=e,this.dispatcher=i,this.on("data",(e=>this._dataHandler(e))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((e,t,i,r)=>{const n=new(ee(t.type))(e,t,i,r);if(n.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${n.id}`);return n})(e,t,i,this),this._tiles={},this._cache=new se(0,(e=>this._unloadTile(e))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ae,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}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 e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,r){return t._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,r)}catch(i){e.state="errored",404!==i.status?this._source.fire(new t.k(i,{tile:e})):this.update(this.transform,this.terrain)}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(xe).map((e=>e.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 r=e.tileID,n=i.tileID,o=new t.P(r.canonical.x,r.canonical.y)._rotate(-this.transform.bearingInRadians),s=new t.P(n.canonical.x,n.canonical.y)._rotate(-this.transform.bearingInRadians);return r.overscaledZ-n.overscaledZ||s.y-o.y||s.x-o.x})).map((e=>e.tileID.key)):i.map((e=>e.tileID)).sort(xe).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)(e||"errored"!==this._tiles[t].state)&&this._reloadTile(t,"reloading")}}_reloadTile(e,i){return t._(this,void 0,void 0,(function*(){const t=this._tiles[e];t&&("loading"!==t.state&&(t.state=i),yield this._loadTile(t,e,i))}))}_tileLoaded(e,i,r){e.timeAdded=s.now(),"expired"===r&&(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.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const t=this.getRenderableIds();for(let r=0;r1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>i)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>t+1;){const e=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[e.key],o&&o.hasData()&&(s=e)}let a=s;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]||e[a.canonical.key]){r[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),r=this._getLoadedTile(t);if(r)return r}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,n=Math.floor(i*r*(null===this._maxTileCacheZoomLevels?t.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(o)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}}_updateCoveredAndRetainedTiles(e,t,i,r,n,o){const a={},l={},c=Object.keys(e),u=s.now();for(const i of c){const r=e[i],n=this._tiles[i];if(!n||0!==n.fadeEndTime&&n.fadeEndTime<=u)continue;const o=this.findLoadedParent(r,t),s=this.findLoadedSibling(r),c=o||s||null;c&&(this._addTile(c.tileID),a[c.tileID.key]=c.tileID),l[i]=r}this._retainLoadedChildren(l,r,i,e);for(const t in a)e[t]||(this._coveredTiles[t]=!0,e[t]=a[t]);if(o){const t={},i={};for(const e of n)this._tiles[e.key].hasData()?t[e.key]=e:i[e.key]=e;for(const r in i){const n=i[r].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]=e[n[0].key]=n[0],t[n[1].key]=e[n[1].key]=n[1],t[n[2].key]=e[n[2].key]=n[2],t[n[3].key]=e[n[3].key]=n[3],delete i[r])}for(const r in i){const n=i[r],o=this.findLoadedParent(n,this._source.minzoom),s=this.findLoadedSibling(n),a=o||s||null;if(a){t[a.tileID.key]=e[a.tileID.key]=a.tileID;for(const e in t)t[e].isChildOf(a.tileID)&&delete t[e]}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.Y(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=ye(e,{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,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[];const n=_e(e,this._source),o=Math.max(n-ve.maxOverzooming,this._source.minzoom),s=Math.max(n+ve.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const e={};for(const t of r)if(t.canonical.z>this._source.minzoom){const i=t.scaledTo(t.canonical.z-1);e[i.key]=i;const r=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[r.key]=r}r=r.concat(Object.values(e))}const a=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new t.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(r,n);be(this._source.type)&&this._updateCoveredAndRetainedTiles(l,o,s,n,r,i);for(const e in l)this._tiles[e].clearFadeHold();const c=t.aj(this._tiles,l);for(const e of c){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var i;const r={},n={},o=Math.max(t-ve.maxOverzooming,this._source.minzoom),s=Math.max(t+ve.maxUnderzooming,this._source.minzoom),a={};for(const i of e){const e=this._addTile(i);r[i.key]=i,e.hasData()||tthis._source.maxzoom){const e=s.children(this._source.maxzoom)[0],t=this.getTile(e);if(t&&t.hasData()){r[e.key]=e;continue}}else{const e=s.children(this._source.maxzoom);if(r[e[0].key]&&r[e[1].key]&&r[e[2].key]&&r[e[3].key])continue}let a=e.wasRequested();for(let t=s.overscaledZ-1;t>=o;--t){const o=s.scaledTo(t);if(n[o.key])break;if(n[o.key]=!0,e=this.getTile(o),!e&&a&&(e=this._addTile(o)),e){const t=e.hasData();if((t||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||a)&&(r[o.key]=o),a=e.wasRequested(),t)break}}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;r=e}for(const e of t)this._loadedParentTiles[e]=i}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const t=this._tiles[e].tileID,i=this._getLoadedTile(t);this._loadedSiblingTiles[t.key]=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 r=i;return i||(i=new oe(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,r||this._source.fire(new t.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){const t=e.sourceDataType;"source"===e.dataType&&"metadata"===t&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===t&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,r){const n=[],o=this.transform;if(!o)return n;const s=r?o.getCameraQueryGeometry(e):e,a=e.map((e=>o.screenPointToMercatorCoordinate(e,this.terrain))),l=s.map((e=>o.screenPointToMercatorCoordinate(e,this.terrain))),c=this.getIds();let u=1/0,h=1/0,d=-1/0,p=-1/0;for(const e of l)u=Math.min(u,e.x),h=Math.min(h,e.y),d=Math.max(d,e.x),p=Math.max(p,e.y);for(let e=0;e=0&&m[1].y+A>=0){const e=a.map((e=>s.getTilePoint(e))),t=l.map((e=>s.getTilePoint(e)));n.push({tile:r,tileID:s,queryGeometry:e,cameraQueryGeometry:t,scale:f})}}return n}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));return this.transform&&this.transform.populateCache(t),t}hasTransition(){if(this._source.hasTransition())return!0;if(be(this._source.type)){const e=s.now();for(const t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,i){const r=this._tiles[e];r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(e,t)))}}function xe(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function be(e){return"raster"===e||"image"===e||"video"===e}ve.maxOverzooming=10,ve.maxUnderzooming=3;class we{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e0?(n-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function Te(e,t){let i=!0;return"always"===e||"never"!==e&&"never"!==t||(i=!1),i}class Be{constructor(e,t,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;ethis.width||r<0||t>this.height)return[];const a=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:e,y1:t,x2:i,y2:r}];for(let e=0;e0}hitTestCircle(e,t,i,r,n){const o=e-i,s=e+i,a=t-i,l=t+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:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(e,t,i,r,n,o,s,a){const{seenUids:l,hitTest:c,overlapMode:u}=s,h=this.boxCells[n];if(null!==h){const n=this.bboxes;for(const s of h)if(!l.box[s]){l.box[s]=!0;const h=4*s,d=this.boxKeys[s];if(e<=n[h+2]&&t<=n[h+3]&&i>=n[h+0]&&r>=n[h+1]&&(!a||a(d))&&(!c||!Te(u,d.overlapMode))&&(o.push({key:d,x1:n[h],y1:n[h+1],x2:n[h+2],y2:n[h+3]}),c))return!0}}const d=this.circleCells[n];if(null!==d){const n=this.circles;for(const s of d)if(!l.circle[s]){l.circle[s]=!0;const h=3*s,d=this.circleKeys[s];if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],e,t,i,r)&&(!a||a(d))&&(!c||!Te(u,d.overlapMode))){const e=n[h],t=n[h+1],i=n[h+2];if(o.push({key:d,x1:e-i,y1:t-i,x2:e+i,y2:t+i}),c)return!0}}}return!1}_queryCellCircle(e,t,i,r,n,o,s,a){const{circle:l,seenUids:c,overlapMode:u}=s,h=this.boxCells[n];if(null!==h){const e=this.bboxes;for(const t of h)if(!c.box[t]){c.box[t]=!0;const i=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(r))&&!Te(u,r.overlapMode))return o.push(!0),!0}}const d=this.circleCells[n];if(null!==d){const e=this.circles;for(const t of d)if(!c.circle[t]){c.circle[t]=!0;const i=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(r))&&!Te(u,r.overlapMode))return o.push(!0),!0}}}_forEachCell(e,t,i,r,n,o,s,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(n.call(this,e,t,i,r,this.xCellCount*l+d,o,s,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,n,o){const s=r-e,a=n-t,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(e,t,i,r,n,o,s){const a=(o-r)/2,l=Math.abs(e-(r+a));if(l>a+i)return!1;const c=(s-n)/2,u=Math.abs(t-(n+c));if(u>c+i)return!1;if(l<=a||u<=c)return!0;const h=l-a,d=u-c;return h*h+d*d<=i*i}}function Ce(e,i,n){const o=t.K();if(!e){const{vecSouth:e,vecEast:t}=Ee(i),n=r();n[0]=t[0],n[1]=t[1],n[2]=e[0],n[3]=e[1],s=n,(d=(l=(a=n)[0])*(h=a[3])-(u=a[2])*(c=a[1]))&&(s[0]=h*(d=1/d),s[1]=-c*d,s[2]=-u*d,s[3]=l*d),o[0]=n[0],o[1]=n[1],o[4]=n[2],o[5]=n[3]}var s,a,l,c,u,h,d;return t.M(o,o,[1/n,1/n,1]),o}function Se(e,i,r,n){if(e){const e=t.K();if(!i){const{vecSouth:t,vecEast:i}=Ee(r);e[0]=i[0],e[1]=i[1],e[4]=t[0],e[5]=t[1]}return t.M(e,e,[n,n,1]),e}return r.pixelsToClipSpaceMatrix}function Ee(e){const i=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),n=Math.cos(e.pitchInRadians),o=Math.cos(e.bearingInRadians),s=Math.sin(e.bearingInRadians),a=t.ao();a[0]=-o*n*r-s*i,a[1]=-s*n*r+o*i;const l=t.ap(a);l<1e-9?t.aq(a):t.ar(a,a,1/l);const c=t.ao();c[0]=o*n*i-s*r,c[1]=s*n*i+o*r;const u=t.ap(c);return u<1e-9?t.aq(c):t.ar(c,c,1/u),{vecEast:c,vecSouth:a}}function Me(e,i,r,n){let o;n?(o=[e,i,n(e,i),1],t.at(o,o,r)):(o=[e,i,0,1],$e(o,o,r));const s=o[3];return{point:new t.P(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}function Ie(e,t){return.5+e/t*.5}function Pe(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function Le(e,i,r,n,o,s,a,l,c,u,h,d,p){const f=r?e.textSizeData:e.iconSizeData,A=t.ak(f,i.transform.zoom),m=[256/i.width*2+1,256/i.height*2+1],g=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();const _=e.lineVertexArray,y=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=i.transform.width/i.transform.height;let x=!1;for(let r=0;rMath.abs(r.x-i.x)*n?{useVertical:!0}:(e===t.al.vertical?i.yr.x)?{needsFlipping:!0}:null}function ze(e){const{projectionContext:i,pitchedLabelPlaneMatrixInverse:r,symbol:n,fontSize:o,flip:s,keepUpright:a,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=e,d=o/24,p=n.lineOffsetX*d,f=n.lineOffsetY*d;let A;if(n.numGlyphs>1){const e=n.glyphStartIndex+n.numGlyphs,t=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,c=Fe(d,l,p,f,s,n,h,i);if(!c)return{notEnoughRoom:!0};const m=Ue(c.first.point.x,c.first.point.y,i,r),g=Ue(c.last.point.x,c.last.point.y,i,r);if(a&&!s){const e=ke(n.writingMode,m,g,u);if(e)return e}A=[c.first];for(let r=n.glyphStartIndex+1;r0?a.point:Re(i.tileAnchorPoint,s,e,1,i),c=Ue(e.x,e.y,i,r),h=Ue(l.x,l.y,i,r),d=ke(n.writingMode,c,h,u);if(d)return d}const e=Ve(d*l.getoffsetX(n.glyphStartIndex),p,f,s,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,i,h);if(!e||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};A=[e]}for(const e of A)t.as(c,e.point,e.angle);return{}}function Re(e,t,i,r,n){const o=e.add(e.sub(t)._unit()),s=Oe(o.x,o.y,n).point,a=i.sub(s);return i.add(a._mult(r/a.mag()))}function De(e,i,r){const n=i.projectionCache;if(n.projections[e])return n.projections[e];const o=new t.P(i.lineVertexArray.getx(e),i.lineVertexArray.gety(e)),s=Oe(o.x,o.y,i);if(s.signedDistanceFromCamera>0)return n.projections[e]=s.point,n.anyProjectionOccluded=n.anyProjectionOccluded||s.isOccluded,s.point;const a=e-r.direction;return Re(0===r.distanceFromAnchor?i.tileAnchorPoint:new t.P(i.lineVertexArray.getx(a),i.lineVertexArray.gety(a)),o,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,i)}function Oe(e,t,i){const r=e+i.translation[0],n=t+i.translation[1];let o;return i.pitchWithMap?(o=Me(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),o.isOccluded=!1):(o=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),o.point.x=(.5*o.point.x+.5)*i.width,o.point.y=(.5*-o.point.y+.5)*i.height),o}function Ue(e,i,r,n){if(r.pitchWithMap){const o=[e,i,0,1];return t.at(o,o,n),r.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],r.unwrappedTileID,r.getElevation).point}return{x:e/r.width*2-1,y:i/r.height*2-1}}function Ne(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function Qe(e,t,i){return e._unit()._perp()._mult(t*i)}function je(e,i,r,n,o,s,a,l,c){if(l.projectionCache.offsets[e])return l.projectionCache.offsets[e];const u=r.add(i);if(e+c.direction=o)return l.projectionCache.offsets[e]=u,u;const h=De(e+c.direction,l,c),d=Qe(h.sub(r),a,c.direction),p=r.add(d),f=h.add(d);return l.projectionCache.offsets[e]=t.au(s,u,p,f)||u,l.projectionCache.offsets[e]}function Ve(e,t,i,r,n,o,s,a,l){const c=r?e-t:e+t;let u=c>0?1:-1,h=0;r&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let d,p=u>0?o+n:o+n+1;a.projectionCache.cachedAnchorPoint?d=a.projectionCache.cachedAnchorPoint:(d=Oe(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,a.projectionCache.cachedAnchorPoint=d);let f,A,m=d,g=d,_=0,y=0;const v=Math.abs(c),x=[];let b;for(;_+y<=v;){if(p+=u,p=s)return null;_+=y,g=m,A=f;const e={absOffsetX:v,direction:u,distanceFromAnchor:_,previousVertex:g};if(m=De(p,a,e),0===i)x.push(g),b=m.sub(g);else{let t;const r=m.sub(g);t=0===r.mag()?Qe(De(p+u,a,e).sub(m),i,u):Qe(r,i,u),A||(A=g.add(t)),f=je(p,t,m,o,s,A,i,a,e),x.push(A),b=f.sub(A)}y=b.mag()}const w=b._mult((v-_)/y)._add(A||g),T=h+Math.atan2(m.y-g.y,m.x-g.x);return x.push(w),{point:w,angle:l?T:0,path:x}}const He=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ge(e,t){for(let i=0;i=1;e--)p.push(s.path[e]);for(let e=1;ee.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let m=[];if(p.length>0){const e=p[0].clone(),i=p[0].clone();for(let t=1;t=r.x&&i.x<=n.x&&e.y>=r.y&&i.y<=n.y?[p]:i.xn.x||i.yn.y?[]:t.av([p],r.x,r.y,n.x,n.y)}for(const t of m){o.reset(t,.25*i);let r=0;r=o.length<=.5*i?1:Math.ceil(o.paddedLength/f)+1;for(let t=0;t{const t=Me(e.x,e.y,r,i.getElevation),n=i.transform.projectTileCoordinates(t.point.x,t.point.y,i.unwrappedTileID,i.getElevation);return n.point.x=(.5*n.point.x+.5)*i.width,n.point.y=(.5*-n.point.y+.5)*i.height,n}))}(e,i);return function(e){let t=0,i=0,r=0,n=0;for(let o=0;oi&&(i=n,t=r));return e.slice(t,t+i)}(r)}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,n=1/0,o=-1/0,s=-1/0;for(const a of e){const e=new t.P(a.x+Ze,a.y+Ze);r=Math.min(r,e.x),n=Math.min(n,e.y),o=Math.max(o,e.x),s=Math.max(s,e.y),i.push(e)}const a=this.grid.query(r,n,o,s).concat(this.ignoredGrid.query(r,n,o,s)),l={},c={};for(const e of a){const r=e.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const n=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.aw(i,n)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(e,t,i,r,n,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n,o){const s=i?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:t};for(let t=0;t=this.screenRightBoundary||rthis.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e=0&&tthis.projectAndGetPerspectiveRatio(e.x,e.y,n,c,h)));M=e.some((e=>!e.isOccluded)),E=e.map((e=>new t.P(e.x,e.y)))}else M=!0;return{box:t.ax(E),allPointsOccluded:!M}}}class Ke{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class We{constructor(e,t,i,r,n){this.text=new Ke(e?e.text:null,t,i,n),this.icon=new Ke(e?e.icon:null,t,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Xe{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}}class Ye{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class Je{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function et(e,i,r,n,o){const{horizontalAlign:s,verticalAlign:a}=t.aE(e);return new t.P(-(s-.5)*i+n[0]*o,-(a-.5)*r+n[1]*o)}class tt{constructor(e,t,i,r,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new qe(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Je(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const t=this.terrain;return t?(i,r)=>t.getElevation(e,i,r):null}getBucketParts(e,i,r,n){const o=r.getBucket(i),s=r.latestFeatureIndex;if(!o||!s||i.id!==o.layerIds[0])return;const a=r.collisionBoxArray,l=o.layers[0].layout,c=o.layers[0].paint,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),h=r.tileSize/t.Z,d=r.tileID.toUnwrapped(),p="map"===l.get("text-rotation-alignment"),f=t.az(r,1,this.transform.zoom),A=t.aA(this.collisionIndex.transform,r,c.get("text-translate"),c.get("text-translate-anchor")),m=t.aA(this.collisionIndex.transform,r,c.get("icon-translate"),c.get("icon-translate-anchor")),g=Ce(p,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new Ye(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,r.tileID);const _={bucket:o,layout:l,translationText:A,translationIcon:m,unwrappedTileID:d,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:h,holdingForFade:r.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:t.ak(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=t;e.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_,y,v){const x=t.aB[e.textAnchor],b=[e.textOffset0,e.textOffset1],w=et(x,r,n,b,o),T=this.collisionIndex.placeCollisionBox(i,d,l,c,u,a,s,m,h.predicate,y,w,v);if((!_||this.collisionIndex.placeCollisionBox(_,d,l,c,u,a,s,g,h.predicate,y,w,v).placeable)&&T.placeable){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:b,width:r,height:n,anchor:x,textBoxScale:o,prevAnchor:e},this.markUsedJustification(f,x,p,A),f.allowVerticalPlacement&&(this.markUsedOrientation(f,A,p),this.placedOrientations[p.crossTileID]=A),{shift:w,placedGlyphBoxes:T}}}placeLayerBucketPart(e,i,r){const{bucket:n,layout:o,translationText:s,translationIcon:a,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:u,holdingForFade:h,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:f}=e.parameters,A=o.get("text-optional"),m=o.get("icon-optional"),g=t.aC(o,"text-overlap","text-allow-overlap"),_="always"===g,y=t.aC(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"),B=_&&(v||!n.hasIconData()||m),C=v&&(_||!n.hasTextData()||A);!n.collisionArrays&&d&&n.deserializeCollisionBoxes(d);const S=this.retainedQueryData[n.bucketInstanceId].tileID,E=this._getTerrainElevationFunc(S),M=this.transform.getFastPathSimpleProjectionMatrix(S),I=(e,d,v)=>{var T,I;if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new Xe(!1,!1,!1));let P=!1,L=!1,F=!0,k=null,z={box:null,placeable:!1,offscreen:null,occluded:!1},R={placeable:!1},D=null,O=null,U=null,N=0,Q=0,j=0;d.textFeatureIndex?N=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(N=e.featureIndex),d.verticalTextFeatureIndex&&(Q=d.verticalTextFeatureIndex);const V=d.textBox;if(V){const i=i=>{let r=t.al.horizontal;if(n.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(n,r,e))}return r},o=(i,r)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const e of n.writingModes)if(e===t.al.vertical?(z=r(),R=z):z=i(),z&&z.placeable)break}else z=i()},c=e.textAnchorOffsetStartIndex,h=e.textAnchorOffsetEndIndex;if(h===c){const r=(t,i)=>{const r=this.collisionIndex.placeCollisionBox(t,g,u,S,l,b,x,s,f.predicate,E,void 0,M);return r&&r.placeable&&(this.markUsedOrientation(n,i,e),this.placedOrientations[e.crossTileID]=i),r};o((()=>r(V,t.al.horizontal)),(()=>{const i=d.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?r(i,t.al.vertical):{box:null,offscreen:null}})),i(z&&z.placeable)}else{let p=t.aB[null===(I=null===(T=this.prevPlacement)||void 0===T?void 0:T.variableOffsets[e.crossTileID])||void 0===I?void 0:I.anchor];const A=(t,i,o)=>{const d=t.x2-t.x1,A=t.y2-t.y1,m=e.textBoxScale,_=w&&"never"===y?i:null;let v=null,T="never"===g?1:2,B="never";p&&T++;for(let i=0;iA(V,d.iconBox,t.al.horizontal)),(()=>{const i=d.verticalTextBox;return n.allowVerticalPlacement&&(!z||!z.placeable)&&e.numVerticalGlyphVertices>0&&i?A(i,d.verticalIconBox,t.al.vertical):{box:null,occluded:!0,offscreen:null}})),z&&(P=z.placeable,F=z.offscreen);const m=i(z&&z.placeable);if(!P&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,m))}}}if(D=z,P=D&&D.placeable,F=D&&D.offscreen,e.useRuntimeCollisionCircles){const i=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),a=t.am(n.textSizeData,p,i),u=o.get("text-padding");O=this.collisionIndex.placeCollisionCircles(g,i,n.lineVertexArray,n.glyphOffsetArray,a,l,c,r,b,f.predicate,e.collisionCircleDiameter,u,s,E),O.circles.length&&O.collisionDetected&&!r&&t.w("Collisions detected, but collision boxes are not shown"),P=_||O.circles.length>0&&!O.collisionDetected,F=F&&O.offscreen}if(d.iconFeatureIndex&&(j=d.iconFeatureIndex),d.iconBox){const e=e=>this.collisionIndex.placeCollisionBox(e,y,u,S,l,b,x,a,f.predicate,E,w&&k?k:void 0,M);R&&R.placeable&&d.verticalIconBox?(U=e(d.verticalIconBox),L=U.placeable):(U=e(d.iconBox),L=U.placeable),F=F&&U.offscreen}const H=A||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,G=m||0===e.numIconVertices;H||G?G?H||(L=L&&P):P=L&&P:L=P=L&&P;const $=L&&U.placeable;if(P&&D.placeable&&this.collisionIndex.insertCollisionBox(D.box,g,o.get("text-ignore-placement"),n.bucketInstanceId,R&&R.placeable&&Q?Q:N,f.ID),$&&this.collisionIndex.insertCollisionBox(U.box,y,o.get("icon-ignore-placement"),n.bucketInstanceId,j,f.ID),O&&P&&this.collisionIndex.insertCollisionCircles(O.circles,g,o.get("text-ignore-placement"),n.bucketInstanceId,N,f.ID),r&&this.storeCollisionData(n.bucketInstanceId,v,d,D,U,O),0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new Xe((P||B)&&!(null==D?void 0:D.occluded),(L||C)&&!(null==U?void 0:U.occluded),F||n.justReloaded),i[e.crossTileID]=!0};if(T){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){const i=t[e];I(n.symbolInstances.get(i),n.collisionArrays[i],i)}}else for(let t=e.symbolInstanceStart;t=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:r.crossTileID)}markUsedOrientation(e,i,r){const n=i===t.al.horizontal||i===t.al.horizontalOnly?i:0,o=i===t.al.vertical?i:0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const t of s)e.text.placedSymbolArray.get(t).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=n[e];o?(this.opacities[e]=new We(o,r,t.text,t.icon),i=i||t.text!==o.text.placed||t.icon!==o.icon.placed):(this.opacities[e]=new We(null,r,t.text,t.icon,t.skipFade),i=i||t.text||t.icon)}for(const e in n){const t=n[e];if(!this.opacities[e]){const n=new We(t,r,!1,!1);n.isHidden()||(this.opacities[e]=n,i=i||t.text.placed||t.icon.placed)}}for(const e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(const e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const i={};for(const r of t){const t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,i,r,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 o=e.layers[0],s=o.layout,a=new We(null,0,!1,!1,!0),l=s.get("text-allow-overlap"),c=s.get("icon-allow-overlap"),u=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h="map"===s.get("text-rotation-alignment"),d="map"===s.get("text-pitch-alignment"),p="none"!==s.get("icon-text-fit"),f=new We(null,0,l&&(c||!e.hasIconData()||s.get("icon-optional")),c&&(l||!e.hasTextData()||s.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);const A=(e,t,i)=>{for(let r=0;r0,_=this.placedOrientations[n.crossTileID],y=_===t.al.vertical,v=_===t.al.horizontal||_===t.al.horizontalOnly;if(o>0||s>0){const t=ut(c.text);A(e.text,o,y?ht:t),A(e.text,s,v?ht:t);const i=c.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||y?1:0)})),n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=i||v?1:0);const r=this.variableOffsets[n.crossTileID];r&&this.markUsedJustification(e,r.anchor,n,_);const a=this.placedOrientations[n.crossTileID];a&&(this.markUsedJustification(e,"left",n,a),this.markUsedOrientation(e,a,n))}if(g){const t=ut(c.icon),i=!(p&&n.verticalPlacedIconSymbolIndex&&y);n.placedIconSymbolIndex>=0&&(A(e.icon,n.numIconVertices,i?t:ht),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=c.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(A(e.icon,n.numVerticalIconVertices,i?ht:t),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=c.icon.isHidden())}const x=m&&m.has(i)?m.get(i):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const r=e.collisionArrays[i];if(r){let i=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){const e=this.variableOffsets[l];e?(i=et(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),h&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let n;r.textBox&&(n=y),r.verticalTextBox&&(n=v),it(e.textCollisionBox.collisionVertexArray,c.text.placed,!t||n,x.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){const t=Boolean(!v&&r.verticalIconBox);let n;r.iconBox&&(n=t),r.verticalIconBox&&(n=!t),it(e.iconCollisionBox.collisionVertexArray,c.icon.placed,n,x.icon,p?i.x:0,p?i.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),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`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function it(e,t,i,r,n,o){r&&0!==r.length||(r=[0,0,0,0]);const s=r[0]-Ze,a=r[1]-Ze,l=r[2]-Ze,c=r[3]-Ze;e.emplaceBack(t?1:0,i?1:0,n||0,o||0,s,a),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,l,a),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,l,c),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,s,c)}const rt=Math.pow(2,25),nt=Math.pow(2,24),ot=Math.pow(2,17),st=Math.pow(2,16),at=Math.pow(2,9),lt=Math.pow(2,8),ct=Math.pow(2,1);function ut(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*rt+t*nt+i*ot+t*st+i*at+t*lt+i*ct+t}const ht=0;class dt{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,r,n){const o=this._bucketParts;for(;this._currentTileIndexe.sortKey-t.sortKey)));this._currentPartIndex!this._forceFullPlacement&&s.now()-r>2;for(;this._currentPlacementIndex>=0;){const r=t[e[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===r.type&&(!r.minzoom||r.minzoom<=o)&&(!r.maxzoom||r.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new dt(r)),this._inProgressLayer.continuePlacement(i[r.source],this.placement,this._showCollisionBoxes,r,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const ft=512/t.Z/2;class At{constructor(e,i,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};const n=new Map;for(let e=0;e({x:Math.floor(e.anchorX*ft),y:Math.floor(e.anchorY*ft)}))),crossTileIDs:i.map((e=>e.crossTileID))};if(r.positions.length>128){const e=new t.aF(r.positions.length,16,Uint16Array);for(const{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,i){const{x:r,y:n,z:o}=this.tileID.canonical,{x:s,y:a,z:l}=i.canonical,c=ft/Math.pow(2,l-o),u=(a*t.Z+e.anchorY)*c,h=n*t.Z*ft;return{x:Math.floor((s*t.Z+e.anchorX)*c-r*t.Z*ft),y:Math.floor(u-h)}}findMatches(e,t,i){const r=this.tileID.canonical.ze))}}class mt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class gt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const e in this.indexes){const i=this.indexes[e],r={};for(const e in i){const n=i[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),r[n.tileID.key]=n}this.indexes[e]=r}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;ee.overscaledZ)for(const i in n){const o=n[i];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,r)}else{const o=n[e.scaledTo(Number(i)).key];o&&o.findMatches(t.symbolInstances,e,r)}}for(let e=0;e{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var yt="void main() {fragColor=vec4(1.0);}";const vt={prelude:xt("#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\nout highp vec4 fragColor;","#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;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\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(texture(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=(texture(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\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\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}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:xt("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:xt("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:xt("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:xt("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;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);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:xt("in vec3 v_data;in 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);float antialiased_blur=v_data.z;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));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out 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 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:xt(yt,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:xt("uniform highp float u_intensity;in 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);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out 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 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.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;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:xt("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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:xt("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:xt("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:xt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:xt(yt,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:xt("#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\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\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=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:xt("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\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);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\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=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:xt("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\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=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\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=projectTile(a_pos+u_fill_translate,a_pos);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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:xt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out 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=projectTile(a_pos+u_fill_translate,a_pos);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:xt("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout 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);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat 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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=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:xt("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in 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=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out 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 elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*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:xt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(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));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\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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:xt("uniform sampler2D u_image;in 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=texture(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);fragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:xt("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\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);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:xt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\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=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:xt("#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;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.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:xt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\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=texture(u_image,v_tex_a).a;float sdfdist_b=texture(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);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;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;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.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:xt("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:xt("uniform sampler2D u_texture;in vec2 v_tex;in 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;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:xt("#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;in vec2 v_data0;in 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=texture(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);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:xt("#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;in vec4 v_data0;in 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;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:xt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:xt("in 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() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:xt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:xt("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:xt("in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:xt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function xt(e,t){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=o?o.concat(n):n,a={};return{fragmentSource:e=e.replace(i,((e,t,i,r,n)=>(a[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`))),vertexSource:t=t.replace(i,((e,t,i,r,n)=>{const o="float"===r?"vec2":"vec4",s=n.match(/color/)?"color":o;return a[n]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${s}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${s}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:r,staticUniforms:s}}class bt{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var wt=t.aG([{name:"a_pos",type:"Int16",components:2}]);const Tt="#define PROJECTION_MERCATOR",Bt="mercator";class Ct{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Bt}get shaderDefine(){return Tt}get shaderPreludeCode(){return vt.projectionMercator}get vertexShaderPreludeCode(){return vt.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aH.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,r,n,o){if(this._cachedMesh)return this._cachedMesh;const s=new t.aI;s.emplaceBack(0,0),s.emplaceBack(t.Z,0),s.emplaceBack(0,t.Z),s.emplaceBack(t.Z,t.Z);const a=e.createVertexBuffer(s,wt.members),l=t.aJ.simpleSegment(0,0,4,2),c=new t.aK;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const u=e.createIndexBuffer(c);return this._cachedMesh=new bt(a,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class St{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=r}interpolate(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.B.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.B.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.B.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.B.number(e.right,i.right,r)),this}getCenter(e,i){const r=t.ae((this.left+e-this.right)/2,0,e),n=t.ae((this.top+i-this.bottom)/2,0,i);return new t.P(r,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new St(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Et(e,t){if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function Mt(e){return Math.max(0,Math.floor(e))}class It{constructor(e,i,r,n,o,s){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===s||!!s,this._minZoom=i||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==o?60:o,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.Q(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Mt(this._zoom),this._scale=t.ac(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new St,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,r){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=Mt(this._zoom),this._scale=t.ac(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new St(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!r&&e.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=t.aL(e,-180,180)*Math.PI/180;var n,o,s,a,l,c,u,h,d;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=r(),n=this._rotationMatrix,s=-this._bearingInRadians,a=(o=this._rotationMatrix)[0],l=o[1],c=o[2],u=o[3],h=Math.sin(s),d=Math.cos(s),n[0]=a*d+c*h,n[1]=l*d+u*h,n[2]=a*-h+c*d,n[3]=l*-h+u*d)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=t.ae(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return t.aM(this._fovInRadians)}setFov(e){e=t.ae(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.ab(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const i=this.getConstrained(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=t.ac(i),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new H([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-85.051129,t.af])}getConstrained(e,t){return this._callbacks.getConstrained(e,t)}getCameraQueryGeometry(e,i){if(1===i.length)return[i[0],e];{let r=e.x,n=e.y,o=e.x,s=e.y;for(const e of i)r=Math.min(r,e.x),n=Math.min(n,e.y),o=Math.max(o,e.x),s=Math.max(s,e.y);return[new t.P(r,n),new t.P(o,n),new t.P(o,s),new t.P(r,s),new t.P(r,n)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:t,zoom:i}=this.getConstrained(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.ad(new Float64Array(16));t.M(e,e,[this._width/2,-this._height/2,1]),t.L(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.ad(new Float64Array(16)),t.M(e,e,[1,-1,1]),t.L(e,e,[-1,-1,0]),t.M(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,r,n){const o=void 0!==r?r:this.bearing,s=n=void 0!==n?n:this.pitch,a=t.$.fromLngLat(e,i),l=-Math.cos(t.ab(s)),c=Math.sin(t.ab(s)),u=c*Math.sin(t.ab(o)),h=-c*Math.cos(t.ab(o));let d=this.elevation;const p=i-d;let f;l*p>=0||Math.abs(l)<.1?(f=1e4,d=i+f*l):f=-p/l;let A,m,g=t.aN(1,a.y),_=0;do{if(_+=1,_>10)break;m=f/g,A=new t.$(a.x+u*m,a.y+h*m),g=1/A.meterInMercatorCoordinateUnits()}while(Math.abs(f-m*g)>1e-12);return{center:A.toLngLat(),elevation:d,zoom:t.ah(this.height/2/Math.tan(this.fovInRadians/2)/m/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=t.ag(1,this.center.lat)*this.worldSize,r=this.cameraToCenterDistance/i,n=t.$.fromLngLat(this.center,this.elevation),o=pe(this.center,this.elevation,this.pitch,this.bearing,r);this._elevation=e;const s=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),t.aN(o.z,n.y),this.bearing,this.pitch);this._elevation=s.elevation,this._center=s.center,this.setZoom(s.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=t.ag(1,this.center.lat)*this.worldSize;return pe(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const i=e.canonical.z>=0?1<this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]0?(t+=e[r]*this.min[r],i+=e[r]*this.max[r]):(i+=e[r]*this.min[r],t+=e[r]*this.max[r]);return t>=0?2:i<0?0:1}}class Lt{distanceToTile2d(e,t,i,r){const n=r.distanceX([e,t]),o=r.distanceY([e,t]);return Math.hypot(n,o)}getWrap(e,t,i){return i}getTileAABB(e,i,r,n){var o,s;let a=r,l=r;if(n.terrain){const c=new t.Y(e.z,i,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(c);a=null!==(o=u.minElevation)&&void 0!==o?o:r,l=null!==(s=u.maxElevation)&&void 0!==s?s:r}const c=1<n}allowWorldCopies(){return!0}recalculateCache(){}}class Ft{constructor(e,t,i){this.points=e,this.planes=t,this.aabb=i}static fromInvProjectionMatrix(e,i=1,r=0){const n=Math.pow(2,r),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((r=>{const o=1/(r=t.at([],r,e))[3]/i*n;return t.aR(r,r,[o,o,1/r[3],o])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const i=t.aS([],o[e[0]],o[e[1]]),r=t.aS([],o[e[2]],o[e[1]]),n=t.aT([],t.aU([],i,r)),s=-t.aV(n,o[e[1]]);return n.concat(s)})),a=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],l=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const e of o)for(let t=0;t<3;t++)a[t]=Math.min(a[t],e[t]),l[t]=Math.max(l[t],e[t]);return new Ft(o,s,new Pt(a,l))}}class kt{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e,t,i,r,n){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new It({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)},e,t,i,r,n),this._coveringTilesDetailsProvider=new Lt}clone(){const e=new kt;return e.apply(this),e}apply(e,t,i){this._helper.apply(e,t,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const i=[new t.aW(0,e)];if(this._helper._renderWorldCopies){const r=this.screenPointToMercatorCoordinate(new t.P(0,0)),n=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new t.P(0,this._helper._height)),a=Math.floor(Math.min(r.x,n.x,o.x,s.x)),l=Math.floor(Math.max(r.x,n.x,o.x,s.x)),c=1;for(let r=a-c;r<=l+c;r++)0!==r&&i.push(new t.aW(r,e))}return i}getCameraFrustum(){return Ft.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const t=this.screenPointToLocation(this.centerPoint,e),i=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(e,i){const r=t.ag(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(i,r),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),s=t.$.fromLngLat(e),a=new t.$(s.x-(n.x-o.x),s.y-(n.y-o.y));this.setCenter(null==a?void 0:a.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(t.$.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(t.$.fromLngLat(e))}screenPointToLocation(e,t){var i;return null===(i=this.screenPointToMercatorCoordinate(e,t))||void 0===i?void 0:i.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){const i=t.pointCoordinate(e);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){const r=i||0,n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.at(n,n,this._pixelMatrixInverse),t.at(o,o,this._pixelMatrixInverse);const s=n[3],a=o[3],l=n[1]/s,c=o[1]/a,u=n[2]/s,h=o[2]/a,d=u===h?0:(r-u)/(h-u);return new t.$(t.B.number(n[0]/s,o[0]/a,d)/this.worldSize,t.B.number(l,c,d)/this.worldSize,r)}coordinatePoint(e,i=0,r=this._pixelMatrix){const n=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.at(n,n,r),new t.P(n[0]/n[3],n[1]/n[3])}getBounds(){const e=Math.max(0,this._helper._height/2-he(this));return(new H).extend(this.screenPointToLocation(new t.P(0,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new t.P(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=t.pointCoordinate(e):e.y>this.height/2-he(this)}calculatePosMatrix(e,i=!1,r){var n;const o=null!==(n=e.key)&&void 0!==n?n:t.aX(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),s=i?this._alignedPosMatrixCache:this._posMatrixCache;if(s.has(o)){const e=s.get(o);return r?e.f32:e.f64}const a=de(e,this.worldSize);t.N(a,i?this._alignedProjMatrix:this._viewProjMatrix,a);const l={f64:a,f32:new Float32Array(a)};return s.set(o,l),r?l.f32:l.f64}calculateFogMatrix(e){const i=e.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);const n=de(e,this.worldSize);return t.N(n,this._fogMatrix,n),r.set(i,new Float32Array(n)),r.get(i)}getConstrained(e,i){i=t.ae(+i,this.minZoom,this.maxZoom);const r={center:new t.Q(e.lng,e.lat),zoom:i};let n=this._helper._lngRange;this._helper._renderWorldCopies||null!==n||(n=[-179.9999999999,180-1e-10]);const o=this.tileSize*t.ac(r.zoom);let s=0,a=o,l=0,c=o,u=0,h=0;const{x:d,y:p}=this.size;if(this._helper._latRange){const e=this._helper._latRange;s=t.S(e[1])*o,a=t.S(e[0])*o,a-sa&&(g=a-e)}if(n){const e=(l+c)/2;let i=f;this._helper._renderWorldCopies&&(i=t.aL(f,e-o/2,e+o/2));const r=d/2;i-rc&&(m=c-r)}if(void 0!==m||void 0!==g){const e=new t.P(null!=m?m:f,null!=g?g:A);r.center=ue(o,e).wrap()}return r}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}_calculateNearFarZIfNeeded(e,i,r){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=e-n*this._helper._pixelPerMeter/Math.cos(i),s=n<0?o:e,a=Math.PI/2+this.pitchInRadians,l=t.ab(this.fov)*(Math.abs(Math.cos(t.ab(this.roll)))*this.height+Math.abs(Math.sin(t.ab(this.roll)))*this.width)/this.height*(.5+r.y/this.height),c=Math.sin(l)*s/Math.sin(t.ae(Math.PI-a-l,.01,Math.PI-.01)),u=he(this),h=Math.atan(u/this._helper.cameraToCenterDistance),d=t.ab(.75),p=h>d?2*h*(.5+r.y/(2*u)):d,f=Math.sin(p)*s/Math.sin(t.ae(Math.PI-a-p,.01,Math.PI-.01)),A=Math.min(c,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*A+s),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=ce(this.worldSize,this.center),r=i.x,n=i.y;this._helper._pixelPerMeter=t.ag(1,this.center.lat)*this.worldSize;const o=t.ab(Math.min(this.pitch,le)),s=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));let a;this._calculateNearFarZIfNeeded(s,o,e),a=new Float64Array(16),t.aY(a,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),t.an(this._invProjMatrix,a),a[8]=2*-e.x/this._helper._width,a[9]=2*e.y/this._helper._height,this._projectionMatrix=t.aZ(a),t.M(a,a,[1,-1,1]),t.L(a,a,[0,0,-this._helper.cameraToCenterDistance]),t.a_(a,a,-this.rollInRadians),t.a$(a,a,this.pitchInRadians),t.a_(a,a,-this.bearingInRadians),t.L(a,a,[-r,-n,0]),this._mercatorMatrix=t.M([],a,[this.worldSize,this.worldSize,this.worldSize]),t.M(a,a,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,a),t.L(a,a,[0,0,-this.elevation]),this._viewProjMatrix=a,this._invViewProjMatrix=t.an([],a);const l=[0,0,-1,1];t.at(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),t.aY(this._fogMatrix,this.fovInRadians,this.width/this.height,s,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,t.M(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.L(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.a_(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.a$(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.a_(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.L(this._fogMatrix,this._fogMatrix,[-r,-n,0]),t.M(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.L(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,a);const c=this._helper._width%2/2,u=this._helper._height%2/2,h=Math.cos(this.bearingInRadians),d=Math.sin(-this.bearingInRadians),p=r-Math.round(r)+h*c+d*u,f=n-Math.round(n)+h*u+d*c,A=new Float64Array(a);if(t.L(A,A,[p>.5?p-1:p,f>.5?f-1:f,0]),this._alignedProjMatrix=A,a=t.an(new Float64Array(16),this._pixelMatrix),!a)throw new Error("failed to invert matrix");this._pixelMatrixInverse=a,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new t.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.at(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=t.ag(1,this.center.lat)*this.worldSize;return pe(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const r=t.$.fromLngLat(e),n=[r.x*this.worldSize,r.y*this.worldSize,i,1];return t.at(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(e){const{overscaledTileID:i,aligned:r,applyTerrainMatrix:n}=e,o=this._helper.getMercatorTileCoordinates(i),s=i?this.calculatePosMatrix(i,r,!0):null;let a;return a=i&&i.terrainRttPosMatrix32f&&n?i.terrainRttPosMatrix32f:s||t.b0(),{mainMatrix:a,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,i){return 1}transformLightDirection(e){return t.aQ(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,r,n){const o=this.calculatePosMatrix(r);let s;n?(s=[e,i,n(e,i),1],t.at(s,s,o)):(s=[e,i,0,1],$e(s,s,o));const a=s[3];return{point:new t.P(s[0]/a,s[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}populateCache(e){for(const t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,i){const r=t.$.fromLngLat(e,i),n=r.meterInMercatorCoordinateUnits(),o=t.b1();return t.L(o,o,[r.x,r.y,r.z]),t.a_(o,o,Math.PI),t.a$(o,o,Math.PI/2),t.M(o,o,[-n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const i=new t.Y(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),n=de(i,this.worldSize);t.N(n,this._viewProjMatrix,n),r.tileMercatorCoords=[0,0,1,1];const o=[t.Z,t.Z,this.worldSize/this._helper.pixelsPerMeter],s=t.b2();return t.M(s,n,o),r.fallbackMatrix=s,r.mainMatrix=s,r}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function zt(){t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Rt(e){if(e.useSlerp)if(e.k<1){const i=t.b3(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=t.b3(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),n=new Float64Array(4);t.b4(n,i,r,e.k);const o=t.b5(n);e.tr.setRoll(o.roll),e.tr.setPitch(o.pitch),e.tr.setBearing(o.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(t.B.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.B.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.B.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function Dt(e,i,r,n,o){const s=o.padding,a=ce(o.worldSize,r.getNorthWest()),l=ce(o.worldSize,r.getNorthEast()),c=ce(o.worldSize,r.getSouthEast()),u=ce(o.worldSize,r.getSouthWest()),h=t.ab(-n),d=a.rotate(h),p=l.rotate(h),f=c.rotate(h),A=u.rotate(h),m=new t.P(Math.max(d.x,p.x,A.x,f.x),Math.max(d.y,p.y,A.y,f.y)),g=new t.P(Math.min(d.x,p.x,A.x,f.x),Math.min(d.y,p.y,A.y,f.y)),_=m.sub(g),y=(o.width-(s.left+s.right+i.left+i.right))/_.x,v=(o.height-(s.top+s.bottom+i.top+i.bottom))/_.y;if(v<0||y<0)return void zt();const x=Math.min(t.ah(o.scale*Math.min(y,v)),e.maxZoom),b=t.P.convert(e.offset),w=new t.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(t.ab(n)),T=b.add(w).mult(o.scale/t.ac(x));return{center:ue(o.worldSize,a.add(c).div(2).sub(T)),zoom:x,bearing:n}}class Ot{get useGlobeControls(){return!1}handlePanInertia(e,t){return{easingOffset:e,easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around)}cameraForBoxAndBearing(e,t,i,r,n){return Dt(e,t,i,r,n)}handleJumpToCenterZoom(e,i){e.zoom!==(void 0!==i.zoom?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),void 0!==i.center&&e.setCenter(t.Q.convert(i.center))}handleEaseTo(e,i){const r=e.zoom,n=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},a=void 0!==i.zoom,l=!e.isPaddingEqual(i.padding);let c=!1;const u=a?+i.zoom:e.zoom;let h=e.centerPoint.add(i.offsetAsPoint);const d=e.screenPointToLocation(h),{center:p,zoom:f}=e.getConstrained(t.Q.convert(i.center||d),null!=u?u:r);Et(e,p);const A=ce(e.worldSize,d),m=ce(e.worldSize,p).sub(A),g=t.ac(f-r);return c=f!==r,{easeFunc:a=>{if(c&&e.setZoom(t.B.number(r,f,a)),t.b6(o,s)||Rt({startEulerAngles:o,endEulerAngles:s,tr:e,k:a,useSlerp:o.roll!=s.roll}),l&&(e.interpolatePadding(n,i.padding,a),h=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const i=t.ac(e.zoom-r),n=f>r?Math.min(2,g):Math.max(.5,g),o=Math.pow(n,1-a),s=ue(e.worldSize,A.add(m.mult(a*o)).mult(i));e.setLocationAtPoint(e.renderWorldCopies?s.wrap():s,h)}},isZooming:c,elevationCenter:p}}handleFlyTo(e,i){const r=void 0!==i.zoom,n=e.zoom,o=e.getConstrained(t.Q.convert(i.center||i.locationAtOffset),r?+i.zoom:n),s=o.center,a=o.zoom;Et(e,s);const l=ce(e.worldSize,i.locationAtOffset),c=ce(e.worldSize,s).sub(l),u=c.mag(),h=t.ac(a-n);let d;if(void 0!==i.minZoom){const r=Math.min(+i.minZoom,n,a),o=e.getConstrained(s,r).zoom;d=t.ac(o-n)}return{easeFunc:(i,r,o,u)=>{e.setZoom(1===i?a:n+t.ah(r));const h=1===i?s:ue(e.worldSize,l.add(c.mult(o)).mult(r));e.setLocationAtPoint(e.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:s,scaleOfMinZoom:d,pixelPathLength:u}}}class Ut{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}Ut.Replace=[1,0],Ut.disabled=new Ut(Ut.Replace,t.b7.transparent,[!1,!1,!1,!1]),Ut.unblended=new Ut(Ut.Replace,t.b7.transparent,[!0,!0,!0,!0]),Ut.alphaBlended=new Ut([1,771],t.b7.transparent,[!0,!0,!0,!0]);const Nt=2305;class Qt{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}Qt.disabled=new Qt(!1,1029,Nt),Qt.backCCW=new Qt(!0,1029,Nt),Qt.frontCCW=new Qt(!0,1028,Nt);class jt{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}jt.ReadOnly=!1,jt.ReadWrite=!0,jt.disabled=new jt(519,jt.ReadOnly,[0,1]);const Vt=7680;class Ht{constructor(e,t,i,r,n,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}Ht.disabled=new Ht({func:519,mask:0},0,0,Vt,Vt,Vt);const Gt=new WeakMap;function $t(e){var t;if(Gt.has(e))return Gt.get(e);{const i=null===(t=e.getParameter(e.VERSION))||void 0===t?void 0:t.startsWith("WebGL 2.0");return Gt.set(e,i),i}}class Zt{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const i=e.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;const n=new t.aI;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const o=new t.aK;o.emplaceBack(0,1,2),this._fullscreenTriangle=new bt(i.createVertexBuffer(n,wt.members),i.createIndexBuffer(o),t.aJ.simpleSegment(0,0,n.length,o.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);const s=r.createTexture();r.bindTexture(r.TEXTURE_2D,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(s),$t(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,t){const i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,t=e.gl;e.activeTexture.set(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){const r=this._cachedRenderContext.context,n=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:t.b7.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,n.TRIANGLES,jt.disabled,Ht.disabled,Ut.unblended,Qt.disabled,((e,t)=>({u_input:e,u_output_expected:t}))(e,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&$t(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);const e=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:e}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&$t(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return t.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Zt._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let t=0;return t+=e[0]/256,t+=e[1]/65536,t+=e[2]/16777216,e[3]<127&&(t=-t),t/128}}const qt=t.Z/128;function Kt(e,i){const r=void 0!==e.granularity?Math.max(e.granularity,1):1,n=r+(e.generateBorders?2:0),o=r+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),s=n+1,a=o+1,l=e.generateBorders?-1:0,c=e.generateBorders||e.extendToNorthPole?-1:0,u=r+(e.generateBorders?1:0),h=r+(e.generateBorders||e.extendToSouthPole?1:0),d=s*a,p=n*o*6,f=s*a>65536;if(f&&"16bit"===i)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const A=f||"32bit"===i,m=new Int16Array(2*d);let g=0;for(let i=c;i<=h;i++)for(let n=l;n<=u;n++){let o=n/r*t.Z;-1===n&&(o=-64),n===r+1&&(o=t.Z+qt);let s=i/r*t.Z;-1===i&&(s=e.extendToNorthPole?t.b9:-64),i===r+1&&(s=e.extendToSouthPole?t.ba:t.Z+qt),m[g++]=o,m[g++]=s}const _=A?new Uint32Array(p):new Uint16Array(p);let y=0;for(let e=0;e0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,i,r,n){return this.currentProjection.getMeshFromTileID(e,t,i,r,n)}setProjection(e){this._transitionable.setValue("type",(null==e?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function ei(e){const t=ri(e.worldSize,e.center.lat);return 2*Math.PI*t}function ti(e,i,r,n,o){const s=1/(1<1e-6){const n=e[0]/r,o=Math.acos(e[2]/r),s=(n>0?o:-o)/Math.PI*180;return new t.Q(t.aL(s,-180,180),i)}return new t.Q(0,i)}function oi(e){return Math.cos(e*Math.PI/180)}function si(e,i){const r=oi(e),n=oi(i);return t.ah(n/r)}function ai(e,i){const r=e.rotate(i.bearingInRadians),n=i.zoom+si(i.center.lat,0),o=t.bc(1/oi(i.center.lat),1/oi(Math.min(Math.abs(i.center.lat),60)),t.bf(n,7,3,0,1)),s=360/ei({worldSize:i.worldSize,center:{lat:i.center.lat}});return new t.Q(i.center.lng-r.x*s*o,t.ae(i.center.lat+r.y*s,-85.051129,t.af))}function li(e){const t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function ci(e,i,r,n){const o=e.lat+r*n;if(Math.abs(r)>1){const s=(Math.sign(e.lat+r)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,a=Math.abs(e.lat+r)*Math.PI/180,l=li(s+n*(a-s)),c=li(s),u=li(a);return new t.Q(e.lng+i*((l-c)/(u-c)),o)}return new t.Q(e.lng+i*n,o)}class ui{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._aabbFactory=e}recalculateCache(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileAABB(e,t,i,r){const n=`${e.z}_${e.x}_${e.y}`,o=this._cache.get(n);if(o)return o;const s=this._cachePrevious.get(n);if(s)return this._cache.set(n,s),s;const a=this._aabbFactory(e,t,i,r);return this._cache.set(n,a),this._hadAnyChanges=!0,a}}function hi(e,t,i){const r=e-t;return r<0?-r:Math.max(0,r-i)}function di(e,t,i,r,n){const o=e-i;let s;return s=o<0?Math.min(-o,1+o-n):o>1?Math.min(Math.max(o-n,0),1-o):0,Math.max(s,hi(t,r,n))}class pi{constructor(){this._aabbCache=new ui(this._computeTileAABB)}recalculateCache(){this._aabbCache.recalculateCache()}distanceToTile2d(e,t,i,r){const n=1<4}allowWorldCopies(){return!1}getTileAABB(e,t,i,r){return this._aabbCache.getTileAABB(e,t,i,r)}_computeTileAABB(e,i,r,n){if(e.z<=0)return new Pt([-1,-1,-1],[1,1,1]);if(1===e.z)return new Pt([0===e.x?-1:0,0===e.y?0:-1,-1],[0===e.x?0:1,0===e.y?1:0,1]);{const i=[ti(0,0,e.x,e.y,e.z),ti(t.Z,0,e.x,e.y,e.z),ti(t.Z,t.Z,e.x,e.y,e.z),ti(0,t.Z,e.x,e.y,e.z)],r=[1,1,1],n=[-1,-1,-1];for(const e of i)for(let t=0;t<3;t++)r[t]=Math.min(r[t],e[t]),n[t]=Math.max(n[t],e[t]);if(0===e.y||e.y===(1<{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)}),this._coveringTilesDetailsProvider=new pi}clone(){const e=new fi;return e.apply(this),e}apply(e,t){this._globeLatitudeErrorCorrectionRadians=t||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=t.bh();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:t,applyGlobeMatrix:i}=e,r=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,r=this.cameraToCenterDistance/e,n=Math.sin(i)*r,o=Math.cos(i)*r+1,s=1/Math.sqrt(n*n+o*o)*1;let a=-n,l=o;const c=Math.sqrt(a*a+l*l);a/=c,l/=c;const u=[0,a,l];t.bl(u,u,[0,0,0],-this.bearingInRadians),t.bm(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.bn(u,u,[0,0,0],this.center.lng*Math.PI/180);const h=1/t.bo(u);return t.aO(u,u,h),[...u,-s*h]}isLocationOccluded(e){return!this.isSurfacePointVisible(ii(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,n=Math.cos(r),o=[Math.sin(i)*n,Math.sin(r),Math.cos(i)*n],s=[o[2],0,-o[0]],a=[0,0,0];t.aU(a,s,o),t.aT(s,s),t.aT(a,a);const l=[0,0,0];return t.aT(l,[s[0]*e[0]+a[0]*e[1]+o[0]*e[2],s[1]*e[0]+a[1]*e[1]+o[1]*e[2],s[2]*e[0]+a[2]*e[1]+o[2]*e[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,r){const n=function(e,i,r){const n=1/(1<o&&(o=i),ra&&(a=r)}const u=[c.lng+s,c.lat+l,c.lng+o,c.lat+a];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new H(u)}getConstrained(e,i){const r=t.ae(e.lat,-85.051129,t.af),n=t.ae(+i,this.minZoom+si(0,r),this.maxZoom);return{center:new t.Q(e.lng,r),zoom:n}}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,i){const r=ii(this.unprojectScreenPoint(i)),n=ii(e),o=t.bh();t.br(o);const s=t.bh();t.bn(s,r,o,-this.center.lng*Math.PI/180),t.bm(s,s,o,this.center.lat*Math.PI/180);const a=n[0]*n[0]+n[2]*n[2],l=s[0]*s[0];if(a=-g&&f<=g,y=m>=-g&&m<=g;let v,x;if(_&&y){const e=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;t.bv(h,e)+t.bv(f,i)=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const i=t.bk();return t.at(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){const r=t.aV(e,i),n=t.bh(),o=t.bh();t.aO(o,i,r),t.aS(n,e,o);const s=1-t.aV(n,n);if(s<0)return null;const a=t.aV(e,e)-1,l=-r+(r<0?1:-1)*Math.sqrt(s),c=a/l,u=l;return{tMin:Math.min(c,u),tMax:Math.max(c,u)}}unprojectScreenPoint(e){const i=this._cameraPosition,r=this.getRayDirectionFromPixel(e),n=this.rayPlanetIntersection(i,r);if(n){const e=t.bh();t.aP(e,i,[r[0]*n.tMin,r[1]*n.tMin,r[2]*n.tMin]);const o=t.bh();return t.aT(o,e),ni(o)}const o=this._cachedClippingPlane,s=o[0]*r[0]+o[1]*r[1]+o[2]*r[2],a=-t.bt(o,i)/s,l=t.bh();if(a>0)t.aP(l,i,[r[0]*a,r[1]*a,r[2]*a]);else{const e=t.bh();t.aP(e,i,[2*r[0],2*r[1],2*r[2]]);const n=t.bt(this._cachedClippingPlane,e);t.aS(l,e,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const c=function(e){const i=t.bh();return i[0]=e[0]*-e[3],i[1]=e[1]*-e[3],i[2]=e[2]*-e[3],{center:i,radius:Math.sqrt(1-e[3]*e[3])}}(o);return ni(function(e,i,r){const n=t.bh();t.aS(n,r,e);const o=t.bh();return t.bi(o,e,n,i/t.bj(n)),o}(c.center,c.radius,l))}getMatrixForModel(e,i){const r=t.Q.convert(e),n=1/t.bu,o=t.b1();return t.bp(o,o,r.lng/180*Math.PI),t.a$(o,o,-r.lat/180*Math.PI),t.L(o,o,[0,0,1+i/t.bu]),t.a$(o,o,.5*Math.PI),t.M(o,o,[n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new t.Y(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class Ai{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,t){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().recalculateCache(),this._mercatorTransform.getCoveringTilesDetailsProvider().recalculateCache()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new It({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)}),this._globeness=1,this._mercatorTransform=new kt,this._verticalPerspectiveTransform=new fi}clone(){const e=new Ai;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const t=this._mercatorTransform.getProjectionData(e),i=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:t.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return t.bc(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bc(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,r){const n=this._mercatorTransform.getPitchedTextCorrection(e,i,r),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,r);return t.bc(n,o,this._globeness)}projectTileCoordinates(e,t,i,r){return this.currentTransform.projectTileCoordinates(e,t,i,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,t){return this.currentTransform.getConstrained(e,t)}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,t){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,t){return this.currentTransform.getMatrixForModel(e,t)}getProjectionDataForCustomLayer(e=!0){const t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;const i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return i.fallbackMatrix=t.mainMatrix,i}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class mi{get useGlobeControls(){return!0}handlePanInertia(e,i){const r=ai(e,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new t.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const r=e.around,n=i.screenPointToLocation(r);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);const o=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);const s=i.zoom-o;if(0===s)return;const a=t.bq(i.center.lng,n.lng),l=a/(Math.abs(a/180)+1),c=t.bq(i.center.lat,n.lat),u=i.getRayDirectionFromPixel(r),h=i.cameraPosition,d=-1*t.aV(h,u),p=t.bh();t.aP(p,h,[u[0]*d,u[1]*d,u[2]*d]);const f=t.bo(p)-1,A=Math.exp(.5*-Math.max(f-.3,0)),m=ri(i.worldSize,i.center.lat)/Math.min(i.width,i.height),g=t.bf(m,.9,.5,1,.25),_=(1-t.ac(-s))*Math.min(A,g),y=i.center.lat,v=i.zoom,x=new t.Q(i.center.lng+l*_,t.ae(i.center.lat+c*_,-85.051129,t.af));i.setLocationAtPoint(n,r);const b=i.center,w=t.bf(Math.abs(a),45,85,0,1),T=t.bf(m,.75,.35,0,1),B=Math.pow(Math.max(w,T),.25),C=t.bq(b.lng,x.lng),S=t.bq(b.lat,x.lat);i.setCenter(new t.Q(b.lng+C*B,b.lat+S*B).wrap()),i.setZoom(v+si(y,i.center.lat))}handleMapControlsPan(e,t,i){if(!e.panDelta)return;const r=t.center.lat,n=t.zoom;t.setCenter(ai(e.panDelta,t).wrap()),t.setZoom(n+si(r,t.center.lat))}cameraForBoxAndBearing(e,i,r,n,o){const s=Dt(e,i,r,n,o),a=i.left/o.width*2-1,l=(o.width-i.right)/o.width*2-1,c=i.top/o.height*-2+1,u=(o.height-i.bottom)/o.height*-2+1,h=t.bq(r.getWest(),r.getEast())<0,d=h?r.getEast():r.getWest(),p=h?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),A=Math.min(r.getNorth(),r.getSouth()),m=d+.5*t.bq(d,p),g=f+.5*t.bq(f,A),_=o.clone();_.setCenter(s.center),_.setBearing(s.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(s.zoom);const y=_.modelViewProjectionMatrix,v=[ii(r.getNorthWest()),ii(r.getNorthEast()),ii(r.getSouthWest()),ii(r.getSouthEast()),ii(new t.Q(p,g)),ii(new t.Q(d,g)),ii(new t.Q(m,f)),ii(new t.Q(m,A))],x=ii(s.center);let b=Number.POSITIVE_INFINITY;for(const e of v)a<0&&(b=mi.getLesserNonNegativeNonNull(b,mi.solveVectorScale(e,x,y,"x",a))),l>0&&(b=mi.getLesserNonNegativeNonNull(b,mi.solveVectorScale(e,x,y,"x",l))),c>0&&(b=mi.getLesserNonNegativeNonNull(b,mi.solveVectorScale(e,x,y,"y",c))),u<0&&(b=mi.getLesserNonNegativeNonNull(b,mi.solveVectorScale(e,x,y,"y",u)));if(Number.isFinite(b)&&0!==b)return s.zoom=_.zoom+t.ah(b),s;zt()}handleJumpToCenterZoom(e,i){const r=e.center.lat,n=e.getConstrained(i.center?t.Q.convert(i.center):e.center,e.zoom).center;e.setCenter(n.wrap());const o=void 0!==i.zoom?+i.zoom:e.zoom+si(r,n.lat);e.zoom!==o&&e.setZoom(o)}handleEaseTo(e,i){const r=e.zoom,n=e.center,o=e.padding,s={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},l=void 0!==i.zoom,c=!e.isPaddingEqual(i.padding);let u=!1;const h=i.center?t.Q.convert(i.center):n,d=e.getConstrained(h,r).center;Et(e,d);const p=e.clone();p.setCenter(d),p.setZoom(l?+i.zoom:r+si(n.lat,h.lat)),p.setBearing(i.bearing);const f=new t.P(t.ae(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.ae(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(d,f);const A=(i.offset&&i.offsetAsPoint.mag())>0?p.center:d,m=l?+i.zoom:r+si(n.lat,A.lat),g=r+si(n.lat,0),_=m+si(A.lat,0),y=t.bq(n.lng,A.lng),v=t.bq(n.lat,A.lat),x=t.ac(_-g);return u=m!==r,{easeFunc:r=>{if(t.b6(s,a)||Rt({startEulerAngles:s,endEulerAngles:a,tr:e,k:r,useSlerp:s.roll!=a.roll}),c&&e.interpolatePadding(o,i.padding,r),i.around)t.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const t=_>g?Math.min(2,x):Math.max(.5,x),i=Math.pow(t,1-r),o=ci(n,y,v,r*i);e.setCenter(o.wrap())}if(u){const i=t.B.number(g,_,r)+si(0,e.center.lat);e.setZoom(i)}},isZooming:u,elevationCenter:A}}handleFlyTo(e,i){const r=void 0!==i.zoom,n=e.center,o=e.zoom,s=e.padding,a=!e.isPaddingEqual(i.padding),l=e.getConstrained(t.Q.convert(i.center||i.locationAtOffset),o).center,c=r?+i.zoom:e.zoom+si(e.center.lat,l.lat),u=e.clone();u.setCenter(l),u.setZoom(c),u.setBearing(i.bearing);const h=new t.P(t.ae(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.ae(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));u.setLocationAtPoint(l,h);const d=u.center;Et(e,d);const p=function(e,i,r){const n=ii(i),o=ii(r),s=t.aV(n,o),a=Math.acos(s),l=ei(e);return a/(2*Math.PI)*l}(e,n,d),f=o+si(n.lat,0),A=c+si(d.lat,0),m=t.ac(A-f);let g;if("number"==typeof i.minZoom){const r=+i.minZoom+si(d.lat,0),n=Math.min(r,f,A)+si(0,d.lat),o=e.getConstrained(d,n).zoom+si(d.lat,0);g=t.ac(o-f)}const _=t.bq(n.lng,d.lng),y=t.bq(n.lat,d.lat);return{easeFunc:(r,o,l,u)=>{const h=ci(n,_,y,l);a&&e.interpolatePadding(s,i.padding,r);const p=1===r?d:h;e.setCenter(p.wrap());const A=f+t.ah(o);e.setZoom(1===r?c:A+si(0,p.lat))},scaleOfZoom:m,targetCenter:d,scaleOfMinZoom:g,pixelPathLength:p}}static solveVectorScale(e,t,i,r,n){const o="x"===r?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],s=[i[3],i[7],i[11],i[15]],a=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],l=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],c=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2];return c+n*l===a+n*u||s[3]*(a-c)+o[3]*(u-l)+a*u==c*l?null:(c+o[3]-n*u-n*s[3])/(c-a-n*u+n*l)}static getLesserNonNegativeNonNull(e,t){return null!==t&&t>=0&&tt.x(e,i&&i.filter((e=>"source.canvas"!==e.identifier))),yi=t.bw();class vi extends t.E{constructor(e,i={}){super(),this._rtlPluginLoaded=()=>{for(const e in this.sourceCaches){const t=this.sourceCaches[e].getSource().type;"vector"!==t&&"geojson"!==t||this.sourceCaches[e].reload()}},this.map=e,this.dispatcher=new D(R(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",((e,t)=>this.getGlyphs(e,t))),this.dispatcher.registerMessageHandler("GI",((e,t)=>this.getImages(e,t))),this.imageManager=new v,this.imageManager.setEventedParent(this),this.glyphManager=new T(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new I(256,512),this.crossTileSymbolIndex=new _t,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.bx,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",t.by()),ne().on(te,this._rtlPluginLoaded),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.sourceCaches[e.sourceId];if(!t)return;const i=t.getSource();if(i&&i.vectorLayerIds)for(const e in this._layers){const t=this._layers[e];t.source===i.id&&this._validateLayer(t)}}))}loadURL(e,i={},r){this.fire(new t.l("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const n=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const o=this._loadStyleRequest;t.j(n,this._loadStyleRequest).then((e=>{this._loadStyleRequest=null,this._load(e.data,i,r)})).catch((e=>{this._loadStyleRequest=null,e&&!o.signal.aborted&&this.fire(new t.k(e))}))}loadJSON(e,i={},r){this.fire(new t.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,s.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(e,i,r)})).catch((()=>{}))}loadEmpty(){this.fire(new t.l("dataloading",{dataType:"style"})),this._load(yi,{validate:!1})}_load(e,i,r){var n,o;const s=i.transformStyle?i.transformStyle(r,e):e;if(!i.validate||!_i(this,t.y(s))){this._loaded=!0,this.stylesheet=s;for(const e in s.sources)this.addSource(e,s.sources[e],{validate:!1});s.sprite?this._loadSprite(s.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(s.glyphs),this._createLayers(),this.light=new S(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new M(this.stylesheet.sky),this.map.setTerrain(null!==(o=this.stylesheet.terrain)&&void 0!==o?o:null),this.fire(new t.l("data",{dataType:"style"})),this.fire(new t.l("style.load"))}}_createLayers(){const e=t.bz(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map((e=>e.id)),this._layers={},this._serializedLayers=null;for(const i of e){const e=t.bA(i);e.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=e}}_loadSprite(e,i=!1,r=void 0){let n;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(e,i,r,n){return t._(this,void 0,void 0,(function*(){const o=m(e),a=r>1?"@2x":"",l={},c={};for(const{id:e,url:r}of o){const o=i.transformRequest(g(r,a,".json"),"SpriteJSON");l[e]=t.j(o,n);const s=i.transformRequest(g(r,a,".png"),"SpriteImage");c[e]=f.getImage(s,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(e,i){return t._(this,void 0,void 0,(function*(){const t={};for(const r in e){t[r]={};const n=s.getImageCanvasContext((yield i[r]).data),o=(yield e[r]).data;for(const e in o){const{width:i,height:s,x:a,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:A}=o[e];t[r][e]={data:null,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:A,spriteData:{width:i,height:s,x:a,y:l,context:n}}}}return t}))}(l,c)}))}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((e=>{if(this._spriteRequest=null,e)for(const t in e){this._spritesImagesIds[t]=[];const r=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in e))):[];for(const e of r)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(const r in e[t]){const n="default"===t?r:`${t}:${r}`;this._spritesImagesIds[t].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,e[t][r],!1):this.imageManager.addImage(n,e[t][r]),i&&(this._changedImages[n]=!0)}}})).catch((e=>{this._spriteRequest=null,n=e,this.fire(new t.k(n))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"})),r&&r(n)}))}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const r=e.sourceLayer;if(!r)return;const n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(r))&&this.fire(new t.k(new Error(`Source layer "${r}" does not exist on source "${n.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,i=!1){const r=this._serializedAllLayers();if(!e||0===e.length)return Object.values(i?t.bB(r):r);const n=[];for(const o of e)if(r[o]){const e=i?t.bB(r[o]):r[o];n.push(e)}return n}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const t=Object.keys(this._layers);for(const i of t){const t=this._layers[i];"custom"!==t.type&&(e[i]=t.serialize())}return e}hasTransitions(){var e,t,i;if(null===(e=this.light)||void 0===e?void 0:e.hasTransition())return!0;if(null===(t=this.sky)||void 0===t?void 0:t.hasTransition())return!0;if(null===(i=this.projection)||void 0===i?void 0:i.hasTransition())return!0;for(const e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].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(i){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const e in this._updatedSources){const t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const r={};for(const e in this.sourceCaches){const t=this.sourceCaches[e];r[e]=t.used,t.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 r){const i=this.sourceCaches[e];!!r[e]!=!!i.used&&i.fire(new t.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new t.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var r;this._checkLoaded();const n=this.serialize();if(e=i.transformStyle?i.transformStyle(n,e):e,(null===(r=i.validate)||void 0===r||r)&&_i(this,t.y(e)))return!1;(e=t.bB(e)).layers=t.bz(e.layers);const o=t.bC(n,e),s=this._getOperationsToPerform(o);if(s.unimplemented.length>0)throw new Error(`Unimplemented: ${s.unimplemented.join(", ")}.`);if(0===s.operations.length)return!1;for(const e of s.operations)e();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const t=[],i=[];for(const r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push((()=>this.addLayer.apply(this,r.args)));break;case"removeLayer":t.push((()=>this.removeLayer.apply(this,r.args)));break;case"setPaintProperty":t.push((()=>this.setPaintProperty.apply(this,r.args)));break;case"setLayoutProperty":t.push((()=>this.setLayoutProperty.apply(this,r.args)));break;case"setFilter":t.push((()=>this.setFilter.apply(this,r.args)));break;case"addSource":t.push((()=>this.addSource.apply(this,r.args)));break;case"removeSource":t.push((()=>this.removeSource.apply(this,r.args)));break;case"setLayerZoomRange":t.push((()=>this.setLayerZoomRange.apply(this,r.args)));break;case"setLight":t.push((()=>this.setLight.apply(this,r.args)));break;case"setGeoJSONSourceData":t.push((()=>this.setGeoJSONSourceData.apply(this,r.args)));break;case"setGlyphs":t.push((()=>this.setGlyphs.apply(this,r.args)));break;case"setSprite":t.push((()=>this.setSprite.apply(this,r.args)));break;case"setTerrain":t.push((()=>this.map.setTerrain.apply(this,r.args)));break;case"setSky":t.push((()=>this.setSky.apply(this,r.args)));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setTransition":t.push((()=>{}));break;default:i.push(r.command)}return{operations:t,unimplemented:i}}addImage(e,i){if(this.getImage(e))return this.fire(new t.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.k(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("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.y.source,`sources.${e}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=this.sourceCaches[e]=new ve(e,i,this.dispatcher);n.style=this,n.setEventedParent(this,(()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:e}))),n.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.k(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.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error(`There is no source with this ID=${e}`);const i=this.sourceCaches[e].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,i,r={}){this._checkLoaded();const n=e.id;if(this.getLayer(n))return void this.fire(new t.k(new Error(`Layer "${n}" already exists on this map.`)));let o;if("custom"===e.type){if(_i(this,t.bD(e)))return;o=t.bA(e)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=t.bB(e),e=t.e(e,{source:n})),this._validate(t.y.layer,`layers.${n}`,e,{arrayIndex:-1},r))return;o=t.bA(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)this.fire(new t.k(new Error(`Cannot add layer "${n}" before non-existing layer "${i}".`)));else{if(this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source&&"custom"!==o.type){const e=this._removedLayers[n];delete this._removedLayers[n],e.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.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const r=this._order.indexOf(e);this._order.splice(r,1);const n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new t.k(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.k(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const r=this._order.indexOf(e);this._order.splice(r,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(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,r){this._checkLoaded();const n=this.getLayer(e);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new t.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,r={}){this._checkLoaded();const n=this.getLayer(e);if(n){if(!t.bE(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.y.filter,`layers.${n.id}.filter`,i,null,r)||(n.filter=t.bB(i),this._updateLayer(n)))}else this.fire(new t.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bB(this.getLayer(e).filter)}setLayoutProperty(e,i,r,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bE(o.getLayoutProperty(i),r)||(o.setLayoutProperty(i,r,n),this._updateLayer(o)):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,r,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bE(o.getPaintProperty(i),r)||(o.setPaintProperty(i,r,n)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,i){this._checkLoaded();const r=e.source,n=e.sourceLayer,o=this.sourceCaches[r];if(void 0===o)return void this.fire(new t.k(new Error(`The source '${r}' does not exist in the map's style.`)));const s=o.getSource().type;"geojson"===s&&n?this.fire(new t.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||n?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,e.id,i)):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const r=e.source,n=this.sourceCaches[r];if(void 0===n)return void this.fire(new t.k(new Error(`The source '${r}' does not exist in the map's style.`)));const o=n.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.k(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(s,e.id,i):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,r=e.sourceLayer,n=this.sourceCaches[i];if(void 0!==n)return"vector"!==n.getSource().type||r?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),n.getFeatureState(r,e.id)):void this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=t.bF(this.sourceCaches,(e=>e.serialize())),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,n=this.stylesheet;return t.bG({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:e,layers:i,terrain:r},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.sourceCaches[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,i={},r=[];for(let n=this._order.length-1;n>=0;n--){const o=this._order[n];if(t(o)){i[o]=n;for(const t of e){const e=t[o];if(e)for(const t of e)r.push(t)}}}r.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const n=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if(t(s))for(let e=r.length-1;e>=0;e--){const t=r[e].feature;if(i[t.layer.id]this.map.terrain.getElevation(e,t,i):void 0));return this.placement&&o.push(function(e,t,i,r,n,o,s){const a={},l=o.queryRenderedSymbols(r),c=[];for(const e of Object.keys(l).map(Number))c.push(s[e]);c.sort(Q);for(const i of c){const r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(const e in r){const t=a[e]=a[e]||[],n=r[e];n.sort(((e,t)=>{const r=i.featureSortOrder;if(r){const i=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex}));for(const e of n)t.push(e)}}return function(e,t,i){for(const r in e)for(const n of e[r])j(n,i[t[r].source]);return e}(a,e,i)}(this._layers,s,this.sourceCaches,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.y.filter,"querySourceFeatures.filter",i.filter,null,i);const r=this.sourceCaches[e];return r?function(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],n={};for(let e=0;ee.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.now(),e.zoom))&&(this.pauseablePlacement=new pt(e,this.map.terrain,this._order,n,t,i,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(s.now()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(const e of this._order){const t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,l[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(s.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,i){return t._(this,void 0,void 0,(function*(){const e=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const t=this.sourceCaches[i.source];return t&&t.setDependencies(i.tileID.key,i.type,i.icons),e}))}getGlyphs(e,i){return t._(this,void 0,void 0,(function*(){const e=yield this.glyphManager.getGlyphs(i.stacks),t=this.sourceCaches[i.source];return t&&t.setDependencies(i.tileID.key,i.type,[""]),e}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.y.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,r={},n){this._checkLoaded();const o=[{id:e,url:i}],s=[...m(this.stylesheet.sprite),...o];this._validate(t.y.sprite,"sprite",s,null,r)||(this.stylesheet.sprite=s,this._loadSprite(o,!0,n))}removeSprite(e){this._checkLoaded();const i=m(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("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}else this.fire(new t.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return m(this.stylesheet.sprite)}setSprite(e,i={},r){this._checkLoaded(),e&&this._validate(t.y.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}}var xi=t.aG([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class bi{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,r,n,o,s,a,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!c&&e({u_texture:0,u_ele_delta:e,u_fog_matrix:i,u_fog_color:r?r.properties.get("fog-color"):t.b7.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:r?r.calculateFogBlendOpacity(n):0,u_horizon_color:r?r.properties.get("horizon-color"):t.b7.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),Ti={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Bi(e){const t=[];for(let i=0;i({u_depth:new t.bH(e,i.u_depth),u_terrain:new t.bH(e,i.u_terrain),u_terrain_dim:new t.b8(e,i.u_terrain_dim),u_terrain_matrix:new t.bJ(e,i.u_terrain_matrix),u_terrain_unpack:new t.bK(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.b8(e,i.u_terrain_exaggeration)}))(e,T),this.projectionUniforms=((e,i)=>({u_projection_matrix:new t.bJ(e,i.u_projection_matrix),u_projection_tile_mercator_coords:new t.bK(e,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.bK(e,i.u_projection_clipping_plane),u_projection_transition:new t.b8(e,i.u_projection_transition),u_projection_fallback_matrix:new t.bJ(e,i.u_projection_fallback_matrix)}))(e,T),this.binderUniforms=r?r.getUniforms(e,T):[]}draw(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,A,m,g,_){const y=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(n),e.setCullFace(o),a){e.activeTexture.set(y.TEXTURE2),y.bindTexture(y.TEXTURE_2D,a.depthTexture),e.activeTexture.set(y.TEXTURE3),y.bindTexture(y.TEXTURE_2D,a.texture);for(const e in this.terrainUniforms)this.terrainUniforms[e].set(a[e])}if(l)for(const e in l)this.projectionUniforms[Ti[e]].set(l[e]);if(s)for(const e in this.fixedUniforms)this.fixedUniforms[e].set(s[e]);A&&A.setUniforms(e,this.binderUniforms,p,{zoom:f});let v=0;switch(t){case y.LINES:v=2;break;case y.TRIANGLES:v=3;break;case y.LINE_STRIP:v=1}for(const i of d.get()){const r=i.vaos||(i.vaos={});(r[c]||(r[c]=new bi)).bind(e,this,u,A?A.getPaintVertexBuffers():[],h,i.vertexOffset,m,g,_),y.drawElements(t,i.primitiveLength*v,y.UNSIGNED_SHORT,i.primitiveOffset*v*2)}}}function Si(e,i,r){const n=1/t.az(r,1,i.transform.tileZoom),o=Math.pow(2,r.tileID.overscaledZ),s=r.tileSize*Math.pow(2,i.transform.tileZoom)/o,a=s*(r.tileID.canonical.x+r.tileID.wrap*o),l=s*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[n,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[a>>16,l>>16],u_pixel_coord_lower:[65535&a,65535&l]}}const Ei=(e,i,r,n)=>{const o=e.style.light,s=o.properties.get("position"),a=[s.x,s.y,s.z],l=t.bN();"viewport"===o.properties.get("anchor")&&t.bO(l,e.transform.bearingInRadians),t.bP(a,a,l);const c=e.transform.transformLightDirection(a),u=o.properties.get("color");return{u_lightpos:a,u_lightpos_globe:c,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:n}},Mi=(e,i,r,n,o,s,a)=>t.e(Ei(e,i,r,n),Si(s,e,a),{u_height_factor:-Math.pow(2,o.overscaledZ)/a.tileSize/8}),Ii=(e,i,r,n)=>t.e(Si(i,e,r),{u_fill_translate:n}),Pi=(e,t)=>({u_world:e,u_fill_translate:t}),Li=(e,i,r,n,o)=>t.e(Ii(e,i,r,o),{u_world:n}),Fi=(e,i,r,n,o)=>{const s=e.transform;let a,l,c=0;if("map"===r.paint.get("circle-pitch-alignment")){const e=t.az(i,1,s.zoom);a=!0,l=[e,e],c=e/(t.Z*Math.pow(2,i.tileID.overscaledZ))*2*Math.PI*o}else a=!1,l=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+a,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:n}},ki=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),zi=e=>({u_viewport_size:[e.width,e.height]}),Ri=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),Di=(e,i,r,n)=>{const o=t.az(e,1,i)/(t.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:t.az(e,1,i),u_intensity:r,u_globe_extrude_scale:o}},Oi=(e,i,r,n)=>{const o=t.K();t.bQ(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:r,u_color_ramp:n,u_opacity:i.paint.get("heatmap-opacity")}},Ui=(e,t,i)=>{const r=i.paint.get("hillshade-shadow-color"),n=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color");let s=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return"viewport"===i.paint.get("hillshade-illumination-anchor")&&(s+=e.transform.bearingInRadians),{u_image:0,u_latrange:Qi(0,t.tileID),u_light:[i.paint.get("hillshade-exaggeration"),s],u_shadow:r,u_highlight:n,u_accent:o}},Ni=(e,i)=>{const r=i.stride,n=t.K();return t.bQ(n,0,t.Z,-8192,0,0,1),t.L(n,n,[0,-8192,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}};function Qi(e,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new t.$(0,n/r).toLngLat().lat,new t.$(0,(n+1)/r).toLngLat().lat]}const ji=(e,i,r,n)=>{const o=e.transform;return{u_translation:Zi(e,i,r),u_ratio:n/t.az(i,1,o.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Vi=(e,i,r,n,o)=>t.e(ji(e,i,r,n),{u_image:0,u_image_height:o}),Hi=(e,i,r,n,o)=>{const s=e.transform,a=$i(i,s);return{u_translation:Zi(e,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:n/t.az(i,1,s.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[a,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},Gi=(e,i,r,n,o,s)=>{const a=e.lineAtlas,l=$i(i,e.transform),c="round"===r.layout.get("line-cap"),u=a.getDash(o.from,c),h=a.getDash(o.to,c),d=u.width*s.fromScale,p=h.width*s.toScale;return t.e(ji(e,i,r,n),{u_patternscale_a:[l/d,-u.height/2],u_patternscale_b:[l/p,-h.height/2],u_sdfgamma:a.width/(256*Math.min(d,p)*e.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:h.y,u_mix:s.t})};function $i(e,i){return 1/t.az(e,1,i.tileZoom)}function Zi(e,i,r){return t.aA(e.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const qi=(e,t,i,r,n)=>{return{u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.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:Ki(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]};var o,s};function Ki(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const Wi=(e,t,i,r,n,o,s,a,l,c,u,h,d)=>{const p=s.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:p.width/p.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:o,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:d}},Xi=(e,i,r,n,o,s,a,l,c,u,h,d,p,f)=>{const A=a.transform;return t.e(Wi(e,i,r,n,o,s,a,l,c,u,h,d,f),{u_gamma_scale:n?Math.cos(A.pitch*Math.PI/180)*A.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:1})},Yi=(e,i,r,n,o,s,a,l,c,u,h,d,p)=>t.e(Xi(e,i,r,n,o,s,a,l,c,u,!0,h,0,p),{u_texsize_icon:d,u_texture_icon:1}),Ji=(e,t)=>({u_opacity:e,u_color:t}),er=(e,i,r,n,o)=>t.e(function(e,i,r,n){const o=r.imageManager.getPattern(e.from.toString()),s=r.imageManager.getPattern(e.to.toString()),{width:a,height:l}=r.imageManager.getPixelSize(),c=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,r.transform.tileZoom)/c,h=u*(n.tileID.canonical.x+n.tileID.wrap*c),d=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[a,l],u_mix:i.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/t.az(n,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(r,o,i,n),{u_opacity:e}),tr=(e,t)=>{},ir={fillExtrusion:(e,i)=>({u_lightpos:new t.bL(e,i.u_lightpos),u_lightpos_globe:new t.bL(e,i.u_lightpos_globe),u_lightintensity:new t.b8(e,i.u_lightintensity),u_lightcolor:new t.bL(e,i.u_lightcolor),u_vertical_gradient:new t.b8(e,i.u_vertical_gradient),u_opacity:new t.b8(e,i.u_opacity),u_fill_translate:new t.bM(e,i.u_fill_translate)}),fillExtrusionPattern:(e,i)=>({u_lightpos:new t.bL(e,i.u_lightpos),u_lightpos_globe:new t.bL(e,i.u_lightpos_globe),u_lightintensity:new t.b8(e,i.u_lightintensity),u_lightcolor:new t.bL(e,i.u_lightcolor),u_vertical_gradient:new t.b8(e,i.u_vertical_gradient),u_height_factor:new t.b8(e,i.u_height_factor),u_opacity:new t.b8(e,i.u_opacity),u_fill_translate:new t.bM(e,i.u_fill_translate),u_image:new t.bH(e,i.u_image),u_texsize:new t.bM(e,i.u_texsize),u_pixel_coord_upper:new t.bM(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bM(e,i.u_pixel_coord_lower),u_scale:new t.bL(e,i.u_scale),u_fade:new t.b8(e,i.u_fade)}),fill:(e,i)=>({u_fill_translate:new t.bM(e,i.u_fill_translate)}),fillPattern:(e,i)=>({u_image:new t.bH(e,i.u_image),u_texsize:new t.bM(e,i.u_texsize),u_pixel_coord_upper:new t.bM(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bM(e,i.u_pixel_coord_lower),u_scale:new t.bL(e,i.u_scale),u_fade:new t.b8(e,i.u_fade),u_fill_translate:new t.bM(e,i.u_fill_translate)}),fillOutline:(e,i)=>({u_world:new t.bM(e,i.u_world),u_fill_translate:new t.bM(e,i.u_fill_translate)}),fillOutlinePattern:(e,i)=>({u_world:new t.bM(e,i.u_world),u_image:new t.bH(e,i.u_image),u_texsize:new t.bM(e,i.u_texsize),u_pixel_coord_upper:new t.bM(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bM(e,i.u_pixel_coord_lower),u_scale:new t.bL(e,i.u_scale),u_fade:new t.b8(e,i.u_fade),u_fill_translate:new t.bM(e,i.u_fill_translate)}),circle:(e,i)=>({u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_scale_with_map:new t.bH(e,i.u_scale_with_map),u_pitch_with_map:new t.bH(e,i.u_pitch_with_map),u_extrude_scale:new t.bM(e,i.u_extrude_scale),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_globe_extrude_scale:new t.b8(e,i.u_globe_extrude_scale),u_translate:new t.bM(e,i.u_translate)}),collisionBox:(e,i)=>({u_pixel_extrude_scale:new t.bM(e,i.u_pixel_extrude_scale)}),collisionCircle:(e,i)=>({u_viewport_size:new t.bM(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.bI(e,i.u_color),u_overlay:new t.bH(e,i.u_overlay),u_overlay_scale:new t.b8(e,i.u_overlay_scale)}),depth:tr,clippingMask:tr,heatmap:(e,i)=>({u_extrude_scale:new t.b8(e,i.u_extrude_scale),u_intensity:new t.b8(e,i.u_intensity),u_globe_extrude_scale:new t.b8(e,i.u_globe_extrude_scale)}),heatmapTexture:(e,i)=>({u_matrix:new t.bJ(e,i.u_matrix),u_world:new t.bM(e,i.u_world),u_image:new t.bH(e,i.u_image),u_color_ramp:new t.bH(e,i.u_color_ramp),u_opacity:new t.b8(e,i.u_opacity)}),hillshade:(e,i)=>({u_image:new t.bH(e,i.u_image),u_latrange:new t.bM(e,i.u_latrange),u_light:new t.bM(e,i.u_light),u_shadow:new t.bI(e,i.u_shadow),u_highlight:new t.bI(e,i.u_highlight),u_accent:new t.bI(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.bJ(e,i.u_matrix),u_image:new t.bH(e,i.u_image),u_dimension:new t.bM(e,i.u_dimension),u_zoom:new t.b8(e,i.u_zoom),u_unpack:new t.bK(e,i.u_unpack)}),line:(e,i)=>({u_translation:new t.bM(e,i.u_translation),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bM(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_translation:new t.bM(e,i.u_translation),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bM(e,i.u_units_to_pixels),u_image:new t.bH(e,i.u_image),u_image_height:new t.b8(e,i.u_image_height)}),linePattern:(e,i)=>({u_translation:new t.bM(e,i.u_translation),u_texsize:new t.bM(e,i.u_texsize),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_image:new t.bH(e,i.u_image),u_units_to_pixels:new t.bM(e,i.u_units_to_pixels),u_scale:new t.bL(e,i.u_scale),u_fade:new t.b8(e,i.u_fade)}),lineSDF:(e,i)=>({u_translation:new t.bM(e,i.u_translation),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bM(e,i.u_units_to_pixels),u_patternscale_a:new t.bM(e,i.u_patternscale_a),u_patternscale_b:new t.bM(e,i.u_patternscale_b),u_sdfgamma:new t.b8(e,i.u_sdfgamma),u_image:new t.bH(e,i.u_image),u_tex_y_a:new t.b8(e,i.u_tex_y_a),u_tex_y_b:new t.b8(e,i.u_tex_y_b),u_mix:new t.b8(e,i.u_mix)}),raster:(e,i)=>({u_tl_parent:new t.bM(e,i.u_tl_parent),u_scale_parent:new t.b8(e,i.u_scale_parent),u_buffer_scale:new t.b8(e,i.u_buffer_scale),u_fade_t:new t.b8(e,i.u_fade_t),u_opacity:new t.b8(e,i.u_opacity),u_image0:new t.bH(e,i.u_image0),u_image1:new t.bH(e,i.u_image1),u_brightness_low:new t.b8(e,i.u_brightness_low),u_brightness_high:new t.b8(e,i.u_brightness_high),u_saturation_factor:new t.b8(e,i.u_saturation_factor),u_contrast_factor:new t.b8(e,i.u_contrast_factor),u_spin_weights:new t.bL(e,i.u_spin_weights),u_coords_top:new t.bK(e,i.u_coords_top),u_coords_bottom:new t.bK(e,i.u_coords_bottom)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.bH(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bH(e,i.u_is_size_feature_constant),u_size_t:new t.b8(e,i.u_size_t),u_size:new t.b8(e,i.u_size),u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_pitch:new t.b8(e,i.u_pitch),u_rotate_symbol:new t.bH(e,i.u_rotate_symbol),u_aspect_ratio:new t.b8(e,i.u_aspect_ratio),u_fade_change:new t.b8(e,i.u_fade_change),u_label_plane_matrix:new t.bJ(e,i.u_label_plane_matrix),u_coord_matrix:new t.bJ(e,i.u_coord_matrix),u_is_text:new t.bH(e,i.u_is_text),u_pitch_with_map:new t.bH(e,i.u_pitch_with_map),u_is_along_line:new t.bH(e,i.u_is_along_line),u_is_variable_anchor:new t.bH(e,i.u_is_variable_anchor),u_texsize:new t.bM(e,i.u_texsize),u_texture:new t.bH(e,i.u_texture),u_translation:new t.bM(e,i.u_translation),u_pitched_scale:new t.b8(e,i.u_pitched_scale)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.bH(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bH(e,i.u_is_size_feature_constant),u_size_t:new t.b8(e,i.u_size_t),u_size:new t.b8(e,i.u_size),u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_pitch:new t.b8(e,i.u_pitch),u_rotate_symbol:new t.bH(e,i.u_rotate_symbol),u_aspect_ratio:new t.b8(e,i.u_aspect_ratio),u_fade_change:new t.b8(e,i.u_fade_change),u_label_plane_matrix:new t.bJ(e,i.u_label_plane_matrix),u_coord_matrix:new t.bJ(e,i.u_coord_matrix),u_is_text:new t.bH(e,i.u_is_text),u_pitch_with_map:new t.bH(e,i.u_pitch_with_map),u_is_along_line:new t.bH(e,i.u_is_along_line),u_is_variable_anchor:new t.bH(e,i.u_is_variable_anchor),u_texsize:new t.bM(e,i.u_texsize),u_texture:new t.bH(e,i.u_texture),u_gamma_scale:new t.b8(e,i.u_gamma_scale),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_is_halo:new t.bH(e,i.u_is_halo),u_translation:new t.bM(e,i.u_translation),u_pitched_scale:new t.b8(e,i.u_pitched_scale)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.bH(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bH(e,i.u_is_size_feature_constant),u_size_t:new t.b8(e,i.u_size_t),u_size:new t.b8(e,i.u_size),u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_pitch:new t.b8(e,i.u_pitch),u_rotate_symbol:new t.bH(e,i.u_rotate_symbol),u_aspect_ratio:new t.b8(e,i.u_aspect_ratio),u_fade_change:new t.b8(e,i.u_fade_change),u_label_plane_matrix:new t.bJ(e,i.u_label_plane_matrix),u_coord_matrix:new t.bJ(e,i.u_coord_matrix),u_is_text:new t.bH(e,i.u_is_text),u_pitch_with_map:new t.bH(e,i.u_pitch_with_map),u_is_along_line:new t.bH(e,i.u_is_along_line),u_is_variable_anchor:new t.bH(e,i.u_is_variable_anchor),u_texsize:new t.bM(e,i.u_texsize),u_texsize_icon:new t.bM(e,i.u_texsize_icon),u_texture:new t.bH(e,i.u_texture),u_texture_icon:new t.bH(e,i.u_texture_icon),u_gamma_scale:new t.b8(e,i.u_gamma_scale),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_is_halo:new t.bH(e,i.u_is_halo),u_translation:new t.bM(e,i.u_translation),u_pitched_scale:new t.b8(e,i.u_pitched_scale)}),background:(e,i)=>({u_opacity:new t.b8(e,i.u_opacity),u_color:new t.bI(e,i.u_color)}),backgroundPattern:(e,i)=>({u_opacity:new t.b8(e,i.u_opacity),u_image:new t.bH(e,i.u_image),u_pattern_tl_a:new t.bM(e,i.u_pattern_tl_a),u_pattern_br_a:new t.bM(e,i.u_pattern_br_a),u_pattern_tl_b:new t.bM(e,i.u_pattern_tl_b),u_pattern_br_b:new t.bM(e,i.u_pattern_br_b),u_texsize:new t.bM(e,i.u_texsize),u_mix:new t.b8(e,i.u_mix),u_pattern_size_a:new t.bM(e,i.u_pattern_size_a),u_pattern_size_b:new t.bM(e,i.u_pattern_size_b),u_scale_a:new t.b8(e,i.u_scale_a),u_scale_b:new t.b8(e,i.u_scale_b),u_pixel_coord_upper:new t.bM(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bM(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.b8(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_texture:new t.bH(e,i.u_texture),u_ele_delta:new t.b8(e,i.u_ele_delta),u_fog_matrix:new t.bJ(e,i.u_fog_matrix),u_fog_color:new t.bI(e,i.u_fog_color),u_fog_ground_blend:new t.b8(e,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.b8(e,i.u_fog_ground_blend_opacity),u_horizon_color:new t.bI(e,i.u_horizon_color),u_horizon_fog_blend:new t.b8(e,i.u_horizon_fog_blend),u_is_globe_mode:new t.b8(e,i.u_is_globe_mode)}),terrainDepth:(e,i)=>({u_ele_delta:new t.b8(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_texture:new t.bH(e,i.u_texture),u_terrain_coords_id:new t.b8(e,i.u_terrain_coords_id),u_ele_delta:new t.b8(e,i.u_ele_delta)}),projectionErrorMeasurement:(e,i)=>({u_input:new t.b8(e,i.u_input),u_output_expected:new t.b8(e,i.u_output_expected)}),atmosphere:(e,i)=>({u_sun_pos:new t.bL(e,i.u_sun_pos),u_atmosphere_blend:new t.b8(e,i.u_atmosphere_blend),u_globe_position:new t.bL(e,i.u_globe_position),u_globe_radius:new t.b8(e,i.u_globe_radius),u_inv_proj_matrix:new t.bJ(e,i.u_inv_proj_matrix)}),sky:(e,i)=>({u_sky_color:new t.bI(e,i.u_sky_color),u_horizon_color:new t.bI(e,i.u_horizon_color),u_horizon:new t.bM(e,i.u_horizon),u_horizon_normal:new t.bM(e,i.u_horizon_normal),u_sky_horizon_blend:new t.b8(e,i.u_sky_horizon_blend),u_sky_blend:new t.b8(e,i.u_sky_blend)})};class rr{constructor(e,t,i){this.context=e;const r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const nr={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class or{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i0&&(u.push({circleArray:m,circleOffset:d,coord:p}),h+=m.length/4,d=h),A&&c.draw(s,l.LINES,jt.disabled,Ht.disabled,e.colorModeForRenderPass(),Qt.disabled,ki(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(p),a.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,A.layoutVertexBuffer,A.indexBuffer,A.segments,null,e.transform.zoom,null,null,A.collisionVertexBuffer)}if(!o||!u.length)return;const p=e.useProgram("collisionCircle"),f=new t.bR;f.resize(4*h),f._trim();let A=0;for(const e of u)for(let t=0;t=0&&(m[g.associatedIconIndex]={shiftedAnchor:E,angle:M})}else Ge(g.numGlyphs,f)}if(c){A.clear();const i=e.icon.placedSymbolArray;for(let e=0;ee.style.map.terrain.getElevation(l,t,i):null,i="map"===r.layout.get("text-rotation-alignment");Le(c,e,o,O,U,_,u,i,l.toUnwrapped(),m.width,m.height,Q,t)}const G=o&&T||H,$=y||G?Zr:_?O:e.transform.clipSpaceToPixelsMatrix,Z=f&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let q;q=f?c.iconsInText?Yi(w.kind,M,v,_,y,G,e,$,N,Q,P,z,C):Xi(w.kind,M,v,_,y,G,e,$,N,Q,o,P,0,C):Wi(w.kind,M,v,_,y,G,e,$,N,Q,o,P,C);const K={program:E,buffers:h,uniformValues:q,projectionData:j,atlasTexture:L,atlasTextureIcon:R,atlasInterpolation:F,atlasInterpolationIcon:k,isSDF:f,hasHalo:Z};if(x&&c.canOverlap){b=!0;const e=h.segments.get();for(const i of e)B.push({segments:new t.aJ([i]),sortKey:i.sortKey,state:K,terrainData:I})}else B.push({segments:h.segments,sortKey:0,state:K,terrainData:I})}b&&B.sort(((e,t)=>e.sortKey-t.sortKey));for(const t of B){const i=t.state;if(f.activeTexture.set(A.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,A.CLAMP_TO_EDGE),i.atlasTextureIcon&&(f.activeTexture.set(A.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,A.CLAMP_TO_EDGE)),i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Jr(i.buffers,t.segments,r,e,i.program,w,h,d,n,i.projectionData,t.terrainData)),n.u_is_halo=0}Jr(i.buffers,t.segments,r,e,i.program,w,h,d,i.uniformValues,i.projectionData,t.terrainData)}}function Jr(e,t,i,r,n,o,s,a,l,c,u){const h=r.context;n.draw(h,h.gl.TRIANGLES,o,s,a,Qt.backCCW,l,u,c,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function en(e,i,r,n,o){const s=e.context,a=s.gl,l=Ht.disabled,c=new Ut([a.ONE,a.ONE],t.b7.transparent,[!0,!0,!0,!0]),u=i.getBucket(r);if(!u)return;const h=n.key;let d=r.heatmapFbos.get(h);d||(d=rn(s,i.tileSize,i.tileSize),r.heatmapFbos.set(h,d)),s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,i.tileSize,i.tileSize]),s.clear({color:t.b7.transparent});const p=u.programConfigurations.get(r.id),f=e.useProgram("heatmap",p,!o),A=e.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),m=e.style.map.terrain.getTerrainData(n);f.draw(s,a.TRIANGLES,jt.disabled,l,c,Qt.disabled,Di(i,e.transform.zoom,r.paint.get("heatmap-intensity"),1),m,A,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,p)}function tn(e,t,i,r,n){const o=e.context,s=o.gl,a=e.transform;o.setColorMode(e.colorModeForRenderPass());const l=nn(o,t),c=i.key,u=t.heatmapFbos.get(c);if(!u)return;o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u.colorAttachment.get()),o.activeTexture.set(s.TEXTURE1),l.bind(s.LINEAR,s.CLAMP_TO_EDGE);const h=a.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});e.useProgram("heatmapTexture").draw(o,s.TRIANGLES,jt.disabled,Ht.disabled,e.colorModeForRenderPass(),Qt.disabled,Oi(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,a.zoom),u.destroy(),t.heatmapFbos.delete(c)}function rn(e,t,i){var r,n;const o=e.gl,s=o.createTexture();o.bindTexture(o.TEXTURE_2D,s),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);const a=null!==(r=e.HALF_FLOAT)&&void 0!==r?r:o.UNSIGNED_BYTE,l=null!==(n=e.RGBA16F)&&void 0!==n?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,t,i,0,o.RGBA,a,null);const c=e.createFramebuffer(t,i,!1,!1);return c.colorAttachment.set(s),c}function nn(e,t){return t.colorRampTexture||(t.colorRampTexture=new _(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function on(e,t,i,r,n){if(!i||!r||!r.imageAtlas)return;const o=r.imageAtlas.patternPositions;let s=o[i.to.toString()],a=o[i.from.toString()];if(!s&&a&&(s=a),!a&&s&&(a=s),!s||!a){const e=n.getPaintProperty(t);s=o[e],a=o[e]}s&&a&&e.setConstantPatternPositions(s,a)}function sn(e,i,r,n,o,s,a,l){const c=e.context.gl,u="fill-pattern",h=r.paint.get(u),d=h&&h.constantOr(1),p=r.getCrossfadeParameters();let f,A,m,g,_;const y=e.transform,v=r.paint.get("fill-translate"),x=r.paint.get("fill-translate-anchor");a?(A=d&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=c.LINES):(A=d?"fillPattern":"fill",f=c.TRIANGLES);const b=h.constantOr(null);for(const h of n){const w=i.getTile(h);if(d&&!w.patternsLoaded())continue;const T=w.getBucket(r);if(!T)continue;const B=T.programConfigurations.get(r.id),C=e.useProgram(A,B),S=e.style.map.terrain&&e.style.map.terrain.getTerrainData(h);d&&(e.context.activeTexture.set(c.TEXTURE0),w.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),B.updatePaintBuffers(p)),on(B,u,b,w,r);const E=y.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),M=t.aA(y,w,v,x);if(a){g=T.indexBuffer2,_=T.segments2;const t=[c.drawingBufferWidth,c.drawingBufferHeight];m="fillOutlinePattern"===A&&d?Li(e,p,w,t,M):Pi(t,M)}else g=T.indexBuffer,_=T.segments,m=d?Ii(e,p,w,M):{u_fill_translate:M};let I;if("translucent"===e.renderPass&&l){const[t]=e.getStencilConfigForOverlapAndUpdateStencilID(n);I=t[h.overscaledZ]}else I=e.stencilModeForClipping(h);C.draw(e.context,f,o,I,s,Qt.backCCW,m,S,E,r.id,T.layoutVertexBuffer,g,_,r.paint,e.transform.zoom,B)}}function an(e,i,r,n,o,s,a,l){const c=e.context,u=c.gl,h="fill-extrusion-pattern",d=r.paint.get(h),p=d.constantOr(1),f=r.getCrossfadeParameters(),A=r.paint.get("fill-extrusion-opacity"),m=d.constantOr(null),g=e.transform;for(const d of n){const n=i.getTile(d),_=n.getBucket(r);if(!_)continue;const y=e.style.map.terrain&&e.style.map.terrain.getTerrainData(d),v=_.programConfigurations.get(r.id),x=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",v);p&&(e.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),v.updatePaintBuffers(f));const b=g.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!l,applyTerrainMatrix:!0});on(v,h,m,n,r);const w=t.aA(g,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),T=r.paint.get("fill-extrusion-vertical-gradient"),B=p?Mi(e,T,A,w,d,f,n):Ei(e,T,A,w);x.draw(c,c.gl.TRIANGLES,o,s,a,Qt.backCCW,B,y,b,r.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,r.paint,e.transform.zoom,v,e.style.map.terrain&&_.centroidVertexBuffer)}}function ln(e,t,i,r,n,o,s,a,l){var c;const u=e.style.projection,h=e.context,d=e.transform,p=h.gl,f=e.useProgram("hillshade"),A=!e.options.moving;for(const m of r){const r=t.getTile(m),g=r.fbo;if(!g)continue;const _=u.getMeshFromTileID(h,m.canonical,a,!0,"raster"),y=null===(c=e.style.map.terrain)||void 0===c?void 0:c.getTerrainData(m);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,g.colorAttachment.get());const v=d.getProjectionData({overscaledTileID:m,aligned:A,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(h,p.TRIANGLES,o,n[m.overscaledZ],s,Qt.backCCW,Ui(e,r,i),y,v,i.id,_.vertexBuffer,_.indexBuffer,_.segments)}}const cn=[new t.P(0,0),new t.P(t.Z,0),new t.P(t.Z,t.Z),new t.P(0,t.Z)];function un(e,t,i,r,n,o,s,a,l=!1,c=!1){const u=r[r.length-1].overscaledZ,h=e.context,d=h.gl,p=e.useProgram("raster"),f=e.transform,A=e.style.projection,m=e.colorModeForRenderPass(),g=!e.options.moving;for(const _ of r){const r=e.getDepthModeForSublayer(_.overscaledZ-u,1===i.paint.get("raster-opacity")?jt.ReadWrite:jt.ReadOnly,d.LESS),y=t.getTile(_);y.registerFadeDuration(i.paint.get("raster-fade-duration"));const v=t.findLoadedParent(_,0),x=t.findLoadedSibling(_),b=hn(y,v||x||null,t,i,e.transform,e.style.map.terrain);let w,T;const B="nearest"===i.paint.get("raster-resampling")?d.NEAREST:d.LINEAR;h.activeTexture.set(d.TEXTURE0),y.texture.bind(B,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(d.TEXTURE1),v?(v.texture.bind(B,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),w=Math.pow(2,v.tileID.overscaledZ-y.tileID.overscaledZ),T=[y.tileID.canonical.x*w%1,y.tileID.canonical.y*w%1]):y.texture.bind(B,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),y.texture.useMipmap&&h.extTextureFilterAnisotropic&&e.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const C=e.style.map.terrain&&e.style.map.terrain.getTerrainData(_),S=f.getProjectionData({overscaledTileID:_,aligned:g,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),E=qi(T||[0,0],w||1,b,i,a),M=A.getMeshFromTileID(h,_.canonical,o,s,"raster");p.draw(h,d.TRIANGLES,r,n?n[_.overscaledZ]:Ht.disabled,m,l?Qt.frontCCW:Qt.backCCW,E,C,S,i.id,M.vertexBuffer,M.indexBuffer,M.segments)}}function hn(e,i,r,n,o,a){const l=n.paint.get("raster-fade-duration");if(!a&&l>0){const n=s.now(),a=(n-e.timeAdded)/l,c=i?(n-i.timeAdded)/l:-1,u=r.getSource(),h=_e(o,{tileSize:u.tileSize,roundZoom:u.roundZoom}),d=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),p=d&&e.refreshedUponExpiration?1:t.ae(d?a:1-c,0,1);return e.refreshedUponExpiration&&a>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const dn=new t.b7(1,0,0,1),pn=new t.b7(0,1,0,1),fn=new t.b7(0,0,1,1),An=new t.b7(1,0,1,1),mn=new t.b7(0,1,1,1);function gn(e,t,i,r){yn(e,0,t+i/2,e.transform.width,i,r)}function _n(e,t,i,r){yn(e,t-i/2,0,i,e.transform.height,r)}function yn(e,t,i,r,n,o){const s=e.context,a=s.gl;a.enable(a.SCISSOR_TEST),a.scissor(t*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,n*e.pixelRatio),s.clear({color:o}),a.disable(a.SCISSOR_TEST)}function vn(e,i,r){const n=e.context,o=n.gl,s=e.useProgram("debug"),a=jt.disabled,l=Ht.disabled,c=e.colorModeForRenderPass(),u="$debug",h=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r);n.activeTexture.set(o.TEXTURE0);const d=i.getTileByID(r.key).latestRawTileData,p=Math.floor((d&&d.byteLength||0)/1024),f=i.getTile(r).tileSize,A=512/Math.min(f,512)*(r.overscaledZ/e.transform.zoom)*.5;let m=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(m+=` => ${r.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,`${m} ${p}kB`);const g=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});s.draw(n,o.TRIANGLES,a,l,Ut.alphaBlended,Qt.disabled,Ri(t.b7.transparent,A),null,g,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),s.draw(n,o.LINE_STRIP,a,l,c,Qt.disabled,Ri(t.b7.red),h,g,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function xn(e,t,i,r){const{isRenderingGlobe:n}=r,o=e.context,s=o.gl,a=e.transform,l=e.colorModeForRenderPass(),c=e.getDepthModeFor3D(),u=e.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,e.width,e.height]);for(const r of i){const i=t.getTerrainMesh(r.tileID),h=e.renderToTexture.getTexture(r),d=t.getTerrainData(r.tileID);o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,h.texture);const p=t.getMeshFrameDelta(a.zoom),f=a.calculateFogMatrix(r.tileID.toUnwrapped()),A=wi(p,f,e.style.sky,a.pitch,n),m=a.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(o,s.TRIANGLES,c,Ht.disabled,l,Qt.backCCW,A,d,m,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}function bn(e,i){if(!i.mesh){const r=new t.aI;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);const n=new t.aK;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),i.mesh=new bt(e.createVertexBuffer(r,wt.members),e.createIndexBuffer(n),t.aJ.simpleSegment(0,0,r.length,n.length))}return i.mesh}class wn{constructor(e,i){this.context=new Hr(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.ad(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ve.maxUnderzooming+ve.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new _t}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style._order)this.style._layers[e].resize()}setup(){const e=this.context,i=new t.aI;i.emplaceBack(0,0),i.emplaceBack(t.Z,0),i.emplaceBack(0,t.Z),i.emplaceBack(t.Z,t.Z),this.tileExtentBuffer=e.createVertexBuffer(i,wt.members),this.tileExtentSegments=t.aJ.simpleSegment(0,0,4,2);const r=new t.aI;r.emplaceBack(0,0),r.emplaceBack(t.Z,0),r.emplaceBack(0,t.Z),r.emplaceBack(t.Z,t.Z),this.debugBuffer=e.createVertexBuffer(r,wt.members),this.debugSegments=t.aJ.simpleSegment(0,0,4,5);const n=new t.bY;n.emplaceBack(0,0,0,0),n.emplaceBack(t.Z,0,t.Z,0),n.emplaceBack(0,t.Z,0,t.Z),n.emplaceBack(t.Z,t.Z,t.Z,t.Z),this.rasterBoundsBuffer=e.createVertexBuffer(n,xi.members),this.rasterBoundsSegments=t.aJ.simpleSegment(0,0,4,2);const o=new t.aI;o.emplaceBack(0,0),o.emplaceBack(t.Z,0),o.emplaceBack(0,t.Z),o.emplaceBack(t.Z,t.Z),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,wt.members),this.rasterBoundsSegmentsPosOnly=t.aJ.simpleSegment(0,0,4,5);const s=new t.aI;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(s,wt.members),this.viewportSegments=t.aJ.simpleSegment(0,0,4,2);const a=new t.bZ;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);const l=new t.aK;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new Ht({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new bt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const r=t.K();t.bQ(r,0,this.width,this.height,0,0,1),t.M(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const n={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,jt.disabled,this.stencilClearMode,Ut.disabled,Qt.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();const r=this.context;r.setColorMode(Ut.disabled),r.setDepthMode(jt.disabled);const n={};for(const e of t)n[e.key]=this.nextStencilID++;this._renderTileMasks(n,t,i,!0),this._renderTileMasks(n,t,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,i,r){const n=this.context,o=n.gl,s=this.style.projection,a=this.transform,l=this.useProgram("clippingMask");for(const c of t){const t=e[c.key],u=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),h=s.getMeshFromTileID(this.context,c.canonical,r,!0,"stencil"),d=a.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!0});l.draw(n,o.TRIANGLES,jt.disabled,new Ht({func:o.ALWAYS,mask:0},t,255,o.KEEP,o.KEEP,o.REPLACE),Ut.disabled,i?Qt.disabled:Qt.backCCW,null,u,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}_renderTilesDepthBuffer(){const e=this.context,t=e.gl,i=this.style.projection,r=this.transform,n=this.useProgram("depth"),o=this.getDepthModeFor3D(),s=ye(r,{tileSize:r.tileSize});for(const a of s){const s=this.style.map.terrain&&this.style.map.terrain.getTerrainData(a),l=i.getMeshFromTileID(this.context,a.canonical,!0,!0,"raster"),c=r.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(e,t.TRIANGLES,o,Ht.disabled,Ut.disabled,Qt.backCCW,null,s,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new Ht({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){const t=this.context.gl;return new Ht({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const t=this.context.gl,i=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const e={};for(let i=0;it.overscaledZ-e.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){const e={},o={};for(let i=0;i0};for(const e in a){const t=a[e];t.used&&t.prepare(this.context),l[e]=t.getVisibleCoordinates(!1),c[e]=l[e].slice().reverse(),u[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;ethis.useProgram(e)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.b7.black:t.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(e,t){const i=e.context,r=i.gl,n=((e,t,i)=>{const r=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),o=he(t),s=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-o*n)*i,(t.height/2+o*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:s}})(t,e.style.map.transform,e.pixelRatio),o=new jt(r.LEQUAL,jt.ReadWrite,[0,1]),s=Ht.disabled,a=e.colorModeForRenderPass(),l=e.useProgram("sky"),c=bn(i,t);l.draw(i,r.TRIANGLES,o,s,a,Qt.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[o[this.currentLayer]],t=a[e.source],i=l[e.source];this._renderTileClippingMasks(e,i,!1),this.renderLayer(this,t,e,i,h)}this.renderPass="translucent";let d=!1;for(this.currentLayer=0;this.currentLayer({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:n}))(c,h,[f[0],f[1],f[2]],d,p),m=bn(n,i);s.draw(n,o.TRIANGLES,a,Ht.disabled,Ut.alphaBlended,Qt.disabled,A,null,null,"atmosphere",m.vertexBuffer,m.indexBuffer,m.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const e=function(e,t){let i=null;const r=Object.values(e._layers).flatMap((i=>i.source&&!i.isHidden(t)?[e.sourceCaches[i.source]]:[])),n=r.filter((e=>"vector"===e.getSource().type)),o=r.filter((e=>"vector"!==e.getSource().type)),s=e=>{(!i||i.getSource().maxzooms(e))),i||o.forEach((e=>s(e))),i}(this.style,this.transform.zoom);e&&function(e,t,i){for(let r=0;rh.getElevation(o,e,t):null;Wr(s,d,p,c,u,m,i,f,g,t.aA(u,e,a,l),o.toUnwrapped(),r)}}}(n,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&Yr(e,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),l,c,a),0!==r.paint.get("text-opacity").constantOr(1)&&Yr(e,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),l,c,a),i.map.showCollisionBoxes&&($r(e,i,r,n,!0),$r(e,i,r,n,!1))}(e,i,r,n,this.style.placement.variableOffsets,o):t.c2(r)?function(e,i,r,n,o){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:s}=o,a=r.paint.get("circle-opacity"),l=r.paint.get("circle-stroke-width"),c=r.paint.get("circle-stroke-opacity"),u=!r.layout.get("circle-sort-key").isConstant();if(0===a.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const h=e.context,d=h.gl,p=e.transform,f=e.getDepthModeForSublayer(0,jt.ReadOnly),A=Ht.disabled,m=e.colorModeForRenderPass(),g=[],_=p.getCircleRadiusCorrection();for(let o=0;oe.sortKey-t.sortKey));for(const t of g){const{programConfiguration:i,program:n,layoutVertexBuffer:o,indexBuffer:s,uniformValues:a,terrainData:l,projectionData:c}=t.state;n.draw(h,d.TRIANGLES,f,A,m,Qt.backCCW,a,l,c,r.id,o,s,t.segments,r.paint,e.transform.zoom,i)}}(e,i,r,n,o):t.c3(r)?function(e,i,r,n,o){if(0===r.paint.get("heatmap-opacity"))return;const s=e.context,{isRenderingToTexture:a,isRenderingGlobe:l}=o;if(e.style.map.terrain){for(const t of n){const n=i.getTile(t);i.hasRenderableParent(t)||("offscreen"===e.renderPass?en(e,n,r,t,l):"translucent"===e.renderPass&&tn(e,r,t,a,l))}s.viewport.set([0,0,e.width,e.height])}else"offscreen"===e.renderPass?function(e,i,r,n){const o=e.context,s=o.gl,a=e.transform,l=Ht.disabled,c=new Ut([s.ONE,s.ONE],t.b7.transparent,[!0,!0,!0,!0]);(function(e,i,r){const n=e.gl;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,i.width/4,i.height/4]);let o=r.heatmapFbos.get(t.bU);o?(n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),e.bindFramebuffer.set(o.framebuffer)):(o=rn(e,i.width/4,i.height/4),r.heatmapFbos.set(t.bU,o))})(o,e,r),o.clear({color:t.b7.transparent});for(let t=0;t0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1){this.cache=this.cache||{};const r=!!this.style.map.terrain,n=this.style.projection,o=e+(t?t.cacheKey:"")+`/${i?Bt:n.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(r?"/terrain":"");return this.cache[o]||(this.cache[o]=new Ci(this.context,vt[e],t,ir[e],this._showOverdrawInspector,r,i?vt.projectionMercator:n.shaderPreludeCode,i?Tt:n.shaderDefine)),this.cache[o]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new _(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function Tn(e,t){let i,r=!1,n=null,o=null;const s=()=>{n=null,r&&(e.apply(o,i),n=setTimeout(s,t),r=!1)};return(...e)=>(r=!0,o=this,i=e,n||s(),n)}class Bn{constructor(e){this._getCurrentHash=()=>{const e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((e=>e.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")},this._onHashChange=()=>{const e=this._getCurrentHash();if(!this._isValidHash(e))return!1;const t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{const e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{const e=this._getCurrentHash();if(0===e.length)return;const t=e.join("/");let i=t;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${t}`);let r=window.location.hash.replace(i,"");r.startsWith("#&")?r=r.slice(0,1)+r.slice(2):"#"===r&&(r="");let n=window.location.href.replace(/(#.+)?$/,r);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=Tn(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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()),this._removeHash(),delete this._map,this}getHashString(e){const t=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),o=Math.round(t.lng*n)/n,s=Math.round(t.lat*n)/n,a=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=e?`/${o}/${s}/${i}`:`${i}/${s}/${o}`,(a||l)&&(c+="/"+Math.round(10*a)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const e=this._hashName;let t=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const r=i.split("=")[0];return r===e?(t=!0,`${r}=${c}`):i})).filter((e=>e));return t||i.push(`${e}=${c}`),`#${i.join("&")}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.Q(+e[2],+e[1])}catch(e){return!1}const i=+e[0],r=+(e[3]||0),n=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&r>=-180&&r<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const Cn={linearity:.3,easing:t.cb(0,0,.3,1)},Sn=t.e({deceleration:2500,maxSpeed:1400},Cn),En=t.e({deceleration:20,maxSpeed:1400},Cn),Mn=t.e({deceleration:1e3,maxSpeed:360},Cn),In=t.e({deceleration:1e3,maxSpeed:90},Cn),Pn=t.e({deceleration:1e3,maxSpeed:360},Cn);class Ln{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,t=s.now();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,i.roll+=e.rollDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const o=kn(i.pan.mag(),r,t.e({},Sn,e||{})),s=i.pan.mult(o.amount/i.pan.mag()),a=this._map.cameraHelper.handlePanInertia(s,this._map.transform);n.center=a.easingCenter,n.offset=a.easingOffset,Fn(n,o)}if(i.zoom){const e=kn(i.zoom,r,En);n.zoom=this._map.transform.zoom+e.amount,Fn(n,e)}if(i.bearing){const e=kn(i.bearing,r,Mn);n.bearing=this._map.transform.bearing+t.ae(e.amount,-179,179),Fn(n,e)}if(i.pitch){const e=kn(i.pitch,r,In);n.pitch=this._map.transform.pitch+e.amount,Fn(n,e)}if(i.roll){const e=kn(i.roll,r,Pn);n.roll=this._map.transform.roll+t.ae(e.amount,-179,179),Fn(n,e)}if(n.zoom||n.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),t.e(n,{noMoveStart:!0})}}function Fn(e,t){(!e.duration||e.durationi.unproject(e))),l=o.reduce(((e,t,i,r)=>e.add(t.div(r.length))),new t.P(0,0));super(e,{points:o,point:l,lngLats:s,lngLat:i.unproject(l),originalEvent:r}),this._defaultPrevented=!1}}class Dn extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class On{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Dn(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new zn(e.type,this._map,e))}mouseup(e){this._map.fire(new zn(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new zn(e.type,this._map,e))}dblclick(e){return this._firePreventable(new zn(e.type,this._map,e))}mouseover(e){this._map.fire(new zn(e.type,this._map,e))}mouseout(e){this._map.fire(new zn(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Rn(e.type,this._map,e))}touchmove(e){this._map.fire(new Rn(e.type,this._map,e))}touchend(e){this._map.fire(new Rn(e.type,this._map,e))}touchcancel(e){this._map.fire(new Rn(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Un{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new zn(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new zn(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Nn{constructor(e){this._map=e}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.screenPointToLocation(t.P.convert(e),this._map.terrain)}}class Qn{constructor(e,t){this._map=e,this._tr=new Nn(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(a.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)e.fitScreenCoordinates(r,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(a.remove(this._box),this._box=null),a.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.l(e,{originalEvent:i}))}}function jn(e,t){if(e.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);const i={};for(let r=0;rthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){const i=new t.P(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=jn(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const r=jn(i,t);for(const e in this.touches){const t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class Hn{constructor(e){this.singleTap=new Vn(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const r=this.singleTap.touchend(e,t,i);if(r){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Gn{constructor(e){this._tr=new Nn(e),this._zoomIn=new Hn({numTouches:1,numTaps:2}),this._zoomOut=new Hn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i),o=this._tr;return r?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(r)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $n{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const r=Array.isArray(t)?t[0]:t;return!this._moved&&r.dist(i)!0}),t=new Kn){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,i){return e instanceof MouseEvent?t(e):"undefined"!=typeof TouchEvent&&e instanceof TouchEvent?i(e):void 0}startMove(e){this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.startMove(e)),(e=>this.oneFingerTouchMoveStateManager.startMove(e)))}endMove(e){this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.endMove(e)),(e=>this.oneFingerTouchMoveStateManager.endMove(e)))}isValidStartEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidStartEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e)))}isValidMoveEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidMoveEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e)))}isValidEndEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidEndEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e)))}}const Xn=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class Yn{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(!this._shouldBePrevented(i.length))return e.preventDefault(),this._calculateTransform(e,t,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,r){r.length>0&&(this._active=!0);const n=jn(r,i),o=new t.P(0,0),s=new t.P(0,0);let a=0;for(const e in n){const t=n[e],i=this._touches[e];i&&(o._add(t),s._add(t.sub(i)),a++,n[e]=t)}if(this._touches=n,this._shouldBePrevented(a)||!s.mag())return;const l=s.div(a);return this._sum._add(l),this._sum.mag()Math.abs(e.x)}class so extends Jn{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,oo(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const r=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,n=t.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return oo(e)&&oo(t)&&o}}const ao={panStep:100,bearingStep:15,pitchStep:10};class lo{constructor(e){this._tr=new Nn(e);const t=ao;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:s=>{const a=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:co,zoom:t?Math.round(a.zoom)+t*(e.shiftKey?2:1):a.zoom,bearing:a.bearing+i*this._bearingStep,pitch:a.pitch+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:a.center},{originalEvent:e})}}}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 co(e){return e*(2-e)}const uo=4.000244140625;class ho{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new Nn(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const i=s.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==t&&t%uo==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=a.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(t.Q.convert(r.center)):i,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("number"==typeof this._lastExpectedZoom){const t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){const i="wheel"===this._type&&Math.abs(this._delta)>uo?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);const n="number"!=typeof this._targetZoom?e.scale:t.ac(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,t.ah(n*r))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"!=typeof this._targetZoom?e.zoom:this._targetZoom,r=this._startZoom,n=this._easing;let o,a=!1;if("wheel"===this._type&&r&&n){const e=s.now()-this._lastWheelEventTime,l=Math.min((e+5)/200,1),c=n(l);o=t.B.number(r,i,c),l<1?this._frameId||(this._frameId=!0):a=!0}else o=i,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.cd;if(this._prevEase){const e=this._prevEase,r=(s.now()-e.start)/e.duration,n=e.easing(r+.01)-e.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,a=Math.sqrt(.0729-o*o);i=t.cb(o,a,.25,1)}return this._prevEase={start:s.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class po{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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 fo{constructor(e){this._tr=new Nn(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ao{constructor(){this._tap=new Hn({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(e,t,i){if(!this._swipePoint)if(this._tapTime){const r=t[0],n=e.timeStamp-this._tapTime<500,o=this._tapPoint.dist(r)<30;n&&o?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(e,t,i)}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const r=this._tap.touchend(e,t,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class mo{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},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 go{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class _o{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class yo{constructor(e,t){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=a.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);const n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(a.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new t.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const vo=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class xo extends t.l{}function bo(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class wo{constructor(e,i){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,i)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;const r="renderFrame"===e.type?void 0:e,n={needsRenderFrame:!1},o={},s={};for(const{handlerName:l,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;if(this._blockedByActive(s,u,l))c.reset();else if(c[i||e.type]){if(t.ce(e,i||e.type)){const t=a.mousePos(this._map.getCanvas(),e);h=c[i||e.type](e,t)}else if(t.cf(e,i||e.type)){const t=this._getMapTouches(e.touches),r=a.touchPos(this._map.getCanvas(),t);h=c[i||e.type](e,r,t)}else t.cg(i||e.type)||(h=c[i||e.type](e));this.mergeHandlerResult(n,o,h,l,r),h&&h.needsRenderFrame&&this._triggerRenderFrame()}(h||c.isActive())&&(s[l]=c)}const l={};for(const e in this._previousActiveHandlers)s[e]||(l[e]=r);this._previousActiveHandlers=s,(Object.keys(l).length||bo(n))&&(this._changes.push([n,o,l]),this._triggerRenderFrame()),(Object.keys(s).length||bo(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:c}=n;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ln(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,t,i]of this._listeners)a.addEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[e,t,i]of this._listeners)a.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){const i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new On(i,e));const n=i.boxZoom=new Qn(i,e);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();const o=i.cooperativeGestures=new yo(i,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();const s=new Gn(i),l=new fo(i);i.doubleClickZoom=new po(l,s),this._add("tapZoom",s),this._add("clickZoom",l),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const c=new Ao;this._add("tapDragZoom",c);const u=i.touchPitch=new so(i);this._add("touchPitch",u),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const h=()=>i.project(i.getCenter()),d=function({enable:e,clickTolerance:i,aroundCenter:r=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:o=.8},s){const l=new qn({checkCorrectEvent:e=>0===a.mouseButton(e)&&e.ctrlKey||2===a.mouseButton(e)&&!e.ctrlKey});return new $n({clickTolerance:i,move:(e,i)=>{const a=s();if(r&&Math.abs(a.y-e.y)>n)return{bearingDelta:t.cc(new t.P(e.x,i.y),i,a)};let l=(i.x-e.x)*o;return r&&i.y0===a.mouseButton(e)&&e.ctrlKey||2===a.mouseButton(e)});return new $n({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*i}),moveStateManager:r,enable:e,assignEvents:Xn})}(e),f=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){const n=new qn({checkCorrectEvent:e=>2===a.mouseButton(e)&&e.ctrlKey});return new $n({clickTolerance:t,move:(e,t)=>{const n=r();let o=(t.x-e.x)*i;return t.y0===a.mouseButton(e)&&!e.ctrlKey});return new $n({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:i,enable:e,assignEvents:Xn})}(e),m=new Yn(e,i);i.dragPan=new mo(r,A,m),this._add("mousePan",A),this._add("touchPan",m,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const g=new no,_=new io;i.touchZoomRotate=new _o(r,_,g,c),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",_,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const y=i.scrollZoom=new ho(i,(()=>this._triggerRenderFrame()));this._add("scrollZoom",y,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const v=i.keyboard=new lo(i);this._add("keyboard",v),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Un(i))}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(vo(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,i){for(const r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}mergeHandlerResult(e,i,r,n,o){if(!r)return;t.e(e,r);const s={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.rollDelta&&(i.roll=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){const e={},i={},r={};for(const[n,o,s]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(e.rollDelta=(e.rollDelta||0)+n.rollDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),t.e(i,o),t.e(r,s);this._updateMapTransform(e,i,r),this._changes=[]}_updateMapTransform(e,t,i){const r=this._map,n=r._getTransformForUpdate(),o=r.terrain;if(!(bo(e)||o&&this._terrainMovement))return this._fireEvents(t,i,!0);r._stop(!0);let{panDelta:s,zoomDelta:a,bearingDelta:l,pitchDelta:c,rollDelta:u,around:h,pinchAround:d}=e;void 0!==d&&(h=d),h=h||r.transform.centerPoint,o&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const p={panDelta:s,zoomDelta:a,rollDelta:u,pitchDelta:c,bearingDelta:l,around:h};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const f=h.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(s?h.sub(s):h);o?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,n),this._terrainMovement||!t.drag&&!t.zoom?t.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(s))):this._map.cameraHelper.handleMapControlsPan(p,n,f):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(p,n,f))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,n),this._map.cameraHelper.handleMapControlsPan(p,n,f)),r._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,i,r){const n=vo(this._eventsInProgress),o=vo(e),a={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(a[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in a)this._fireEvent(e,a[e]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const l={};let c;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],c=i[t]||r,l[`${e}end`]=c)}for(const e in l)this._fireEvent(e,l[e]);const u=vo(this._eventsInProgress),h=(n||o)&&!u;if(h&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const e=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(r&&h){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap{delete this._frameId,this.handleEvent(new xo("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class To extends t.E{constructor(e,t,i){super(),this._renderFrameCallback=()=>{const e=Math.min((s.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.cameraHelper=t,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(e,t){e.apply(this.transform),this.transform=e,this.cameraHelper=t}getCenter(){return new t.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,r){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},i),r)}panTo(e,i,r){return this.easeTo(t.e({center:e},i),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,i,r){return this.easeTo(t.e({zoom:e},i),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.l("movestart",i)).fire(new t.l("move",i)).fire(new t.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,i,r){return this.easeTo(t.e({bearing:e},i),r)}resetNorth(e,i){return this.rotateTo(0,t.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,t){return Math.abs(this.getBearing()){m.easeFunc(t),this.terrain&&!e.freezeElevation&&this._updateElevation(t),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(t=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,t)}),e),this}_prepareEase(e,i,r={}){this._moving=!0,i||r.moving||this.fire(new t.l("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.l("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.l("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.l("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new t.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(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.setElevation(t.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const t=e.getCameraLngLat(),i=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(ithis._elevateCameraIfInsideTerrain(e))),this.transformCameraUpdate&&t.push((e=>this.transformCameraUpdate(e))),!t.length)return;const i=e.clone();for(const e of t){const t=i.clone(),{center:r,zoom:n,roll:o,pitch:s,bearing:a,elevation:l}=e(t);r&&t.setCenter(r),void 0!==l&&t.setElevation(l),void 0!==n&&t.setZoom(n),void 0!==o&&t.setRoll(o),void 0!==s&&t.setPitch(s),void 0!==a&&t.setBearing(a),i.apply(t)}this.transform.apply(i)}_fireMoveEvents(e){this.fire(new t.l("move",e)),this._zooming&&this.fire(new t.l("zoom",e)),this._rotating&&this.fire(new t.l("rotate",e)),this._pitching&&this.fire(new t.l("pitch",e)),this._rolling&&this.fire(new t.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const r=this._zooming,n=this._rotating,o=this._pitching,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new t.l("zoomend",e)),n&&this.fire(new t.l("rotateend",e)),o&&this.fire(new t.l("pitchend",e)),s&&this.fire(new t.l("rollend",e)),this.fire(new t.l("moveend",e))}flyTo(e,i){if(!e.essential&&s.prefersReducedMotion){const r=t.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(r,i)}this.stop(),e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.cd},e);const r=this._getTransformForUpdate(),n=r.bearing,o=r.pitch,a=r.roll,l=r.padding,c="bearing"in e?this._normalizeBearing(e.bearing,n):n,u="pitch"in e?+e.pitch:o,h="roll"in e?this._normalizeBearing(e.roll,a):a,d="padding"in e?e.padding:r.padding,p=t.P.convert(e.offset);let f=r.centerPoint.add(p);const A=r.screenPointToLocation(f),m=this.cameraHelper.handleFlyTo(r,{bearing:c,pitch:u,roll:h,padding:d,locationAtOffset:A,offsetAsPoint:p,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let g=e.curve;const _=Math.max(r.width,r.height),y=_/m.scaleOfZoom,v=m.pixelPathLength;"number"==typeof m.scaleOfMinZoom&&(g=Math.sqrt(_/m.scaleOfMinZoom/v*2));const x=g*g;function b(e){const t=(y*y-_*_+(e?-1:1)*x*x*v*v)/(2*(e?y:_)*x*v);return Math.log(Math.sqrt(t*t+1)-t)}function w(e){return(Math.exp(e)-Math.exp(-e))/2}function T(e){return(Math.exp(e)+Math.exp(-e))/2}const B=b(!1);let C=function(e){return T(B)/T(B+g*e)},S=function(e){return _*((T(B)*(w(t=B+g*e)/T(t))-w(B))/x)/v;var t},E=(b(!0)-B)/g;if(Math.abs(v)<2e-6||!isFinite(E)){if(Math.abs(_-y)<1e-6)return this.easeTo(e,i);const t=y<_?-1:1;E=Math.abs(Math.log(y/_))/g,S=()=>0,C=e=>Math.exp(t*g*e)}return e.duration="duration"in e?+e.duration:1e3*E/("screenSpeed"in e?+e.screenSpeed/g:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=n!==c,this._pitching=u!==o,this._rolling=h!==a,this._padding=!r.isPaddingEqual(d),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease((s=>{const A=s*E,g=1/C(A),_=S(A);this._rotating&&r.setBearing(t.B.number(n,c,s)),this._pitching&&r.setPitch(t.B.number(o,u,s)),this._rolling&&r.setRoll(t.B.number(a,h,s)),this._padding&&(r.interpolatePadding(l,d,s),f=r.centerPoint.add(p)),m.easeFunc(s,g,_,f),this.terrain&&!e.freezeElevation&&this._updateElevation(s),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(e,t,i){!1===i.animate||0===i.duration?(e(1),t()):(this._easeStart=s.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=t.aL(e,-180,180);const r=Math.abs(e-i);return Math.abs(e-360-i)MapLibre'};class Co{constructor(e=Bo){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=e=>{!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType&&"terrain"!==e.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=a.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=a.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=a.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(){a.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(e,t){const i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((e=>"string"!=typeof e?"":e))):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style.sourceCaches;for(const i in t){const r=t[i];if(r.used||r.usedForTerrain){const t=r.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter((e=>String(e).trim())),e.sort(((e,t)=>e.length-t.length)),e=e.filter(((t,i)=>{for(let r=i+1;r=0)return!1;return!0}));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=a.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class So{constructor(e={}){this._updateCompact=()=>{const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=a.create("div","maplibregl-ctrl");const t=a.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){a.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Eo{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Mo=t.aG([{name:"a_pos3d",type:"Int16",components:3}]);class Io extends t.E{constructor(e){super(),this._lastTilesetChange=s.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const r={};for(const n of ye(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))r[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),t.bQ(n.terrainRttPosMatrix32f,0,t.Z,t.Z,0,0,1),this._tiles[n.key]=new oe(n,this.tileSize),this._lastTilesetChange=s.now());for(const e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(e){for(const t in this._tiles){const i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const r of this._renderableTilesKeys){const n=this._tiles[r].tileID,o=e.clone(),s=t.b2();if(n.canonical.equals(e.canonical))t.bQ(s,0,t.Z,t.Z,0,0,1);else if(n.canonical.isChildOf(e.canonical)){const i=n.canonical.z-e.canonical.z,r=n.canonical.x-(n.canonical.x>>i<>i<>i;t.bQ(s,0,a,a,0,0,1),t.L(s,s,[-r*a,-o*a,0])}else{if(!e.canonical.isChildOf(n.canonical))continue;{const i=e.canonical.z-n.canonical.z,r=e.canonical.x-(e.canonical.x>>i<>i<>i;t.bQ(s,0,t.Z,t.Z,0,0,1),t.L(s,s,[r*a,o*a,0]),t.M(s,s,[1/2**i,1/2**i,0])}}o.terrainRttPosMatrix32f=new Float32Array(s),i[r]=o}return i}_getTerrainCoordsForTileRanges(e,i){const r={};for(const n of this._renderableTilesKeys){const o=this._tiles[n].tileID;if(!this._isWithinTileRanges(o,i))continue;const s=e.clone(),a=t.b2();if(o.canonical.z===e.canonical.z){const i=e.canonical.x-o.canonical.x,r=e.canonical.y-o.canonical.y;t.bQ(a,0,t.Z,t.Z,0,0,1),t.L(a,a,[i*t.Z,r*t.Z,0])}else if(o.canonical.z>e.canonical.z){const i=o.canonical.z-e.canonical.z,r=o.canonical.x-(o.canonical.x>>i<>i<>i),l=e.canonical.y-(o.canonical.y>>i),c=t.Z>>i;t.bQ(a,0,c,c,0,0,1),t.L(a,a,[-r*c+s*t.Z,-n*c+l*t.Z,0])}else{const i=e.canonical.z-o.canonical.z,r=e.canonical.x-(e.canonical.x>>i<>i<>i)-o.canonical.x,l=(e.canonical.y>>i)-o.canonical.y,c=t.Z<i.maxzoom&&(r=i.maxzoom),r=i.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(e.scaledTo(r--).key);return n}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){return t[e.canonical.z]&&e.canonical.x>=t[e.canonical.z].minTileX&&e.canonical.x<=t[e.canonical.z].maxTileX&&e.canonical.y>=t[e.canonical.z].minTileY&&e.canonical.y<=t[e.canonical.z].maxTileY}}class Po{constructor(e,t,i){this._meshCache={},this.painter=e,this.sourceCache=new Io(t),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,r,n=t.Z){var o;if(!(i>=0&&i=0&&re.canonical.z&&(e.canonical.z>=r?n=e.canonical.z-r:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=e.canonical.x-(e.canonical.x>>n<>n<>8<<4|e>>8,i[t+3]=0;const r=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),n=new _(e,r,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),r=this.painter.context,n=r.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),s=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),a=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,a-s-1,1,1,n.RGBA,n.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),c=i[1]+((15&i[2])<<8),u=this.coordsIndex[255-i[3]],h=u&&this.sourceCache.getTileByID(u);if(!h)return null;const d=this._coordsTextureSize,p=(1<0,n=r&&0===e.canonical.y,o=r&&e.canonical.y===(1<e.id!==t)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length!e.inUse))}}const Fo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ko{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new Lo(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter((i=>!e._layers[i].isHidden(t))),this._coordsAscending={};for(const t in e.sourceCaches){this._coordsAscending[t]={};const i=e.sourceCaches[t].getVisibleCoordinates(),r=e.sourceCaches[t].getSource(),n=r instanceof W?r.terrainTileRanges:null;for(const e of i){const i=this.terrain.sourceCache.getTerrainCoords(e,n);for(const e in i)this._coordsAscending[t][e]||(this._coordsAscending[t][e]=[]),this._coordsAscending[t][e].push(i[e])}}this._coordsAscendingStr={};for(const t of e._order){const i=e._layers[t],r=i.source;if(Fo[i.type]&&!this._coordsAscendingStr[r]){this._coordsAscendingStr[r]={};for(const e in this._coordsAscending[r])this._coordsAscendingStr[r][e]=this._coordsAscending[r][e].map((e=>e.key)).sort().join()}}for(const e of this._renderableTiles)for(const t in this._coordsAscendingStr){const i=this._coordsAscendingStr[t][e.tileID.key];i&&i!==e.rttCoords[t]&&(e.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const r=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),n=e.type,o=this.painter,s=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Fo[n]&&(this._prevType&&Fo[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!s))return!0;if(Fo[this._prevType]||Fo[n]&&s){this._prevType=n;const e=this._stacks.length-1,i=this._stacks[e]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(xn(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[e]){const t=this.pool.getObjectForId(n.rtt[e].id);if(t.stamp===n.rtt[e].stamp){this.pool.useObject(t);continue}}const s=this.pool.getOrCreateFreeObject();this.pool.useObject(s),this.pool.stampObject(s),n.rtt[e]={id:s.id,stamp:s.stamp},o.context.bindFramebuffer.set(s.fbo.framebuffer),o.context.clear({color:t.b7.transparent,stencil:0}),o.currentStencilSource=void 0;for(let e=0;e{this.startMove(e,a.mousePos(this.element,e)),a.addEventListener(window,"mousemove",this.mousemove),a.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,a.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHanlder.dragEnd(e),this.offTemp()},this.touchstart=e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=a.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),a.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.addEventListener(window,"touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=a.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))},this.touchend=e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const n=new Wn;this._rotatePitchHanlder=new $n({clickTolerance:3,move:(e,n)=>{const o=i.getBoundingClientRect(),s=new t.P((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:t.cc(new t.P(e.x,n.y),n,s),pitchDelta:r?-.5*(n.y-e.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=e,a.addEventListener(i,"mousedown",this.mousedown),a.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),a.addEventListener(i,"touchcancel",this.reset)}startMove(e,t){this._rotatePitchHanlder.dragStart(e,t),a.disableDrag()}move(e,t){const i=this.map,{bearingDelta:r,pitchDelta:n}=this._rotatePitchHanlder.dragMove(e,t)||{};r&&i.setBearing(i.getBearing()+r),n&&i.setPitch(i.getPitch()+n)}off(){const e=this.element;a.removeEventListener(e,"mousedown",this.mousedown),a.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),a.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.removeEventListener(window,"touchend",this.touchend),a.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){a.enableDrag(),a.removeEventListener(window,"mousemove",this.mousemove),a.removeEventListener(window,"mouseup",this.mouseup),a.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.removeEventListener(window,"touchend",this.touchend)}}let No;function Qo(e,i,r,n=!1){if(n||!r.getCoveringTilesDetailsProvider().allowWorldCopies())return null==e?void 0:e.wrap();const o=new t.Q(e.lng,e.lat);if(e=new t.Q(e.lng,e.lat),i){const n=new t.Q(e.lng-360,e.lat),o=new t.Q(e.lng+360,e.lat),s=r.locationToScreenPoint(e).distSqr(i);r.locationToScreenPoint(n).distSqr(i)180;){const t=r.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e.lng!==o.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(e))?e:o}const jo={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 Vo(e,t,i){const r=e.classList;for(const e in jo)r.remove(`maplibregl-${i}-anchor-${e}`);r.add(`maplibregl-${i}-anchor-${t}`)}class Ho extends t.E{constructor(e){if(super(),this._onKeyPress=e=>{const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=e=>{const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;const t=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==e?void 0:e.type)||"render"===(null==e?void 0:e.type)&&!t)&&this._map.once("render",this._update),this._lngLat=Qo(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(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 r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&"moveend"!==e.type||(this._pos=this._pos.round()),a.setTransform(this._element,`${jo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${i}`),s.frameAsync(new AbortController).then((()=>{this._updateOpacity(e&&"moveend"===e.type)})).catch((()=>{}))},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.l("dragstart"))),this.fire(new t.l("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.l("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(null==e?void 0:e.opacity,null==e?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=t.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=a.create("div");const i=a.createNS("http://www.w3.org/2000/svg","svg"),r=41,n=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${r}px`),i.setAttributeNS(null,"width",`${n}px`),i.setAttributeNS(null,"viewBox",`0 0 ${n} ${r}`);const o=a.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const s=a.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const l=a.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 e of c){const t=a.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),l.appendChild(t)}const u=a.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill",this._color);const h=a.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),u.appendChild(h);const d=a.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const p=a.createNS("http://www.w3.org/2000/svg","path");p.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"),d.appendChild(p);const f=a.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const A=a.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"transform","translate(8.0, 8.0)");const m=a.createNS("http://www.w3.org/2000/svg","circle");m.setAttributeNS(null,"fill","#000000"),m.setAttributeNS(null,"opacity","0.25"),m.setAttributeNS(null,"cx","5.5"),m.setAttributeNS(null,"cy","5.5"),m.setAttributeNS(null,"r","5.4999962");const g=a.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#FFFFFF"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962"),A.appendChild(m),A.appendChild(g),s.appendChild(l),s.appendChild(u),s.appendChild(d),s.appendChild(f),s.appendChild(A),i.appendChild(s),i.setAttributeNS(null,"height",r*this._scale+"px"),i.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(i),this._offset=t.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()})),Vo(this._element,this._anchor,"marker"),e&&e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",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),a.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,r=Math.abs(i)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-13.5,-1*(t-i)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,r;if(!(null===(i=this._map)||void 0===i?void 0:i.terrain)){const e=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const n=this._map,o=n.terrain.depthAtPoint(this._pos),s=n.terrain.getElevationForLngLatZoom(this._lngLat,n.transform.tileZoom);if(n.transform.lngLatToCameraDepth(this._lngLat,s)-o<.006)return void(this._element.style.opacity=this._opacity);const a=-this._offset.y/n.transform.pixelsPerMeter,l=Math.sin(n.getPitch()*Math.PI/180)*a,c=n.terrain.depthAtPoint(new t.P(this._pos.x,this._pos.y-this._offset.y)),u=n.transform.lngLatToCameraDepth(this._lngLat,s+l)-c>.006;(null===(r=this._popup)||void 0===r?void 0:r.isOpen())&&u&&this._popup.remove(),this._element.style.opacity=u?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=e),void 0!==t&&(this._opacityWhenCovered=t),this._map&&this._updateOpacity(!0),this}}const Go={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let $o=0,Zo=!1;const qo={maxWidth:100,unit:"metric"};function Ko(e,t,i){const r=i&&i.maxWidth||100,n=e._container.clientHeight/2,o=e._container.clientWidth/2,s=e.unproject([o-r/2,n]),a=e.unproject([o+r/2,n]),l=Math.round(e.project(a).x-e.project(s).x),c=Math.min(r,l,e._container.clientWidth),u=s.distanceTo(a);if(i&&"imperial"===i.unit){const i=3.2808*u;i>5280?Wo(t,c,i/5280,e._getUIString("ScaleControl.Miles")):Wo(t,c,i,e._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Wo(t,c,u/1852,e._getUIString("ScaleControl.NauticalMiles")):u>=1e3?Wo(t,c,u/1e3,e._getUIString("ScaleControl.Kilometers")):Wo(t,c,u,e._getUIString("ScaleControl.Meters"))}function Wo(e,t,i,r){const n=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(i);e.style.width=t*(n/i)+"px",e.innerHTML=`${n} ${r}`}const Xo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Yo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Jo(e){if(e){if("number"==typeof e){const i=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,e),"top-left":new t.P(i,i),"top-right":new t.P(-i,i),bottom:new t.P(0,-e),"bottom-left":new t.P(i,-i),"bottom-right":new t.P(-i,-i),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){const i=t.P.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.P.convert(e.center||[0,0]),top:t.P.convert(e.top||[0,0]),"top-left":t.P.convert(e["top-left"]||[0,0]),"top-right":t.P.convert(e["top-right"]||[0,0]),bottom:t.P.convert(e.bottom||[0,0]),"bottom-left":t.P.convert(e["bottom-left"]||[0,0]),"bottom-right":t.P.convert(e["bottom-right"]||[0,0]),left:t.P.convert(e.left||[0,0]),right:t.P.convert(e.right||[0,0])}}return Jo(new t.P(0,0))}const es=i;e.AJAXError=t.co,e.Event=t.l,e.Evented=t.E,e.LngLat=t.Q,e.MercatorCoordinate=t.$,e.Point=t.P,e.addProtocol=t.cp,e.config=t.a,e.removeProtocol=t.cq,e.AttributionControl=Co,e.BoxZoomHandler=Qn,e.CanvasSource=Y,e.CooperativeGesturesHandler=yo,e.DoubleClickZoomHandler=po,e.DragPanHandler=mo,e.DragRotateHandler=go,e.EdgeInsets=St,e.FullscreenControl=class extends t.E{constructor(e={}){super(),this._onFullscreenChange=()=>{var e;let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(e=null==t?void 0:t.shadowRoot)||void 0===e?void 0:e.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){a.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const e=this._fullscreenButton=a.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);a.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_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.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new t.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},e.GeoJSONSource=K,e.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.l("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.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new t.Q(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=this._map.getBearing(),o=t.e({bearing:n},this.options.fitBoundsOptions),s=H.fromLngLat(i,r);this._map.fitBounds(s,o,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new t.Q(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 e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Zo)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=a.create("button","maplibregl-ctrl-geolocate",this._container),a.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){t.w("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=a.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ho({element:this._dotElement}),this._circleElement=a.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ho({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(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.l("trackuserlocationend")),this.fire(new t.l("userlocationlostfocus")))}))}},this.options=t.e({},Go,e)}onAdd(e){return this._map=e,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return t._(this,arguments,void 0,(function*(e=!1){if(void 0!==No&&!e)return No;if(void 0===window.navigator.permissions)return No=!!window.navigator.geolocation,No;try{const e=yield window.navigator.permissions.query({name:"geolocation"});No="denied"!==e.state}catch(e){No=!!window.navigator.geolocation}return No}))}().then((e=>this._finishSetupUI(e))),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(),a.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,$o=0,Zo=!1}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return t&&(i.longitudet.getEast()||i.latitudet.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 e=this._map.getBounds(),t=e.getSouthEast(),i=e.getNorthEast(),r=t.distanceTo(i),n=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}trigger(){if(!this._setup)return t.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":$o--,Zo=!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.l("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.l("trackuserlocationstart")),this.fire(new t.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),$o++,$o>1?(e={maximumAge:6e5,timeout:0},Zo=!0):(e=this.options.positionOptions,Zo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}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)}},e.GlobeControl=class{constructor(){this._toggleProjection=()=>{var e;const t=null===(e=this._map.getProjection())||void 0===e?void 0:e.type;this._map.setProjection("mercator"!==t&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(e=this._map.getProjection())||void 0===e?void 0:e.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=a.create("button","maplibregl-ctrl-globe",this._container),a.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){a.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},e.Hash=Bn,e.ImageSource=W,e.KeyboardHandler=lo,e.LngLatBounds=H,e.LogoControl=So,e.Map=class extends To{constructor(e){var i,r;t.cl.mark(t.cm.create);const n=Object.assign(Object.assign(Object.assign({},Do),e),{canvasContextAttributes:Object.assign(Object.assign({},Do.canvasContextAttributes),e.canvasContextAttributes)});if(null!=n.minZoom&&null!=n.maxZoom&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=n.minPitch&&null!=n.maxPitch&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=n.minPitch&&n.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=n.maxPitch&&n.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const o=new kt,s=new Ot;if(void 0!==n.minZoom&&o.setMinZoom(n.minZoom),void 0!==n.maxZoom&&o.setMaxZoom(n.maxZoom),void 0!==n.minPitch&&o.setMinPitch(n.minPitch),void 0!==n.maxPitch&&o.setMaxPitch(n.maxPitch),void 0!==n.renderWorldCopies&&o.setRenderWorldCopies(n.renderWorldCopies),super(o,s,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Eo,this._controls=[],this._mapId=t.a4(),this._contextLost=e=>{e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new t.l("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new t.l("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=!0===n.trackResize,this._bearingSnap=n.bearingSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=!0===n.refreshExpiredTiles,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=!0===n.crossSourceCollisions,this._collectResourceTiming=!0===n.collectResourceTiming,this._locale=Object.assign(Object.assign({},zo),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this.transformCameraUpdate=n.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=f.addThrottleControl((()=>this.isMoving())),this._requestManager=new A(n.transformRequest),"string"==typeof n.container){if(this._container=document.getElementById(n.container),!this._container)throw new Error(`Container '${n.container}' not found.`)}else{if(!(n.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=n.container}if(n.maxBounds&&this.setMaxBounds(n.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 e=!1;const t=Tn((e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())}),50);this._resizeObserver=new ResizeObserver((i=>{e?t(i):e=!0})),this._resizeObserver.observe(this._container)}this.handlers=new wo(this,n),this._hash=n.hash&&new Bn("string"==typeof n.hash&&n.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,t.e({},n.fitBoundsOptions,{duration:0}))));const a="string"==typeof n.style||!("globe"===(null===(r=null===(i=n.style)||void 0===i?void 0:i.projection)||void 0===r?void 0:r.type));this.resize(null,a),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new Co("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new So,n.logoPosition),this.on("style.load",(()=>{if(a||this._resizeTransform(),this.transform.unmodified){const e=t.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.l(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.l(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.l("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.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=e.onAdd(this);this._controls.push(e);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.k(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(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,t,i,r)}resize(e,i=!0){const[r,n]=this._containerDimensions(),o=this._getClampedPixelRatio(r,n);if(this._resizeCanvas(r,n,o),this.painter.resize(r,n,o),this.painter.overLimit()){const e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];const t=this._getClampedPixelRatio(r,n);this._resizeCanvas(r,n,t),this.painter.resize(r,n,t)}this._resizeTransform(i);const s=!this._moving;return s&&(this.stop(),this.fire(new t.l("movestart",e)).fire(new t.l("move",e))),this.fire(new t.l("resize",e)),s&&this.fire(new t.l("moveend",e)),this}_resizeTransform(e=!0){var t;const[i,r]=this._containerDimensions();this.transform.resize(i,r,e),null===(t=this._requestedCameraState)||void 0===t||t.resize(i,r,e)}_getClampedPixelRatio(e,t){const{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),o=e*n,s=t*n;return Math.min(o>i?i/o:1,s>r?r/s:1)*n}getPixelRatio(){var e;return null!==(e=this._overridePixelRatio)&&void 0!==e?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(H.convert(e)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom)return this.transform.setMinZoom(e),this._update(),this.getZoom()=this.transform.minZoom)return this.transform.setMaxZoom(e),this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()180)throw new Error("maxPitch must be less than or equal to 180");if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.Q.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null===(e=this.handlers)||void 0===e?void 0:e.isMoving())}isZooming(){var e;return this._zooming||(null===(e=this.handlers)||void 0===e?void 0:e.isZooming())}isRotating(){var e;return this._rotating||(null===(e=this.handlers)||void 0===e?void 0:e.isRotating())}_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let r=!1;const n=n=>{const o=t.filter((e=>this.getLayer(e))),s=0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];s.length?r||(r=!0,i.call(this,new zn(e,this,n.originalEvent,{features:s}))):r=!1};return{layers:t,listener:i,delegates:{mousemove:n,mouseout:()=>{r=!1}}}}if("mouseleave"===e||"mouseout"===e){let r=!1;const n=n=>{const o=t.filter((e=>this.getLayer(e)));(0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?r=!0:r&&(r=!1,i.call(this,new zn(e,this,n.originalEvent)))},o=t=>{r&&(r=!1,i.call(this,new zn(e,this,t.originalEvent)))};return{layers:t,listener:i,delegates:{mousemove:n,mouseout:o}}}{const r=e=>{const r=t.filter((e=>this.getLayer(e))),n=0!==r.length?this.queryRenderedFeatures(e.point,{layers:r}):[];n.length&&(e.features=n,i.call(this,e),delete e.features)};return{layers:t,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners||!this._delegatedListeners[e])return;const r=this._delegatedListeners[e];for(let e=0;et.includes(e)))){for(const e in n.delegates)this.off(e,n.delegates[e]);return void r.splice(e,1)}}}on(e,t,i){if(void 0===i)return super.on(e,t);const r="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,r,i);this._saveDelegatedListener(e,n);for(const e in n.delegates)this.on(e,n.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(void 0===i)return super.once(e,t);const r="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,r,i);for(const t in n.delegates){const o=n.delegates[t];n.delegates[t]=(...t)=>{this._removeDelegatedListener(e,r,i),o(...t)}}this._saveDelegatedListener(e,n);for(const e in n.delegates)this.once(e,n.delegates[e]);return this}off(e,t,i){return void 0===i?super.off(e,t):(this._removeDelegatedListener(e,"string"==typeof t?[t]:t,i),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let r;const n=e instanceof t.P||Array.isArray(e),o=n?e:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(n?{}:e)||{},o instanceof t.P||"number"==typeof o[0])r=[t.P.convert(o)];else{const e=t.P.convert(o[0]),i=t.P.convert(o[1]);r=[e,new t.P(i.x,e.y),i,new t.P(e.x,i.y),e]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,i){return!1!==(i=t.e({},{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(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var i,r;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(e,t)));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new vi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,n):this.style.loadJSON(e,t,n),this):(null===(r=null===(i=this.style)||void 0===i?void 0:i.projection)||void 0===r||r.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new vi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const r=this._requestManager.transformRequest(e,"Style");t.j(r,new AbortController).then((e=>{this._updateDiff(e.data,i)})).catch((e=>{e&&this.fire(new t.k(e))}))}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(r){t.w(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.w("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.k(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}`);null===this.terrain&&i.reload();for(const i in this.style._layers){const r=this.style._layers[i];"hillshade"===r.type&&r.source===e.source&&t.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Po(this.painter,i,e),this.painter.renderToTexture=new ko(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=t=>{var i;"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(i=t.source)||void 0===i?void 0:i.type)?this.terrain.sourceCache.freeRtt():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.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new t.l("terrain",{terrain:e})),this}getTerrain(){var e,t;return null!==(t=null===(e=this.terrain)||void 0===e?void 0:e.options)&&void 0!==t?t:null}areTilesLoaded(){const e=this.style&&this.style.sourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,i){if(i){const r=this.getSource(i);if(!r)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);r.calculateTileZoom=me(Math.max(1,e),Math.max(1,t))}else for(const i in this.style.sourceCaches)this.style.sourceCaches[i].getSource().calculateTileZoom=me(Math.max(1,e),Math.max(1,t));return this._update(!0),this}addImage(e,i,r={}){const{pixelRatio:n=1,sdf:o=!1,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h}=r;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.k(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:r,height:s,data:d}=i,p=i;return this.style.addImage(e,{data:new t.R({width:r,height:s},new Uint8Array(d)),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0,userImage:p}),p.onAdd&&p.onAdd(this,e),this}}{const{width:r,height:d,data:p}=s.getImageData(i);this.style.addImage(e,{data:new t.R({width:r,height:d},p),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0})}}updateImage(e,i){const r=this.style.getImage(e);if(!r)return this.fire(new t.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof HTMLImageElement||t.b(i)?s.getImageData(i):i,{width:o,height:a,data:l}=n;if(void 0===o||void 0===a)return this.fire(new t.k(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!==r.data.width||a!==r.data.height)return this.fire(new t.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(i instanceof HTMLImageElement||t.b(i));return r.data.replace(l,c),this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.k(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return f.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,r={}){return this.style.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,(e=>{e||this._update(!0)})),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,(e=>{e||this._update(!0)})),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){const e=this._container;e.classList.add("maplibregl-map");const t=this._canvasContainer=a.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=a.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);const n=this._controlContainer=a.create("div","maplibregl-control-container",e),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((e=>{o[e]=a.create("div",`maplibregl-ctrl-${e} `,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const e=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{t={requestedAttributes:e},i&&(t.statusMessage=i.statusMessage,t.type=i.type)}),{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!i){const e="Failed to initialize WebGL";throw t?(t.message=e,new Error(JSON.stringify(t))):new Error(e)}this.painter=new wn(i,this.transform),l.testSupport(i)}migrateProjection(e,i){super.migrateProjection(e,i),this.painter.transform=e,this.fire(new t.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var i,r,n,o,a;const l=this._idleTriggered?this._fadeDuration:0,c=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=s.now();this.style.zoomHistory.update(e,i);const r=new t.C(e,{now:i,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=r.crossFadingFactor();1===n&&n===this._crossFadingFactor||(u=!0,this._crossFadingFactor=n),this.style.update(r)}const h=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0!==c;null===(n=this.style.projection)||void 0===n||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(o=this.style.projection)||void 0===o?void 0:o.transitionState,null===(a=this.style.projection)||void 0===a?void 0:a.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||h)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,h),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding}),this.fire(new t.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.cl.mark(t.cm.load),this.fire(new t.l("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.l("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,t.cl.mark(t.cm.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),f.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),a.remove(this._canvasContainer),a.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),t.cl.clearMetrics(),this._removed=!0,this.fire(new t.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,s.frame(this._frameRequest,(e=>{t.cl.frame(e),this._frameRequest=null;try{this._render(e)}catch(e){if(!t.cn(e)&&!function(e){return e.message===jr}(e))throw e}}),(()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return Ro}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},e.MapMouseEvent=zn,e.MapTouchEvent=Rn,e.MapWheelEvent=Dn,e.Marker=Ho,e.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,t)=>{const i=this._map._getUIString(`NavigationControl.${t}`);e.title=i,e.setAttribute("aria-label",i)},this.options=t.e({},Oo,e),this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),a.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),a.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=a.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Uo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){a.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){const i=a.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},e.Popup=class extends t.E{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&a.remove(this._content),this._container&&(a.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new t.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=a.create("div","maplibregl-popup",this._map.getContainer()),this._tip=a.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const e of this.options.className.split(" "))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Qo(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const t=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let i=this.options.anchor;const r=Jo(this.options.offset);if(!i){const e=this._container.offsetWidth,n=this._container.offsetHeight;let o;o=t.y+r.bottom.ythis._map.transform.height-n?["bottom"]:[],t.xthis._map.transform.width-e/2&&o.push("right"),i=0===o.length?"bottom":o.join("-")}let n=t.add(r[i]);this.options.subpixelPositioning||(n=n.round()),a.setTransform(this._container,`${jo[i]} translate(${n.x}px,${n.y}px)`),Vo(this._container,i,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(Xo),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.Q.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){var e;return null===(e=this._container)||void 0===e?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=a.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}_createCloseButton(){this.options.closeButton&&(this._closeButton=a.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(Yo);e&&e.focus()}},e.RasterDEMTileSource=q,e.RasterTileSource=Z,e.ScaleControl=class{constructor(e){this._onMove=()=>{Ko(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Ko(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},qo),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){a.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},e.ScrollZoomHandler=ho,e.Style=vi,e.TerrainControl=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=e}onAdd(e){return this._map=e,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=a.create("button","maplibregl-ctrl-terrain",this._container),a.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(){a.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=so,e.TwoFingersTouchRotateHandler=no,e.TwoFingersTouchZoomHandler=io,e.TwoFingersTouchZoomRotateHandler=_o,e.VectorTileSource=$,e.VideoSource=X,e.addSourceType=(e,i)=>t._(void 0,void 0,void 0,(function*(){if(ee(e))throw new Error(`A source type called "${e}" already exists.`);((e,t)=>{J[e]=t})(e,i)})),e.clearPrewarmedResources=function(){const e=k;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(P),k=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()"))},e.createTileMesh=Kt,e.getMaxParallelImageRequests=function(){return t.a.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return ne().getRTLTextPluginStatus()},e.getVersion=function(){return es},e.getWorkerCount=function(){return L.workerCount},e.getWorkerUrl=function(){return t.a.WORKER_URL},e.importScriptInWorkers=function(e){return O().broadcast("IS",e)},e.prewarm=function(){R().acquire(P)},e.setMaxParallelImageRequests=function(e){t.a.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setRTLTextPlugin=function(e,t){return ne().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){L.workerCount=e},e.setWorkerUrl=function(e){t.a.WORKER_URL=e}})),e}();var Te=_e(we.exports),Be=e({__proto__:null,default:Te},[we.exports]);const Ce=[];function Se(e,i=t){let r;const n=new Set;function o(t){if(a(e,t)&&(e=t,r)){const t=!Ce.length;for(const t of n)t[1](),Ce.push(t,e);if(t){for(let e=0;e{n.delete(l),0===n.size&&r&&(r(),r=null)}}}}const Ee=Se([]),Me=Se([]),Ie=Se([]),Pe=Se(!0),Le=Se(!0),Fe=Se([]),ke=Se({}),ze=e=>{if(!Array.isArray(e))return!1;const t=["id","name","type"],i=e=>{const i=Object.keys(e);return t.filter((e=>!i.includes(e))).length>0};return!(e.filter((e=>"sublist"===e.type?e.presets.every(i):i(e))).length>0)},Re=(e,t)=>Math.round(e*10**t)/10**t;var De="Expected a function",Oe=/^\s+|\s+$/g,Ue=/^[-+]0x[0-9a-f]+$/i,Ne=/^0b[01]+$/i,Qe=/^0o[0-7]+$/i,je=parseInt,Ve="object"==typeof ge&&ge&&ge.Object===Object&&ge,He="object"==typeof self&&self&&self.Object===Object&&self,Ge=Ve||He||Function("return this")(),$e=Object.prototype.toString,Ze=Math.max,qe=Math.min,Ke=function(){return Ge.Date.now()};function We(e,t,i){var r,n,o,s,a,l,c=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(De);function p(t){var i=r,o=n;return r=n=void 0,c=t,s=e.apply(o,i)}function f(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-c>=o}function A(){var e=Ke();if(f(e))return m(e);a=setTimeout(A,function(e){var i=t-(e-l);return h?qe(i,o-(e-c)):i}(e))}function m(e){return a=void 0,d&&r?p(e):(r=n=void 0,s)}function g(){var e=Ke(),i=f(e);if(r=arguments,n=this,l=e,i){if(void 0===a)return function(e){return c=e,a=setTimeout(A,t),u?p(e):s}(l);if(h)return a=setTimeout(A,t),p(l)}return void 0===a&&(a=setTimeout(A,t)),s}return t=Ye(t)||0,Xe(i)&&(u=!!i.leading,o=(h="maxWait"in i)?Ze(Ye(i.maxWait)||0,t):o,d="trailing"in i?!!i.trailing:d),g.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=l=n=a=void 0},g.flush=function(){return void 0===a?s:m(Ke())},g}function Xe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ye(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==$e.call(e)}(e))return NaN;if(Xe(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xe(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Oe,"");var i=Ne.test(e);return i||Qe.test(e)?je(e.slice(2),i?2:8):Ue.test(e)?NaN:+e}var Je,et=function(e,t,i){var r=!0,n=!0;if("function"!=typeof e)throw new TypeError(De);return Xe(i)&&(r="leading"in i?!!i.leading:r,n="trailing"in i?!!i.trailing:n),We(e,t,{leading:r,maxWait:t,trailing:n})},tt=Object.prototype.toString,it=function(e){var t=tt.call(e),i="[object Arguments]"===t;return i||(i="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===tt.call(e.callee)),i};if(!Object.keys){var rt=Object.prototype.hasOwnProperty,nt=Object.prototype.toString,ot=it,st=Object.prototype.propertyIsEnumerable,at=!st.call({toString:null},"toString"),lt=st.call((function(){}),"prototype"),ct=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ut=function(e){var t=e.constructor;return t&&t.prototype===e},ht={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},dt=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!ht["$"+e]&&rt.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{ut(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();Je=function(e){var t=null!==e&&"object"==typeof e,i="[object Function]"===nt.call(e),r=ot(e),n=t&&"[object String]"===nt.call(e),o=[];if(!t&&!i&&!r)throw new TypeError("Object.keys called on a non-object");var s=lt&&i;if(n&&e.length>0&&!rt.call(e,0))for(var a=0;a0)for(var l=0;l3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new Et("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new Et("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new Et("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new Et("`loose`, if provided, must be a boolean");var r=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,s=arguments.length>6&&arguments[6],a=!!Mt&&Mt(e,t);if(Ct)Ct(e,t,{configurable:null===o&&a?a.configurable:!o,enumerable:null===r&&a?a.enumerable:!r,value:i,writable:null===n&&a?a.writable:!n});else{if(!s&&(r||n||o))throw new St("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=i}},Pt=xt,Lt=function(){return!!Pt};Lt.hasArrayLengthDefineBug=function(){if(!Pt)return null;try{return 1!==Pt([],"length",{value:1}).length}catch(e){return!0}};var Ft=Lt,kt=yt,zt="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),Rt=Object.prototype.toString,Dt=Array.prototype.concat,Ot=It,Ut=Ft(),Nt=function(e,t,i,r){if(t in e)if(!0===r){if(e[t]===i)return}else if(!function(e){return"function"==typeof e&&"[object Function]"===Rt.call(e)}(r)||!r())return;Ut?Ot(e,t,i,!0):Ot(e,t,i)},Qt=function(e,t){var i=arguments.length>2?arguments[2]:{},r=kt(t);zt&&(r=Dt.call(r,Object.getOwnPropertySymbols(t)));for(var n=0;n1&&"boolean"!=typeof t)throw new Gi('"allowMissing" argument must be a boolean');if(null===Tr(/^%?[^%]*%?$/,e))throw new Hi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=function(e){var t=wr(e,0,1),i=wr(e,-1);if("%"===t&&"%"!==i)throw new Hi("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==t)throw new Hi("invalid intrinsic syntax, expected opening `%`");var r=[];return br(e,Br,(function(e,t,i,n){r[r.length]=i?br(n,Cr,"$1"):t||e})),r}(e),r=i.length>0?i[0]:"",n=Sr("%"+r+"%",t),o=n.name,s=n.value,a=!1,l=n.alias;l&&(r=l[0],xr(i,vr([0,1],l)));for(var c=1,u=!0;c=i.length){var f=ir(s,h);s=(u=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:s[h]}else u=yr(s,h),s=s[h];u&&!a&&(fr[o]=s)}}return s},Mr=Er,Ir=It,Pr=Ft(),Lr=Bt,Fr=wt,kr=Mr("%Math.floor%"),zr=function(e,t){if("function"!=typeof e)throw new Fr("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||kr(t)!==t)throw new Fr("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],r=!0,n=!0;if("length"in e&&Lr){var o=Lr(e,"length");o&&!o.configurable&&(r=!1),o&&!o.writable&&(n=!1)}return(r||n||!i)&&(Pr?Ir(e,"length",t,!0,!0):Ir(e,"length",t)),e},Rr=fi,Dr=mi,Or=yi,Ur=function(){return Or(Rr,Dr,arguments)};!function(e){var t=zr,i=xt,r=Ti,n=Ur;e.exports=function(e){var i=r(arguments),n=e.length-(arguments.length-1);return t(i,1+(n>0?n:0),!0)},i?i(e.exports,"apply",{value:n}):e.exports.apply=n}(Ht);var Nr=Er,Qr=Ti,jr=Qr([Nr("%String.prototype.indexOf%")]),Vr=function(e,t){var i=Nr(e,!!t);return"function"==typeof i&&jr(e,".prototype.")>-1?Qr([i]):i},Hr=yt,Gr=ni(),$r=Vr,Zr=Gt,qr=$r("Array.prototype.push"),Kr=$r("Object.prototype.propertyIsEnumerable"),Wr=Gr?Zr.getOwnPropertySymbols:null,Xr=function(e,t){if(null==e)throw new TypeError("target must be an object");var i=Zr(e);if(1===arguments.length)return i;for(var r=1;r2&&!!arguments[2]&&!yn||(_n?gn(e,"name",t,!0,!0):gn(e,"name",t)),e},bn=wt,wn=Object,Tn=xn((function(){if(null==this||this!==wn(this))throw new bn("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e}),"get flags",!0),Bn=Tn,Cn=Vt.supportsDescriptors,Sn=Object.getOwnPropertyDescriptor,En=function(){if(Cn&&"gim"===/a/gim.flags){var e=Sn(RegExp.prototype,"flags");if(e&&"function"==typeof e.get&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var t="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(i,"sticky",{get:function(){t+="y"}}),e.get.call(i),"dy"===t)return e.get}}return Bn},Mn=Vt.supportsDescriptors,In=En,Pn=Bt,Ln=Object.defineProperty,Fn=$t,kn=zi,zn=/a/,Rn=Vt,Dn=Tn,On=En,Un=function(){if(!Mn||!kn)throw new Fn("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=In(),t=kn(zn),i=Pn(t,"flags");return i&&i.get===e||Ln(t,"flags",{configurable:!0,enumerable:!1,get:e}),e},Nn=(0,Ht.exports)(On());Rn(Nn,{getPolyfill:On,implementation:Dn,shim:Un});var Qn=Nn,jn=Symbol.iterator,Vn=ye(Object.freeze({__proto__:null,default:{}})),Hn="function"==typeof Map&&Map.prototype,Gn=Object.getOwnPropertyDescriptor&&Hn?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,$n=Hn&&Gn&&"function"==typeof Gn.get?Gn.get:null,Zn=Hn&&Map.prototype.forEach,qn="function"==typeof Set&&Set.prototype,Kn=Object.getOwnPropertyDescriptor&&qn?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Wn=qn&&Kn&&"function"==typeof Kn.get?Kn.get:null,Xn=qn&&Set.prototype.forEach,Yn="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,Jn="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,eo="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,to=Boolean.prototype.valueOf,io=Object.prototype.toString,ro=Function.prototype.toString,no=String.prototype.match,oo=String.prototype.slice,so=String.prototype.replace,ao=String.prototype.toUpperCase,lo=String.prototype.toLowerCase,co=RegExp.prototype.test,uo=Array.prototype.concat,ho=Array.prototype.join,po=Array.prototype.slice,fo=Math.floor,Ao="function"==typeof BigInt?BigInt.prototype.valueOf:null,mo=Object.getOwnPropertySymbols,go="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,_o="function"==typeof Symbol&&"object"==typeof Symbol.iterator,yo="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===_o||"symbol")?Symbol.toStringTag:null,vo=Object.prototype.propertyIsEnumerable,xo=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function bo(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||co.call(/e/,t))return t;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var r=e<0?-fo(-e):fo(e);if(r!==e){var n=String(r),o=oo.call(t,n.length+1);return so.call(n,i,"$&_")+"."+so.call(so.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return so.call(t,i,"$&_")}var wo=Vn,To=wo.custom,Bo=ko(To)?To:null,Co={__proto__:null,double:'"',single:"'"},So={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Eo=function e(t,i,r,n){var o=i||{};if(Ro(o,"quoteStyle")&&!Ro(Co,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ro(o,"maxStringLength")&&("number"==typeof o.maxStringLength?o.maxStringLength<0&&o.maxStringLength!==1/0:null!==o.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=!Ro(o,"customInspect")||o.customInspect;if("boolean"!=typeof s&&"symbol"!==s)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ro(o,"indent")&&null!==o.indent&&"\t"!==o.indent&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ro(o,"numericSeparator")&&"boolean"!=typeof o.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return Uo(t,o);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var l=String(t);return a?bo(t,l):l}if("bigint"==typeof t){var c=String(t)+"n";return a?bo(t,c):c}var u=void 0===o.depth?5:o.depth;if(void 0===r&&(r=0),r>=u&&u>0&&"object"==typeof t)return Lo(t)?"[Array]":"[Object]";var h=function(e,t){var i;if("\t"===e.indent)i="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;i=ho.call(Array(e.indent+1)," ")}return{base:i,prev:ho.call(Array(t+1),i)}}(o,r);if(void 0===n)n=[];else if(Oo(n,t)>=0)return"[Circular]";function d(t,i,s){if(i&&(n=po.call(n)).push(i),s){var a={depth:o.depth};return Ro(o,"quoteStyle")&&(a.quoteStyle=o.quoteStyle),e(t,a,r+1,n)}return e(t,o,r+1,n)}if("function"==typeof t&&!Fo(t)){var p=function(e){if(e.name)return e.name;var t=no.call(ro.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),f=Go(t,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(f.length>0?" { "+ho.call(f,", ")+" }":"")}if(ko(t)){var A=_o?so.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):go.call(t);return"object"!=typeof t||_o?A:Qo(A)}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var m="<"+lo.call(String(t.nodeName)),g=t.attributes||[],_=0;_"}if(Lo(t)){if(0===t.length)return"[]";var y=Go(t,d);return h&&!function(e){for(var t=0;t=0)return!1;return!0}(y)?"["+Ho(y,h)+"]":"[ "+ho.call(y,", ")+" ]"}if(function(e){return"[object Error]"===Do(e)&&Po(e)}(t)){var v=Go(t,d);return"cause"in Error.prototype||!("cause"in t)||vo.call(t,"cause")?0===v.length?"["+String(t)+"]":"{ ["+String(t)+"] "+ho.call(v,", ")+" }":"{ ["+String(t)+"] "+ho.call(uo.call("[cause]: "+d(t.cause),v),", ")+" }"}if("object"==typeof t&&s){if(Bo&&"function"==typeof t[Bo]&&wo)return wo(t,{depth:u-r});if("symbol"!==s&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!$n||!e||"object"!=typeof e)return!1;try{$n.call(e);try{Wn.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var x=[];return Zn&&Zn.call(t,(function(e,i){x.push(d(i,t,!0)+" => "+d(e,t))})),Vo("Map",$n.call(t),x,h)}if(function(e){if(!Wn||!e||"object"!=typeof e)return!1;try{Wn.call(e);try{$n.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var b=[];return Xn&&Xn.call(t,(function(e){b.push(d(e,t))})),Vo("Set",Wn.call(t),b,h)}if(function(e){if(!Yn||!e||"object"!=typeof e)return!1;try{Yn.call(e,Yn);try{Jn.call(e,Jn)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return jo("WeakMap");if(function(e){if(!Jn||!e||"object"!=typeof e)return!1;try{Jn.call(e,Jn);try{Yn.call(e,Yn)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return jo("WeakSet");if(function(e){if(!eo||!e||"object"!=typeof e)return!1;try{return eo.call(e),!0}catch(e){}return!1}(t))return jo("WeakRef");if(function(e){return"[object Number]"===Do(e)&&Po(e)}(t))return Qo(d(Number(t)));if(function(e){if(!e||"object"!=typeof e||!Ao)return!1;try{return Ao.call(e),!0}catch(e){}return!1}(t))return Qo(d(Ao.call(t)));if(function(e){return"[object Boolean]"===Do(e)&&Po(e)}(t))return Qo(to.call(t));if(function(e){return"[object String]"===Do(e)&&Po(e)}(t))return Qo(d(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||void 0!==ge&&t===ge)return"{ [object globalThis] }";if(!function(e){return"[object Date]"===Do(e)&&Po(e)}(t)&&!Fo(t)){var w=Go(t,d),T=xo?xo(t)===Object.prototype:t instanceof Object||t.constructor===Object,B=t instanceof Object?"":"null prototype",C=!T&&yo&&Object(t)===t&&yo in t?oo.call(Do(t),8,-1):B?"Object":"",S=(T||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(C||B?"["+ho.call(uo.call([],C||[],B||[]),": ")+"] ":"");return 0===w.length?S+"{}":h?S+"{"+Ho(w,h)+"}":S+"{ "+ho.call(w,", ")+" }"}return String(t)};function Mo(e,t,i){var r=i.quoteStyle||t,n=Co[r];return n+e+n}function Io(e){return so.call(String(e),/"/g,""")}function Po(e){return!yo||!("object"==typeof e&&(yo in e||void 0!==e[yo]))}function Lo(e){return"[object Array]"===Do(e)&&Po(e)}function Fo(e){return"[object RegExp]"===Do(e)&&Po(e)}function ko(e){if(_o)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!go)return!1;try{return go.call(e),!0}catch(e){}return!1}var zo=Object.prototype.hasOwnProperty||function(e){return e in this};function Ro(e,t){return zo.call(e,t)}function Do(e){return io.call(e)}function Oo(e,t){if(e.indexOf)return e.indexOf(t);for(var i=0,r=e.length;it.maxStringLength){var i=e.length-t.maxStringLength,r="... "+i+" more character"+(i>1?"s":"");return Uo(oo.call(e,0,t.maxStringLength),t)+r}var n=So[t.quoteStyle||"single"];return n.lastIndex=0,Mo(so.call(so.call(e,n,"\\$1"),/[\x00-\x1f]/g,No),"single",t)}function No(e){var t=e.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return i?"\\"+i:"\\x"+(t<16?"0":"")+ao.call(t.toString(16))}function Qo(e){return"Object("+e+")"}function jo(e){return e+" { ? }"}function Vo(e,t,i,r){return e+" ("+t+") {"+(r?Ho(i,r):ho.call(i,", "))+"}"}function Ho(e,t){if(0===e.length)return"";var i="\n"+t.prev+t.base;return i+ho.call(e,","+i)+"\n"+t.prev}function Go(e,t){var i=Lo(e),r=[];if(i){r.length=e.length;for(var n=0;n=0&&"[object Array]"!==Fs(e)&&"callee"in e&&"[object Function]"===Fs(e.callee)},Rs=function(){return ks(arguments)}();ks.isLegacyArguments=zs;var Ds,Os=Rs?ks:zs,Us={}.toString,Ns=Array.isArray||function(e){return"[object Array]"==Us.call(e)},Qs=Ht.exports,js=Vr,Vs=Er("%ArrayBuffer%",!0),Hs=js("ArrayBuffer.prototype.byteLength",!0),Gs=js("Object.prototype.toString"),$s=!!Vs&&!Hs&&new Vs(0).slice,Zs=!!$s&&Qs($s),qs=Hs||Zs?function(e){if(!e||"object"!=typeof e)return!1;try{return Hs?Hs(e):Zs(e,0),!0}catch(e){return!1}}:Vs?function(e){return"[object ArrayBuffer]"===Gs(e)}:function(e){return!1},Ks=Vr,Ws=Ks("Date.prototype.getDay"),Xs=Ks("Object.prototype.toString"),Ys=Ps(),Js=Vr,ea=Ps(),ta=Oi,ia=Bt;if(ea){var ra=Js("RegExp.prototype.exec"),na={},oa=function(){throw na},sa={toString:oa,valueOf:oa};"symbol"==typeof Symbol.toPrimitive&&(sa[Symbol.toPrimitive]=oa),Ds=function(e){if(!e||"object"!=typeof e)return!1;var t=ia(e,"lastIndex");if(!(t&&ta(t,"value")))return!1;try{ra(e,sa)}catch(e){return e===na}}}else{var aa=Js("Object.prototype.toString");Ds=function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===aa(e)}}var la=Ds,ca=Vr("SharedArrayBuffer.prototype.byteLength",!0),ua=ca?function(e){if(!e||"object"!=typeof e)return!1;try{return ca(e),!0}catch(e){return!1}}:function(e){return!1},ha=Vr,da=ha("String.prototype.valueOf"),pa=ha("Object.prototype.toString"),fa=Ps(),Aa=Vr,ma=Aa("Number.prototype.toString"),ga=Aa("Object.prototype.toString"),_a=Ps(),ya=Vr,va=ya("Boolean.prototype.toString"),xa=ya("Object.prototype.toString"),ba=Ps(),wa={exports:{}},Ta=la,Ba=Vr("RegExp.prototype.exec"),Ca=wt,Sa=Vr,Ea=Sa("Object.prototype.toString"),Ma=function(e){if(!Ta(e))throw new Ca("`regex` must be a RegExp");return function(t){return null!==Ba(e,t)}};if(ai()){var Ia=Sa("Symbol.prototype.toString"),Pa=Ma(/^Symbol\(.*\)$/);wa.exports=function(e){if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||"[object Symbol]"!==Ea(e))return!1;try{return function(e){return"symbol"==typeof e.valueOf()&&Pa(Ia(e))}(e)}catch(e){return!1}}}else wa.exports=function(e){return!1};var La={exports:{}},Fa="undefined"!=typeof BigInt&&BigInt;if("function"==typeof Fa&&"function"==typeof BigInt&&"bigint"==typeof Fa(42)&&"bigint"==typeof BigInt(42)){var ka=BigInt.prototype.valueOf;La.exports=function(e){return null!=e&&"boolean"!=typeof e&&"string"!=typeof e&&"number"!=typeof e&&"symbol"!=typeof e&&"function"!=typeof e&&("bigint"==typeof e||function(e){try{return ka.call(e),!0}catch(e){}return!1}(e))}}else La.exports=function(e){return!1};var za,Ra=function(e){return"string"==typeof e||!(!e||"object"!=typeof e)&&(fa?function(e){try{return da(e),!0}catch(e){return!1}}(e):"[object String]"===pa(e))},Da=function(e){return"number"==typeof e||!(!e||"object"!=typeof e)&&(_a?function(e){try{return ma(e),!0}catch(e){return!1}}(e):"[object Number]"===ga(e))},Oa=function(e){return"boolean"==typeof e||null!==e&&"object"==typeof e&&(ba?function(e){try{return va(e),!0}catch(e){return!1}}(e):"[object Boolean]"===xa(e))},Ua=wa.exports,Na=La.exports,Qa="function"==typeof Map&&Map.prototype?Map:null,ja="function"==typeof Set&&Set.prototype?Set:null;Qa||(za=function(e){return!1});var Va=Qa?Map.prototype.has:null,Ha=ja?Set.prototype.has:null;za||Va||(za=function(e){return!1});var Ga,$a=za||function(e){if(!e||"object"!=typeof e)return!1;try{if(Va.call(e),Ha)try{Ha.call(e)}catch(e){return!0}return e instanceof Qa}catch(e){}return!1},Za="function"==typeof Map&&Map.prototype?Map:null,qa="function"==typeof Set&&Set.prototype?Set:null;qa||(Ga=function(e){return!1});var Ka=Za?Map.prototype.has:null,Wa=qa?Set.prototype.has:null;Ga||Wa||(Ga=function(e){return!1});var Xa,Ya=Ga||function(e){if(!e||"object"!=typeof e)return!1;try{if(Wa.call(e),Ka)try{Ka.call(e)}catch(e){return!0}return e instanceof qa}catch(e){}return!1},Ja="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,el="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;Ja||(Xa=function(e){return!1});var tl=Ja?Ja.prototype.has:null,il=el?el.prototype.has:null;Xa||tl||(Xa=function(e){return!1});var rl=Xa||function(e){if(!e||"object"!=typeof e)return!1;try{if(tl.call(e,tl),il)try{il.call(e,il)}catch(e){return!0}return e instanceof Ja}catch(e){}return!1},nl={exports:{}},ol=Vr,sl=Er("%WeakSet%",!0),al=ol("WeakSet.prototype.has",!0);if(al){var ll=ol("WeakMap.prototype.has",!0);nl.exports=function(e){if(!e||"object"!=typeof e)return!1;try{if(al(e,al),ll)try{ll(e,ll)}catch(e){return!0}return e instanceof sl}catch(e){}return!1}}else nl.exports=function(e){return!1};var cl,ul,hl=$a,dl=Ya,pl=rl,fl=nl.exports,Al=Function.prototype.toString,ml="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof ml&&"function"==typeof Object.defineProperty)try{cl=Object.defineProperty({},"length",{get:function(){throw ul}}),ul={},ml((function(){throw 42}),null,cl)}catch(By){By!==ul&&(ml=null)}else ml=null;var gl=/^\s*class\b/,_l=function(e){try{var t=Al.call(e);return gl.test(t)}catch(e){return!1}},yl=function(e){try{return!_l(e)&&(Al.call(e),!0)}catch(e){return!1}},vl=Object.prototype.toString,xl="function"==typeof Symbol&&!!Symbol.toStringTag,bl=!(0 in[,]),wl=function(){return!1};if("object"==typeof document){var Tl=document.all;vl.call(Tl)===vl.call(document.all)&&(wl=function(e){if((bl||!e)&&(void 0===e||"object"==typeof e))try{var t=vl.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}var Bl=ml?function(e){if(wl(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{ml(e,null,cl)}catch(e){if(e!==ul)return!1}return!_l(e)&&yl(e)}:function(e){if(wl(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(xl)return yl(e);if(_l(e))return!1;var t=vl.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&yl(e)},Cl=Bl,Sl=Object.prototype.toString,El=Object.prototype.hasOwnProperty;var Ml=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Il="undefined"==typeof globalThis?ge:globalThis,Pl=function(e,t,i){if(!Cl(t))throw new TypeError("iterator must be a function");var r;arguments.length>=3&&(r=i),function(e){return"[object Array]"===Sl.call(e)}(e)?function(e,t,i){for(var r=0,n=e.length;r-1?hn(i):i},ql=Qn,Kl=Er,Wl=function(e){if(null!=e&&void 0!==e[jn])return e[jn]()},Xl=function(){var e,t={assert:function(e){if(!t.has(e))throw new fs("Side channel does not contain "+As(e))},delete:function(t){return!!e&&e.delete(t)},get:function(t){return e&&e.get(t)},has:function(t){return!!e&&e.has(t)},set:function(t,i){e||(e=gs()),e.set(t,i)}};return t},Yl=Ms,Jl=Os,ec=Ns,tc=qs,ic=function(e){return"object"==typeof e&&null!==e&&(Ys?function(e){try{return Ws(e),!0}catch(e){return!1}}(e):"[object Date]"===Xs(e))},rc=la,nc=ua,oc=yt,sc=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e?null:Ra(e)?"String":Da(e)?"Number":Oa(e)?"Boolean":Ua(e)?"Symbol":Na(e)?"BigInt":void 0},ac=function(e){if(e&&"object"==typeof e){if(hl(e))return"Map";if(dl(e))return"Set";if(pl(e))return"WeakMap";if(fl(e))return"WeakSet"}return!1},lc=function(e){if(!e||"object"!=typeof e)return!1;if(!Ol){var t=Ql(Dl(e),8,-1);return jl(Nl,t)>-1?t:"Object"===t&&function(e){var t=!1;return Pl(Vl,(function(i,r){if(!t)try{i(e),t=Ql(r,1)}catch(e){}})),t}(e)}return zl?function(e){var t=!1;return Pl(Vl,(function(i,r){if(!t)try{"$"+i(e)===r&&(t=Ql(r,1))}catch(e){}})),t}(e):null},cc=function(e){return Gl(e)?Hl?Hl(e):e.byteLength:NaN},uc=Zl("SharedArrayBuffer.prototype.byteLength",!0),hc=Zl("Date.prototype.getTime"),dc=Object.getPrototypeOf,pc=Zl("Object.prototype.toString"),fc=Kl("%Set%",!0),Ac=Zl("Map.prototype.has",!0),mc=Zl("Map.prototype.get",!0),gc=Zl("Map.prototype.size",!0),_c=Zl("Set.prototype.add",!0),yc=Zl("Set.prototype.delete",!0),vc=Zl("Set.prototype.has",!0),xc=Zl("Set.prototype.size",!0);function bc(e,t,i,r){for(var n,o=Wl(e);(n=o.next())&&!n.done;)if(Sc(t,n.value,i,r))return yc(e,n.value),!0;return!1}function wc(e){return void 0===e?null:"object"!=typeof e?"symbol"!=typeof e&&("string"!=typeof e&&"number"!=typeof e||+e==+e):void 0}function Tc(e,t,i,r,n,o){var s=wc(i);if(null!=s)return s;var a=mc(t,s),l=$l({},n,{strict:!1});return!(void 0===a&&!Ac(t,s)||!Sc(r,a,l,o))&&(!Ac(e,s)&&Sc(r,a,l,o))}function Bc(e,t,i){var r=wc(i);return null!=r?r:vc(t,r)&&!vc(e,r)}function Cc(e,t,i,r,n,o){for(var s,a,l=Wl(e);(s=l.next())&&!s.done;)if(Sc(i,a=s.value,n,o)&&Sc(r,mc(t,a),n,o))return yc(e,a),!0;return!1}function Sc(e,t,i,r){var n=i||{};if(n.strict?Yl(e,t):e===t)return!0;if(sc(e)!==sc(t))return!1;if(!e||!t||"object"!=typeof e&&"object"!=typeof t)return n.strict?Yl(e,t):e==t;var o,s=r.has(e),a=r.has(t);if(s&&a){if(r.get(e)===r.get(t))return!0}else o={};return s||r.set(e,o),a||r.set(t,o),function(e,t,i,r){var n,o;if(typeof e!=typeof t)return!1;if(null==e||null==t)return!1;if(pc(e)!==pc(t))return!1;if(Jl(e)!==Jl(t))return!1;var s=ec(e),a=ec(t);if(s!==a)return!1;var l=e instanceof Error,c=t instanceof Error;if(l!==c)return!1;if((l||c)&&(e.name!==t.name||e.message!==t.message))return!1;var u=rc(e),h=rc(t);if(u!==h)return!1;if((u||h)&&(e.source!==t.source||ql(e)!==ql(t)))return!1;var d=ic(e),p=ic(t);if(d!==p)return!1;if((d||p)&&hc(e)!==hc(t))return!1;if(i.strict&&dc&&dc(e)!==dc(t))return!1;var f=lc(e),A=lc(t);if(f!==A)return!1;if(f||A){if(e.length!==t.length)return!1;for(n=0;n=0;n--)if(b[n]!=w[n])return!1;for(n=b.length-1;n>=0;n--)if(!Sc(e[o=b[n]],t[o],i,r))return!1;var T=ac(e),B=ac(t);if(T!==B)return!1;if("Set"===T||"Set"===B)return function(e,t,i,r){if(xc(e)!==xc(t))return!1;var n,o,s,a=Wl(e),l=Wl(t);for(;(n=a.next())&&!n.done;)if(n.value&&"object"==typeof n.value)s||(s=new fc),_c(s,n.value);else if(!vc(t,n.value)){if(i.strict)return!1;if(!Bc(e,t,n.value))return!1;s||(s=new fc),_c(s,n.value)}if(s){for(;(o=l.next())&&!o.done;)if(o.value&&"object"==typeof o.value){if(!bc(s,o.value,i.strict,r))return!1}else if(!i.strict&&!vc(e,o.value)&&!bc(s,o.value,i.strict,r))return!1;return 0===xc(s)}return!0}(e,t,i,r);if("Map"===T)return function(e,t,i,r){if(gc(e)!==gc(t))return!1;var n,o,s,a,l,c,u=Wl(e),h=Wl(t);for(;(n=u.next())&&!n.done;)if(a=n.value[0],l=n.value[1],a&&"object"==typeof a)s||(s=new fc),_c(s,a);else if(void 0===(c=mc(t,a))&&!Ac(t,a)||!Sc(l,c,i,r)){if(i.strict)return!1;if(!Tc(e,t,a,l,i,r))return!1;s||(s=new fc),_c(s,a)}if(s){for(;(o=h.next())&&!o.done;)if(a=o.value[0],c=o.value[1],a&&"object"==typeof a){if(!Cc(s,e,a,c,i,r))return!1}else if(!(i.strict||e.has(a)&&Sc(mc(e,a),c,i,r)||Cc(s,e,a,c,$l({},i,{strict:!1}),r)))return!1;return 0===xc(s)}return!0}(e,t,i,r);return!0}(e,t,n,r)}function Ec(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&(!(e.length>0&&"number"!=typeof e[0])&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))))}var Mc=function(e,t,i){return Sc(e,t,i,Xl())};function Ic(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}function Pc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var Lc=function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var r,n,o;if(Array.isArray(t)){if((r=t.length)!=i.length)return!1;for(n=r;0!=n--;)if(!e(t[n],i[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(i,o[n]))return!1;for(n=r;0!=n--;){var s=o[n];if(!e(t[s],i[s]))return!1}return!0}return t!=t&&i!=i},Fc=Pc(Lc);const kc="__googleMapsScriptId";var zc;!function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"}(zc||(zc={}));class Rc{constructor({apiKey:e,authReferrerPolicy:t,channel:i,client:r,id:n=kc,language:o,libraries:s=[],mapIds:a,nonce:l,region:c,retries:u=3,url:h="https://maps.googleapis.com/maps/api/js",version:d}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=e,this.authReferrerPolicy=t,this.channel=i,this.client=r,this.id=n||kc,this.language=o,this.libraries=s,this.mapIds=a,this.nonce=l,this.region=c,this.retries=u,this.url=h,this.version=d,Rc.instance){if(!Fc(this.options,Rc.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(Rc.instance.options)}`);return Rc.instance}Rc.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?zc.FAILURE:this.done?zc.SUCCESS:this.loading?zc.LOADING:zc.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(e+=`&key=${this.apiKey}`),this.channel&&(e+=`&channel=${this.channel}`),this.client&&(e+=`&client=${this.client}`),this.libraries.length>0&&(e+=`&libraries=${this.libraries.join(",")}`),this.language&&(e+=`&language=${this.language}`),this.region&&(e+=`®ion=${this.region}`),this.version&&(e+=`&v=${this.version}`),this.mapIds&&(e+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(e+=`&auth_referrer_policy=${this.authReferrerPolicy}`),e}deleteScript(){const e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise(((e,t)=>{this.loadCallback((i=>{i?t(i.error):e(window.google)}))}))}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,t;if(document.getElementById(this.id))return void this.callback();const i={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(i).forEach((e=>!i[e]&&delete i[e])),(null===(t=null===(e=null===window||void 0===window?void 0:window.google)||void 0===e?void 0:e.maps)||void 0===t?void 0:t.importLibrary)||(e=>{let t,i,r,n="The Google Maps JavaScript API",o="google",s="importLibrary",a="__ib__",l=document,c=window;c=c[o]||(c[o]={});const u=c.maps||(c.maps={}),h=new Set,d=new URLSearchParams,p=()=>t||(t=new Promise(((s,c)=>Ic(this,void 0,void 0,(function*(){var p;for(r in yield i=l.createElement("script"),i.id=this.id,d.set("libraries",[...h]+""),e)d.set(r.replace(/[A-Z]/g,(e=>"_"+e[0].toLowerCase())),e[r]);d.set("callback",o+".maps."+a),i.src=this.url+"?"+d,u[a]=s,i.onerror=()=>t=c(Error(n+" could not load.")),i.nonce=this.nonce||(null===(p=l.querySelector("script[nonce]"))||void 0===p?void 0:p.nonce)||"",l.head.append(i)})))));u[s]?console.warn(n+" only loads once. Ignoring:",e):u[s]=(e,...t)=>h.add(e)&&p().then((()=>u[s](e,...t)))})(i);const r=this.libraries.map((e=>this.importLibrary(e)));r.length||r.push(this.importLibrary("core")),Promise.all(r).then((()=>this.callback()),(e=>{const t=new ErrorEvent("error",{error:e});this.loadErrorCallback(t)}))}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){const e=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout((()=>{this.deleteScript(),this.setScript()}),e)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach((e=>{e(this.onerrorEvent)})),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version)return console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."),void this.callback();this.loading=!0,this.setScript()}}}function Dc(e){let i;return{c(){i=b("div"),E(i,"id",e[0]),E(i,"class","map svelte-16c2pp7")},m(e,t){y(e,i,t)},p(e,[t]){1&t&&E(i,"id",e[0])},i:t,o:t,d(e){e&&v(i)}}}function Oc(e,t,i){let r,n,{id:o}=t,{bearing:s}=t,{center:a}=t,{pitch:l}=t,{zoom:c}=t,{mapStyle:u}=t,{numberOfMaps:h}=t,{onMapMount:d}=t;Ie.subscribe((e=>({googleMapsAPIKey:n}=e)));const p=H();let f,A={};const m=new Rc({apiKey:n,version:"beta"}),g=()=>({bearing:f.getHeading(),center:{lng:f.getCenter().lng(),lat:f.getCenter().lat()},pitch:f.getTilt(),zoom:f.getZoom()-1}),_=()=>{const e=y(g()),t=y(A);return!Mc(e,t)},y=e=>({bearing:Re(e.bearing,1),pitch:Re(e.pitch,1),center:{lat:Re(e.center.lat,6),lng:Re(e.center.lng,6)},zoom:Re(e.zoom,2)});return j((()=>{m.load().then((()=>{var t;HTMLCanvasElement.prototype.getContext=(t=HTMLCanvasElement.prototype.getContext,function(e,i){return(i=i||{}).preserveDrawingBuffer=!0,t.call(this,e,i)}),i(8,f=new google.maps.Map(document.getElementById(o),{center:A.center,zoom:A.zoom,mapId:r,disableDefaultUI:!0,isFractionalZoomEnabled:!0,fullscreenControl:!1,zoomControl:!1})),d(f);const n=et((()=>{document.getElementById(o).querySelector('div[tabindex="0"]').focus()}),250);document.getElementById(o).addEventListener("wheel",n,{passive:!0}),f.addListener("center_changed",e),f.addListener("heading_changed",e),f.addListener("tilt_changed",e),f.addListener("zoom_changed",e)}));const e=()=>{document.getElementById(o).contains(document.activeElement)&&_()&&p("mapMove",{options:g()})}})),e.$$set=e=>{"id"in e&&i(0,o=e.id),"bearing"in e&&i(1,s=e.bearing),"center"in e&&i(2,a=e.center),"pitch"in e&&i(3,l=e.pitch),"zoom"in e&&i(4,c=e.zoom),"mapStyle"in e&&i(5,u=e.mapStyle),"numberOfMaps"in e&&i(6,h=e.numberOfMaps),"onMapMount"in e&&i(7,d=e.onMapMount)},e.$$.update=()=>{if(32&e.$$.dirty&&(r=u?.mapId),30&e.$$.dirty&&i(9,A={bearing:s,center:a,pitch:l,zoom:c}),768&e.$$.dirty&&(e=>{e&&_()&&e.moveCamera({center:{lat:a.lat,lng:a.lng},zoom:c+1,heading:s,tilt:l})})(f),321&e.$$.dirty&&f&&h){const e=document.getElementById(o);if(e){new ResizeObserver((()=>{google.maps.event.trigger(f,"resize")})).observe(e)}}},[o,s,a,l,c,u,h,d,f,A]}class Uc extends me{constructor(e){super(),Ae(this,e,Oc,Dc,a,{id:0,bearing:1,center:2,pitch:3,zoom:4,mapStyle:5,numberOfMaps:6,onMapMount:7})}}function Nc(e){let i;return{c(){i=b("div"),E(i,"id",e[0]),E(i,"class","map svelte-369bnt")},m(e,t){y(e,i,t)},p(e,[t]){1&t&&E(i,"id",e[0])},i:t,o:t,d(e){e&&v(i)}}}function Qc(e,t,i){let r;l(e,Ie,(e=>i(18,r=e)));let n,{id:o}=t,{bearing:s}=t,{center:a}=t,{pitch:c}=t,{showCollisions:u}=t,{showBoundaries:h}=t,{zoom:d}=t,{mapStyle:p}=t,{numberOfMaps:f}=t,{onMapMount:A}=t,{mapRenderer:m}=t;const g=H();let _,y,v={},x=null,b=!1,w={};const T=()=>({bearing:y.getBearing(),center:y.getCenter(),pitch:y.getPitch(),zoom:y.getZoom()}),B=(e,t)=>{e&&!Mc(T(),w)&&e.jumpTo(t)};return j((async()=>{await(async()=>{"maplibre-gl"===m?(await Promise.resolve().then((function(){return Tp})),n=await Promise.resolve().then((function(){return Be}))):"maptiler-sdk"===m?(await Promise.resolve().then((function(){return Bp})),n=await Promise.resolve().then((function(){return Pb})),n.config.apiKey=r.maptilerApiKey):(await Promise.resolve().then((function(){return Lb})),n=await Promise.resolve().then((function(){return be})),n.accessToken=r.mapboxGlAccessToken,r.mapboxBaseApiUrl&&(n.baseApiUrl=r.mapboxBaseApiUrl))})();const e=n;i(13,y=new e.Map({container:o,style:_,canvasContextAttributes:{preserveDrawingBuffer:!0},preserveDrawingBuffer:!0,...w})),A(y);const t=et((()=>{document.getElementById(o).querySelector('canvas[tabindex="0"]').focus()}),250);document.getElementById(o).addEventListener("wheel",t,{passive:!0});y.on("move",(e=>{e?.resize||(({origin:e})=>{document.getElementById(o)?.contains(document.activeElement)&&g("mapMove",{options:T()})})(e)})),y.on("click",(t=>{let i=y.queryRenderedFeatures(t.point);i.length&&(b?(x.remove(),x=null):(x=(new e.Popup).setLngLat(t.lngLat).setHTML((e=>{const t=e.reduce(((e,t)=>{const{source:i,sourceLayer:r,properties:n}=t;return e.some((e=>{const t=e.source===i&&e.sourceLayer===r,o=Object.keys(n).every((t=>n[t]===e.properties[t]));return t&&o}))||e.push(t),e}),[]);let i='",i})(i)).setMaxWidth(360).addTo(y),b=!0,x.on("close",(()=>{b=!1}))))}))})),V((()=>{y&&y.remove()})),e.$$set=e=>{"id"in e&&i(0,o=e.id),"bearing"in e&&i(1,s=e.bearing),"center"in e&&i(2,a=e.center),"pitch"in e&&i(3,c=e.pitch),"showCollisions"in e&&i(4,u=e.showCollisions),"showBoundaries"in e&&i(5,h=e.showBoundaries),"zoom"in e&&i(6,d=e.zoom),"mapStyle"in e&&i(7,p=e.mapStyle),"numberOfMaps"in e&&i(8,f=e.numberOfMaps),"onMapMount"in e&&i(9,A=e.onMapMount),"mapRenderer"in e&&i(10,m=e.mapRenderer)},e.$$.update=()=>{128&e.$$.dirty&&i(11,({style:v,url:_}=p),v,(i(12,_),i(7,p))),78&e.$$.dirty&&i(14,w={bearing:s,center:a,pitch:c,zoom:d}),8208&e.$$.dirty&&y&&i(13,y.showCollisionBoxes=u,y),8224&e.$$.dirty&&y&&i(13,y.showTileBoundaries=h,y),24576&e.$$.dirty&&B(y,w),14336&e.$$.dirty&&((e,t,i)=>{e&&e.setStyle(t||i)})(y,_,v),9473&e.$$.dirty&&y&&f&&"maplibre-gl"!==m&&"maptiler-sdk"!==m&&y.once("render",(()=>{const e=document.getElementById(o);if(e){new ResizeObserver((()=>{y.resize({resize:!0})})).observe(e)}}))},[o,s,a,c,u,h,d,p,f,A,m,v,_,y,w]}class jc extends me{constructor(e){super(),Ae(this,e,Qc,Nc,a,{id:0,bearing:1,center:2,pitch:3,showCollisions:4,showBoundaries:5,zoom:6,mapStyle:7,numberOfMaps:8,onMapMount:9,mapRenderer:10})}}var Vc={exports:{}}; /* @preserve * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade @@ -8,12 +8,12 @@ function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isAr * Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) * Copyright 2024 Fonticons, Inc. - */const Xc={prefix:"fas",iconName:"compress",icon:[448,512,[],"f066","M160 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96zM32 320c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM352 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 320c-17.7 0-32 14.3-32 32l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0z"]},Yc={prefix:"fas",iconName:"camera",icon:[512,512,[62258,"camera-alt"],"f030","M149.1 64.8L138.7 96 64 96C28.7 96 0 124.7 0 160L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64l-74.7 0L362.9 64.8C356.4 45.2 338.1 32 317.4 32L194.6 32c-20.7 0-39 13.2-45.5 32.8zM256 192a96 96 0 1 1 0 192 96 96 0 1 1 0-192z"]},Jc={prefix:"fas",iconName:"link",icon:[640,512,[128279,"chain"],"f0c1","M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"]},eu={prefix:"fas",iconName:"plus",icon:[448,512,[10133,61543,"add"],"2b","M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 144L48 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0 0 144c0 17.7 14.3 32 32 32s32-14.3 32-32l0-144 144 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-144 0 0-144z"]},tu={prefix:"fas",iconName:"expand",icon:[448,512,[],"f065","M32 32C14.3 32 0 46.3 0 64l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 32zM64 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96z"]},iu={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"]},ru={prefix:"fas",iconName:"link-slash",icon:[640,512,["chain-broken","chain-slash","unlink"],"f127","M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L489.3 358.2l90.5-90.5c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114l-96 96-31.9-25C430.9 239.6 420.1 175.1 377 132c-52.2-52.3-134.5-56.2-191.3-11.7L38.8 5.1zM239 162c30.1-14.9 67.7-9.9 92.8 15.3c20 20 27.5 48.3 21.7 74.5L239 162zM406.6 416.4L220.9 270c-2.1 39.8 12.2 80.1 42.2 110c38.9 38.9 94.4 51 143.6 36.3zm-290-228.5L60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5l61.8-61.8-50.6-39.9z"]},nu=parseFloat;function ou(e,t=";"){let i;if(Array.isArray(e))i=e.filter((e=>e));else{i=[];for(const t in e)e[t]&&i.push(`${t}:${e[t]}`)}return i.join(t)}function su(e){let t,i,r,n,o,s,a;function l(e,t){return"string"==typeof e[7][4]?lu:au}let c=l(e),u=c(e);return{c(){t=w("svg"),i=w("g"),r=w("g"),u.c(),E(r,"transform",e[10]),E(i,"transform",n=`translate(${e[7][0]/2} ${e[7][1]/2})`),E(i,"transform-origin",o=e[7][0]/4+" 0"),E(t,"id",e[0]),E(t,"class",s=m(e[8])+" svelte-1cj2gr0"),E(t,"style",e[9]),E(t,"viewBox",a=`0 0 ${e[7][0]} ${e[7][1]}`),E(t,"aria-hidden","true"),E(t,"role","img"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,n){y(e,t,n),_(t,i),_(i,r),u.m(r,null)},p(e,h){c===(c=l(e))&&u?u.p(e,h):(u.d(1),u=c(e),u&&(u.c(),u.m(r,null))),1024&h&&E(r,"transform",e[10]),128&h&&n!==(n=`translate(${e[7][0]/2} ${e[7][1]/2})`)&&E(i,"transform",n),128&h&&o!==(o=e[7][0]/4+" 0")&&E(i,"transform-origin",o),1&h&&E(t,"id",e[0]),256&h&&s!==(s=m(e[8])+" svelte-1cj2gr0")&&E(t,"class",s),512&h&&E(t,"style",e[9]),128&h&&a!==(a=`0 0 ${e[7][0]} ${e[7][1]}`)&&E(t,"viewBox",a)},d(e){e&&v(t),u.d()}}}function au(e){let t,i,r,n,o,s,a,l,c,u;return{c(){t=w("path"),s=w("path"),E(t,"d",i=e[7][4][0]),E(t,"fill",r=e[3]||e[1]||"currentColor"),E(t,"fill-opacity",n=0!=e[6]?e[4]:e[5]),E(t,"transform",o=`translate(${e[7][0]/-2} ${e[7][1]/-2})`),E(s,"d",a=e[7][4][1]),E(s,"fill",l=e[2]||e[1]||"currentColor"),E(s,"fill-opacity",c=0!=e[6]?e[5]:e[4]),E(s,"transform",u=`translate(${e[7][0]/-2} ${e[7][1]/-2})`)},m(e,i){y(e,t,i),y(e,s,i)},p(e,h){128&h&&i!==(i=e[7][4][0])&&E(t,"d",i),10&h&&r!==(r=e[3]||e[1]||"currentColor")&&E(t,"fill",r),112&h&&n!==(n=0!=e[6]?e[4]:e[5])&&E(t,"fill-opacity",n),128&h&&o!==(o=`translate(${e[7][0]/-2} ${e[7][1]/-2})`)&&E(t,"transform",o),128&h&&a!==(a=e[7][4][1])&&E(s,"d",a),6&h&&l!==(l=e[2]||e[1]||"currentColor")&&E(s,"fill",l),112&h&&c!==(c=0!=e[6]?e[5]:e[4])&&E(s,"fill-opacity",c),128&h&&u!==(u=`translate(${e[7][0]/-2} ${e[7][1]/-2})`)&&E(s,"transform",u)},d(e){e&&v(t),e&&v(s)}}}function lu(e){let t,i,r,n;return{c(){t=w("path"),E(t,"d",i=e[7][4]),E(t,"fill",r=e[1]||e[2]||"currentColor"),E(t,"transform",n=`translate(${e[7][0]/-2} ${e[7][1]/-2})`)},m(e,i){y(e,t,i)},p(e,o){128&o&&i!==(i=e[7][4])&&E(t,"d",i),6&o&&r!==(r=e[1]||e[2]||"currentColor")&&E(t,"fill",r),128&o&&n!==(n=`translate(${e[7][0]/-2} ${e[7][1]/-2})`)&&E(t,"transform",n)},d(e){e&&v(t)}}}function cu(e){let i,r=e[7][4]&&su(e);return{c(){r&&r.c(),i=C()},m(e,t){r&&r.m(e,t),y(e,i,t)},p(e,[t]){e[7][4]?r?r.p(e,t):(r=su(e),r.c(),r.m(i.parentNode,i)):r&&(r.d(1),r=null)},i:t,o:t,d(e){r&&r.d(e),e&&v(i)}}}function uu(e,t,i){let r,n,o,s,{class:a=""}=t,{id:l=""}=t,{style:c=""}=t,{icon:u}=t,{size:h=""}=t,{color:d=""}=t,{fw:p=!1}=t,{pull:f=""}=t,{scale:A=1}=t,{translateX:m=0}=t,{translateY:g=0}=t,{rotate:_=""}=t,{flip:y=!1}=t,{spin:v=!1}=t,{pulse:x=!1}=t,{primaryColor:b=""}=t,{secondaryColor:w=""}=t,{primaryOpacity:T=1}=t,{secondaryOpacity:B=.4}=t,{swapOpacity:C=!1}=t;return e.$$set=e=>{"class"in e&&i(11,a=e.class),"id"in e&&i(0,l=e.id),"style"in e&&i(12,c=e.style),"icon"in e&&i(13,u=e.icon),"size"in e&&i(14,h=e.size),"color"in e&&i(1,d=e.color),"fw"in e&&i(15,p=e.fw),"pull"in e&&i(16,f=e.pull),"scale"in e&&i(17,A=e.scale),"translateX"in e&&i(18,m=e.translateX),"translateY"in e&&i(19,g=e.translateY),"rotate"in e&&i(20,_=e.rotate),"flip"in e&&i(21,y=e.flip),"spin"in e&&i(22,v=e.spin),"pulse"in e&&i(23,x=e.pulse),"primaryColor"in e&&i(2,b=e.primaryColor),"secondaryColor"in e&&i(3,w=e.secondaryColor),"primaryOpacity"in e&&i(4,T=e.primaryOpacity),"secondaryOpacity"in e&&i(5,B=e.secondaryOpacity),"swapOpacity"in e&&i(6,C=e.swapOpacity)},e.$$.update=()=>{8192&e.$$.dirty&&i(7,r=u&&u.icon||[0,0,"",[],""]),12584960&e.$$.dirty&&i(8,n=ou([a,"svelte-fa",v&&"spin",x&&"pulse"]," ")),118784&e.$$.dirty&&i(9,o=function(e,t,i,r){let n,o,s,a,l,c="-.125em";return r&&(l="center",o="1.25em"),i&&(n=i),t&&("lg"==t?(a="1.33333em",s=".75em",c="-.225em"):a="xs"==t?".75em":"sm"==t?".875em":t.replace("x","em")),ou([ou({float:n,width:o,height:"1em","line-height":s,"font-size":a,"text-align":l,"vertical-align":c,"transform-origin":"center",overflow:"visible"}),e])}(c,h,f,p)),4063232&e.$$.dirty&&i(10,s=function(e,t,i,r,n,o=1,s="",a=""){let l=1,c=1;return n&&("horizontal"==n?l=-1:"vertical"==n?c=-1:l=c=-1),ou([`translate(${nu(t)*o}${s},${nu(i)*o}${s})`,`scale(${l*nu(e)},${c*nu(e)})`,r&&`rotate(${r}${a})`]," ")}(A,m,g,_,y,512))},[l,d,b,w,T,B,C,r,n,o,s,a,c,u,h,p,f,A,m,g,_,y,v,x]}var hu=class extends me{constructor(e){super(),Ae(this,e,uu,cu,a,{class:11,id:0,style:12,icon:13,size:14,color:1,fw:15,pull:16,scale:17,translateX:18,translateY:19,rotate:20,flip:21,spin:22,pulse:23,primaryColor:2,secondaryColor:3,primaryOpacity:4,secondaryOpacity:5,swapOpacity:6})}},du={exports:{}},pu=du.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var i=Math.log(Math.pow(2,e))/Math.log(t),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(t)*r;var n=i-Math.floor(i),o="";for(r=0;r=Math.pow(2,e)?pu(e,t):o};pu.rack=function(e,t,i){var r=function(r){var o=0;do{if(o++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var s=pu(e,t)}while(Object.hasOwnProperty.call(n,s));return n[s]=r,s},n=r.hats={};return r.get=function(e){return r.hats[e]},r.set=function(e,t){return r.hats[e]=t,r},r.bits=e||128,r.base=t||16,r};var fu=du.exports;const Au=(e,t,i)=>e.replace("{branch}",t).replace("{style}",i),mu=e=>{if("string"!=typeof e)return!1;return e.startsWith("mapbox://")},gu={name:"Mapbox GL JS",value:"mapbox-gl"},_u=[gu,{name:"Maplibre GL JS",value:"maplibre-gl"},{name:"MapTiler SDK",value:"maptiler-sdk"}],yu={google:[{name:"Google Maps",value:"google"}],leaflet:[{name:"Leaflet",value:"leaflet"}],tangram:[{name:"Tangram (Leaflet)",value:"tangram"}],"vector-gl":_u,"mapbox-gl":_u,"maplibre-gl":_u,"maptiler-sdk":_u},vu=(e,t)=>{let i=!1;return"mapbox-gl"!==e.type?yu[e.type]:(e.url&&mu(e.url)?i=!0:t&&(i=Object.values(t).some((e=>mu(e?.url)||(e?.tiles??[]).some((e=>mu(e)))))),i?[gu]:yu[e.type])},xu=(e,t)=>{let i;const r=()=>window.removeEventListener("keydown",i),n=()=>{r(),t&&(i=i=>{!!t.alt==i.altKey&&!!t.shift==i.shiftKey&&!!t.control==(i.ctrlKey||i.metaKey)&&t.code==i.code&&(i.preventDefault(),t.callback?t.callback():e.click())},window.addEventListener("keydown",i))};return n(),{update:n,destroy:r}},bu=e=>{if("string"!=typeof e)return!1;return e.startsWith("mapbox://")},wu=e=>{if(!e)return!1;let t;try{t=new URL(e)}catch(e){return!1}return"api.maptiler.com"===t.host&&!t.searchParams.has("key")},Tu=(e,t)=>{const{mapboxKey:i,maptilerKey:r}=t;let n=e;return bu(e)&&i?n=((e,t)=>{if(!bu(e))return e;if(!t)return e;const[,,,i,r]=e.split("/");return`https://api.mapbox.com/styles/v1/${i}/${r}?title=true&access_token=${t}`})(n,i):wu(e)&&r&&(n=((e,t)=>{if(!t)return e;let i=new URL(e);return t&&wu(e)&&i.searchParams.append("key",t),i.toString()})(n,r)),n};let Bu,Cu;Ie.subscribe((e=>({mapboxGlAccessToken:Bu,maptilerApiKey:Cu}=e)));function Su(e){let i,r,n,a,l,c,u,h,d,p,f,A=(e[2]??e[3])+"";return{c(){i=b("div"),r=b("div"),n=b("div"),l=B(),c=b("div"),u=b("div"),h=T(A),E(n,"class",a=m(e[1]?`caret-${e[4]}`:"caret-right")+" svelte-1q5ddxk"),E(r,"class","caret-container svelte-1q5ddxk"),E(u,"class","label svelte-1q5ddxk"),E(c,"class","label-container svelte-1q5ddxk"),E(i,"class",d=m(`toggle ${e[1]&&("up"===e[4]?"active-toggle-top":"active-toggle-bottom")}`)+" svelte-1q5ddxk")},m(t,o){y(t,i,o),_(i,r),_(r,n),_(i,l),_(i,c),_(c,u),_(u,h),p||(f=[S(i,"click",(function(){s(e[0])&&e[0].apply(this,arguments)})),S(i,"keydown",e[5])],p=!0)},p(t,[r]){e=t,18&r&&a!==(a=m(e[1]?`caret-${e[4]}`:"caret-right")+" svelte-1q5ddxk")&&E(n,"class",a),12&r&&A!==(A=(e[2]??e[3])+"")&&I(h,A),18&r&&d!==(d=m(`toggle ${e[1]&&("up"===e[4]?"active-toggle-top":"active-toggle-bottom")}`)+" svelte-1q5ddxk")&&E(i,"class",d)},i:t,o:t,d(e){e&&v(i),p=!1,o(f)}}}function Eu(e,t,i){let{openTopLevel:r}=t,{topLevelOpen:n}=t,{activeLabel:o}=t,{placeholder:s}=t,{direction:a}=t;return e.$$set=e=>{"openTopLevel"in e&&i(0,r=e.openTopLevel),"topLevelOpen"in e&&i(1,n=e.topLevelOpen),"activeLabel"in e&&i(2,o=e.activeLabel),"placeholder"in e&&i(3,s=e.placeholder),"direction"in e&&i(4,a=e.direction)},[r,n,o,s,a,()=>!1]}class Mu extends me{constructor(e){super(),Ae(this,e,Eu,Su,a,{openTopLevel:0,topLevelOpen:1,activeLabel:2,placeholder:3,direction:4})}}function Iu(e,t,i){const r=e.slice();return r[16]=t[i],r}function Pu(e,t,i){const r=e.slice();return r[19]=t[i],r}function Lu(e){let t,i;return t=new Mu({props:{openTopLevel:e[7],topLevelOpen:e[4],activeLabel:e[6],direction:e[1],placeholder:e[2]}}),{c(){de(t.$$.fragment)},m(e,r){pe(t,e,r),i=!0},p(e,i){const r={};16&i&&(r.topLevelOpen=e[4]),64&i&&(r.activeLabel=e[6]),2&i&&(r.direction=e[1]),4&i&&(r.placeholder=e[2]),t.$set(r)},i(e){i||(le(t.$$.fragment,e),i=!0)},o(e){ce(t.$$.fragment,e),i=!1},d(e){fe(t,e)}}}function Fu(e){let t,i,r=e[3],n=[];for(let t=0;t{o=null})),ae()),e[4]?s?s.p(e,n):(s=Fu(e),s.c(),s.m(t,r)):s&&(s.d(1),s=null),"up"===e[1]?a?(a.p(e,n),2&n&&le(a,1)):(a=Nu(e),a.c(),le(a,1),a.m(t,null)):a&&(se(),ce(a,1,1,(()=>{a=null})),ae())},i(e){n||(le(o),le(a),n=!0)},o(e){ce(o),ce(a),n=!1},d(e){e&&v(t),o&&o.d(),s&&s.d(),a&&a.d()}}}function ju(e,t,i){let r,n,{options:o}=t,{activeValue:s}=t,{onSelect:a}=t,{direction:l="up"}=t,{placeholder:c=""}=t,u=!1,h=null;const d=e=>{i(5,h=h===e?null:e)},p=e=>{a(e),i(4,u=!1),i(5,h=null)};return e.$$set=e=>{"options"in e&&i(11,o=e.options),"activeValue"in e&&i(0,s=e.activeValue),"onSelect"in e&&i(12,a=e.onSelect),"direction"in e&&i(1,l=e.direction),"placeholder"in e&&i(2,c=e.placeholder)},e.$$.update=()=>{2048&e.$$.dirty&&i(3,r=o.map(((e,t)=>{let i={...e,id:`${t}`};return i.options&&(i.options=i.options.map(((e,i)=>({...e,id:`${t}-${i}`})))),i}))),9&e.$$.dirty&&i(6,n=r.filter((e=>!e?.header)).map((e=>e?.options?e?.options:e)).flat().find((e=>e.value===s))?.label)},[s,l,c,r,u,h,n,()=>{if(i(4,u=!u),u){const e=r.filter((e=>e.options)).find((e=>e.options.some((e=>e.value===s))));e&&i(5,h=e.id)}else i(5,h=null)},d,()=>!1,p,o,a,e=>d(e.id),e=>p(e.value),e=>p(e.value)]}class Vu extends me{constructor(e){super(),Ae(this,e,ju,Qu,a,{options:11,activeValue:0,onSelect:12,direction:1,placeholder:2})}}function Hu(e){let t,i,r,n;return i=new Vu({props:{options:e[4],activeValue:e[0].dropdownId,onSelect:e[1],direction:e[3]}}),{c(){t=b("div"),de(i.$$.fragment),E(t,"id",r=`styles-dropdown-${e[2]}`)},m(e,r){y(e,t,r),pe(i,t,null),n=!0},p(e,[o]){const s={};16&o&&(s.options=e[4]),1&o&&(s.activeValue=e[0].dropdownId),2&o&&(s.onSelect=e[1]),8&o&&(s.direction=e[3]),i.$set(s),(!n||4&o&&r!==(r=`styles-dropdown-${e[2]}`))&&E(t,"id",r)},i(e){n||(le(i.$$.fragment,e),n=!0)},o(e){ce(i.$$.fragment,e),n=!1},d(e){e&&v(t),fe(i)}}}function Gu(e,t,i){let r,{dropdownDisplayOptions:n}=t,{dropdownValue:o}=t,{onSelect:s}=t,{index:a}=t,l="up";return j((()=>{const e=document?.body?.clientHeight,t=document?.getElementById(`styles-dropdown-${a}`),r=t?.getBoundingClientRect(),n=r?.top;n&&e&&i(3,l=n{"dropdownDisplayOptions"in e&&i(5,n=e.dropdownDisplayOptions),"dropdownValue"in e&&i(0,o=e.dropdownValue),"onSelect"in e&&i(1,s=e.onSelect),"index"in e&&i(2,a=e.index)},e.$$.update=()=>{32&e.$$.dirty&&i(4,r=Object.entries(n).reduce(((e,[t,i])=>{e.push({header:t});for(const t of i)"sublist"===t.type?e.push({label:t.text,options:t.presets.map((e=>({label:e.text,value:e.dropdownId})))}):e.push({label:t.text,value:t.dropdownId});return e}),[]))},[o,s,a,l,r,n]}class $u extends me{constructor(e){super(),Ae(this,e,Gu,Hu,a,{dropdownDisplayOptions:5,dropdownValue:0,onSelect:1,index:2})}}function Zu(e){let t,i,r,n,s,a,l,c,u;return{c(){t=b("div"),i=b("input"),n=B(),s=b("button"),a=T("Submit"),E(i,"placeholder",r="branch"===e[6].dropdownType?"enter a branch name":"enter a url to a style"),E(i,"class","svelte-1fo36py"),O(i,"input-error",e[7]),s.disabled=l=e[6]?.url===e[5],E(t,"class","custom-input svelte-1fo36py")},m(r,o){y(r,t,o),_(t,i),P(i,e[5]),_(t,n),_(t,s),_(s,a),c||(u=[S(i,"input",e[15]),S(i,"focus",e[11]),S(i,"blur",e[12]),g(xu.call(null,s,{code:"Enter",callback:e[10]})),S(s,"click",e[9])],c=!0)},p(e,t){64&t&&r!==(r="branch"===e[6].dropdownType?"enter a branch name":"enter a url to a style")&&E(i,"placeholder",r),32&t&&i.value!==e[5]&&P(i,e[5]),128&t&&O(i,"input-error",e[7]),96&t&&l!==(l=e[6]?.url===e[5])&&(s.disabled=l)},d(e){e&&v(t),c=!1,o(u)}}}function qu(e){let t,i;return{c(){t=b("div"),i=T(e[7]),E(t,"class","error-message svelte-1fo36py")},m(e,r){y(e,t,r),_(t,i)},p(e,t){128&t&&I(i,e[7])},d(e){e&&v(t)}}}function Ku(e){let t,i,r,n,o,s,a,l,c,u;i=new $u({props:{dropdownDisplayOptions:e[0],dropdownValue:e[1],index:e[4],onSelect:e[14]}});let h=("custom"===e[6]?.dropdownType||"branch"===e[6]?.dropdownType)&&Zu(e),d=!!e[7]&&qu(e);return c=new Vu({props:{options:e[2].map(Wu),activeValue:e[3],onSelect:e[16],direction:"up"}}),{c(){t=b("div"),de(i.$$.fragment),r=B(),h&&h.c(),n=B(),d&&d.c(),o=B(),s=b("div"),a=b("span"),a.textContent="Rendered with",l=B(),de(c.$$.fragment),E(a,"class","nowrap svelte-1fo36py"),E(s,"class","renderer-control svelte-1fo36py"),E(t,"class","map-style-input svelte-1fo36py")},m(e,p){y(e,t,p),pe(i,t,null),_(t,r),h&&h.m(t,null),_(t,n),d&&d.m(t,null),_(t,o),_(t,s),_(s,a),_(s,l),pe(c,s,null),u=!0},p(e,[r]){const s={};1&r&&(s.dropdownDisplayOptions=e[0]),2&r&&(s.dropdownValue=e[1]),16&r&&(s.index=e[4]),i.$set(s),"custom"===e[6]?.dropdownType||"branch"===e[6]?.dropdownType?h?h.p(e,r):(h=Zu(e),h.c(),h.m(t,n)):h&&(h.d(1),h=null),e[7]?d?d.p(e,r):(d=qu(e),d.c(),d.m(t,o)):d&&(d.d(1),d=null);const a={};4&r&&(a.options=e[2].map(Wu)),8&r&&(a.activeValue=e[3]),c.$set(a)},i(e){u||(le(i.$$.fragment,e),le(c.$$.fragment,e),u=!0)},o(e){ce(i.$$.fragment,e),ce(c.$$.fragment,e),u=!1},d(e){e&&v(t),fe(i),h&&h.d(),d&&d.d(),fe(c)}}}const Wu=e=>({label:e.name,value:e.value});function Xu(e,t,i){const r=H();let n,o,{dropdownDisplayOptions:s}=t,{dropdownValue:a}=t,{rendererOptions:l}=t,{rendererValue:c}=t,{activeUrl:u}=t,{index:h}=t,d=!1,p=null,f=!0;V((()=>{f=!1})),j((()=>{i(6,n=a),i(5,o=n.defaultText),A(n.url)}));const A=e=>{const t=e=>{if(!f||!e||u!==e)return!1;const t=new RegExp("^(?:[a-z+]+:)?//","i");return e.includes("localhost")||!t.test(e)};t(e)&&setTimeout((()=>t(e)&&g(e,!0)),3e3)},m=e=>{const t=["dropdownType","selected","defaultText"];let i={...Object.fromEntries(Object.entries(e).filter((([e,i])=>!t.includes(e))))};"branch"===n.dropdownType&&(i.branch=o),e&&(i.id=e.id??e?.style?.id,i.name=e.name??e?.style?.name),r("updateMapStore",{value:i})},g=async(e,t=!1)=>{let o;try{const i=await(async e=>{const t=bu(e);let i,r=e;try{r=new URL(e);const t={mapboxKey:Bu,maptilerKey:Cu};r=Tu(r.toString(),t)}catch(e){}try{i=await fetch(r)}catch(e){throw{message:e.message}}if(!i.ok)throw{status:i.status,message:i.statusText};const n=await i.json();if(t&&n.message)throw{message:n.message};return n})(e);if(i&&"object"==typeof i)return o=i,A(e),t?r("updateMapStore",{value:{style:o,isPolling:t}}):m({...n,style:o,url:e,isPolling:t}),{status:"200"}}catch(e){const{status:t,message:r}=e;return i(7,p=new Error(r)),{status:t}}},_=async e=>{const{status:t}=await g(e);"200"===t&&(i(6,n.url=e,n),A(e)),r("setUrl",{value:e})},y=async()=>{const{dropdownType:e,pattern:t}=n;let i="branch"===e?Au(t,o,n.id):o;if(n?.url!==i){if(i.includes("localhost")){const[e,t]=i.split("localhost");e||(i=`http://localhost${t}`)}_(i)}};return e.$$set=e=>{"dropdownDisplayOptions"in e&&i(0,s=e.dropdownDisplayOptions),"dropdownValue"in e&&i(1,a=e.dropdownValue),"rendererOptions"in e&&i(2,l=e.rendererOptions),"rendererValue"in e&&i(3,c=e.rendererValue),"activeUrl"in e&&i(13,u=e.activeUrl),"index"in e&&i(4,h=e.index)},e.$$.update=()=>{32&e.$$.dirty&&(e=>{p&&void 0!==e&&i(7,p=null)})(o),2&e.$$.dirty&&(()=>{const e=Object.entries(a).every((e=>{const[t,i]=e;return"url"===t||!(!n||n[t]!==i)||void 0}));if(e)return;const t=n?.dropdownType;i(6,n=a),i(7,p=null);const{dropdownType:r}=n;switch(r){case"preset":{const{type:e,url:t}=n;if(["google","leaflet"].includes(e)){m(n);break}_(t);break}case"branch":o&&"branch"===t&&y()}i(5,o=n.defaultText)})()},[s,a,l,c,h,o,n,p,r,y,()=>{d&&y()},()=>{d=!0},()=>{d=!1,p&&i(5,o=n.defaultText)},u,e=>r("selectOption",{dropdownId:e}),function(){o=this.value,i(5,o)},e=>r("selectRenderer",{value:e})]}class Yu extends me{constructor(e){super(),Ae(this,e,Xu,Ku,a,{dropdownDisplayOptions:0,dropdownValue:1,rendererOptions:2,rendererValue:3,activeUrl:13,index:4})}}function Ju(e,t,i){const r=e.slice();return r[15]=t[i],r[17]=i,r}function eh(e,t,i){const r=e.slice();return r[18]=t[i],r[20]=i,r}function th(e,t,i){const r=e.slice();return r[21]=t[i],r[17]=i,r}function ih(e,t,i){const r=e.slice();return r[23]=t[i],r[20]=i,r}function rh(e){let t,i,r,n=e[2].length&&nh(),o=e[1].length&&oh(e),s=e[5].length&&lh(e);return{c(){n&&n.c(),t=B(),i=b("div"),o&&o.c(),r=B(),s&&s.c(),E(i,"class","controls svelte-1cgcqsn")},m(e,a){n&&n.m(e,a),y(e,t,a),y(e,i,a),o&&o.m(i,null),_(i,r),s&&s.m(i,null)},p(e,a){e[2].length?n||(n=nh(),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null),e[1].length?o?o.p(e,a):(o=oh(e),o.c(),o.m(i,r)):o&&(o.d(1),o=null),e[5].length?s?s.p(e,a):(s=lh(e),s.c(),s.m(i,null)):s&&(s.d(1),s=null)},d(e){n&&n.d(e),e&&v(t),e&&v(i),o&&o.d(),s&&s.d()}}}function nh(e){let t;return{c(){t=b("div"),t.textContent="Custom actions:",E(t,"class","action-dropdown svelte-1cgcqsn")},m(e,i){y(e,t,i)},d(e){e&&v(t)}}}function oh(e){let t,i,r,n=e[1],s=[];for(let t=0;te[11].call(t)))},m(n,o){y(n,t,o);for(let e=0;ei(13,s=e)));let a,{mapId:c}=t,{mapIdIndex:u}=t,h=!1;ke.subscribe((e=>{const t=u.split("-").pop();i(0,a=e?.[t])}));const{customJs:d=[]}=s;let p=null;const f=e=>{if(u.split("-").pop(),!a||!e)return;e(a)()};return e.$$set=e=>{"mapId"in e&&i(9,c=e.mapId),"mapIdIndex"in e&&i(10,u=e.mapIdIndex)},e.$$.update=()=>{if(512&e.$$.dirty&&i(2,r=d.filter((e=>e.mapIds.includes(c)))),4&e.$$.dirty&&i(1,n=r.filter((e=>"dropdown"===e.type))),4&e.$$.dirty&&i(5,o=r.filter((e=>"checkbox"===e.type))),2&e.$$.dirty&&(n.length||i(4,p=null)),1&e.$$.dirty&&a){a.isStyleLoaded?.()??!0?i(3,h=!0):a.on("style.load",(()=>{i(3,h=!0)}))}},[a,n,r,h,p,o,e=>{const{dropdown:t,option:i}=JSON.parse(e.target.value),r=n?.[t]?.options?.[i];if(!a||!r)return;const{script:o}=r;o(a)()},f,e=>{if("boolean"==typeof e)return e;if(!a||!e)return;return e(a)()},c,u,function(){p=function(e){const t=e.querySelector(":checked");return t&&t.__value}(this),i(4,p),i(1,n),i(2,r),i(9,c)},e=>f(e?.script)]}class fh extends me{constructor(e){super(),Ae(this,e,ph,dh,a,{mapId:9,mapIdIndex:10})}}function Ah(e){let t,i;return t=new Yu({props:{dropdownValue:e[6],dropdownDisplayOptions:e[4],rendererOptions:e[7],rendererValue:e[2],index:e[0],activeUrl:e[3]}}),t.$on("setUrl",e[9]),t.$on("selectOption",e[10]),t.$on("selectRenderer",e[11]),t.$on("updateMapStore",e[12]),{c(){de(t.$$.fragment)},m(e,r){pe(t,e,r),i=!0},p(e,i){const r={};64&i&&(r.dropdownValue=e[6]),16&i&&(r.dropdownDisplayOptions=e[4]),128&i&&(r.rendererOptions=e[7]),4&i&&(r.rendererValue=e[2]),1&i&&(r.index=e[0]),8&i&&(r.activeUrl=e[3]),t.$set(r)},i(e){i||(le(t.$$.fragment,e),i=!0)},o(e){ce(t.$$.fragment,e),i=!1},d(e){fe(t,e)}}}function mh(e){let t,i,r,n,o=e[5]&&Ah(e);return r=new fh({props:{mapId:e[8],mapIdIndex:e[1]}}),{c(){t=b("div"),o&&o.c(),i=B(),de(r.$$.fragment),E(t,"class","map-style-input-wrapper svelte-7abtsv")},m(e,s){y(e,t,s),o&&o.m(t,null),_(t,i),pe(r,t,null),n=!0},p(e,[n]){e[5]?o?(o.p(e,n),32&n&&le(o,1)):(o=Ah(e),o.c(),le(o,1),o.m(t,i)):o&&(se(),ce(o,1,1,(()=>{o=null})),ae());const s={};256&n&&(s.mapId=e[8]),2&n&&(s.mapIdIndex=e[1]),r.$set(s)},i(e){n||(le(o),le(r.$$.fragment,e),n=!0)},o(e){ce(o),ce(r.$$.fragment,e),n=!1},d(e){e&&v(t),o&&o.d(),fe(r)}}}function gh(e,t,i){let r,n,o,s,a,l,{index:c}=t,{stylesheet:u}=t,{mapIdIndex:h}=t;Ie.subscribe((e=>({branchPatterns:r}=e)));let d=[];Ee.subscribe((e=>{i(14,n=e.find((e=>e.index===c))),n&&(o=n.branch,s=n.renderer,a=n.type,i(3,l=n.url))}));let p,f,A={},m=[],g=[];const _=()=>{let e;for(const t of m)if(t?.selected&&(e=t),"sublist"===t?.type)for(const i of t?.presets)i?.selected&&(e=i);if(e){switch(e=JSON.parse(JSON.stringify(e)),e.dropdownType){case"preset":e={...e,defaultText:""};break;case"branch":e={...e,defaultText:o??""};break;case"custom":e={...e,defaultText:l,url:l}}i(6,p=e)}},y=()=>{i(7,g=vu(p,u?.sources)),v()},v=()=>{let e=s;const t=vu(p,u?.sources).map((e=>e.value));e&&t.includes(e)||(e=t.includes(p.type)?p.type:t[0]),i(2,f=e)},x=()=>{(()=>{if(i(4,A={}),i(5,m=[]),d.length){const e=d.map((e=>({...e,dropdownType:"preset",selected:l===e?.url&&a===e?.type,dropdownId:fu(),..."sublist"===e.type&&{presets:e.presets.map((e=>({...e,dropdownType:"preset",selected:l===e?.url&&a===e?.type,dropdownId:fu()})))}})));i(5,m=m.concat(e)),i(4,A.Presets=e.map((e=>({text:e.name,..."sublist"!==e.type&&{dropdownId:e.dropdownId},..."sublist"===e.type&&{type:"sublist",presets:e.presets.map((e=>({text:e.name,dropdownId:e.dropdownId})))}}))),A)}if(r){let e=[];for(const t of r){let r={name:t.name??t.id,type:"sublist",dropdownId:fu(),presets:[]};if(t?.styles?.length){const e=t?.styles.map((e=>({screenshotName:`${t.name??t.id}: ${e} on`,name:`${t.name??t.id}: ${e} on...`,branchId:t?.id,id:e,branchStyle:e,type:t.type,dropdownType:"branch",selected:!(!o||Au(t.pattern,o,e)!==l||t.type!==a),pattern:t.pattern,dropdownId:fu()})));r.presets=r.presets.concat(e)}e.push(r),i(5,m=m.concat(e)),i(4,A["Styles on a branch"]=e.map((e=>({text:e.name,..."sublist"!==e.type&&{dropdownId:e.dropdownId},..."sublist"===e.type&&{type:"sublist",presets:e.presets.map((e=>({text:e.name,dropdownId:e.dropdownId})))}}))),A)}}const e=[{name:"Fetch URL at...",dropdownType:"custom",selected:!m.some((e=>!!e?.selected||e?.presets?.some((e=>!!e.selected)))),type:"mapbox-gl",renderer:"mapbox-gl",dropdownId:fu()}];i(5,m=m.concat(e)),i(4,A.Custom=e.map((e=>({text:e.name,dropdownId:e.dropdownId}))),A)})(),_()};Me.subscribe((e=>{d=e,x(),y()}));let b;return e.$$set=e=>{"index"in e&&i(0,c=e.index),"stylesheet"in e&&i(13,u=e.stylesheet),"mapIdIndex"in e&&i(1,h=e.mapIdIndex)},e.$$.update=()=>{var t;16384&e.$$.dirty&&(!(t=n)||"branch"===p?.dropdownType&&!p?.url&&n.isPolling||t.type===p.type&&t.url===p.url||x()),4&e.$$.dirty&&(e=>{Ee.update((t=>t.map(((t,i)=>i!==c?t:{...t,renderer:e}))))})(f),16384&e.$$.dirty&&n&&i(8,b=n?.branchId??n?.id??null)},[c,h,f,l,A,m,p,g,b,e=>{i(6,p.url=e.detail.value,p),y()},e=>{const{dropdownId:t}=e.detail;i(5,m=m.reduce(((e,i)=>{let r=i;return"sublist"===r?.type?r.presets=r.presets.map((e=>({...e,selected:e.dropdownId===t}))):r={...r,selected:i.dropdownId===t},e.push(r),e}),[])),_(),y()},e=>{i(2,f=e.detail.value)},e=>{const{value:t}=e.detail;if(t.isPolling)Ee.update((e=>e.map(((e,i)=>i===c?{...e,...t}:e))));else{const e={...t,index:c,renderer:s};delete e.dropdownId,Ee.update((t=>t.map(((t,i)=>i===c?e:t))))}},u,n]}class _h extends me{constructor(e){super(),Ae(this,e,gh,mh,a,{index:0,stylesheet:13,mapIdIndex:1})}}function yh(e){let t,i,r,n;const o=e[1].default,s=c(o,e,e[0],null);return{c(){t=b("button"),s&&s.c(),E(t,"class","svelte-d9bm20")},m(o,a){y(o,t,a),s&&s.m(t,null),i=!0,r||(n=S(t,"click",e[2]),r=!0)},p(e,[t]){s&&s.p&&(!i||1&t)&&d(s,o,e,e[0],i?h(o,e[0],t,null):p(e[0]),null)},i(e){i||(le(s,e),i=!0)},o(e){ce(s,e),i=!1},d(e){e&&v(t),s&&s.d(e),r=!1,n()}}}function vh(e,t,i){let{$$slots:r={},$$scope:n}=t;return e.$$set=e=>{"$$scope"in e&&i(0,n=e.$$scope)},[n,r,function(t){G.call(this,e,t)}]}class xh extends me{constructor(e){super(),Ae(this,e,vh,yh,a,{})}}function bh(e){let t,i,r,n,o,s,a,l,c,u,h,d,p;return a=new xh({props:{$$slots:{default:[Th]},$$scope:{ctx:e}}}),a.$on("click",e[6]),u=new xh({props:{$$slots:{default:[Bh]},$$scope:{ctx:e}}}),u.$on("click",e[5]),{c(){t=b("div"),i=b("div"),r=T(e[2]),n=B(),o=b("div"),s=b("div"),de(a.$$.fragment),l=B(),c=b("div"),de(u.$$.fragment),E(i,"class","map-state svelte-1nshzal"),E(s,"class","svelte-1nshzal"),E(c,"class","svelte-1nshzal"),E(o,"class","location-actions svelte-1nshzal"),E(t,"class","map-state-container svelte-1nshzal")},m(f,A){y(f,t,A),_(t,i),_(i,r),_(t,n),_(t,o),_(o,s),pe(a,s,null),_(o,l),_(o,c),pe(u,c,null),h=!0,d||(p=S(i,"click",e[5]),d=!0)},p(e,t){(!h||4&t)&&I(r,e[2]);const i={};2097152&t&&(i.$$scope={dirty:t,ctx:e}),a.$set(i);const n={};2097153&t&&(n.$$scope={dirty:t,ctx:e}),u.$set(n)},i(e){h||(le(a.$$.fragment,e),le(u.$$.fragment,e),h=!0)},o(e){ce(a.$$.fragment,e),ce(u.$$.fragment,e),h=!1},d(e){e&&v(t),fe(a),fe(u),d=!1,p()}}}function wh(e){let i,r,n,s,a;return{c(){i=b("div"),r=b("input"),n=b("label"),n.textContent="enter zoom/lat/lng[/pitch/bearing]",F(r,"height","18px"),E(r,"type","text"),E(n,"class","input-label svelte-1nshzal"),E(i,"class","state-record svelte-1nshzal")},m(t,o){y(t,i,o),_(i,r),P(r,e[3]),e[17](r),_(i,n),s||(a=[S(r,"input",e[15]),S(r,"keydown",e[16]),S(r,"focus",Sh)],s=!0)},p(e,t){8&t&&r.value!==e[3]&&P(r,e[3])},i:t,o:t,d(t){t&&v(i),e[17](null),s=!1,o(a)}}}function Th(e){let t;return{c(){t=T("change")},m(e,i){y(e,t,i)},d(e){e&&v(t)}}}function Bh(e){let t,i=e[0]?"copied":"copy";return{c(){t=T(i)},m(e,i){y(e,t,i)},p(e,r){1&r&&i!==(i=e[0]?"copied":"copy")&&I(t,i)},d(e){e&&v(t)}}}function Ch(e){let t,i,r,n;const o=[wh,bh],s=[];function a(e,t){return e[1]?0:1}return i=a(e),r=s[i]=o[i](e),{c(){t=b("div"),r.c()},m(e,r){y(e,t,r),s[i].m(t,null),n=!0},p(e,[n]){let l=i;i=a(e),i===l?s[i].p(e,n):(se(),ce(s[l],1,1,(()=>{s[l]=null})),ae(),r=s[i],r?r.p(e,n):(r=s[i]=o[i](e),r.c()),le(r,1),r.m(t,null))},i(e){n||(le(r),n=!0)},o(e){ce(r),n=!1},d(e){e&&v(t),s[i].d()}}}const Sh=e=>e.target.select();function Eh(e,t,i){let r,n,{bearing:o}=t,{center:s}=t,{pitch:a}=t,{zoom:l}=t;const c=H();let u,h=!1,d=!1,p="",f="";const A=()=>{i(1,d=!1)},m=()=>{i(1,d=!1),i(0,h=!1);const[e,t,r,n,o]=f.split("/"),s=(({zoom:e,lat:t,lng:i,pitch:r,bearing:n})=>{let o=!0;return[e,t,i,r,n].filter(Boolean).every((e=>!isNaN(Number(e))))||(o=!1),(+e<0||+e>24)&&(o=!1),(+t<-90||+t>90)&&(o=!1),(+i<-180||+i>180)&&(o=!1),void 0!==r&&(+r<0||+r>85)&&(o=!1),void 0!==n&&isNaN(+n)&&(o=!1),o})({zoom:e,lat:t,lng:r,pitch:n,bearing:o});if(!s)return;const a={mapStateUpdateOrigin:"controls"};void 0!==e&&(a.zoom=+e),void 0!==t&&void 0!==r&&(a.center={lng:+r,lat:+t}),void 0!==n&&(a.pitch=+n),void 0!==o&&(a.bearing=+o),c("mapState",{options:a})};return e.$$set=e=>{"bearing"in e&&i(9,o=e.bearing),"center"in e&&i(10,s=e.center),"pitch"in e&&i(11,a=e.pitch),"zoom"in e&&i(12,l=e.zoom)},e.$$.update=()=>{1024&e.$$.dirty&&i(14,r=s.lat),1024&e.$$.dirty&&i(13,n=s.lng),31232&e.$$.dirty&&((e,t,r,n,o)=>{let s=[Re(r,2),Re(e,5),Re(t,5)];(n||o)&&(s.push(Re(n,1)),s.push(Re(o,1))),i(2,p=s.join("/")),i(0,h=!1)})(r,n,l,a,o)},[h,d,p,f,u,()=>{i(0,h=!0),navigator.clipboard.writeText(p)},async()=>{i(1,d=!0),i(3,f=p),await(Y(),W),u.focus()},A,m,o,s,a,l,n,r,function(){f=this.value,i(3,f)},e=>{"Enter"===e.key&&m(),"Escape"===e.key&&A()},function(e){Z[e?"unshift":"push"]((()=>{u=e,i(4,u)}))}]}class Mh extends me{constructor(e){super(),Ae(this,e,Eh,Ch,a,{bearing:9,center:10,pitch:11,zoom:12})}}function Ih(e){let t,i,r,n,o,a,l,c,u,h,d,p,f,A=!e[8]&&Object.keys(e[6]).length;r=new hu({props:{icon:iu}}),u=new _h({props:{index:e[0],stylesheet:e[4],mapIdIndex:e[5]}});let m=A&&Ph(e);return{c(){t=b("div"),i=b("button"),de(r.$$.fragment),n=B(),o=b("div"),a=T(e[1]),l=B(),c=b("div"),de(u.$$.fragment),h=B(),m&&m.c(),E(i,"class","close-button svelte-1mnw17n"),i.disabled=e[3],E(o,"class","map-name svelte-1mnw17n"),E(c,"class","options-container svelte-1mnw17n"),E(t,"class","map-label svelte-1mnw17n")},m(A,g){y(A,t,g),_(t,i),pe(r,i,null),_(t,n),_(t,o),_(o,a),_(t,l),_(t,c),pe(u,c,null),_(c,h),m&&m.m(c,null),d=!0,p||(f=S(i,"click",(function(){s(e[2])&&e[2].apply(this,arguments)})),p=!0)},p(t,r){e=t,(!d||8&r)&&(i.disabled=e[3]),(!d||2&r)&&I(a,e[1]);const n={};1&r&&(n.index=e[0]),16&r&&(n.stylesheet=e[4]),32&r&&(n.mapIdIndex=e[5]),u.$set(n),320&r&&(A=!e[8]&&Object.keys(e[6]).length),A?m?(m.p(e,r),320&r&&le(m,1)):(m=Ph(e),m.c(),le(m,1),m.m(c,null)):m&&(se(),ce(m,1,1,(()=>{m=null})),ae())},i(e){d||(le(r.$$.fragment,e),le(u.$$.fragment,e),le(m),d=!0)},o(e){ce(r.$$.fragment,e),ce(u.$$.fragment,e),ce(m),d=!1},d(e){e&&v(t),fe(r),fe(u),m&&m.d(),p=!1,f()}}}function Ph(e){let t,r,n;const o=[e[6]];let s={};for(let e=0;e{r=null})),ae())},i(e){i||(le(r),i=!0)},o(e){ce(r),i=!1},d(e){r&&r.d(e),e&&v(t)}}}function Fh(e,t,i){let r,n,o,s;l(e,Pe,(e=>i(7,o=e))),l(e,Le,(e=>i(8,s=e)));let a,{index:c}=t,{name:u}=t,{onClose:h}=t,{disableClose:d}=t,{mapState:p}=t,{stylesheet:f}=t,{mapIdIndex:A}=t;return e.$$set=e=>{"index"in e&&i(0,c=e.index),"name"in e&&i(1,u=e.name),"onClose"in e&&i(2,h=e.onClose),"disableClose"in e&&i(3,d=e.disableClose),"mapState"in e&&i(9,p=e.mapState),"stylesheet"in e&&i(4,f=e.stylesheet),"mapIdIndex"in e&&i(5,A=e.mapIdIndex)},e.$$.update=()=>{512&e.$$.dirty&&i(6,({showBoundaries:r,showCollisions:n,...a}=p),a)},[c,u,h,d,f,A,a,o,s,p,function(t){G.call(this,e,t)}]}class kh extends me{constructor(e){super(),Ae(this,e,Fh,Lh,a,{index:0,name:1,onClose:2,disableClose:3,mapState:9,stylesheet:4,mapIdIndex:5})}}const zh=["swipe","mirror","phone","responsive"],Rh=(e,t)=>{const i=t.some((({type:e})=>"google"===e));return i?e.zoom<12?35:45:60},Dh=(e,t)=>{const i={...e};if((e=>e.some((({type:e})=>"google"===e)))(t)){const r=Rh(e,t);i.pitch>r&&(i.pitch=r)}return i};var Oh={exports:{}};!function(e,t){var i="__lodash_hash_undefined__",r=9007199254740991,n="[object Arguments]",o="[object Array]",s="[object Boolean]",a="[object Date]",l="[object Error]",c="[object Function]",u="[object Map]",h="[object Number]",d="[object Object]",p="[object Promise]",f="[object RegExp]",A="[object Set]",m="[object String]",g="[object Symbol]",_="[object WeakMap]",y="[object ArrayBuffer]",v="[object DataView]",x=/^\[object .+?Constructor\]$/,b=/^(?:0|[1-9]\d*)$/,w={};w["[object Float32Array]"]=w["[object Float64Array]"]=w["[object Int8Array]"]=w["[object Int16Array]"]=w["[object Int32Array]"]=w["[object Uint8Array]"]=w["[object Uint8ClampedArray]"]=w["[object Uint16Array]"]=w["[object Uint32Array]"]=!0,w[n]=w[o]=w[y]=w[s]=w[v]=w[a]=w[l]=w[c]=w[u]=w[h]=w[d]=w[f]=w[A]=w[m]=w[_]=!1;var T="object"==typeof ge&&ge&&ge.Object===Object&&ge,B="object"==typeof self&&self&&self.Object===Object&&self,C=T||B||Function("return this")(),S=t&&!t.nodeType&&t,E=S&&e&&!e.nodeType&&e,M=E&&E.exports===S,I=M&&T.process,P=function(){try{return I&&I.binding&&I.binding("util")}catch(e){}}(),L=P&&P.isTypedArray;function F(e,t){for(var i=-1,r=null==e?0:e.length;++ia))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var u=-1,h=!0,d=2&i?new ye:void 0;for(o.set(e,t),o.set(t,e);++u-1},me.prototype.set=function(e,t){var i=this.__data__,r=be(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this},_e.prototype.clear=function(){this.size=0,this.__data__={hash:new Ae,map:new(re||me),string:new Ae}},_e.prototype.delete=function(e){var t=Ie(this,e).delete(e);return this.size-=t?1:0,t},_e.prototype.get=function(e){return Ie(this,e).get(e)},_e.prototype.has=function(e){return Ie(this,e).has(e)},_e.prototype.set=function(e,t){var i=Ie(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this},ye.prototype.add=ye.prototype.push=function(e){return this.__data__.set(e,i),this},ye.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.clear=function(){this.__data__=new me,this.size=0},ve.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},ve.prototype.get=function(e){return this.__data__.get(e)},ve.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.set=function(e,t){var i=this.__data__;if(i instanceof me){var r=i.__data__;if(!re||r.length<199)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new _e(r)}return i.set(e,t),this.size=i.size,this};var Le=J?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var i=-1,r=null==e?0:e.length,n=0,o=[];++i-1&&e%1==0&&e-1&&e%1==0&&e<=r}function je(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ve(e){return null!=e&&"object"==typeof e}var He=L?function(e){return function(t){return e(t)}}(L):function(e){return Ve(e)&&Qe(e.length)&&!!w[we(e)]};function Ge(e){return null!=(t=e)&&Qe(t.length)&&!Ne(t)?xe(e):Se(e);var t}e.exports=function(e,t){return Be(e,t)}}(Oh,Oh.exports);var Uh=Oh.exports;function Nh(e){let t,i=(e[0].name??e[0].id)+"";return{c(){t=T(i)},m(e,i){y(e,t,i)},p(e,r){1&r&&i!==(i=(e[0].name??e[0].id)+"")&&I(t,i)},d(e){e&&v(t)}}}function Qh(e){let t,i,r,n,o,s,a=(e[0].screenshotName??e[0].name??e[0].id)+"",l=e[0].branch+"";return{c(){t=b("div"),i=T(a),r=B(),n=b("span"),o=T(" "),s=T(l),E(n,"class","screenshot-label-bold svelte-14y9jxq"),E(t,"class","screenshot-text svelte-14y9jxq")},m(e,a){y(e,t,a),_(t,i),_(t,r),_(t,n),_(n,o),_(n,s)},p(e,t){1&t&&a!==(a=(e[0].screenshotName??e[0].name??e[0].id)+"")&&I(i,a),1&t&&l!==(l=e[0].branch+"")&&I(s,l)},d(e){e&&v(t)}}}function jh(e){let t,r,n;const o=[{onMapMount:e[12]},e[8],e[9]];var s=e[7];function a(e){let t={};for(let e=0;e{fe(e,1)})),ae()}s?(r=U(s,a()),r.$on("mapMove",e[11]),de(r.$$.fragment),le(r.$$.fragment,1),pe(r,t,null)):r=null}else s&&r.$set(l);(!n||4&i)&&O(t,"highlight-diff",e[2])},i(e){n||(r&&le(r.$$.fragment,e),n=!0)},o(e){r&&ce(r.$$.fragment,e),n=!1},d(e){e&&v(t),r&&fe(r)}}}function Vh(e){let t,i,r,n,o;return i=new kh({props:{index:e[0].index,mapIdIndex:e[6],name:e[0].name,onClose:e[10],disableClose:e[1]<=1,mapState:e[9],stylesheet:e[4]}}),i.$on("mapState",e[11]),{c(){t=b("div"),de(i.$$.fragment),E(t,"id",r=e[0].id),E(t,"class",n=m("map-label-container "+(2===e[1]?`map-label-container-${e[0].index}`:""))+" svelte-14y9jxq"),E(t,"style",e[3])},m(e,r){y(e,t,r),pe(i,t,null),o=!0},p(e,s){const a={};1&s&&(a.index=e[0].index),64&s&&(a.mapIdIndex=e[6]),1&s&&(a.name=e[0].name),2&s&&(a.disableClose=e[1]<=1),512&s&&(a.mapState=e[9]),16&s&&(a.stylesheet=e[4]),i.$set(a),(!o||1&s&&r!==(r=e[0].id))&&E(t,"id",r),(!o||3&s&&n!==(n=m("map-label-container "+(2===e[1]?`map-label-container-${e[0].index}`:""))+" svelte-14y9jxq"))&&E(t,"class",n),(!o||8&s)&&E(t,"style",e[3])},i(e){o||(le(i.$$.fragment,e),o=!0)},o(e){ce(i.$$.fragment,e),o=!1},d(e){e&&v(t),fe(i)}}}function Hh(e){let i,r,n,o,s,l=e[5],c=`${e[1]}-${e[0].index}`;function u(e,t){return e[0]?.branch?Qh:Nh}let h=u(e),d=h(e),p=jh(e),f=Vh(e);return{c(){i=b("div"),r=b("div"),d.c(),n=B(),p.c(),o=B(),f.c(),E(r,"class","screenshot-label-transparent svelte-14y9jxq"),E(i,"class","map-container svelte-14y9jxq")},m(e,t){y(e,i,t),_(i,r),d.m(r,null),_(i,n),p.m(i,null),_(i,o),f.m(i,null),s=!0},p(e,[n]){h===(h=u(e))&&d?d.p(e,n):(d.d(1),d=h(e),d&&(d.c(),d.m(r,null))),32&n&&a(l,l=e[5])?(se(),ce(p,1,1,t),ae(),p=jh(e),p.c(),le(p,1),p.m(i,o)):p.p(e,n),3&n&&a(c,c=`${e[1]}-${e[0].index}`)?(se(),ce(f,1,1,t),ae(),f=Vh(e),f.c(),le(f,1),f.m(i,null)):f.p(e,n)},i(e){s||(le(p),le(f),s=!0)},o(e){ce(p),ce(f),s=!1},d(e){e&&v(i),d.d(),p.d(e),f.d(e)}}}function Gh(e,t,r){let n,o,s,a;const c=["map","numberOfMaps","highlightDifferences","labelStyle"];let u,h,d,p=A(t,c);l(e,Le,(e=>r(15,u=e))),l(e,Ie,(e=>r(16,h=e))),l(e,Fe,(e=>r(13,d=e)));let{map:m}=t,{numberOfMaps:g}=t,{highlightDifferences:_=!1}=t,{labelStyle:y=""}=t;const v=H();let x,b={},w={};const T=e=>{switch(e){case"google":r(7,x=Uc);break;case"leaflet":r(7,x=$c);break;case"tangram":r(7,x=Wc);break;default:r(7,x=jc),r(8,b.mapRenderer=e,b)}};return e.$$set=e=>{t=i(i({},t),f(e)),r(21,p=A(t,c)),"map"in e&&r(0,m=e.map),"numberOfMaps"in e&&r(1,g=e.numberOfMaps),"highlightDifferences"in e&&r(2,_=e.highlightDifferences),"labelStyle"in e&&r(3,y=e.labelStyle)},e.$$.update=()=>{8193&e.$$.dirty&&(n=d?.[m.index]??{}),1&e.$$.dirty&&r(6,o=`${m.id}-${m.index}`),17&e.$$.dirty&&(Uh(w,m?.style)||r(4,w=m?.style)),1&e.$$.dirty&&r(5,s=m.renderer),82&e.$$.dirty&&((e,t)=>{const i={mapboxKey:h.mapboxGlAccessToken,maptilerKey:h.maptilerApiKey};r(8,b={id:e,mapStyle:{...m,url:Tu(m.url,i)},numberOfMaps:t}),T(s)})(o,g),32&e.$$.dirty&&T(s),r(9,a=(e=>{if(u)return e;const{bearing:t,center:i,pitch:r,zoom:o,...s}=e;let a={...s,...{bearing:t,center:i,pitch:r,zoom:o,...n}};return a=Dh(a,[m]),a})(p)),1&e.$$.dirty&&console.log(m)},[m,g,_,y,w,s,o,x,b,a,()=>{Ee.update((e=>e.filter(((e,t)=>t!==m.index)).map(((e,t)=>({...e,index:t}))))),u||Fe.update((e=>e.filter(((e,t)=>t!==m.index))))},e=>{if(u)v("mapMove",e.detail);else{const{options:t}=e.detail;Fe.update((e=>e.map(((e,i)=>i===m.index?t:e))))}},e=>{ke.update((t=>({...t,[m.index]:e})))},d]}class $h extends me{constructor(e){super(),Ae(this,e,Gh,Hh,a,{map:0,numberOfMaps:1,highlightDifferences:2,labelStyle:3})}}function Zh(e,t,i){const r=e.slice();return r[1]=t[i],r}function qh(e,t,i){const r=e.slice();return r[10]=t[i],r}function Kh(e){let t,r,n;const o=[{map:e[10]},e[0],{numberOfMaps:e[2]}];let s={};for(let e=0;ece(o[e],1,1,(()=>{o[e]=null}));return{c(){t=b("div");for(let e=0;ece(s[e],1,1,(()=>{s[e]=null}));return{c(){t=b("div"),i=b("div");for(let e=0;e{"maps"in e&&i(1,r=e.maps),"mapState"in e&&i(0,n=e.mapState)},e.$$.update=()=>{2&e.$$.dirty&&i(2,s=r.length),4&e.$$.dirty&&i(4,l=a.includes(s)?"row":"column"),2&e.$$.dirty&&(e=>{const t=Math.round(Math.sqrt(s)),r=Math.floor(s/t);let n=JSON.parse(JSON.stringify(e)),a=[];for(;n.length;)a.push(n.slice(0,r)),n=n.slice(r);i(3,o=a)})(r)},[n,r,s,o,l,function(t){G.call(this,e,t)}]}class Jh extends me{constructor(e){super(),Ae(this,e,Yh,Xh,a,{maps:1,mapState:0})}}function ed(e,t,i){const r=e.slice();return r[3]=t[i],r}function td(e){let t,r,n,o;const s=[{map:e[3]},e[1],{labelStyle:"position: absolute; margin-top: 48px; left: 0; right: 0; bottom: unset; max-width: unset;"},{numberOfMaps:e[0].length}];let a={};for(let e=0;ece(o[e],1,1,(()=>{o[e]=null}));return{c(){t=b("div"),i=b("div");for(let e=0;e{"maps"in e&&i(0,r=e.maps),"mapState"in e&&i(1,n=e.mapState)},[r,n,function(t){G.call(this,e,t)}]}class nd extends me{constructor(e){super(),Ae(this,e,rd,id,a,{maps:0,mapState:1})}}function od(e,t,i){const r=e.slice();return r[15]=t[i],r}function sd(e){let t,r,n,o;const s=[{map:e[15]},e[1],{numberOfMaps:e[0].length},{highlightDifferences:1===e[15].index&&e[1]?.showDiff},{labelStyle:0===e[15].index?e[7]:e[6]}];let a={};for(let e=0;ece(u[e],1,1,(()=>{u[e]=null}));return{c(){t=b("div");for(let e=0;ee[14].call(t))),O(t,"dragging",e[4])},m(o,c){y(o,t,c);for(let e=0;e{e.source===i.contentWindow&&t()}))):(i.src="about:blank",i.onload=()=>{n=S(i.contentWindow,"resize",t),t()}),_(e,i),()=>{(r||n&&i.contentWindow)&&n(),v(i)}}(t,e[14].bind(t)),s=!0,a||(l=[S(r,"mousedown",e[8]),S(t,"mousemove",e[10]),S(t,"mouseup",e[9])],a=!0)},p(e,[n]){if(239&n){let r;for(c=e[0],r=0;r{"maps"in e&&i(0,c=e.maps),"mapState"in e&&i(1,u=e.mapState)},e.$$.update=()=>{8&e.$$.dirty&&i(2,d=a/2),12&e.$$.dirty&&i(11,r=a-d),2056&e.$$.dirty&&i(12,n=a-r),4096&e.$$.dirty&&i(7,o=`right: unset; margin-right:unset; left:0; margin-left:1em; max-width:calc(${n}px - 6em)`),2048&e.$$.dirty&&i(6,s=`max-width:calc(${r}px - 6em)`)},[c,u,d,a,h,l,s,o,()=>i(4,h=!0),()=>i(4,h=!1),e=>{h&&0!==e.clientX&&i(2,d=e.clientX-ld/2)},r,n,function(t){G.call(this,e,t)},function(){l=this.clientHeight,a=this.clientWidth,i(5,l),i(3,a)}]}class ud extends me{constructor(e){super(),Ae(this,e,cd,ad,a,{maps:0,mapState:1})}}function hd(e){let t,r;const n=[{map:e[8]},e[6],{numberOfMaps:e[7]},{labelStyle:"position: fixed;"}];let o={};for(let e=0;e{Q=null})),ae()),(!O||3&t&&r!==(r=`height:${e[0]}px; width:${e[1]}px`))&&E(i,"style",r),4&t&&M(h.value)!==e[2]&&P(h,e[2]),8&t&&M(x.value)!==e[3]&&P(x,e[3]),(!O||12&t&&F!==(F=!e[3]||!e[2]))&&(I.disabled=F),(!O||3&t&&D!==(D="100%"===e[0]&&"100%"===e[1]))&&(z.disabled=D)},i(e){O||(le(Q),O=!0)},o(e){ce(Q),O=!1},d(e){e&&v(t),Q&&Q.d(),U=!1,o(N)}}}function pd(e,t,i){let r,n,{maps:o}=t,{mapState:s}=t;const a=H();let l=s.height||"100%",c=s.width||"100%",u=s.height||"",h=s.width||"",d=!1,p=!1,f=s;delete f.width,delete f.height;const A=()=>{i(0,l=u),i(1,c=h),a("mapSetDimensions",{options:{height:l,width:c}})};return e.$$set=e=>{"maps"in e&&i(12,o=e.maps),"mapState"in e&&i(13,s=e.mapState)},e.$$.update=()=>{if(4096&e.$$.dirty&&i(8,r=o[0]),4096&e.$$.dirty&&i(7,n=o?.length??0),8192&e.$$.dirty){let{width:e,height:t,...r}=s;i(6,f=r)}},[l,c,u,h,d,p,f,n,r,()=>{(d||p)&&!(!h||!u)&&A()},A,()=>{i(0,l="100%"),i(1,c="100%"),i(2,u=""),i(3,h=""),a("mapSetDimensions",{options:{height:null,width:null}})},o,s,function(t){G.call(this,e,t)},function(){u=M(this.value),i(2,u)},()=>i(4,d=!0),()=>i(4,d=!1),function(){h=M(this.value),i(3,h)},()=>i(5,p=!0),()=>i(5,p=!1)]}class fd extends me{constructor(e){super(),Ae(this,e,pd,dd,a,{maps:12,mapState:13})}}function Ad(e){let t,i,r;var n=e[2];function o(e){return{props:{maps:e[0],mapState:e[1]}}}return n&&(t=U(n,o(e)),t.$on("mapMove",e[3]),t.$on("mapSetDimensions",e[4])),{c(){t&&de(t.$$.fragment),i=C()},m(e,n){t&&pe(t,e,n),y(e,i,n),r=!0},p(e,[r]){const s={};if(1&r&&(s.maps=e[0]),2&r&&(s.mapState=e[1]),4&r&&n!==(n=e[2])){if(t){se();const e=t;ce(e.$$.fragment,1,0,(()=>{fe(e,1)})),ae()}n?(t=U(n,o(e)),t.$on("mapMove",e[3]),t.$on("mapSetDimensions",e[4]),de(t.$$.fragment),le(t.$$.fragment,1),pe(t,i.parentNode,i)):t=null}else n&&t.$set(s)},i(e){r||(t&&le(t.$$.fragment,e),r=!0)},o(e){t&&ce(t.$$.fragment,e),r=!1},d(e){e&&v(i),t&&fe(t,e)}}}function md(e,t,i){let r,n,{maps:o}=t,{mapState:s}=t,{viewMode:a}=t;const l=H();let c;const u=e=>{l("setDimensions",{...e.detail.options})};return e.$$set=e=>{"maps"in e&&i(0,o=e.maps),"mapState"in e&&i(1,s=e.mapState),"viewMode"in e&&i(5,a=e.viewMode)},e.$$.update=()=>{2&e.$$.dirty&&i(7,r=s.height),2&e.$$.dirty&&i(6,n=s.width),32&e.$$.dirty&&(e=>{switch(e){case"phone":i(2,c=nd);break;case"mirror":i(2,c=Jh);break;case"responsive":i(2,c=fd);break;default:i(2,c=ud)}})(a),224&e.$$.dirty&&"responsive"!==a&&(r||n)&&u({detail:{options:{height:null,width:null}}})},[o,s,c,e=>{l("mapState",{options:e.detail.options})},u,a,n,r]}class gd extends me{constructor(e){super(),Ae(this,e,md,Ad,a,{maps:0,mapState:1,viewMode:5})}}var _d={exports:{}}; + */const Xc={prefix:"fas",iconName:"compress",icon:[448,512,[],"f066","M160 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96zM32 320c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM352 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 320c-17.7 0-32 14.3-32 32l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0z"]},Yc={prefix:"fas",iconName:"camera",icon:[512,512,[62258,"camera-alt"],"f030","M149.1 64.8L138.7 96 64 96C28.7 96 0 124.7 0 160L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64l-74.7 0L362.9 64.8C356.4 45.2 338.1 32 317.4 32L194.6 32c-20.7 0-39 13.2-45.5 32.8zM256 192a96 96 0 1 1 0 192 96 96 0 1 1 0-192z"]},Jc={prefix:"fas",iconName:"link",icon:[640,512,[128279,"chain"],"f0c1","M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"]},eu={prefix:"fas",iconName:"plus",icon:[448,512,[10133,61543,"add"],"2b","M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 144L48 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0 0 144c0 17.7 14.3 32 32 32s32-14.3 32-32l0-144 144 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-144 0 0-144z"]},tu={prefix:"fas",iconName:"expand",icon:[448,512,[],"f065","M32 32C14.3 32 0 46.3 0 64l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 32zM64 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96z"]},iu={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"]},ru={prefix:"fas",iconName:"link-slash",icon:[640,512,["chain-broken","chain-slash","unlink"],"f127","M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L489.3 358.2l90.5-90.5c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114l-96 96-31.9-25C430.9 239.6 420.1 175.1 377 132c-52.2-52.3-134.5-56.2-191.3-11.7L38.8 5.1zM239 162c30.1-14.9 67.7-9.9 92.8 15.3c20 20 27.5 48.3 21.7 74.5L239 162zM406.6 416.4L220.9 270c-2.1 39.8 12.2 80.1 42.2 110c38.9 38.9 94.4 51 143.6 36.3zm-290-228.5L60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5l61.8-61.8-50.6-39.9z"]},nu=parseFloat;function ou(e,t=";"){let i;if(Array.isArray(e))i=e.filter((e=>e));else{i=[];for(const t in e)e[t]&&i.push(`${t}:${e[t]}`)}return i.join(t)}function su(e){let t,i,r,n,o,s,a;function l(e,t){return"string"==typeof e[7][4]?lu:au}let c=l(e),u=c(e);return{c(){t=w("svg"),i=w("g"),r=w("g"),u.c(),E(r,"transform",e[10]),E(i,"transform",n=`translate(${e[7][0]/2} ${e[7][1]/2})`),E(i,"transform-origin",o=e[7][0]/4+" 0"),E(t,"id",e[0]),E(t,"class",s=m(e[8])+" svelte-1cj2gr0"),E(t,"style",e[9]),E(t,"viewBox",a=`0 0 ${e[7][0]} ${e[7][1]}`),E(t,"aria-hidden","true"),E(t,"role","img"),E(t,"xmlns","http://www.w3.org/2000/svg")},m(e,n){y(e,t,n),_(t,i),_(i,r),u.m(r,null)},p(e,h){c===(c=l(e))&&u?u.p(e,h):(u.d(1),u=c(e),u&&(u.c(),u.m(r,null))),1024&h&&E(r,"transform",e[10]),128&h&&n!==(n=`translate(${e[7][0]/2} ${e[7][1]/2})`)&&E(i,"transform",n),128&h&&o!==(o=e[7][0]/4+" 0")&&E(i,"transform-origin",o),1&h&&E(t,"id",e[0]),256&h&&s!==(s=m(e[8])+" svelte-1cj2gr0")&&E(t,"class",s),512&h&&E(t,"style",e[9]),128&h&&a!==(a=`0 0 ${e[7][0]} ${e[7][1]}`)&&E(t,"viewBox",a)},d(e){e&&v(t),u.d()}}}function au(e){let t,i,r,n,o,s,a,l,c,u;return{c(){t=w("path"),s=w("path"),E(t,"d",i=e[7][4][0]),E(t,"fill",r=e[3]||e[1]||"currentColor"),E(t,"fill-opacity",n=0!=e[6]?e[4]:e[5]),E(t,"transform",o=`translate(${e[7][0]/-2} ${e[7][1]/-2})`),E(s,"d",a=e[7][4][1]),E(s,"fill",l=e[2]||e[1]||"currentColor"),E(s,"fill-opacity",c=0!=e[6]?e[5]:e[4]),E(s,"transform",u=`translate(${e[7][0]/-2} ${e[7][1]/-2})`)},m(e,i){y(e,t,i),y(e,s,i)},p(e,h){128&h&&i!==(i=e[7][4][0])&&E(t,"d",i),10&h&&r!==(r=e[3]||e[1]||"currentColor")&&E(t,"fill",r),112&h&&n!==(n=0!=e[6]?e[4]:e[5])&&E(t,"fill-opacity",n),128&h&&o!==(o=`translate(${e[7][0]/-2} ${e[7][1]/-2})`)&&E(t,"transform",o),128&h&&a!==(a=e[7][4][1])&&E(s,"d",a),6&h&&l!==(l=e[2]||e[1]||"currentColor")&&E(s,"fill",l),112&h&&c!==(c=0!=e[6]?e[5]:e[4])&&E(s,"fill-opacity",c),128&h&&u!==(u=`translate(${e[7][0]/-2} ${e[7][1]/-2})`)&&E(s,"transform",u)},d(e){e&&v(t),e&&v(s)}}}function lu(e){let t,i,r,n;return{c(){t=w("path"),E(t,"d",i=e[7][4]),E(t,"fill",r=e[1]||e[2]||"currentColor"),E(t,"transform",n=`translate(${e[7][0]/-2} ${e[7][1]/-2})`)},m(e,i){y(e,t,i)},p(e,o){128&o&&i!==(i=e[7][4])&&E(t,"d",i),6&o&&r!==(r=e[1]||e[2]||"currentColor")&&E(t,"fill",r),128&o&&n!==(n=`translate(${e[7][0]/-2} ${e[7][1]/-2})`)&&E(t,"transform",n)},d(e){e&&v(t)}}}function cu(e){let i,r=e[7][4]&&su(e);return{c(){r&&r.c(),i=C()},m(e,t){r&&r.m(e,t),y(e,i,t)},p(e,[t]){e[7][4]?r?r.p(e,t):(r=su(e),r.c(),r.m(i.parentNode,i)):r&&(r.d(1),r=null)},i:t,o:t,d(e){r&&r.d(e),e&&v(i)}}}function uu(e,t,i){let r,n,o,s,{class:a=""}=t,{id:l=""}=t,{style:c=""}=t,{icon:u}=t,{size:h=""}=t,{color:d=""}=t,{fw:p=!1}=t,{pull:f=""}=t,{scale:A=1}=t,{translateX:m=0}=t,{translateY:g=0}=t,{rotate:_=""}=t,{flip:y=!1}=t,{spin:v=!1}=t,{pulse:x=!1}=t,{primaryColor:b=""}=t,{secondaryColor:w=""}=t,{primaryOpacity:T=1}=t,{secondaryOpacity:B=.4}=t,{swapOpacity:C=!1}=t;return e.$$set=e=>{"class"in e&&i(11,a=e.class),"id"in e&&i(0,l=e.id),"style"in e&&i(12,c=e.style),"icon"in e&&i(13,u=e.icon),"size"in e&&i(14,h=e.size),"color"in e&&i(1,d=e.color),"fw"in e&&i(15,p=e.fw),"pull"in e&&i(16,f=e.pull),"scale"in e&&i(17,A=e.scale),"translateX"in e&&i(18,m=e.translateX),"translateY"in e&&i(19,g=e.translateY),"rotate"in e&&i(20,_=e.rotate),"flip"in e&&i(21,y=e.flip),"spin"in e&&i(22,v=e.spin),"pulse"in e&&i(23,x=e.pulse),"primaryColor"in e&&i(2,b=e.primaryColor),"secondaryColor"in e&&i(3,w=e.secondaryColor),"primaryOpacity"in e&&i(4,T=e.primaryOpacity),"secondaryOpacity"in e&&i(5,B=e.secondaryOpacity),"swapOpacity"in e&&i(6,C=e.swapOpacity)},e.$$.update=()=>{8192&e.$$.dirty&&i(7,r=u&&u.icon||[0,0,"",[],""]),12584960&e.$$.dirty&&i(8,n=ou([a,"svelte-fa",v&&"spin",x&&"pulse"]," ")),118784&e.$$.dirty&&i(9,o=function(e,t,i,r){let n,o,s,a,l,c="-.125em";return r&&(l="center",o="1.25em"),i&&(n=i),t&&("lg"==t?(a="1.33333em",s=".75em",c="-.225em"):a="xs"==t?".75em":"sm"==t?".875em":t.replace("x","em")),ou([ou({float:n,width:o,height:"1em","line-height":s,"font-size":a,"text-align":l,"vertical-align":c,"transform-origin":"center",overflow:"visible"}),e])}(c,h,f,p)),4063232&e.$$.dirty&&i(10,s=function(e,t,i,r,n,o=1,s="",a=""){let l=1,c=1;return n&&("horizontal"==n?l=-1:"vertical"==n?c=-1:l=c=-1),ou([`translate(${nu(t)*o}${s},${nu(i)*o}${s})`,`scale(${l*nu(e)},${c*nu(e)})`,r&&`rotate(${r}${a})`]," ")}(A,m,g,_,y,512))},[l,d,b,w,T,B,C,r,n,o,s,a,c,u,h,p,f,A,m,g,_,y,v,x]}var hu=class extends me{constructor(e){super(),Ae(this,e,uu,cu,a,{class:11,id:0,style:12,icon:13,size:14,color:1,fw:15,pull:16,scale:17,translateX:18,translateY:19,rotate:20,flip:21,spin:22,pulse:23,primaryColor:2,secondaryColor:3,primaryOpacity:4,secondaryOpacity:5,swapOpacity:6})}},du={exports:{}},pu=du.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var i=Math.log(Math.pow(2,e))/Math.log(t),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(t)*r;var n=i-Math.floor(i),o="";for(r=0;r=Math.pow(2,e)?pu(e,t):o};pu.rack=function(e,t,i){var r=function(r){var o=0;do{if(o++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var s=pu(e,t)}while(Object.hasOwnProperty.call(n,s));return n[s]=r,s},n=r.hats={};return r.get=function(e){return r.hats[e]},r.set=function(e,t){return r.hats[e]=t,r},r.bits=e||128,r.base=t||16,r};var fu=du.exports;const Au=(e,t,i)=>e.replace("{branch}",t).replace("{style}",i),mu=e=>{if("string"!=typeof e)return!1;return e.startsWith("mapbox://")},gu={name:"Mapbox GL JS",value:"mapbox-gl"},_u=[gu,{name:"Maplibre GL JS",value:"maplibre-gl"},{name:"MapTiler SDK",value:"maptiler-sdk"}],yu={google:[{name:"Google Maps",value:"google"}],leaflet:[{name:"Leaflet",value:"leaflet"}],tangram:[{name:"Tangram (Leaflet)",value:"tangram"}],"vector-gl":_u,"mapbox-gl":_u,"maplibre-gl":_u,"maptiler-sdk":_u},vu=(e,t)=>{let i=!1;return"mapbox-gl"!==e.type?yu[e.type]:(e.url&&mu(e.url)?i=!0:t&&(i=Object.values(t).some((e=>mu(e?.url)||(e?.tiles??[]).some((e=>mu(e)))))),i?[gu]:yu[e.type])},xu=(e,t)=>{let i;const r=()=>window.removeEventListener("keydown",i),n=()=>{r(),t&&(i=i=>{!!t.alt==i.altKey&&!!t.shift==i.shiftKey&&!!t.control==(i.ctrlKey||i.metaKey)&&t.code==i.code&&(i.preventDefault(),t.callback?t.callback():e.click())},window.addEventListener("keydown",i))};return n(),{update:n,destroy:r}},bu=e=>{if("string"!=typeof e)return!1;return e.startsWith("mapbox://")},wu=e=>{if(!e)return!1;let t;try{t=new URL(e)}catch(e){return!1}return"api.maptiler.com"===t.host&&!t.searchParams.has("key")},Tu=(e,t)=>{const{mapboxKey:i,maptilerKey:r}=t;let n=e;return bu(e)&&i?n=((e,t)=>{if(!bu(e))return e;if(!t)return e;const[,,,i,r]=e.split("/");return`https://api.mapbox.com/styles/v1/${i}/${r}?title=true&access_token=${t}`})(n,i):wu(e)&&r&&(n=((e,t)=>{if(!t)return e;let i=new URL(e);return t&&wu(e)&&i.searchParams.append("key",t),i.toString()})(n,r)),n};let Bu,Cu;Ie.subscribe((e=>({mapboxGlAccessToken:Bu,maptilerApiKey:Cu}=e)));function Su(e){let i,r,n,a,l,c,u,h,d,p,f,A=(e[2]??e[3])+"";return{c(){i=b("div"),r=b("div"),n=b("div"),l=B(),c=b("div"),u=b("div"),h=T(A),E(n,"class",a=m(e[1]?`caret-${e[4]}`:"caret-right")+" svelte-1q5ddxk"),E(r,"class","caret-container svelte-1q5ddxk"),E(u,"class","label svelte-1q5ddxk"),E(c,"class","label-container svelte-1q5ddxk"),E(i,"class",d=m(`toggle ${e[1]&&("up"===e[4]?"active-toggle-top":"active-toggle-bottom")}`)+" svelte-1q5ddxk")},m(t,o){y(t,i,o),_(i,r),_(r,n),_(i,l),_(i,c),_(c,u),_(u,h),p||(f=[S(i,"click",(function(){s(e[0])&&e[0].apply(this,arguments)})),S(i,"keydown",e[5])],p=!0)},p(t,[r]){e=t,18&r&&a!==(a=m(e[1]?`caret-${e[4]}`:"caret-right")+" svelte-1q5ddxk")&&E(n,"class",a),12&r&&A!==(A=(e[2]??e[3])+"")&&I(h,A),18&r&&d!==(d=m(`toggle ${e[1]&&("up"===e[4]?"active-toggle-top":"active-toggle-bottom")}`)+" svelte-1q5ddxk")&&E(i,"class",d)},i:t,o:t,d(e){e&&v(i),p=!1,o(f)}}}function Eu(e,t,i){let{openTopLevel:r}=t,{topLevelOpen:n}=t,{activeLabel:o}=t,{placeholder:s}=t,{direction:a}=t;return e.$$set=e=>{"openTopLevel"in e&&i(0,r=e.openTopLevel),"topLevelOpen"in e&&i(1,n=e.topLevelOpen),"activeLabel"in e&&i(2,o=e.activeLabel),"placeholder"in e&&i(3,s=e.placeholder),"direction"in e&&i(4,a=e.direction)},[r,n,o,s,a,()=>!1]}class Mu extends me{constructor(e){super(),Ae(this,e,Eu,Su,a,{openTopLevel:0,topLevelOpen:1,activeLabel:2,placeholder:3,direction:4})}}function Iu(e,t,i){const r=e.slice();return r[16]=t[i],r}function Pu(e,t,i){const r=e.slice();return r[19]=t[i],r}function Lu(e){let t,i;return t=new Mu({props:{openTopLevel:e[7],topLevelOpen:e[4],activeLabel:e[6],direction:e[1],placeholder:e[2]}}),{c(){de(t.$$.fragment)},m(e,r){pe(t,e,r),i=!0},p(e,i){const r={};16&i&&(r.topLevelOpen=e[4]),64&i&&(r.activeLabel=e[6]),2&i&&(r.direction=e[1]),4&i&&(r.placeholder=e[2]),t.$set(r)},i(e){i||(le(t.$$.fragment,e),i=!0)},o(e){ce(t.$$.fragment,e),i=!1},d(e){fe(t,e)}}}function Fu(e){let t,i,r=e[3],n=[];for(let t=0;t{o=null})),ae()),e[4]?s?s.p(e,n):(s=Fu(e),s.c(),s.m(t,r)):s&&(s.d(1),s=null),"up"===e[1]?a?(a.p(e,n),2&n&&le(a,1)):(a=Nu(e),a.c(),le(a,1),a.m(t,null)):a&&(se(),ce(a,1,1,(()=>{a=null})),ae())},i(e){n||(le(o),le(a),n=!0)},o(e){ce(o),ce(a),n=!1},d(e){e&&v(t),o&&o.d(),s&&s.d(),a&&a.d()}}}function ju(e,t,i){let r,n,{options:o}=t,{activeValue:s}=t,{onSelect:a}=t,{direction:l="up"}=t,{placeholder:c=""}=t,u=!1,h=null;const d=e=>{i(5,h=h===e?null:e)},p=e=>{a(e),i(4,u=!1),i(5,h=null)};return e.$$set=e=>{"options"in e&&i(11,o=e.options),"activeValue"in e&&i(0,s=e.activeValue),"onSelect"in e&&i(12,a=e.onSelect),"direction"in e&&i(1,l=e.direction),"placeholder"in e&&i(2,c=e.placeholder)},e.$$.update=()=>{2048&e.$$.dirty&&i(3,r=o.map(((e,t)=>{let i={...e,id:`${t}`};return i.options&&(i.options=i.options.map(((e,i)=>({...e,id:`${t}-${i}`})))),i}))),9&e.$$.dirty&&i(6,n=r.filter((e=>!e?.header)).map((e=>e?.options?e?.options:e)).flat().find((e=>e.value===s))?.label)},[s,l,c,r,u,h,n,()=>{if(i(4,u=!u),u){const e=r.filter((e=>e.options)).find((e=>e.options.some((e=>e.value===s))));e&&i(5,h=e.id)}else i(5,h=null)},d,()=>!1,p,o,a,e=>d(e.id),e=>p(e.value),e=>p(e.value)]}class Vu extends me{constructor(e){super(),Ae(this,e,ju,Qu,a,{options:11,activeValue:0,onSelect:12,direction:1,placeholder:2})}}function Hu(e){let t,i,r,n;return i=new Vu({props:{options:e[4],activeValue:e[0].dropdownId,onSelect:e[1],direction:e[3]}}),{c(){t=b("div"),de(i.$$.fragment),E(t,"id",r=`styles-dropdown-${e[2]}`)},m(e,r){y(e,t,r),pe(i,t,null),n=!0},p(e,[o]){const s={};16&o&&(s.options=e[4]),1&o&&(s.activeValue=e[0].dropdownId),2&o&&(s.onSelect=e[1]),8&o&&(s.direction=e[3]),i.$set(s),(!n||4&o&&r!==(r=`styles-dropdown-${e[2]}`))&&E(t,"id",r)},i(e){n||(le(i.$$.fragment,e),n=!0)},o(e){ce(i.$$.fragment,e),n=!1},d(e){e&&v(t),fe(i)}}}function Gu(e,t,i){let r,{dropdownDisplayOptions:n}=t,{dropdownValue:o}=t,{onSelect:s}=t,{index:a}=t,l="up";return j((()=>{const e=document?.body?.clientHeight,t=document?.getElementById(`styles-dropdown-${a}`),r=t?.getBoundingClientRect(),n=r?.top;n&&e&&i(3,l=n{"dropdownDisplayOptions"in e&&i(5,n=e.dropdownDisplayOptions),"dropdownValue"in e&&i(0,o=e.dropdownValue),"onSelect"in e&&i(1,s=e.onSelect),"index"in e&&i(2,a=e.index)},e.$$.update=()=>{32&e.$$.dirty&&i(4,r=Object.entries(n).reduce(((e,[t,i])=>{e.push({header:t});for(const t of i)"sublist"===t.type?e.push({label:t.text,options:t.presets.map((e=>({label:e.text,value:e.dropdownId})))}):e.push({label:t.text,value:t.dropdownId});return e}),[]))},[o,s,a,l,r,n]}class $u extends me{constructor(e){super(),Ae(this,e,Gu,Hu,a,{dropdownDisplayOptions:5,dropdownValue:0,onSelect:1,index:2})}}function Zu(e){let t,i,r,n,s,a,l,c,u;return{c(){t=b("div"),i=b("input"),n=B(),s=b("button"),a=T("Submit"),E(i,"placeholder",r="branch"===e[6].dropdownType?"enter a branch name":"enter a url to a style"),E(i,"class","svelte-1fo36py"),O(i,"input-error",e[7]),s.disabled=l=e[6]?.url===e[5],E(t,"class","custom-input svelte-1fo36py")},m(r,o){y(r,t,o),_(t,i),P(i,e[5]),_(t,n),_(t,s),_(s,a),c||(u=[S(i,"input",e[15]),S(i,"focus",e[11]),S(i,"blur",e[12]),g(xu.call(null,s,{code:"Enter",callback:e[10]})),S(s,"click",e[9])],c=!0)},p(e,t){64&t&&r!==(r="branch"===e[6].dropdownType?"enter a branch name":"enter a url to a style")&&E(i,"placeholder",r),32&t&&i.value!==e[5]&&P(i,e[5]),128&t&&O(i,"input-error",e[7]),96&t&&l!==(l=e[6]?.url===e[5])&&(s.disabled=l)},d(e){e&&v(t),c=!1,o(u)}}}function qu(e){let t,i;return{c(){t=b("div"),i=T(e[7]),E(t,"class","error-message svelte-1fo36py")},m(e,r){y(e,t,r),_(t,i)},p(e,t){128&t&&I(i,e[7])},d(e){e&&v(t)}}}function Ku(e){let t,i,r,n,o,s,a,l,c,u;i=new $u({props:{dropdownDisplayOptions:e[0],dropdownValue:e[1],index:e[4],onSelect:e[14]}});let h=("custom"===e[6]?.dropdownType||"branch"===e[6]?.dropdownType)&&Zu(e),d=!!e[7]&&qu(e);return c=new Vu({props:{options:e[2].map(Wu),activeValue:e[3],onSelect:e[16],direction:"up"}}),{c(){t=b("div"),de(i.$$.fragment),r=B(),h&&h.c(),n=B(),d&&d.c(),o=B(),s=b("div"),a=b("span"),a.textContent="Rendered with",l=B(),de(c.$$.fragment),E(a,"class","nowrap svelte-1fo36py"),E(s,"class","renderer-control svelte-1fo36py"),E(t,"class","map-style-input svelte-1fo36py")},m(e,p){y(e,t,p),pe(i,t,null),_(t,r),h&&h.m(t,null),_(t,n),d&&d.m(t,null),_(t,o),_(t,s),_(s,a),_(s,l),pe(c,s,null),u=!0},p(e,[r]){const s={};1&r&&(s.dropdownDisplayOptions=e[0]),2&r&&(s.dropdownValue=e[1]),16&r&&(s.index=e[4]),i.$set(s),"custom"===e[6]?.dropdownType||"branch"===e[6]?.dropdownType?h?h.p(e,r):(h=Zu(e),h.c(),h.m(t,n)):h&&(h.d(1),h=null),e[7]?d?d.p(e,r):(d=qu(e),d.c(),d.m(t,o)):d&&(d.d(1),d=null);const a={};4&r&&(a.options=e[2].map(Wu)),8&r&&(a.activeValue=e[3]),c.$set(a)},i(e){u||(le(i.$$.fragment,e),le(c.$$.fragment,e),u=!0)},o(e){ce(i.$$.fragment,e),ce(c.$$.fragment,e),u=!1},d(e){e&&v(t),fe(i),h&&h.d(),d&&d.d(),fe(c)}}}const Wu=e=>({label:e.name,value:e.value});function Xu(e,t,i){const r=H();let n,o,{dropdownDisplayOptions:s}=t,{dropdownValue:a}=t,{rendererOptions:l}=t,{rendererValue:c}=t,{activeUrl:u}=t,{index:h}=t,d=!1,p=null,f=!0;V((()=>{f=!1})),j((()=>{i(6,n=a),i(5,o=n.defaultText),A(n.url)}));const A=e=>{const t=e=>{if(!f||!e||u!==e)return!1;const t=new RegExp("^(?:[a-z+]+:)?//","i");return e.includes("localhost")||!t.test(e)};t(e)&&setTimeout((()=>t(e)&&g(e,!0)),3e3)},m=e=>{const t=["dropdownType","selected","defaultText"];let i={...Object.fromEntries(Object.entries(e).filter((([e,i])=>!t.includes(e))))};"branch"===n.dropdownType&&(i.branch=o),e&&(i.id=e.id??e?.style?.id,i.name=e.name??e?.style?.name),r("updateMapStore",{value:i})},g=async(e,t=!1)=>{let o;try{const i=await(async e=>{const t=bu(e);let i,r=e;try{r=new URL(e);const t={mapboxKey:Bu,maptilerKey:Cu};r=Tu(r.toString(),t)}catch(e){}try{i=await fetch(r)}catch(e){throw{message:e.message}}if(!i.ok)throw{status:i.status,message:i.statusText};const n=await i.json();if(t&&n.message)throw{message:n.message};return n})(e);if(i&&"object"==typeof i)return o=i,A(e),t?r("updateMapStore",{value:{style:o,isPolling:t}}):m({...n,style:o,url:e,isPolling:t}),{status:"200"}}catch(e){const{status:t,message:r}=e;return i(7,p=new Error(r)),{status:t}}},_=async e=>{const{status:t}=await g(e);"200"===t&&(i(6,n.url=e,n),A(e)),r("setUrl",{value:e})},y=async()=>{const{dropdownType:e,pattern:t}=n;let i="branch"===e?Au(t,o,n.id):o;if(n?.url!==i){if(i.includes("localhost")){const[e,t]=i.split("localhost");e||(i=`http://localhost${t}`)}_(i)}};return e.$$set=e=>{"dropdownDisplayOptions"in e&&i(0,s=e.dropdownDisplayOptions),"dropdownValue"in e&&i(1,a=e.dropdownValue),"rendererOptions"in e&&i(2,l=e.rendererOptions),"rendererValue"in e&&i(3,c=e.rendererValue),"activeUrl"in e&&i(13,u=e.activeUrl),"index"in e&&i(4,h=e.index)},e.$$.update=()=>{32&e.$$.dirty&&(e=>{p&&void 0!==e&&i(7,p=null)})(o),2&e.$$.dirty&&(()=>{const e=Object.entries(a).every((e=>{const[t,i]=e;return"url"===t||!(!n||n[t]!==i)||void 0}));if(e)return;const t=n?.dropdownType;i(6,n=a),i(7,p=null);const{dropdownType:r}=n;switch(r){case"preset":{const{type:e,url:t}=n;if(["google","leaflet"].includes(e)){m(n);break}_(t);break}case"branch":o&&"branch"===t&&y()}i(5,o=n.defaultText)})()},[s,a,l,c,h,o,n,p,r,y,()=>{d&&y()},()=>{d=!0},()=>{d=!1,p&&i(5,o=n.defaultText)},u,e=>r("selectOption",{dropdownId:e}),function(){o=this.value,i(5,o)},e=>r("selectRenderer",{value:e})]}class Yu extends me{constructor(e){super(),Ae(this,e,Xu,Ku,a,{dropdownDisplayOptions:0,dropdownValue:1,rendererOptions:2,rendererValue:3,activeUrl:13,index:4})}}function Ju(e,t,i){const r=e.slice();return r[16]=t[i],r[18]=i,r}function eh(e,t,i){const r=e.slice();return r[19]=t[i],r[21]=i,r}function th(e,t,i){const r=e.slice();return r[22]=t[i],r[18]=i,r}function ih(e,t,i){const r=e.slice();return r[24]=t[i],r[21]=i,r}function rh(e){let t,i,r,n=e[0],o=e[4].length&&nh(),s=e[2].length&&oh(e),l=dh(e);return{c(){o&&o.c(),t=B(),i=b("div"),s&&s.c(),r=B(),l.c(),E(i,"class","controls svelte-1cgcqsn")},m(e,n){o&&o.m(e,n),y(e,t,n),y(e,i,n),s&&s.m(i,null),_(i,r),l.m(i,null)},p(e,c){e[4].length?o||(o=nh(),o.c(),o.m(t.parentNode,t)):o&&(o.d(1),o=null),e[2].length?s?s.p(e,c):(s=oh(e),s.c(),s.m(i,r)):s&&(s.d(1),s=null),1&c&&a(n,n=e[0])?(l.d(1),l=dh(e),l.c(),l.m(i,null)):l.p(e,c)},d(e){o&&o.d(e),e&&v(t),e&&v(i),s&&s.d(),l.d(e)}}}function nh(e){let t;return{c(){t=b("div"),t.textContent="Custom actions:",E(t,"class","action-dropdown svelte-1cgcqsn")},m(e,i){y(e,t,i)},d(e){e&&v(t)}}}function oh(e){let t,i,r,n=e[2],s=[];for(let t=0;te[12].call(t)))},m(n,o){y(n,t,o);for(let e=0;ei(14,s=e)));let a,{mapId:c}=t,{mapIdIndex:u}=t,h=!1;ke.subscribe((e=>{const t=u.split("-").pop();i(1,a=e?.[t])}));const{customJs:d=[]}=s;let p=null,f=null;const A=(e,t)=>{const r=p?.[t];if(u.split("-").pop(),!a||!e)return;e(a)(r,(e=>i(11,p[t]=e,p)))};return e.$$set=e=>{"mapId"in e&&i(0,c=e.mapId),"mapIdIndex"in e&&i(10,u=e.mapIdIndex)},e.$$.update=()=>{if(1&e.$$.dirty&&i(4,r=d.filter((e=>e.mapIds.includes(c)))),16&e.$$.dirty&&i(2,n=r.filter((e=>"dropdown"===e.type))),16&e.$$.dirty&&i(3,o=r.filter((e=>"checkbox"===e.type))),1&e.$$.dirty&&c&&i(11,p=null),2056&e.$$.dirty&&o&&!p&&i(11,p=o.reduce(((e,t,i)=>(e[i]=t?.state,e)),{})),4&e.$$.dirty&&(n.length||i(6,f=null)),2&e.$$.dirty&&a){a.isStyleLoaded?.()??!0?i(5,h=!0):a.on("style.load",(()=>{i(5,h=!0)}))}},[c,a,n,o,r,h,f,e=>{const{dropdown:t,option:i}=JSON.parse(e.target.value),r=n?.[t]?.options?.[i];if(!a||!r)return;const{script:o}=r;o(a)()},A,e=>{if("boolean"==typeof e)return e;if(!a||!e)return;return e(a)()},u,p,function(){f=function(e){const t=e.querySelector(":checked");return t&&t.__value}(this),i(6,f),i(2,n),i(4,r),i(0,c)},(e,t)=>A(e?.script,t)]}class Ah extends me{constructor(e){super(),Ae(this,e,fh,ph,a,{mapId:0,mapIdIndex:10})}}function mh(e){let t,i;return t=new Yu({props:{dropdownValue:e[6],dropdownDisplayOptions:e[4],rendererOptions:e[7],rendererValue:e[2],index:e[0],activeUrl:e[3]}}),t.$on("setUrl",e[9]),t.$on("selectOption",e[10]),t.$on("selectRenderer",e[11]),t.$on("updateMapStore",e[12]),{c(){de(t.$$.fragment)},m(e,r){pe(t,e,r),i=!0},p(e,i){const r={};64&i&&(r.dropdownValue=e[6]),16&i&&(r.dropdownDisplayOptions=e[4]),128&i&&(r.rendererOptions=e[7]),4&i&&(r.rendererValue=e[2]),1&i&&(r.index=e[0]),8&i&&(r.activeUrl=e[3]),t.$set(r)},i(e){i||(le(t.$$.fragment,e),i=!0)},o(e){ce(t.$$.fragment,e),i=!1},d(e){fe(t,e)}}}function gh(e){let t,i,r,n,o=e[5]&&mh(e);return r=new Ah({props:{mapId:e[8],mapIdIndex:e[1]}}),{c(){t=b("div"),o&&o.c(),i=B(),de(r.$$.fragment),E(t,"class","map-style-input-wrapper svelte-7abtsv")},m(e,s){y(e,t,s),o&&o.m(t,null),_(t,i),pe(r,t,null),n=!0},p(e,[n]){e[5]?o?(o.p(e,n),32&n&&le(o,1)):(o=mh(e),o.c(),le(o,1),o.m(t,i)):o&&(se(),ce(o,1,1,(()=>{o=null})),ae());const s={};256&n&&(s.mapId=e[8]),2&n&&(s.mapIdIndex=e[1]),r.$set(s)},i(e){n||(le(o),le(r.$$.fragment,e),n=!0)},o(e){ce(o),ce(r.$$.fragment,e),n=!1},d(e){e&&v(t),o&&o.d(),fe(r)}}}function _h(e,t,i){let r,n,o,s,a,l,{index:c}=t,{stylesheet:u}=t,{mapIdIndex:h}=t;Ie.subscribe((e=>({branchPatterns:r}=e)));let d=[];Ee.subscribe((e=>{i(14,n=e.find((e=>e.index===c))),n&&(o=n.branch,s=n.renderer,a=n.type,i(3,l=n.url))}));let p,f,A={},m=[],g=[];const _=()=>{let e;for(const t of m)if(t?.selected&&(e=t),"sublist"===t?.type)for(const i of t?.presets)i?.selected&&(e=i);if(e){switch(e=JSON.parse(JSON.stringify(e)),e.dropdownType){case"preset":e={...e,defaultText:""};break;case"branch":e={...e,defaultText:o??""};break;case"custom":e={...e,defaultText:l,url:l}}i(6,p=e)}},y=()=>{i(7,g=vu(p,u?.sources)),v()},v=()=>{let e=s;const t=vu(p,u?.sources).map((e=>e.value));e&&t.includes(e)||(e=t.includes(p.type)?p.type:t[0]),i(2,f=e)},x=()=>{(()=>{if(i(4,A={}),i(5,m=[]),d.length){const e=d.map((e=>({...e,dropdownType:"preset",selected:l===e?.url&&a===e?.type,dropdownId:fu(),..."sublist"===e.type&&{presets:e.presets.map((e=>({...e,dropdownType:"preset",selected:l===e?.url&&a===e?.type,dropdownId:fu()})))}})));i(5,m=m.concat(e)),i(4,A.Presets=e.map((e=>({text:e.name,..."sublist"!==e.type&&{dropdownId:e.dropdownId},..."sublist"===e.type&&{type:"sublist",presets:e.presets.map((e=>({text:e.name,dropdownId:e.dropdownId})))}}))),A)}if(r){let e=[];for(const t of r){let r={name:t.name??t.id,type:"sublist",dropdownId:fu(),presets:[]};if(t?.styles?.length){const e=t?.styles.map((e=>({screenshotName:`${t.name??t.id}: ${e} on`,name:`${t.name??t.id}: ${e} on...`,branchId:t?.id,id:e,branchStyle:e,type:t.type,dropdownType:"branch",selected:!(!o||Au(t.pattern,o,e)!==l||t.type!==a),pattern:t.pattern,dropdownId:fu()})));r.presets=r.presets.concat(e)}e.push(r),i(5,m=m.concat(e)),i(4,A["Styles on a branch"]=e.map((e=>({text:e.name,..."sublist"!==e.type&&{dropdownId:e.dropdownId},..."sublist"===e.type&&{type:"sublist",presets:e.presets.map((e=>({text:e.name,dropdownId:e.dropdownId})))}}))),A)}}const e=[{name:"Fetch URL at...",dropdownType:"custom",selected:!m.some((e=>!!e?.selected||e?.presets?.some((e=>!!e.selected)))),type:"mapbox-gl",renderer:"mapbox-gl",dropdownId:fu()}];i(5,m=m.concat(e)),i(4,A.Custom=e.map((e=>({text:e.name,dropdownId:e.dropdownId}))),A)})(),_()};Me.subscribe((e=>{d=e,x(),y()}));let b;return e.$$set=e=>{"index"in e&&i(0,c=e.index),"stylesheet"in e&&i(13,u=e.stylesheet),"mapIdIndex"in e&&i(1,h=e.mapIdIndex)},e.$$.update=()=>{var t;16384&e.$$.dirty&&(!(t=n)||"branch"===p?.dropdownType&&!p?.url&&n.isPolling||t.type===p.type&&t.url===p.url||x()),4&e.$$.dirty&&(e=>{Ee.update((t=>t.map(((t,i)=>i!==c?t:{...t,renderer:e}))))})(f),16384&e.$$.dirty&&n&&i(8,b=n?.branchId??n?.id??null)},[c,h,f,l,A,m,p,g,b,e=>{i(6,p.url=e.detail.value,p),y()},e=>{const{dropdownId:t}=e.detail;i(5,m=m.reduce(((e,i)=>{let r=i;return"sublist"===r?.type?r.presets=r.presets.map((e=>({...e,selected:e.dropdownId===t}))):r={...r,selected:i.dropdownId===t},e.push(r),e}),[])),_(),y()},e=>{i(2,f=e.detail.value)},e=>{const{value:t}=e.detail;if(t.isPolling)Ee.update((e=>e.map(((e,i)=>i===c?{...e,...t}:e))));else{const e={...t,index:c,renderer:s};delete e.dropdownId,Ee.update((t=>t.map(((t,i)=>i===c?e:t))))}},u,n]}class yh extends me{constructor(e){super(),Ae(this,e,_h,gh,a,{index:0,stylesheet:13,mapIdIndex:1})}}function vh(e){let t,i,r,n;const o=e[1].default,s=c(o,e,e[0],null);return{c(){t=b("button"),s&&s.c(),E(t,"class","svelte-d9bm20")},m(o,a){y(o,t,a),s&&s.m(t,null),i=!0,r||(n=S(t,"click",e[2]),r=!0)},p(e,[t]){s&&s.p&&(!i||1&t)&&d(s,o,e,e[0],i?h(o,e[0],t,null):p(e[0]),null)},i(e){i||(le(s,e),i=!0)},o(e){ce(s,e),i=!1},d(e){e&&v(t),s&&s.d(e),r=!1,n()}}}function xh(e,t,i){let{$$slots:r={},$$scope:n}=t;return e.$$set=e=>{"$$scope"in e&&i(0,n=e.$$scope)},[n,r,function(t){G.call(this,e,t)}]}class bh extends me{constructor(e){super(),Ae(this,e,xh,vh,a,{})}}function wh(e){let t,i,r,n,o,s,a,l,c,u,h,d,p;return a=new bh({props:{$$slots:{default:[Bh]},$$scope:{ctx:e}}}),a.$on("click",e[6]),u=new bh({props:{$$slots:{default:[Ch]},$$scope:{ctx:e}}}),u.$on("click",e[5]),{c(){t=b("div"),i=b("div"),r=T(e[2]),n=B(),o=b("div"),s=b("div"),de(a.$$.fragment),l=B(),c=b("div"),de(u.$$.fragment),E(i,"class","map-state svelte-1nshzal"),E(s,"class","svelte-1nshzal"),E(c,"class","svelte-1nshzal"),E(o,"class","location-actions svelte-1nshzal"),E(t,"class","map-state-container svelte-1nshzal")},m(f,A){y(f,t,A),_(t,i),_(i,r),_(t,n),_(t,o),_(o,s),pe(a,s,null),_(o,l),_(o,c),pe(u,c,null),h=!0,d||(p=S(i,"click",e[5]),d=!0)},p(e,t){(!h||4&t)&&I(r,e[2]);const i={};2097152&t&&(i.$$scope={dirty:t,ctx:e}),a.$set(i);const n={};2097153&t&&(n.$$scope={dirty:t,ctx:e}),u.$set(n)},i(e){h||(le(a.$$.fragment,e),le(u.$$.fragment,e),h=!0)},o(e){ce(a.$$.fragment,e),ce(u.$$.fragment,e),h=!1},d(e){e&&v(t),fe(a),fe(u),d=!1,p()}}}function Th(e){let i,r,n,s,a;return{c(){i=b("div"),r=b("input"),n=b("label"),n.textContent="enter zoom/lat/lng[/pitch/bearing]",F(r,"height","18px"),E(r,"type","text"),E(n,"class","input-label svelte-1nshzal"),E(i,"class","state-record svelte-1nshzal")},m(t,o){y(t,i,o),_(i,r),P(r,e[3]),e[17](r),_(i,n),s||(a=[S(r,"input",e[15]),S(r,"keydown",e[16]),S(r,"focus",Eh)],s=!0)},p(e,t){8&t&&r.value!==e[3]&&P(r,e[3])},i:t,o:t,d(t){t&&v(i),e[17](null),s=!1,o(a)}}}function Bh(e){let t;return{c(){t=T("change")},m(e,i){y(e,t,i)},d(e){e&&v(t)}}}function Ch(e){let t,i=e[0]?"copied":"copy";return{c(){t=T(i)},m(e,i){y(e,t,i)},p(e,r){1&r&&i!==(i=e[0]?"copied":"copy")&&I(t,i)},d(e){e&&v(t)}}}function Sh(e){let t,i,r,n;const o=[Th,wh],s=[];function a(e,t){return e[1]?0:1}return i=a(e),r=s[i]=o[i](e),{c(){t=b("div"),r.c()},m(e,r){y(e,t,r),s[i].m(t,null),n=!0},p(e,[n]){let l=i;i=a(e),i===l?s[i].p(e,n):(se(),ce(s[l],1,1,(()=>{s[l]=null})),ae(),r=s[i],r?r.p(e,n):(r=s[i]=o[i](e),r.c()),le(r,1),r.m(t,null))},i(e){n||(le(r),n=!0)},o(e){ce(r),n=!1},d(e){e&&v(t),s[i].d()}}}const Eh=e=>e.target.select();function Mh(e,t,i){let r,n,{bearing:o}=t,{center:s}=t,{pitch:a}=t,{zoom:l}=t;const c=H();let u,h=!1,d=!1,p="",f="";const A=()=>{i(1,d=!1)},m=()=>{i(1,d=!1),i(0,h=!1);const[e,t,r,n,o]=f.split("/"),s=(({zoom:e,lat:t,lng:i,pitch:r,bearing:n})=>{let o=!0;return[e,t,i,r,n].filter(Boolean).every((e=>!isNaN(Number(e))))||(o=!1),(+e<0||+e>24)&&(o=!1),(+t<-90||+t>90)&&(o=!1),(+i<-180||+i>180)&&(o=!1),void 0!==r&&(+r<0||+r>85)&&(o=!1),void 0!==n&&isNaN(+n)&&(o=!1),o})({zoom:e,lat:t,lng:r,pitch:n,bearing:o});if(!s)return;const a={mapStateUpdateOrigin:"controls"};void 0!==e&&(a.zoom=+e),void 0!==t&&void 0!==r&&(a.center={lng:+r,lat:+t}),void 0!==n&&(a.pitch=+n),void 0!==o&&(a.bearing=+o),c("mapState",{options:a})};return e.$$set=e=>{"bearing"in e&&i(9,o=e.bearing),"center"in e&&i(10,s=e.center),"pitch"in e&&i(11,a=e.pitch),"zoom"in e&&i(12,l=e.zoom)},e.$$.update=()=>{1024&e.$$.dirty&&i(14,r=s.lat),1024&e.$$.dirty&&i(13,n=s.lng),31232&e.$$.dirty&&((e,t,r,n,o)=>{let s=[Re(r,2),Re(e,5),Re(t,5)];(n||o)&&(s.push(Re(n,1)),s.push(Re(o,1))),i(2,p=s.join("/")),i(0,h=!1)})(r,n,l,a,o)},[h,d,p,f,u,()=>{i(0,h=!0),navigator.clipboard.writeText(p)},async()=>{i(1,d=!0),i(3,f=p),await(Y(),W),u.focus()},A,m,o,s,a,l,n,r,function(){f=this.value,i(3,f)},e=>{"Enter"===e.key&&m(),"Escape"===e.key&&A()},function(e){Z[e?"unshift":"push"]((()=>{u=e,i(4,u)}))}]}class Ih extends me{constructor(e){super(),Ae(this,e,Mh,Sh,a,{bearing:9,center:10,pitch:11,zoom:12})}}function Ph(e){let t,i,r,n,o,a,l,c,u,h,d,p,f,A=!e[8]&&Object.keys(e[6]).length;r=new hu({props:{icon:iu}}),u=new yh({props:{index:e[0],stylesheet:e[4],mapIdIndex:e[5]}});let m=A&&Lh(e);return{c(){t=b("div"),i=b("button"),de(r.$$.fragment),n=B(),o=b("div"),a=T(e[1]),l=B(),c=b("div"),de(u.$$.fragment),h=B(),m&&m.c(),E(i,"class","close-button svelte-1mnw17n"),i.disabled=e[3],E(o,"class","map-name svelte-1mnw17n"),E(c,"class","options-container svelte-1mnw17n"),E(t,"class","map-label svelte-1mnw17n")},m(A,g){y(A,t,g),_(t,i),pe(r,i,null),_(t,n),_(t,o),_(o,a),_(t,l),_(t,c),pe(u,c,null),_(c,h),m&&m.m(c,null),d=!0,p||(f=S(i,"click",(function(){s(e[2])&&e[2].apply(this,arguments)})),p=!0)},p(t,r){e=t,(!d||8&r)&&(i.disabled=e[3]),(!d||2&r)&&I(a,e[1]);const n={};1&r&&(n.index=e[0]),16&r&&(n.stylesheet=e[4]),32&r&&(n.mapIdIndex=e[5]),u.$set(n),320&r&&(A=!e[8]&&Object.keys(e[6]).length),A?m?(m.p(e,r),320&r&&le(m,1)):(m=Lh(e),m.c(),le(m,1),m.m(c,null)):m&&(se(),ce(m,1,1,(()=>{m=null})),ae())},i(e){d||(le(r.$$.fragment,e),le(u.$$.fragment,e),le(m),d=!0)},o(e){ce(r.$$.fragment,e),ce(u.$$.fragment,e),ce(m),d=!1},d(e){e&&v(t),fe(r),fe(u),m&&m.d(),p=!1,f()}}}function Lh(e){let t,r,n;const o=[e[6]];let s={};for(let e=0;e{r=null})),ae())},i(e){i||(le(r),i=!0)},o(e){ce(r),i=!1},d(e){r&&r.d(e),e&&v(t)}}}function kh(e,t,i){let r,n,o,s;l(e,Pe,(e=>i(7,o=e))),l(e,Le,(e=>i(8,s=e)));let a,{index:c}=t,{name:u}=t,{onClose:h}=t,{disableClose:d}=t,{mapState:p}=t,{stylesheet:f}=t,{mapIdIndex:A}=t;return e.$$set=e=>{"index"in e&&i(0,c=e.index),"name"in e&&i(1,u=e.name),"onClose"in e&&i(2,h=e.onClose),"disableClose"in e&&i(3,d=e.disableClose),"mapState"in e&&i(9,p=e.mapState),"stylesheet"in e&&i(4,f=e.stylesheet),"mapIdIndex"in e&&i(5,A=e.mapIdIndex)},e.$$.update=()=>{512&e.$$.dirty&&i(6,({showBoundaries:r,showCollisions:n,...a}=p),a)},[c,u,h,d,f,A,a,o,s,p,function(t){G.call(this,e,t)}]}class zh extends me{constructor(e){super(),Ae(this,e,kh,Fh,a,{index:0,name:1,onClose:2,disableClose:3,mapState:9,stylesheet:4,mapIdIndex:5})}}const Rh=["swipe","mirror","phone","responsive"],Dh=(e,t)=>{const i=t.some((({type:e})=>"google"===e));return i?e.zoom<12?35:45:60},Oh=(e,t)=>{const i={...e};if((e=>e.some((({type:e})=>"google"===e)))(t)){const r=Dh(e,t);i.pitch>r&&(i.pitch=r)}return i};var Uh={exports:{}};!function(e,t){var i="__lodash_hash_undefined__",r=9007199254740991,n="[object Arguments]",o="[object Array]",s="[object Boolean]",a="[object Date]",l="[object Error]",c="[object Function]",u="[object Map]",h="[object Number]",d="[object Object]",p="[object Promise]",f="[object RegExp]",A="[object Set]",m="[object String]",g="[object Symbol]",_="[object WeakMap]",y="[object ArrayBuffer]",v="[object DataView]",x=/^\[object .+?Constructor\]$/,b=/^(?:0|[1-9]\d*)$/,w={};w["[object Float32Array]"]=w["[object Float64Array]"]=w["[object Int8Array]"]=w["[object Int16Array]"]=w["[object Int32Array]"]=w["[object Uint8Array]"]=w["[object Uint8ClampedArray]"]=w["[object Uint16Array]"]=w["[object Uint32Array]"]=!0,w[n]=w[o]=w[y]=w[s]=w[v]=w[a]=w[l]=w[c]=w[u]=w[h]=w[d]=w[f]=w[A]=w[m]=w[_]=!1;var T="object"==typeof ge&&ge&&ge.Object===Object&&ge,B="object"==typeof self&&self&&self.Object===Object&&self,C=T||B||Function("return this")(),S=t&&!t.nodeType&&t,E=S&&e&&!e.nodeType&&e,M=E&&E.exports===S,I=M&&T.process,P=function(){try{return I&&I.binding&&I.binding("util")}catch(e){}}(),L=P&&P.isTypedArray;function F(e,t){for(var i=-1,r=null==e?0:e.length;++ia))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var u=-1,h=!0,d=2&i?new ye:void 0;for(o.set(e,t),o.set(t,e);++u-1},me.prototype.set=function(e,t){var i=this.__data__,r=be(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this},_e.prototype.clear=function(){this.size=0,this.__data__={hash:new Ae,map:new(re||me),string:new Ae}},_e.prototype.delete=function(e){var t=Ie(this,e).delete(e);return this.size-=t?1:0,t},_e.prototype.get=function(e){return Ie(this,e).get(e)},_e.prototype.has=function(e){return Ie(this,e).has(e)},_e.prototype.set=function(e,t){var i=Ie(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this},ye.prototype.add=ye.prototype.push=function(e){return this.__data__.set(e,i),this},ye.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.clear=function(){this.__data__=new me,this.size=0},ve.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},ve.prototype.get=function(e){return this.__data__.get(e)},ve.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.set=function(e,t){var i=this.__data__;if(i instanceof me){var r=i.__data__;if(!re||r.length<199)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new _e(r)}return i.set(e,t),this.size=i.size,this};var Le=J?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var i=-1,r=null==e?0:e.length,n=0,o=[];++i-1&&e%1==0&&e-1&&e%1==0&&e<=r}function je(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ve(e){return null!=e&&"object"==typeof e}var He=L?function(e){return function(t){return e(t)}}(L):function(e){return Ve(e)&&Qe(e.length)&&!!w[we(e)]};function Ge(e){return null!=(t=e)&&Qe(t.length)&&!Ne(t)?xe(e):Se(e);var t}e.exports=function(e,t){return Be(e,t)}}(Uh,Uh.exports);var Nh=Uh.exports;function Qh(e){let t,i=(e[0].name??e[0].id)+"";return{c(){t=T(i)},m(e,i){y(e,t,i)},p(e,r){1&r&&i!==(i=(e[0].name??e[0].id)+"")&&I(t,i)},d(e){e&&v(t)}}}function jh(e){let t,i,r,n,o,s,a=(e[0].screenshotName??e[0].name??e[0].id)+"",l=e[0].branch+"";return{c(){t=b("div"),i=T(a),r=B(),n=b("span"),o=T(" "),s=T(l),E(n,"class","screenshot-label-bold svelte-14y9jxq"),E(t,"class","screenshot-text svelte-14y9jxq")},m(e,a){y(e,t,a),_(t,i),_(t,r),_(t,n),_(n,o),_(n,s)},p(e,t){1&t&&a!==(a=(e[0].screenshotName??e[0].name??e[0].id)+"")&&I(i,a),1&t&&l!==(l=e[0].branch+"")&&I(s,l)},d(e){e&&v(t)}}}function Vh(e){let t,r,n;const o=[{onMapMount:e[12]},e[8],e[9]];var s=e[7];function a(e){let t={};for(let e=0;e{fe(e,1)})),ae()}s?(r=U(s,a()),r.$on("mapMove",e[11]),de(r.$$.fragment),le(r.$$.fragment,1),pe(r,t,null)):r=null}else s&&r.$set(l);(!n||4&i)&&O(t,"highlight-diff",e[2])},i(e){n||(r&&le(r.$$.fragment,e),n=!0)},o(e){r&&ce(r.$$.fragment,e),n=!1},d(e){e&&v(t),r&&fe(r)}}}function Hh(e){let t,i,r,n,o;return i=new zh({props:{index:e[0].index,mapIdIndex:e[6],name:e[0].name,onClose:e[10],disableClose:e[1]<=1,mapState:e[9],stylesheet:e[4]}}),i.$on("mapState",e[11]),{c(){t=b("div"),de(i.$$.fragment),E(t,"id",r=e[0].id),E(t,"class",n=m("map-label-container "+(2===e[1]?`map-label-container-${e[0].index}`:""))+" svelte-14y9jxq"),E(t,"style",e[3])},m(e,r){y(e,t,r),pe(i,t,null),o=!0},p(e,s){const a={};1&s&&(a.index=e[0].index),64&s&&(a.mapIdIndex=e[6]),1&s&&(a.name=e[0].name),2&s&&(a.disableClose=e[1]<=1),512&s&&(a.mapState=e[9]),16&s&&(a.stylesheet=e[4]),i.$set(a),(!o||1&s&&r!==(r=e[0].id))&&E(t,"id",r),(!o||3&s&&n!==(n=m("map-label-container "+(2===e[1]?`map-label-container-${e[0].index}`:""))+" svelte-14y9jxq"))&&E(t,"class",n),(!o||8&s)&&E(t,"style",e[3])},i(e){o||(le(i.$$.fragment,e),o=!0)},o(e){ce(i.$$.fragment,e),o=!1},d(e){e&&v(t),fe(i)}}}function Gh(e){let i,r,n,o,s,l=e[5],c=`${e[1]}-${e[0].index}`;function u(e,t){return e[0]?.branch?jh:Qh}let h=u(e),d=h(e),p=Vh(e),f=Hh(e);return{c(){i=b("div"),r=b("div"),d.c(),n=B(),p.c(),o=B(),f.c(),E(r,"class","screenshot-label-transparent svelte-14y9jxq"),E(i,"class","map-container svelte-14y9jxq")},m(e,t){y(e,i,t),_(i,r),d.m(r,null),_(i,n),p.m(i,null),_(i,o),f.m(i,null),s=!0},p(e,[n]){h===(h=u(e))&&d?d.p(e,n):(d.d(1),d=h(e),d&&(d.c(),d.m(r,null))),32&n&&a(l,l=e[5])?(se(),ce(p,1,1,t),ae(),p=Vh(e),p.c(),le(p,1),p.m(i,o)):p.p(e,n),3&n&&a(c,c=`${e[1]}-${e[0].index}`)?(se(),ce(f,1,1,t),ae(),f=Hh(e),f.c(),le(f,1),f.m(i,null)):f.p(e,n)},i(e){s||(le(p),le(f),s=!0)},o(e){ce(p),ce(f),s=!1},d(e){e&&v(i),d.d(),p.d(e),f.d(e)}}}function $h(e,t,r){let n,o,s,a;const c=["map","numberOfMaps","highlightDifferences","labelStyle"];let u,h,d,p=A(t,c);l(e,Le,(e=>r(15,u=e))),l(e,Ie,(e=>r(16,h=e))),l(e,Fe,(e=>r(13,d=e)));let{map:m}=t,{numberOfMaps:g}=t,{highlightDifferences:_=!1}=t,{labelStyle:y=""}=t;const v=H();let x,b={},w={};const T=e=>{switch(e){case"google":r(7,x=Uc);break;case"leaflet":r(7,x=$c);break;case"tangram":r(7,x=Wc);break;default:r(7,x=jc),r(8,b.mapRenderer=e,b)}};return e.$$set=e=>{t=i(i({},t),f(e)),r(21,p=A(t,c)),"map"in e&&r(0,m=e.map),"numberOfMaps"in e&&r(1,g=e.numberOfMaps),"highlightDifferences"in e&&r(2,_=e.highlightDifferences),"labelStyle"in e&&r(3,y=e.labelStyle)},e.$$.update=()=>{8193&e.$$.dirty&&(n=d?.[m.index]??{}),1&e.$$.dirty&&r(6,o=`${m.id}-${m.index}`),17&e.$$.dirty&&(Nh(w,m?.style)||r(4,w=m?.style)),1&e.$$.dirty&&r(5,s=m.renderer),82&e.$$.dirty&&((e,t)=>{const i={mapboxKey:h.mapboxGlAccessToken,maptilerKey:h.maptilerApiKey};r(8,b={id:e,mapStyle:{...m,url:Tu(m.url,i)},numberOfMaps:t}),T(s)})(o,g),32&e.$$.dirty&&T(s),r(9,a=(e=>{if(u)return e;const{bearing:t,center:i,pitch:r,zoom:o,...s}=e;let a={...s,...{bearing:t,center:i,pitch:r,zoom:o,...n}};return a=Oh(a,[m]),a})(p))},[m,g,_,y,w,s,o,x,b,a,()=>{Ee.update((e=>e.filter(((e,t)=>t!==m.index)).map(((e,t)=>({...e,index:t}))))),u||Fe.update((e=>e.filter(((e,t)=>t!==m.index))))},e=>{if(u)v("mapMove",e.detail);else{const{options:t}=e.detail;Fe.update((e=>e.map(((e,i)=>i===m.index?t:e))))}},e=>{ke.update((t=>({...t,[m.index]:e})))},d]}class Zh extends me{constructor(e){super(),Ae(this,e,$h,Gh,a,{map:0,numberOfMaps:1,highlightDifferences:2,labelStyle:3})}}function qh(e,t,i){const r=e.slice();return r[1]=t[i],r}function Kh(e,t,i){const r=e.slice();return r[10]=t[i],r}function Wh(e){let t,r,n;const o=[{map:e[10]},e[0],{numberOfMaps:e[2]}];let s={};for(let e=0;ece(o[e],1,1,(()=>{o[e]=null}));return{c(){t=b("div");for(let e=0;ece(s[e],1,1,(()=>{s[e]=null}));return{c(){t=b("div"),i=b("div");for(let e=0;e{"maps"in e&&i(1,r=e.maps),"mapState"in e&&i(0,n=e.mapState)},e.$$.update=()=>{2&e.$$.dirty&&i(2,s=r.length),4&e.$$.dirty&&i(4,l=a.includes(s)?"row":"column"),2&e.$$.dirty&&(e=>{const t=Math.round(Math.sqrt(s)),r=Math.floor(s/t);let n=JSON.parse(JSON.stringify(e)),a=[];for(;n.length;)a.push(n.slice(0,r)),n=n.slice(r);i(3,o=a)})(r)},[n,r,s,o,l,function(t){G.call(this,e,t)}]}class ed extends me{constructor(e){super(),Ae(this,e,Jh,Yh,a,{maps:1,mapState:0})}}function td(e,t,i){const r=e.slice();return r[3]=t[i],r}function id(e){let t,r,n,o;const s=[{map:e[3]},e[1],{labelStyle:"position: absolute; margin-top: 48px; left: 0; right: 0; bottom: unset; max-width: unset;"},{numberOfMaps:e[0].length}];let a={};for(let e=0;ece(o[e],1,1,(()=>{o[e]=null}));return{c(){t=b("div"),i=b("div");for(let e=0;e{"maps"in e&&i(0,r=e.maps),"mapState"in e&&i(1,n=e.mapState)},[r,n,function(t){G.call(this,e,t)}]}class od extends me{constructor(e){super(),Ae(this,e,nd,rd,a,{maps:0,mapState:1})}}function sd(e,t,i){const r=e.slice();return r[15]=t[i],r}function ad(e){let t,r,n,o;const s=[{map:e[15]},e[1],{numberOfMaps:e[0].length},{highlightDifferences:1===e[15].index&&e[1]?.showDiff},{labelStyle:0===e[15].index?e[7]:e[6]}];let a={};for(let e=0;ece(u[e],1,1,(()=>{u[e]=null}));return{c(){t=b("div");for(let e=0;ee[14].call(t))),O(t,"dragging",e[4])},m(o,c){y(o,t,c);for(let e=0;e{e.source===i.contentWindow&&t()}))):(i.src="about:blank",i.onload=()=>{n=S(i.contentWindow,"resize",t),t()}),_(e,i),()=>{(r||n&&i.contentWindow)&&n(),v(i)}}(t,e[14].bind(t)),s=!0,a||(l=[S(r,"mousedown",e[8]),S(t,"mousemove",e[10]),S(t,"mouseup",e[9])],a=!0)},p(e,[n]){if(239&n){let r;for(c=e[0],r=0;r{"maps"in e&&i(0,c=e.maps),"mapState"in e&&i(1,u=e.mapState)},e.$$.update=()=>{8&e.$$.dirty&&i(2,d=a/2),12&e.$$.dirty&&i(11,r=a-d),2056&e.$$.dirty&&i(12,n=a-r),4096&e.$$.dirty&&i(7,o=`right: unset; margin-right:unset; left:0; margin-left:1em; max-width:calc(${n}px - 6em)`),2048&e.$$.dirty&&i(6,s=`max-width:calc(${r}px - 6em)`)},[c,u,d,a,h,l,s,o,()=>i(4,h=!0),()=>i(4,h=!1),e=>{h&&0!==e.clientX&&i(2,d=e.clientX-cd/2)},r,n,function(t){G.call(this,e,t)},function(){l=this.clientHeight,a=this.clientWidth,i(5,l),i(3,a)}]}class hd extends me{constructor(e){super(),Ae(this,e,ud,ld,a,{maps:0,mapState:1})}}function dd(e){let t,r;const n=[{map:e[8]},e[6],{numberOfMaps:e[7]},{labelStyle:"position: fixed;"}];let o={};for(let e=0;e{Q=null})),ae()),(!O||3&t&&r!==(r=`height:${e[0]}px; width:${e[1]}px`))&&E(i,"style",r),4&t&&M(h.value)!==e[2]&&P(h,e[2]),8&t&&M(x.value)!==e[3]&&P(x,e[3]),(!O||12&t&&F!==(F=!e[3]||!e[2]))&&(I.disabled=F),(!O||3&t&&D!==(D="100%"===e[0]&&"100%"===e[1]))&&(z.disabled=D)},i(e){O||(le(Q),O=!0)},o(e){ce(Q),O=!1},d(e){e&&v(t),Q&&Q.d(),U=!1,o(N)}}}function fd(e,t,i){let r,n,{maps:o}=t,{mapState:s}=t;const a=H();let l=s.height||"100%",c=s.width||"100%",u=s.height||"",h=s.width||"",d=!1,p=!1,f=s;delete f.width,delete f.height;const A=()=>{i(0,l=u),i(1,c=h),a("mapSetDimensions",{options:{height:l,width:c}})};return e.$$set=e=>{"maps"in e&&i(12,o=e.maps),"mapState"in e&&i(13,s=e.mapState)},e.$$.update=()=>{if(4096&e.$$.dirty&&i(8,r=o[0]),4096&e.$$.dirty&&i(7,n=o?.length??0),8192&e.$$.dirty){let{width:e,height:t,...r}=s;i(6,f=r)}},[l,c,u,h,d,p,f,n,r,()=>{(d||p)&&!(!h||!u)&&A()},A,()=>{i(0,l="100%"),i(1,c="100%"),i(2,u=""),i(3,h=""),a("mapSetDimensions",{options:{height:null,width:null}})},o,s,function(t){G.call(this,e,t)},function(){u=M(this.value),i(2,u)},()=>i(4,d=!0),()=>i(4,d=!1),function(){h=M(this.value),i(3,h)},()=>i(5,p=!0),()=>i(5,p=!1)]}class Ad extends me{constructor(e){super(),Ae(this,e,fd,pd,a,{maps:12,mapState:13})}}function md(e){let t,i,r;var n=e[2];function o(e){return{props:{maps:e[0],mapState:e[1]}}}return n&&(t=U(n,o(e)),t.$on("mapMove",e[3]),t.$on("mapSetDimensions",e[4])),{c(){t&&de(t.$$.fragment),i=C()},m(e,n){t&&pe(t,e,n),y(e,i,n),r=!0},p(e,[r]){const s={};if(1&r&&(s.maps=e[0]),2&r&&(s.mapState=e[1]),4&r&&n!==(n=e[2])){if(t){se();const e=t;ce(e.$$.fragment,1,0,(()=>{fe(e,1)})),ae()}n?(t=U(n,o(e)),t.$on("mapMove",e[3]),t.$on("mapSetDimensions",e[4]),de(t.$$.fragment),le(t.$$.fragment,1),pe(t,i.parentNode,i)):t=null}else n&&t.$set(s)},i(e){r||(t&&le(t.$$.fragment,e),r=!0)},o(e){t&&ce(t.$$.fragment,e),r=!1},d(e){e&&v(i),t&&fe(t,e)}}}function gd(e,t,i){let r,n,{maps:o}=t,{mapState:s}=t,{viewMode:a}=t;const l=H();let c;const u=e=>{l("setDimensions",{...e.detail.options})};return e.$$set=e=>{"maps"in e&&i(0,o=e.maps),"mapState"in e&&i(1,s=e.mapState),"viewMode"in e&&i(5,a=e.viewMode)},e.$$.update=()=>{2&e.$$.dirty&&i(7,r=s.height),2&e.$$.dirty&&i(6,n=s.width),32&e.$$.dirty&&(e=>{switch(e){case"phone":i(2,c=od);break;case"mirror":i(2,c=ed);break;case"responsive":i(2,c=Ad);break;default:i(2,c=hd)}})(a),224&e.$$.dirty&&"responsive"!==a&&(r||n)&&u({detail:{options:{height:null,width:null}}})},[o,s,c,e=>{l("mapState",{options:e.detail.options})},u,a,n,r]}class _d extends me{constructor(e){super(),Ae(this,e,gd,md,a,{maps:0,mapState:1,viewMode:5})}}var yd={exports:{}}; /*! * html2canvas 1.4.1 * Copyright (c) 2022 Niklas von Hertzen * Released under MIT License - */_d.exports=function(){ + */yd.exports=function(){ /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -28,5 +28,5 @@ function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isAr OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};function t(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}var i=function(){return i=Object.assign||function(e){for(var t,i=1,r=arguments.length;i0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=55296&&n<=56319&&i>10),s%1024+56320)),(n+1===i||r.length>16384)&&(o+=String.fromCharCode.apply(String,r),r.length=0)}return o},h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="undefined"==typeof Uint8Array?[]:new Uint8Array(256),p=0;p>4,u[l++]=(15&r)<<4|n>>2,u[l++]=(3&n)<<6|63&o;return c},_=function(e){for(var t=e.length,i=[],r=0;r>v,T=(1<>v)+32,C=65536>>x,S=(1<=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>v])<>v)])<>x),t=this.index[t],t+=e>>v&S,t=((t=this.index[t])<z?(n.push(!0),s-=z):n.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(e))return r.push(o),i.push(W);if(s===U||s===G){if(0===o)return r.push(o),i.push(ue);var a=i[o-1];return-1===Fe.indexOf(a)?(r.push(r[o-1]),i.push(a)):(r.push(o),i.push(ue))}return r.push(o),s===he?i.push("strict"===t?te:ge):s===be||s===ce?i.push(ue):s===we?e>=131072&&e<=196605||e>=196608&&e<=262141?i.push(ge):i.push(ue):void i.push(s)})),[r,i,n]},De=function(e,t,i,r){var n=r[i];if(Array.isArray(e)?-1!==e.indexOf(n):e===n)for(var o=i;o<=r.length;){if((l=r[++o])===t)return!0;if(l!==H)break}if(n===H)for(o=i;o>0;){var s=r[--o];if(Array.isArray(e)?-1!==e.indexOf(s):e===s)for(var a=i;a<=r.length;){var l;if((l=r[++a])===t)return!0;if(l!==H)break}if(s!==H)break}return!1},Oe=function(e,t){for(var i=e;i>=0;){var r=t[i];if(r!==H)return r;i--}return 0},Ue=function(e,t,i,r,n){if(0===i[r])return Ce;var o=r-1;if(Array.isArray(n)&&!0===n[o])return Ce;var s=o-1,a=o+1,l=t[o],c=s>=0?t[s]:0,u=t[a];if(l===D&&u===O)return Ce;if(-1!==Ie.indexOf(l))return Be;if(-1!==Ie.indexOf(u))return Ce;if(-1!==Pe.indexOf(u))return Ce;if(Oe(o,t)===j)return Se;if(Ee.get(e[o])===G)return Ce;if((l===de||l===pe)&&Ee.get(e[a])===G)return Ce;if(l===Q||u===Q)return Ce;if(l===V)return Ce;if(-1===[H,Z,K].indexOf(l)&&u===V)return Ce;if(-1!==[X,Y,J,ne,le].indexOf(u))return Ce;if(Oe(o,t)===ie)return Ce;if(De(re,ie,o,t))return Ce;if(De([X,Y],te,o,t))return Ce;if(De($,$,o,t))return Ce;if(l===H)return Se;if(l===re||u===re)return Ce;if(u===W||l===W)return Se;if(-1!==[Z,K,te].indexOf(u)||l===q)return Ce;if(c===me&&-1!==ze.indexOf(l))return Ce;if(l===le&&u===me)return Ce;if(u===ee)return Ce;if(-1!==Me.indexOf(u)&&l===oe||-1!==Me.indexOf(l)&&u===oe)return Ce;if(l===ae&&-1!==[ge,de,pe].indexOf(u)||-1!==[ge,de,pe].indexOf(l)&&u===se)return Ce;if(-1!==Me.indexOf(l)&&-1!==Le.indexOf(u)||-1!==Le.indexOf(l)&&-1!==Me.indexOf(u))return Ce;if(-1!==[ae,se].indexOf(l)&&(u===oe||-1!==[ie,K].indexOf(u)&&t[a+1]===oe)||-1!==[ie,K].indexOf(l)&&u===oe||l===oe&&-1!==[oe,le,ne].indexOf(u))return Ce;if(-1!==[oe,le,ne,X,Y].indexOf(u))for(var h=o;h>=0;){if((d=t[h])===oe)return Ce;if(-1===[le,ne].indexOf(d))break;h--}if(-1!==[ae,se].indexOf(u))for(h=-1!==[X,Y].indexOf(l)?s:o;h>=0;){var d;if((d=t[h])===oe)return Ce;if(-1===[le,ne].indexOf(d))break;h--}if(_e===l&&-1!==[_e,ye,fe,Ae].indexOf(u)||-1!==[ye,fe].indexOf(l)&&-1!==[ye,ve].indexOf(u)||-1!==[ve,Ae].indexOf(l)&&u===ve)return Ce;if(-1!==ke.indexOf(l)&&-1!==[ee,se].indexOf(u)||-1!==ke.indexOf(u)&&l===ae)return Ce;if(-1!==Me.indexOf(l)&&-1!==Me.indexOf(u))return Ce;if(l===ne&&-1!==Me.indexOf(u))return Ce;if(-1!==Me.concat(oe).indexOf(l)&&u===ie&&-1===Te.indexOf(e[a])||-1!==Me.concat(oe).indexOf(u)&&l===Y)return Ce;if(l===xe&&u===xe){for(var p=i[o],f=1;p>0&&t[--p]===xe;)f++;if(f%2!=0)return Ce}return l===de&&u===pe?Ce:Se},Ne=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var i=Re(e,t.lineBreak),r=i[0],n=i[1],o=i[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(n=n.map((function(e){return-1!==[oe,ue,be].indexOf(e)?ge:e})));var s="keep-all"===t.wordBreak?o.map((function(t,i){return t&&e[i]>=19968&&e[i]<=40959})):void 0;return[r,n,s]},Qe=function(){function e(e,t,i,r){this.codePoints=e,this.required=t===Be,this.start=i,this.end=r}return e.prototype.slice=function(){return u.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),je=function(e,t){var i=c(e),r=Ne(i,t),n=r[0],o=r[1],s=r[2],a=i.length,l=0,u=0;return{next:function(){if(u>=a)return{done:!0,value:null};for(var e=Ce;u=zt&&e<=57},Zt=function(e){return e>=55296&&e<=57343},qt=function(e){return $t(e)||e>=Qt&&e<=Vt||e>=Rt&&e<=Ot},Kt=function(e){return e>=Rt&&e<=Nt},Wt=function(e){return e>=Qt&&e<=Gt},Xt=function(e){return Kt(e)||Wt(e)},Yt=function(e){return e>=vt},Jt=function(e){return e===Ze||e===We||e===Xe},ei=function(e){return Xt(e)||Yt(e)||e===st},ti=function(e){return ei(e)||$t(e)||e===at},ii=function(e){return e>=Et&&e<=Mt||e===It||e>=Pt&&e<=Lt||e===Ft},ri=function(e,t){return e===Ke&&t!==Ze},ni=function(e,t,i){return e===at?ei(t)||ri(t,i):!!ei(e)||!(e!==Ke||!ri(e,t))},oi=function(e,t,i){return e===wt||e===at?!!$t(t)||t===St&&$t(i):$t(e===St?t:e)},si=function(e){var t=0,i=1;e[t]!==wt&&e[t]!==at||(e[t]===at&&(i=-1),t++);for(var r=[];$t(e[t]);)r.push(e[t++]);var n=r.length?parseInt(u.apply(void 0,r),10):0;e[t]===St&&t++;for(var o=[];$t(e[t]);)o.push(e[t++]);var s=o.length,a=s?parseInt(u.apply(void 0,o),10):0;e[t]!==jt&&e[t]!==Dt||t++;var l=1;e[t]!==wt&&e[t]!==at||(e[t]===at&&(l=-1),t++);for(var c=[];$t(e[t]);)c.push(e[t++]);var h=c.length?parseInt(u.apply(void 0,c),10):0;return i*(n+a*Math.pow(10,-s))*Math.pow(10,l*h)},ai={type:2},li={type:3},ci={type:4},ui={type:13},hi={type:8},di={type:21},pi={type:9},fi={type:10},Ai={type:11},mi={type:12},gi={type:14},_i={type:23},yi={type:1},vi={type:25},xi={type:24},bi={type:26},wi={type:27},Ti={type:28},Bi={type:29},Ci={type:31},Si={type:32},Ei=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(c(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Si;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Ye:return this.consumeStringToken(Ye);case et:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),r=this.peekCodePoint(2);if(ti(t)||ri(i,r)){var n=ni(t,i,r)?He:Ve;return{type:5,value:this.consumeName(),flags:n}}break;case tt:if(this.peekCodePoint(0)===Je)return this.consumeCodePoint(),ui;break;case rt:return this.consumeStringToken(rt);case nt:return ai;case ot:return li;case bt:if(this.peekCodePoint(0)===Je)return this.consumeCodePoint(),gi;break;case wt:if(oi(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Tt:return ci;case at:var o=e,s=this.peekCodePoint(0),a=this.peekCodePoint(1);if(oi(o,s,a))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(ni(o,s,a))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(s===at&&a===ut)return this.consumeCodePoint(),this.consumeCodePoint(),xi;break;case St:if(oi(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case qe:if(this.peekCodePoint(0)===bt)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===bt&&(l=this.consumeCodePoint())===qe)return this.consumeToken();if(l===kt)return this.consumeToken()}break;case Bt:return bi;case Ct:return wi;case ct:if(this.peekCodePoint(0)===lt&&this.peekCodePoint(1)===at&&this.peekCodePoint(2)===at)return this.consumeCodePoint(),this.consumeCodePoint(),vi;break;case ht:var c=this.peekCodePoint(0),h=this.peekCodePoint(1),d=this.peekCodePoint(2);if(ni(c,h,d))return{type:7,value:this.consumeName()};break;case dt:return Ti;case Ke:if(ri(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case pt:return Bi;case ft:if(this.peekCodePoint(0)===Je)return this.consumeCodePoint(),hi;break;case At:return Ai;case gt:return mi;case Ut:case Ht:var p=this.peekCodePoint(0),f=this.peekCodePoint(1);return p!==wt||!qt(f)&&f!==mt||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case _t:if(this.peekCodePoint(0)===Je)return this.consumeCodePoint(),pi;if(this.peekCodePoint(0)===_t)return this.consumeCodePoint(),di;break;case yt:if(this.peekCodePoint(0)===Je)return this.consumeCodePoint(),fi;break;case kt:return Si}return Jt(e)?(this.consumeWhiteSpace(),Ci):$t(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ei(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:u(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return void 0===e?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();qt(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;t===mt&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i)return{type:30,start:parseInt(u.apply(void 0,e.map((function(e){return e===mt?zt:e}))),16),end:parseInt(u.apply(void 0,e.map((function(e){return e===mt?Vt:e}))),16)};var r=parseInt(u.apply(void 0,e),16);if(this.peekCodePoint(0)===at&&qt(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var n=[];qt(t)&&n.length<6;)n.push(t),t=this.consumeCodePoint();return{type:30,start:r,end:parseInt(u.apply(void 0,n),16)}}return{type:30,start:r,end:r}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return"url"===e.toLowerCase()&&this.peekCodePoint(0)===nt?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===nt?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===kt)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===rt||t===Ye){var i=this.consumeStringToken(this.consumeCodePoint());return 0===i.type&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===kt||this.peekCodePoint(0)===ot)?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),_i)}for(;;){var r=this.consumeCodePoint();if(r===kt||r===ot)return{type:22,value:u.apply(void 0,e)};if(Jt(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===kt||this.peekCodePoint(0)===ot?(this.consumeCodePoint(),{type:22,value:u.apply(void 0,e)}):(this.consumeBadUrlRemnants(),_i);if(r===Ye||r===rt||r===nt||ii(r))return this.consumeBadUrlRemnants(),_i;if(r===Ke){if(!ri(r,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),_i;e.push(this.consumeEscapedCodePoint())}else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;Jt(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===ot||e===kt)return;ri(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t=5e4,i="";e>0;){var r=Math.min(t,e);i+=u.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),i},e.prototype.consumeStringToken=function(e){for(var t="",i=0;;){var r=this._value[i];if(r===kt||void 0===r||r===e)return{type:0,value:t+=this.consumeStringSlice(i)};if(r===Ze)return this._value.splice(0,i),yi;if(r===Ke){var n=this._value[i+1];n!==kt&&void 0!==n&&(n===Ze?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):ri(r,n)&&(t+=this.consumeStringSlice(i),t+=u(this.consumeEscapedCodePoint()),i=-1))}i++}},e.prototype.consumeNumber=function(){var e=[],t=Ge,i=this.peekCodePoint(0);for(i!==wt&&i!==at||e.push(this.consumeCodePoint());$t(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(i===St&&$t(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=$e;$t(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((i===jt||i===Dt)&&((r===wt||r===at)&&$t(n)||$t(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=$e;$t(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[si(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),o=this.peekCodePoint(2);return ni(r,n,o)?{type:15,number:t,flags:i,unit:this.consumeName()}:r===it?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(qt(e)){for(var t=u(e);qt(this.peekCodePoint(0))&&t.length<6;)t+=u(this.consumeCodePoint());Jt(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return 0===i||Zt(i)||i>1114111?xt:i}return e===kt?xt:e},e.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(ti(t))e+=u(t);else{if(!ri(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),e;e+=u(this.consumeEscapedCodePoint())}}},e}(),Mi=function(){function e(e){this._tokens=e}return e.create=function(t){var i=new Ei;return i.write(t),new e(i.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();31===e.type;)e=this.consumeToken();if(32===e.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(32===t.type)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(32===i.type||Oi(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(32===i.type||3===i.type)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?Si:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Ii=function(e){return 15===e.type},Pi=function(e){return 17===e.type},Li=function(e){return 20===e.type},Fi=function(e){return 0===e.type},ki=function(e,t){return Li(e)&&e.value===t},zi=function(e){return 31!==e.type},Ri=function(e){return 31!==e.type&&4!==e.type},Di=function(e){var t=[],i=[];return e.forEach((function(e){if(4===e.type){if(0===i.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(i),void(i=[])}31!==e.type&&i.push(e)})),i.length&&t.push(i),t},Oi=function(e,t){return 11===t&&12===e.type||28===t&&29===e.type||2===t&&3===e.type},Ui=function(e){return 17===e.type||15===e.type},Ni=function(e){return 16===e.type||Ui(e)},Qi=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},ji={type:17,number:0,flags:Ge},Vi={type:16,number:50,flags:Ge},Hi={type:16,number:100,flags:Ge},Gi=function(e,t,i){var r=e[0],n=e[1];return[$i(r,t),$i(void 0!==n?n:r,i)]},$i=function(e,t){if(16===e.type)return e.number/100*t;if(Ii(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},Zi="deg",qi="grad",Ki="rad",Wi="turn",Xi={name:"angle",parse:function(e,t){if(15===t.type)switch(t.unit){case Zi:return Math.PI*t.number/180;case qi:return Math.PI/200*t.number;case Ki:return t.number;case Wi:return 2*Math.PI*t.number}throw new Error("Unsupported angle type")}},Yi=function(e){return 15===e.type&&(e.unit===Zi||e.unit===qi||e.unit===Ki||e.unit===Wi)},Ji=function(e){switch(e.filter(Li).map((function(e){return e.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ji,ji];case"to top":case"bottom":return er(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ji,Hi];case"to right":case"left":return er(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Hi,Hi];case"to bottom":case"top":return er(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Hi,ji];case"to left":case"right":return er(270)}return 0},er=function(e){return Math.PI*e/180},tr={name:"color",parse:function(e,t){if(18===t.type){var i=cr[t.name];if(void 0===i)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return i(e,t.values)}if(5===t.type){if(3===t.value.length){var r=t.value.substring(0,1),n=t.value.substring(1,2),o=t.value.substring(2,3);return nr(parseInt(r+r,16),parseInt(n+n,16),parseInt(o+o,16),1)}if(4===t.value.length){r=t.value.substring(0,1),n=t.value.substring(1,2),o=t.value.substring(2,3);var s=t.value.substring(3,4);return nr(parseInt(r+r,16),parseInt(n+n,16),parseInt(o+o,16),parseInt(s+s,16)/255)}if(6===t.value.length)return r=t.value.substring(0,2),n=t.value.substring(2,4),o=t.value.substring(4,6),nr(parseInt(r,16),parseInt(n,16),parseInt(o,16),1);if(8===t.value.length)return r=t.value.substring(0,2),n=t.value.substring(2,4),o=t.value.substring(4,6),s=t.value.substring(6,8),nr(parseInt(r,16),parseInt(n,16),parseInt(o,16),parseInt(s,16)/255)}if(20===t.type){var a=hr[t.value.toUpperCase()];if(void 0!==a)return a}return hr.TRANSPARENT}},ir=function(e){return!(255&e)},rr=function(e){var t=255&e,i=255&e>>8,r=255&e>>16,n=255&e>>24;return t<255?"rgba("+n+","+r+","+i+","+t/255+")":"rgb("+n+","+r+","+i+")"},nr=function(e,t,i,r){return(e<<24|t<<16|i<<8|Math.round(255*r))>>>0},or=function(e,t){if(17===e.type)return e.number;if(16===e.type){var i=3===t?1:255;return 3===t?e.number/100*i:Math.round(e.number/100*i)}return 0},sr=function(e,t){var i=t.filter(Ri);if(3===i.length){var r=i.map(or),n=r[0],o=r[1],s=r[2];return nr(n,o,s,1)}if(4===i.length){var a=i.map(or),l=(n=a[0],o=a[1],s=a[2],a[3]);return nr(n,o,s,l)}return 0};function ar(e,t,i){return i<0&&(i+=1),i>=1&&(i-=1),i<1/6?(t-e)*i*6+e:i<.5?t:i<2/3?6*(t-e)*(2/3-i)+e:e}var lr=function(e,t){var i=t.filter(Ri),r=i[0],n=i[1],o=i[2],s=i[3],a=(17===r.type?er(r.number):Xi.parse(e,r))/(2*Math.PI),l=Ni(n)?n.number/100:0,c=Ni(o)?o.number/100:0,u=void 0!==s&&Ni(s)?$i(s,1):1;if(0===l)return nr(255*c,255*c,255*c,1);var h=c<=.5?c*(l+1):c+l-c*l,d=2*c-h,p=ar(d,h,a+1/3),f=ar(d,h,a),A=ar(d,h,a-1/3);return nr(255*p,255*f,255*A,u)},cr={hsl:lr,hsla:lr,rgb:sr,rgba:sr},ur=function(e,t){return tr.parse(e,Mi.create(t).parseComponentValue())},hr={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},dr={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(Li(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},pr={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},fr=function(e,t){var i=tr.parse(e,t[0]),r=t[1];return r&&Ni(r)?{color:i,stop:r}:{color:i,stop:null}},Ar=function(e,t){var i=e[0],r=e[e.length-1];null===i.stop&&(i.stop=ji),null===r.stop&&(r.stop=Hi);for(var n=[],o=0,s=0;so?n.push(l):n.push(o),o=l}else n.push(null)}var c=null;for(s=0;se.optimumDistance)?{optimumCorner:t,optimumDistance:a}:e}),{optimumDistance:n?1/0:-1/0,optimumCorner:null}).optimumCorner},vr=function(e,t,i,r,n){var o=0,s=0;switch(e.size){case 0:0===e.shape?o=s=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(i),Math.abs(i-n)):1===e.shape&&(o=Math.min(Math.abs(t),Math.abs(t-r)),s=Math.min(Math.abs(i),Math.abs(i-n)));break;case 2:if(0===e.shape)o=s=Math.min(_r(t,i),_r(t,i-n),_r(t-r,i),_r(t-r,i-n));else if(1===e.shape){var a=Math.min(Math.abs(i),Math.abs(i-n))/Math.min(Math.abs(t),Math.abs(t-r)),l=yr(r,n,t,i,!0),c=l[0],u=l[1];s=a*(o=_r(c-t,(u-i)/a))}break;case 1:0===e.shape?o=s=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(i),Math.abs(i-n)):1===e.shape&&(o=Math.max(Math.abs(t),Math.abs(t-r)),s=Math.max(Math.abs(i),Math.abs(i-n)));break;case 3:if(0===e.shape)o=s=Math.max(_r(t,i),_r(t,i-n),_r(t-r,i),_r(t-r,i-n));else if(1===e.shape){a=Math.max(Math.abs(i),Math.abs(i-n))/Math.max(Math.abs(t),Math.abs(t-r));var h=yr(r,n,t,i,!1);c=h[0],u=h[1],s=a*(o=_r(c-t,(u-i)/a))}}return Array.isArray(e.size)&&(o=$i(e.size[0],r),s=2===e.size.length?$i(e.size[1],n):o),[o,s]},xr=function(e,t){var i=er(180),r=[];return Di(t).forEach((function(t,n){if(0===n){var o=t[0];if(20===o.type&&-1!==["top","left","right","bottom"].indexOf(o.value))return void(i=Ji(t));if(Yi(o))return void(i=(Xi.parse(e,o)+er(270))%er(360))}var s=fr(e,t);r.push(s)})),{angle:i,stops:r,type:1}},br=function(e,t){var i=er(180),r=[],n=1,o=0,s=3,a=[];return Di(t).forEach((function(t,i){var o=t[0];if(0===i){if(Li(o)&&"linear"===o.value)return void(n=1);if(Li(o)&&"radial"===o.value)return void(n=2)}if(18===o.type)if("from"===o.name){var s=tr.parse(e,o.values[0]);r.push({stop:ji,color:s})}else if("to"===o.name)s=tr.parse(e,o.values[0]),r.push({stop:Hi,color:s});else if("color-stop"===o.name){var a=o.values.filter(Ri);if(2===a.length){s=tr.parse(e,a[1]);var l=a[0];Pi(l)&&r.push({stop:{type:16,number:100*l.number,flags:l.flags},color:s})}}})),1===n?{angle:(i+er(180))%er(360),stops:r,type:n}:{size:s,shape:o,stops:r,position:a,type:n}},wr="closest-side",Tr="farthest-side",Br="closest-corner",Cr="farthest-corner",Sr="circle",Er="ellipse",Mr="cover",Ir="contain",Pr=function(e,t){var i=0,r=3,n=[],o=[];return Di(t).forEach((function(t,s){var a=!0;if(0===s?a=t.reduce((function(e,t){if(Li(t))switch(t.value){case"center":return o.push(Vi),!1;case"top":case"left":return o.push(ji),!1;case"right":case"bottom":return o.push(Hi),!1}else if(Ni(t)||Ui(t))return o.push(t),!1;return e}),a):1===s&&(a=t.reduce((function(e,t){if(Li(t))switch(t.value){case Sr:return i=0,!1;case Er:return i=1,!1;case Ir:case wr:return r=0,!1;case Tr:return r=1,!1;case Br:return r=2,!1;case Mr:case Cr:return r=3,!1}else if(Ui(t)||Ni(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e}),a)),a){var l=fr(e,t);n.push(l)}})),{size:r,shape:i,stops:n,position:o,type:2}},Lr=function(e){return 1===e.type},Fr=function(e){return 2===e.type},kr={name:"image",parse:function(e,t){if(22===t.type){var i={url:t.value,type:0};return e.cache.addImage(t.value),i}if(18===t.type){var r=Dr[t.name];if(void 0===r)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return r(e,t.values)}throw new Error("Unsupported image type "+t.type)}};function zr(e){return!(20===e.type&&"none"===e.value||18===e.type&&!Dr[e.name])}var Rr,Dr={"linear-gradient":function(e,t){var i=er(180),r=[];return Di(t).forEach((function(t,n){if(0===n){var o=t[0];if(20===o.type&&"to"===o.value)return void(i=Ji(t));if(Yi(o))return void(i=Xi.parse(e,o))}var s=fr(e,t);r.push(s)})),{angle:i,stops:r,type:1}},"-moz-linear-gradient":xr,"-ms-linear-gradient":xr,"-o-linear-gradient":xr,"-webkit-linear-gradient":xr,"radial-gradient":function(e,t){var i=0,r=3,n=[],o=[];return Di(t).forEach((function(t,s){var a=!0;if(0===s){var l=!1;a=t.reduce((function(e,t){if(l)if(Li(t))switch(t.value){case"center":return o.push(Vi),e;case"top":case"left":return o.push(ji),e;case"right":case"bottom":return o.push(Hi),e}else(Ni(t)||Ui(t))&&o.push(t);else if(Li(t))switch(t.value){case Sr:return i=0,!1;case Er:return i=1,!1;case"at":return l=!0,!1;case wr:return r=0,!1;case Mr:case Tr:return r=1,!1;case Ir:case Br:return r=2,!1;case Cr:return r=3,!1}else if(Ui(t)||Ni(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e}),a)}if(a){var c=fr(e,t);n.push(c)}})),{size:r,shape:i,stops:n,position:o,type:2}},"-moz-radial-gradient":Pr,"-ms-radial-gradient":Pr,"-o-radial-gradient":Pr,"-webkit-radial-gradient":Pr,"-webkit-gradient":br},Or={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var i=t[0];return 20===i.type&&"none"===i.value?[]:t.filter((function(e){return Ri(e)&&zr(e)})).map((function(t){return kr.parse(e,t)}))}},Ur={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(Li(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},Nr={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Di(t).map((function(e){return e.filter(Ni)})).map(Qi)}},Qr={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Di(t).map((function(e){return e.filter(Li).map((function(e){return e.value})).join(" ")})).map(jr)}},jr=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"}(Rr||(Rr={}));var Vr,Hr={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Di(t).map((function(e){return e.filter(Gr)}))}},Gr=function(e){return Li(e)||Ni(e)},$r=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Zr=$r("top"),qr=$r("right"),Kr=$r("bottom"),Wr=$r("left"),Xr=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Qi(t.filter(Ni))}}},Yr=Xr("top-left"),Jr=Xr("top-right"),en=Xr("bottom-right"),tn=Xr("bottom-left"),rn=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},nn=rn("top"),on=rn("right"),sn=rn("bottom"),an=rn("left"),ln=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Ii(t)?t.number:0}}},cn=ln("top"),un=ln("right"),hn=ln("bottom"),dn=ln("left"),pn={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},fn={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){return"rtl"===t?1:0}},An={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(Li).reduce((function(e,t){return e|mn(t.value)}),0)}},mn=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},gn={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},_n={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(Vr||(Vr={}));var yn,vn={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"strict"===t?Vr.STRICT:Vr.NORMAL}},xn={name:"line-height",initialValue:"normal",prefix:!1,type:4},bn=function(e,t){return Li(e)&&"normal"===e.value?1.2*t:17===e.type?t*e.number:Ni(e)?$i(e,t):t},wn={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return 20===t.type&&"none"===t.value?null:kr.parse(e,t)}},Tn={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){return"inside"===t?0:1}},Bn={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Cn=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},Sn=Cn("top"),En=Cn("right"),Mn=Cn("bottom"),In=Cn("left"),Pn={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(Li).map((function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}}))}},Ln={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"break-word"===t?"break-word":"normal"}},Fn=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},kn=Fn("top"),zn=Fn("right"),Rn=Fn("bottom"),Dn=Fn("left"),On={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Un={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Nn={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&ki(t[0],"none")?[]:Di(t).map((function(t){for(var i={color:hr.TRANSPARENT,offsetX:ji,offsetY:ji,blur:ji},r=0,n=0;n1?1:0],this.overflowWrap=vo(e,Ln,t.overflowWrap),this.paddingTop=vo(e,kn,t.paddingTop),this.paddingRight=vo(e,zn,t.paddingRight),this.paddingBottom=vo(e,Rn,t.paddingBottom),this.paddingLeft=vo(e,Dn,t.paddingLeft),this.paintOrder=vo(e,fo,t.paintOrder),this.position=vo(e,Un,t.position),this.textAlign=vo(e,On,t.textAlign),this.textDecorationColor=vo(e,Yn,null!==(i=t.textDecorationColor)&&void 0!==i?i:t.color),this.textDecorationLine=vo(e,Jn,null!==(r=t.textDecorationLine)&&void 0!==r?r:t.textDecoration),this.textShadow=vo(e,Nn,t.textShadow),this.textTransform=vo(e,Qn,t.textTransform),this.transform=vo(e,jn,t.transform),this.transformOrigin=vo(e,$n,t.transformOrigin),this.visibility=vo(e,Zn,t.visibility),this.webkitTextStrokeColor=vo(e,Ao,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=vo(e,mo,t.webkitTextStrokeWidth),this.wordBreak=vo(e,qn,t.wordBreak),this.zIndex=vo(e,Kn,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return ir(this.backgroundColor)},e.prototype.isTransformed=function(){return null!==this.transform},e.prototype.isPositioned=function(){return 0!==this.position},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return 0!==this.float},e.prototype.isInlineLevel=function(){return oo(this.display,4)||oo(this.display,33554432)||oo(this.display,268435456)||oo(this.display,536870912)||oo(this.display,67108864)||oo(this.display,134217728)},e}(),_o=function(){function e(e,t){this.content=vo(e,so,t.content),this.quotes=vo(e,uo,t.quotes)}return e}(),yo=function(){function e(e,t){this.counterIncrement=vo(e,ao,t.counterIncrement),this.counterReset=vo(e,lo,t.counterReset)}return e}(),vo=function(e,t,i){var r=new Ei,n=null!=i?i.toString():t.initialValue;r.write(n);var o=new Mi(r.read());switch(t.type){case 2:var s=o.parseComponentValue();return t.parse(e,Li(s)?s.value:t.initialValue);case 0:return t.parse(e,o.parseComponentValue());case 1:return t.parse(e,o.parseComponentValues());case 4:return o.parseComponentValue();case 3:switch(t.format){case"angle":return Xi.parse(e,o.parseComponentValue());case"color":return tr.parse(e,o.parseComponentValue());case"image":return kr.parse(e,o.parseComponentValue());case"length":var a=o.parseComponentValue();return Ui(a)?a:ji;case"length-percentage":var l=o.parseComponentValue();return Ni(l)?l:ji;case"time":return Wn.parse(e,o.parseComponentValue())}}},xo="data-html2canvas-debug",bo=function(e){switch(e.getAttribute(xo)){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},wo=function(e,t){var i=bo(e);return 1===i||t===i},To=function(){function e(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,wo(t,3),this.styles=new go(e,window.getComputedStyle(t,null)),ha(t)&&(this.styles.animationDuration.some((function(e){return e>0}))&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=a(this.context,t),wo(t,4)&&(this.flags|=16)}return e}(),Bo="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Co="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",So="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Eo=0;Eo>4,u[l++]=(15&r)<<4|n>>2,u[l++]=(3&n)<<6|63&o;return c},Io=function(e){for(var t=e.length,i=[],r=0;r>Lo,Ro=(1<>Lo)+32,Oo=65536>>Fo,Uo=(1<=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>Lo])<>Lo)])<>Fo),t=this.index[t],t+=e>>Lo&Uo,t=((t=this.index[t])<=55296&&n<=56319&&i>10),s%1024+56320)),(n+1===i||r.length>16384)&&(o+=String.fromCharCode.apply(String,r),r.length=0)}return o},us=jo(Bo),hs="×",ds="÷",ps=function(e){return us.get(e)},fs=function(e,t,i){var r=i-2,n=t[r],o=t[i-1],s=t[i];if(o===Ko&&s===Wo)return hs;if(o===Ko||o===Wo||o===Xo)return ds;if(s===Ko||s===Wo||s===Xo)return ds;if(o===es&&-1!==[es,ts,rs,ns].indexOf(s))return hs;if(!(o!==rs&&o!==ts||s!==ts&&s!==is))return hs;if((o===ns||o===is)&&s===is)return hs;if(s===os||s===Yo)return hs;if(s===Jo)return hs;if(o===qo)return hs;if(o===os&&s===ss){for(;n===Yo;)n=t[--r];if(n===ss)return hs}if(o===as&&s===as){for(var a=0;n===as;)a++,n=t[--r];if(a%2==0)return hs}return ds},As=function(e){var t=ls(e),i=t.length,r=0,n=0,o=t.map(ps);return{next:function(){if(r>=i)return{done:!0,value:null};for(var e=hs;rs.x||n.y>s.y;return s=n,0===t||a}));return e.body.removeChild(t),a},ys=function(){return void 0!==(new Image).crossOrigin},vs=function(){return"string"==typeof(new XMLHttpRequest).responseType},xs=function(e){var t=new Image,i=e.createElement("canvas"),r=i.getContext("2d");if(!r)return!1;t.src="data:image/svg+xml,";try{r.drawImage(t,0,0),i.toDataURL()}catch(e){return!1}return!0},bs=function(e){return 0===e[0]&&255===e[1]&&0===e[2]&&255===e[3]},ws=function(e){var t=e.createElement("canvas"),i=100;t.width=i,t.height=i;var r=t.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,i,i);var n=new Image,o=t.toDataURL();n.src=o;var s=Ts(i,i,0,0,n);return r.fillStyle="red",r.fillRect(0,0,i,i),Bs(s).then((function(t){r.drawImage(t,0,0);var n=r.getImageData(0,0,i,i).data;r.fillStyle="red",r.fillRect(0,0,i,i);var s=e.createElement("div");return s.style.backgroundImage="url("+o+")",s.style.height=i+"px",bs(n)?Bs(Ts(i,i,0,0,s)):Promise.reject(!1)})).then((function(e){return r.drawImage(e,0,0),bs(r.getImageData(0,0,i,i).data)})).catch((function(){return!1}))},Ts=function(e,t,i,r,n){var o="http://www.w3.org/2000/svg",s=document.createElementNS(o,"svg"),a=document.createElementNS(o,"foreignObject");return s.setAttributeNS(null,"width",e.toString()),s.setAttributeNS(null,"height",t.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",i.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(a),a.appendChild(n),s},Bs=function(e){return new Promise((function(t,i){var r=new Image;r.onload=function(){return t(r)},r.onerror=i,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(e))}))},Cs={get SUPPORT_RANGE_BOUNDS(){var e=gs(document);return Object.defineProperty(Cs,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Cs.SUPPORT_RANGE_BOUNDS&&_s(document);return Object.defineProperty(Cs,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=xs(document);return Object.defineProperty(Cs,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?ws(document):Promise.resolve(!1);return Object.defineProperty(Cs,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=ys();return Object.defineProperty(Cs,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=vs();return Object.defineProperty(Cs,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Cs,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(Cs,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Ss=function(){function e(e,t){this.text=e,this.bounds=t}return e}(),Es=function(e,t,i,r){var n=Fs(t,i),o=[],a=0;return n.forEach((function(t){if(i.textDecorationLine.length||t.trim().length>0)if(Cs.SUPPORT_RANGE_BOUNDS){var n=Is(r,a,t.length).getClientRects();if(n.length>1){var l=Ps(t),c=0;l.forEach((function(t){o.push(new Ss(t,s.fromDOMRectList(e,Is(r,c+a,t.length).getClientRects()))),c+=t.length}))}else o.push(new Ss(t,s.fromDOMRectList(e,n)))}else{var u=r.splitText(t.length);o.push(new Ss(t,Ms(e,r))),r=u}else Cs.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));a+=t.length})),o},Ms=function(e,t){var i=t.ownerDocument;if(i){var r=i.createElement("html2canvaswrapper");r.appendChild(t.cloneNode(!0));var n=t.parentNode;if(n){n.replaceChild(r,t);var o=a(e,r);return r.firstChild&&n.replaceChild(r.firstChild,r),o}}return s.EMPTY},Is=function(e,t,i){var r=e.ownerDocument;if(!r)throw new Error("Node has no owner document");var n=r.createRange();return n.setStart(e,t),n.setEnd(e,t+i),n},Ps=function(e){if(Cs.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map((function(e){return e.segment}))}return ms(e)},Ls=function(e,t){if(Cs.SUPPORT_NATIVE_TEXT_SEGMENTATION){var i=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(i.segment(e)).map((function(e){return e.segment}))}return zs(e,t)},Fs=function(e,t){return 0!==t.letterSpacing?Ps(e):Ls(e,t)},ks=[32,160,4961,65792,65793,4153,4241],zs=function(e,t){for(var i,r=je(e,{lineBreak:t.lineBreak,wordBreak:"break-word"===t.overflowWrap?"break-word":t.wordBreak}),n=[],o=function(){if(i.value){var e=i.value.slice(),t=c(e),r="";t.forEach((function(e){-1===ks.indexOf(e)?r+=u(e):(r.length&&n.push(r),n.push(u(e)),r="")})),r.length&&n.push(r)}};!(i=r.next()).done;)o();return n},Rs=function(){function e(e,t,i){this.text=Ds(t.data,i.textTransform),this.textBounds=Es(e,this.text,i,t)}return e}(),Ds=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Os,Us);case 2:return e.toUpperCase();default:return e}},Os=/(^|\s|:|-|\(|\))([a-z])/g,Us=function(e,t,i){return e.length>0?t+i.toUpperCase():e},Ns=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.src=i.currentSrc||i.src,r.intrinsicWidth=i.naturalWidth,r.intrinsicHeight=i.naturalHeight,r.context.cache.addImage(r.src),r}return t(i,e),i}(To),Qs=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.canvas=i,r.intrinsicWidth=i.width,r.intrinsicHeight=i.height,r}return t(i,e),i}(To),js=function(e){function i(t,i){var r=e.call(this,t,i)||this,n=new XMLSerializer,o=a(t,i);return i.setAttribute("width",o.width+"px"),i.setAttribute("height",o.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(i)),r.intrinsicWidth=i.width.baseVal.value,r.intrinsicHeight=i.height.baseVal.value,r.context.cache.addImage(r.svg),r}return t(i,e),i}(To),Vs=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.value=i.value,r}return t(i,e),i}(To),Hs=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.start=i.start,r.reversed="boolean"==typeof i.reversed&&!0===i.reversed,r}return t(i,e),i}(To),Gs=[{type:15,flags:0,unit:"px",number:3}],$s=[{type:16,flags:0,number:50}],Zs=function(e){return e.width>e.height?new s(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width0)i.textNodes.push(new Rs(e,n,i.styles));else if(ua(n))if(Sa(n)&&n.assignedNodes)n.assignedNodes().forEach((function(t){return na(e,t,i,r)}));else{var s=oa(e,n);s.styles.isVisible()&&(aa(n,s,r)?s.flags|=4:la(s.styles)&&(s.flags|=2),-1!==ra.indexOf(n.tagName)&&(s.flags|=8),i.elements.push(s),n.slot,n.shadowRoot?na(e,n.shadowRoot,s,r):Ba(n)||ga(n)||Ca(n)||na(e,n,s,r))}},oa=function(e,t){return xa(t)?new Ns(e,t):ya(t)?new Qs(e,t):ga(t)?new js(e,t):pa(t)?new Vs(e,t):fa(t)?new Hs(e,t):Aa(t)?new Js(e,t):Ca(t)?new ea(e,t):Ba(t)?new ta(e,t):ba(t)?new ia(e,t):new To(e,t)},sa=function(e,t){var i=oa(e,t);return i.flags|=4,na(e,t,i,i),i},aa=function(e,t,i){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||_a(e)&&i.styles.isTransparent()},la=function(e){return e.isPositioned()||e.isFloating()},ca=function(e){return e.nodeType===Node.TEXT_NODE},ua=function(e){return e.nodeType===Node.ELEMENT_NODE},ha=function(e){return ua(e)&&void 0!==e.style&&!da(e)},da=function(e){return"object"==typeof e.className},pa=function(e){return"LI"===e.tagName},fa=function(e){return"OL"===e.tagName},Aa=function(e){return"INPUT"===e.tagName},ma=function(e){return"HTML"===e.tagName},ga=function(e){return"svg"===e.tagName},_a=function(e){return"BODY"===e.tagName},ya=function(e){return"CANVAS"===e.tagName},va=function(e){return"VIDEO"===e.tagName},xa=function(e){return"IMG"===e.tagName},ba=function(e){return"IFRAME"===e.tagName},wa=function(e){return"STYLE"===e.tagName},Ta=function(e){return"SCRIPT"===e.tagName},Ba=function(e){return"TEXTAREA"===e.tagName},Ca=function(e){return"SELECT"===e.tagName},Sa=function(e){return"SLOT"===e.tagName},Ea=function(e){return e.tagName.indexOf("-")>0},Ma=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},e.prototype.pop=function(e){var t=this;e.forEach((function(e){return t.counters[e].pop()}))},e.prototype.parse=function(e){var t=this,i=e.counterIncrement,r=e.counterReset,n=!0;null!==i&&i.forEach((function(e){var i=t.counters[e.counter];i&&0!==e.increment&&(n=!1,i.length||i.push(1),i[Math.max(0,i.length-1)]+=e.increment)}));var o=[];return n&&r.forEach((function(e){var i=t.counters[e.counter];o.push(e.counter),i||(i=t.counters[e.counter]=[]),i.push(e.reset)})),o},e}(),Ia={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Pa={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},La={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Fa={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},ka=function(e,t,i,r,n,o){return ei?Za(e,n,o.length>0):r.integers.reduce((function(t,i,n){for(;e>=i;)e-=i,t+=r.values[n];return t}),"")+o},za=function(e,t,i,r){var n="";do{i||e--,n=r(e)+n,e/=t}while(e*t>=t);return n},Ra=function(e,t,i,r,n){var o=i-t+1;return(e<0?"-":"")+(za(Math.abs(e),o,r,(function(e){return u(Math.floor(e%o)+t)}))+n)},Da=function(e,t,i){void 0===i&&(i=". ");var r=t.length;return za(Math.abs(e),r,!1,(function(e){return t[Math.floor(e%r)]}))+i},Oa=1,Ua=2,Na=4,Qa=8,ja=function(e,t,i,r,n,o){if(e<-9999||e>9999)return Za(e,4,n.length>0);var s=Math.abs(e),a=n;if(0===s)return t[0]+a;for(var l=0;s>0&&l<=4;l++){var c=s%10;0===c&&oo(o,Oa)&&""!==a?a=t[c]+a:c>1||1===c&&0===l||1===c&&1===l&&oo(o,Ua)||1===c&&1===l&&oo(o,Na)&&e>100||1===c&&l>1&&oo(o,Qa)?a=t[c]+(l>0?i[l-1]:"")+a:1===c&&l>0&&(a=i[l-1]+a),s=Math.floor(s/10)}return(e<0?r:"")+a},Va="十百千萬",Ha="拾佰仟萬",Ga="マイナス",$a="마이너스",Za=function(e,t,i){var r=i?". ":"",n=i?"、":"",o=i?", ":"",s=i?" ":"";switch(t){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var a=Ra(e,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return Da(e,"〇一二三四五六七八九",n);case 6:return ka(e,1,3999,Ia,3,r).toLowerCase();case 7:return ka(e,1,3999,Ia,3,r);case 8:return Ra(e,945,969,!1,r);case 9:return Ra(e,97,122,!1,r);case 10:return Ra(e,65,90,!1,r);case 11:return Ra(e,1632,1641,!0,r);case 12:case 49:return ka(e,1,9999,Pa,3,r);case 35:return ka(e,1,9999,Pa,3,r).toLowerCase();case 13:return Ra(e,2534,2543,!0,r);case 14:case 30:return Ra(e,6112,6121,!0,r);case 15:return Da(e,"子丑寅卯辰巳午未申酉戌亥",n);case 16:return Da(e,"甲乙丙丁戊己庚辛壬癸",n);case 17:case 48:return ja(e,"零一二三四五六七八九",Va,"負",n,Ua|Na|Qa);case 47:return ja(e,"零壹貳參肆伍陸柒捌玖",Ha,"負",n,Oa|Ua|Na|Qa);case 42:return ja(e,"零一二三四五六七八九",Va,"负",n,Ua|Na|Qa);case 41:return ja(e,"零壹贰叁肆伍陆柒捌玖",Ha,"负",n,Oa|Ua|Na|Qa);case 26:return ja(e,"〇一二三四五六七八九","十百千万",Ga,n,0);case 25:return ja(e,"零壱弐参四伍六七八九","拾百千万",Ga,n,Oa|Ua|Na);case 31:return ja(e,"영일이삼사오육칠팔구","십백천만",$a,o,Oa|Ua|Na);case 33:return ja(e,"零一二三四五六七八九","十百千萬",$a,o,0);case 32:return ja(e,"零壹貳參四五六七八九","拾百千",$a,o,Oa|Ua|Na);case 18:return Ra(e,2406,2415,!0,r);case 20:return ka(e,1,19999,Fa,3,r);case 21:return Ra(e,2790,2799,!0,r);case 22:return Ra(e,2662,2671,!0,r);case 22:return ka(e,1,10999,La,3,r);case 23:return Da(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Da(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ra(e,3302,3311,!0,r);case 28:return Da(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",n);case 29:return Da(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",n);case 34:return Ra(e,3792,3801,!0,r);case 37:return Ra(e,6160,6169,!0,r);case 38:return Ra(e,4160,4169,!0,r);case 39:return Ra(e,2918,2927,!0,r);case 40:return Ra(e,1776,1785,!0,r);case 43:return Ra(e,3046,3055,!0,r);case 44:return Ra(e,3174,3183,!0,r);case 45:return Ra(e,3664,3673,!0,r);case 46:return Ra(e,3872,3881,!0,r);default:return Ra(e,48,57,!0,r)}},qa="data-html2canvas-ignore",Ka=function(){function e(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new Ma,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var i=this,o=Xa(e,t);if(!o.contentWindow)return Promise.reject("Unable to find iframe window");var s=e.defaultView.pageXOffset,a=e.defaultView.pageYOffset,l=o.contentWindow,c=l.document,u=el(o).then((function(){return r(i,void 0,void 0,(function(){var e,i;return n(this,(function(r){switch(r.label){case 0:return this.scrolledElements.forEach(ol),l&&(l.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||l.scrollY===t.top&&l.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(l.scrollX-t.left,l.scrollY-t.top,0,0))),e=this.options.onclone,void 0===(i=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:c.fonts&&c.fonts.ready?[4,c.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Ja(c)]:[3,4];case 3:r.sent(),r.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then((function(){return e(c,i)})).then((function(){return o}))]:[2,o]}}))}))}));return c.open(),c.write(rl(document.doctype)+""),nl(this.referenceElement.ownerDocument,s,a),c.replaceChild(c.adoptNode(this.documentElement),c.documentElement),c.close(),u},e.prototype.createElementClone=function(e){if(wo(e,2),ya(e))return this.createCanvasClone(e);if(va(e))return this.createVideoClone(e);if(wa(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return xa(t)&&(xa(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),Ea(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return il(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce((function(e,t){return t&&"string"==typeof t.cssText?e+t.cssText:e}),""),r=e.cloneNode(!1);return r.textContent=i,r}}catch(e){if(this.context.logger.error("Unable to access cssRules property",e),"SecurityError"!==e.name)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch(t){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var n=e.getContext("2d"),o=r.getContext("2d");if(o)if(!this.options.allowTaint&&n)o.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var s=null!==(t=e.getContext("webgl2"))&&void 0!==t?t:e.getContext("webgl");if(s){var a=s.getContextAttributes();!1===(null==a?void 0:a.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}o.drawImage(e,0,0)}return r}catch(t){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch(t){this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,i){ua(t)&&(Ta(t)||t.hasAttribute(qa)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&ua(t)&&wa(t)||e.appendChild(this.cloneNode(t,i))},e.prototype.cloneChildNodes=function(e,t,i){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(ua(n)&&Sa(n)&&"function"==typeof n.assignedNodes){var o=n.assignedNodes();o.length&&o.forEach((function(e){return r.appendChildNode(t,e,i)}))}else this.appendChildNode(t,n,i)},e.prototype.cloneNode=function(e,t){if(ca(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&ua(e)&&(ha(e)||da(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=i.getComputedStyle(e),o=i.getComputedStyle(e,":before"),s=i.getComputedStyle(e,":after");this.referenceElement===e&&ha(r)&&(this.clonedReferenceElement=r),_a(r)&&hl(r);var a=this.counters.parse(new yo(this.context,n)),l=this.resolvePseudoContent(e,r,o,Zo.BEFORE);Ea(e)&&(t=!0),va(e)||this.cloneChildNodes(e,r,t),l&&r.insertBefore(l,r.firstChild);var c=this.resolvePseudoContent(e,r,s,Zo.AFTER);return c&&r.appendChild(c),this.counters.pop(a),(n&&(this.options.copyStyles||da(e))&&!ba(e)||t)&&il(n,r),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ba(e)||Ca(e))&&(Ba(r)||Ca(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,i,r){var n=this;if(i){var o=i.content,s=t.ownerDocument;if(s&&o&&"none"!==o&&"-moz-alt-content"!==o&&"none"!==i.display){this.counters.parse(new yo(this.context,i));var a=new _o(this.context,i),l=s.createElement("html2canvaspseudoelement");il(i,l),a.content.forEach((function(t){if(0===t.type)l.appendChild(s.createTextNode(t.value));else if(22===t.type){var i=s.createElement("img");i.src=t.value,i.style.opacity="1",l.appendChild(i)}else if(18===t.type){if("attr"===t.name){var r=t.values.filter(Li);r.length&&l.appendChild(s.createTextNode(e.getAttribute(r[0].value)||""))}else if("counter"===t.name){var o=t.values.filter(Ri),c=o[0],u=o[1];if(c&&Li(c)){var h=n.counters.getCounterValue(c.value),d=u&&Li(u)?Bn.parse(n.context,u.value):3;l.appendChild(s.createTextNode(Za(h,d,!1)))}}else if("counters"===t.name){var p=t.values.filter(Ri),f=(c=p[0],p[1]);if(u=p[2],c&&Li(c)){var A=n.counters.getCounterValues(c.value),m=u&&Li(u)?Bn.parse(n.context,u.value):3,g=f&&0===f.type?f.value:"",_=A.map((function(e){return Za(e,m,!1)})).join(g);l.appendChild(s.createTextNode(_))}}}else if(20===t.type)switch(t.value){case"open-quote":l.appendChild(s.createTextNode(ho(a.quotes,n.quoteDepth++,!0)));break;case"close-quote":l.appendChild(s.createTextNode(ho(a.quotes,--n.quoteDepth,!1)));break;default:l.appendChild(s.createTextNode(t.value))}})),l.className=ll+" "+cl;var c=r===Zo.BEFORE?" "+ll:" "+cl;return da(t)?t.className.baseValue+=c:t.className+=c,l}}},e.destroy=function(e){return!!e.parentNode&&(e.parentNode.removeChild(e),!0)},e}();!function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"}(Zo||(Zo={}));var Wa,Xa=function(e,t){var i=e.createElement("iframe");return i.className="html2canvas-container",i.style.visibility="hidden",i.style.position="fixed",i.style.left="-10000px",i.style.top="0px",i.style.border="0",i.width=t.width.toString(),i.height=t.height.toString(),i.scrolling="no",i.setAttribute(qa,"true"),e.body.appendChild(i),i},Ya=function(e){return new Promise((function(t){e.complete?t():e.src?(e.onload=t,e.onerror=t):t()}))},Ja=function(e){return Promise.all([].slice.call(e.images,0).map(Ya))},el=function(e){return new Promise((function(t,i){var r=e.contentWindow;if(!r)return i("No window assigned for iframe");var n=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var i=setInterval((function(){n.body.childNodes.length>0&&"complete"===n.readyState&&(clearInterval(i),t(e))}),50)}}))},tl=["all","d","content"],il=function(e,t){for(var i=e.length-1;i>=0;i--){var r=e.item(i);-1===tl.indexOf(r)&&t.style.setProperty(r,e.getPropertyValue(r))}return t},rl=function(e){var t="";return e&&(t+=""),t},nl=function(e,t,i){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||i!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,i)},ol=function(e){var t=e[0],i=e[1],r=e[2];t.scrollLeft=i,t.scrollTop=r},sl=":before",al=":after",ll="___html2canvas___pseudoelement_before",cl="___html2canvas___pseudoelement_after",ul='{\n content: "" !important;\n display: none !important;\n}',hl=function(e){dl(e,"."+ll+sl+ul+"\n ."+cl+al+ul)},dl=function(e,t){var i=e.ownerDocument;if(i){var r=i.createElement("style");r.textContent=t,e.appendChild(r)}},pl=function(){function e(){}return e.getOrigin=function(t){var i=e._link;return i?(i.href=t,i.href=i.href,i.protocol+i.hostname+i.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),fl=function(){function e(e,t){this.context=e,this._options=t,this._cache={}}return e.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)?t:xl(e)||_l(e)?((this._cache[e]=this.loadImage(e)).catch((function(){})),t):t},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return r(this,void 0,void 0,(function(){var t,i,r,o,s=this;return n(this,(function(n){switch(n.label){case 0:return t=pl.isSameOrigin(e),i=!yl(e)&&!0===this._options.useCORS&&Cs.SUPPORT_CORS_IMAGES&&!t,r=!yl(e)&&!t&&!xl(e)&&"string"==typeof this._options.proxy&&Cs.SUPPORT_CORS_XHR&&!i,t||!1!==this._options.allowTaint||yl(e)||xl(e)||r||i?(o=e,r?[4,this.proxy(o)]:[3,2]):[2];case 1:o=n.sent(),n.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise((function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,(vl(o)||i)&&(r.crossOrigin="anonymous"),r.src=o,!0===r.complete&&setTimeout((function(){return e(r)}),500),s._options.imageTimeout>0&&setTimeout((function(){return t("Timed out ("+s._options.imageTimeout+"ms) loading image")}),s._options.imageTimeout)}))];case 3:return[2,n.sent()]}}))}))},e.prototype.has=function(e){return void 0!==this._cache[e]},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(e){var t=this,i=this._options.proxy;if(!i)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise((function(n,o){var s=Cs.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(200===a.status)if("text"===s)n(a.response);else{var e=new FileReader;e.addEventListener("load",(function(){return n(e.result)}),!1),e.addEventListener("error",(function(e){return o(e)}),!1),e.readAsDataURL(a.response)}else o("Failed to proxy resource "+r+" with status code "+a.status)},a.onerror=o;var l=i.indexOf("?")>-1?"&":"?";if(a.open("GET",""+i+l+"url="+encodeURIComponent(e)+"&responseType="+s),"text"!==s&&a instanceof XMLHttpRequest&&(a.responseType=s),t._options.imageTimeout){var c=t._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return o("Timed out ("+c+"ms) proxying "+r)}}a.send()}))},e}(),Al=/^data:image\/svg\+xml/i,ml=/^data:image\/.*;base64,/i,gl=/^data:image\/.*/i,_l=function(e){return Cs.SUPPORT_SVG_DRAWING||!bl(e)},yl=function(e){return gl.test(e)},vl=function(e){return ml.test(e)},xl=function(e){return"blob"===e.substr(0,4)},bl=function(e){return"svg"===e.substr(-3).toLowerCase()||Al.test(e)},wl=function(){function e(e,t){this.type=0,this.x=e,this.y=t}return e.prototype.add=function(t,i){return new e(this.x+t,this.y+i)},e}(),Tl=function(e,t,i){return new wl(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i)},Bl=function(){function e(e,t,i,r){this.type=1,this.start=e,this.startControl=t,this.endControl=i,this.end=r}return e.prototype.subdivide=function(t,i){var r=Tl(this.start,this.startControl,t),n=Tl(this.startControl,this.endControl,t),o=Tl(this.endControl,this.end,t),s=Tl(r,n,t),a=Tl(n,o,t),l=Tl(s,a,t);return i?new e(this.start,r,s,l):new e(l,a,o,this.end)},e.prototype.add=function(t,i){return new e(this.start.add(t,i),this.startControl.add(t,i),this.endControl.add(t,i),this.end.add(t,i))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Cl=function(e){return 1===e.type},Sl=function(){function e(e){var t=e.styles,i=e.bounds,r=Gi(t.borderTopLeftRadius,i.width,i.height),n=r[0],o=r[1],s=Gi(t.borderTopRightRadius,i.width,i.height),a=s[0],l=s[1],c=Gi(t.borderBottomRightRadius,i.width,i.height),u=c[0],h=c[1],d=Gi(t.borderBottomLeftRadius,i.width,i.height),p=d[0],f=d[1],A=[];A.push((n+a)/i.width),A.push((p+u)/i.width),A.push((o+f)/i.height),A.push((l+h)/i.height);var m=Math.max.apply(Math,A);m>1&&(n/=m,o/=m,a/=m,l/=m,u/=m,h/=m,p/=m,f/=m);var g=i.width-a,_=i.height-h,y=i.width-u,v=i.height-f,x=t.borderTopWidth,b=t.borderRightWidth,w=t.borderBottomWidth,T=t.borderLeftWidth,B=$i(t.paddingTop,e.bounds.width),C=$i(t.paddingRight,e.bounds.width),S=$i(t.paddingBottom,e.bounds.width),E=$i(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||o>0?El(i.left+T/3,i.top+x/3,n-T/3,o-x/3,Wa.TOP_LEFT):new wl(i.left+T/3,i.top+x/3),this.topRightBorderDoubleOuterBox=n>0||o>0?El(i.left+g,i.top+x/3,a-b/3,l-x/3,Wa.TOP_RIGHT):new wl(i.left+i.width-b/3,i.top+x/3),this.bottomRightBorderDoubleOuterBox=u>0||h>0?El(i.left+y,i.top+_,u-b/3,h-w/3,Wa.BOTTOM_RIGHT):new wl(i.left+i.width-b/3,i.top+i.height-w/3),this.bottomLeftBorderDoubleOuterBox=p>0||f>0?El(i.left+T/3,i.top+v,p-T/3,f-w/3,Wa.BOTTOM_LEFT):new wl(i.left+T/3,i.top+i.height-w/3),this.topLeftBorderDoubleInnerBox=n>0||o>0?El(i.left+2*T/3,i.top+2*x/3,n-2*T/3,o-2*x/3,Wa.TOP_LEFT):new wl(i.left+2*T/3,i.top+2*x/3),this.topRightBorderDoubleInnerBox=n>0||o>0?El(i.left+g,i.top+2*x/3,a-2*b/3,l-2*x/3,Wa.TOP_RIGHT):new wl(i.left+i.width-2*b/3,i.top+2*x/3),this.bottomRightBorderDoubleInnerBox=u>0||h>0?El(i.left+y,i.top+_,u-2*b/3,h-2*w/3,Wa.BOTTOM_RIGHT):new wl(i.left+i.width-2*b/3,i.top+i.height-2*w/3),this.bottomLeftBorderDoubleInnerBox=p>0||f>0?El(i.left+2*T/3,i.top+v,p-2*T/3,f-2*w/3,Wa.BOTTOM_LEFT):new wl(i.left+2*T/3,i.top+i.height-2*w/3),this.topLeftBorderStroke=n>0||o>0?El(i.left+T/2,i.top+x/2,n-T/2,o-x/2,Wa.TOP_LEFT):new wl(i.left+T/2,i.top+x/2),this.topRightBorderStroke=n>0||o>0?El(i.left+g,i.top+x/2,a-b/2,l-x/2,Wa.TOP_RIGHT):new wl(i.left+i.width-b/2,i.top+x/2),this.bottomRightBorderStroke=u>0||h>0?El(i.left+y,i.top+_,u-b/2,h-w/2,Wa.BOTTOM_RIGHT):new wl(i.left+i.width-b/2,i.top+i.height-w/2),this.bottomLeftBorderStroke=p>0||f>0?El(i.left+T/2,i.top+v,p-T/2,f-w/2,Wa.BOTTOM_LEFT):new wl(i.left+T/2,i.top+i.height-w/2),this.topLeftBorderBox=n>0||o>0?El(i.left,i.top,n,o,Wa.TOP_LEFT):new wl(i.left,i.top),this.topRightBorderBox=a>0||l>0?El(i.left+g,i.top,a,l,Wa.TOP_RIGHT):new wl(i.left+i.width,i.top),this.bottomRightBorderBox=u>0||h>0?El(i.left+y,i.top+_,u,h,Wa.BOTTOM_RIGHT):new wl(i.left+i.width,i.top+i.height),this.bottomLeftBorderBox=p>0||f>0?El(i.left,i.top+v,p,f,Wa.BOTTOM_LEFT):new wl(i.left,i.top+i.height),this.topLeftPaddingBox=n>0||o>0?El(i.left+T,i.top+x,Math.max(0,n-T),Math.max(0,o-x),Wa.TOP_LEFT):new wl(i.left+T,i.top+x),this.topRightPaddingBox=a>0||l>0?El(i.left+Math.min(g,i.width-b),i.top+x,g>i.width+b?0:Math.max(0,a-b),Math.max(0,l-x),Wa.TOP_RIGHT):new wl(i.left+i.width-b,i.top+x),this.bottomRightPaddingBox=u>0||h>0?El(i.left+Math.min(y,i.width-T),i.top+Math.min(_,i.height-w),Math.max(0,u-b),Math.max(0,h-w),Wa.BOTTOM_RIGHT):new wl(i.left+i.width-b,i.top+i.height-w),this.bottomLeftPaddingBox=p>0||f>0?El(i.left+T,i.top+Math.min(v,i.height-w),Math.max(0,p-T),Math.max(0,f-w),Wa.BOTTOM_LEFT):new wl(i.left+T,i.top+i.height-w),this.topLeftContentBox=n>0||o>0?El(i.left+T+E,i.top+x+B,Math.max(0,n-(T+E)),Math.max(0,o-(x+B)),Wa.TOP_LEFT):new wl(i.left+T+E,i.top+x+B),this.topRightContentBox=a>0||l>0?El(i.left+Math.min(g,i.width+T+E),i.top+x+B,g>i.width+T+E?0:a-T+E,l-(x+B),Wa.TOP_RIGHT):new wl(i.left+i.width-(b+C),i.top+x+B),this.bottomRightContentBox=u>0||h>0?El(i.left+Math.min(y,i.width-(T+E)),i.top+Math.min(_,i.height+x+B),Math.max(0,u-(b+C)),h-(w+S),Wa.BOTTOM_RIGHT):new wl(i.left+i.width-(b+C),i.top+i.height-(w+S)),this.bottomLeftContentBox=p>0||f>0?El(i.left+T+E,i.top+v,Math.max(0,p-(T+E)),f-(w+S),Wa.BOTTOM_LEFT):new wl(i.left+T+E,i.top+i.height-(w+S))}return e}();!function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(Wa||(Wa={}));var El=function(e,t,i,r,n){var o=(Math.sqrt(2)-1)/3*4,s=i*o,a=r*o,l=e+i,c=t+r;switch(n){case Wa.TOP_LEFT:return new Bl(new wl(e,c),new wl(e,c-a),new wl(l-s,t),new wl(l,t));case Wa.TOP_RIGHT:return new Bl(new wl(e,t),new wl(e+s,t),new wl(l,c-a),new wl(l,c));case Wa.BOTTOM_RIGHT:return new Bl(new wl(l,t),new wl(l,t+a),new wl(e+s,c),new wl(e,c));case Wa.BOTTOM_LEFT:default:return new Bl(new wl(l,c),new wl(l-s,c),new wl(e,t+a),new wl(e,t))}},Ml=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Il=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},Pl=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Ll=function(){function e(e,t,i){this.offsetX=e,this.offsetY=t,this.matrix=i,this.type=0,this.target=6}return e}(),Fl=function(){function e(e,t){this.path=e,this.target=t,this.type=1}return e}(),kl=function(){function e(e){this.opacity=e,this.type=2,this.target=6}return e}(),zl=function(e){return 0===e.type},Rl=function(e){return 1===e.type},Dl=function(e){return 2===e.type},Ol=function(e,t){return e.length===t.length&&e.some((function(e,i){return e===t[i]}))},Ul=function(e,t,i,r,n){return e.map((function(e,o){switch(o){case 0:return e.add(t,i);case 1:return e.add(t+r,i);case 2:return e.add(t+r,i+n);case 3:return e.add(t,i+n)}return e}))},Nl=function(){function e(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),Ql=function(){function e(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Sl(this.container),this.container.styles.opacity<1&&this.effects.push(new kl(this.container.styles.opacity)),null!==this.container.styles.transform){var i=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new Ll(i,r,n))}if(0!==this.container.styles.overflowX){var o=Ml(this.curves),s=Pl(this.curves);Ol(o,s)?this.effects.push(new Fl(o,6)):(this.effects.push(new Fl(o,2)),this.effects.push(new Fl(s,4)))}}return e.prototype.getEffects=function(e){for(var t=-1===[2,3].indexOf(this.container.styles.position),i=this.parent,r=this.effects.slice(0);i;){var n=i.effects.filter((function(e){return!Rl(e)}));if(t||0!==i.container.styles.position||!i.parent){if(r.unshift.apply(r,n),t=-1===[2,3].indexOf(i.container.styles.position),0!==i.container.styles.overflowX){var o=Ml(i.curves),s=Pl(i.curves);Ol(o,s)||r.unshift(new Fl(s,6))}}else r.unshift.apply(r,n);i=i.parent}return r.filter((function(t){return oo(t.target,e)}))},e}(),jl=function(e,t,i,r){e.container.elements.forEach((function(n){var o=oo(n.flags,4),s=oo(n.flags,2),a=new Ql(n,e);oo(n.styles.display,2048)&&r.push(a);var l=oo(n.flags,8)?[]:r;if(o||s){var c=o||n.styles.isPositioned()?i:t,u=new Nl(a);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var d=0;c.negativeZIndex.some((function(e,t){return h>e.element.container.styles.zIndex.order?(d=t,!1):d>0})),c.negativeZIndex.splice(d,0,u)}else if(h>0){var p=0;c.positiveZIndex.some((function(e,t){return h>=e.element.container.styles.zIndex.order?(p=t+1,!1):p>0})),c.positiveZIndex.splice(p,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else n.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);jl(a,u,o?u:i,l)}else n.styles.isInlineLevel()?t.inlineLevel.push(a):t.nonInlineLevel.push(a),jl(a,t,i,l);oo(n.flags,8)&&Vl(n,l)}))},Vl=function(e,t){for(var i=e instanceof Hs?e.start:1,r=e instanceof Hs&&e.reversed,n=0;n0&&e.intrinsicHeight>0){var r=Yl(e),n=Pl(t);this.path(n),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,e.intrinsicWidth,e.intrinsicHeight,r.left,r.top,r.width,r.height),this.ctx.restore()}},i.prototype.renderNodeContent=function(e){return r(this,void 0,void 0,(function(){var t,r,o,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x;return n(this,(function(n){switch(n.label){case 0:this.applyEffects(e.getEffects(4)),t=e.container,r=e.curves,o=t.styles,a=0,l=t.textNodes,n.label=1;case 1:return a0&&T>0&&(_=r.ctx.createPattern(A,"repeat"),r.renderRepeat(v,_,C,S))):Fr(i)&&(y=tc(e,t,[null,null,null]),v=y[0],x=y[1],b=y[2],w=y[3],T=y[4],B=0===i.position.length?[Vi]:i.position,C=$i(B[0],w),S=$i(B[B.length-1],T),E=vr(i,C,S,w,T),M=E[0],I=E[1],M>0&&I>0&&(P=r.ctx.createRadialGradient(x+C,b+S,0,x+C,b+S,M),Ar(i.stops,2*M).forEach((function(e){return P.addColorStop(e.stop,rr(e.color))})),r.path(v),r.ctx.fillStyle=P,M!==I?(L=e.bounds.left+.5*e.bounds.width,F=e.bounds.top+.5*e.bounds.height,z=1/(k=I/M),r.ctx.save(),r.ctx.translate(L,F),r.ctx.transform(1,0,0,k,0,0),r.ctx.translate(-L,-F),r.ctx.fillRect(x,z*(b-F)+F,w,T*z),r.ctx.restore()):r.ctx.fill())),n.label=6;case 6:return t--,[2]}}))},r=this,o=0,s=e.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return o0?2!==c.style?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,s,e.curves,2)]:[3,11]:[3,13];case 4:return n.sent(),[3,11];case 5:return 3!==c.style?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,s,e.curves,3)];case 6:return n.sent(),[3,11];case 7:return 4!==c.style?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,s,e.curves)];case 8:return n.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,s,e.curves)];case 10:n.sent(),n.label=11;case 11:s++,n.label=12;case 12:return a++,[3,3];case 13:return[2]}}))}))},i.prototype.renderDashedDottedBorder=function(e,t,i,o,s){return r(this,void 0,void 0,(function(){var r,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x;return n(this,(function(n){return this.ctx.save(),r=ql(o,i),a=Gl(o,i),2===s&&(this.path(a),this.ctx.clip()),Cl(a[0])?(l=a[0].start.x,c=a[0].start.y):(l=a[0].x,c=a[0].y),Cl(a[1])?(u=a[1].end.x,h=a[1].end.y):(u=a[1].x,h=a[1].y),d=0===i||2===i?Math.abs(l-u):Math.abs(c-h),this.ctx.beginPath(),3===s?this.formatPath(r):this.formatPath(a.slice(0,2)),p=t<3?3*t:2*t,f=t<3?2*t:t,3===s&&(p=t,f=t),A=!0,d<=2*p?A=!1:d<=2*p+f?(p*=m=d/(2*p+f),f*=m):(g=Math.floor((d+f)/(p+f)),_=(d-g*p)/(g-1),f=(y=(d-(g+1)*p)/g)<=0||Math.abs(f-_){};return function(e,t){for(const{type:i,value:r,id:n}of e){if(document.getElementById(n))return void("script"===i&&t());const e=document.createElement(i);e.id=n,"script"===i?(e.async=!0,e.defer=!0,e.src=r,e.onload=()=>t()):(e.rel="stylesheet",e.href=r),document.body.appendChild(e)}}(i,(()=>{n=function(e,t){const i=new window.MapboxGeocoder(e);i.addTo(`#${t.id}`),e.value&&i.setInput(e.value);return function(e,t,i,r){const n=[];for(const[o,s]of Object.entries(t)){const t=t=>{const[n,o]=s(e,t,i);r.dispatchEvent(new CustomEvent(n,{detail:o}))};e.on(o,t),n.push([o,t])}return()=>{for(const[t,i]of n)e.off(t,i)}}(i,xd,!1,t)}(t,e)})),{destroy(){n()}}}const xd={results:(e,t)=>["results",t],result:(e,t)=>["result",t],loading:(e,t)=>["loading",t],error:(e,t)=>["error",t],clear:(e,t)=>["clear",t],load:e=>["ready",{geocoder:e}]};function bd(e){let i,r,n;return{c(){i=b("div"),E(i,"id",e[0]),E(i,"class","svelte-1k1b3t4")},m(t,o){y(t,i,o),r||(n=[g(vd.call(null,i,e[1])),S(i,"ready",e[2]),S(i,"results",e[11]),S(i,"result",e[12]),S(i,"loading",e[13]),S(i,"error",e[14]),S(i,"clear",e[15]),S(i,"load",e[16])],r=!0)},p:t,i:t,o:t,d(e){e&&v(i),r=!1,o(n)}}}function wd(e,t,i){let{accessToken:r}=t,{options:n={}}=t,{version:o="v4.5.1"}=t,{types:s=["country","region","postcode","district","place","locality","neighborhood","address"]}=t,{placeholder:a="Search"}=t,{value:l=null}=t,{customStylesheetUrl:c=!1}=t,{geocoder:u}=t;const h=H(),d="bsm-"+Math.random().toString(36).substring(6),p=Object.assign({version:o,accessToken:r,types:s.join(","),placeholder:a,customStylesheetUrl:c,value:l},n);return e.$$set=e=>{"accessToken"in e&&i(4,r=e.accessToken),"options"in e&&i(5,n=e.options),"version"in e&&i(6,o=e.version),"types"in e&&i(7,s=e.types),"placeholder"in e&&i(8,a=e.placeholder),"value"in e&&i(9,l=e.value),"customStylesheetUrl"in e&&i(10,c=e.customStylesheetUrl),"geocoder"in e&&i(3,u=e.geocoder)},[d,p,function({detail:e}){i(3,u=e.geocoder),h("ready")},u,r,n,o,s,a,l,c,function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(t){G.call(this,e,t)}]}class Td extends me{constructor(e){super(),Ae(this,e,wd,bd,a,{accessToken:4,options:5,version:6,types:7,placeholder:8,value:9,customStylesheetUrl:10,geocoder:3})}}function Bd(e){let t,i,r;return i=new Vu({props:{options:e[1].map(Cd),activeValue:e[0],onSelect:e[2],direction:"down"}}),{c(){t=b("div"),de(i.$$.fragment),E(t,"class","dropdown-container svelte-1yvkhcz")},m(e,n){y(e,t,n),pe(i,t,null),r=!0},p(e,[t]){const r={};2&t&&(r.options=e[1].map(Cd)),1&t&&(r.activeValue=e[0]),4&t&&(r.onSelect=e[2]),i.$set(r)},i(e){r||(le(i.$$.fragment,e),r=!0)},o(e){ce(i.$$.fragment,e),r=!1},d(e){e&&v(t),fe(i)}}}const Cd=e=>({label:e,value:e});function Sd(e,t,i){let r,n;l(e,Le,(e=>i(5,n=e)));let{mode:o}=t,{mapsNum:s}=t;const a=H();let c=o??"",u=zh;const h=e=>{1===e&&i(1,u=zh.filter((e=>"swipe"!==e))),2===e&&i(1,u=zh.filter((e=>"responsive"!==e))),e>2&&e<=4&&i(1,u=zh.filter((e=>"swipe"!==e&&"responsive"!==e))),e>4&&i(1,u=zh.filter((e=>"swipe"!==e&&"phone"!==e&&"responsive"!==e))),n||i(1,u=["mirror"]),u.includes(c)||i(0,c=u[0])};return Le.subscribe((()=>{h(s)})),e.$$set=e=>{"mode"in e&&i(3,o=e.mode),"mapsNum"in e&&i(4,s=e.mapsNum)},e.$$.update=()=>{var t;16&e.$$.dirty&&h(s),1&e.$$.dirty&&(e=>{a("viewMode",{mode:e})})(c),8&e.$$.dirty&&(t=o)!==c&&i(0,c=t)},i(2,r=e=>{i(0,c=e)}),[c,u,r,o,s]}class Ed extends me{constructor(e){super(),Ae(this,e,Sd,Bd,a,{mode:3,mapsNum:4})}}function Md(e){let t,i,r;return i=new Vu({props:{placeholder:"Go to...",options:e[3],activeValue:e[1],onSelect:e[2],direction:"down"}}),{c(){t=b("div"),de(i.$$.fragment),E(t,"class","dropdown-container svelte-1ho45wf")},m(e,n){y(e,t,n),pe(i,t,null),r=!0},p(e,t){const r={};8&t&&(r.options=e[3]),2&t&&(r.activeValue=e[1]),4&t&&(r.onSelect=e[2]),i.$set(r)},i(e){r||(le(i.$$.fragment,e),r=!0)},o(e){ce(i.$$.fragment,e),r=!1},d(e){e&&v(t),fe(i)}}}function Id(e){let t,i,r=e[0]&&Md(e);return{c(){r&&r.c(),t=C()},m(e,n){r&&r.m(e,n),y(e,t,n),i=!0},p(e,[i]){e[0]?r?(r.p(e,i),1&i&&le(r,1)):(r=Md(e),r.c(),le(r,1),r.m(t.parentNode,t)):r&&(se(),ce(r,1,1,(()=>{r=null})),ae())},i(e){i||(le(r),i=!0)},o(e){ce(r),i=!1},d(e){r&&r.d(e),e&&v(t)}}}function Pd(e,t,i){let r,n,{bearing:o}=t,{center:s}=t,{pitch:a}=t,{zoom:l}=t;const c=H();let u;Ie.subscribe((e=>i(0,({gazetteer:u}=e),u)));const h=(e,t)=>Number.parseFloat(e).toFixed(t),d=e=>{if(!u)return"";const t=Object.keys(u).reduce(((e,t)=>e=e.concat(u[t])),[]).find((t=>{const i=Object.values(t)[0];return Object.keys(i).every((t=>{if("center"===t&&e.center){const{lng:t,lat:r}=i.center,{lng:n,lat:o}=e.center;return h(t,4)===h(n,4)&&h(r,4)===h(o,4)}return h(i[t],2)===h(e[t],2)}))}));return t?JSON.stringify(t):""};let p=d({zoom:l,center:s,pitch:a,bearing:o});const f=()=>{const{options:e}=(e=>{if(!e)return{};try{const t=JSON.parse(e),i=Object.keys(t)[0],r=t[i];return c("mapState",{options:r}),{label:i,options:r}}catch(e){return console.error(e),{}}})(p);e&&c("mapState",{options:e})};return e.$$set=e=>{"bearing"in e&&i(4,o=e.bearing),"center"in e&&i(5,s=e.center),"pitch"in e&&i(6,a=e.pitch),"zoom"in e&&i(7,l=e.zoom)},e.$$.update=()=>{240&e.$$.dirty&&(e=>{const t=d(e);p!==t&&i(1,p=t??"")})({zoom:l,center:s,pitch:a,bearing:o}),2&e.$$.dirty&&f(),1&e.$$.dirty&&i(3,r=Object.entries(u).reduce(((e,[t,i])=>{e.push({header:t});for(const t of i){let[i,r]=Object.entries(t)[0];e.push({label:i,value:JSON.stringify(t)})}return e}),[]))},i(2,n=e=>{i(1,p=e)}),[u,p,n,r,o,s,a,l]}class Ld extends me{constructor(e){super(),Ae(this,e,Pd,Id,a,{bearing:4,center:5,pitch:6,zoom:7})}}function Fd(e){let t,i;return{c(){t=b("div"),i=T(e[0]),F(t,"top",e[3]+"px"),F(t,"left",e[2]+"px"),E(t,"class","tooltip svelte-1qc780y")},m(e,r){y(e,t,r),_(t,i)},p(e,r){1&r&&I(i,e[0]),8&r&&F(t,"top",e[3]+"px"),4&r&&F(t,"left",e[2]+"px")},d(e){e&&v(t)}}}function kd(e){let t,i,r,n,s,a;const l=e[8].default,u=c(l,e,e[7],null);let f=e[1]&&Fd(e);return{c(){t=b("div"),u&&u.c(),i=B(),f&&f.c(),r=C()},m(o,l){y(o,t,l),u&&u.m(t,null),y(o,i,l),f&&f.m(o,l),y(o,r,l),n=!0,s||(a=[S(t,"mouseover",e[4]),S(t,"mouseleave",e[6]),S(t,"mousemove",e[5])],s=!0)},p(e,[t]){u&&u.p&&(!n||128&t)&&d(u,l,e,e[7],n?h(l,e[7],t,null):p(e[7]),null),e[1]?f?f.p(e,t):(f=Fd(e),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},i(e){n||(le(u,e),n=!0)},o(e){ce(u,e),n=!1},d(e){e&&v(t),u&&u.d(e),e&&v(i),f&&f.d(e),e&&v(r),s=!1,o(a)}}}function zd(e,t,i){let r,n,{$$slots:o={},$$scope:s}=t,{title:a=""}=t,l=!1;return e.$$set=e=>{"title"in e&&i(0,a=e.title),"$$scope"in e&&i(7,s=e.$$scope)},[a,l,r,n,function(e){i(1,l=!0),i(2,r=e.pageX+5),i(3,n=e.pageY+5)},function(e){i(2,r=e.pageX+5),i(3,n=e.pageY+5)},function(){i(1,l=!1)},s,o]}class Rd extends me{constructor(e){super(),Ae(this,e,zd,kd,a,{title:0})}}function Dd(e,t,i){const r=e.slice();return r[27]=t[i],r}function Od(e){let i,r,n,s,a;return r=new hu({props:{icon:Xc}}),{c(){i=b("button"),de(r.$$.fragment),E(i,"class","fullscreen-btn show-ui svelte-1g6kozd"),E(i,"title","Show UI")},m(t,o){y(t,i,o),pe(r,i,null),n=!0,s||(a=[S(i,"click",e[13]),g(xu.call(null,i,{shift:!0,control:!0,code:"KeyF",callback:e[13]}))],s=!0)},p:t,i(e){n||(le(r.$$.fragment,e),n=!0)},o(e){ce(r.$$.fragment,e),n=!1},d(e){e&&v(i),fe(r),s=!1,o(a)}}}function Ud(e){let t,r,n,s,a,l,c,u,h,d,p,f,A,m,x,w,C,M,I,P,L,k,z,R,D,O,U,N,Q,j,V,H,G,$,Z,q,K,W,X,Y,J,ee,te,ie,re,ne,oe,Ae,me,ge;a=new hu({props:{icon:e[8]?Jc:ru}});let _e=e[8]&&Nd(e);d=new Ed({props:{mode:e[4],mapsNum:e[5].length}}),d.$on("viewMode",e[21]);let ye=e[3]&&Qd(e);const ve=[e[6]];let xe={};for(let e=0;e0&&Hd(e);return{c(){t=b("div"),r=b("div"),n=b("div"),s=b("div"),de(a.$$.fragment),c=B(),_e&&_e.c(),u=B(),h=b("div"),de(d.$$.fragment),p=B(),f=b("div"),ye&&ye.c(),A=B(),m=b("div"),de(x.$$.fragment),w=B(),C=b("div"),M=b("div"),I=b("label"),P=b("span"),P.innerHTML='Label Collisions',L=B(),k=b("input"),z=B(),R=b("label"),D=b("span"),D.innerHTML='Tile Boundaries',O=B(),U=b("input"),N=B(),be&&be.c(),Q=B(),j=b("div"),V=b("div"),H=b("button"),de(G.$$.fragment),$=T(" Add map"),K=B(),W=b("button"),de(X.$$.fragment),Y=T("\n Copy image"),te=B(),ie=b("div"),re=b("button"),de(ne.$$.fragment),oe=B(),we&&we.c(),E(s,"class","link-button svelte-1g6kozd"),F(s,"margin-right","6px"),E(s,"title",l=e[8]?"Unlink locations":"Link locations"),E(n,"class","control-section svelte-1g6kozd"),E(h,"class","control-section svelte-1g6kozd"),E(f,"class","control-section svelte-1g6kozd"),E(m,"class","control-section svelte-1g6kozd"),E(P,"class","checkbox-label svelte-1g6kozd"),E(k,"type","checkbox"),E(I,"class","checkbox-container svelte-1g6kozd"),E(D,"class","checkbox-label svelte-1g6kozd"),E(U,"type","checkbox"),E(R,"class","checkbox-container svelte-1g6kozd"),E(M,"class","checkboxes svelte-1g6kozd"),E(C,"class","control-section svelte-1g6kozd"),F(H,"margin-right","6px"),H.disabled=Z=e[5].length>=8,E(H,"title",q=e[5].length>=8?"Maximum of 8 maps allowed.":""),W.disabled=J="swipe"===e[4],E(W,"title",ee="swipe"===e[4]?"Must be in phone or mirror mode to screenshot.":"Copy image to clipboard"),E(V,"class","buttons svelte-1g6kozd"),E(j,"class","control-section svelte-1g6kozd"),E(re,"class","fullscreen-btn svelte-1g6kozd"),E(re,"title","Hide UI"),E(ie,"class","control-section svelte-1g6kozd"),E(r,"class","control-row svelte-1g6kozd"),E(t,"class","map-controls svelte-1g6kozd")},m(i,o){y(i,t,o),_(t,r),_(r,n),_(n,s),pe(a,s,null),_(n,c),_e&&_e.m(n,null),_(r,u),_(r,h),pe(d,h,null),_(r,p),_(r,f),ye&&ye.m(f,null),_(r,A),_(r,m),pe(x,m,null),_(r,w),_(r,C),_(C,M),_(M,I),_(I,P),_(I,L),_(I,k),k.checked=e[0],_(M,z),_(M,R),_(R,D),_(R,O),_(R,U),U.checked=e[1],_(M,N),be&&be.m(M,null),_(r,Q),_(r,j),_(j,V),_(V,H),pe(G,H,null),_(H,$),_(V,K),_(V,W),pe(X,W,null),_(W,Y),_(r,te),_(r,ie),_(ie,re),pe(ne,re,null),_(t,oe),we&&we.m(t,null),Ae=!0,me||(ge=[S(s,"click",e[14]),S(k,"change",e[23]),S(U,"change",e[24]),S(H,"click",e[11]),S(W,"click",e[12]),S(re,"click",e[13]),g(xu.call(null,re,{shift:!0,control:!0,code:"KeyF",callback:e[13]}))],me=!0)},p(e,i){const r={};256&i&&(r.icon=e[8]?Jc:ru),a.$set(r),(!Ae||256&i&&l!==(l=e[8]?"Unlink locations":"Link locations"))&&E(s,"title",l),e[8]?_e?(_e.p(e,i),256&i&&le(_e,1)):(_e=Nd(e),_e.c(),le(_e,1),_e.m(n,null)):_e&&(se(),ce(_e,1,1,(()=>{_e=null})),ae());const o={};16&i&&(o.mode=e[4]),32&i&&(o.mapsNum=e[5].length),d.$set(o),e[3]?ye?(ye.p(e,i),8&i&&le(ye,1)):(ye=Qd(e),ye.c(),le(ye,1),ye.m(f,null)):ye&&(se(),ce(ye,1,1,(()=>{ye=null})),ae());const c=64&i?ue(ve,[he(e[6])]):{};x.$set(c),1&i&&(k.checked=e[0]),2&i&&(U.checked=e[1]),"swipe"===e[4]?be?(be.p(e,i),16&i&&le(be,1)):(be=jd(e),be.c(),le(be,1),be.m(M,null)):be&&(se(),ce(be,1,1,(()=>{be=null})),ae()),(!Ae||32&i&&Z!==(Z=e[5].length>=8))&&(H.disabled=Z),(!Ae||32&i&&q!==(q=e[5].length>=8?"Maximum of 8 maps allowed.":""))&&E(H,"title",q),(!Ae||16&i&&J!==(J="swipe"===e[4]))&&(W.disabled=J),(!Ae||16&i&&ee!==(ee="swipe"===e[4]?"Must be in phone or mirror mode to screenshot.":"Copy image to clipboard"))&&E(W,"title",ee),e[7].length>0?we?we.p(e,i):(we=Hd(e),we.c(),we.m(t,null)):we&&(we.d(1),we=null)},i(e){Ae||(le(a.$$.fragment,e),le(_e),le(d.$$.fragment,e),le(ye),le(x.$$.fragment,e),le(be),le(G.$$.fragment,e),le(X.$$.fragment,e),le(ne.$$.fragment,e),Ae=!0)},o(e){ce(a.$$.fragment,e),ce(_e),ce(d.$$.fragment,e),ce(ye),ce(x.$$.fragment,e),ce(be),ce(G.$$.fragment,e),ce(X.$$.fragment,e),ce(ne.$$.fragment,e),Ae=!1},d(e){e&&v(t),fe(a),_e&&_e.d(),fe(d),ye&&ye.d(),fe(x),be&&be.d(),fe(G),fe(X),fe(ne),we&&we.d(),me=!1,o(ge)}}}function Nd(e){let t,r;const n=[e[6]];let o={};for(let e=0;eDifferences',r=B(),n=b("input"),E(i,"class","checkbox-label svelte-1g6kozd"),E(n,"type","checkbox"),E(t,"class","checkbox-container svelte-1g6kozd")},m(a,l){y(a,t,l),_(t,i),_(t,r),_(t,n),n.checked=e[2],o||(s=S(n,"change",e[25]),o=!0)},p(e,t){4&t&&(n.checked=e[2])},d(e){e&&v(t),o=!1,s()}}}function Hd(e){let t,i=e[7],r=[];for(let t=0;t{l[o]=null})),ae(),i=l[t],i?i.p(e,n):(i=l[t]=a[t](e),i.c()),le(i,1),i.m(r.parentNode,r))},i(e){n||(le(i),n=!0)},o(e){ce(i),n=!1},d(e){l[t].d(e),e&&v(r),o=!1,s()}}}function Zd(e,t,i){let r,n;l(e,Le,(e=>i(8,r=e))),l(e,Pe,(e=>i(9,n=e)));let{bearing:o}=t,{center:s}=t,{mapboxGlAccessToken:a}=t,{pitch:c}=t,{showCollisions:u}=t,{showBoundaries:h}=t,{showDiff:d}=t,{viewMode:p}=t,{zoom:f}=t;const A=H();let m,g=[],_=[];Ee.subscribe((e=>i(5,g=e)));return e.$$set=e=>{"bearing"in e&&i(16,o=e.bearing),"center"in e&&i(17,s=e.center),"mapboxGlAccessToken"in e&&i(3,a=e.mapboxGlAccessToken),"pitch"in e&&i(18,c=e.pitch),"showCollisions"in e&&i(0,u=e.showCollisions),"showBoundaries"in e&&i(1,h=e.showBoundaries),"showDiff"in e&&i(2,d=e.showDiff),"viewMode"in e&&i(4,p=e.viewMode),"zoom"in e&&i(19,f=e.zoom)},e.$$.update=()=>{983040&e.$$.dirty&&i(6,m={bearing:o,center:s,pitch:c,zoom:f}),96&e.$$.dirty&&i(7,_=((e,t)=>{const i=[],r=Rh(e,t);return e.pitch>=r&&i.push({type:"warning",message:`Pitch capped at ${r} as that is the maximum for this zoom level.`}),i})(m,g)),20&e.$$.dirty&&"swipe"!==p&&d&&i(2,d=!1),7&e.$$.dirty&&A("mapState",{options:{showCollisions:u,showBoundaries:h,showDiff:d}})},[u,h,d,a,p,g,m,_,r,n,({detail:e})=>{const{result:t}=e,i={center:{lat:t.center[1],lng:t.center[0]},zoom:17};t.bbox&&(i.zoom=14),A("mapState",{options:i})},()=>{Ee.update((e=>{let t=e[e.length-1];t={...t,index:t.index+1};return e.concat([t])})),r||Fe.update((e=>[...e,{...e[e.length-1]}]))},async()=>{const e=document.getElementsByClassName("maps")[0];let t=[...document.getElementsByClassName("screenshot-label-transparent")];t.forEach((e=>{e.classList.remove("screenshot-label-transparent"),e.classList.add("screenshot-label")}));let i=[];"mirror"===p&&(i=[...document.getElementsByClassName("map-container-border")],i.forEach((e=>{e.classList.remove("map-container-border"),e.classList.add("map-container-border-transparent")})));yd(e,{ignoreElements:e=>!(!e.className||"string"!=typeof e.className)&&e.className.includes("map-label")}).then((e=>{e.toBlob((e=>navigator.clipboard.write([new ClipboardItem({"image/png":e})])))})),t.forEach((e=>{e.classList.remove("screenshot-label"),e.classList.add("screenshot-label-transparent")})),"mirror"===p&&i.forEach((e=>{e.classList.remove("map-container-border-transparent"),e.classList.add("map-container-border")}))},()=>{Pe.update((e=>!e))},()=>{Le.update((e=>!e))},function(e){"input"!==e.target.tagName.toLowerCase()&&("c"!==e.key&&"C"!==e.key||i(0,u=!u),"t"!==e.key&&"T"!==e.key||i(1,h=!h),"d"!==e.key&&"D"!==e.key||i(2,d=!d))},o,s,c,f,function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(){u=this.checked,i(0,u)},function(){h=this.checked,i(1,h)},function(){d=this.checked,i(2,d),i(4,p)}]}class qd extends me{constructor(e){super(),Ae(this,e,Zd,$d,a,{bearing:16,center:17,mapboxGlAccessToken:3,pitch:18,showCollisions:0,showBoundaries:1,showDiff:2,viewMode:4,zoom:19})}}let Kd;Le.subscribe((e=>Kd=e));const Wd=["locations"],Xd=["showCollisions","showBoundaries","showDiff"],Yd=["bearing","center","pitch","zoom"],Jd=["bearing","lat","lng","pitch","zoom"],ep=["map","stylePresets"];const tp=(e,t)=>[...t.filter((e=>"sublist"!==e.type)),...t.filter((e=>"sublist"===e.type)).flatMap((e=>e.presets))].find((t=>t.id===e)),ip=(e,t)=>{const i=t.find((t=>t.id===e.branchId));return i?{...i,url:Au(i.pattern,e.branch,e.branchStyle)}:null},rp=(e,t)=>JSON.parse(e).map((e=>{let i=tp(e.id,t?.stylePresets??[]);return i||(i=ip(e,t?.branchPatterns??[])),i?{...i,...e}:e})).filter((e=>e)),np=({zoom:e,center:t,pitch:i,bearing:r})=>[Re(e,2),Re(t.lat,4),Re(t.lng,4),Re(i??0,1),Re(r??0,1)].join("/"),op=e=>{const[t,i,r,n,o]=e.split("/");return{bearing:o,center:{lat:i,lng:r},pitch:n,zoom:t}};const sp=(e,t)=>{let i=Object.fromEntries(Object.entries(e).filter((([e,t])=>!Yd.includes(e)&&"locations"!==e)).map((([e,i])=>{let r=i;return"maps"===e?r=((e,t)=>{const i=e.map((e=>{let i,r={id:e.id};return e.branchId?(i=ip(e,t?.branchPatterns??[]),r={branchId:i.id,branchStyle:e.branchStyle,branch:e.branch}):i=tp(e.id,t.stylePresets),i?(e.renderer!==i.renderer&&(r.renderer=e.renderer),r):Object.fromEntries(Object.entries(e).filter((([e])=>"style"!==e)))}));return JSON.stringify(i)})(i,t):Wd.includes(e)&&(r=JSON.stringify(i)),[e,r]})));i=(e=>{let t=Object.keys(e).reduce(((t,i)=>{const r=e[i];return Xd.includes(i)&&!r||null!==r&&(t[i]=r),t}),{});return t})(i);const r=ap(window.location.hash,t),n=Object.entries(i).some((e=>{let[t,i]=e;if(ep.includes(t))return!1;try{i=JSON.parse(i)}catch(e){}return!Uh(i,r?.[t])}));let o={...i};o=Kd?{map:np(e),...o}:{locations:JSON.stringify(e.locations.map((e=>np(e)))),...o};const s=function(e){let t=e.map?`map=${e.map}`:"";return Object.entries(e).forEach((([e,i],r)=>{if(ep.includes(e))return;let n=encodeURIComponent(i);t=`${t}${""!==t?"&":""}${e}=${n}`})),t}(o);return{nextHash:s,requiresHistoryItem:n}};function ap(e,t){let i=Object.fromEntries(Object.entries(function(e){const t=e.split("#")[1];if(!t)return{};let i=Object.fromEntries(t.split("&").map((e=>e.split("=").map(decodeURIComponent))));return i.map&&(i={...i,...op(i.map)}),i.locations&&(i.locations=JSON.stringify(JSON.parse(i.locations).map((e=>op(e))))),i}(e)).filter((([e,t])=>!!t)).map((([e,i])=>"maps"===e?[e,rp(i,t)]:Wd.includes(e)?[e,JSON.parse(i)]:Xd.includes(e)?[e,"true"===i]:Jd.includes(e)?[e,+i||0]:[e,i])));return i.map&&delete i.map,i}const lp=e=>{const{mapState:t,maps:i,viewMode:r,stylePresets:n}=e;return{...t,viewMode:r,maps:i,stylePresets:n,...ap(window.location.hash,e)}};var cp={};Object.defineProperty(cp,"__esModule",{value:!0}),cp.updateStyle=_p=cp.addLink=void 0;var up={};Object.defineProperty(up,"__esModule",{value:!0}),up.stamenSvg=void 0;function hp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var r,n,o=[],s=!0,a=!1;try{for(i=i.call(e);!(s=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,n=e}finally{try{s||null==i.return||i.return()}finally{if(a)throw n}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return dp(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return dp(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dp(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i\n\n\n\n\n\n';var pp=function(e,t){Object.entries(t).forEach((function(t){var i=hp(t,2),r=i[0],n=i[1];e.style[r]=n}))},fp=document.createElement("img");fp.src="data:image/svg+xml;charset=utf-8,".concat(up.stamenSvg);var Ap=document.createElement("a");Ap.href="https://stamen.com";var mp=document.createElement("div");pp(fp,{height:"24px",position:"absolute",bottom:"-1px"});pp(Ap,{width:"110px",position:"relative"});pp(mp,{position:"fixed",bottom:"0px",right:"12px",zIndex:1e4,display:"flex",flexDirection:"row-reverse"}),Ap.appendChild(fp),mp.appendChild(Ap),document.body.appendChild(mp);cp.updateStyle=function(e){for(var t=0,i=Object.entries(e);ti(9,r=e))),_p("https://stamen.com/blog/","Learn more"),_p("https://github.com/stamen/maperture","Fork on Github");let{localConfig:n}=t;const o=(e=>({maps:[{id:"mapbox-streets",name:"Mapbox Streets",type:"mapbox-gl",url:"mapbox://styles/mapbox/streets-v11"},{id:"mapbox-light",name:"Mapbox Light",type:"mapbox-gl",url:"mapbox://styles/mapbox/light-v10"}].map(((t,i)=>e?.stylePresets?.[i]??t)),mapState:{bearing:0,center:{lng:-73.92169,lat:40.83962},pitch:0,showCollisions:!1,showBoundaries:!1,showDiff:!1,zoom:13.25},viewMode:"swipe",gazetteer:{Scenarios:[{"Zoomed out":{pitch:0,zoom:10}},{"Zoomed in/Tilted":{pitch:45,zoom:16}}],Locations:[{"San Francisco, CA":{zoom:18,center:{lng:-122.4193,lat:37.7648}}},{"Washington DC":{zoom:12,center:{lng:-77.0435,lat:38.9098}}}]},branchPatterns:[{pattern:"",styles:[]}],stylePresetUrls:[],...e}))(n),{mapboxGlAccessToken:s,stylePresetUrls:a}=o;Ie.set(o);let c=lp(o),u={},h=!1;const d=()=>location.hash.slice(1)!==sp(c,o)?.nextHash;Ee.set(c.maps.map(((e,t)=>({...e,index:t})))),Me.set(c.stylePresets),Fe.set(c?.locations??null),r&&r.length&&Le.set(!1);let p=[];j((()=>{a.length>0&&a.forEach((async e=>{const t=await(async e=>{const t=await fetch(e),i=await t.json();return ze(i)?i:(console.warn(`Style presets at ${e} is not valid, check the format`),[])})(e);Me.update((e=>[...e,...t]))}))})),window.addEventListener("hashchange",(()=>{if(!h&&d()){const e=lp(o);if(i(0,c=e),c.maps.length){const e=c.maps.map(((e,t)=>({...e,index:t})));Ee.set(e)}}h=!1})),Ee.subscribe((e=>{const t=JSON.parse(JSON.stringify(e)).map((e=>(delete e.isPolling,e)));i(0,c={...c,maps:t})})),Fe.subscribe((e=>{i(0,c={...c,locations:e})})),Le.subscribe((e=>{if(!e&&!r){const e=p.map((()=>u));Fe.set(e)}e&&r&&Fe.set(null)}));const f=et((()=>{d()&&(h=!0,function(e,t){const{nextHash:i,requiresHistoryItem:r}=sp(e,t);r?window.location.hash=i:window.location.replace(`${window.location.pathname}#${i}`)}(c,o))}),250);return"unavailable"===xe.getRTLTextPluginStatus()&&xe.setRTLTextPlugin("https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js"),"unavailable"===Te.getRTLTextPluginStatus()&&Te.setRTLTextPlugin("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js"),e.$$set=e=>{"localConfig"in e&&i(7,n=e.localConfig)},e.$$.update=()=>{5&e.$$.dirty&&(Uh(p,c.maps)||i(2,p=c.maps)),6&e.$$.dirty&&i(1,u=Dh(u,p)),1&e.$$.dirty&&c&&f(),1&e.$$.dirty&&(c||height||width)&&i(1,u=(()=>{const{bearing:e,center:t,pitch:i,showCollisions:r,showBoundaries:n,showDiff:o,zoom:s,height:a,width:l}=c;return{bearing:e,center:t,pitch:i,showCollisions:r,showBoundaries:n,showDiff:o,zoom:s,...a&&{height:a},...l&&{width:l}}})())},[c,u,p,s,e=>{let t={...u,...e.detail.options};i(0,c={...c,...Dh(t,p)})},e=>{i(0,c={...c,viewMode:e.detail.mode})},e=>{i(0,c={...c,...e.detail})},n]}class xp extends me{constructor(e){super(),Ae(this,e,vp,yp,a,{localConfig:7})}}const bp=(e,t)=>new xp({target:e,props:t});var wp=Object.freeze({__proto__:null,default:undefined}),Tp=Object.freeze({__proto__:null,default:undefined});class Bp extends Map{#e=0;#t=new Map;#i=new Map;#r;#n;#o;constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.#r=e.maxSize,this.#n=e.maxAge||Number.POSITIVE_INFINITY,this.#o=e.onEviction}get __oldCache(){return this.#i}#s(e){if("function"==typeof this.#o)for(const[t,i]of e)this.#o(t,i.value)}#a(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.#o&&this.#o(e,t.value),this.delete(e))}#l(e,t){if(!1===this.#a(e,t))return t.value}#c(e,t){return t.expiry?this.#l(e,t):t.value}#u(e,t){const i=t.get(e);return this.#c(e,i)}#h(e,t){this.#t.set(e,t),this.#e++,this.#e>=this.#r&&(this.#e=0,this.#s(this.#i),this.#i=this.#t,this.#t=new Map)}#d(e,t){this.#i.delete(e),this.#h(e,t)}*#p(){for(const e of this.#i){const[t,i]=e;if(!this.#t.has(t)){!1===this.#a(t,i)&&(yield e)}}for(const e of this.#t){const[t,i]=e;!1===this.#a(t,i)&&(yield e)}}get(e){if(this.#t.has(e)){const t=this.#t.get(e);return this.#c(e,t)}if(this.#i.has(e)){const t=this.#i.get(e);if(!1===this.#a(e,t))return this.#d(e,t),t.value}}set(e,t,{maxAge:i=this.#n}={}){const r="number"==typeof i&&i!==Number.POSITIVE_INFINITY?Date.now()+i:void 0;return this.#t.has(e)?this.#t.set(e,{value:t,expiry:r}):this.#h(e,{value:t,expiry:r}),this}has(e){return this.#t.has(e)?!this.#a(e,this.#t.get(e)):!!this.#i.has(e)&&!this.#a(e,this.#i.get(e))}peek(e){return this.#t.has(e)?this.#u(e,this.#t):this.#i.has(e)?this.#u(e,this.#i):void 0}delete(e){const t=this.#t.delete(e);return t&&this.#e--,this.#i.delete(e)||t}clear(){this.#t.clear(),this.#i.clear(),this.#e=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this.#p()],i=t.length-e;i<0?(this.#t=new Map(t),this.#i=new Map,this.#e=t.length):(i>0&&this.#s(t.slice(0,i)),this.#i=new Map(t.slice(i)),this.#t=new Map,this.#e=0),this.#r=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.#t){const[t,i]=e;!1===this.#a(t,i)&&(yield[t,i.value])}for(const e of this.#i){const[t,i]=e;if(!this.#t.has(t)){!1===this.#a(t,i)&&(yield[t,i.value])}}}*entriesDescending(){let e=[...this.#t];for(let t=e.length-1;t>=0;--t){const i=e[t],[r,n]=i;!1===this.#a(r,n)&&(yield[r,n.value])}e=[...this.#i];for(let t=e.length-1;t>=0;--t){const i=e[t],[r,n]=i;if(!this.#t.has(r)){!1===this.#a(r,n)&&(yield[r,n.value])}}}*entriesAscending(){for(const[e,t]of this.#p())yield[e,t.value]}get size(){if(!this.#e)return this.#i.size;let e=0;for(const t of this.#i.keys())this.#t.has(t)||e++;return Math.min(this.#e+e,this.#r)}get maxSize(){return this.#r}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[i,r]of this.entriesAscending())e.call(t,r,i,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}const Cp=new class{constructor(){this._apiKey="",this._fetch="undefined"!=typeof self?fetch.bind(self):"undefined"!=typeof global&&global.fetch?global.fetch:null,this.tileCacheSize=200}set apiKey(e){this._apiKey=e}get apiKey(){return this._apiKey}set fetch(e){this._fetch=e}get fetch(){return this._fetch}},Sp={AUTO:{code:null,flag:"auto",name:"Auto",latin:!1,isMode:!0,geocoding:!0},LATIN:{code:"latin",flag:"name:latin",name:"Latin",latin:!0,isMode:!1,geocoding:!1},NON_LATIN:{code:"nonlatin",flag:"name:nonlatin",name:"Non Latin",latin:!1,isMode:!1,geocoding:!1},LOCAL:{code:null,flag:"name",name:"Local",latin:!0,isMode:!1,geocoding:!1},ALBANIAN:{code:"sq",flag:"name:sq",name:"Albanian",latin:!0,isMode:!1,geocoding:!0},AMHARIC:{code:"am",flag:"name:am",name:"Amharic",latin:!1,isMode:!1,geocoding:!0},ARABIC:{code:"ar",flag:"name:ar",name:"Arabic",latin:!1,isMode:!1,geocoding:!0},ARMENIAN:{code:"hy",flag:"name:hy",name:"Armenian",latin:!1,isMode:!1,geocoding:!0},AZERBAIJANI:{code:"az",flag:"name:az",name:"Azerbaijani",latin:!0,isMode:!1,geocoding:!0},BASQUE:{code:"eu",flag:"name:eu",name:"Basque",latin:!0,isMode:!1,geocoding:!0},BELARUSIAN:{code:"be",flag:"name:be",name:"Belarusian",latin:!1,isMode:!1,geocoding:!0},BENGALI:{code:"bn",flag:"name:bn",name:"Bengali",latin:!0,isMode:!1,geocoding:!0},BOSNIAN:{code:"bs",flag:"name:bs",name:"Bosnian",latin:!0,isMode:!1,geocoding:!0},BRETON:{code:"br",flag:"name:br",name:"Breton",latin:!0,isMode:!1,geocoding:!0},BULGARIAN:{code:"bg",flag:"bg",name:"Bulgarian",latin:!1,isMode:!1,geocoding:!0},CATALAN:{code:"ca",flag:"name:ca",name:"Catalan",latin:!0,isMode:!1,geocoding:!0},CHINESE:{code:"zh",flag:"name:zh",name:"Chinese",latin:!1,isMode:!1,geocoding:!0},TRADITIONAL_CHINESE:{code:"zh-Hant",flag:"name:zh-Hant",name:"Chinese (traditional)",latin:!1,isMode:!1,geocoding:!1},SIMPLIFIED_CHINESE:{code:"zh-Hans",flag:"name:zh-Hans",name:"Chinese (simplified)",latin:!1,isMode:!1,geocoding:!1},CORSICAN:{code:"co",flag:"name:co",name:"Corsican",latin:!0,isMode:!1,geocoding:!0},CROATIAN:{code:"hr",flag:"name:hr",name:"Croatian",latin:!0,isMode:!1,geocoding:!0},CZECH:{code:"cs",flag:"name:cs",name:"Czech",latin:!0,isMode:!1,geocoding:!0},DANISH:{code:"da",flag:"name:da",name:"Danish",latin:!0,isMode:!1,geocoding:!0},DUTCH:{code:"nl",flag:"name:nl",name:"Dutch",latin:!0,isMode:!1,geocoding:!0},GERMAN:{code:"de",flag:"name:de",name:"German",latin:!0,isMode:!1,geocoding:!0},GREEK:{code:"el",flag:"name:el",name:"Greek",latin:!1,isMode:!1,geocoding:!0},ENGLISH:{code:"en",flag:"name:en",name:"English",latin:!0,isMode:!1,geocoding:!0},ESPERANTO:{code:"eo",flag:"name:eo",name:"Esperanto",latin:!0,isMode:!1,geocoding:!0},ESTONIAN:{code:"et",flag:"name:et",name:"Estonian",latin:!0,isMode:!1,geocoding:!0},FINNISH:{code:"fi",flag:"name:fi",name:"Finnish",latin:!0,isMode:!1,geocoding:!0},FRENCH:{code:"fr",flag:"name:fr",name:"French",latin:!0,isMode:!1,geocoding:!0},FRISIAN:{code:"fy",flag:"name:fy",name:"Frisian (West)",latin:!0,isMode:!1,geocoding:!0},GEORGIAN:{code:"ka",flag:"name:ka",name:"Georgian",latin:!1,isMode:!1,geocoding:!0},HEBREW:{code:"he",flag:"name:he",name:"Hebrew",latin:!1,isMode:!1,geocoding:!0},HINDI:{code:"hi",flag:"name:hi",name:"Hindi",latin:!1,isMode:!1,geocoding:!0},HUNGARIAN:{code:"hu",flag:"name:hu",name:"Hungarian",latin:!0,isMode:!1,geocoding:!0},ICELANDIC:{code:"is",flag:"name:is",name:"Icelandic",latin:!0,isMode:!1,geocoding:!0},INDONESIAN:{code:"id",flag:"name:id",name:"Indonesian",latin:!0,isMode:!1,geocoding:!0},IRISH:{code:"ga",flag:"name:ga",name:"Irish",latin:!0,isMode:!1,geocoding:!0},ITALIAN:{code:"it",flag:"name:it",name:"Italian",latin:!0,isMode:!1,geocoding:!0},JAPANESE:{code:"ja",flag:"name:ja",name:"Japanese",latin:!1,isMode:!1,geocoding:!0},JAPANESE_HIRAGANA:{code:"ja-Hira",flag:"name:ja-Hira",name:"Japanese Hiragana form",latin:!1,isMode:!1,geocoding:!1},JAPANESE_2018:{code:"ja-Latn",flag:"name:ja-Latn",name:"Japanese (Latin 2018)",latin:!0,isMode:!1,geocoding:!1},JAPANESE_KANA:{code:"ja_kana",flag:"name:ja_kana",name:"Japanese (Kana)",latin:!1,isMode:!1,geocoding:!1},JAPANESE_LATIN:{code:"ja_rm",flag:"name:ja_rm",name:"Japanese (Latin script)",latin:!0,isMode:!1,geocoding:!1},KANNADA:{code:"kn",flag:"name:kn",name:"Kannada",latin:!0,isMode:!1,geocoding:!0},KAZAKH:{code:"kk",flag:"name:kk",name:"Kazakh",latin:!1,isMode:!1,geocoding:!0},KOREAN:{code:"ko",flag:"name:ko",name:"Korean",latin:!1,isMode:!1,geocoding:!0},KOREAN_LATIN:{code:"ko-Latn",flag:"name:ko-Latn",name:"Korean (Latin script)",latin:!0,isMode:!1,geocoding:!1},KURDISH:{code:"ku",flag:"name:ku",name:"Kurdish",latin:!0,isMode:!1,geocoding:!0},CLASSICAL_LATIN:{code:"la",flag:"name:la",name:"Latin",latin:!0,isMode:!1,geocoding:!0},LATVIAN:{code:"lv",flag:"name:lv",name:"Latvian",latin:!0,isMode:!1,geocoding:!0},LITHUANIAN:{code:"lt",flag:"name:lt",name:"Lithuanian",latin:!0,isMode:!1,geocoding:!0},LUXEMBOURGISH:{code:"lb",flag:"name:lb",name:"Luxembourgish",latin:!0,isMode:!1,geocoding:!0},MACEDONIAN:{code:"mk",flag:"name:mk",name:"Macedonian",latin:!1,isMode:!1,geocoding:!0},MALAYALAM:{code:"ml",flag:"name:ml",name:"Malayalam",latin:!1,isMode:!1,geocoding:!0},MALTESE:{code:"mt",flag:"name:mt",name:"Maltese",latin:!0,isMode:!1,geocoding:!0},NORWEGIAN:{code:"no",flag:"name:no",name:"Norwegian",latin:!0,isMode:!1,geocoding:!0},OCCITAN:{code:"oc",flag:"name:oc",name:"Occitan",latin:!0,isMode:!1,geocoding:!0},PERSIAN:{code:"fa",flag:"name:fa",name:"Persian",latin:!1,isMode:!1,geocoding:!0},POLISH:{code:"pl",flag:"name:pl",name:"Polish",latin:!0,isMode:!1,geocoding:!0},PORTUGUESE:{code:"pt",flag:"name:pt",name:"Portuguese",latin:!0,isMode:!1,geocoding:!0},PUNJABI:{code:"pa",flag:"name:pa",name:"Punjabi",latin:!1,isMode:!1,geocoding:!0},WESTERN_PUNJABI:{code:"pnb",flag:"name:pnb",name:"Western Punjabi",latin:!1,isMode:!1,geocoding:!1},ROMANIAN:{code:"ro",flag:"name:ro",name:"Romanian",latin:!0,isMode:!1,geocoding:!0},ROMANSH:{code:"rm",flag:"name:rm",name:"Romansh",latin:!0,isMode:!1,geocoding:!0},RUSSIAN:{code:"ru",flag:"name:ru",name:"Russian",latin:!1,isMode:!1,geocoding:!0},SERBIAN_CYRILLIC:{code:"sr",flag:"name:sr",name:"Serbian (Cyrillic script)",latin:!1,isMode:!1,geocoding:!0},SERBIAN_LATIN:{code:"sr-Latn",flag:"name:sr-Latn",name:"Serbian (Latin script)",latin:!0,isMode:!1,geocoding:!1},SCOTTISH_GAELIC:{code:"gd",flag:"name:gd",name:"Scottish Gaelic",latin:!0,isMode:!1,geocoding:!0},SLOVAK:{code:"sk",flag:"name:sk",name:"Slovak",latin:!0,isMode:!1,geocoding:!0},SLOVENE:{code:"sl",flag:"name:sl",name:"Slovene",latin:!0,isMode:!1,geocoding:!0},SPANISH:{code:"es",flag:"name:es",name:"Spanish",latin:!0,isMode:!1,geocoding:!0},SWEDISH:{code:"sv",flag:"name:sv",name:"Swedish",latin:!0,isMode:!1,geocoding:!0},TAMIL:{code:"ta",flag:"name:ta",name:"Tamil",latin:!1,isMode:!1,geocoding:!0},TELUGU:{code:"te",flag:"name:te",name:"Telugu",latin:!1,isMode:!1,geocoding:!0},THAI:{code:"th",flag:"name:th",name:"Thai",latin:!1,isMode:!1,geocoding:!0},TURKISH:{code:"tr",flag:"name:tr",name:"Turkish",latin:!0,isMode:!1,geocoding:!0},UKRAINIAN:{code:"uk",flag:"name:uk",name:"Ukrainian",latin:!1,isMode:!1,geocoding:!0},VIETNAMESE:{code:"vi",flag:"name:vi",name:"Vietnamese (Latin script)",latin:!0,isMode:!1,geocoding:!0},WELSH:{code:"cy",flag:"name:cy",name:"Welsh",latin:!0,isMode:!1,geocoding:!0}};function Ep(e,t=Sp){return e in t?e[e]:null}function Mp(e,t=Sp){for(const i of Object.values(t))if(i.code===e)return i;return null}function Ip(e,t=Sp){for(const i of Object.values(t))if(i.flag===e)return i;return null}function Pp(){if("undefined"==typeof navigator){return Mp(Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0])??Sp.ENGLISH}const e=Array.from(new Set(navigator.languages.map((e=>e.split("-")[0])))).map((e=>Mp(e))).filter((e=>e));return e[0]??Sp.ENGLISH}function Lp(e){return null!==e&&"object"==typeof e&&"code"in e&&"flag"in e&&"name"in e&&"latin"in e&&"isMode"in e&&"geocoding"in e&&("string"==typeof e.code||null===e.code)&&"string"==typeof e.flag&&"string"==typeof e.name&&"boolean"==typeof e.latin&&"boolean"==typeof e.isMode&&"boolean"==typeof e.geocoding}function Fp(e,t=Sp){return Lp(e)?Ip(e.flag,t):"string"!=typeof e?null:Ep(e,t)||Mp(e,t)||Ip(e,t)||null}async function kp(e,t={}){if(null===Cp.fetch)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(""===new URL(e).searchParams.get("key").trim())throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Cp.fetch(e,t)}const zp={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(zp);class Rp extends Error{constructor(e,t=""){super(`Call to enpoint ${e.url} failed with the status code ${e.status}. ${t}`),this.res=e}}const Dp={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function Op(e,t){const{language:i}=t;if(void 0===i)return;const r=(Array.isArray(i)?i:[i]).map((e=>function(e){const t=e===Sp.AUTO.flag?Pp():"string"==typeof e?Mp(e):Lp(e)?e.flag===Sp.AUTO.flag?Pp():Ip(e.flag):null;return t?.geocoding?t.code:null}(e))).filter((e=>e)),n=Array.from(new Set(r)).join(",");e.set("language",n)}function Up(e,t){const{apiKey:i,limit:r,types:n,excludeTypes:o}=t;e.set("key",i??Cp.apiKey),void 0!==r&&e.set("limit",String(r)),void 0!==n&&e.set("types",n.join(",")),void 0!==o&&e.set("excludeTypes",String(o)),Op(e,t)}function Np(e,t){Up(e,t);const{bbox:i,proximity:r,country:n,fuzzyMatch:o,autocomplete:s}=t;void 0!==i&&e.set("bbox",i.join(",")),void 0!==r&&e.set("proximity","ip"===r?r:r.join(",")),void 0!==n&&e.set("country",n.join(",")),void 0!==o&&e.set("fuzzyMatch",o?"true":"false"),void 0!==s&&e.set("autocomplete",s?"true":"false")}const Qp={forward:async function(e,t={}){if("string"!=typeof e||0===e.trim().length)throw new Error("The query must be a non-empty string");const i=new URL(`geocoding/${encodeURIComponent(e)}.json`,zp.maptilerApiURL);Np(i.searchParams,t);const r=await kp(i.toString());if(!r.ok)throw new Rp(r,Dp[r.status]??"");return await r.json()},reverse:async function(e,t={}){if(!Array.isArray(e)||e.length<2)throw new Error("The position must be an array of form [lng, lat].");const i=new URL(`geocoding/${e[0]},${e[1]}.json`,zp.maptilerApiURL);Up(i.searchParams,t);const r=await kp(i.toString());if(!r.ok)throw new Rp(r,Dp[r.status]??"");return await r.json()},byId:async function(e,t={}){const i=new URL(`geocoding/${e}.json`,zp.maptilerApiURL);i.searchParams.set("key",t.apiKey??Cp.apiKey),Op(i.searchParams,t);const r=await kp(i.toString());if(!r.ok)throw new Rp(r,Dp[r.status]??"");return await r.json()},batch:async function(e,t={}){if(!e.length)return[];const i=e.map((e=>encodeURIComponent(e))).join(";"),r=new URL(`geocoding/${i}.json`,zp.maptilerApiURL);Np(r.searchParams,t);const n=await kp(r.toString());if(!n.ok)throw new Rp(n,Dp[n.status]??"");const o=await n.json();return 1===e.length?[o]:o}},jp={403:"Key is missing, invalid or restricted"};const Vp={info:async function(e={}){const t=new URL("geolocation/ip.json",zp.maptilerApiURL);t.searchParams.set("key",e.apiKey??Cp.apiKey);const i=t.toString(),r=await kp(i);if(!r.ok)throw new Rp(r,r.status in jp?jp[r.status]:"");return await r.json()}},Hp={403:"Key is missing, invalid or restricted"};const Gp={search:async function(e,t={}){if("string"!=typeof e||0===e.trim().length)throw new Error("The query must be a non-empty string");const i=new URL(`coordinates/search/${e}.json`,zp.maptilerApiURL);i.searchParams.set("key",t.apiKey??Cp.apiKey),"limit"in t&&i.searchParams.set("limit",t.limit.toString()),"transformations"in t&&i.searchParams.set("transformations",t.transformations.toString()),"exports"in t&&i.searchParams.set("exports",t.exports.toString());const r=i.toString(),n=await kp(r);if(!n.ok)throw new Rp(n,n.status in Hp?Hp[n.status]:"");return await n.json()},transform:async function(e,t={}){const i=(Array.isArray(e[0])?e:[e]).map((e=>`${e[0]},${e[1]}`)).join(";"),r=new URL(`coordinates/transform/${i}.json`,zp.maptilerApiURL);r.searchParams.set("key",t.apiKey??Cp.apiKey),"sourceCrs"in t&&r.searchParams.set("s_srs",t.sourceCrs.toString()),"targetCrs"in t&&r.searchParams.set("t_srs",t.targetCrs.toString()),"operations"in t&&r.searchParams.set("ops",(Array.isArray(t.operations)?t.operations:[t.operations]).join("|"));const n=r.toString(),o=await kp(n);if(!o.ok)throw new Rp(o,o.status in Hp?Hp[o.status]:"");return await o.json()}},$p={403:"Key is missing, invalid or restricted"};const Zp={get:async function(e,t={}){if("string"!=typeof e||0===e.trim().length)throw new Error("The data ID must be a non-empty string");const i=new URL(`data/${encodeURIComponent(e)}/features.json`,zp.maptilerApiURL);i.searchParams.set("key",t.apiKey??Cp.apiKey);const r=i.toString(),n=await kp(r);if(!n.ok)throw new Rp(n,n.status in $p?$p[n.status]:"");return await n.json()}};function qp(e){let t;const i=e.trim();let r;return r=i.startsWith("http://")||i.startsWith("https://")?i:null!==(t=/^maptiler:\/\/(.*)/.exec(i))?`https://api.maptiler.com/maps/${t[1]}/style.json`:`https://api.maptiler.com/maps/${i}/style.json`,r}class Kp{constructor(e,t,i,r,n,o,s=!1){this.name=e,this.variantType=t,this.id=i,this.referenceStyle=r,this.description=n,this.imageURL=o,this.deprecated=s}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(e){return this.referenceStyle.hasVariant(e)}getVariant(e){const t=this.referenceStyle.getVariant(e);return this.warnIfDeprecated(t),t}getVariants(){return this.referenceStyle.getVariants().filter((e=>e!==this)).map((e=>(this.warnIfDeprecated(e),e)))}getImageURL(){return this.imageURL}getExpandedStyleURL(){return qp(this.getId())}warnIfDeprecated(e=this){if(!e.deprecated)return e;const t=e.getFullName();return console.warn(`Style "${t}" is deprecated and will be removed in a future version.`),e}}class Wp{constructor(e,t){this.name=e,this.id=t,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(e){this.variants[e.getType()]=e,this.orderedVariants.push(e)}hasVariant(e){return e in this.variants}getVariant(e){return e in this.variants?this.variants[e]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0].warnIfDeprecated()}}const Xp=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",deprecated:!0,name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",deprecated:!0,variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",deprecated:!0,variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",deprecated:!0,variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",deprecated:!0,variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",deprecated:!0,variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",deprecated:!0,description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",deprecated:!0,description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"AQUARELLE",name:"Aquarelle",description:"Watercolor map for creative use",variants:[{id:"aquarelle",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"aquarelle-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"aquarelle-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]},{referenceStyleID:"LANDSCAPE",name:"Landscape",description:"Terrain map for data overlays and visualisations",variants:[{id:"landscape",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"landscape-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"landscape-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]}];function Yp(e){return new Proxy(e,{get(t,i,r){if(t.hasVariant(i))return t.getVariant(i);if(i.toString().toUpperCase()===i)return e.getDefaultVariant();return Reflect.get(t,i,r)}})}function Jp(e){return e?"string"==typeof e||e instanceof String?e.trim().toLowerCase():e instanceof Kp?e.getId():e instanceof Wp?e.getDefaultVariant().getId():void 0:ef[Xp[0].referenceStyleID].getDefaultVariant().getId()}const ef=function(){const e={};for(let t=0;t1?(r=i[0],n=i[1]):t>0&&(r+=o*t,n+=s*t)}return o=e[0]-r,s=e[1]-n,o*o+s*s}function rf(e,t,i,r,n){let o,s=r;for(let r=t+1;rs&&(o=r,s=n)}s>r&&(o-t>1&&rf(e,t,o,r,n),n.push(e[o]),i-o>1&&rf(e,o,i,r,n))}function nf(e,t){const i=e.length-1,r=[e[0]];return rf(e,0,i,t,r),r.push(e[i]),r}const of={extractLineStrings:function(e){const t=[];function i(e){"LineString"!==e.type&&"MultiLineString"!==e.type||t.push(e)}function r(e){e.geometry&&i(e.geometry)}return"Feature"===e.type?r(e):"FeatureCollection"===e.type?function e(t){for(const i of t.features)"Feature"===i.type?r(i):"FeatureCollection"===i.type&&e(i)}(e):i(e),t},simplify:function(e,t){return e.length<=2?e:nf(e,void 0!==t?t*t:1)}};function sf(e,t=!0){let i=`${e[0]},${e[1]}`;return 3===e.length&&t&&(i+=`,${e[2]}`),i}function af(e,t=3e3){let i=e.map((e=>e.join(","))).join("|"),r=5e-6;for(;i.length>t;){i=of.simplify(e,r).map((e=>`${e[0]},${e[1]}`)).join("|"),r+=1e-5}return i}const lf={centered:function(e,t,i={}){const r=Jp(i.style),n=i.hiDPI?"@2x":"",o=i.format??"png";let s=~~(i.width??1024),a=~~(i.height??1024);i.hiDPI&&(s=~~(s/2),a=~~(a/2));const l=new URL(`maps/${encodeURIComponent(r)}/static/${e[0]},${e[1]},${t}/${s}x${a}${n}.${o}`,zp.maptilerApiURL);if("attribution"in i&&l.searchParams.set("attribution",i.attribution.toString()),"markers"in i){let e="";const t="markerIcon"in i;t&&(e+=`icon:${i.markerIcon}|`),t&&"markerAnchor"in i&&(e+=`anchor:${i.markerAnchor}|`),t&&i.hiDPI&&(e+="scale:2|");e+=(Array.isArray(i.markers[0])?i.markers:[i.markers]).map((e=>sf(e,!t))).join("|"),l.searchParams.set("markers",e)}if("path"in i){let e="";if(e+=`fill:${i.pathFillColor??"none"}|`,"pathStrokeColor"in i&&(e+=`stroke:${i.pathStrokeColor}|`),"pathWidth"in i){e+=`width:${(i.pathWidth/(i.hiDPI?2:1)).toString()}|`}e+=af(i.path),l.searchParams.set("path",e)}return l.searchParams.set("key",i.apiKey??Cp.apiKey),l.toString()},bounded:function(e,t={}){const i=Jp(t.style),r=t.hiDPI?"@2x":"",n=t.format??"png";let o=~~(t.width??1024),s=~~(t.height??1024);t.hiDPI&&(o=~~(o/2),s=~~(s/2));const a=new URL(`maps/${encodeURIComponent(i)}/static/${e[0]},${e[1]},${e[2]},${e[3]}/${o}x${s}${r}.${n}`,zp.maptilerApiURL);if("attribution"in t&&a.searchParams.set("attribution",t.attribution.toString()),"padding"in t&&a.searchParams.set("padding",t.padding.toString()),"markers"in t){let e="";const i="markerIcon"in t;i&&(e+=`icon:${t.markerIcon}|`),i&&"markerAnchor"in t&&(e+=`anchor:${t.markerAnchor}|`),i&&t.hiDPI&&(e+="scale:2|");e+=(Array.isArray(t.markers[0])?t.markers:[t.markers]).map((e=>sf(e,!i))).join("|"),a.searchParams.set("markers",e)}if("path"in t){let e="";if(e+=`fill:${t.pathFillColor??"none"}|`,"pathStrokeColor"in t&&(e+=`stroke:${t.pathStrokeColor}|`),"pathWidth"in t){e+=`width:${(t.pathWidth/(t.hiDPI?2:1)).toString()}|`}e+=af(t.path),a.searchParams.set("path",e)}return a.searchParams.set("key",t.apiKey??Cp.apiKey),a.toString()},automatic:function(e={}){if(!("markers"in e)&&!("path"in e))throw new Error("Automatic static maps require markers and/or path to be created.");const t=Jp(e.style),i=e.hiDPI?"@2x":"",r=e.format??"png";let n=~~(e.width??1024),o=~~(e.height??1024);e.hiDPI&&(n=~~(n/2),o=~~(o/2));const s=new URL(`maps/${encodeURIComponent(t)}/static/auto/${n}x${o}${i}.${r}`,zp.maptilerApiURL);if("attribution"in e&&s.searchParams.set("attribution",e.attribution.toString()),"padding"in e&&s.searchParams.set("padding",e.padding.toString()),"markers"in e){let t="";const i="markerIcon"in e;i&&(t+=`icon:${e.markerIcon}|`),i&&"markerAnchor"in e&&(t+=`anchor:${e.markerAnchor}|`),i&&e.hiDPI&&(t+="scale:2|");t+=(Array.isArray(e.markers[0])?e.markers:[e.markers]).map((e=>sf(e,!i))).join("|"),s.searchParams.set("markers",t)}if("path"in e){let t="";if(t+=`fill:${e.pathFillColor??"none"}|`,"pathStrokeColor"in e&&(t+=`stroke:${e.pathStrokeColor}|`),"pathWidth"in e){t+=`width:${(e.pathWidth/(e.hiDPI?2:1)).toString()}|`}t+=af(e.path),s.searchParams.set("path",t)}return s.searchParams.set("key",e.apiKey??Cp.apiKey),s.toString()}},cf=6371008.8,uf=2*Math.PI*cf;function hf(e){return(180+e)/360}function df(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function pf(e){const t=gf(e);return[hf(t[0]),df(t[1])]}function ff(e){return 360*e-180}function Af(e){const t=180-360*e;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function mf(e,t){const i=Math.PI/180,r=e[1]*i,n=t[1]*i,o=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t[0]-e[0])*i);return cf*Math.acos(Math.min(o,1))}function gf(e){const t=((e[0]+180)%360+360)%360-180;return[-180===t?180:t,e[1]]}function _f(e){return uf*Math.cos(e*Math.PI/180)}function yf(e,t,i=!0){const r=2**t,n=[e[0]*r,e[1]*r];return i?[~~n[0],~~n[1]]:n}function vf(e){return e*Math.PI/180}function xf(e){return 180*e/Math.PI}const bf={EARTH_RADIUS:cf,EARTH_CIRCUMFERENCE:uf,longitudeToMercatorX:hf,latitudeToMercatorY:df,wgs84ToMercator:pf,mercatorXToLongitude:ff,mercatorYToLatitude:Af,mercatorToWgs84:function(e){return[ff(e[0]),Af(e[1])]},haversineDistanceWgs84:mf,wrapWgs84:gf,circumferenceAtLatitude:_f,mercatorToTileIndex:yf,wgs84ToTileIndex:function(e,t,i=!0){return yf(pf(e),t,i)},toRadians:vf,toDegrees:xf,haversineIntermediateWgs84:function(e,t,i){const r=mf(e,t),n=vf(e[0]),o=vf(e[1]),s=vf(t[0]),a=vf(t[1]),l=r/cf,c=Math.sin((1-i)*l)/Math.sin(l),u=Math.sin(i*l)/Math.sin(l),h=c*Math.cos(o)*Math.cos(n)+u*Math.cos(a)*Math.cos(s),d=c*Math.cos(o)*Math.sin(n)+u*Math.cos(a)*Math.sin(s),p=c*Math.sin(o)+u*Math.sin(a),f=Math.atan2(p,Math.sqrt(h*h+d*d));return[xf(Math.atan2(d,h)),xf(f)]},haversineCumulatedDistanceWgs84:function(e){const t=Array(e.length);t[0]=0;const i=t.length;for(let r=1;rs||a<0)&&(a=s);const l=e.map((e=>bf.wgs84ToTileIndex(e,a,!1))),c=l.map((e=>[~~e[0],~~e[1]])).map((e=>`terrain_${a.toString()}_${e[0].toString()}_${e[1].toString()}`)),u=Array.from(new Set(c.filter((e=>!o.has(e))))).map((e=>e.split("_").slice(1))),h=u.map((e=>n.replace("{x}",e[1].toString()).replace("{y}",e[2].toString()).replace("{z}",e[0].toString()))).map((e=>kp(e))),d=(await Promise.allSettled(h)).map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e)),p=d.filter((e=>!e.ok));if(d.length!==h.length)throw new Error("Some tiles could not be fetched.");if(p.length)throw new Rp(p[0],Ef[p[0].status]??"");const f=await Promise.all(d.map((e=>e.arrayBuffer())));if(!f.every((e=>e.byteLength>0)))throw new Error("Some tiles are not available.");(await Promise.all(f.map((e=>r(e))))).forEach(((e,t)=>{const i=u[t],r=`terrain_${i[0].toString()}_${i[1].toString()}_${i[2].toString()}`;o.set(r,e)}));const A=e.map(((e,t)=>{const i=c[t],r=l[t],n=o.get(i),s=Math.min(Math.round(n.width*(r[0]%1)),n.width-1),a=(Math.min(Math.round(n.height*(r[1]%1)),n.height-1)*n.width+s)*n.components,u=.1*(256*n.pixels[a]*256+256*n.pixels[a+1]+n.pixels[a+2])-1e4;return[e[0],e[1],~~(1e3*u)/1e3]}));if(t.smoothingKernelSize){const e=2*~~(t.smoothingKernelSize/2)+1,i=A.map((e=>e[2])),r=~~(e/2);for(let t=r;tr||n<0)&&(n=r);const o=bf.wgs84ToTileIndex(e,n,!1),s=~~o[0],a=~~o[1];if(!Sf.tiles.length)throw new Error("Terrain tileJSON tile list is empty.");const l=`terrain_${n.toString()}_${s.toString()}_${a.toString()}`;let c;const u=Tf();if(u.has(l))c=u.get(l);else{const e=Sf.tiles[0].replace("{x}",s.toString()).replace("{y}",a.toString()).replace("{z}",n.toString()),t=await kp(e);if(!t.ok)throw new Rp(t,Ef[t.status]??"");const i=await t.arrayBuffer(),r=Cf();c=await r(i),u.set(l,c)}const h=~~(c.width*(o[0]%1)),d=(~~(c.height*(o[1]%1))*c.width+h)*c.components,p=.1*(256*c.pixels[d]*256+256*c.pixels[d+1]+c.pixels[d+2])-1e4;return[e[0],e[1],p]},batch:If,fromLineString:async function(e,t={}){if("LineString"!==e.type)throw new Error("The provided object is not a GeoJSON LineString");const i=structuredClone(e),r=await If(i.coordinates,t);return i.coordinates=r,i},fromMultiLineString:async function(e,t={}){if("MultiLineString"!==e.type)throw new Error("The provided object is not a GeoJSON MultiLineString");const i=structuredClone(e),r=i.coordinates.map((e=>e.length)),n=i.coordinates.flat(),o=await If(n,t),s=[];let a=0;for(const e of r)s.push(o.slice(a,a+e)),a+=e;return i.coordinates=s,i}};var Lf,Ff={exports:{}},kf="object"==typeof Reflect?Reflect:null,zf=kf&&"function"==typeof kf.apply?kf.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};Lf=kf&&"function"==typeof kf.ownKeys?kf.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Rf=Number.isNaN||function(e){return e!=e};function Df(){Df.init.call(this)}Ff.exports=Df,Ff.exports.once=function(e,t){return new Promise((function(i,r){function n(i){e.removeListener(t,o),r(i)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}Zf(e,t,o,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&Zf(e,"error",t,i)}(e,n,{once:!0})}))},Df.EventEmitter=Df,Df.prototype._events=void 0,Df.prototype._eventsCount=0,Df.prototype._maxListeners=void 0;var Of=10;function Uf(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Nf(e){return void 0===e._maxListeners?Df.defaultMaxListeners:e._maxListeners}function Qf(e,t,i,r){var n,o,s,a;if(Uf(i),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),o=e._events),s=o[t]),void 0===s)s=o[t]=i,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[i,s]:[s,i]:r?s.unshift(i):s.push(i),(n=Nf(e))>0&&s.length>n&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,a=l,console&&console.warn&&console.warn(a)}return e}function jf(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Vf(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=jf.bind(r);return n.listener=i,r.wrapFn=n,n}function Hf(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=n[e];if(void 0===a)return!1;if("function"==typeof a)zf(a,this,t);else{var l=a.length,c=$f(a,l);for(i=0;i=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,n=o;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},Df.prototype.listeners=function(e){return Hf(this,e,!0)},Df.prototype.rawListeners=function(e){return Hf(this,e,!1)},Df.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Gf.call(e,t)},Df.prototype.listenerCount=Gf,Df.prototype.eventNames=function(){return this._eventsCount>0?Lf(this._events):[]};var qf=Ff.exports;const Kf=[];for(let e=0;e<256;++e)Kf.push((e+256).toString(16).slice(1));let Wf;const Xf=new Uint8Array(16);var Yf={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};const Jf="function"==typeof Buffer,eA=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder,Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),tA=(()=>{let e={};return eA.forEach(((t,i)=>e[t]=i)),e})(),iA=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,rA=String.fromCharCode.bind(String),nA=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),oA=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),sA=e=>{let t,i,r,n,o="";const s=e.length%3;for(let s=0;s255||(r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=i<<16|r<<8|n,o+=eA[t>>18&63]+eA[t>>12&63]+eA[t>>6&63]+eA[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},aA="function"==typeof btoa?e=>btoa(e):Jf?e=>Buffer.from(e,"binary").toString("base64"):sA,lA=Jf?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let i=0,r=e.length;it?nA(lA(e)):lA(e),uA=e=>{if(e=e.replace(/\s+/g,""),!iA.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,i,r,n="";for(let o=0;o>16&255):64===r?rA(t>>16&255,t>>8&255):rA(t>>16&255,t>>8&255,255&t);return n},hA=cA;var dA=Object.defineProperty,pA=e=>{throw TypeError(e)},fA=(e,t,i)=>((e,t,i)=>t in e?dA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),AA=(e,t,i)=>t.has(e)||pA("Cannot "+i),mA=(e,t,i)=>(AA(e,t,"read from private field"),i?i.call(e):t.get(e)),gA=(e,t,i)=>t.has(e)?pA("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),_A=(e,t,i,r)=>(AA(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),yA=(e,t,i)=>(AA(e,t,"access private method"),i);const vA={VISITOR:{code:null,flag:"visitor",name:"Visitor",latin:!0,isMode:!0,geocoding:!1},VISITOR_ENGLISH:{code:null,flag:"visitor_en",name:"Visitor English",latin:!0,isMode:!0,geocoding:!1},STYLE:{code:null,flag:"style",name:"Style",latin:!1,isMode:!0,geocoding:!1},STYLE_LOCK:{code:null,flag:"style_lock",name:"Style Lock",latin:!1,isMode:!0,geocoding:!1},...Sp};function xA(){if(typeof navigator>"u"){return Mp(Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0])||vA.ENGLISH}return Array.from(new Set(navigator.languages.map((e=>e.split("-")[0])))).map((e=>Mp(e))).filter((e=>e))[0]??vA.LOCAL}const bA={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",telemetryURL:"https://api.maptiler.com/metrics",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:vA.STYLE,secondaryLanguage:vA.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(bA);const wA=function(e,t,i){if(Yf.randomUUID&&!t&&!e)return Yf.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!Wf){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Wf=crypto.getRandomValues.bind(crypto)}return Wf(Xf)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){if((i=i||0)<0||i+16>t.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[i+e]=r[e];return t}return function(e,t=0){return(Kf[e[t+0]]+Kf[e[t+1]]+Kf[e[t+2]]+Kf[e[t+3]]+"-"+Kf[e[t+4]]+Kf[e[t+5]]+"-"+Kf[e[t+6]]+Kf[e[t+7]]+"-"+Kf[e[t+8]]+Kf[e[t+9]]+"-"+Kf[e[t+10]]+Kf[e[t+11]]+Kf[e[t+12]]+Kf[e[t+13]]+Kf[e[t+14]]+Kf[e[t+15]]).toLowerCase()}(r)}();class TA extends qf{constructor(){super(...arguments),fA(this,"primaryLanguage",bA.primaryLanguage),fA(this,"secondaryLanguage"),fA(this,"session",!0),fA(this,"caching",!0),fA(this,"telemetry",!0),fA(this,"_unit","metric"),fA(this,"_apiKey","")}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,Cp.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){Cp.fetch=e}get fetch(){return Cp.fetch}}const BA=new TA,CA="localcache_source",SA="localcache",EA=typeof caches<"u";function MA(e,t){if(EA&&BA.caching&&BA.session&&e.host===bA.maptilerApiHost){if("Source"===t&&e.href.includes("tiles.json"))return e.href.replace("https://",`${CA}://`);if("Tile"===t||"Glyphs"===t)return e.href.replace("https://",`${SA}://`)}return e.href}let IA;async function PA(){return IA||(IA=await caches.open("maptiler_sdk")),IA}let LA=0;function FA(){we.exports.addProtocol(CA,(async(e,t)=>{if(!e.url)throw new Error("");e.url=e.url.replace(`${CA}://`,"https://");const i=e;i.signal=t.signal;const r=await fetch(e.url,i),n=await r.json();return n.tiles&&n.tiles.length>0&&(n.tiles[0]+=`&last-modified=${r.headers.get("Last-Modified")}`),{data:n,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}})),we.exports.addProtocol(SA,(async(e,t)=>{if(!e.url)throw new Error("");e.url=e.url.replace(`${SA}://`,"https://");const i=new URL(e.url),r=new URL(i);r.searchParams.delete("mtsid"),r.searchParams.delete("key");const n=r.toString(),o=new URL(i);o.searchParams.delete("last-modified");const s=o.toString(),a=async e=>({data:await e.arrayBuffer(),cacheControl:e.headers.get("Cache-Control"),expires:e.headers.get("Expires")}),l=await PA(),c=await l.match(n);if(c)return a(c);const u=e;u.signal=t.signal;const h=await fetch(s,u);return h.status>=200&&h.status<300&&(l.put(n,h.clone()).catch((()=>{})),++LA>100&&(async function(){const e=await PA(),t=await e.keys(),i=t.slice(0,Math.max(t.length-1e3,0));for(const t of i)e.delete(t)}(),LA=0)),a(h)}))}function kA(e,t){let i=null;try{i=new URL(e)}catch{return{url:e}}return i.host===bA.maptilerApiHost&&(i.searchParams.has("key")||i.searchParams.append("key",BA.apiKey),BA.session&&i.searchParams.append("mtsid",wA)),{url:MA(i,t)}}function zA(e){return(t,i)=>{if(null!=e){const r=e(t,i),n=kA((null==r?void 0:r.url)??"",i);return{...r,...n}}return kA(t,i)}}function RA(){return Math.random().toString(36).substring(2)}function DA(e){return/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(e)}function OA(){return document.createElement("canvas").getContext("webgl2")?null:typeof WebGL2RenderingContext<"u"?"Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed.":"Your browser does not support graphic rendering with WebGL2. The map cannot be displayed."}function UA(e,t){return!(!Array.isArray(e)||2!==e.length||"get"!==e[0]||"string"!=typeof e[1]||t&&!e[1].startsWith("name:")||!t&&"name"!==e[1])}function NA(e,t,i){const r=structuredClone(e),n=e=>{if("string"!=typeof e)for(let r=0;ri===n.length-1?[e]:[e,t]))]}function VA(e){var t;const i=/\{name(?:\:(?\S+))?\}/g,r=[];for(;;){const n=i.exec(e);if(!n)break;const o=(null==(t=n.groups)?void 0:t.language)??null;r.push(o)}return r}function HA(e){return Array.isArray(e)&&2===e.length&&"get"===e[0]&&"string"==typeof e[1]?"name"===e[1].trim()?{isLanguage:!0,localization:null}:e[1].trim().startsWith("name:")?{isLanguage:!0,localization:e[1].trim().split(":").pop()}:null:null}function GA(e){const t=[],i=structuredClone(e),r=e=>{if("string"!=typeof e)for(let i=0;i":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_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"}}};class ym{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function vm(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}class xm extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class bm{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new bm(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const wm={kind:"null"},Tm={kind:"number"},Bm={kind:"string"},Cm={kind:"boolean"},Sm={kind:"color"},Em={kind:"projectionDefinition"},Mm={kind:"object"},Im={kind:"value"},Pm={kind:"collator"},Lm={kind:"formatted"},Fm={kind:"padding"},km={kind:"resolvedImage"},zm={kind:"variableAnchorOffsetCollection"};function Rm(e,t){return{kind:"array",itemType:e,N:t}}function Dm(e){if("array"===e.kind){const t=Dm(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Om=[wm,Tm,Bm,Cm,Sm,Em,Lm,Mm,Rm(Im),Fm,km,zm];function Um(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Um(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Om)if(!Um(e,t))return null}return`Expected ${Dm(e)} but found ${Dm(t)} instead.`}function Nm(e,t){return t.some((t=>t.kind===e.kind))}function Qm(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}function jm(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const Vm=.96422,Hm=.82521,Gm=4/29,$m=6/29,Zm=3*$m*$m,qm=$m*$m*$m,Km=Math.PI/180,Wm=180/Math.PI;function Xm(e){return(e%=360)<0&&(e+=360),e}function Ym([e,t,i,r]){let n,o;const s=eg((.2225045*(e=Jm(e))+.7168786*(t=Jm(t))+.0606169*(i=Jm(i)))/1);e===t&&t===i?n=o=s:(n=eg((.4360747*e+.3850649*t+.1430804*i)/Vm),o=eg((.0139322*e+.0971045*t+.7141733*i)/Hm));const a=116*s-16;return[a<0?0:a,500*(n-s),200*(s-o),r]}function Jm(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function eg(e){return e>qm?Math.pow(e,1/3):e/Zm+Gm}function tg([e,t,i,r]){let n=(e+16)/116,o=isNaN(t)?n:n+t/500,s=isNaN(i)?n:n-i/200;return n=1*rg(n),o=Vm*rg(o),s=Hm*rg(s),[ig(3.1338561*o-1.6168667*n-.4906146*s),ig(-.9787684*o+1.9161415*n+.033454*s),ig(.0719453*o-.2289914*n+1.4052427*s),r]}function ig(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function rg(e){return e>$m?e*e*e:Zm*(e-Gm)}function ng(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=cg[e];if(t){const[e,i,r]=t;return[e/255,i/255,r/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let i=1;return[og(e.slice(i,i+=t)),og(e.slice(i,i+=t)),og(e.slice(i,i+=t)),og(e.slice(i,i+t)||"ff")]}if(e.startsWith("rgb")){const t=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=e.match(t);if(i){const[e,t,r,n,o,s,a,l,c,u,h,d]=i,p=[n||" ",a||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[r,s,c].join(""),i="%%%"===e?100:""===e?255:0;if(i){const e=[ag(+t/i,0,1),ag(+o/i,0,1),ag(+l/i,0,1),h?sg(+h,d):1];if(lg(e))return e}}return}}const i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[e,t,r,n,o,s,a,l,c]=i,u=[r||" ",o||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,ag(+n,0,100),ag(+s,0,100),l?sg(+l,c):1];if(lg(e))return function([e,t,i,r]){function n(r){const n=(r+e/30)%12,o=t*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return e=Xm(e),t/=100,i/=100,[n(0),n(8),n(4),r]}(e)}}}function og(e){return parseInt(e.padEnd(2,e),16)/255}function sg(e,t){return ag(t?e/100:e,0,1)}function ag(e,t,i){return Math.min(Math.max(t,e),i)}function lg(e){return!e.some(Number.isNaN)}const cg={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function ug(e,t,i){return e+i*(t-e)}function hg(e,t,i){return e.map(((e,r)=>ug(e,t[r],i)))}class dg{constructor(e,t,i,r=1,n=!0){this.r=e,this.g=t,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,i,r]))}static parse(e){if(e instanceof dg)return e;if("string"!=typeof e)return;const t=ng(e);return t?new dg(...t,!1):void 0}get rgb(){const{r:e,g:t,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[e/n,t/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,i,r,n]=Ym(e),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?Xm(Math.atan2(r,i)*Wm):NaN,o,t,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Ym(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,r]=this.rgb;return`rgba(${[e,t,i].map((e=>Math.round(255*e))).join(",")},${r})`}static interpolate(e,t,i,r="rgb"){switch(r){case"rgb":{const[r,n,o,s]=hg(e.rgb,t.rgb,i);return new dg(r,n,o,s,!1)}case"hcl":{const[r,n,o,s]=e.hcl,[a,l,c,u]=t.hcl;let h,d;if(isNaN(r)||isNaN(a))isNaN(r)?isNaN(a)?h=NaN:(h=a,(1===o||0===o)&&(d=l)):(h=r,(1===c||0===c)&&(d=n));else{let e=a-r;a>r&&e>180?e-=360:a180&&(e+=360),h=r+i*e}const[p,f,A,m]=function([e,t,i,r]){return e=isNaN(e)?0:e*Km,tg([i,Math.cos(e)*t,Math.sin(e)*t,r])}([h,d??ug(n,l,i),ug(o,c,i),ug(s,u,i)]);return new dg(p,f,A,m,!1)}case"lab":{const[r,n,o,s]=tg(hg(e.lab,t.lab,i));return new dg(r,n,o,s,!1)}}}}dg.black=new dg(0,0,0,1),dg.white=new dg(1,1,1,1),dg.transparent=new dg(0,0,0,0),dg.red=new dg(1,0,0,1);class pg{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const fg=["bottom","center","top"];class Ag{constructor(e,t,i,r,n,o){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=o}}class mg{constructor(e){this.sections=e}static fromString(e){return new mg([new Ag(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof mg?e:mg.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}}class gg{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof gg)return e;if("number"==typeof e)return new gg([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new gg(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new gg(hg(e.values,t.values,i))}}class _g{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const yg=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class vg{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof vg)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?typeof r>"u"||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Tg(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof bg||e instanceof dg||e instanceof pg||e instanceof mg||e instanceof gg||e instanceof vg||e instanceof xg)return!0;if(Array.isArray(e)){for(const t of e)if(!Tg(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Tg(e[t]))return!1;return!0}return!1}function Bg(e){if(null===e)return wm;if("string"==typeof e)return Bm;if("boolean"==typeof e)return Cm;if("number"==typeof e)return Tm;if(e instanceof dg)return Sm;if(e instanceof bg)return Em;if(e instanceof pg)return Pm;if(e instanceof mg)return Lm;if(e instanceof gg)return Fm;if(e instanceof vg)return zm;if(e instanceof xg)return km;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=Bg(t);if(i){if(i===e)continue;i=Im;break}i=e}return Rm(i||Im,t)}return Mm}function Cg(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof dg||e instanceof bg||e instanceof mg||e instanceof gg||e instanceof vg||e instanceof xg?e.toString():JSON.stringify(e)}class Sg{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Tg(e[1]))return t.error("invalid value");const i=e[1];let r=Bg(i);const n=t.expectedType;return"array"===r.kind&&0===r.N&&n&&"array"===n.kind&&("number"!=typeof n.N||0===n.N)&&(r=n),new Sg(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Eg={string:Bm,number:Tm,boolean:Cm,object:Mm};class Mg{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in Eg)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=Eg[i],r++}else n=Im;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],r++}i=Rm(n,o)}else{if(!Eg[n])throw new Error(`Types doesn't contain name = ${n}`);i=Eg[n]}const o=[];for(;re.outputDefined()))}}const Ig={"to-boolean":Cm,"to-color":Sm,"to-number":Tm,"to-string":Bm};class Pg{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(!Ig[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!==e.length)return t.error("Expected one argument.");const r=Ig[i],n=[];for(let i=1;i4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:wg(t[0],t[1],t[2],t[3]),!i))return new dg(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new _g(i||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const r=gg.parse(t);if(r)return r}throw new _g(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const r=vg.parse(t);if(r)return r}throw new _g(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new _g(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return mg.fromString(Cg(this.args[0].evaluate(e)));case"resolvedImage":return xg.fromString(Cg(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Cg(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Lg=["Unknown","Point","LineString","Polygon"];class Fg{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?Lg[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(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=dg.parse(e)),t}}class kg{constructor(e,t,i=[],r,n=new bm,o=[]){this.registry=e,this.path=i,this.key=i.map((e=>`[${e}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=t}parse(e,t,i,r,n={}){return t?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}_parse(e,t){function i(e,t,i){return"assert"===i?new Mg(t,[e]):"coerce"===i?new Pg(t,[e]):e}if((null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e)&&(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind)if("projectionDefinition"!==e.kind||"string"!==n.kind&&"array"!==n.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==e.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind)if("variableAnchorOffsetCollection"!==e.kind||"value"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof Sg)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new Fg;try{r=new Sg(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const r="number"==typeof e?this.path.concat(e):this.path,n=i?this.scope.concat(i):this.scope;return new kg(this.registry,this._isConstant,r,t||null,n,this.errors)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new xm(i,e))}checkSubtype(e,t){const i=Um(e,t);return i&&this.error(i),i}}class zg{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let r=1;r=i.length)throw new _g(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new _g(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Og{constructor(e,t){this.type=Cm,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Im),r=t.parse(e[2],2,Im);return i&&r?Nm(i.type,[Cm,Bm,Tm,wm,Im])?new Og(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Dm(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!Qm(t,["boolean","string","number","null"]))throw new _g(`Expected first argument to be of type boolean, string, number or null, but found ${Dm(Bg(t))} instead.`);if(!Qm(i,["string","array"]))throw new _g(`Expected second argument to be of type array or string, but found ${Dm(Bg(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Ug{constructor(e,t,i){this.type=Tm,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Im),r=t.parse(e[2],2,Im);if(!i||!r)return null;if(!Nm(i.type,[Cm,Bm,Tm,wm,Im]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Dm(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Tm);return n?new Ug(i,r,n):null}return new Ug(i,r)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Qm(t,["boolean","string","number","null"]))throw new _g(`Expected first argument to be of type boolean, string, number or null, but found ${Dm(Bg(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),Qm(i,["string"])){const e=i.indexOf(t,r);return-1===e?-1:[...i.slice(0,e)].length}if(Qm(i,["array"]))return i.indexOf(t,r);throw new _g(`Expected second argument to be of type array or string, but found ${Dm(Bg(i))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Ng{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let s=2;sNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Bg(e)))return null}else i=Bg(e);if(typeof n[String(e)]<"u")return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(l,s,r);if(!u)return null;r=r||u.type,o.push(u)}const s=t.parse(e[1],1,Im);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,r);return!a||"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new Ng(i,r,s,n,o,a)}evaluate(e){const t=this.input.evaluate(e);return(Bg(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Qg{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const r=[];for(let n=1;nt.outputDefined()))&&this.otherwise.outputDefined()}}class jg{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Im),r=t.parse(e[2],2,Tm);if(!i||!r)return null;if(!Nm(i.type,[Rm(Im),Bm,Im]))return t.error(`Expected first argument to be of type array or string, but found ${Dm(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Tm);return n?new jg(i.type,i,r,n):null}return new jg(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),Qm(t,["string"]))return[...t].slice(i,r).join("");if(Qm(t,["array"]))return t.slice(i,r);throw new _g(`Expected first argument to be of type array or string, but found ${Dm(Bg(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Vg(e,t){const i=e.length-1;let r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=e[a],n=e[a+1],r<=t){if(a===i||tt))throw new _g("Input is not a number.");s=a-1}return 0}class Hg{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,Tm);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new Hg(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);return i[Vg(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Gg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $g,Zg;var qg=Gg(function(){if(Zg)return $g;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return Zg=1,$g=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},$g}());class Kg{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=Wg(t,e.base,i,r);else if("linear"===e.name)n=Wg(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new qg(o[0],o[1],o[2],o[3]).solve(Wg(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,Tm),!n)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=Sm:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(r,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return jm(a,Tm)||jm(a,Em)||jm(a,Sm)||jm(a,Fm)||jm(a,zm)||jm(a,Rm(Tm))?new Kg(a,i,r,n,s):t.error(`Type ${Dm(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=Vg(t,r),s=t[o],a=t[o+1],l=Kg.interpolationFactor(this.interpolation,r,s,a),c=i[o].evaluate(e),u=i[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ug(c,u,l);case"color":return dg.interpolate(c,u,l);case"padding":return gg.interpolate(c,u,l);case"variableAnchorOffsetCollection":return vg.interpolate(c,u,l);case"array":return hg(c,u,l);case"projectionDefinition":return bg.interpolate(c,u,l)}case"interpolate-hcl":return dg.interpolate(c,u,l,"hcl");case"interpolate-lab":return dg.interpolate(c,u,l,"lab")}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Wg(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}dg.interpolate,gg.interpolate,vg.interpolate;class Xg{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of e.slice(1)){const e=t.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}if(!i)throw new Error("No output type");return r&&n.some((e=>Um(r,e.type)))?new Xg(Im,n):new Xg(i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(e),i&&i instanceof xg&&!i.available&&(t||(t=i.name),i=null,r===this.args.length&&(i=t)),null!==i)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Yg(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function Jg(e,t,i,r){return 0===r.compare(t,i)}function e_(e,t,i){const r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=Cm,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,Im);if(!o)return null;if(!Yg(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${Dm(o.type)}'.`);let s=t.parse(e[2],2,Im);if(!s)return null;if(!Yg(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${Dm(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${Dm(o.type)}' and '${Dm(s.type)}'.`);r&&("value"===o.type.kind&&"value"!==s.type.kind?o=new Mg(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new Mg(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,Pm),!a)return null}return new n(o,s,a)}evaluate(n){const o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=Bg(o),i=Bg(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new _g(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=Bg(o),i=Bg(s);if("string"!==e.kind||"string"!==i.kind)return t(n,o,s)}return this.collator?i(n,o,s,this.collator.evaluate(n)):t(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const t_=e_("==",(function(e,t,i){return t===i}),Jg),i_=e_("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!Jg(0,t,i,r)})),r_=e_("<",(function(e,t,i){return t",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),o_=e_("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),s_=e_(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0}));class a_{constructor(e,t,i){this.type=Pm,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");const r=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,Cm);if(!r)return null;const n=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,Cm);if(!n)return null;let o=null;return i.locale&&(o=t.parse(i.locale,1,Bm),!o)?null:new a_(r,n,o)}evaluate(e){return new pg(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class l_{constructor(e,t,i,r,n){this.type=Bm,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Tm);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parse(r.locale,1,Bm),!n))return null;let o=null;if(r.currency&&(o=t.parse(r.currency,1,Bm),!o))return null;let s=null;if(r["min-fraction-digits"]&&(s=t.parse(r["min-fraction-digits"],1,Tm),!s))return null;let a=null;return r["max-fraction-digits"]&&(a=t.parse(r["max-fraction-digits"],1,Tm),!a)?null:new l_(i,n,o,s,a)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class c_{constructor(e){this.type=Lm,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,Tm),!e))return null;let i=null;if(o["text-font"]&&(i=t.parse(o["text-font"],1,Rm(Bm)),!i))return null;let s=null;if(o["text-color"]&&(s=t.parse(o["text-color"],1,Sm),!s))return null;let a=null;if(o["vertical-align"]){if("string"==typeof o["vertical-align"]&&!fg.includes(o["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(a=t.parse(o["vertical-align"],1,Bm),!a)return null}const l=r[r.length-1];l.scale=e,l.font=i,l.textColor=s,l.verticalAlign=a}else{const o=t.parse(e[i],1,Im);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null,verticalAlign:null})}}return new c_(r)}evaluate(e){return new mg(this.sections.map((t=>{const i=t.content.evaluate(e);return Bg(i)===km?new Ag("",i,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new Ag(Cg(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class u_{constructor(e){this.type=km,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Bm);return i?new u_(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=xg.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class h_{constructor(e){this.type=Tm,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${Dm(i.type)} instead.`):new h_(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new _g(`Expected value to be of type string or array, but found ${Dm(Bg(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const d_=8192;function p_(e,t){const i=function(e){return(180+e)/360}(e[0]),r=function(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}(e[1]),n=Math.pow(2,t.z);return[Math.round(i*n*d_),Math.round(r*n*d_)]}function f_(e,t){const i=Math.pow(2,t.z),r=(e[0]/d_+t.x)/i,n=(e[1]/d_+t.y)/i;return[A_(r),m_(n)]}function A_(e){return 360*e-180}function m_(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function g_(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function __(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function y_(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function v_(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],s=e[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function x_(e,t,i,r){const n=[t[0]-e[0],t[1]-e[1]];return 0!==function(e,t){return e[0]*t[1]-e[1]*t[0]}([r[0]-i[0],r[1]-i[1]],n)&&!(!S_(e,t,i,r)||!S_(i,r,e,t))}function b_(e,t,i){for(const r of i)for(let i=0;i0&&h<0||u<0&&h>0}function E_(e,t,i){const r=[];for(let n=0;ni[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}g_(t,e)}function P_(e,t,i,r){const n=Math.pow(2,r.z)*d_,o=[r.x*d_,r.y*d_],s=[];for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];I_(r,t,i,n),s.push(r)}return s}function L_(e,t,i,r){const n=Math.pow(2,r.z)*d_,o=[r.x*d_,r.y*d_],s=[];for(const i of e){const e=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];g_(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=n/2){!function(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}(t);for(const e of s)for(const r of e)I_(r,t,i,n)}return s}class F_{constructor(e,t){this.type=Cm,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Tg(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const i of t.features){const{type:t,coordinates:r}=i.geometry;"Polygon"===t&&e.push(r),"MultiPolygon"===t&&e.push(...r)}if(e.length){return new F_(t,{type:"MultiPolygon",coordinates:e})}}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new F_(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new F_(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=E_(t.coordinates,r,n),s=P_(e.geometry(),i,r,n);if(!__(i,r))return!1;for(const e of s)if(!w_(e,o))return!1}if("MultiPolygon"===t.type){const o=M_(t.coordinates,r,n),s=P_(e.geometry(),i,r,n);if(!__(i,r))return!1;for(const e of s)if(!T_(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=E_(t.coordinates,r,n),s=L_(e.geometry(),i,r,n);if(!__(i,r))return!1;for(const e of s)if(!B_(e,o))return!1}if("MultiPolygon"===t.type){const o=M_(t.coordinates,r,n),s=L_(e.geometry(),i,r,n);if(!__(i,r))return!1;for(const e of s)if(!C_(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class k_{constructor(e=[],t=(e,t)=>et?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e=0)break;t[e]=t[r],e=r}t[e]=n}}function z_(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n1?(l=e[a+1][0],c=e[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;p180;)e-=360;return e}}function N_(e,t){return t[0]-e[0]}function Q_(e){return e[1]-e[0]+1}function j_(e,t){return e[1]>=e[0]&&e[1]e[1])return[null,null];const i=Q_(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===i)return[e,null];const r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function H_(e,t){if(!j_(t,e.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)g_(i,e[r]);return i}function G_(e){const t=[1/0,1/0,-1/0,-1/0];for(const i of e)for(const e of i)g_(t,e);return t}function $_(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Z_(e,t,i){if(!$_(e)||!$_(t))return NaN;let r=0,n=0;return e[2]t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]=r)return r;if(__(n,o)){if(ey(e,t))return 0}else if(ey(t,e))return 0;let s=1/0;for(const r of e)for(let e=0,n=r.length,o=n-1;e0;){const n=s.pop();if(n[0]>=o)continue;const l=n[1],c=t?50:100;if(Q_(l)<=c){if(!j_(l,e.length))return NaN;if(t){const t=J_(e,l,i,r);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const n=Y_(e[t],i,r);if(o=Math.min(o,n),0===o)return 0}}else{const i=V_(l,t);iy(s,o,r,e,a,i[0]),iy(s,o,r,e,a,i[1])}}return o}function oy(e,t,i,r,n,o=1/0){let s=Math.min(o,n.distance(e[0],i[0]));if(0===s)return s;const a=new k_([[0,[0,e.length-1],[0,i.length-1]]],N_);for(;a.length>0;){const o=a.pop();if(o[0]>=s)continue;const l=o[1],c=o[2],u=t?50:100,h=r?50:100;if(Q_(l)<=u&&Q_(c)<=h){if(!j_(l,e.length)&&j_(c,i.length))return NaN;let o;if(t&&r)o=W_(e,l,i,c,n),s=Math.min(s,o);else if(t&&!r){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=q_(i[e],t,n),s=Math.min(s,o),0===s)return s}else if(!t&&r){const t=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(o=q_(e[i],t,n),s=Math.min(s,o),0===s)return s}else o=X_(e,l,i,c,n),s=Math.min(s,o)}else{const o=V_(l,t),u=V_(c,r);ry(a,s,n,e,i,o[0],u[0]),ry(a,s,n,e,i,o[0],u[1]),ry(a,s,n,e,i,o[1],u[0]),ry(a,s,n,e,i,o[1],u[1])}}return s}function sy(e,t){const i=e.geometry();if(0===i.length||0===i[0].length)return NaN;const r=function(e){if(e.length<=1)return[e];const t=[];let i,r;for(const n of e){const e=z_(n);0!==e&&(n.area=Math.abs(e),void 0===r&&(r=e<0),r===e<0?(i&&t.push(i),i=[n]):i.push(n))}return i&&t.push(i),t}(i).map((t=>t.map((t=>t.map((t=>f_([t.x,t.y],e.canonical))))))),n=new U_(r[0][0][0][1]);let o=1/0;for(const e of t)for(const t of r){switch(e.type){case"Point":o=Math.min(o,ny([e.coordinates],!1,t,n,o));break;case"LineString":o=Math.min(o,ny(e.coordinates,!0,t,n,o));break;case"Polygon":o=Math.min(o,ty(t,e.coordinates,n,o))}if(0===o)return o}return o}function ay(e){return"MultiPolygon"===e.type?e.coordinates.map((e=>({type:"Polygon",coordinates:e}))):"MultiLineString"===e.type?e.coordinates.map((e=>({type:"LineString",coordinates:e}))):"MultiPoint"===e.type?e.coordinates.map((e=>({type:"Point",coordinates:e}))):[e]}class ly{constructor(e,t){this.type=Tm,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Tg(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new ly(t,t.features.map((e=>ay(e.geometry))).flat());if("Feature"===t.type)return new ly(t,ay(t.geometry));if("type"in t&&"coordinates"in t)return new ly(t,ay(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>f_([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new U_(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,oy(r,!1,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,oy(r,!1,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,ny(r,!1,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>f_([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new U_(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,oy(r,!0,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,oy(r,!0,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,ny(r,!0,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("Polygon"===e.geometryType())return sy(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const cy={"==":t_,"!=":i_,">":n_,"<":r_,">=":s_,"<=":o_,array:Mg,at:Dg,boolean:Mg,case:Qg,coalesce:Xg,collator:a_,format:c_,image:u_,in:Og,"index-of":Ug,interpolate:Kg,"interpolate-hcl":Kg,"interpolate-lab":Kg,length:h_,let:zg,literal:Sg,match:Ng,number:Mg,"number-format":l_,object:Mg,slice:jg,step:Hg,string:Mg,"to-boolean":Pg,"to-color":Pg,"to-number":Pg,"to-string":Pg,var:Rg,within:F_,distance:ly};class uy{constructor(e,t,i,r){this.name=e,this.type=t,this._evaluate=i,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],r=uy.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let a=null;for(const[r,o]of s){a=new kg(t.registry,Ay,t.path,null,t.scope);const s=[];let l=!1;for(let t=1;t{return t=e,Array.isArray(t)?`(${t.map(Dm).join(", ")})`:`(${Dm(t.type)}...)`;var t})).join(" | "),r=[];for(let i=1;i"u"?null:i}function fy(e){return{type:e}}function Ay(e){if(e instanceof Rg)return Ay(e.boundExpression);if(e instanceof uy&&"error"===e.name)return!1;if(e instanceof a_)return!1;if(e instanceof F_)return!1;if(e instanceof ly)return!1;const t=e instanceof Pg||e instanceof Mg;let i=!0;return e.eachChild((e=>{i=t?i&&Ay(e):i&&e instanceof Sg})),!!i&&(my(e)&&_y(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]))}function my(e){if(e instanceof uy){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof F_||e instanceof ly)return!1;let t=!0;return e.eachChild((e=>{t&&!my(e)&&(t=!1)})),t}function gy(e){if(e instanceof uy&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!gy(e)&&(t=!1)})),t}function _y(e,t){if(e instanceof uy&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!_y(e,t)&&(i=!1)})),i}function yy(e){return{result:"success",value:e}}function vy(e){return{result:"error",value:e}}function xy(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function by(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function wy(e){return!!e.expression&&e.expression.interpolated}function Ty(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function By(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}uy.register(cy,{error:[{kind:"error"},[Bm],(e,[t])=>{throw new _g(t.evaluate(e))}],typeof:[Bm,[Im],(e,[t])=>Dm(Bg(t.evaluate(e)))],"to-rgba":[Rm(Tm,4),[Sm],(e,[t])=>{const[i,r,n,o]=t.evaluate(e).rgb;return[255*i,255*r,255*n,o]}],rgb:[Sm,[Tm,Tm,Tm],hy],rgba:[Sm,[Tm,Tm,Tm,Tm],hy],has:{type:Cm,overloads:[[[Bm],(e,[t])=>dy(t.evaluate(e),e.properties())],[[Bm,Mm],(e,[t,i])=>dy(t.evaluate(e),i.evaluate(e))]]},get:{type:Im,overloads:[[[Bm],(e,[t])=>py(t.evaluate(e),e.properties())],[[Bm,Mm],(e,[t,i])=>py(t.evaluate(e),i.evaluate(e))]]},"feature-state":[Im,[Bm],(e,[t])=>py(t.evaluate(e),e.featureState||{})],properties:[Mm,[],e=>e.properties()],"geometry-type":[Bm,[],e=>e.geometryType()],id:[Im,[],e=>e.id()],zoom:[Tm,[],e=>e.globals.zoom],"heatmap-density":[Tm,[],e=>e.globals.heatmapDensity||0],"line-progress":[Tm,[],e=>e.globals.lineProgress||0],accumulated:[Im,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Tm,fy(Tm),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[Tm,fy(Tm),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:Tm,overloads:[[[Tm,Tm],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[Tm],(e,[t])=>-t.evaluate(e)]]},"/":[Tm,[Tm,Tm],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[Tm,[Tm,Tm],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[Tm,[],()=>Math.LN2],pi:[Tm,[],()=>Math.PI],e:[Tm,[],()=>Math.E],"^":[Tm,[Tm,Tm],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[Tm,[Tm],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Tm,[Tm],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Tm,[Tm],(e,[t])=>Math.log(t.evaluate(e))],log2:[Tm,[Tm],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Tm,[Tm],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Tm,[Tm],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Tm,[Tm],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Tm,[Tm],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Tm,[Tm],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Tm,[Tm],(e,[t])=>Math.atan(t.evaluate(e))],min:[Tm,fy(Tm),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[Tm,fy(Tm),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[Tm,[Tm],(e,[t])=>Math.abs(t.evaluate(e))],round:[Tm,[Tm],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[Tm,[Tm],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Tm,[Tm],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[Cm,[Bm,Im],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[Cm,[Im],(e,[t])=>e.id()===t.value],"filter-type-==":[Cm,[Bm],(e,[t])=>e.geometryType()===t.value],"filter-<":[Cm,[Bm,Im],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r{const i=e.id(),r=t.value;return typeof i==typeof r&&i":[Cm,[Bm,Im],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[Cm,[Im],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[Cm,[Bm,Im],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[Cm,[Im],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[Cm,[Bm,Im],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[Cm,[Im],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[Cm,[Im],(e,[t])=>t.value in e.properties()],"filter-has-id":[Cm,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[Cm,[Rm(Bm)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[Cm,[Rm(Im)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[Cm,[Bm,Rm(Im)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[Cm,[Bm,Rm(Im)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:Cm,overloads:[[[Cm,Cm],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[fy(Cm),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:Cm,overloads:[[[Cm,Cm],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[fy(Cm),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[Cm,[Cm],(e,[t])=>!t.evaluate(e)],"is-supported-script":[Cm,[Bm],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[Bm,[Bm],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Bm,[Bm],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Bm,fy(Im),(e,t)=>t.map((t=>Cg(t.evaluate(e)))).join("")],"resolved-locale":[Bm,[Pm],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Cy{constructor(e,t){var i;this.expression=e,this._warningHistory={},this._evaluator=new Fg,this._defaultValue=t?"color"===(i=t).type&&By(i.default)?new dg(0,0,0,0):"color"===i.type?dg.parse(i.default)||null:"padding"===i.type?gg.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?vg.parse(i.default)||null:"projectionDefinition"===i.type?bg.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,o){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new _g(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,typeof console<"u"&&console.warn(e.message)),this._defaultValue}}}function Sy(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in cy}function Ey(e,t){const i=new kg(cy,Ay,[],t?function(e){const t={color:Sm,string:Bm,number:Tm,enum:Bm,boolean:Cm,formatted:Lm,padding:Fm,projectionDefinition:Em,resolvedImage:km,variableAnchorOffsetCollection:zm};return"array"===e.type?Rm(t[e.value]||Im,e.length):t[e.type]}(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?yy(new Cy(r,t)):vy(i.errors)}class My{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!gy(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}}class Iy{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!gy(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?Kg.interpolationFactor(this.interpolationType,e,t,i):0}}function Py(e,t){const i=Ey(e,t);if("error"===i.result)return i;const r=i.value.expression,n=my(r);if(!n&&!xy(t))return vy([new xm("","data expressions not supported")]);const o=_y(r,["zoom"]);if(!o&&!by(t))return vy([new xm("","zoom expressions not supported")]);const s=Ly(r);if(!s&&!o)return vy([new xm("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof xm)return vy([s]);if(s instanceof Kg&&!wy(t))return vy([new xm("",'"interpolate" expressions cannot be used with this property')]);if(!s)return yy(new My(n?"constant":"source",i.value));const a=s instanceof Kg?s.interpolation:void 0;return yy(new Iy(n?"camera":"composite",i.value,s.labels,a))}function Ly(e){let t=null;if(e instanceof zg)t=Ly(e.result);else if(e instanceof Xg){for(const i of e.args)if(t=Ly(i),t)break}else(e instanceof Hg||e instanceof Kg)&&e.input instanceof uy&&"zoom"===e.input.name&&(t=e);return t instanceof xm||e.eachChild((e=>{const i=Ly(e);i instanceof xm?t=i:!t&&i?t=new xm("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new xm("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function Fy(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Fy(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function ky(e){const t=e.key,i=e.value;return i?[new ym(t,i,"constants have been deprecated as of v8")]:[]}function zy(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Ry(e){if(Array.isArray(e))return e.map(Ry);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=Ry(e[i]);return t}return zy(e)}function Dy(e){const t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},o=e.style,s=e.styleSpec,a=e.validateSpec;let l=[];const c=Ty(i);if("object"!==c)return[new ym(t,i,`object expected, ${c} found`)];for(const e in i){const c=e.split(".")[0],u=r[c]||r["*"];let h;if(n[c])h=n[c];else if(r[c])h=a;else if(n["*"])h=n["*"];else{if(!r["*"]){l.push(new ym(t,i[e],`unknown property "${e}"`));continue}h=a}l=l.concat(h({key:(t&&`${t}.`)+e,value:i[e],valueSpec:u,style:o,styleSpec:s,object:i,objectKey:e,validateSpec:a},i))}for(const e in r)n[e]||r[e].required&&void 0===r[e].default&&void 0===i[e]&&l.push(new ym(t,i,`missing required property "${e}"`));return l}function Oy(e){const t=e.value,i=e.valueSpec,r=e.validateSpec,n=e.style,o=e.styleSpec,s=e.key,a=e.arrayElementValidator||r;if("array"!==Ty(t))return[new ym(s,t,`array expected, ${Ty(t)} found`)];if(i.length&&t.length!==i.length)return[new ym(s,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.lengthr.maximum?[new ym(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function Ny(e){const t=e.valueSpec,i=zy(e.value.type);let r,n,o,s={};const a="categorical"!==i&&void 0===e.value.property,l=!a,c="array"===Ty(e.value.stops)&&"array"===Ty(e.value.stops[0])&&"object"===Ty(e.value.stops[0][0]),u=Dy({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new ym(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(Oy({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===Ty(r)&&0===r.length&&t.push(new ym(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&a&&u.push(new ym(e.key,e.value,'missing required property "property"')),"identity"!==i&&!e.value.stops&&u.push(new ym(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!wy(e.valueSpec)&&u.push(new ym(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!xy(e.valueSpec)?u.push(new ym(e.key,e.value,"property functions not supported")):a&&!by(e.valueSpec)&&u.push(new ym(e.key,e.value,"zoom functions not supported"))),("categorical"===i||c)&&void 0===e.value.property&&u.push(new ym(e.key,e.value,'"property" property is required')),u;function h(e){let i=[];const r=e.value,a=e.key;if("array"!==Ty(r))return[new ym(a,r,`array expected, ${Ty(r)} found`)];if(2!==r.length)return[new ym(a,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==Ty(r[0]))return[new ym(a,r,`object expected, ${Ty(r[0])} found`)];if(void 0===r[0].zoom)return[new ym(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new ym(a,r,"object stop key must have value")];if(o&&o>zy(r[0].zoom))return[new ym(a,r[0].zoom,"stop zoom values must appear in ascending order")];zy(r[0].zoom)!==o&&(o=zy(r[0].zoom),n=void 0,s={}),i=i.concat(Dy({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Uy,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:r[0],valueSpec:{},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return Sy(Ry(r[1]))?i.concat([new ym(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(e.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const a=Ty(e.value),l=zy(e.value),c=null!==e.value?e.value:o;if(r){if(a!==r)return[new ym(e.key,c,`${a} stop domain type must match previous stop domain type ${r}`)]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new ym(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let r=`number expected, ${a} found`;return xy(t)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ym(e.key,c,r)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==n&&lnew ym(`${e.key}${t.key}`,e.value,t.message)));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new ym(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!gy(i))return[new ym(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!gy(i))return[new ym(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!_y(i,["zoom","feature-state"]))return[new ym(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!my(i))return[new ym(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function jy(e){const t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(zy(i))&&n.push(new ym(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(zy(i))&&n.push(new ym(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function Vy(e){return Fy(Ry(e.value))?Qy(vm({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Hy(e)}function Hy(e){const t=e.value,i=e.key;if("array"!==Ty(t))return[new ym(i,t,`array expected, ${Ty(t)} found`)];const r=e.styleSpec;let n,o=[];if(t.length<1)return[new ym(i,t,"filter array must have at least 1 element")];switch(o=o.concat(jy({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),zy(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===zy(t[1])&&o.push(new ym(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new ym(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=Ty(t[1]),"string"!==n&&o.push(new ym(`${i}[1]`,t[1],`string expected, ${n} found`)));for(let s=2;s{e in i&&t.push(new ym(r,i[e],`"${e}" is prohibited for ref layers`))})),n.layers.forEach((t=>{zy(t.id)===a&&(e=t)})),e?e.ref?t.push(new ym(r,i.ref,"ref cannot reference another ref layer")):s=zy(e.type):t.push(new ym(r,i.ref,`ref layer "${a}" not found`))}else if("background"!==s)if(i.source){const e=n.sources&&n.sources[i.source],o=e&&zy(e.type);e?"vector"===o&&"raster"===s?t.push(new ym(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===s?t.push(new ym(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==s?t.push(new ym(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==s?t.push(new ym(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===s&&i.paint&&i.paint["line-gradient"]&&("geojson"!==o||!e.lineMetrics)&&t.push(new ym(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new ym(r,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new ym(r,i.source,`source "${i.source}" not found`))}else t.push(new ym(r,i,'missing required property "source"'));return t=t.concat(Dy({key:r,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"}),filter:Vy,layout:e=>Dy({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Zy(vm({layerType:s},e))}}),paint:e=>Dy({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>$y(vm({layerType:s},e))}})}})),t}function Ky(e){const t=e.value,i=e.key,r=Ty(t);return"string"!==r?[new ym(i,t,`string expected, ${r} found`)]:[]}const Wy={promoteId:function({key:e,value:t}){if("string"===Ty(t))return Ky({key:e,value:t});{const i=[];for(const r in t)i.push(...Ky({key:`${e}.${r}`,value:t[r]}));return i}}};function Xy(e){const t=e.value,i=e.key,r=e.styleSpec,n=e.style,o=e.validateSpec;if(!t.type)return[new ym(i,t,'"type" is required')];const s=zy(t.type);let a;switch(s){case"vector":case"raster":return a=Dy({key:i,value:t,valueSpec:r[`source_${s.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:Wy,validateSpec:o}),a;case"raster-dem":return a=function(e){var t;const i=null!==(t=e.sourceName)&&void 0!==t?t:"",r=e.value,n=e.styleSpec,o=n.source_raster_dem,s=e.style;let a=[];const l=Ty(r);if(void 0===r)return a;if("object"!==l)return a.push(new ym("source_raster_dem",r,`object expected, ${l} found`)),a;const c="custom"===zy(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const t in r)!c&&u.includes(t)?a.push(new ym(t,r[t],`In "${i}": "${t}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[t]?a=a.concat(e.validateSpec({key:t,value:r[t],valueSpec:o[t],validateSpec:e.validateSpec,style:s,styleSpec:n})):a.push(new ym(t,r[t],`unknown property "${t}"`));return a}({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:o}),a;case"geojson":if(a=Dy({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:Wy}),t.cluster)for(const e in t.clusterProperties){const[r,n]=t.clusterProperties[e],s="string"==typeof r?[r,["accumulated"],["get",e]]:r;a.push(...Qy({key:`${i}.${e}.map`,value:n,validateSpec:o,expressionContext:"cluster-map"})),a.push(...Qy({key:`${i}.${e}.reduce`,value:s,validateSpec:o,expressionContext:"cluster-reduce"}))}return a;case"video":return Dy({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return Dy({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new ym(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return jy({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:o,styleSpec:r})}}function Yy(e){const t=e.value,i=e.styleSpec,r=i.light,n=e.style;let o=[];const s=Ty(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new ym("light",t,`object expected, ${s} found`)]),o;for(const s in t){const a=s.match(/^(.*)-transition$/);o=a&&r[a[1]]&&r[a[1]].transition?o.concat(e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i})):r[s]?o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i})):o.concat([new ym(s,t[s],`unknown property "${s}"`)])}return o}function Jy(e){const t=e.value,i=e.styleSpec,r=i.sky,n=e.style,o=Ty(t);if(void 0===t)return[];if("object"!==o)return[new ym("sky",t,`object expected, ${o} found`)];let s=[];for(const o in t)s=r[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i})):s.concat([new ym(o,t[o],`unknown property "${o}"`)]);return s}function ev(e){const t=e.value,i=e.styleSpec,r=i.terrain,n=e.style;let o=[];const s=Ty(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new ym("terrain",t,`object expected, ${s} found`)]),o;for(const s in t)o=r[s]?o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i})):o.concat([new ym(s,t[s],`unknown property "${s}"`)]);return o}function tv(e){let t=[];const i=e.value,r=e.key;if(Array.isArray(i)){const n=[],o=[];for(const s in i){i[s].id&&n.includes(i[s].id)&&t.push(new ym(r,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),n.push(i[s].id),i[s].url&&o.includes(i[s].url)&&t.push(new ym(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),o.push(i[s].url);const a={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(Dy({key:`${r}[${s}]`,value:i[s],valueSpec:a,validateSpec:e.validateSpec}))}return t}return Ky({key:r,value:i})}const iv={"*":()=>[],array:Oy,boolean:function(e){const t=e.value,i=e.key,r=Ty(t);return"boolean"!==r?[new ym(i,t,`boolean expected, ${r} found`)]:[]},number:Uy,color:function(e){const t=e.key,i=e.value,r=Ty(i);return"string"!==r?[new ym(t,i,`color expected, ${r} found`)]:dg.parse(String(i))?[]:[new ym(t,i,`color expected, "${i}" found`)]},constants:ky,enum:jy,filter:Vy,function:Ny,layer:qy,object:Dy,source:Xy,light:Yy,sky:Jy,terrain:ev,projection:function(e){const t=e.value,i=e.styleSpec,r=i.projection,n=e.style,o=Ty(t);if(void 0===t)return[];if("object"!==o)return[new ym("projection",t,`object expected, ${o} found`)];let s=[];for(const o in t)s=r[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i})):s.concat([new ym(o,t[o],`unknown property "${o}"`)]);return s},projectionDefinition:function(e){const t=e.key;let i=e.value;i=i instanceof String?i.valueOf():i;const r=Ty(i);return"array"!==r||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(i)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(i)?["array","string"].includes(r)?[]:[new ym(t,i,`projection expected, invalid type "${r}" found`)]:[new ym(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Ky,formatted:function(e){return 0===Ky(e).length?[]:Qy(e)},resolvedImage:function(e){return 0===Ky(e).length?[]:Qy(e)},padding:function(e){const t=e.key,i=e.value;if("array"===Ty(i)){if(i.length<1||i.length>4)return[new ym(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let o=0;o[]}})),e.constants&&(i=i.concat(ky({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:rv}))),av(i)}function sv(e){return function(t){return e({...t,validateSpec:rv})}}function av(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function lv(e){return function(...t){return av(e.apply(this,t))}}function cv(e){if(!e)return{style:ef[Xp[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0};if("string"==typeof e){const t=function(e){try{const t=JSON.parse(e),i=ov(t);return{isValidJSON:!0,isValidStyle:0===i.length,styleObject:0===i.length?t:null}}catch{return{isValidJSON:!1,isValidStyle:!1,styleObject:null}}}(e);return t.isValidStyle?{style:t.styleObject,requiresUrlMonitoring:!1,isFallback:!1}:t.isValidJSON?{style:ef[Xp[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0}:e.startsWith("http")?{style:e,requiresUrlMonitoring:!0,isFallback:!1}:e.toLowerCase().includes(".json")?{style:uv(e),requiresUrlMonitoring:!0,isFallback:!1}:{style:qp(e),requiresUrlMonitoring:!0,isFallback:!1}}return e instanceof Kp?{style:e.getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!1}:e instanceof Wp?{style:e.getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!1}:0===ov(e).length?{style:e,requiresUrlMonitoring:!1,isFallback:!1}:{style:ef[Xp[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0}}function uv(e){try{return new URL(e).href}catch{}return new URL(e,location.origin).href}function hv(e,t,i){const r=window.document.createElement(e);return void 0!==t&&(r.className=t),i&&i.appendChild(r),r}function dv(e){e.parentNode&&e.parentNode.removeChild(e)}ov.source=lv(sv(Xy)),ov.sprite=lv(sv(tv)),ov.glyphs=lv(sv(nv)),ov.light=lv(sv(Yy)),ov.sky=lv(sv(Jy)),ov.terrain=lv(sv(ev)),ov.layer=lv(sv(qy)),ov.filter=lv(sv(Vy)),ov.paintProperty=lv(sv($y)),ov.layoutProperty=lv(sv(Zy));class pv{constructor(){fA(this,"_map"),fA(this,"_container"),fA(this,"_terrainButton"),function(e,t){for(const i of e)"function"==typeof t[i]&&(t[i]=t[i].bind(t))}(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=hv("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=hv("button","maplibregl-ctrl-terrain",this._container),hv("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(){dv(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))}}class fv extends im{constructor(e={}){super({showCompass:e.showCompass??!0,showZoom:e.showZoom??!0,visualizePitch:e.visualizePitch??!0}),fA(this,"_rotateCompassArrow",(()=>{const e=this._map.getBearing(),t=this._map.getPitch(),i=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.cos(t*(Math.PI/180))**.5)}) rotateX(${Math.min(70,t)}deg) rotateZ(${-e}deg)`:`rotate(${-e}deg)`;this._compassIcon.style.transform=i})),this._compass&&(this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",(e=>{0===this._map.getPitch()?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})))}_createButton(e,t){const i=super._createButton(e,t);return i.clickFunction=t,i}}const Av=Te.Marker,mv=Te.LngLat,gv=Te.LngLatBounds;class _v extends rm{constructor(){super(...arguments),fA(this,"lastUpdatedCenter",new mv(0,0)),fA(this,"_updateCamera",(e=>{var t;const i=new mv(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n={bearing:this._map.getBearing(),...this.options.fitBoundsOptions,linear:!0},o=this._map.getZoom();o>((null==(t=this.options.fitBoundsOptions)?void 0:t.maxZoom)??30)&&(n.zoom=o),this._map.fitBounds(gv.fromLngLat(i,r),n,{geolocateSource:!0});let s=!1;const a=()=>{s=!0};this._map.once("click",a),this._map.once("dblclick",a),this._map.once("dragstart",a),this._map.once("mousedown",a),this._map.once("touchstart",a),this._map.once("wheel",a),this._map.once("moveend",(()=>{this._map.off("click",a),this._map.off("dblclick",a),this._map.off("dragstart",a),this._map.off("mousedown",a),this._map.off("touchstart",a),this._map.off("wheel",a),!s&&(this.lastUpdatedCenter=this._map.getCenter())}))})),fA(this,"_finishSetupUI",(e=>{if(this._map){if(!1===e){const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=hv("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Av({element:this._dotElement}),this._circleElement=hv("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Av({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",(e=>{const t=e.originalEvent&&"resize"===e.originalEvent.type,i=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!e.geolocateSource&&"ACTIVE_LOCK"===this._watchState&&!t&&i>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))}))}})),fA(this,"_onZoom",(()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}))}_updateCircleRadius(){if("BACKGROUND"!==this._watchState&&"ACTIVE_LOCK"!==this._watchState)return;const e=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],t=this._map.project(e),i=this._map.unproject([t.x,t.y]),r=this._map.unproject([t.x+20,t.y]),n=i.distanceTo(r)/20,o=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_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":case"BACKGROUND_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}}var yv,vv,xv,bv,wv,Tv,Bv,Cv,Sv,Ev;class Mv{constructor(e,t){gA(this,Bv),gA(this,yv),fA(this,"map"),gA(this,vv),gA(this,xv),gA(this,bv),gA(this,wv,!1),gA(this,Tv),void 0!==e.style&&_A(this,wv,!0),_A(this,yv,{zoomAdjust:-4,position:"top-right",...t,forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1,...e,containerStyle:{border:"1px solid #000",width:"400px",height:"300px",...e.containerStyle??{}}}),void 0!==e.lockZoom&&(mA(this,yv).minZoom=e.lockZoom,mA(this,yv).maxZoom=e.lockZoom)}setStyle(e,t){mA(this,wv)||this.map.setStyle(e,t),yA(this,Bv,Sv).call(this)}addLayer(e,t){return mA(this,wv)||this.map.addLayer(e,t),yA(this,Bv,Sv).call(this),this.map}moveLayer(e,t){return mA(this,wv)||this.map.moveLayer(e,t),yA(this,Bv,Sv).call(this),this.map}removeLayer(e){return mA(this,wv)||this.map.removeLayer(e),yA(this,Bv,Sv).call(this),this}setLayerZoomRange(e,t,i){return mA(this,wv)||this.map.setLayerZoomRange(e,t,i),yA(this,Bv,Sv).call(this),this}setFilter(e,t,i){return mA(this,wv)||this.map.setFilter(e,t,i),yA(this,Bv,Sv).call(this),this}setPaintProperty(e,t,i,r){return mA(this,wv)||this.map.setPaintProperty(e,t,i,r),yA(this,Bv,Sv).call(this),this}setLayoutProperty(e,t,i,r){return mA(this,wv)||this.map.setLayoutProperty(e,t,i,r),yA(this,Bv,Sv).call(this),this}setGlyphs(e,t){return mA(this,wv)||this.map.setGlyphs(e,t),yA(this,Bv,Sv).call(this),this}onAdd(e){_A(this,vv,e),_A(this,xv,hv("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[e,t]of Object.entries(mA(this,yv).containerStyle))mA(this,xv).style.setProperty(e,t);return mA(this,yv).container=mA(this,xv),mA(this,yv).zoom=e.getZoom()+mA(this,yv).zoomAdjust,this.map=new kv(mA(this,yv)),this.map.once("style.load",(()=>{this.map.resize()})),this.map.once("load",(()=>{yA(this,Bv,Cv).call(this,mA(this,yv).parentRect),_A(this,Tv,yA(this,Bv,Ev).call(this))})),mA(this,xv)}onRemove(){var e;null==(e=mA(this,Tv))||e.call(this),dv(mA(this,xv))}}yv=new WeakMap,vv=new WeakMap,xv=new WeakMap,bv=new WeakMap,wv=new WeakMap,Tv=new WeakMap,Bv=new WeakSet,Cv=function(e){void 0===e||void 0===e.linePaint&&void 0===e.fillPaint||(_A(this,bv,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:mA(this,bv)}),(void 0!==e.lineLayout||void 0!==e.linePaint)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:{...e.lineLayout},paint:{"line-color":"#FFF","line-width":1,"line-opacity":.85,...e.linePaint}}),void 0!==e.fillPaint&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:{"fill-color":"#08F","fill-opacity":.135,...e.fillPaint}}),yA(this,Bv,Sv).call(this))},Sv=function(){if(void 0===mA(this,bv))return;const{devicePixelRatio:e}=window,t=mA(this,vv).getCanvas(),i=t.width/e,r=t.height/e,n=mA(this,vv).unproject.bind(mA(this,vv)),o=n([0,0]),s=n([i,0]),a=n([0,r]),l=n([i,r]);mA(this,bv).geometry.coordinates=[[a.toArray(),l.toArray(),s.toArray(),o.toArray(),a.toArray()]];const c=this.map.getSource("parentRect");void 0!==c&&c.setData(mA(this,bv))},Ev=function(){const{pitchAdjust:e}=mA(this,yv),t=()=>{o("parent")},i=()=>{o("minimap")},r=()=>{mA(this,vv).on("move",t),this.map.on("move",i)},n=()=>{mA(this,vv).off("move",t),this.map.off("move",i)},o=t=>{n();const i="parent"===t?mA(this,vv):this.map,o="parent"===t?this.map:mA(this,vv),s=i.getCenter(),a=i.getZoom()+mA(this,yv).zoomAdjust*("parent"===t?1:-1),l=i.getBearing(),c=i.getPitch();o.jumpTo({center:s,zoom:a,bearing:l,pitch:e?c:0}),yA(this,Bv,Sv).call(this),r()};return r(),()=>{n()}};class Iv{constructor(){fA(this,"map"),fA(this,"container"),fA(this,"projectionButton")}onAdd(e){return this.map=e,this.container=hv("div","maplibregl-ctrl maplibregl-ctrl-group"),this.projectionButton=hv("button","maplibregl-ctrl-projection",this.container),hv("span","maplibregl-ctrl-icon",this.projectionButton).setAttribute("aria-hidden","true"),this.projectionButton.type="button",this.projectionButton.addEventListener("click",this.toggleProjection.bind(this)),e.on("projectiontransition",this.updateProjectionIcon.bind(this)),this.updateProjectionIcon(),this.container}onRemove(){dv(this.container),this.map.off("projectiontransition",this.updateProjectionIcon),this.map=void 0}toggleProjection(){void 0===this.map.getProjection()&&this.map.setProjection({type:"mercator"}),this.map.isGlobeProjection()?this.map.enableMercatorProjection():this.map.enableGlobeProjection(),this.updateProjectionIcon()}updateProjectionIcon(){this.projectionButton.classList.remove("maplibregl-ctrl-projection-globe"),this.projectionButton.classList.remove("maplibregl-ctrl-projection-mercator"),this.map.isGlobeProjection()?(this.projectionButton.classList.add("maplibregl-ctrl-projection-mercator"),this.projectionButton.title="Enable Mercator projection"):(this.projectionButton.classList.add("maplibregl-ctrl-projection-globe"),this.projectionButton.title="Enable Globe projection")}}const Pv="3.2.0";class Lv{constructor(e,t=2e3){fA(this,"map"),fA(this,"registeredModules",new Set),this.map=e,setTimeout((async()=>{if(!BA.telemetry)return;const e=this.preparePayload();try{(await fetch(e,{method:"POST"})).ok||console.warn("The metrics could not be sent to MapTiler Cloud")}catch(e){console.warn("The metrics could not be sent to MapTiler Cloud",e)}}),Math.max(1e3,t))}registerModule(e,t){this.registeredModules.add(`${e}:${t}`)}preparePayload(){const e=new URL(bA.telemetryURL);return e.searchParams.append("sdk",Pv),e.searchParams.append("key",BA.apiKey),e.searchParams.append("mtsid",wA),e.searchParams.append("session",BA.session?"1":"0"),e.searchParams.append("caching",BA.caching?"1":"0"),e.searchParams.append("lang-updated",this.map.isLanguageUpdated()?"1":"0"),e.searchParams.append("terrain",this.map.getTerrain()?"1":"0"),e.searchParams.append("globe",this.map.isGlobeProjection()?"1":"0"),this.registeredModules.size>0&&e.searchParams.append("modules",Array.from(this.registeredModules).join("|")),e.href}}const Fv={POINT:"POINT",COUNTRY:"COUNTRY"};class kv extends Te.Map{constructor(e){(function(e){const t=OA();if(!t)return;let i=null;if("string"==typeof e?i=document.getElementById(e):e instanceof HTMLElement&&(i=e),!i)throw new Error("The Map container must be provided.");const r=document.createElement("div");throw r.innerHTML=t,r.classList.add("webgl-warning-div"),i.appendChild(r),new Error(t)})(e.container),e.apiKey&&(BA.apiKey=e.apiKey);const{style:t,requiresUrlMonitoring:i,isFallback:r}=cv(e.style);r&&console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style."),BA.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");const n=location.hash;let o={compact:!1};e.customAttribution?o.customAttribution=e.customAttribution:e.attributionControl&&"object"==typeof e.attributionControl&&(o={...o,...e.attributionControl});const s={...e,style:t,maplibreLogo:!1,transformRequest:zA(e.transformRequest),attributionControl:!0!==e.forceNoAttributionControl&&o};delete s.style,super(s),fA(this,"options"),fA(this,"telemetry"),fA(this,"isTerrainEnabled",!1),fA(this,"terrainExaggeration",1),fA(this,"primaryLanguage"),fA(this,"terrainGrowing",!1),fA(this,"terrainFlattening",!1),fA(this,"minimap"),fA(this,"forceLanguageUpdate"),fA(this,"languageAlwaysBeenStyle"),fA(this,"isReady",!1),fA(this,"terrainAnimationDuration",1e3),fA(this,"monitoredStyleUrls"),fA(this,"styleInProcess",!1),fA(this,"curentProjection"),fA(this,"originalLabelStyle",new window.Map),fA(this,"isStyleLocalized",!1),fA(this,"languageIsUpdated",!1),this.options=e,this.setStyle(t),i&&this.monitorStyleUrl(t);const a=()=>{let e="The distant style could not be loaded.";this.getStyle()?e+="Leaving the style as is.":(this.setStyle(ef.STREETS),e+=`Loading default MapTiler Cloud style "${ef.STREETS.getDefaultVariant().getId()}" as a fallback.`),console.warn(e)};if(this.on("style.load",(()=>{this.styleInProcess=!1})),this.on("error",(e=>{if(e.error instanceof Te.AJAXError){const t=e.error.url,i=new URL(t);i.search="";const r=i.href;this.monitoredStyleUrls&&this.monitoredStyleUrls.has(r)&&(this.monitoredStyleUrls.delete(r),a())}else this.styleInProcess&&a()})),BA.caching&&!EA&&console.warn("The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"),BA.caching&&EA&&FA(),typeof e.language>"u")this.primaryLanguage=BA.primaryLanguage;else{const t=Fp(e.language,vA);this.primaryLanguage=t??BA.primaryLanguage}this.forceLanguageUpdate=!(this.primaryLanguage===vA.STYLE||this.primaryLanguage===vA.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===vA.STYLE,this.terrainExaggeration=e.terrainExaggeration??this.terrainExaggeration,this.curentProjection=e.projection,this.on("styledata",(()=>{"mercator"===this.curentProjection?this.setProjection({type:"mercator"}):"globe"===this.curentProjection&&this.setProjection({type:"globe"})})),this.once("styledata",(async()=>{if(!e.geolocate||e.center||e.hash&&n)return;try{if(e.geolocate===Fv.COUNTRY)return void await this.fitToIpBounds()}catch(e){console.warn(e.message)}let t;try{await this.centerOnIpPoint(e.zoom),t=this.getCameraHash()}catch(e){console.warn(e.message)}"granted"===(await navigator.permissions.query({name:"geolocation"})).state&&navigator.geolocation.getCurrentPosition((i=>{t===this.getCameraHash()&&(this.terrain?this.easeTo({center:[i.coords.longitude,i.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",(()=>{this.easeTo({center:[i.coords.longitude,i.coords.latitude],zoom:e.zoom||12,duration:2e3})})))}),null,{maximumAge:864e5,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",(()=>{this.setPrimaryLanguage(this.primaryLanguage)})),this.on("styledata",(()=>{null===this.getTerrain()&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)})),this.once("load",(async()=>{let t={logo:null};try{const e=Object.keys(this.style.sourceCaches).map((e=>this.getSource(e))).filter((e=>e&&"url"in e&&"string"==typeof e.url&&e.url.includes("tiles.json"))),i=new URL(e[0].url);i.searchParams.has("key")||i.searchParams.append("key",BA.apiKey),t=await(await fetch(i.href)).json()}catch{}if(!0!==e.forceNoAttributionControl)if("logo"in t&&t.logo){const i=t.logo;this.addControl(new gm({logoURL:i}),e.logoPosition)}else e.maptilerLogo&&this.addControl(new gm,e.logoPosition);if(e.scaleControl){const t=!0===e.scaleControl||void 0===e.scaleControl?"bottom-right":e.scaleControl,i=new sm({unit:BA.unit});this.addControl(i,t),BA.on("unit",(e=>{i.setUnit(e)}))}if(!1!==e.navigationControl){const t=!0===e.navigationControl||void 0===e.navigationControl?"top-right":e.navigationControl;this.addControl(new fv,t)}if(!1!==e.geolocateControl){const t=!0===e.geolocateControl||void 0===e.geolocateControl?"top-right":e.geolocateControl;this.addControl(new _v({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),t)}if(e.terrainControl){const t=!0===e.terrainControl||void 0===e.terrainControl?"top-right":e.terrainControl;this.addControl(new pv,t)}if(e.projectionControl){const t=!0===e.projectionControl||void 0===e.projectionControl?"top-right":e.projectionControl;this.addControl(new Iv,t)}if(e.fullscreenControl){const t=!0===e.fullscreenControl||void 0===e.fullscreenControl?"top-right":e.fullscreenControl;this.addControl(new am({}),t)}this.isReady=!0,this.fire("ready",{target:this})}));let l,c=!1,u=!1;this.once("ready",(()=>{c=!0,u&&this.fire("loadWithTerrain",l)})),this.once("style.load",(()=>{const{minimap:t}=e;if("object"==typeof t){const{zoom:i,center:r,style:n,language:o,apiKey:s,maptilerLogo:a,canvasContextAttributes:l,refreshExpiredTiles:c,maxBounds:u,scrollZoom:h,minZoom:d,maxZoom:p,boxZoom:f,locale:A,fadeDuration:m,crossSourceCollisions:g,clickTolerance:_,bounds:y,fitBoundsOptions:v,pixelRatio:x,validateStyle:b}=e;this.minimap=new Mv(t,{zoom:i,center:r,style:n,language:o,apiKey:s,container:"null",maptilerLogo:a,canvasContextAttributes:l,refreshExpiredTiles:c,maxBounds:u,scrollZoom:h,minZoom:d,maxZoom:p,boxZoom:f,locale:A,fadeDuration:m,crossSourceCollisions:g,clickTolerance:_,bounds:y,fitBoundsOptions:v,pixelRatio:x,validateStyle:b}),this.addControl(this.minimap,t.position??"bottom-left")}else!0===t?(this.minimap=new Mv({},e),this.addControl(this.minimap,"bottom-left")):void 0!==t&&!1!==t&&(this.minimap=new Mv({},e),this.addControl(this.minimap,t))}));const h=e=>{e.terrain&&(u=!0,l={type:"loadWithTerrain",target:this,terrain:e.terrain},this.off("terrain",h),c&&this.fire("loadWithTerrain",l))};this.on("terrain",h),e.terrain&&this.enableTerrain(e.terrainExaggeration??this.terrainExaggeration),this.once("load",(()=>{this.getCanvas().addEventListener("webglcontextlost",(e=>{!0!==this._removed?(console.warn("[webglcontextlost]","Unexpected loss of WebGL context!"),this.fire("webglContextLost",e)):console.warn("[webglcontextlost]","WebGL context lost after map removal. This is harmless.")}))})),this.telemetry=new Lv(this)}recreate(){const e={center:this.getCenter(),zoom:this.getZoom(),bearing:this.getBearing(),pitch:this.getPitch()};this.remove(),Object.assign(this,new kv({...this.options})),this.once("load",(()=>{this.jumpTo(e)}))}setTerrainAnimationDuration(e){this.terrainAnimationDuration=Math.max(e,0)}async onLoadAsync(){return new Promise((e=>{this.loaded()?e(this):this.once("load",(()=>{e(this)}))}))}async onReadyAsync(){return new Promise((e=>{this.isReady?e(this):this.once("ready",(()=>{e(this)}))}))}async onLoadWithTerrainAsync(){return new Promise((e=>{this.isReady&&this.terrain?e(this):this.once("loadWithTerrain",(()=>{e(this)}))}))}monitorStyleUrl(e){typeof this.monitoredStyleUrls>"u"&&(this.monitoredStyleUrls=new Set);const t=new URL(e);t.search="",this.monitoredStyleUrls.add(t.href)}setStyle(e,t){var i;this.originalLabelStyle.clear(),null==(i=this.minimap)||i.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",(()=>{this.forceLanguageUpdate=!1}));const r=cv(e);if(r.requiresUrlMonitoring&&this.monitorStyleUrl(r.style),r.isFallback){if(this.getStyle())return console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Keeping the curent style instead."),this;console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style.")}return this.styleInProcess=!0,super.setStyle(r.style,t),this}addLayer(e,t){var i;return null==(i=this.minimap)||i.addLayer(e,t),super.addLayer(e,t)}moveLayer(e,t){var i;return null==(i=this.minimap)||i.moveLayer(e,t),super.moveLayer(e,t)}removeLayer(e){var t;return null==(t=this.minimap)||t.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,t,i){var r;return null==(r=this.minimap)||r.setLayerZoomRange(e,t,i),super.setLayerZoomRange(e,t,i)}setFilter(e,t,i){var r;return null==(r=this.minimap)||r.setFilter(e,t,i),super.setFilter(e,t,i)}setPaintProperty(e,t,i,r){var n;return null==(n=this.minimap)||n.setPaintProperty(e,t,i,r),super.setPaintProperty(e,t,i,r)}setLayoutProperty(e,t,i,r){var n;return null==(n=this.minimap)||n.setLayoutProperty(e,t,i,r),super.setLayoutProperty(e,t,i,r)}setGlyphs(e,t){var i;return null==(i=this.minimap)||i.setGlyphs(e,t),super.setGlyphs(e,t)}getStyleLanguage(){return this.style&&this.style.stylesheet&&this.style.stylesheet.metadata&&"object"==typeof this.style.stylesheet.metadata&&"maptiler:language"in this.style.stylesheet.metadata&&"string"==typeof this.style.stylesheet.metadata["maptiler:language"]?Ip(this.style.stylesheet.metadata["maptiler:language"]):null}setLanguage(e){var t;null==(t=this.minimap)||t.map.setLanguage(e),this.onStyleReady((()=>{this.setPrimaryLanguage(e)}))}setPrimaryLanguage(e){const t=this.getStyleLanguage(),i=Fp(e,vA);if(!i)return void console.warn(`The language "${i}" is not supported.`);if((i.flag!==vA.STYLE.flag||!t||t.flag!==vA.AUTO.flag&&t.flag!==vA.VISITOR.flag)&&(i.flag!==vA.STYLE.flag&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===i&&!this.forceLanguageUpdate))return;if(this.primaryLanguage.flag===vA.STYLE_LOCK.flag)return void console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");this.primaryLanguage=i;let r=i;if(i.flag===vA.STYLE.flag){if(!t)return void console.warn("The style has no default languages or has an invalid one.");r=t}let n=vA.LOCAL.flag,o=["get",n];r.flag===vA.VISITOR.flag?(n=xA().flag,o=["case",["all",["has",n],["has",vA.LOCAL.flag]],["case",["==",["get",n],["get",vA.LOCAL.flag]],["get",vA.LOCAL.flag],["format",["get",n],{"font-scale":.8},"\n",["get",vA.LOCAL.flag],{"font-scale":1.1}]],["get",vA.LOCAL.flag]]):r.flag===vA.VISITOR_ENGLISH.flag?(n=vA.ENGLISH.flag,o=["case",["all",["has",n],["has",vA.LOCAL.flag]],["case",["==",["get",n],["get",vA.LOCAL.flag]],["get",vA.LOCAL.flag],["format",["get",n],{"font-scale":.8},"\n",["get",vA.LOCAL.flag],{"font-scale":1.1}]],["get",vA.LOCAL.flag]]):r.flag===vA.AUTO.flag?(n=xA().flag,o=["coalesce",["get",n],["get",vA.LOCAL.flag]]):r===vA.LOCAL?(n=vA.LOCAL.flag,o=["get",n]):(n=r.flag,o=["coalesce",["get",n],["get",vA.LOCAL.flag]]);const{layers:s}=this.getStyle(),a=0===this.originalLabelStyle.size;if(a){const e=function(e,t){const i=[];for(const r of e){if("symbol"!==r.type)continue;const e=r,{id:n,layout:o}=e;if(!o||!("text-field"in o))continue;const s=t.getLayoutProperty(n,"text-field");if(s)if("string"==typeof s){const e=VA(s);i.push(e)}else{const e=GA(s);i.push(e)}}const r=i.flat(),n={unlocalized:0,localized:{}};for(const e of r)null===e?n.unlocalized+=1:(e in n.localized||(n.localized[e]=0),n.localized[e]+=1);return n}(s,this);this.isStyleLocalized=Object.keys(e.localized).length>0}for(const e of s){if("symbol"!==e.type)continue;const t=e,i=this.getSource(t.source);if(!i||!("url"in i)||"string"!=typeof i.url||new URL(i.url).host!==bA.maptilerApiHost)continue;const{id:r,layout:n}=t;if(!n||!("text-field"in n))continue;let s;if(a?(s=this.getLayoutProperty(r,"text-field"),this.originalLabelStyle.set(r,s)):s=this.originalLabelStyle.get(r),"string"==typeof s){const{contains:e,exactMatch:t}=QA(s,this.isStyleLocalized);if(!e)continue;if(t)this.setLayoutProperty(r,"text-field",o);else{const e=jA(s,o,this.isStyleLocalized);this.setLayoutProperty(r,"text-field",e)}}else{const e=NA(s,o,this.isStyleLocalized);this.setLayoutProperty(r,"text-field",e)}}this.languageIsUpdated=!0}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(e){if(!this.terrain)return;const t=performance.now(),i=this.terrain.exaggeration,r=e-i,n=()=>{if(!this.terrain||this.terrainFlattening)return;const o=(performance.now()-t)/this.terrainAnimationDuration;if(o<.99){const e=i+(1-(1-o)**4)*r;this.terrain.exaggeration=e,requestAnimationFrame(n)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=e,this.fire("terrainAnimationStop",{terrain:this.terrain});this._elevationFreeze=!1,this.triggerRepaint()};!this.terrainGrowing&&!this.terrainFlattening&&this.fire("terrainAnimationStart",{terrain:this.terrain}),this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(n)}enableTerrain(e=this.terrainExaggeration){if(e<0)return void console.warn("Terrain exaggeration cannot be negative.");const t=i=>{!this.terrain||"data"!==i.type||"source"!==i.dataType||!("source"in i)||"maptiler-terrain"!==i.sourceId||"raster-dem"!==i.source.type||i.isSourceLoaded&&(this.off("data",t),this.growTerrain(e))},i=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=e,this.on("data",t),this.addSource(bA.terrainSourceId,{type:"raster-dem",url:bA.terrainSourceURL}),this.setTerrain({source:bA.terrainSourceId,exaggeration:0})};if(this.getTerrain())return this.isTerrainEnabled=!0,void this.growTerrain(e);this.loaded()||this.isTerrainEnabled?i():this.once("load",(()=>{this.getTerrain()&&this.getSource(bA.terrainSourceId)||i()}))}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const e=performance.now(),t=this.terrain.exaggeration,i=()=>{if(!this.terrain||this.terrainGrowing)return;const r=(performance.now()-e)/this.terrainAnimationDuration;if(this._elevationFreeze=!1,r<.99){const e=t*(1-r)**4;this.terrain.exaggeration=e,requestAnimationFrame(i)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(bA.terrainSourceId)&&this.removeSource(bA.terrainSourceId),this.fire("terrainAnimationStop",{terrain:null});this.triggerRepaint()};!this.terrainGrowing&&!this.terrainFlattening&&this.fire("terrainAnimationStart",{terrain:this.terrain}),this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(i)}setTerrainExaggeration(e,t=!0){!t&&this.terrain?(this.terrainExaggeration=e,this.terrain.exaggeration=e,this.triggerRepaint()):this.enableTerrain(e)}onStyleReady(e){this.isStyleLoaded()?e():this.once("styledata",(()=>{e()}))}async fitToIpBounds(){const e=await Vp.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})}async centerOnIpPoint(e){const t=await Vp.info();this.jumpTo({center:[t.longitude??0,t.latitude??0],zoom:e||11})}getCameraHash(){const e=new Float32Array(5),t=this.getCenter();return e[0]=t.lng,e[1]=t.lat,e[2]=this.getZoom(),e[3]=this.getPitch(),e[4]=this.getBearing(),hA(new Uint8Array(e.buffer))}getSdkConfig(){return BA}getMaptilerSessionId(){return wA}setTransformRequest(e){return super.setTransformRequest(zA(e)),this}isGlobeProjection(){const e=this.getProjection();return!!e&&"globe"===e.type}enableGlobeProjection(){!0!==this.isGlobeProjection()&&(this.setProjection({type:"globe"}),this.curentProjection="globe")}enableMercatorProjection(){!1!==this.isGlobeProjection()&&(this.setProjection({type:"mercator"}),this.curentProjection="mercator")}isLanguageUpdated(){return this.languageIsUpdated}}function zv(e){if(typeof DOMParser<"u"){const t=(new DOMParser).parseFromString(e,"application/xml");if(t.querySelector("parsererror"))throw new Error("The provided string is not valid XML");return t}throw new Error("No XML parser found")}function Rv(e,t){if(!e.hasChildNodes())return!1;for(const i of Array.from(e.childNodes)){const e=i.nodeName;if("string"==typeof e&&e.trim().toLowerCase()===t.toLowerCase())return!0}return!1}function Dv(e){if(typeof XMLSerializer<"u")return(new XMLSerializer).serializeToString(e);throw new Error("No XML serializer found")}function Ov(e){const t="string"==typeof e?zv(e):e;if(!Rv(t,"gpx"))throw new Error("The XML document is not valid GPX");const i=Yv(t,"trk"),r=Yv(t,"rte"),n=Yv(t,"wpt"),o={type:"FeatureCollection",features:[]};for(const e of Array.from(i)){const t=$v(e);t&&o.features.push(t)}for(const e of Array.from(r)){const t=Zv(e);t&&o.features.push(t)}for(const e of Array.from(n))o.features.push(qv(e));return o}function Uv(e,t){let i=e;if("string"==typeof i&&(i=zv(i)),!Rv(i,"kml"))throw new Error("The XML document is not valid KML");const r={type:"FeatureCollection",features:[]},n={},o={},s={},a=Yv(i,"Placemark"),l=Yv(i,"Style"),c=Yv(i,"StyleMap");for(const e of Array.from(l)){const i=Xv(void 0!==t?t(e):Dv(e)).toString(16);n[`#${Jv(e,"id")}`]=i,o[i]=e}for(const e of Array.from(c)){n[`#${Jv(e,"id")}`]=Xv(void 0!==t?t(e):Dv(e)).toString(16);const i=Yv(e,"Pair"),r={};for(const e of Array.from(i))r[rx(tx(e,"key"))??""]=rx(tx(e,"styleUrl"));s[`#${Jv(e,"id")}`]=r}for(const e of Array.from(a))r.features=r.features.concat(Hv(e,n,o,s));return r}function Nv(e){if(null===e)return["#000000",1];let t="",i=1,r=e;return r.startsWith("#")&&(r=r.substring(1)),(6===r.length||3===r.length)&&(t=r),8===r.length&&(i=Number.parseInt(r.substring(0,2),16)/255,t=`#${r.substring(6,8)}${r.substring(4,6)}${r.substring(2,4)}`),[t??"#000000",i??1]}function Qv(e){return ix(e.split(" "))}function jv(e){let t=Yv(e,"coord");const i=[],r=[];0===t.length&&(t=Yv(e,"gx:coord"));for(const e of Array.from(t))i.push(Qv(rx(e)??""));const n=Yv(e,"when");for(const e of Array.from(n))r.push(rx(e));return{coords:i,times:r}}function Vv(e){const t=["Polygon","LineString","Point","Track","gx:Track"];let i,r,n,o,s;const a=[],l=[];if(null!==tx(e,"MultiGeometry"))return Vv(tx(e,"MultiGeometry"));if(null!==tx(e,"MultiTrack"))return Vv(tx(e,"MultiTrack"));if(null!==tx(e,"gx:MultiTrack"))return Vv(tx(e,"gx:MultiTrack"));for(n=0;nNumber.isNaN(e)?null:e))}function rx(e){return e&&function(e){e.normalize&&e.normalize()}(e),e&&e.textContent}function nx(e,t){const i={};let r,n;for(n=0;n=e[e.length-1].zoom)return e[e.length-1].value;for(let i=0;i=e[i].zoom&&t[e.zoom,e.value]))]}function Ax(e){return["interpolate",["linear"],["zoom"],...e.flatMap((e=>[e.zoom,e.value]))]}function mx(e,t){if("number"==typeof t&&"number"==typeof e)return 2*t+e;if("number"==typeof t&&Array.isArray(e))return["interpolate",["linear"],["zoom"],...e.flatMap((e=>[e.zoom,2*t+e.value]))];if("number"==typeof e&&Array.isArray(t))return["interpolate",["linear"],["zoom"],...t.flatMap((t=>[t.zoom,2*t.value+e]))];if(Array.isArray(e)&&Array.isArray(t)){return["interpolate",["linear"],["zoom"],...Array.from(new Set([...e.map((e=>e.zoom)),...t.map((e=>e.zoom))])).sort(((e,t)=>e[i,2*px(t,i)+px(e,i)]))]}return 0}function gx(e,t){return["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,e.value]))]}function _x(e){const t=e.trimStart(),i=`${t}${" ".repeat(e.length-t.length)}`,r=Array.from(i);if(!r.every((e=>" "===e||"_"===e)))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!r.some((e=>"_"===e))||!r.some((e=>" "===e)))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const n=[1];for(let e=1;e[e.value,e.color]))]}function vx(e,t,i=!0){return i?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.025*e.pointRadius]))],2,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.05*e.pointRadius]))],4,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.1*e.pointRadius]))],8,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.25*e.pointRadius]))],16,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,e.pointRadius]))]]:["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,e.pointRadius]))]}function xx(e,t,i=!0){return i?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.025*e.value]))],2,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.05*e.value]))],4,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.1*e.value]))],8,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.25*e.value]))],16,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,e.value]))]]:["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,e.value]))]}function bx(e,t){return e.every((t=>t.color[3]===e[0].color[3]))?e[0].color[3]?e[0].color[3]/255:1:["interpolate",["linear"],["get",t],...e.getRawColorStops().flatMap((e=>{const t=e.value,i=e.color;return[t,4===i.length?i[3]/255:1]}))]}function wx(e,t=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:t+1},((i,r)=>{const n=r/t;return[n,e.getColorHex(n)]})).flat()]}function Tx(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}class Bx extends Array{constructor(e={}){super(),fA(this,"min",0),fA(this,"max",1),"min"in e&&(this.min=e.min),"max"in e&&(this.max=e.max),"stops"in e&&this.setStops(e.stops,{clone:!1})}static fromArrayDefinition(e){return new Bx({stops:e.map((e=>({value:e[0],color:e[1]})))})}setStops(e,t={clone:!0}){const i=t.clone?this.clone():this;i.length=0;let r=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(let t=0;te.value=this.at(-1).value)return this.at(-1).color;for(let i=0;ithis[i+1].value)continue;const r=this[i].color;if(!t.smooth)return r.slice();const n=this[i].value,o=this[i+1].value,s=this[i+1].color,a=(o-e)/(o-n);return r.map(((e,t)=>Math.round(e*a+s[t]*(1-a))))}return[0,0,0]}getColorHex(e,t={smooth:!0,withAlpha:!1}){return`#${Tx((i=this.getColor(e,t))[0])}${Tx(i[1])}${Tx(i[2])}${4===i.length?Tx(i[3]):""}`;var i}getColorRelative(e,t={smooth:!0}){const i=this.getBounds();return this.getColor(i.min+e*(i.max-i.min),t)}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){const t=document.createElement("canvas");t.width=e.horizontal?e.size:1,t.height=e.horizontal?1:e.size;const i=t.getContext("2d");if(!i)throw new Error("Canvs context is missing");const r=i.getImageData(0,0,t.width,t.height),n=r.data,o=e.size,s=this[0].value,a=(this.at(-1).value-s)/o;for(let t=0;t3?i[3]:255}return i.putImageData(r,0,0),t}resample(e,t=15){const i=this.getBounds(),r=this.scale(0,1),n=1/(t-1);let o;if("ease-in-square"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=i**2;return{value:i,color:r.getColor(o)}}));else if("ease-out-square"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=1-(1-i)**2;return{value:i,color:r.getColor(o)}}));else if("ease-out-sqrt"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=i**.5;return{value:i,color:r.getColor(o)}}));else if("ease-in-sqrt"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=1-(1-i)**.5;return{value:i,color:r.getColor(o)}}));else if("ease-out-exp"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=1-2**(-10*i);return{value:i,color:r.getColor(o)}}));else{if("ease-in-exp"!==e)throw new Error("Invalid ressampling method.");o=Array.from({length:t},((e,t)=>{const i=t*n,o=2**(10*i-10);return{value:i,color:r.getColor(o)}}))}return new Bx({stops:o}).scale(i.min,i.max)}transparentStart(){const e=this.getRawColorStops();e.unshift({value:e[0].value,color:e[0].color.slice()}),e[1].value+=.001;for(const t of e)3===t.color.length&&t.color.push(255);return e[0].color[3]=0,new Bx({stops:e})}hasTransparentStart(){return 4===this[0].color.length&&0===this[0].color[3]}}const Cx={NULL:new Bx({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new Bx({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new Bx({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),HSV:new Bx({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),HOT:new Bx({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),SPRING:new Bx({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new Bx({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new Bx({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new Bx({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new Bx({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),COPPER:new Bx({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new Bx({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new Bx({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]},{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),GREENS:new Bx({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),YIORRD:new Bx({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),BLUERED:new Bx({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new Bx({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),PICNIC:new Bx({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),RAINBOW:new Bx({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]},{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),PORTLAND:new Bx({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),BLACKBODY:new Bx({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),EARTH:new Bx({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),ELECTRIC:new Bx({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),VIRIDIS:new Bx({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),INFERNO:new Bx({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),MAGMA:new Bx({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),PLASMA:new Bx({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),WARM:new Bx({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),COOL:new Bx({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),RAINBOW_SOFT:new Bx({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),BATHYMETRY:new Bx({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]},{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),CDOM:new Bx({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),CHLOROPHYLL:new Bx({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),DENSITY:new Bx({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),FREESURFACE_BLUE:new Bx({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]},{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),FREESURFACE_RED:new Bx({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),OXYGEN:new Bx({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),PAR:new Bx({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),PHASE:new Bx({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),SALINITY:new Bx({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),TEMPERATURE:new Bx({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),TURBIDITY:new Bx({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),VELOCITY_BLUE:new Bx({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),VELOCITY_GREEN:new Bx({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),CUBEHELIX:new Bx({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),CIVIDIS:new Bx({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]},{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),TURBO:new Bx({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),ROCKET:new Bx({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),MAKO:new Bx({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]},{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]})};const Sx=Object.freeze(Object.defineProperty({__proto__:null,addHeatmap:function(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.sourceId??hx(),r=t.layerId??dx(),n=t.minzoom??0,o=t.maxzoom??23,s=t.zoomCompensation??!0,a=t.opacity??[{zoom:n,value:0},{zoom:n+.25,value:1},{zoom:o-.25,value:1},{zoom:o,value:0}];let l=Array.isArray(t.colorRamp)?t.colorRamp:Cx.TURBO.transparentStart();const c=l.getBounds();(0!==c.min||1!==c.max)&&(l=l.scale(0,1)),l.hasTransparentStart()||(l=l.transparentStart());const u=t.intensity??[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],h=t.property??null,d=t.weight??1;let p=1;h?"number"==typeof d?(p=d,"number"==typeof t.weight&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(d)?p=gx(d,h):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):"number"==typeof d?p=d:Array.isArray(d)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const f=[{zoom:0,value:1.25},{zoom:2,value:2.5},{zoom:4,value:5},{zoom:8,value:12.5},{zoom:16,value:50}],A=t.radius??(s?f:10);let m=1;"number"==typeof A?m=A:Array.isArray(A)&&"zoom"in A[0]?m=Ax(A):h&&Array.isArray(A)&&"propertyValue"in A[0]?m=xx(A,h,s):!h&&Array.isArray(A)&&"propertyValue"in A[0]?(m=Ax(f),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):m=Ax(f);const g={heatmapLayerId:r,heatmapSourceId:i};if(t.data&&!e.getSource(i)){let r=t.data;"string"==typeof r&&DA(r)&&(r=`https://api.maptiler.com/data/${r}/features.json?key=${BA.apiKey}`),e.addSource(i,{type:"geojson",data:r})}return e.addLayer({id:r,type:"heatmap",source:i,minzoom:n,maxzoom:o,paint:{"heatmap-weight":p,"heatmap-intensity":"number"==typeof u?u:Ax(u),"heatmap-color":wx(l),"heatmap-radius":m,"heatmap-opacity":"number"==typeof a?a:Ax(a)}},t.beforeId),g},addPoint:function(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.minPointRadius??10,r=t.maxPointRadius??50,n=t.cluster??!1,o=20,s=Array.isArray(t.pointColor)?t.pointColor:Cx.TURBO.scale(10,t.cluster?1e4:1e3).resample("ease-out-square"),a=s.getBounds(),l=t.sourceId??hx(),c=t.layerId??dx(),u=t.showLabel??n,h=t.alignOnViewport??!0,d=t.outline??!1,p=t.outlineOpacity??1,f=t.outlineWidth??1,A=t.outlineColor??"#FFFFFF";let m;const g=t.zoomCompensation??!0,_=t.minzoom??0,y=t.maxzoom??23;m="number"==typeof t.pointOpacity?t.pointOpacity:Array.isArray(t.pointOpacity)?Ax(t.pointOpacity):t.cluster?bx(s,"point_count"):t.property?bx(s,t.property):Ax([{zoom:_,value:0},{zoom:_+.25,value:1},{zoom:y-.25,value:1},{zoom:y,value:0}]);const v={pointLayerId:c,clusterLayerId:"",labelLayerId:"",pointSourceId:l};if(t.data&&!e.getSource(l)){let i=t.data;"string"==typeof i&&DA(i)&&(i=`https://api.maptiler.com/data/${i}/features.json?key=${BA.apiKey}`),e.addSource(l,{type:"geojson",data:i,cluster:n})}if(n){v.clusterLayerId=`${c}_cluster`;const n=Array.from({length:o},((e,t)=>{const n=a.min+t*(a.max-a.min)/19;return{value:n,pointRadius:i+(r-i)*(t/19)**.5,color:s.getColorHex(n)}}));e.addLayer({id:v.clusterLayerId,type:"circle",source:l,filter:["has","point_count"],paint:{"circle-color":"string"==typeof t.pointColor?t.pointColor:yx(n,"point_count"),"circle-radius":"number"==typeof t.pointRadius?t.pointRadius:Array.isArray(t.pointRadius)?Ax(t.pointRadius):vx(n,"point_count",!1),"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-opacity":m,...d&&{"circle-stroke-opacity":"number"==typeof p?p:Ax(p),"circle-stroke-width":"number"==typeof f?f:Ax(f),"circle-stroke-color":"string"==typeof A?A:fx(A)}},minzoom:_,maxzoom:y},t.beforeId),e.addLayer({id:v.pointLayerId,type:"circle",source:l,filter:["!",["has","point_count"]],paint:{"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-color":"string"==typeof t.pointColor?t.pointColor:s.getColorHex(s.getBounds().min),"circle-radius":"number"==typeof t.pointRadius?t.pointRadius:Array.isArray(t.pointRadius)?Ax(t.pointRadius):.75*n[0].pointRadius,"circle-opacity":m,...d&&{"circle-stroke-opacity":"number"==typeof p?p:Ax(p),"circle-stroke-width":"number"==typeof f?f:Ax(f),"circle-stroke-color":"string"==typeof A?A:fx(A)}},minzoom:_,maxzoom:y},t.beforeId)}else{let n="string"==typeof t.pointColor?t.pointColor:Array.isArray(t.pointColor)?t.pointColor.getColorHex(t.pointColor.getBounds().min):ux(),c="number"==typeof t.pointRadius?g?Ax([{zoom:0,value:.025*t.pointRadius},{zoom:2,value:.05*t.pointRadius},{zoom:4,value:.1*t.pointRadius},{zoom:8,value:.25*t.pointRadius},{zoom:16,value:1*t.pointRadius}]):t.pointRadius:Array.isArray(t.pointRadius)?Ax(t.pointRadius):g?Ax([{zoom:0,value:.05*i},{zoom:2,value:.1*i},{zoom:4,value:.2*i},{zoom:8,value:.5*i},{zoom:16,value:1*i}]):i;if(t.property&&Array.isArray(t.pointColor)){const e=Array.from({length:o},((e,n)=>{const o=a.min+n*(a.max-a.min)/19;return{value:o,pointRadius:"number"==typeof t.pointRadius?t.pointRadius:i+(r-i)*(n/19)**.5,color:"string"==typeof t.pointColor?t.pointColor:s.getColorHex(o)}}));n=yx(e,t.property),c=vx(e,t.property,g)}e.addLayer({id:v.pointLayerId,type:"circle",source:l,layout:{"circle-sort-key":t.property?["/",1,["get",t.property]]:0},paint:{"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-color":n,"circle-opacity":m,"circle-radius":c,...d&&{"circle-stroke-opacity":"number"==typeof p?p:Ax(p),"circle-stroke-width":"number"==typeof f?f:Ax(f),"circle-stroke-color":"string"==typeof A?A:fx(A)}},minzoom:_,maxzoom:y},t.beforeId)}if(!1!==u&&(t.cluster||t.property)){v.labelLayerId=`${c}_label`;const i=t.labelColor??"#fff",r=t.labelSize??12;e.addLayer({id:v.labelLayerId,type:"symbol",source:l,filter:["has",t.cluster?"point_count":t.property],layout:{"text-field":t.cluster?"{point_count_abbreviated}":`{${t.property}}`,"text-font":["Noto Sans Regular"],"text-size":r,"text-pitch-alignment":h?"viewport":"map","symbol-sort-key":["/",1,["get",t.cluster?"point_count":t.property]]},paint:{"text-color":i,"text-opacity":m},minzoom:_,maxzoom:y},t.beforeId)}return v},addPolygon:function(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.sourceId??hx(),r=t.layerId??dx(),n={polygonLayerId:r,polygonOutlineLayerId:t.outline?`${r}_outline`:"",polygonSourceId:i};if(t.data&&!e.getSource(i)){let r=t.data;"string"==typeof r&&DA(r)&&(r=`https://api.maptiler.com/data/${r}/features.json?key=${BA.apiKey}`),e.addSource(i,{type:"geojson",data:r})}let o=t.outlineDashArray??null;const s=t.outlineWidth??1,a=t.outlineColor??"#FFFFFF",l=t.outlineOpacity??1,c=t.outlineBlur??0,u=t.fillColor??ux(),h=t.fillOpacity??1,d=t.outlinePosition??"center",p=t.pattern??null;"string"==typeof o&&(o=_x(o));const f=(p=null)=>{if(e.addLayer({id:r,type:"fill",source:i,minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"fill-color":"string"==typeof u?u:fx(u),"fill-opacity":"number"==typeof h?h:Ax(h),...p&&{"fill-pattern":p}}},t.beforeId),!0===t.outline){let r;r="inside"===d?"number"==typeof s?.5*s:Ax(s.map((({zoom:e,value:t})=>({zoom:e,value:.5*t})))):"outside"===d?"number"==typeof s?-.5*s:Ax(s.map((e=>({zoom:e.zoom,value:-.5*e.value})))):0,e.addLayer({id:n.polygonOutlineLayerId,type:"line",source:i,layout:{"line-join":t.outlineJoin??"round","line-cap":t.outlineCap??"butt"},minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"line-opacity":"number"==typeof l?l:Ax(l),"line-color":"string"==typeof a?a:fx(a),"line-width":"number"==typeof s?s:Ax(s),"line-blur":"number"==typeof c?c:Ax(c),"line-offset":r,...o&&{"line-dasharray":o}}},t.beforeId)}};return p?e.hasImage(p)?f(p):e.loadImage(p).then((t=>{e.addImage(p,t.data),f(p)})).catch((e=>{console.error("Could not load the pattern image.",e.message),f()})):f(),n},addPolyline:async function(e,t,i={}){var r,n;if(!t.sourceId&&!t.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let o=t.data;if("string"==typeof o){if(DA(o))o=`https://api.maptiler.com/data/${t.data}/features.json?key=${BA.apiKey}`;else if("gpx"===(null==(r=o.split(".").pop())?void 0:r.toLowerCase().trim())){o=Ov(await(await fetch(o,i)).text())}else if("kml"===(null==(n=o.split(".").pop())?void 0:n.toLowerCase().trim())){o=Uv(await(await fetch(o,i)).text())}else{const e=function(e){try{return JSON.parse(e)}catch{}return null}(o)??lx(o);e&&(o=e)}if(!o)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return function(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.sourceId??hx(),r=t.layerId??dx(),n={polylineLayerId:r,polylineOutlineLayerId:"",polylineSourceId:i};t.data&&!e.getSource(i)&&e.addSource(i,{type:"geojson",data:t.data});const o=t.lineWidth??3,s=t.lineColor??ux(),a=t.lineOpacity??1,l=t.lineBlur??0,c=t.lineGapWidth??0;let u=t.lineDashArray??null;const h=t.outlineWidth??1,d=t.outlineColor??"#FFFFFF",p=t.outlineOpacity??1,f=t.outlineBlur??0;if("string"==typeof u&&(u=_x(u)),!0===t.outline){const s=`${r}_outline`;n.polylineOutlineLayerId=s,e.addLayer({id:s,type:"line",source:i,layout:{"line-join":t.lineJoin??"round","line-cap":t.lineCap??"round"},minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"line-opacity":"number"==typeof p?p:Ax(p),"line-color":"string"==typeof d?d:fx(d),"line-width":mx(o,h),"line-blur":"number"==typeof f?f:Ax(f)}},t.beforeId)}return e.addLayer({id:r,type:"line",source:i,layout:{"line-join":t.lineJoin??"round","line-cap":t.lineCap??"round"},minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"line-opacity":"number"==typeof a?a:Ax(a),"line-color":"string"==typeof s?s:fx(s),"line-width":"number"==typeof o?o:Ax(o),"line-blur":"number"==typeof l?l:Ax(l),"line-gap-width":"number"==typeof c?c:Ax(c),...u&&{"line-dasharray":u}}},t.beforeId),n}(e,{...t,data:o})},colorDrivenByProperty:yx,colorPalettes:cx,computeRampedOutlineWidth:mx,dashArrayMaker:_x,generateRandomLayerName:dx,generateRandomSourceName:hx,getRandomColor:ux,heatmapIntensityFromColorRamp:wx,lerpZoomNumberValues:px,opacityDrivenByProperty:bx,paintColorOptionsToPaintSpec:fx,radiusDrivenByProperty:vx,radiusDrivenByPropertyHeatmap:xx,rampedOptionsToLayerPaintSpec:Ax,rampedPropertyValueWeight:gx,takeScreenshot:async function(e,t={}){const i=t.download??!1,r=await function(e){return new Promise(((t,i)=>{e.redraw(),e.once("idle",(()=>{e.getCanvas().toBlob((e=>{e?t(e):i(Error("Screenshot could not be created."))}),"image/png")}))}))}(e);if(i){const e=t.filename??"maptiler_screenshot.png",i=document.createElement("a");i.style.display="none",document.body.appendChild(i),i.href=URL.createObjectURL(r),i.download=e,i.click(),setTimeout((()=>{document.body.removeChild(i),URL.revokeObjectURL(i.href)}),0)}return r}},Symbol.toStringTag,{value:"Module"}));!function(){if(typeof window>"u")return;const e=Te.getRTLTextPluginStatus();if("unavailable"===e||"requested"===e)try{Te.setRTLTextPlugin(bA.rtlPluginURL,!0)}catch{}}();const Ex=Te.Map,Mx=Te.Marker,Ix=Te.Popup,Px=Te.Style,Lx=Te.CanvasSource,Fx=Te.GeoJSONSource,kx=Te.ImageSource,zx=Te.RasterTileSource,Rx=Te.RasterDEMTileSource,Dx=Te.VectorTileSource,Ox=Te.VideoSource,Ux=Te.NavigationControl,Nx=Te.GeolocateControl,Qx=Te.AttributionControl,jx=Te.LogoControl,Vx=Te.ScaleControl,Hx=Te.FullscreenControl,Gx=Te.TerrainControl,$x=Te.BoxZoomHandler,Zx=Te.ScrollZoomHandler,qx=Te.CooperativeGesturesHandler,Kx=Te.KeyboardHandler,Wx=Te.TwoFingersTouchPitchHandler,Xx=Te.MapWheelEvent,Yx=Te.MapTouchEvent,Jx=Te.MapMouseEvent,eb=Te.config,tb=Te.getVersion,{setRTLTextPlugin:ib,getRTLTextPluginStatus:rb,LngLat:nb,LngLatBounds:ob,MercatorCoordinate:sb,Evented:ab,AJAXError:lb,prewarm:cb,clearPrewarmedResources:ub,Hash:hb,Point:db,EdgeInsets:pb,DragRotateHandler:fb,DragPanHandler:Ab,TwoFingersTouchZoomRotateHandler:mb,DoubleClickZoomHandler:gb,TwoFingersTouchZoomHandler:_b,TwoFingersTouchRotateHandler:yb,getWorkerCount:vb,setWorkerCount:xb,getMaxParallelImageRequests:bb,setMaxParallelImageRequests:wb,getWorkerUrl:Tb,setWorkerUrl:Bb,addSourceType:Cb,importScriptInWorkers:Sb,addProtocol:Eb,removeProtocol:Mb}=Te;var Ib=Object.freeze({__proto__:null,AJAXError:lb,AttributionControl:nm,AttributionControlMLGL:Qx,BoxZoomHandler:cm,BoxZoomHandlerMLGL:$x,CanvasSource:KA,CanvasSourceMLGL:Lx,ColorRamp:Bx,ColorRampCollection:Cx,CooperativeGesturesHandler:hm,CooperativeGesturesHandlerMLGL:qx,DOMcreate:hv,DOMremove:dv,DoubleClickZoomHandler:gb,DragPanHandler:Ab,DragRotateHandler:fb,EdgeInsets:pb,Evented:ab,FullscreenControl:am,FullscreenControlMLGL:Hx,GeoJSONSource:WA,GeoJSONSourceMLGL:Fx,GeolocateControl:rm,GeolocateControlMLGL:Nx,GeolocationType:Fv,Hash:hb,ImageSource:XA,ImageSourceMLGL:kx,KeyboardHandler:dm,KeyboardHandlerMLGL:Kx,Language:vA,LngLat:nb,LngLatBounds:ob,LogoControl:om,LogoControlMLGL:jx,Map:kv,MapMLGL:Ex,MapMouseEvent:mm,MapMouseEventMLGL:Jx,MapStyle:ef,MapStyleVariant:Kp,MapTouchEvent:Am,MapTouchEventMLGL:Yx,MapWheelEvent:fm,MapWheelEventMLGL:Xx,MaptilerGeolocateControl:_v,MaptilerLogoControl:gm,MaptilerNavigationControl:fv,MaptilerProjectionControl:Iv,MaptilerTerrainControl:pv,Marker:$A,MarkerMLGL:Mx,MercatorCoordinate:sb,NavigationControMLGL:Ux,NavigationControl:im,Point:db,Popup:ZA,PopupMLGL:Ix,RasterDEMTileSource:JA,RasterDEMTileSourceMLGL:Rx,RasterTileSource:YA,RasterTileSourceMLGL:zx,ReferenceMapStyle:Wp,ScaleControl:sm,ScaleControlMLGL:Vx,ScrollZoomHandler:um,ScrollZoomHandlerMLGL:Zx,SdkConfig:TA,ServiceError:Rp,Style:qA,StyleMLGL:Px,TerrainControMLGL:Gx,TerrainControl:lm,TwoFingersTouchPitchHandler:pm,TwoFingersTouchPitchHandlerMLGL:Wx,TwoFingersTouchRotateHandler:yb,TwoFingersTouchZoomHandler:_b,TwoFingersTouchZoomRotateHandler:mb,VectorTileSource:em,VectorTileSourceMLGL:Dx,VideoSource:tm,VideoSourceMLGL:Ox,addProtocol:Eb,addSourceType:Cb,areSameLanguages:function(e,t,i=Sp){const r=Fp(e,i),n=Fp(t,i);return r&&n&&r.flag===n.flag},bufferToPixelDataBrowser:Bf,circumferenceAtLatitude:_f,clearPrewarmedResources:ub,config:BA,configMLGL:eb,coordinates:Gp,data:Zp,displayWebGLContextLostWarning:function(e){const t=e.getContainer(),i=document.createElement("div");i.innerHTML="The WebGL context was lost.",i.classList.add("webgl-warning-div"),t.appendChild(i)},elevation:Pf,expandMapStyle:qp,geocoding:Qp,geolocation:Vp,getAutoLanguage:Pp,getBrowserLanguage:xA,getBufferToPixelDataParser:Cf,getLanguageInfoFromCode:Mp,getLanguageInfoFromFlag:Ip,getLanguageInfoFromKey:Ep,getMapLibreVersion:tb,getMaxParallelImageRequests:bb,getRTLTextPluginStatus:rb,getTileCache:Tf,getVersion:function(){return"3.2.0"},getWebGLSupportError:OA,getWorkerCount:vb,getWorkerUrl:Tb,gpx:Ov,gpxOrKml:lx,hasChildNodeWithName:Rv,helpers:Sx,importScriptInWorkers:Sb,isLanguageInfo:Lp,kml:Uv,mapStylePresetList:Xp,math:bf,misc:of,prewarm:cb,removeProtocol:Mb,setMaxParallelImageRequests:wb,setRTLTextPlugin:ib,setWorkerCount:xb,setWorkerUrl:Bb,staticMaps:lf,str2xml:zv,styleToStyle:Jp,toLanguageInfo:Fp,xml2str:Dv}),Pb=Object.freeze({__proto__:null,default:undefined});export{bp as startApp}; +var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};function t(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}var i=function(){return i=Object.assign||function(e){for(var t,i=1,r=arguments.length;i0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=55296&&n<=56319&&i>10),s%1024+56320)),(n+1===i||r.length>16384)&&(o+=String.fromCharCode.apply(String,r),r.length=0)}return o},h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="undefined"==typeof Uint8Array?[]:new Uint8Array(256),p=0;p>4,u[l++]=(15&r)<<4|n>>2,u[l++]=(3&n)<<6|63&o;return c},_=function(e){for(var t=e.length,i=[],r=0;r>v,T=(1<>v)+32,C=65536>>x,S=(1<=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>v])<>v)])<>x),t=this.index[t],t+=e>>v&S,t=((t=this.index[t])<z?(n.push(!0),s-=z):n.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(e))return r.push(o),i.push(W);if(s===U||s===G){if(0===o)return r.push(o),i.push(ue);var a=i[o-1];return-1===Fe.indexOf(a)?(r.push(r[o-1]),i.push(a)):(r.push(o),i.push(ue))}return r.push(o),s===he?i.push("strict"===t?te:ge):s===be||s===ce?i.push(ue):s===we?e>=131072&&e<=196605||e>=196608&&e<=262141?i.push(ge):i.push(ue):void i.push(s)})),[r,i,n]},De=function(e,t,i,r){var n=r[i];if(Array.isArray(e)?-1!==e.indexOf(n):e===n)for(var o=i;o<=r.length;){if((l=r[++o])===t)return!0;if(l!==H)break}if(n===H)for(o=i;o>0;){var s=r[--o];if(Array.isArray(e)?-1!==e.indexOf(s):e===s)for(var a=i;a<=r.length;){var l;if((l=r[++a])===t)return!0;if(l!==H)break}if(s!==H)break}return!1},Oe=function(e,t){for(var i=e;i>=0;){var r=t[i];if(r!==H)return r;i--}return 0},Ue=function(e,t,i,r,n){if(0===i[r])return Ce;var o=r-1;if(Array.isArray(n)&&!0===n[o])return Ce;var s=o-1,a=o+1,l=t[o],c=s>=0?t[s]:0,u=t[a];if(l===D&&u===O)return Ce;if(-1!==Ie.indexOf(l))return Be;if(-1!==Ie.indexOf(u))return Ce;if(-1!==Pe.indexOf(u))return Ce;if(Oe(o,t)===j)return Se;if(Ee.get(e[o])===G)return Ce;if((l===de||l===pe)&&Ee.get(e[a])===G)return Ce;if(l===Q||u===Q)return Ce;if(l===V)return Ce;if(-1===[H,Z,K].indexOf(l)&&u===V)return Ce;if(-1!==[X,Y,J,ne,le].indexOf(u))return Ce;if(Oe(o,t)===ie)return Ce;if(De(re,ie,o,t))return Ce;if(De([X,Y],te,o,t))return Ce;if(De($,$,o,t))return Ce;if(l===H)return Se;if(l===re||u===re)return Ce;if(u===W||l===W)return Se;if(-1!==[Z,K,te].indexOf(u)||l===q)return Ce;if(c===me&&-1!==ze.indexOf(l))return Ce;if(l===le&&u===me)return Ce;if(u===ee)return Ce;if(-1!==Me.indexOf(u)&&l===oe||-1!==Me.indexOf(l)&&u===oe)return Ce;if(l===ae&&-1!==[ge,de,pe].indexOf(u)||-1!==[ge,de,pe].indexOf(l)&&u===se)return Ce;if(-1!==Me.indexOf(l)&&-1!==Le.indexOf(u)||-1!==Le.indexOf(l)&&-1!==Me.indexOf(u))return Ce;if(-1!==[ae,se].indexOf(l)&&(u===oe||-1!==[ie,K].indexOf(u)&&t[a+1]===oe)||-1!==[ie,K].indexOf(l)&&u===oe||l===oe&&-1!==[oe,le,ne].indexOf(u))return Ce;if(-1!==[oe,le,ne,X,Y].indexOf(u))for(var h=o;h>=0;){if((d=t[h])===oe)return Ce;if(-1===[le,ne].indexOf(d))break;h--}if(-1!==[ae,se].indexOf(u))for(h=-1!==[X,Y].indexOf(l)?s:o;h>=0;){var d;if((d=t[h])===oe)return Ce;if(-1===[le,ne].indexOf(d))break;h--}if(_e===l&&-1!==[_e,ye,fe,Ae].indexOf(u)||-1!==[ye,fe].indexOf(l)&&-1!==[ye,ve].indexOf(u)||-1!==[ve,Ae].indexOf(l)&&u===ve)return Ce;if(-1!==ke.indexOf(l)&&-1!==[ee,se].indexOf(u)||-1!==ke.indexOf(u)&&l===ae)return Ce;if(-1!==Me.indexOf(l)&&-1!==Me.indexOf(u))return Ce;if(l===ne&&-1!==Me.indexOf(u))return Ce;if(-1!==Me.concat(oe).indexOf(l)&&u===ie&&-1===Te.indexOf(e[a])||-1!==Me.concat(oe).indexOf(u)&&l===Y)return Ce;if(l===xe&&u===xe){for(var p=i[o],f=1;p>0&&t[--p]===xe;)f++;if(f%2!=0)return Ce}return l===de&&u===pe?Ce:Se},Ne=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var i=Re(e,t.lineBreak),r=i[0],n=i[1],o=i[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(n=n.map((function(e){return-1!==[oe,ue,be].indexOf(e)?ge:e})));var s="keep-all"===t.wordBreak?o.map((function(t,i){return t&&e[i]>=19968&&e[i]<=40959})):void 0;return[r,n,s]},Qe=function(){function e(e,t,i,r){this.codePoints=e,this.required=t===Be,this.start=i,this.end=r}return e.prototype.slice=function(){return u.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),je=function(e,t){var i=c(e),r=Ne(i,t),n=r[0],o=r[1],s=r[2],a=i.length,l=0,u=0;return{next:function(){if(u>=a)return{done:!0,value:null};for(var e=Ce;u=zt&&e<=57},Zt=function(e){return e>=55296&&e<=57343},qt=function(e){return $t(e)||e>=Qt&&e<=Vt||e>=Rt&&e<=Ot},Kt=function(e){return e>=Rt&&e<=Nt},Wt=function(e){return e>=Qt&&e<=Gt},Xt=function(e){return Kt(e)||Wt(e)},Yt=function(e){return e>=vt},Jt=function(e){return e===Ze||e===We||e===Xe},ei=function(e){return Xt(e)||Yt(e)||e===st},ti=function(e){return ei(e)||$t(e)||e===at},ii=function(e){return e>=Et&&e<=Mt||e===It||e>=Pt&&e<=Lt||e===Ft},ri=function(e,t){return e===Ke&&t!==Ze},ni=function(e,t,i){return e===at?ei(t)||ri(t,i):!!ei(e)||!(e!==Ke||!ri(e,t))},oi=function(e,t,i){return e===wt||e===at?!!$t(t)||t===St&&$t(i):$t(e===St?t:e)},si=function(e){var t=0,i=1;e[t]!==wt&&e[t]!==at||(e[t]===at&&(i=-1),t++);for(var r=[];$t(e[t]);)r.push(e[t++]);var n=r.length?parseInt(u.apply(void 0,r),10):0;e[t]===St&&t++;for(var o=[];$t(e[t]);)o.push(e[t++]);var s=o.length,a=s?parseInt(u.apply(void 0,o),10):0;e[t]!==jt&&e[t]!==Dt||t++;var l=1;e[t]!==wt&&e[t]!==at||(e[t]===at&&(l=-1),t++);for(var c=[];$t(e[t]);)c.push(e[t++]);var h=c.length?parseInt(u.apply(void 0,c),10):0;return i*(n+a*Math.pow(10,-s))*Math.pow(10,l*h)},ai={type:2},li={type:3},ci={type:4},ui={type:13},hi={type:8},di={type:21},pi={type:9},fi={type:10},Ai={type:11},mi={type:12},gi={type:14},_i={type:23},yi={type:1},vi={type:25},xi={type:24},bi={type:26},wi={type:27},Ti={type:28},Bi={type:29},Ci={type:31},Si={type:32},Ei=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(c(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Si;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Ye:return this.consumeStringToken(Ye);case et:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),r=this.peekCodePoint(2);if(ti(t)||ri(i,r)){var n=ni(t,i,r)?He:Ve;return{type:5,value:this.consumeName(),flags:n}}break;case tt:if(this.peekCodePoint(0)===Je)return this.consumeCodePoint(),ui;break;case rt:return this.consumeStringToken(rt);case nt:return ai;case ot:return li;case bt:if(this.peekCodePoint(0)===Je)return this.consumeCodePoint(),gi;break;case wt:if(oi(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Tt:return ci;case at:var o=e,s=this.peekCodePoint(0),a=this.peekCodePoint(1);if(oi(o,s,a))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(ni(o,s,a))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(s===at&&a===ut)return this.consumeCodePoint(),this.consumeCodePoint(),xi;break;case St:if(oi(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case qe:if(this.peekCodePoint(0)===bt)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===bt&&(l=this.consumeCodePoint())===qe)return this.consumeToken();if(l===kt)return this.consumeToken()}break;case Bt:return bi;case Ct:return wi;case ct:if(this.peekCodePoint(0)===lt&&this.peekCodePoint(1)===at&&this.peekCodePoint(2)===at)return this.consumeCodePoint(),this.consumeCodePoint(),vi;break;case ht:var c=this.peekCodePoint(0),h=this.peekCodePoint(1),d=this.peekCodePoint(2);if(ni(c,h,d))return{type:7,value:this.consumeName()};break;case dt:return Ti;case Ke:if(ri(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case pt:return Bi;case ft:if(this.peekCodePoint(0)===Je)return this.consumeCodePoint(),hi;break;case At:return Ai;case gt:return mi;case Ut:case Ht:var p=this.peekCodePoint(0),f=this.peekCodePoint(1);return p!==wt||!qt(f)&&f!==mt||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case _t:if(this.peekCodePoint(0)===Je)return this.consumeCodePoint(),pi;if(this.peekCodePoint(0)===_t)return this.consumeCodePoint(),di;break;case yt:if(this.peekCodePoint(0)===Je)return this.consumeCodePoint(),fi;break;case kt:return Si}return Jt(e)?(this.consumeWhiteSpace(),Ci):$t(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ei(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:u(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return void 0===e?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();qt(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;t===mt&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i)return{type:30,start:parseInt(u.apply(void 0,e.map((function(e){return e===mt?zt:e}))),16),end:parseInt(u.apply(void 0,e.map((function(e){return e===mt?Vt:e}))),16)};var r=parseInt(u.apply(void 0,e),16);if(this.peekCodePoint(0)===at&&qt(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var n=[];qt(t)&&n.length<6;)n.push(t),t=this.consumeCodePoint();return{type:30,start:r,end:parseInt(u.apply(void 0,n),16)}}return{type:30,start:r,end:r}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return"url"===e.toLowerCase()&&this.peekCodePoint(0)===nt?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===nt?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===kt)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===rt||t===Ye){var i=this.consumeStringToken(this.consumeCodePoint());return 0===i.type&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===kt||this.peekCodePoint(0)===ot)?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),_i)}for(;;){var r=this.consumeCodePoint();if(r===kt||r===ot)return{type:22,value:u.apply(void 0,e)};if(Jt(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===kt||this.peekCodePoint(0)===ot?(this.consumeCodePoint(),{type:22,value:u.apply(void 0,e)}):(this.consumeBadUrlRemnants(),_i);if(r===Ye||r===rt||r===nt||ii(r))return this.consumeBadUrlRemnants(),_i;if(r===Ke){if(!ri(r,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),_i;e.push(this.consumeEscapedCodePoint())}else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;Jt(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===ot||e===kt)return;ri(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t=5e4,i="";e>0;){var r=Math.min(t,e);i+=u.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),i},e.prototype.consumeStringToken=function(e){for(var t="",i=0;;){var r=this._value[i];if(r===kt||void 0===r||r===e)return{type:0,value:t+=this.consumeStringSlice(i)};if(r===Ze)return this._value.splice(0,i),yi;if(r===Ke){var n=this._value[i+1];n!==kt&&void 0!==n&&(n===Ze?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):ri(r,n)&&(t+=this.consumeStringSlice(i),t+=u(this.consumeEscapedCodePoint()),i=-1))}i++}},e.prototype.consumeNumber=function(){var e=[],t=Ge,i=this.peekCodePoint(0);for(i!==wt&&i!==at||e.push(this.consumeCodePoint());$t(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(i===St&&$t(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=$e;$t(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((i===jt||i===Dt)&&((r===wt||r===at)&&$t(n)||$t(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=$e;$t(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[si(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),o=this.peekCodePoint(2);return ni(r,n,o)?{type:15,number:t,flags:i,unit:this.consumeName()}:r===it?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(qt(e)){for(var t=u(e);qt(this.peekCodePoint(0))&&t.length<6;)t+=u(this.consumeCodePoint());Jt(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return 0===i||Zt(i)||i>1114111?xt:i}return e===kt?xt:e},e.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(ti(t))e+=u(t);else{if(!ri(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),e;e+=u(this.consumeEscapedCodePoint())}}},e}(),Mi=function(){function e(e){this._tokens=e}return e.create=function(t){var i=new Ei;return i.write(t),new e(i.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();31===e.type;)e=this.consumeToken();if(32===e.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(32===t.type)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(32===i.type||Oi(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(32===i.type||3===i.type)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?Si:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Ii=function(e){return 15===e.type},Pi=function(e){return 17===e.type},Li=function(e){return 20===e.type},Fi=function(e){return 0===e.type},ki=function(e,t){return Li(e)&&e.value===t},zi=function(e){return 31!==e.type},Ri=function(e){return 31!==e.type&&4!==e.type},Di=function(e){var t=[],i=[];return e.forEach((function(e){if(4===e.type){if(0===i.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(i),void(i=[])}31!==e.type&&i.push(e)})),i.length&&t.push(i),t},Oi=function(e,t){return 11===t&&12===e.type||28===t&&29===e.type||2===t&&3===e.type},Ui=function(e){return 17===e.type||15===e.type},Ni=function(e){return 16===e.type||Ui(e)},Qi=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},ji={type:17,number:0,flags:Ge},Vi={type:16,number:50,flags:Ge},Hi={type:16,number:100,flags:Ge},Gi=function(e,t,i){var r=e[0],n=e[1];return[$i(r,t),$i(void 0!==n?n:r,i)]},$i=function(e,t){if(16===e.type)return e.number/100*t;if(Ii(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},Zi="deg",qi="grad",Ki="rad",Wi="turn",Xi={name:"angle",parse:function(e,t){if(15===t.type)switch(t.unit){case Zi:return Math.PI*t.number/180;case qi:return Math.PI/200*t.number;case Ki:return t.number;case Wi:return 2*Math.PI*t.number}throw new Error("Unsupported angle type")}},Yi=function(e){return 15===e.type&&(e.unit===Zi||e.unit===qi||e.unit===Ki||e.unit===Wi)},Ji=function(e){switch(e.filter(Li).map((function(e){return e.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ji,ji];case"to top":case"bottom":return er(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ji,Hi];case"to right":case"left":return er(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Hi,Hi];case"to bottom":case"top":return er(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Hi,ji];case"to left":case"right":return er(270)}return 0},er=function(e){return Math.PI*e/180},tr={name:"color",parse:function(e,t){if(18===t.type){var i=cr[t.name];if(void 0===i)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return i(e,t.values)}if(5===t.type){if(3===t.value.length){var r=t.value.substring(0,1),n=t.value.substring(1,2),o=t.value.substring(2,3);return nr(parseInt(r+r,16),parseInt(n+n,16),parseInt(o+o,16),1)}if(4===t.value.length){r=t.value.substring(0,1),n=t.value.substring(1,2),o=t.value.substring(2,3);var s=t.value.substring(3,4);return nr(parseInt(r+r,16),parseInt(n+n,16),parseInt(o+o,16),parseInt(s+s,16)/255)}if(6===t.value.length)return r=t.value.substring(0,2),n=t.value.substring(2,4),o=t.value.substring(4,6),nr(parseInt(r,16),parseInt(n,16),parseInt(o,16),1);if(8===t.value.length)return r=t.value.substring(0,2),n=t.value.substring(2,4),o=t.value.substring(4,6),s=t.value.substring(6,8),nr(parseInt(r,16),parseInt(n,16),parseInt(o,16),parseInt(s,16)/255)}if(20===t.type){var a=hr[t.value.toUpperCase()];if(void 0!==a)return a}return hr.TRANSPARENT}},ir=function(e){return!(255&e)},rr=function(e){var t=255&e,i=255&e>>8,r=255&e>>16,n=255&e>>24;return t<255?"rgba("+n+","+r+","+i+","+t/255+")":"rgb("+n+","+r+","+i+")"},nr=function(e,t,i,r){return(e<<24|t<<16|i<<8|Math.round(255*r))>>>0},or=function(e,t){if(17===e.type)return e.number;if(16===e.type){var i=3===t?1:255;return 3===t?e.number/100*i:Math.round(e.number/100*i)}return 0},sr=function(e,t){var i=t.filter(Ri);if(3===i.length){var r=i.map(or),n=r[0],o=r[1],s=r[2];return nr(n,o,s,1)}if(4===i.length){var a=i.map(or),l=(n=a[0],o=a[1],s=a[2],a[3]);return nr(n,o,s,l)}return 0};function ar(e,t,i){return i<0&&(i+=1),i>=1&&(i-=1),i<1/6?(t-e)*i*6+e:i<.5?t:i<2/3?6*(t-e)*(2/3-i)+e:e}var lr=function(e,t){var i=t.filter(Ri),r=i[0],n=i[1],o=i[2],s=i[3],a=(17===r.type?er(r.number):Xi.parse(e,r))/(2*Math.PI),l=Ni(n)?n.number/100:0,c=Ni(o)?o.number/100:0,u=void 0!==s&&Ni(s)?$i(s,1):1;if(0===l)return nr(255*c,255*c,255*c,1);var h=c<=.5?c*(l+1):c+l-c*l,d=2*c-h,p=ar(d,h,a+1/3),f=ar(d,h,a),A=ar(d,h,a-1/3);return nr(255*p,255*f,255*A,u)},cr={hsl:lr,hsla:lr,rgb:sr,rgba:sr},ur=function(e,t){return tr.parse(e,Mi.create(t).parseComponentValue())},hr={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},dr={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(Li(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},pr={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},fr=function(e,t){var i=tr.parse(e,t[0]),r=t[1];return r&&Ni(r)?{color:i,stop:r}:{color:i,stop:null}},Ar=function(e,t){var i=e[0],r=e[e.length-1];null===i.stop&&(i.stop=ji),null===r.stop&&(r.stop=Hi);for(var n=[],o=0,s=0;so?n.push(l):n.push(o),o=l}else n.push(null)}var c=null;for(s=0;se.optimumDistance)?{optimumCorner:t,optimumDistance:a}:e}),{optimumDistance:n?1/0:-1/0,optimumCorner:null}).optimumCorner},vr=function(e,t,i,r,n){var o=0,s=0;switch(e.size){case 0:0===e.shape?o=s=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(i),Math.abs(i-n)):1===e.shape&&(o=Math.min(Math.abs(t),Math.abs(t-r)),s=Math.min(Math.abs(i),Math.abs(i-n)));break;case 2:if(0===e.shape)o=s=Math.min(_r(t,i),_r(t,i-n),_r(t-r,i),_r(t-r,i-n));else if(1===e.shape){var a=Math.min(Math.abs(i),Math.abs(i-n))/Math.min(Math.abs(t),Math.abs(t-r)),l=yr(r,n,t,i,!0),c=l[0],u=l[1];s=a*(o=_r(c-t,(u-i)/a))}break;case 1:0===e.shape?o=s=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(i),Math.abs(i-n)):1===e.shape&&(o=Math.max(Math.abs(t),Math.abs(t-r)),s=Math.max(Math.abs(i),Math.abs(i-n)));break;case 3:if(0===e.shape)o=s=Math.max(_r(t,i),_r(t,i-n),_r(t-r,i),_r(t-r,i-n));else if(1===e.shape){a=Math.max(Math.abs(i),Math.abs(i-n))/Math.max(Math.abs(t),Math.abs(t-r));var h=yr(r,n,t,i,!1);c=h[0],u=h[1],s=a*(o=_r(c-t,(u-i)/a))}}return Array.isArray(e.size)&&(o=$i(e.size[0],r),s=2===e.size.length?$i(e.size[1],n):o),[o,s]},xr=function(e,t){var i=er(180),r=[];return Di(t).forEach((function(t,n){if(0===n){var o=t[0];if(20===o.type&&-1!==["top","left","right","bottom"].indexOf(o.value))return void(i=Ji(t));if(Yi(o))return void(i=(Xi.parse(e,o)+er(270))%er(360))}var s=fr(e,t);r.push(s)})),{angle:i,stops:r,type:1}},br=function(e,t){var i=er(180),r=[],n=1,o=0,s=3,a=[];return Di(t).forEach((function(t,i){var o=t[0];if(0===i){if(Li(o)&&"linear"===o.value)return void(n=1);if(Li(o)&&"radial"===o.value)return void(n=2)}if(18===o.type)if("from"===o.name){var s=tr.parse(e,o.values[0]);r.push({stop:ji,color:s})}else if("to"===o.name)s=tr.parse(e,o.values[0]),r.push({stop:Hi,color:s});else if("color-stop"===o.name){var a=o.values.filter(Ri);if(2===a.length){s=tr.parse(e,a[1]);var l=a[0];Pi(l)&&r.push({stop:{type:16,number:100*l.number,flags:l.flags},color:s})}}})),1===n?{angle:(i+er(180))%er(360),stops:r,type:n}:{size:s,shape:o,stops:r,position:a,type:n}},wr="closest-side",Tr="farthest-side",Br="closest-corner",Cr="farthest-corner",Sr="circle",Er="ellipse",Mr="cover",Ir="contain",Pr=function(e,t){var i=0,r=3,n=[],o=[];return Di(t).forEach((function(t,s){var a=!0;if(0===s?a=t.reduce((function(e,t){if(Li(t))switch(t.value){case"center":return o.push(Vi),!1;case"top":case"left":return o.push(ji),!1;case"right":case"bottom":return o.push(Hi),!1}else if(Ni(t)||Ui(t))return o.push(t),!1;return e}),a):1===s&&(a=t.reduce((function(e,t){if(Li(t))switch(t.value){case Sr:return i=0,!1;case Er:return i=1,!1;case Ir:case wr:return r=0,!1;case Tr:return r=1,!1;case Br:return r=2,!1;case Mr:case Cr:return r=3,!1}else if(Ui(t)||Ni(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e}),a)),a){var l=fr(e,t);n.push(l)}})),{size:r,shape:i,stops:n,position:o,type:2}},Lr=function(e){return 1===e.type},Fr=function(e){return 2===e.type},kr={name:"image",parse:function(e,t){if(22===t.type){var i={url:t.value,type:0};return e.cache.addImage(t.value),i}if(18===t.type){var r=Dr[t.name];if(void 0===r)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return r(e,t.values)}throw new Error("Unsupported image type "+t.type)}};function zr(e){return!(20===e.type&&"none"===e.value||18===e.type&&!Dr[e.name])}var Rr,Dr={"linear-gradient":function(e,t){var i=er(180),r=[];return Di(t).forEach((function(t,n){if(0===n){var o=t[0];if(20===o.type&&"to"===o.value)return void(i=Ji(t));if(Yi(o))return void(i=Xi.parse(e,o))}var s=fr(e,t);r.push(s)})),{angle:i,stops:r,type:1}},"-moz-linear-gradient":xr,"-ms-linear-gradient":xr,"-o-linear-gradient":xr,"-webkit-linear-gradient":xr,"radial-gradient":function(e,t){var i=0,r=3,n=[],o=[];return Di(t).forEach((function(t,s){var a=!0;if(0===s){var l=!1;a=t.reduce((function(e,t){if(l)if(Li(t))switch(t.value){case"center":return o.push(Vi),e;case"top":case"left":return o.push(ji),e;case"right":case"bottom":return o.push(Hi),e}else(Ni(t)||Ui(t))&&o.push(t);else if(Li(t))switch(t.value){case Sr:return i=0,!1;case Er:return i=1,!1;case"at":return l=!0,!1;case wr:return r=0,!1;case Mr:case Tr:return r=1,!1;case Ir:case Br:return r=2,!1;case Cr:return r=3,!1}else if(Ui(t)||Ni(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e}),a)}if(a){var c=fr(e,t);n.push(c)}})),{size:r,shape:i,stops:n,position:o,type:2}},"-moz-radial-gradient":Pr,"-ms-radial-gradient":Pr,"-o-radial-gradient":Pr,"-webkit-radial-gradient":Pr,"-webkit-gradient":br},Or={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var i=t[0];return 20===i.type&&"none"===i.value?[]:t.filter((function(e){return Ri(e)&&zr(e)})).map((function(t){return kr.parse(e,t)}))}},Ur={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(Li(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},Nr={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Di(t).map((function(e){return e.filter(Ni)})).map(Qi)}},Qr={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Di(t).map((function(e){return e.filter(Li).map((function(e){return e.value})).join(" ")})).map(jr)}},jr=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"}(Rr||(Rr={}));var Vr,Hr={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Di(t).map((function(e){return e.filter(Gr)}))}},Gr=function(e){return Li(e)||Ni(e)},$r=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Zr=$r("top"),qr=$r("right"),Kr=$r("bottom"),Wr=$r("left"),Xr=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Qi(t.filter(Ni))}}},Yr=Xr("top-left"),Jr=Xr("top-right"),en=Xr("bottom-right"),tn=Xr("bottom-left"),rn=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},nn=rn("top"),on=rn("right"),sn=rn("bottom"),an=rn("left"),ln=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Ii(t)?t.number:0}}},cn=ln("top"),un=ln("right"),hn=ln("bottom"),dn=ln("left"),pn={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},fn={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){return"rtl"===t?1:0}},An={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(Li).reduce((function(e,t){return e|mn(t.value)}),0)}},mn=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},gn={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},_n={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(Vr||(Vr={}));var yn,vn={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"strict"===t?Vr.STRICT:Vr.NORMAL}},xn={name:"line-height",initialValue:"normal",prefix:!1,type:4},bn=function(e,t){return Li(e)&&"normal"===e.value?1.2*t:17===e.type?t*e.number:Ni(e)?$i(e,t):t},wn={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return 20===t.type&&"none"===t.value?null:kr.parse(e,t)}},Tn={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){return"inside"===t?0:1}},Bn={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Cn=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},Sn=Cn("top"),En=Cn("right"),Mn=Cn("bottom"),In=Cn("left"),Pn={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(Li).map((function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}}))}},Ln={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"break-word"===t?"break-word":"normal"}},Fn=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},kn=Fn("top"),zn=Fn("right"),Rn=Fn("bottom"),Dn=Fn("left"),On={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Un={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Nn={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&ki(t[0],"none")?[]:Di(t).map((function(t){for(var i={color:hr.TRANSPARENT,offsetX:ji,offsetY:ji,blur:ji},r=0,n=0;n1?1:0],this.overflowWrap=vo(e,Ln,t.overflowWrap),this.paddingTop=vo(e,kn,t.paddingTop),this.paddingRight=vo(e,zn,t.paddingRight),this.paddingBottom=vo(e,Rn,t.paddingBottom),this.paddingLeft=vo(e,Dn,t.paddingLeft),this.paintOrder=vo(e,fo,t.paintOrder),this.position=vo(e,Un,t.position),this.textAlign=vo(e,On,t.textAlign),this.textDecorationColor=vo(e,Yn,null!==(i=t.textDecorationColor)&&void 0!==i?i:t.color),this.textDecorationLine=vo(e,Jn,null!==(r=t.textDecorationLine)&&void 0!==r?r:t.textDecoration),this.textShadow=vo(e,Nn,t.textShadow),this.textTransform=vo(e,Qn,t.textTransform),this.transform=vo(e,jn,t.transform),this.transformOrigin=vo(e,$n,t.transformOrigin),this.visibility=vo(e,Zn,t.visibility),this.webkitTextStrokeColor=vo(e,Ao,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=vo(e,mo,t.webkitTextStrokeWidth),this.wordBreak=vo(e,qn,t.wordBreak),this.zIndex=vo(e,Kn,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return ir(this.backgroundColor)},e.prototype.isTransformed=function(){return null!==this.transform},e.prototype.isPositioned=function(){return 0!==this.position},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return 0!==this.float},e.prototype.isInlineLevel=function(){return oo(this.display,4)||oo(this.display,33554432)||oo(this.display,268435456)||oo(this.display,536870912)||oo(this.display,67108864)||oo(this.display,134217728)},e}(),_o=function(){function e(e,t){this.content=vo(e,so,t.content),this.quotes=vo(e,uo,t.quotes)}return e}(),yo=function(){function e(e,t){this.counterIncrement=vo(e,ao,t.counterIncrement),this.counterReset=vo(e,lo,t.counterReset)}return e}(),vo=function(e,t,i){var r=new Ei,n=null!=i?i.toString():t.initialValue;r.write(n);var o=new Mi(r.read());switch(t.type){case 2:var s=o.parseComponentValue();return t.parse(e,Li(s)?s.value:t.initialValue);case 0:return t.parse(e,o.parseComponentValue());case 1:return t.parse(e,o.parseComponentValues());case 4:return o.parseComponentValue();case 3:switch(t.format){case"angle":return Xi.parse(e,o.parseComponentValue());case"color":return tr.parse(e,o.parseComponentValue());case"image":return kr.parse(e,o.parseComponentValue());case"length":var a=o.parseComponentValue();return Ui(a)?a:ji;case"length-percentage":var l=o.parseComponentValue();return Ni(l)?l:ji;case"time":return Wn.parse(e,o.parseComponentValue())}}},xo="data-html2canvas-debug",bo=function(e){switch(e.getAttribute(xo)){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},wo=function(e,t){var i=bo(e);return 1===i||t===i},To=function(){function e(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,wo(t,3),this.styles=new go(e,window.getComputedStyle(t,null)),ha(t)&&(this.styles.animationDuration.some((function(e){return e>0}))&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=a(this.context,t),wo(t,4)&&(this.flags|=16)}return e}(),Bo="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Co="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",So="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Eo=0;Eo>4,u[l++]=(15&r)<<4|n>>2,u[l++]=(3&n)<<6|63&o;return c},Io=function(e){for(var t=e.length,i=[],r=0;r>Lo,Ro=(1<>Lo)+32,Oo=65536>>Fo,Uo=(1<=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>Lo])<>Lo)])<>Fo),t=this.index[t],t+=e>>Lo&Uo,t=((t=this.index[t])<=55296&&n<=56319&&i>10),s%1024+56320)),(n+1===i||r.length>16384)&&(o+=String.fromCharCode.apply(String,r),r.length=0)}return o},us=jo(Bo),hs="×",ds="÷",ps=function(e){return us.get(e)},fs=function(e,t,i){var r=i-2,n=t[r],o=t[i-1],s=t[i];if(o===Ko&&s===Wo)return hs;if(o===Ko||o===Wo||o===Xo)return ds;if(s===Ko||s===Wo||s===Xo)return ds;if(o===es&&-1!==[es,ts,rs,ns].indexOf(s))return hs;if(!(o!==rs&&o!==ts||s!==ts&&s!==is))return hs;if((o===ns||o===is)&&s===is)return hs;if(s===os||s===Yo)return hs;if(s===Jo)return hs;if(o===qo)return hs;if(o===os&&s===ss){for(;n===Yo;)n=t[--r];if(n===ss)return hs}if(o===as&&s===as){for(var a=0;n===as;)a++,n=t[--r];if(a%2==0)return hs}return ds},As=function(e){var t=ls(e),i=t.length,r=0,n=0,o=t.map(ps);return{next:function(){if(r>=i)return{done:!0,value:null};for(var e=hs;rs.x||n.y>s.y;return s=n,0===t||a}));return e.body.removeChild(t),a},ys=function(){return void 0!==(new Image).crossOrigin},vs=function(){return"string"==typeof(new XMLHttpRequest).responseType},xs=function(e){var t=new Image,i=e.createElement("canvas"),r=i.getContext("2d");if(!r)return!1;t.src="data:image/svg+xml,";try{r.drawImage(t,0,0),i.toDataURL()}catch(e){return!1}return!0},bs=function(e){return 0===e[0]&&255===e[1]&&0===e[2]&&255===e[3]},ws=function(e){var t=e.createElement("canvas"),i=100;t.width=i,t.height=i;var r=t.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,i,i);var n=new Image,o=t.toDataURL();n.src=o;var s=Ts(i,i,0,0,n);return r.fillStyle="red",r.fillRect(0,0,i,i),Bs(s).then((function(t){r.drawImage(t,0,0);var n=r.getImageData(0,0,i,i).data;r.fillStyle="red",r.fillRect(0,0,i,i);var s=e.createElement("div");return s.style.backgroundImage="url("+o+")",s.style.height=i+"px",bs(n)?Bs(Ts(i,i,0,0,s)):Promise.reject(!1)})).then((function(e){return r.drawImage(e,0,0),bs(r.getImageData(0,0,i,i).data)})).catch((function(){return!1}))},Ts=function(e,t,i,r,n){var o="http://www.w3.org/2000/svg",s=document.createElementNS(o,"svg"),a=document.createElementNS(o,"foreignObject");return s.setAttributeNS(null,"width",e.toString()),s.setAttributeNS(null,"height",t.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",i.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(a),a.appendChild(n),s},Bs=function(e){return new Promise((function(t,i){var r=new Image;r.onload=function(){return t(r)},r.onerror=i,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(e))}))},Cs={get SUPPORT_RANGE_BOUNDS(){var e=gs(document);return Object.defineProperty(Cs,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Cs.SUPPORT_RANGE_BOUNDS&&_s(document);return Object.defineProperty(Cs,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=xs(document);return Object.defineProperty(Cs,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?ws(document):Promise.resolve(!1);return Object.defineProperty(Cs,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=ys();return Object.defineProperty(Cs,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=vs();return Object.defineProperty(Cs,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Cs,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(Cs,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Ss=function(){function e(e,t){this.text=e,this.bounds=t}return e}(),Es=function(e,t,i,r){var n=Fs(t,i),o=[],a=0;return n.forEach((function(t){if(i.textDecorationLine.length||t.trim().length>0)if(Cs.SUPPORT_RANGE_BOUNDS){var n=Is(r,a,t.length).getClientRects();if(n.length>1){var l=Ps(t),c=0;l.forEach((function(t){o.push(new Ss(t,s.fromDOMRectList(e,Is(r,c+a,t.length).getClientRects()))),c+=t.length}))}else o.push(new Ss(t,s.fromDOMRectList(e,n)))}else{var u=r.splitText(t.length);o.push(new Ss(t,Ms(e,r))),r=u}else Cs.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));a+=t.length})),o},Ms=function(e,t){var i=t.ownerDocument;if(i){var r=i.createElement("html2canvaswrapper");r.appendChild(t.cloneNode(!0));var n=t.parentNode;if(n){n.replaceChild(r,t);var o=a(e,r);return r.firstChild&&n.replaceChild(r.firstChild,r),o}}return s.EMPTY},Is=function(e,t,i){var r=e.ownerDocument;if(!r)throw new Error("Node has no owner document");var n=r.createRange();return n.setStart(e,t),n.setEnd(e,t+i),n},Ps=function(e){if(Cs.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map((function(e){return e.segment}))}return ms(e)},Ls=function(e,t){if(Cs.SUPPORT_NATIVE_TEXT_SEGMENTATION){var i=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(i.segment(e)).map((function(e){return e.segment}))}return zs(e,t)},Fs=function(e,t){return 0!==t.letterSpacing?Ps(e):Ls(e,t)},ks=[32,160,4961,65792,65793,4153,4241],zs=function(e,t){for(var i,r=je(e,{lineBreak:t.lineBreak,wordBreak:"break-word"===t.overflowWrap?"break-word":t.wordBreak}),n=[],o=function(){if(i.value){var e=i.value.slice(),t=c(e),r="";t.forEach((function(e){-1===ks.indexOf(e)?r+=u(e):(r.length&&n.push(r),n.push(u(e)),r="")})),r.length&&n.push(r)}};!(i=r.next()).done;)o();return n},Rs=function(){function e(e,t,i){this.text=Ds(t.data,i.textTransform),this.textBounds=Es(e,this.text,i,t)}return e}(),Ds=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Os,Us);case 2:return e.toUpperCase();default:return e}},Os=/(^|\s|:|-|\(|\))([a-z])/g,Us=function(e,t,i){return e.length>0?t+i.toUpperCase():e},Ns=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.src=i.currentSrc||i.src,r.intrinsicWidth=i.naturalWidth,r.intrinsicHeight=i.naturalHeight,r.context.cache.addImage(r.src),r}return t(i,e),i}(To),Qs=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.canvas=i,r.intrinsicWidth=i.width,r.intrinsicHeight=i.height,r}return t(i,e),i}(To),js=function(e){function i(t,i){var r=e.call(this,t,i)||this,n=new XMLSerializer,o=a(t,i);return i.setAttribute("width",o.width+"px"),i.setAttribute("height",o.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(i)),r.intrinsicWidth=i.width.baseVal.value,r.intrinsicHeight=i.height.baseVal.value,r.context.cache.addImage(r.svg),r}return t(i,e),i}(To),Vs=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.value=i.value,r}return t(i,e),i}(To),Hs=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.start=i.start,r.reversed="boolean"==typeof i.reversed&&!0===i.reversed,r}return t(i,e),i}(To),Gs=[{type:15,flags:0,unit:"px",number:3}],$s=[{type:16,flags:0,number:50}],Zs=function(e){return e.width>e.height?new s(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width0)i.textNodes.push(new Rs(e,n,i.styles));else if(ua(n))if(Sa(n)&&n.assignedNodes)n.assignedNodes().forEach((function(t){return na(e,t,i,r)}));else{var s=oa(e,n);s.styles.isVisible()&&(aa(n,s,r)?s.flags|=4:la(s.styles)&&(s.flags|=2),-1!==ra.indexOf(n.tagName)&&(s.flags|=8),i.elements.push(s),n.slot,n.shadowRoot?na(e,n.shadowRoot,s,r):Ba(n)||ga(n)||Ca(n)||na(e,n,s,r))}},oa=function(e,t){return xa(t)?new Ns(e,t):ya(t)?new Qs(e,t):ga(t)?new js(e,t):pa(t)?new Vs(e,t):fa(t)?new Hs(e,t):Aa(t)?new Js(e,t):Ca(t)?new ea(e,t):Ba(t)?new ta(e,t):ba(t)?new ia(e,t):new To(e,t)},sa=function(e,t){var i=oa(e,t);return i.flags|=4,na(e,t,i,i),i},aa=function(e,t,i){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||_a(e)&&i.styles.isTransparent()},la=function(e){return e.isPositioned()||e.isFloating()},ca=function(e){return e.nodeType===Node.TEXT_NODE},ua=function(e){return e.nodeType===Node.ELEMENT_NODE},ha=function(e){return ua(e)&&void 0!==e.style&&!da(e)},da=function(e){return"object"==typeof e.className},pa=function(e){return"LI"===e.tagName},fa=function(e){return"OL"===e.tagName},Aa=function(e){return"INPUT"===e.tagName},ma=function(e){return"HTML"===e.tagName},ga=function(e){return"svg"===e.tagName},_a=function(e){return"BODY"===e.tagName},ya=function(e){return"CANVAS"===e.tagName},va=function(e){return"VIDEO"===e.tagName},xa=function(e){return"IMG"===e.tagName},ba=function(e){return"IFRAME"===e.tagName},wa=function(e){return"STYLE"===e.tagName},Ta=function(e){return"SCRIPT"===e.tagName},Ba=function(e){return"TEXTAREA"===e.tagName},Ca=function(e){return"SELECT"===e.tagName},Sa=function(e){return"SLOT"===e.tagName},Ea=function(e){return e.tagName.indexOf("-")>0},Ma=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},e.prototype.pop=function(e){var t=this;e.forEach((function(e){return t.counters[e].pop()}))},e.prototype.parse=function(e){var t=this,i=e.counterIncrement,r=e.counterReset,n=!0;null!==i&&i.forEach((function(e){var i=t.counters[e.counter];i&&0!==e.increment&&(n=!1,i.length||i.push(1),i[Math.max(0,i.length-1)]+=e.increment)}));var o=[];return n&&r.forEach((function(e){var i=t.counters[e.counter];o.push(e.counter),i||(i=t.counters[e.counter]=[]),i.push(e.reset)})),o},e}(),Ia={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Pa={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},La={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Fa={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},ka=function(e,t,i,r,n,o){return ei?Za(e,n,o.length>0):r.integers.reduce((function(t,i,n){for(;e>=i;)e-=i,t+=r.values[n];return t}),"")+o},za=function(e,t,i,r){var n="";do{i||e--,n=r(e)+n,e/=t}while(e*t>=t);return n},Ra=function(e,t,i,r,n){var o=i-t+1;return(e<0?"-":"")+(za(Math.abs(e),o,r,(function(e){return u(Math.floor(e%o)+t)}))+n)},Da=function(e,t,i){void 0===i&&(i=". ");var r=t.length;return za(Math.abs(e),r,!1,(function(e){return t[Math.floor(e%r)]}))+i},Oa=1,Ua=2,Na=4,Qa=8,ja=function(e,t,i,r,n,o){if(e<-9999||e>9999)return Za(e,4,n.length>0);var s=Math.abs(e),a=n;if(0===s)return t[0]+a;for(var l=0;s>0&&l<=4;l++){var c=s%10;0===c&&oo(o,Oa)&&""!==a?a=t[c]+a:c>1||1===c&&0===l||1===c&&1===l&&oo(o,Ua)||1===c&&1===l&&oo(o,Na)&&e>100||1===c&&l>1&&oo(o,Qa)?a=t[c]+(l>0?i[l-1]:"")+a:1===c&&l>0&&(a=i[l-1]+a),s=Math.floor(s/10)}return(e<0?r:"")+a},Va="十百千萬",Ha="拾佰仟萬",Ga="マイナス",$a="마이너스",Za=function(e,t,i){var r=i?". ":"",n=i?"、":"",o=i?", ":"",s=i?" ":"";switch(t){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var a=Ra(e,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return Da(e,"〇一二三四五六七八九",n);case 6:return ka(e,1,3999,Ia,3,r).toLowerCase();case 7:return ka(e,1,3999,Ia,3,r);case 8:return Ra(e,945,969,!1,r);case 9:return Ra(e,97,122,!1,r);case 10:return Ra(e,65,90,!1,r);case 11:return Ra(e,1632,1641,!0,r);case 12:case 49:return ka(e,1,9999,Pa,3,r);case 35:return ka(e,1,9999,Pa,3,r).toLowerCase();case 13:return Ra(e,2534,2543,!0,r);case 14:case 30:return Ra(e,6112,6121,!0,r);case 15:return Da(e,"子丑寅卯辰巳午未申酉戌亥",n);case 16:return Da(e,"甲乙丙丁戊己庚辛壬癸",n);case 17:case 48:return ja(e,"零一二三四五六七八九",Va,"負",n,Ua|Na|Qa);case 47:return ja(e,"零壹貳參肆伍陸柒捌玖",Ha,"負",n,Oa|Ua|Na|Qa);case 42:return ja(e,"零一二三四五六七八九",Va,"负",n,Ua|Na|Qa);case 41:return ja(e,"零壹贰叁肆伍陆柒捌玖",Ha,"负",n,Oa|Ua|Na|Qa);case 26:return ja(e,"〇一二三四五六七八九","十百千万",Ga,n,0);case 25:return ja(e,"零壱弐参四伍六七八九","拾百千万",Ga,n,Oa|Ua|Na);case 31:return ja(e,"영일이삼사오육칠팔구","십백천만",$a,o,Oa|Ua|Na);case 33:return ja(e,"零一二三四五六七八九","十百千萬",$a,o,0);case 32:return ja(e,"零壹貳參四五六七八九","拾百千",$a,o,Oa|Ua|Na);case 18:return Ra(e,2406,2415,!0,r);case 20:return ka(e,1,19999,Fa,3,r);case 21:return Ra(e,2790,2799,!0,r);case 22:return Ra(e,2662,2671,!0,r);case 22:return ka(e,1,10999,La,3,r);case 23:return Da(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Da(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Ra(e,3302,3311,!0,r);case 28:return Da(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",n);case 29:return Da(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",n);case 34:return Ra(e,3792,3801,!0,r);case 37:return Ra(e,6160,6169,!0,r);case 38:return Ra(e,4160,4169,!0,r);case 39:return Ra(e,2918,2927,!0,r);case 40:return Ra(e,1776,1785,!0,r);case 43:return Ra(e,3046,3055,!0,r);case 44:return Ra(e,3174,3183,!0,r);case 45:return Ra(e,3664,3673,!0,r);case 46:return Ra(e,3872,3881,!0,r);default:return Ra(e,48,57,!0,r)}},qa="data-html2canvas-ignore",Ka=function(){function e(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new Ma,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var i=this,o=Xa(e,t);if(!o.contentWindow)return Promise.reject("Unable to find iframe window");var s=e.defaultView.pageXOffset,a=e.defaultView.pageYOffset,l=o.contentWindow,c=l.document,u=el(o).then((function(){return r(i,void 0,void 0,(function(){var e,i;return n(this,(function(r){switch(r.label){case 0:return this.scrolledElements.forEach(ol),l&&(l.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||l.scrollY===t.top&&l.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(l.scrollX-t.left,l.scrollY-t.top,0,0))),e=this.options.onclone,void 0===(i=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:c.fonts&&c.fonts.ready?[4,c.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Ja(c)]:[3,4];case 3:r.sent(),r.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then((function(){return e(c,i)})).then((function(){return o}))]:[2,o]}}))}))}));return c.open(),c.write(rl(document.doctype)+""),nl(this.referenceElement.ownerDocument,s,a),c.replaceChild(c.adoptNode(this.documentElement),c.documentElement),c.close(),u},e.prototype.createElementClone=function(e){if(wo(e,2),ya(e))return this.createCanvasClone(e);if(va(e))return this.createVideoClone(e);if(wa(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return xa(t)&&(xa(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),Ea(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return il(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce((function(e,t){return t&&"string"==typeof t.cssText?e+t.cssText:e}),""),r=e.cloneNode(!1);return r.textContent=i,r}}catch(e){if(this.context.logger.error("Unable to access cssRules property",e),"SecurityError"!==e.name)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch(t){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var n=e.getContext("2d"),o=r.getContext("2d");if(o)if(!this.options.allowTaint&&n)o.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var s=null!==(t=e.getContext("webgl2"))&&void 0!==t?t:e.getContext("webgl");if(s){var a=s.getContextAttributes();!1===(null==a?void 0:a.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}o.drawImage(e,0,0)}return r}catch(t){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch(t){this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,i){ua(t)&&(Ta(t)||t.hasAttribute(qa)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&ua(t)&&wa(t)||e.appendChild(this.cloneNode(t,i))},e.prototype.cloneChildNodes=function(e,t,i){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(ua(n)&&Sa(n)&&"function"==typeof n.assignedNodes){var o=n.assignedNodes();o.length&&o.forEach((function(e){return r.appendChildNode(t,e,i)}))}else this.appendChildNode(t,n,i)},e.prototype.cloneNode=function(e,t){if(ca(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&ua(e)&&(ha(e)||da(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=i.getComputedStyle(e),o=i.getComputedStyle(e,":before"),s=i.getComputedStyle(e,":after");this.referenceElement===e&&ha(r)&&(this.clonedReferenceElement=r),_a(r)&&hl(r);var a=this.counters.parse(new yo(this.context,n)),l=this.resolvePseudoContent(e,r,o,Zo.BEFORE);Ea(e)&&(t=!0),va(e)||this.cloneChildNodes(e,r,t),l&&r.insertBefore(l,r.firstChild);var c=this.resolvePseudoContent(e,r,s,Zo.AFTER);return c&&r.appendChild(c),this.counters.pop(a),(n&&(this.options.copyStyles||da(e))&&!ba(e)||t)&&il(n,r),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ba(e)||Ca(e))&&(Ba(r)||Ca(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,i,r){var n=this;if(i){var o=i.content,s=t.ownerDocument;if(s&&o&&"none"!==o&&"-moz-alt-content"!==o&&"none"!==i.display){this.counters.parse(new yo(this.context,i));var a=new _o(this.context,i),l=s.createElement("html2canvaspseudoelement");il(i,l),a.content.forEach((function(t){if(0===t.type)l.appendChild(s.createTextNode(t.value));else if(22===t.type){var i=s.createElement("img");i.src=t.value,i.style.opacity="1",l.appendChild(i)}else if(18===t.type){if("attr"===t.name){var r=t.values.filter(Li);r.length&&l.appendChild(s.createTextNode(e.getAttribute(r[0].value)||""))}else if("counter"===t.name){var o=t.values.filter(Ri),c=o[0],u=o[1];if(c&&Li(c)){var h=n.counters.getCounterValue(c.value),d=u&&Li(u)?Bn.parse(n.context,u.value):3;l.appendChild(s.createTextNode(Za(h,d,!1)))}}else if("counters"===t.name){var p=t.values.filter(Ri),f=(c=p[0],p[1]);if(u=p[2],c&&Li(c)){var A=n.counters.getCounterValues(c.value),m=u&&Li(u)?Bn.parse(n.context,u.value):3,g=f&&0===f.type?f.value:"",_=A.map((function(e){return Za(e,m,!1)})).join(g);l.appendChild(s.createTextNode(_))}}}else if(20===t.type)switch(t.value){case"open-quote":l.appendChild(s.createTextNode(ho(a.quotes,n.quoteDepth++,!0)));break;case"close-quote":l.appendChild(s.createTextNode(ho(a.quotes,--n.quoteDepth,!1)));break;default:l.appendChild(s.createTextNode(t.value))}})),l.className=ll+" "+cl;var c=r===Zo.BEFORE?" "+ll:" "+cl;return da(t)?t.className.baseValue+=c:t.className+=c,l}}},e.destroy=function(e){return!!e.parentNode&&(e.parentNode.removeChild(e),!0)},e}();!function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"}(Zo||(Zo={}));var Wa,Xa=function(e,t){var i=e.createElement("iframe");return i.className="html2canvas-container",i.style.visibility="hidden",i.style.position="fixed",i.style.left="-10000px",i.style.top="0px",i.style.border="0",i.width=t.width.toString(),i.height=t.height.toString(),i.scrolling="no",i.setAttribute(qa,"true"),e.body.appendChild(i),i},Ya=function(e){return new Promise((function(t){e.complete?t():e.src?(e.onload=t,e.onerror=t):t()}))},Ja=function(e){return Promise.all([].slice.call(e.images,0).map(Ya))},el=function(e){return new Promise((function(t,i){var r=e.contentWindow;if(!r)return i("No window assigned for iframe");var n=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var i=setInterval((function(){n.body.childNodes.length>0&&"complete"===n.readyState&&(clearInterval(i),t(e))}),50)}}))},tl=["all","d","content"],il=function(e,t){for(var i=e.length-1;i>=0;i--){var r=e.item(i);-1===tl.indexOf(r)&&t.style.setProperty(r,e.getPropertyValue(r))}return t},rl=function(e){var t="";return e&&(t+=""),t},nl=function(e,t,i){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||i!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,i)},ol=function(e){var t=e[0],i=e[1],r=e[2];t.scrollLeft=i,t.scrollTop=r},sl=":before",al=":after",ll="___html2canvas___pseudoelement_before",cl="___html2canvas___pseudoelement_after",ul='{\n content: "" !important;\n display: none !important;\n}',hl=function(e){dl(e,"."+ll+sl+ul+"\n ."+cl+al+ul)},dl=function(e,t){var i=e.ownerDocument;if(i){var r=i.createElement("style");r.textContent=t,e.appendChild(r)}},pl=function(){function e(){}return e.getOrigin=function(t){var i=e._link;return i?(i.href=t,i.href=i.href,i.protocol+i.hostname+i.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),fl=function(){function e(e,t){this.context=e,this._options=t,this._cache={}}return e.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)?t:xl(e)||_l(e)?((this._cache[e]=this.loadImage(e)).catch((function(){})),t):t},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return r(this,void 0,void 0,(function(){var t,i,r,o,s=this;return n(this,(function(n){switch(n.label){case 0:return t=pl.isSameOrigin(e),i=!yl(e)&&!0===this._options.useCORS&&Cs.SUPPORT_CORS_IMAGES&&!t,r=!yl(e)&&!t&&!xl(e)&&"string"==typeof this._options.proxy&&Cs.SUPPORT_CORS_XHR&&!i,t||!1!==this._options.allowTaint||yl(e)||xl(e)||r||i?(o=e,r?[4,this.proxy(o)]:[3,2]):[2];case 1:o=n.sent(),n.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise((function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,(vl(o)||i)&&(r.crossOrigin="anonymous"),r.src=o,!0===r.complete&&setTimeout((function(){return e(r)}),500),s._options.imageTimeout>0&&setTimeout((function(){return t("Timed out ("+s._options.imageTimeout+"ms) loading image")}),s._options.imageTimeout)}))];case 3:return[2,n.sent()]}}))}))},e.prototype.has=function(e){return void 0!==this._cache[e]},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(e){var t=this,i=this._options.proxy;if(!i)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise((function(n,o){var s=Cs.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(200===a.status)if("text"===s)n(a.response);else{var e=new FileReader;e.addEventListener("load",(function(){return n(e.result)}),!1),e.addEventListener("error",(function(e){return o(e)}),!1),e.readAsDataURL(a.response)}else o("Failed to proxy resource "+r+" with status code "+a.status)},a.onerror=o;var l=i.indexOf("?")>-1?"&":"?";if(a.open("GET",""+i+l+"url="+encodeURIComponent(e)+"&responseType="+s),"text"!==s&&a instanceof XMLHttpRequest&&(a.responseType=s),t._options.imageTimeout){var c=t._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return o("Timed out ("+c+"ms) proxying "+r)}}a.send()}))},e}(),Al=/^data:image\/svg\+xml/i,ml=/^data:image\/.*;base64,/i,gl=/^data:image\/.*/i,_l=function(e){return Cs.SUPPORT_SVG_DRAWING||!bl(e)},yl=function(e){return gl.test(e)},vl=function(e){return ml.test(e)},xl=function(e){return"blob"===e.substr(0,4)},bl=function(e){return"svg"===e.substr(-3).toLowerCase()||Al.test(e)},wl=function(){function e(e,t){this.type=0,this.x=e,this.y=t}return e.prototype.add=function(t,i){return new e(this.x+t,this.y+i)},e}(),Tl=function(e,t,i){return new wl(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i)},Bl=function(){function e(e,t,i,r){this.type=1,this.start=e,this.startControl=t,this.endControl=i,this.end=r}return e.prototype.subdivide=function(t,i){var r=Tl(this.start,this.startControl,t),n=Tl(this.startControl,this.endControl,t),o=Tl(this.endControl,this.end,t),s=Tl(r,n,t),a=Tl(n,o,t),l=Tl(s,a,t);return i?new e(this.start,r,s,l):new e(l,a,o,this.end)},e.prototype.add=function(t,i){return new e(this.start.add(t,i),this.startControl.add(t,i),this.endControl.add(t,i),this.end.add(t,i))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Cl=function(e){return 1===e.type},Sl=function(){function e(e){var t=e.styles,i=e.bounds,r=Gi(t.borderTopLeftRadius,i.width,i.height),n=r[0],o=r[1],s=Gi(t.borderTopRightRadius,i.width,i.height),a=s[0],l=s[1],c=Gi(t.borderBottomRightRadius,i.width,i.height),u=c[0],h=c[1],d=Gi(t.borderBottomLeftRadius,i.width,i.height),p=d[0],f=d[1],A=[];A.push((n+a)/i.width),A.push((p+u)/i.width),A.push((o+f)/i.height),A.push((l+h)/i.height);var m=Math.max.apply(Math,A);m>1&&(n/=m,o/=m,a/=m,l/=m,u/=m,h/=m,p/=m,f/=m);var g=i.width-a,_=i.height-h,y=i.width-u,v=i.height-f,x=t.borderTopWidth,b=t.borderRightWidth,w=t.borderBottomWidth,T=t.borderLeftWidth,B=$i(t.paddingTop,e.bounds.width),C=$i(t.paddingRight,e.bounds.width),S=$i(t.paddingBottom,e.bounds.width),E=$i(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||o>0?El(i.left+T/3,i.top+x/3,n-T/3,o-x/3,Wa.TOP_LEFT):new wl(i.left+T/3,i.top+x/3),this.topRightBorderDoubleOuterBox=n>0||o>0?El(i.left+g,i.top+x/3,a-b/3,l-x/3,Wa.TOP_RIGHT):new wl(i.left+i.width-b/3,i.top+x/3),this.bottomRightBorderDoubleOuterBox=u>0||h>0?El(i.left+y,i.top+_,u-b/3,h-w/3,Wa.BOTTOM_RIGHT):new wl(i.left+i.width-b/3,i.top+i.height-w/3),this.bottomLeftBorderDoubleOuterBox=p>0||f>0?El(i.left+T/3,i.top+v,p-T/3,f-w/3,Wa.BOTTOM_LEFT):new wl(i.left+T/3,i.top+i.height-w/3),this.topLeftBorderDoubleInnerBox=n>0||o>0?El(i.left+2*T/3,i.top+2*x/3,n-2*T/3,o-2*x/3,Wa.TOP_LEFT):new wl(i.left+2*T/3,i.top+2*x/3),this.topRightBorderDoubleInnerBox=n>0||o>0?El(i.left+g,i.top+2*x/3,a-2*b/3,l-2*x/3,Wa.TOP_RIGHT):new wl(i.left+i.width-2*b/3,i.top+2*x/3),this.bottomRightBorderDoubleInnerBox=u>0||h>0?El(i.left+y,i.top+_,u-2*b/3,h-2*w/3,Wa.BOTTOM_RIGHT):new wl(i.left+i.width-2*b/3,i.top+i.height-2*w/3),this.bottomLeftBorderDoubleInnerBox=p>0||f>0?El(i.left+2*T/3,i.top+v,p-2*T/3,f-2*w/3,Wa.BOTTOM_LEFT):new wl(i.left+2*T/3,i.top+i.height-2*w/3),this.topLeftBorderStroke=n>0||o>0?El(i.left+T/2,i.top+x/2,n-T/2,o-x/2,Wa.TOP_LEFT):new wl(i.left+T/2,i.top+x/2),this.topRightBorderStroke=n>0||o>0?El(i.left+g,i.top+x/2,a-b/2,l-x/2,Wa.TOP_RIGHT):new wl(i.left+i.width-b/2,i.top+x/2),this.bottomRightBorderStroke=u>0||h>0?El(i.left+y,i.top+_,u-b/2,h-w/2,Wa.BOTTOM_RIGHT):new wl(i.left+i.width-b/2,i.top+i.height-w/2),this.bottomLeftBorderStroke=p>0||f>0?El(i.left+T/2,i.top+v,p-T/2,f-w/2,Wa.BOTTOM_LEFT):new wl(i.left+T/2,i.top+i.height-w/2),this.topLeftBorderBox=n>0||o>0?El(i.left,i.top,n,o,Wa.TOP_LEFT):new wl(i.left,i.top),this.topRightBorderBox=a>0||l>0?El(i.left+g,i.top,a,l,Wa.TOP_RIGHT):new wl(i.left+i.width,i.top),this.bottomRightBorderBox=u>0||h>0?El(i.left+y,i.top+_,u,h,Wa.BOTTOM_RIGHT):new wl(i.left+i.width,i.top+i.height),this.bottomLeftBorderBox=p>0||f>0?El(i.left,i.top+v,p,f,Wa.BOTTOM_LEFT):new wl(i.left,i.top+i.height),this.topLeftPaddingBox=n>0||o>0?El(i.left+T,i.top+x,Math.max(0,n-T),Math.max(0,o-x),Wa.TOP_LEFT):new wl(i.left+T,i.top+x),this.topRightPaddingBox=a>0||l>0?El(i.left+Math.min(g,i.width-b),i.top+x,g>i.width+b?0:Math.max(0,a-b),Math.max(0,l-x),Wa.TOP_RIGHT):new wl(i.left+i.width-b,i.top+x),this.bottomRightPaddingBox=u>0||h>0?El(i.left+Math.min(y,i.width-T),i.top+Math.min(_,i.height-w),Math.max(0,u-b),Math.max(0,h-w),Wa.BOTTOM_RIGHT):new wl(i.left+i.width-b,i.top+i.height-w),this.bottomLeftPaddingBox=p>0||f>0?El(i.left+T,i.top+Math.min(v,i.height-w),Math.max(0,p-T),Math.max(0,f-w),Wa.BOTTOM_LEFT):new wl(i.left+T,i.top+i.height-w),this.topLeftContentBox=n>0||o>0?El(i.left+T+E,i.top+x+B,Math.max(0,n-(T+E)),Math.max(0,o-(x+B)),Wa.TOP_LEFT):new wl(i.left+T+E,i.top+x+B),this.topRightContentBox=a>0||l>0?El(i.left+Math.min(g,i.width+T+E),i.top+x+B,g>i.width+T+E?0:a-T+E,l-(x+B),Wa.TOP_RIGHT):new wl(i.left+i.width-(b+C),i.top+x+B),this.bottomRightContentBox=u>0||h>0?El(i.left+Math.min(y,i.width-(T+E)),i.top+Math.min(_,i.height+x+B),Math.max(0,u-(b+C)),h-(w+S),Wa.BOTTOM_RIGHT):new wl(i.left+i.width-(b+C),i.top+i.height-(w+S)),this.bottomLeftContentBox=p>0||f>0?El(i.left+T+E,i.top+v,Math.max(0,p-(T+E)),f-(w+S),Wa.BOTTOM_LEFT):new wl(i.left+T+E,i.top+i.height-(w+S))}return e}();!function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(Wa||(Wa={}));var El=function(e,t,i,r,n){var o=(Math.sqrt(2)-1)/3*4,s=i*o,a=r*o,l=e+i,c=t+r;switch(n){case Wa.TOP_LEFT:return new Bl(new wl(e,c),new wl(e,c-a),new wl(l-s,t),new wl(l,t));case Wa.TOP_RIGHT:return new Bl(new wl(e,t),new wl(e+s,t),new wl(l,c-a),new wl(l,c));case Wa.BOTTOM_RIGHT:return new Bl(new wl(l,t),new wl(l,t+a),new wl(e+s,c),new wl(e,c));case Wa.BOTTOM_LEFT:default:return new Bl(new wl(l,c),new wl(l-s,c),new wl(e,t+a),new wl(e,t))}},Ml=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Il=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},Pl=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Ll=function(){function e(e,t,i){this.offsetX=e,this.offsetY=t,this.matrix=i,this.type=0,this.target=6}return e}(),Fl=function(){function e(e,t){this.path=e,this.target=t,this.type=1}return e}(),kl=function(){function e(e){this.opacity=e,this.type=2,this.target=6}return e}(),zl=function(e){return 0===e.type},Rl=function(e){return 1===e.type},Dl=function(e){return 2===e.type},Ol=function(e,t){return e.length===t.length&&e.some((function(e,i){return e===t[i]}))},Ul=function(e,t,i,r,n){return e.map((function(e,o){switch(o){case 0:return e.add(t,i);case 1:return e.add(t+r,i);case 2:return e.add(t+r,i+n);case 3:return e.add(t,i+n)}return e}))},Nl=function(){function e(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),Ql=function(){function e(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Sl(this.container),this.container.styles.opacity<1&&this.effects.push(new kl(this.container.styles.opacity)),null!==this.container.styles.transform){var i=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new Ll(i,r,n))}if(0!==this.container.styles.overflowX){var o=Ml(this.curves),s=Pl(this.curves);Ol(o,s)?this.effects.push(new Fl(o,6)):(this.effects.push(new Fl(o,2)),this.effects.push(new Fl(s,4)))}}return e.prototype.getEffects=function(e){for(var t=-1===[2,3].indexOf(this.container.styles.position),i=this.parent,r=this.effects.slice(0);i;){var n=i.effects.filter((function(e){return!Rl(e)}));if(t||0!==i.container.styles.position||!i.parent){if(r.unshift.apply(r,n),t=-1===[2,3].indexOf(i.container.styles.position),0!==i.container.styles.overflowX){var o=Ml(i.curves),s=Pl(i.curves);Ol(o,s)||r.unshift(new Fl(s,6))}}else r.unshift.apply(r,n);i=i.parent}return r.filter((function(t){return oo(t.target,e)}))},e}(),jl=function(e,t,i,r){e.container.elements.forEach((function(n){var o=oo(n.flags,4),s=oo(n.flags,2),a=new Ql(n,e);oo(n.styles.display,2048)&&r.push(a);var l=oo(n.flags,8)?[]:r;if(o||s){var c=o||n.styles.isPositioned()?i:t,u=new Nl(a);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var d=0;c.negativeZIndex.some((function(e,t){return h>e.element.container.styles.zIndex.order?(d=t,!1):d>0})),c.negativeZIndex.splice(d,0,u)}else if(h>0){var p=0;c.positiveZIndex.some((function(e,t){return h>=e.element.container.styles.zIndex.order?(p=t+1,!1):p>0})),c.positiveZIndex.splice(p,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else n.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);jl(a,u,o?u:i,l)}else n.styles.isInlineLevel()?t.inlineLevel.push(a):t.nonInlineLevel.push(a),jl(a,t,i,l);oo(n.flags,8)&&Vl(n,l)}))},Vl=function(e,t){for(var i=e instanceof Hs?e.start:1,r=e instanceof Hs&&e.reversed,n=0;n0&&e.intrinsicHeight>0){var r=Yl(e),n=Pl(t);this.path(n),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,e.intrinsicWidth,e.intrinsicHeight,r.left,r.top,r.width,r.height),this.ctx.restore()}},i.prototype.renderNodeContent=function(e){return r(this,void 0,void 0,(function(){var t,r,o,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x;return n(this,(function(n){switch(n.label){case 0:this.applyEffects(e.getEffects(4)),t=e.container,r=e.curves,o=t.styles,a=0,l=t.textNodes,n.label=1;case 1:return a0&&T>0&&(_=r.ctx.createPattern(A,"repeat"),r.renderRepeat(v,_,C,S))):Fr(i)&&(y=tc(e,t,[null,null,null]),v=y[0],x=y[1],b=y[2],w=y[3],T=y[4],B=0===i.position.length?[Vi]:i.position,C=$i(B[0],w),S=$i(B[B.length-1],T),E=vr(i,C,S,w,T),M=E[0],I=E[1],M>0&&I>0&&(P=r.ctx.createRadialGradient(x+C,b+S,0,x+C,b+S,M),Ar(i.stops,2*M).forEach((function(e){return P.addColorStop(e.stop,rr(e.color))})),r.path(v),r.ctx.fillStyle=P,M!==I?(L=e.bounds.left+.5*e.bounds.width,F=e.bounds.top+.5*e.bounds.height,z=1/(k=I/M),r.ctx.save(),r.ctx.translate(L,F),r.ctx.transform(1,0,0,k,0,0),r.ctx.translate(-L,-F),r.ctx.fillRect(x,z*(b-F)+F,w,T*z),r.ctx.restore()):r.ctx.fill())),n.label=6;case 6:return t--,[2]}}))},r=this,o=0,s=e.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return o0?2!==c.style?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,s,e.curves,2)]:[3,11]:[3,13];case 4:return n.sent(),[3,11];case 5:return 3!==c.style?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,s,e.curves,3)];case 6:return n.sent(),[3,11];case 7:return 4!==c.style?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,s,e.curves)];case 8:return n.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,s,e.curves)];case 10:n.sent(),n.label=11;case 11:s++,n.label=12;case 12:return a++,[3,3];case 13:return[2]}}))}))},i.prototype.renderDashedDottedBorder=function(e,t,i,o,s){return r(this,void 0,void 0,(function(){var r,a,l,c,u,h,d,p,f,A,m,g,_,y,v,x;return n(this,(function(n){return this.ctx.save(),r=ql(o,i),a=Gl(o,i),2===s&&(this.path(a),this.ctx.clip()),Cl(a[0])?(l=a[0].start.x,c=a[0].start.y):(l=a[0].x,c=a[0].y),Cl(a[1])?(u=a[1].end.x,h=a[1].end.y):(u=a[1].x,h=a[1].y),d=0===i||2===i?Math.abs(l-u):Math.abs(c-h),this.ctx.beginPath(),3===s?this.formatPath(r):this.formatPath(a.slice(0,2)),p=t<3?3*t:2*t,f=t<3?2*t:t,3===s&&(p=t,f=t),A=!0,d<=2*p?A=!1:d<=2*p+f?(p*=m=d/(2*p+f),f*=m):(g=Math.floor((d+f)/(p+f)),_=(d-g*p)/(g-1),f=(y=(d-(g+1)*p)/g)<=0||Math.abs(f-_){};return function(e,t){for(const{type:i,value:r,id:n}of e){if(document.getElementById(n))return void("script"===i&&t());const e=document.createElement(i);e.id=n,"script"===i?(e.async=!0,e.defer=!0,e.src=r,e.onload=()=>t()):(e.rel="stylesheet",e.href=r),document.body.appendChild(e)}}(i,(()=>{n=function(e,t){const i=new window.MapboxGeocoder(e);i.addTo(`#${t.id}`),e.value&&i.setInput(e.value);return function(e,t,i,r){const n=[];for(const[o,s]of Object.entries(t)){const t=t=>{const[n,o]=s(e,t,i);r.dispatchEvent(new CustomEvent(n,{detail:o}))};e.on(o,t),n.push([o,t])}return()=>{for(const[t,i]of n)e.off(t,i)}}(i,bd,!1,t)}(t,e)})),{destroy(){n()}}}const bd={results:(e,t)=>["results",t],result:(e,t)=>["result",t],loading:(e,t)=>["loading",t],error:(e,t)=>["error",t],clear:(e,t)=>["clear",t],load:e=>["ready",{geocoder:e}]};function wd(e){let i,r,n;return{c(){i=b("div"),E(i,"id",e[0]),E(i,"class","svelte-1k1b3t4")},m(t,o){y(t,i,o),r||(n=[g(xd.call(null,i,e[1])),S(i,"ready",e[2]),S(i,"results",e[11]),S(i,"result",e[12]),S(i,"loading",e[13]),S(i,"error",e[14]),S(i,"clear",e[15]),S(i,"load",e[16])],r=!0)},p:t,i:t,o:t,d(e){e&&v(i),r=!1,o(n)}}}function Td(e,t,i){let{accessToken:r}=t,{options:n={}}=t,{version:o="v4.5.1"}=t,{types:s=["country","region","postcode","district","place","locality","neighborhood","address"]}=t,{placeholder:a="Search"}=t,{value:l=null}=t,{customStylesheetUrl:c=!1}=t,{geocoder:u}=t;const h=H(),d="bsm-"+Math.random().toString(36).substring(6),p=Object.assign({version:o,accessToken:r,types:s.join(","),placeholder:a,customStylesheetUrl:c,value:l},n);return e.$$set=e=>{"accessToken"in e&&i(4,r=e.accessToken),"options"in e&&i(5,n=e.options),"version"in e&&i(6,o=e.version),"types"in e&&i(7,s=e.types),"placeholder"in e&&i(8,a=e.placeholder),"value"in e&&i(9,l=e.value),"customStylesheetUrl"in e&&i(10,c=e.customStylesheetUrl),"geocoder"in e&&i(3,u=e.geocoder)},[d,p,function({detail:e}){i(3,u=e.geocoder),h("ready")},u,r,n,o,s,a,l,c,function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(t){G.call(this,e,t)}]}class Bd extends me{constructor(e){super(),Ae(this,e,Td,wd,a,{accessToken:4,options:5,version:6,types:7,placeholder:8,value:9,customStylesheetUrl:10,geocoder:3})}}function Cd(e){let t,i,r;return i=new Vu({props:{options:e[1].map(Sd),activeValue:e[0],onSelect:e[2],direction:"down"}}),{c(){t=b("div"),de(i.$$.fragment),E(t,"class","dropdown-container svelte-1yvkhcz")},m(e,n){y(e,t,n),pe(i,t,null),r=!0},p(e,[t]){const r={};2&t&&(r.options=e[1].map(Sd)),1&t&&(r.activeValue=e[0]),4&t&&(r.onSelect=e[2]),i.$set(r)},i(e){r||(le(i.$$.fragment,e),r=!0)},o(e){ce(i.$$.fragment,e),r=!1},d(e){e&&v(t),fe(i)}}}const Sd=e=>({label:e,value:e});function Ed(e,t,i){let r,n;l(e,Le,(e=>i(5,n=e)));let{mode:o}=t,{mapsNum:s}=t;const a=H();let c=o??"",u=Rh;const h=e=>{1===e&&i(1,u=Rh.filter((e=>"swipe"!==e))),2===e&&i(1,u=Rh.filter((e=>"responsive"!==e))),e>2&&e<=4&&i(1,u=Rh.filter((e=>"swipe"!==e&&"responsive"!==e))),e>4&&i(1,u=Rh.filter((e=>"swipe"!==e&&"phone"!==e&&"responsive"!==e))),n||i(1,u=["mirror"]),u.includes(c)||i(0,c=u[0])};return Le.subscribe((()=>{h(s)})),e.$$set=e=>{"mode"in e&&i(3,o=e.mode),"mapsNum"in e&&i(4,s=e.mapsNum)},e.$$.update=()=>{var t;16&e.$$.dirty&&h(s),1&e.$$.dirty&&(e=>{a("viewMode",{mode:e})})(c),8&e.$$.dirty&&(t=o)!==c&&i(0,c=t)},i(2,r=e=>{i(0,c=e)}),[c,u,r,o,s]}class Md extends me{constructor(e){super(),Ae(this,e,Ed,Cd,a,{mode:3,mapsNum:4})}}function Id(e){let t,i,r;return i=new Vu({props:{placeholder:"Go to...",options:e[3],activeValue:e[1],onSelect:e[2],direction:"down"}}),{c(){t=b("div"),de(i.$$.fragment),E(t,"class","dropdown-container svelte-1ho45wf")},m(e,n){y(e,t,n),pe(i,t,null),r=!0},p(e,t){const r={};8&t&&(r.options=e[3]),2&t&&(r.activeValue=e[1]),4&t&&(r.onSelect=e[2]),i.$set(r)},i(e){r||(le(i.$$.fragment,e),r=!0)},o(e){ce(i.$$.fragment,e),r=!1},d(e){e&&v(t),fe(i)}}}function Pd(e){let t,i,r=e[0]&&Id(e);return{c(){r&&r.c(),t=C()},m(e,n){r&&r.m(e,n),y(e,t,n),i=!0},p(e,[i]){e[0]?r?(r.p(e,i),1&i&&le(r,1)):(r=Id(e),r.c(),le(r,1),r.m(t.parentNode,t)):r&&(se(),ce(r,1,1,(()=>{r=null})),ae())},i(e){i||(le(r),i=!0)},o(e){ce(r),i=!1},d(e){r&&r.d(e),e&&v(t)}}}function Ld(e,t,i){let r,n,{bearing:o}=t,{center:s}=t,{pitch:a}=t,{zoom:l}=t;const c=H();let u;Ie.subscribe((e=>i(0,({gazetteer:u}=e),u)));const h=(e,t)=>Number.parseFloat(e).toFixed(t),d=e=>{if(!u)return"";const t=Object.keys(u).reduce(((e,t)=>e=e.concat(u[t])),[]).find((t=>{const i=Object.values(t)[0];return Object.keys(i).every((t=>{if("center"===t&&e.center){const{lng:t,lat:r}=i.center,{lng:n,lat:o}=e.center;return h(t,4)===h(n,4)&&h(r,4)===h(o,4)}return h(i[t],2)===h(e[t],2)}))}));return t?JSON.stringify(t):""};let p=d({zoom:l,center:s,pitch:a,bearing:o});const f=()=>{const{options:e}=(e=>{if(!e)return{};try{const t=JSON.parse(e),i=Object.keys(t)[0],r=t[i];return c("mapState",{options:r}),{label:i,options:r}}catch(e){return console.error(e),{}}})(p);e&&c("mapState",{options:e})};return e.$$set=e=>{"bearing"in e&&i(4,o=e.bearing),"center"in e&&i(5,s=e.center),"pitch"in e&&i(6,a=e.pitch),"zoom"in e&&i(7,l=e.zoom)},e.$$.update=()=>{240&e.$$.dirty&&(e=>{const t=d(e);p!==t&&i(1,p=t??"")})({zoom:l,center:s,pitch:a,bearing:o}),2&e.$$.dirty&&f(),1&e.$$.dirty&&i(3,r=Object.entries(u).reduce(((e,[t,i])=>{e.push({header:t});for(const t of i){let[i,r]=Object.entries(t)[0];e.push({label:i,value:JSON.stringify(t)})}return e}),[]))},i(2,n=e=>{i(1,p=e)}),[u,p,n,r,o,s,a,l]}class Fd extends me{constructor(e){super(),Ae(this,e,Ld,Pd,a,{bearing:4,center:5,pitch:6,zoom:7})}}function kd(e){let t,i;return{c(){t=b("div"),i=T(e[0]),F(t,"top",e[3]+"px"),F(t,"left",e[2]+"px"),E(t,"class","tooltip svelte-1qc780y")},m(e,r){y(e,t,r),_(t,i)},p(e,r){1&r&&I(i,e[0]),8&r&&F(t,"top",e[3]+"px"),4&r&&F(t,"left",e[2]+"px")},d(e){e&&v(t)}}}function zd(e){let t,i,r,n,s,a;const l=e[8].default,u=c(l,e,e[7],null);let f=e[1]&&kd(e);return{c(){t=b("div"),u&&u.c(),i=B(),f&&f.c(),r=C()},m(o,l){y(o,t,l),u&&u.m(t,null),y(o,i,l),f&&f.m(o,l),y(o,r,l),n=!0,s||(a=[S(t,"mouseover",e[4]),S(t,"mouseleave",e[6]),S(t,"mousemove",e[5])],s=!0)},p(e,[t]){u&&u.p&&(!n||128&t)&&d(u,l,e,e[7],n?h(l,e[7],t,null):p(e[7]),null),e[1]?f?f.p(e,t):(f=kd(e),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},i(e){n||(le(u,e),n=!0)},o(e){ce(u,e),n=!1},d(e){e&&v(t),u&&u.d(e),e&&v(i),f&&f.d(e),e&&v(r),s=!1,o(a)}}}function Rd(e,t,i){let r,n,{$$slots:o={},$$scope:s}=t,{title:a=""}=t,l=!1;return e.$$set=e=>{"title"in e&&i(0,a=e.title),"$$scope"in e&&i(7,s=e.$$scope)},[a,l,r,n,function(e){i(1,l=!0),i(2,r=e.pageX+5),i(3,n=e.pageY+5)},function(e){i(2,r=e.pageX+5),i(3,n=e.pageY+5)},function(){i(1,l=!1)},s,o]}class Dd extends me{constructor(e){super(),Ae(this,e,Rd,zd,a,{title:0})}}function Od(e,t,i){const r=e.slice();return r[27]=t[i],r}function Ud(e){let i,r,n,s,a;return r=new hu({props:{icon:Xc}}),{c(){i=b("button"),de(r.$$.fragment),E(i,"class","fullscreen-btn show-ui svelte-1g6kozd"),E(i,"title","Show UI")},m(t,o){y(t,i,o),pe(r,i,null),n=!0,s||(a=[S(i,"click",e[13]),g(xu.call(null,i,{shift:!0,control:!0,code:"KeyF",callback:e[13]}))],s=!0)},p:t,i(e){n||(le(r.$$.fragment,e),n=!0)},o(e){ce(r.$$.fragment,e),n=!1},d(e){e&&v(i),fe(r),s=!1,o(a)}}}function Nd(e){let t,r,n,s,a,l,c,u,h,d,p,f,A,m,x,w,C,M,I,P,L,k,z,R,D,O,U,N,Q,j,V,H,G,$,Z,q,K,W,X,Y,J,ee,te,ie,re,ne,oe,Ae,me,ge;a=new hu({props:{icon:e[8]?Jc:ru}});let _e=e[8]&&Qd(e);d=new Md({props:{mode:e[4],mapsNum:e[5].length}}),d.$on("viewMode",e[21]);let ye=e[3]&&jd(e);const ve=[e[6]];let xe={};for(let e=0;e0&&Gd(e);return{c(){t=b("div"),r=b("div"),n=b("div"),s=b("div"),de(a.$$.fragment),c=B(),_e&&_e.c(),u=B(),h=b("div"),de(d.$$.fragment),p=B(),f=b("div"),ye&&ye.c(),A=B(),m=b("div"),de(x.$$.fragment),w=B(),C=b("div"),M=b("div"),I=b("label"),P=b("span"),P.innerHTML='Label Collisions',L=B(),k=b("input"),z=B(),R=b("label"),D=b("span"),D.innerHTML='Tile Boundaries',O=B(),U=b("input"),N=B(),be&&be.c(),Q=B(),j=b("div"),V=b("div"),H=b("button"),de(G.$$.fragment),$=T(" Add map"),K=B(),W=b("button"),de(X.$$.fragment),Y=T("\n Copy image"),te=B(),ie=b("div"),re=b("button"),de(ne.$$.fragment),oe=B(),we&&we.c(),E(s,"class","link-button svelte-1g6kozd"),F(s,"margin-right","6px"),E(s,"title",l=e[8]?"Unlink locations":"Link locations"),E(n,"class","control-section svelte-1g6kozd"),E(h,"class","control-section svelte-1g6kozd"),E(f,"class","control-section svelte-1g6kozd"),E(m,"class","control-section svelte-1g6kozd"),E(P,"class","checkbox-label svelte-1g6kozd"),E(k,"type","checkbox"),E(I,"class","checkbox-container svelte-1g6kozd"),E(D,"class","checkbox-label svelte-1g6kozd"),E(U,"type","checkbox"),E(R,"class","checkbox-container svelte-1g6kozd"),E(M,"class","checkboxes svelte-1g6kozd"),E(C,"class","control-section svelte-1g6kozd"),F(H,"margin-right","6px"),H.disabled=Z=e[5].length>=8,E(H,"title",q=e[5].length>=8?"Maximum of 8 maps allowed.":""),W.disabled=J="swipe"===e[4],E(W,"title",ee="swipe"===e[4]?"Must be in phone or mirror mode to screenshot.":"Copy image to clipboard"),E(V,"class","buttons svelte-1g6kozd"),E(j,"class","control-section svelte-1g6kozd"),E(re,"class","fullscreen-btn svelte-1g6kozd"),E(re,"title","Hide UI"),E(ie,"class","control-section svelte-1g6kozd"),E(r,"class","control-row svelte-1g6kozd"),E(t,"class","map-controls svelte-1g6kozd")},m(i,o){y(i,t,o),_(t,r),_(r,n),_(n,s),pe(a,s,null),_(n,c),_e&&_e.m(n,null),_(r,u),_(r,h),pe(d,h,null),_(r,p),_(r,f),ye&&ye.m(f,null),_(r,A),_(r,m),pe(x,m,null),_(r,w),_(r,C),_(C,M),_(M,I),_(I,P),_(I,L),_(I,k),k.checked=e[0],_(M,z),_(M,R),_(R,D),_(R,O),_(R,U),U.checked=e[1],_(M,N),be&&be.m(M,null),_(r,Q),_(r,j),_(j,V),_(V,H),pe(G,H,null),_(H,$),_(V,K),_(V,W),pe(X,W,null),_(W,Y),_(r,te),_(r,ie),_(ie,re),pe(ne,re,null),_(t,oe),we&&we.m(t,null),Ae=!0,me||(ge=[S(s,"click",e[14]),S(k,"change",e[23]),S(U,"change",e[24]),S(H,"click",e[11]),S(W,"click",e[12]),S(re,"click",e[13]),g(xu.call(null,re,{shift:!0,control:!0,code:"KeyF",callback:e[13]}))],me=!0)},p(e,i){const r={};256&i&&(r.icon=e[8]?Jc:ru),a.$set(r),(!Ae||256&i&&l!==(l=e[8]?"Unlink locations":"Link locations"))&&E(s,"title",l),e[8]?_e?(_e.p(e,i),256&i&&le(_e,1)):(_e=Qd(e),_e.c(),le(_e,1),_e.m(n,null)):_e&&(se(),ce(_e,1,1,(()=>{_e=null})),ae());const o={};16&i&&(o.mode=e[4]),32&i&&(o.mapsNum=e[5].length),d.$set(o),e[3]?ye?(ye.p(e,i),8&i&&le(ye,1)):(ye=jd(e),ye.c(),le(ye,1),ye.m(f,null)):ye&&(se(),ce(ye,1,1,(()=>{ye=null})),ae());const c=64&i?ue(ve,[he(e[6])]):{};x.$set(c),1&i&&(k.checked=e[0]),2&i&&(U.checked=e[1]),"swipe"===e[4]?be?(be.p(e,i),16&i&&le(be,1)):(be=Vd(e),be.c(),le(be,1),be.m(M,null)):be&&(se(),ce(be,1,1,(()=>{be=null})),ae()),(!Ae||32&i&&Z!==(Z=e[5].length>=8))&&(H.disabled=Z),(!Ae||32&i&&q!==(q=e[5].length>=8?"Maximum of 8 maps allowed.":""))&&E(H,"title",q),(!Ae||16&i&&J!==(J="swipe"===e[4]))&&(W.disabled=J),(!Ae||16&i&&ee!==(ee="swipe"===e[4]?"Must be in phone or mirror mode to screenshot.":"Copy image to clipboard"))&&E(W,"title",ee),e[7].length>0?we?we.p(e,i):(we=Gd(e),we.c(),we.m(t,null)):we&&(we.d(1),we=null)},i(e){Ae||(le(a.$$.fragment,e),le(_e),le(d.$$.fragment,e),le(ye),le(x.$$.fragment,e),le(be),le(G.$$.fragment,e),le(X.$$.fragment,e),le(ne.$$.fragment,e),Ae=!0)},o(e){ce(a.$$.fragment,e),ce(_e),ce(d.$$.fragment,e),ce(ye),ce(x.$$.fragment,e),ce(be),ce(G.$$.fragment,e),ce(X.$$.fragment,e),ce(ne.$$.fragment,e),Ae=!1},d(e){e&&v(t),fe(a),_e&&_e.d(),fe(d),ye&&ye.d(),fe(x),be&&be.d(),fe(G),fe(X),fe(ne),we&&we.d(),me=!1,o(ge)}}}function Qd(e){let t,r;const n=[e[6]];let o={};for(let e=0;eDifferences',r=B(),n=b("input"),E(i,"class","checkbox-label svelte-1g6kozd"),E(n,"type","checkbox"),E(t,"class","checkbox-container svelte-1g6kozd")},m(a,l){y(a,t,l),_(t,i),_(t,r),_(t,n),n.checked=e[2],o||(s=S(n,"change",e[25]),o=!0)},p(e,t){4&t&&(n.checked=e[2])},d(e){e&&v(t),o=!1,s()}}}function Gd(e){let t,i=e[7],r=[];for(let t=0;t{l[o]=null})),ae(),i=l[t],i?i.p(e,n):(i=l[t]=a[t](e),i.c()),le(i,1),i.m(r.parentNode,r))},i(e){n||(le(i),n=!0)},o(e){ce(i),n=!1},d(e){l[t].d(e),e&&v(r),o=!1,s()}}}function qd(e,t,i){let r,n;l(e,Le,(e=>i(8,r=e))),l(e,Pe,(e=>i(9,n=e)));let{bearing:o}=t,{center:s}=t,{mapboxGlAccessToken:a}=t,{pitch:c}=t,{showCollisions:u}=t,{showBoundaries:h}=t,{showDiff:d}=t,{viewMode:p}=t,{zoom:f}=t;const A=H();let m,g=[],_=[];Ee.subscribe((e=>i(5,g=e)));return e.$$set=e=>{"bearing"in e&&i(16,o=e.bearing),"center"in e&&i(17,s=e.center),"mapboxGlAccessToken"in e&&i(3,a=e.mapboxGlAccessToken),"pitch"in e&&i(18,c=e.pitch),"showCollisions"in e&&i(0,u=e.showCollisions),"showBoundaries"in e&&i(1,h=e.showBoundaries),"showDiff"in e&&i(2,d=e.showDiff),"viewMode"in e&&i(4,p=e.viewMode),"zoom"in e&&i(19,f=e.zoom)},e.$$.update=()=>{983040&e.$$.dirty&&i(6,m={bearing:o,center:s,pitch:c,zoom:f}),96&e.$$.dirty&&i(7,_=((e,t)=>{const i=[],r=Dh(e,t);return e.pitch>=r&&i.push({type:"warning",message:`Pitch capped at ${r} as that is the maximum for this zoom level.`}),i})(m,g)),20&e.$$.dirty&&"swipe"!==p&&d&&i(2,d=!1),7&e.$$.dirty&&A("mapState",{options:{showCollisions:u,showBoundaries:h,showDiff:d}})},[u,h,d,a,p,g,m,_,r,n,({detail:e})=>{const{result:t}=e,i={center:{lat:t.center[1],lng:t.center[0]},zoom:17};t.bbox&&(i.zoom=14),A("mapState",{options:i})},()=>{Ee.update((e=>{let t=e[e.length-1];t={...t,index:t.index+1};return e.concat([t])})),r||Fe.update((e=>[...e,{...e[e.length-1]}]))},async()=>{const e=document.getElementsByClassName("maps")[0];let t=[...document.getElementsByClassName("screenshot-label-transparent")];t.forEach((e=>{e.classList.remove("screenshot-label-transparent"),e.classList.add("screenshot-label")}));let i=[];"mirror"===p&&(i=[...document.getElementsByClassName("map-container-border")],i.forEach((e=>{e.classList.remove("map-container-border"),e.classList.add("map-container-border-transparent")})));vd(e,{ignoreElements:e=>!(!e.className||"string"!=typeof e.className)&&e.className.includes("map-label")}).then((e=>{e.toBlob((e=>navigator.clipboard.write([new ClipboardItem({"image/png":e})])))})),t.forEach((e=>{e.classList.remove("screenshot-label"),e.classList.add("screenshot-label-transparent")})),"mirror"===p&&i.forEach((e=>{e.classList.remove("map-container-border-transparent"),e.classList.add("map-container-border")}))},()=>{Pe.update((e=>!e))},()=>{Le.update((e=>!e))},function(e){"input"!==e.target.tagName.toLowerCase()&&("c"!==e.key&&"C"!==e.key||i(0,u=!u),"t"!==e.key&&"T"!==e.key||i(1,h=!h),"d"!==e.key&&"D"!==e.key||i(2,d=!d))},o,s,c,f,function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(t){G.call(this,e,t)},function(){u=this.checked,i(0,u)},function(){h=this.checked,i(1,h)},function(){d=this.checked,i(2,d),i(4,p)}]}class Kd extends me{constructor(e){super(),Ae(this,e,qd,Zd,a,{bearing:16,center:17,mapboxGlAccessToken:3,pitch:18,showCollisions:0,showBoundaries:1,showDiff:2,viewMode:4,zoom:19})}}let Wd;Le.subscribe((e=>Wd=e));const Xd=["locations"],Yd=["showCollisions","showBoundaries","showDiff"],Jd=["bearing","center","pitch","zoom"],ep=["bearing","lat","lng","pitch","zoom"],tp=["map","stylePresets"];const ip=(e,t)=>[...t.filter((e=>"sublist"!==e.type)),...t.filter((e=>"sublist"===e.type)).flatMap((e=>e.presets))].find((t=>t.id===e)),rp=(e,t)=>{const i=t.find((t=>t.id===e.branchId));return i?{...i,url:Au(i.pattern,e.branch,e.branchStyle)}:null},np=(e,t)=>JSON.parse(e).map((e=>{let i=ip(e.id,t?.stylePresets??[]);return i||(i=rp(e,t?.branchPatterns??[])),i?{...i,...e}:e})).filter((e=>e)),op=({zoom:e,center:t,pitch:i,bearing:r})=>[Re(e,2),Re(t.lat,4),Re(t.lng,4),Re(i??0,1),Re(r??0,1)].join("/"),sp=e=>{const[t,i,r,n,o]=e.split("/");return{bearing:o,center:{lat:i,lng:r},pitch:n,zoom:t}};const ap=(e,t)=>{let i=Object.fromEntries(Object.entries(e).filter((([e,t])=>!Jd.includes(e)&&"locations"!==e)).map((([e,i])=>{let r=i;return"maps"===e?r=((e,t)=>{const i=e.map((e=>{let i,r={id:e.id};return e.branchId?(i=rp(e,t?.branchPatterns??[]),r={branchId:i.id,branchStyle:e.branchStyle,branch:e.branch}):i=ip(e.id,t.stylePresets),i?(e.renderer!==i.renderer&&(r.renderer=e.renderer),r):Object.fromEntries(Object.entries(e).filter((([e])=>"style"!==e)))}));return JSON.stringify(i)})(i,t):Xd.includes(e)&&(r=JSON.stringify(i)),[e,r]})));i=(e=>{let t=Object.keys(e).reduce(((t,i)=>{const r=e[i];return Yd.includes(i)&&!r||null!==r&&(t[i]=r),t}),{});return t})(i);const r=lp(window.location.hash,t),n=Object.entries(i).some((e=>{let[t,i]=e;if(tp.includes(t))return!1;try{i=JSON.parse(i)}catch(e){}return!Nh(i,r?.[t])}));let o={...i};o=Wd?{map:op(e),...o}:{locations:JSON.stringify(e.locations.map((e=>op(e)))),...o};const s=function(e){let t=e.map?`map=${e.map}`:"";return Object.entries(e).forEach((([e,i],r)=>{if(tp.includes(e))return;let n=encodeURIComponent(i);t=`${t}${""!==t?"&":""}${e}=${n}`})),t}(o);return{nextHash:s,requiresHistoryItem:n}};function lp(e,t){let i=Object.fromEntries(Object.entries(function(e){const t=e.split("#")[1];if(!t)return{};let i=Object.fromEntries(t.split("&").map((e=>e.split("=").map(decodeURIComponent))));return i.map&&(i={...i,...sp(i.map)}),i.locations&&(i.locations=JSON.stringify(JSON.parse(i.locations).map((e=>sp(e))))),i}(e)).filter((([e,t])=>!!t)).map((([e,i])=>"maps"===e?[e,np(i,t)]:Xd.includes(e)?[e,JSON.parse(i)]:Yd.includes(e)?[e,"true"===i]:ep.includes(e)?[e,+i||0]:[e,i])));return i.map&&delete i.map,i}const cp=e=>{const{mapState:t,maps:i,viewMode:r,stylePresets:n}=e;return{...t,viewMode:r,maps:i,stylePresets:n,...lp(window.location.hash,e)}};var up={};Object.defineProperty(up,"__esModule",{value:!0}),up.updateStyle=yp=up.addLink=void 0;var hp={};Object.defineProperty(hp,"__esModule",{value:!0}),hp.stamenSvg=void 0;function dp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var r,n,o=[],s=!0,a=!1;try{for(i=i.call(e);!(s=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,n=e}finally{try{s||null==i.return||i.return()}finally{if(a)throw n}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return pp(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return pp(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pp(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i\n\n\n\n\n\n';var fp=function(e,t){Object.entries(t).forEach((function(t){var i=dp(t,2),r=i[0],n=i[1];e.style[r]=n}))},Ap=document.createElement("img");Ap.src="data:image/svg+xml;charset=utf-8,".concat(hp.stamenSvg);var mp=document.createElement("a");mp.href="https://stamen.com";var gp=document.createElement("div");fp(Ap,{height:"24px",position:"absolute",bottom:"-1px"});fp(mp,{width:"110px",position:"relative"});fp(gp,{position:"fixed",bottom:"0px",right:"12px",zIndex:1e4,display:"flex",flexDirection:"row-reverse"}),mp.appendChild(Ap),gp.appendChild(mp),document.body.appendChild(gp);up.updateStyle=function(e){for(var t=0,i=Object.entries(e);ti(9,r=e))),yp("https://stamen.com/blog/","Learn more"),yp("https://github.com/stamen/maperture","Fork on Github");let{localConfig:n}=t;const o=(e=>({maps:[{id:"mapbox-streets",name:"Mapbox Streets",type:"mapbox-gl",url:"mapbox://styles/mapbox/streets-v11"},{id:"mapbox-light",name:"Mapbox Light",type:"mapbox-gl",url:"mapbox://styles/mapbox/light-v10"}].map(((t,i)=>e?.stylePresets?.[i]??t)),mapState:{bearing:0,center:{lng:-73.92169,lat:40.83962},pitch:0,showCollisions:!1,showBoundaries:!1,showDiff:!1,zoom:13.25},viewMode:"swipe",gazetteer:{Scenarios:[{"Zoomed out":{pitch:0,zoom:10}},{"Zoomed in/Tilted":{pitch:45,zoom:16}}],Locations:[{"San Francisco, CA":{zoom:18,center:{lng:-122.4193,lat:37.7648}}},{"Washington DC":{zoom:12,center:{lng:-77.0435,lat:38.9098}}}]},branchPatterns:[{pattern:"",styles:[]}],stylePresetUrls:[],...e}))(n),{mapboxGlAccessToken:s,stylePresetUrls:a}=o;Ie.set(o);let c=cp(o),u={},h=!1;const d=()=>location.hash.slice(1)!==ap(c,o)?.nextHash;Ee.set(c.maps.map(((e,t)=>({...e,index:t})))),Me.set(c.stylePresets),Fe.set(c?.locations??null),r&&r.length&&Le.set(!1);let p=[];j((()=>{a.length>0&&a.forEach((async e=>{const t=await(async e=>{const t=await fetch(e),i=await t.json();return ze(i)?i:(console.warn(`Style presets at ${e} is not valid, check the format`),[])})(e);Me.update((e=>[...e,...t]))}))})),window.addEventListener("hashchange",(()=>{if(!h&&d()){const e=cp(o);if(i(0,c=e),c.maps.length){const e=c.maps.map(((e,t)=>({...e,index:t})));Ee.set(e)}}h=!1})),Ee.subscribe((e=>{const t=JSON.parse(JSON.stringify(e)).map((e=>(delete e.isPolling,e)));i(0,c={...c,maps:t})})),Fe.subscribe((e=>{i(0,c={...c,locations:e})})),Le.subscribe((e=>{if(!e&&!r){const e=p.map((()=>u));Fe.set(e)}e&&r&&Fe.set(null)}));const f=et((()=>{d()&&(h=!0,function(e,t){const{nextHash:i,requiresHistoryItem:r}=ap(e,t);r?window.location.hash=i:window.location.replace(`${window.location.pathname}#${i}`)}(c,o))}),250);return"unavailable"===xe.getRTLTextPluginStatus()&&xe.setRTLTextPlugin("https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js"),"unavailable"===Te.getRTLTextPluginStatus()&&Te.setRTLTextPlugin("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js"),e.$$set=e=>{"localConfig"in e&&i(7,n=e.localConfig)},e.$$.update=()=>{5&e.$$.dirty&&(Nh(p,c.maps)||i(2,p=c.maps)),6&e.$$.dirty&&i(1,u=Oh(u,p)),1&e.$$.dirty&&c&&f(),1&e.$$.dirty&&(c||height||width)&&i(1,u=(()=>{const{bearing:e,center:t,pitch:i,showCollisions:r,showBoundaries:n,showDiff:o,zoom:s,height:a,width:l}=c;return{bearing:e,center:t,pitch:i,showCollisions:r,showBoundaries:n,showDiff:o,zoom:s,...a&&{height:a},...l&&{width:l}}})())},[c,u,p,s,e=>{let t={...u,...e.detail.options};i(0,c={...c,...Oh(t,p)})},e=>{i(0,c={...c,viewMode:e.detail.mode})},e=>{i(0,c={...c,...e.detail})},n]}class bp extends me{constructor(e){super(),Ae(this,e,xp,vp,a,{localConfig:7})}}const wp=(e,t)=>new bp({target:e,props:t});var Tp=Object.freeze({__proto__:null,default:undefined}),Bp=Object.freeze({__proto__:null,default:undefined});class Cp extends Map{#e=0;#t=new Map;#i=new Map;#r;#n;#o;constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.#r=e.maxSize,this.#n=e.maxAge||Number.POSITIVE_INFINITY,this.#o=e.onEviction}get __oldCache(){return this.#i}#s(e){if("function"==typeof this.#o)for(const[t,i]of e)this.#o(t,i.value)}#a(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.#o&&this.#o(e,t.value),this.delete(e))}#l(e,t){if(!1===this.#a(e,t))return t.value}#c(e,t){return t.expiry?this.#l(e,t):t.value}#u(e,t){const i=t.get(e);return this.#c(e,i)}#h(e,t){this.#t.set(e,t),this.#e++,this.#e>=this.#r&&(this.#e=0,this.#s(this.#i),this.#i=this.#t,this.#t=new Map)}#d(e,t){this.#i.delete(e),this.#h(e,t)}*#p(){for(const e of this.#i){const[t,i]=e;if(!this.#t.has(t)){!1===this.#a(t,i)&&(yield e)}}for(const e of this.#t){const[t,i]=e;!1===this.#a(t,i)&&(yield e)}}get(e){if(this.#t.has(e)){const t=this.#t.get(e);return this.#c(e,t)}if(this.#i.has(e)){const t=this.#i.get(e);if(!1===this.#a(e,t))return this.#d(e,t),t.value}}set(e,t,{maxAge:i=this.#n}={}){const r="number"==typeof i&&i!==Number.POSITIVE_INFINITY?Date.now()+i:void 0;return this.#t.has(e)?this.#t.set(e,{value:t,expiry:r}):this.#h(e,{value:t,expiry:r}),this}has(e){return this.#t.has(e)?!this.#a(e,this.#t.get(e)):!!this.#i.has(e)&&!this.#a(e,this.#i.get(e))}peek(e){return this.#t.has(e)?this.#u(e,this.#t):this.#i.has(e)?this.#u(e,this.#i):void 0}delete(e){const t=this.#t.delete(e);return t&&this.#e--,this.#i.delete(e)||t}clear(){this.#t.clear(),this.#i.clear(),this.#e=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this.#p()],i=t.length-e;i<0?(this.#t=new Map(t),this.#i=new Map,this.#e=t.length):(i>0&&this.#s(t.slice(0,i)),this.#i=new Map(t.slice(i)),this.#t=new Map,this.#e=0),this.#r=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.#t){const[t,i]=e;!1===this.#a(t,i)&&(yield[t,i.value])}for(const e of this.#i){const[t,i]=e;if(!this.#t.has(t)){!1===this.#a(t,i)&&(yield[t,i.value])}}}*entriesDescending(){let e=[...this.#t];for(let t=e.length-1;t>=0;--t){const i=e[t],[r,n]=i;!1===this.#a(r,n)&&(yield[r,n.value])}e=[...this.#i];for(let t=e.length-1;t>=0;--t){const i=e[t],[r,n]=i;if(!this.#t.has(r)){!1===this.#a(r,n)&&(yield[r,n.value])}}}*entriesAscending(){for(const[e,t]of this.#p())yield[e,t.value]}get size(){if(!this.#e)return this.#i.size;let e=0;for(const t of this.#i.keys())this.#t.has(t)||e++;return Math.min(this.#e+e,this.#r)}get maxSize(){return this.#r}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[i,r]of this.entriesAscending())e.call(t,r,i,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}const Sp=new class{constructor(){this._apiKey="",this._fetch="undefined"!=typeof self?fetch.bind(self):"undefined"!=typeof global&&global.fetch?global.fetch:null,this.tileCacheSize=200}set apiKey(e){this._apiKey=e}get apiKey(){return this._apiKey}set fetch(e){this._fetch=e}get fetch(){return this._fetch}},Ep={AUTO:{code:null,flag:"auto",name:"Auto",latin:!1,isMode:!0,geocoding:!0},LATIN:{code:"latin",flag:"name:latin",name:"Latin",latin:!0,isMode:!1,geocoding:!1},NON_LATIN:{code:"nonlatin",flag:"name:nonlatin",name:"Non Latin",latin:!1,isMode:!1,geocoding:!1},LOCAL:{code:null,flag:"name",name:"Local",latin:!0,isMode:!1,geocoding:!1},ALBANIAN:{code:"sq",flag:"name:sq",name:"Albanian",latin:!0,isMode:!1,geocoding:!0},AMHARIC:{code:"am",flag:"name:am",name:"Amharic",latin:!1,isMode:!1,geocoding:!0},ARABIC:{code:"ar",flag:"name:ar",name:"Arabic",latin:!1,isMode:!1,geocoding:!0},ARMENIAN:{code:"hy",flag:"name:hy",name:"Armenian",latin:!1,isMode:!1,geocoding:!0},AZERBAIJANI:{code:"az",flag:"name:az",name:"Azerbaijani",latin:!0,isMode:!1,geocoding:!0},BASQUE:{code:"eu",flag:"name:eu",name:"Basque",latin:!0,isMode:!1,geocoding:!0},BELARUSIAN:{code:"be",flag:"name:be",name:"Belarusian",latin:!1,isMode:!1,geocoding:!0},BENGALI:{code:"bn",flag:"name:bn",name:"Bengali",latin:!0,isMode:!1,geocoding:!0},BOSNIAN:{code:"bs",flag:"name:bs",name:"Bosnian",latin:!0,isMode:!1,geocoding:!0},BRETON:{code:"br",flag:"name:br",name:"Breton",latin:!0,isMode:!1,geocoding:!0},BULGARIAN:{code:"bg",flag:"bg",name:"Bulgarian",latin:!1,isMode:!1,geocoding:!0},CATALAN:{code:"ca",flag:"name:ca",name:"Catalan",latin:!0,isMode:!1,geocoding:!0},CHINESE:{code:"zh",flag:"name:zh",name:"Chinese",latin:!1,isMode:!1,geocoding:!0},TRADITIONAL_CHINESE:{code:"zh-Hant",flag:"name:zh-Hant",name:"Chinese (traditional)",latin:!1,isMode:!1,geocoding:!1},SIMPLIFIED_CHINESE:{code:"zh-Hans",flag:"name:zh-Hans",name:"Chinese (simplified)",latin:!1,isMode:!1,geocoding:!1},CORSICAN:{code:"co",flag:"name:co",name:"Corsican",latin:!0,isMode:!1,geocoding:!0},CROATIAN:{code:"hr",flag:"name:hr",name:"Croatian",latin:!0,isMode:!1,geocoding:!0},CZECH:{code:"cs",flag:"name:cs",name:"Czech",latin:!0,isMode:!1,geocoding:!0},DANISH:{code:"da",flag:"name:da",name:"Danish",latin:!0,isMode:!1,geocoding:!0},DUTCH:{code:"nl",flag:"name:nl",name:"Dutch",latin:!0,isMode:!1,geocoding:!0},GERMAN:{code:"de",flag:"name:de",name:"German",latin:!0,isMode:!1,geocoding:!0},GREEK:{code:"el",flag:"name:el",name:"Greek",latin:!1,isMode:!1,geocoding:!0},ENGLISH:{code:"en",flag:"name:en",name:"English",latin:!0,isMode:!1,geocoding:!0},ESPERANTO:{code:"eo",flag:"name:eo",name:"Esperanto",latin:!0,isMode:!1,geocoding:!0},ESTONIAN:{code:"et",flag:"name:et",name:"Estonian",latin:!0,isMode:!1,geocoding:!0},FINNISH:{code:"fi",flag:"name:fi",name:"Finnish",latin:!0,isMode:!1,geocoding:!0},FRENCH:{code:"fr",flag:"name:fr",name:"French",latin:!0,isMode:!1,geocoding:!0},FRISIAN:{code:"fy",flag:"name:fy",name:"Frisian (West)",latin:!0,isMode:!1,geocoding:!0},GEORGIAN:{code:"ka",flag:"name:ka",name:"Georgian",latin:!1,isMode:!1,geocoding:!0},HEBREW:{code:"he",flag:"name:he",name:"Hebrew",latin:!1,isMode:!1,geocoding:!0},HINDI:{code:"hi",flag:"name:hi",name:"Hindi",latin:!1,isMode:!1,geocoding:!0},HUNGARIAN:{code:"hu",flag:"name:hu",name:"Hungarian",latin:!0,isMode:!1,geocoding:!0},ICELANDIC:{code:"is",flag:"name:is",name:"Icelandic",latin:!0,isMode:!1,geocoding:!0},INDONESIAN:{code:"id",flag:"name:id",name:"Indonesian",latin:!0,isMode:!1,geocoding:!0},IRISH:{code:"ga",flag:"name:ga",name:"Irish",latin:!0,isMode:!1,geocoding:!0},ITALIAN:{code:"it",flag:"name:it",name:"Italian",latin:!0,isMode:!1,geocoding:!0},JAPANESE:{code:"ja",flag:"name:ja",name:"Japanese",latin:!1,isMode:!1,geocoding:!0},JAPANESE_HIRAGANA:{code:"ja-Hira",flag:"name:ja-Hira",name:"Japanese Hiragana form",latin:!1,isMode:!1,geocoding:!1},JAPANESE_2018:{code:"ja-Latn",flag:"name:ja-Latn",name:"Japanese (Latin 2018)",latin:!0,isMode:!1,geocoding:!1},JAPANESE_KANA:{code:"ja_kana",flag:"name:ja_kana",name:"Japanese (Kana)",latin:!1,isMode:!1,geocoding:!1},JAPANESE_LATIN:{code:"ja_rm",flag:"name:ja_rm",name:"Japanese (Latin script)",latin:!0,isMode:!1,geocoding:!1},KANNADA:{code:"kn",flag:"name:kn",name:"Kannada",latin:!0,isMode:!1,geocoding:!0},KAZAKH:{code:"kk",flag:"name:kk",name:"Kazakh",latin:!1,isMode:!1,geocoding:!0},KOREAN:{code:"ko",flag:"name:ko",name:"Korean",latin:!1,isMode:!1,geocoding:!0},KOREAN_LATIN:{code:"ko-Latn",flag:"name:ko-Latn",name:"Korean (Latin script)",latin:!0,isMode:!1,geocoding:!1},KURDISH:{code:"ku",flag:"name:ku",name:"Kurdish",latin:!0,isMode:!1,geocoding:!0},CLASSICAL_LATIN:{code:"la",flag:"name:la",name:"Latin",latin:!0,isMode:!1,geocoding:!0},LATVIAN:{code:"lv",flag:"name:lv",name:"Latvian",latin:!0,isMode:!1,geocoding:!0},LITHUANIAN:{code:"lt",flag:"name:lt",name:"Lithuanian",latin:!0,isMode:!1,geocoding:!0},LUXEMBOURGISH:{code:"lb",flag:"name:lb",name:"Luxembourgish",latin:!0,isMode:!1,geocoding:!0},MACEDONIAN:{code:"mk",flag:"name:mk",name:"Macedonian",latin:!1,isMode:!1,geocoding:!0},MALAYALAM:{code:"ml",flag:"name:ml",name:"Malayalam",latin:!1,isMode:!1,geocoding:!0},MALTESE:{code:"mt",flag:"name:mt",name:"Maltese",latin:!0,isMode:!1,geocoding:!0},NORWEGIAN:{code:"no",flag:"name:no",name:"Norwegian",latin:!0,isMode:!1,geocoding:!0},OCCITAN:{code:"oc",flag:"name:oc",name:"Occitan",latin:!0,isMode:!1,geocoding:!0},PERSIAN:{code:"fa",flag:"name:fa",name:"Persian",latin:!1,isMode:!1,geocoding:!0},POLISH:{code:"pl",flag:"name:pl",name:"Polish",latin:!0,isMode:!1,geocoding:!0},PORTUGUESE:{code:"pt",flag:"name:pt",name:"Portuguese",latin:!0,isMode:!1,geocoding:!0},PUNJABI:{code:"pa",flag:"name:pa",name:"Punjabi",latin:!1,isMode:!1,geocoding:!0},WESTERN_PUNJABI:{code:"pnb",flag:"name:pnb",name:"Western Punjabi",latin:!1,isMode:!1,geocoding:!1},ROMANIAN:{code:"ro",flag:"name:ro",name:"Romanian",latin:!0,isMode:!1,geocoding:!0},ROMANSH:{code:"rm",flag:"name:rm",name:"Romansh",latin:!0,isMode:!1,geocoding:!0},RUSSIAN:{code:"ru",flag:"name:ru",name:"Russian",latin:!1,isMode:!1,geocoding:!0},SERBIAN_CYRILLIC:{code:"sr",flag:"name:sr",name:"Serbian (Cyrillic script)",latin:!1,isMode:!1,geocoding:!0},SERBIAN_LATIN:{code:"sr-Latn",flag:"name:sr-Latn",name:"Serbian (Latin script)",latin:!0,isMode:!1,geocoding:!1},SCOTTISH_GAELIC:{code:"gd",flag:"name:gd",name:"Scottish Gaelic",latin:!0,isMode:!1,geocoding:!0},SLOVAK:{code:"sk",flag:"name:sk",name:"Slovak",latin:!0,isMode:!1,geocoding:!0},SLOVENE:{code:"sl",flag:"name:sl",name:"Slovene",latin:!0,isMode:!1,geocoding:!0},SPANISH:{code:"es",flag:"name:es",name:"Spanish",latin:!0,isMode:!1,geocoding:!0},SWEDISH:{code:"sv",flag:"name:sv",name:"Swedish",latin:!0,isMode:!1,geocoding:!0},TAMIL:{code:"ta",flag:"name:ta",name:"Tamil",latin:!1,isMode:!1,geocoding:!0},TELUGU:{code:"te",flag:"name:te",name:"Telugu",latin:!1,isMode:!1,geocoding:!0},THAI:{code:"th",flag:"name:th",name:"Thai",latin:!1,isMode:!1,geocoding:!0},TURKISH:{code:"tr",flag:"name:tr",name:"Turkish",latin:!0,isMode:!1,geocoding:!0},UKRAINIAN:{code:"uk",flag:"name:uk",name:"Ukrainian",latin:!1,isMode:!1,geocoding:!0},VIETNAMESE:{code:"vi",flag:"name:vi",name:"Vietnamese (Latin script)",latin:!0,isMode:!1,geocoding:!0},WELSH:{code:"cy",flag:"name:cy",name:"Welsh",latin:!0,isMode:!1,geocoding:!0}};function Mp(e,t=Ep){return e in t?e[e]:null}function Ip(e,t=Ep){for(const i of Object.values(t))if(i.code===e)return i;return null}function Pp(e,t=Ep){for(const i of Object.values(t))if(i.flag===e)return i;return null}function Lp(){if("undefined"==typeof navigator){return Ip(Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0])??Ep.ENGLISH}const e=Array.from(new Set(navigator.languages.map((e=>e.split("-")[0])))).map((e=>Ip(e))).filter((e=>e));return e[0]??Ep.ENGLISH}function Fp(e){return null!==e&&"object"==typeof e&&"code"in e&&"flag"in e&&"name"in e&&"latin"in e&&"isMode"in e&&"geocoding"in e&&("string"==typeof e.code||null===e.code)&&"string"==typeof e.flag&&"string"==typeof e.name&&"boolean"==typeof e.latin&&"boolean"==typeof e.isMode&&"boolean"==typeof e.geocoding}function kp(e,t=Ep){return Fp(e)?Pp(e.flag,t):"string"!=typeof e?null:Mp(e,t)||Ip(e,t)||Pp(e,t)||null}async function zp(e,t={}){if(null===Sp.fetch)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(""===new URL(e).searchParams.get("key").trim())throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Sp.fetch(e,t)}const Rp={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(Rp);class Dp extends Error{constructor(e,t=""){super(`Call to enpoint ${e.url} failed with the status code ${e.status}. ${t}`),this.res=e}}const Op={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function Up(e,t){const{language:i}=t;if(void 0===i)return;const r=(Array.isArray(i)?i:[i]).map((e=>function(e){const t=e===Ep.AUTO.flag?Lp():"string"==typeof e?Ip(e):Fp(e)?e.flag===Ep.AUTO.flag?Lp():Pp(e.flag):null;return t?.geocoding?t.code:null}(e))).filter((e=>e)),n=Array.from(new Set(r)).join(",");e.set("language",n)}function Np(e,t){const{apiKey:i,limit:r,types:n,excludeTypes:o}=t;e.set("key",i??Sp.apiKey),void 0!==r&&e.set("limit",String(r)),void 0!==n&&e.set("types",n.join(",")),void 0!==o&&e.set("excludeTypes",String(o)),Up(e,t)}function Qp(e,t){Np(e,t);const{bbox:i,proximity:r,country:n,fuzzyMatch:o,autocomplete:s}=t;void 0!==i&&e.set("bbox",i.join(",")),void 0!==r&&e.set("proximity","ip"===r?r:r.join(",")),void 0!==n&&e.set("country",n.join(",")),void 0!==o&&e.set("fuzzyMatch",o?"true":"false"),void 0!==s&&e.set("autocomplete",s?"true":"false")}const jp={forward:async function(e,t={}){if("string"!=typeof e||0===e.trim().length)throw new Error("The query must be a non-empty string");const i=new URL(`geocoding/${encodeURIComponent(e)}.json`,Rp.maptilerApiURL);Qp(i.searchParams,t);const r=await zp(i.toString());if(!r.ok)throw new Dp(r,Op[r.status]??"");return await r.json()},reverse:async function(e,t={}){if(!Array.isArray(e)||e.length<2)throw new Error("The position must be an array of form [lng, lat].");const i=new URL(`geocoding/${e[0]},${e[1]}.json`,Rp.maptilerApiURL);Np(i.searchParams,t);const r=await zp(i.toString());if(!r.ok)throw new Dp(r,Op[r.status]??"");return await r.json()},byId:async function(e,t={}){const i=new URL(`geocoding/${e}.json`,Rp.maptilerApiURL);i.searchParams.set("key",t.apiKey??Sp.apiKey),Up(i.searchParams,t);const r=await zp(i.toString());if(!r.ok)throw new Dp(r,Op[r.status]??"");return await r.json()},batch:async function(e,t={}){if(!e.length)return[];const i=e.map((e=>encodeURIComponent(e))).join(";"),r=new URL(`geocoding/${i}.json`,Rp.maptilerApiURL);Qp(r.searchParams,t);const n=await zp(r.toString());if(!n.ok)throw new Dp(n,Op[n.status]??"");const o=await n.json();return 1===e.length?[o]:o}},Vp={403:"Key is missing, invalid or restricted"};const Hp={info:async function(e={}){const t=new URL("geolocation/ip.json",Rp.maptilerApiURL);t.searchParams.set("key",e.apiKey??Sp.apiKey);const i=t.toString(),r=await zp(i);if(!r.ok)throw new Dp(r,r.status in Vp?Vp[r.status]:"");return await r.json()}},Gp={403:"Key is missing, invalid or restricted"};const $p={search:async function(e,t={}){if("string"!=typeof e||0===e.trim().length)throw new Error("The query must be a non-empty string");const i=new URL(`coordinates/search/${e}.json`,Rp.maptilerApiURL);i.searchParams.set("key",t.apiKey??Sp.apiKey),"limit"in t&&i.searchParams.set("limit",t.limit.toString()),"transformations"in t&&i.searchParams.set("transformations",t.transformations.toString()),"exports"in t&&i.searchParams.set("exports",t.exports.toString());const r=i.toString(),n=await zp(r);if(!n.ok)throw new Dp(n,n.status in Gp?Gp[n.status]:"");return await n.json()},transform:async function(e,t={}){const i=(Array.isArray(e[0])?e:[e]).map((e=>`${e[0]},${e[1]}`)).join(";"),r=new URL(`coordinates/transform/${i}.json`,Rp.maptilerApiURL);r.searchParams.set("key",t.apiKey??Sp.apiKey),"sourceCrs"in t&&r.searchParams.set("s_srs",t.sourceCrs.toString()),"targetCrs"in t&&r.searchParams.set("t_srs",t.targetCrs.toString()),"operations"in t&&r.searchParams.set("ops",(Array.isArray(t.operations)?t.operations:[t.operations]).join("|"));const n=r.toString(),o=await zp(n);if(!o.ok)throw new Dp(o,o.status in Gp?Gp[o.status]:"");return await o.json()}},Zp={403:"Key is missing, invalid or restricted"};const qp={get:async function(e,t={}){if("string"!=typeof e||0===e.trim().length)throw new Error("The data ID must be a non-empty string");const i=new URL(`data/${encodeURIComponent(e)}/features.json`,Rp.maptilerApiURL);i.searchParams.set("key",t.apiKey??Sp.apiKey);const r=i.toString(),n=await zp(r);if(!n.ok)throw new Dp(n,n.status in Zp?Zp[n.status]:"");return await n.json()}};function Kp(e){let t;const i=e.trim();let r;return r=i.startsWith("http://")||i.startsWith("https://")?i:null!==(t=/^maptiler:\/\/(.*)/.exec(i))?`https://api.maptiler.com/maps/${t[1]}/style.json`:`https://api.maptiler.com/maps/${i}/style.json`,r}class Wp{constructor(e,t,i,r,n,o,s=!1){this.name=e,this.variantType=t,this.id=i,this.referenceStyle=r,this.description=n,this.imageURL=o,this.deprecated=s}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(e){return this.referenceStyle.hasVariant(e)}getVariant(e){const t=this.referenceStyle.getVariant(e);return this.warnIfDeprecated(t),t}getVariants(){return this.referenceStyle.getVariants().filter((e=>e!==this)).map((e=>(this.warnIfDeprecated(e),e)))}getImageURL(){return this.imageURL}getExpandedStyleURL(){return Kp(this.getId())}warnIfDeprecated(e=this){if(!e.deprecated)return e;const t=e.getFullName();return console.warn(`Style "${t}" is deprecated and will be removed in a future version.`),e}}class Xp{constructor(e,t){this.name=e,this.id=t,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(e){this.variants[e.getType()]=e,this.orderedVariants.push(e)}hasVariant(e){return e in this.variants}getVariant(e){return e in this.variants?this.variants[e]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0].warnIfDeprecated()}}const Yp=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",deprecated:!0,name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",deprecated:!0,variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",deprecated:!0,variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",deprecated:!0,variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",deprecated:!0,variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",deprecated:!0,variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",deprecated:!0,description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",deprecated:!0,description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"AQUARELLE",name:"Aquarelle",description:"Watercolor map for creative use",variants:[{id:"aquarelle",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"aquarelle-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"aquarelle-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]},{referenceStyleID:"LANDSCAPE",name:"Landscape",description:"Terrain map for data overlays and visualisations",variants:[{id:"landscape",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"landscape-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"landscape-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]}];function Jp(e){return new Proxy(e,{get(t,i,r){if(t.hasVariant(i))return t.getVariant(i);if(i.toString().toUpperCase()===i)return e.getDefaultVariant();return Reflect.get(t,i,r)}})}function ef(e){return e?"string"==typeof e||e instanceof String?e.trim().toLowerCase():e instanceof Wp?e.getId():e instanceof Xp?e.getDefaultVariant().getId():void 0:tf[Yp[0].referenceStyleID].getDefaultVariant().getId()}const tf=function(){const e={};for(let t=0;t1?(r=i[0],n=i[1]):t>0&&(r+=o*t,n+=s*t)}return o=e[0]-r,s=e[1]-n,o*o+s*s}function nf(e,t,i,r,n){let o,s=r;for(let r=t+1;rs&&(o=r,s=n)}s>r&&(o-t>1&&nf(e,t,o,r,n),n.push(e[o]),i-o>1&&nf(e,o,i,r,n))}function of(e,t){const i=e.length-1,r=[e[0]];return nf(e,0,i,t,r),r.push(e[i]),r}const sf={extractLineStrings:function(e){const t=[];function i(e){"LineString"!==e.type&&"MultiLineString"!==e.type||t.push(e)}function r(e){e.geometry&&i(e.geometry)}return"Feature"===e.type?r(e):"FeatureCollection"===e.type?function e(t){for(const i of t.features)"Feature"===i.type?r(i):"FeatureCollection"===i.type&&e(i)}(e):i(e),t},simplify:function(e,t){return e.length<=2?e:of(e,void 0!==t?t*t:1)}};function af(e,t=!0){let i=`${e[0]},${e[1]}`;return 3===e.length&&t&&(i+=`,${e[2]}`),i}function lf(e,t=3e3){let i=e.map((e=>e.join(","))).join("|"),r=5e-6;for(;i.length>t;){i=sf.simplify(e,r).map((e=>`${e[0]},${e[1]}`)).join("|"),r+=1e-5}return i}const cf={centered:function(e,t,i={}){const r=ef(i.style),n=i.hiDPI?"@2x":"",o=i.format??"png";let s=~~(i.width??1024),a=~~(i.height??1024);i.hiDPI&&(s=~~(s/2),a=~~(a/2));const l=new URL(`maps/${encodeURIComponent(r)}/static/${e[0]},${e[1]},${t}/${s}x${a}${n}.${o}`,Rp.maptilerApiURL);if("attribution"in i&&l.searchParams.set("attribution",i.attribution.toString()),"markers"in i){let e="";const t="markerIcon"in i;t&&(e+=`icon:${i.markerIcon}|`),t&&"markerAnchor"in i&&(e+=`anchor:${i.markerAnchor}|`),t&&i.hiDPI&&(e+="scale:2|");e+=(Array.isArray(i.markers[0])?i.markers:[i.markers]).map((e=>af(e,!t))).join("|"),l.searchParams.set("markers",e)}if("path"in i){let e="";if(e+=`fill:${i.pathFillColor??"none"}|`,"pathStrokeColor"in i&&(e+=`stroke:${i.pathStrokeColor}|`),"pathWidth"in i){e+=`width:${(i.pathWidth/(i.hiDPI?2:1)).toString()}|`}e+=lf(i.path),l.searchParams.set("path",e)}return l.searchParams.set("key",i.apiKey??Sp.apiKey),l.toString()},bounded:function(e,t={}){const i=ef(t.style),r=t.hiDPI?"@2x":"",n=t.format??"png";let o=~~(t.width??1024),s=~~(t.height??1024);t.hiDPI&&(o=~~(o/2),s=~~(s/2));const a=new URL(`maps/${encodeURIComponent(i)}/static/${e[0]},${e[1]},${e[2]},${e[3]}/${o}x${s}${r}.${n}`,Rp.maptilerApiURL);if("attribution"in t&&a.searchParams.set("attribution",t.attribution.toString()),"padding"in t&&a.searchParams.set("padding",t.padding.toString()),"markers"in t){let e="";const i="markerIcon"in t;i&&(e+=`icon:${t.markerIcon}|`),i&&"markerAnchor"in t&&(e+=`anchor:${t.markerAnchor}|`),i&&t.hiDPI&&(e+="scale:2|");e+=(Array.isArray(t.markers[0])?t.markers:[t.markers]).map((e=>af(e,!i))).join("|"),a.searchParams.set("markers",e)}if("path"in t){let e="";if(e+=`fill:${t.pathFillColor??"none"}|`,"pathStrokeColor"in t&&(e+=`stroke:${t.pathStrokeColor}|`),"pathWidth"in t){e+=`width:${(t.pathWidth/(t.hiDPI?2:1)).toString()}|`}e+=lf(t.path),a.searchParams.set("path",e)}return a.searchParams.set("key",t.apiKey??Sp.apiKey),a.toString()},automatic:function(e={}){if(!("markers"in e)&&!("path"in e))throw new Error("Automatic static maps require markers and/or path to be created.");const t=ef(e.style),i=e.hiDPI?"@2x":"",r=e.format??"png";let n=~~(e.width??1024),o=~~(e.height??1024);e.hiDPI&&(n=~~(n/2),o=~~(o/2));const s=new URL(`maps/${encodeURIComponent(t)}/static/auto/${n}x${o}${i}.${r}`,Rp.maptilerApiURL);if("attribution"in e&&s.searchParams.set("attribution",e.attribution.toString()),"padding"in e&&s.searchParams.set("padding",e.padding.toString()),"markers"in e){let t="";const i="markerIcon"in e;i&&(t+=`icon:${e.markerIcon}|`),i&&"markerAnchor"in e&&(t+=`anchor:${e.markerAnchor}|`),i&&e.hiDPI&&(t+="scale:2|");t+=(Array.isArray(e.markers[0])?e.markers:[e.markers]).map((e=>af(e,!i))).join("|"),s.searchParams.set("markers",t)}if("path"in e){let t="";if(t+=`fill:${e.pathFillColor??"none"}|`,"pathStrokeColor"in e&&(t+=`stroke:${e.pathStrokeColor}|`),"pathWidth"in e){t+=`width:${(e.pathWidth/(e.hiDPI?2:1)).toString()}|`}t+=lf(e.path),s.searchParams.set("path",t)}return s.searchParams.set("key",e.apiKey??Sp.apiKey),s.toString()}},uf=6371008.8,hf=2*Math.PI*uf;function df(e){return(180+e)/360}function pf(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function ff(e){const t=_f(e);return[df(t[0]),pf(t[1])]}function Af(e){return 360*e-180}function mf(e){const t=180-360*e;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function gf(e,t){const i=Math.PI/180,r=e[1]*i,n=t[1]*i,o=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t[0]-e[0])*i);return uf*Math.acos(Math.min(o,1))}function _f(e){const t=((e[0]+180)%360+360)%360-180;return[-180===t?180:t,e[1]]}function yf(e){return hf*Math.cos(e*Math.PI/180)}function vf(e,t,i=!0){const r=2**t,n=[e[0]*r,e[1]*r];return i?[~~n[0],~~n[1]]:n}function xf(e){return e*Math.PI/180}function bf(e){return 180*e/Math.PI}const wf={EARTH_RADIUS:uf,EARTH_CIRCUMFERENCE:hf,longitudeToMercatorX:df,latitudeToMercatorY:pf,wgs84ToMercator:ff,mercatorXToLongitude:Af,mercatorYToLatitude:mf,mercatorToWgs84:function(e){return[Af(e[0]),mf(e[1])]},haversineDistanceWgs84:gf,wrapWgs84:_f,circumferenceAtLatitude:yf,mercatorToTileIndex:vf,wgs84ToTileIndex:function(e,t,i=!0){return vf(ff(e),t,i)},toRadians:xf,toDegrees:bf,haversineIntermediateWgs84:function(e,t,i){const r=gf(e,t),n=xf(e[0]),o=xf(e[1]),s=xf(t[0]),a=xf(t[1]),l=r/uf,c=Math.sin((1-i)*l)/Math.sin(l),u=Math.sin(i*l)/Math.sin(l),h=c*Math.cos(o)*Math.cos(n)+u*Math.cos(a)*Math.cos(s),d=c*Math.cos(o)*Math.sin(n)+u*Math.cos(a)*Math.sin(s),p=c*Math.sin(o)+u*Math.sin(a),f=Math.atan2(p,Math.sqrt(h*h+d*d));return[bf(Math.atan2(d,h)),bf(f)]},haversineCumulatedDistanceWgs84:function(e){const t=Array(e.length);t[0]=0;const i=t.length;for(let r=1;rs||a<0)&&(a=s);const l=e.map((e=>wf.wgs84ToTileIndex(e,a,!1))),c=l.map((e=>[~~e[0],~~e[1]])).map((e=>`terrain_${a.toString()}_${e[0].toString()}_${e[1].toString()}`)),u=Array.from(new Set(c.filter((e=>!o.has(e))))).map((e=>e.split("_").slice(1))),h=u.map((e=>n.replace("{x}",e[1].toString()).replace("{y}",e[2].toString()).replace("{z}",e[0].toString()))).map((e=>zp(e))),d=(await Promise.allSettled(h)).map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e)),p=d.filter((e=>!e.ok));if(d.length!==h.length)throw new Error("Some tiles could not be fetched.");if(p.length)throw new Dp(p[0],Mf[p[0].status]??"");const f=await Promise.all(d.map((e=>e.arrayBuffer())));if(!f.every((e=>e.byteLength>0)))throw new Error("Some tiles are not available.");(await Promise.all(f.map((e=>r(e))))).forEach(((e,t)=>{const i=u[t],r=`terrain_${i[0].toString()}_${i[1].toString()}_${i[2].toString()}`;o.set(r,e)}));const A=e.map(((e,t)=>{const i=c[t],r=l[t],n=o.get(i),s=Math.min(Math.round(n.width*(r[0]%1)),n.width-1),a=(Math.min(Math.round(n.height*(r[1]%1)),n.height-1)*n.width+s)*n.components,u=.1*(256*n.pixels[a]*256+256*n.pixels[a+1]+n.pixels[a+2])-1e4;return[e[0],e[1],~~(1e3*u)/1e3]}));if(t.smoothingKernelSize){const e=2*~~(t.smoothingKernelSize/2)+1,i=A.map((e=>e[2])),r=~~(e/2);for(let t=r;tr||n<0)&&(n=r);const o=wf.wgs84ToTileIndex(e,n,!1),s=~~o[0],a=~~o[1];if(!Ef.tiles.length)throw new Error("Terrain tileJSON tile list is empty.");const l=`terrain_${n.toString()}_${s.toString()}_${a.toString()}`;let c;const u=Bf();if(u.has(l))c=u.get(l);else{const e=Ef.tiles[0].replace("{x}",s.toString()).replace("{y}",a.toString()).replace("{z}",n.toString()),t=await zp(e);if(!t.ok)throw new Dp(t,Mf[t.status]??"");const i=await t.arrayBuffer(),r=Sf();c=await r(i),u.set(l,c)}const h=~~(c.width*(o[0]%1)),d=(~~(c.height*(o[1]%1))*c.width+h)*c.components,p=.1*(256*c.pixels[d]*256+256*c.pixels[d+1]+c.pixels[d+2])-1e4;return[e[0],e[1],p]},batch:Pf,fromLineString:async function(e,t={}){if("LineString"!==e.type)throw new Error("The provided object is not a GeoJSON LineString");const i=structuredClone(e),r=await Pf(i.coordinates,t);return i.coordinates=r,i},fromMultiLineString:async function(e,t={}){if("MultiLineString"!==e.type)throw new Error("The provided object is not a GeoJSON MultiLineString");const i=structuredClone(e),r=i.coordinates.map((e=>e.length)),n=i.coordinates.flat(),o=await Pf(n,t),s=[];let a=0;for(const e of r)s.push(o.slice(a,a+e)),a+=e;return i.coordinates=s,i}};var Ff,kf={exports:{}},zf="object"==typeof Reflect?Reflect:null,Rf=zf&&"function"==typeof zf.apply?zf.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};Ff=zf&&"function"==typeof zf.ownKeys?zf.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Df=Number.isNaN||function(e){return e!=e};function Of(){Of.init.call(this)}kf.exports=Of,kf.exports.once=function(e,t){return new Promise((function(i,r){function n(i){e.removeListener(t,o),r(i)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}qf(e,t,o,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&qf(e,"error",t,i)}(e,n,{once:!0})}))},Of.EventEmitter=Of,Of.prototype._events=void 0,Of.prototype._eventsCount=0,Of.prototype._maxListeners=void 0;var Uf=10;function Nf(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Qf(e){return void 0===e._maxListeners?Of.defaultMaxListeners:e._maxListeners}function jf(e,t,i,r){var n,o,s,a;if(Nf(i),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),o=e._events),s=o[t]),void 0===s)s=o[t]=i,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[i,s]:[s,i]:r?s.unshift(i):s.push(i),(n=Qf(e))>0&&s.length>n&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,a=l,console&&console.warn&&console.warn(a)}return e}function Vf(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Hf(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=Vf.bind(r);return n.listener=i,r.wrapFn=n,n}function Gf(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=n[e];if(void 0===a)return!1;if("function"==typeof a)Rf(a,this,t);else{var l=a.length,c=Zf(a,l);for(i=0;i=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,n=o;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},Of.prototype.listeners=function(e){return Gf(this,e,!0)},Of.prototype.rawListeners=function(e){return Gf(this,e,!1)},Of.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):$f.call(e,t)},Of.prototype.listenerCount=$f,Of.prototype.eventNames=function(){return this._eventsCount>0?Ff(this._events):[]};var Kf=kf.exports;const Wf=[];for(let e=0;e<256;++e)Wf.push((e+256).toString(16).slice(1));let Xf;const Yf=new Uint8Array(16);var Jf={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};const eA="function"==typeof Buffer,tA=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder,Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),iA=(()=>{let e={};return tA.forEach(((t,i)=>e[t]=i)),e})(),rA=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,nA=String.fromCharCode.bind(String),oA=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),sA=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),aA=e=>{let t,i,r,n,o="";const s=e.length%3;for(let s=0;s255||(r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=i<<16|r<<8|n,o+=tA[t>>18&63]+tA[t>>12&63]+tA[t>>6&63]+tA[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},lA="function"==typeof btoa?e=>btoa(e):eA?e=>Buffer.from(e,"binary").toString("base64"):aA,cA=eA?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let i=0,r=e.length;it?oA(cA(e)):cA(e),hA=e=>{if(e=e.replace(/\s+/g,""),!rA.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,i,r,n="";for(let o=0;o>16&255):64===r?nA(t>>16&255,t>>8&255):nA(t>>16&255,t>>8&255,255&t);return n},dA=uA;var pA=Object.defineProperty,fA=e=>{throw TypeError(e)},AA=(e,t,i)=>((e,t,i)=>t in e?pA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),mA=(e,t,i)=>t.has(e)||fA("Cannot "+i),gA=(e,t,i)=>(mA(e,t,"read from private field"),i?i.call(e):t.get(e)),_A=(e,t,i)=>t.has(e)?fA("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),yA=(e,t,i,r)=>(mA(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),vA=(e,t,i)=>(mA(e,t,"access private method"),i);const xA={VISITOR:{code:null,flag:"visitor",name:"Visitor",latin:!0,isMode:!0,geocoding:!1},VISITOR_ENGLISH:{code:null,flag:"visitor_en",name:"Visitor English",latin:!0,isMode:!0,geocoding:!1},STYLE:{code:null,flag:"style",name:"Style",latin:!1,isMode:!0,geocoding:!1},STYLE_LOCK:{code:null,flag:"style_lock",name:"Style Lock",latin:!1,isMode:!0,geocoding:!1},...Ep};function bA(){if(typeof navigator>"u"){return Ip(Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0])||xA.ENGLISH}return Array.from(new Set(navigator.languages.map((e=>e.split("-")[0])))).map((e=>Ip(e))).filter((e=>e))[0]??xA.LOCAL}const wA={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",telemetryURL:"https://api.maptiler.com/metrics",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:xA.STYLE,secondaryLanguage:xA.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(wA);const TA=function(e,t,i){if(Jf.randomUUID&&!t&&!e)return Jf.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!Xf){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Xf=crypto.getRandomValues.bind(crypto)}return Xf(Yf)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){if((i=i||0)<0||i+16>t.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[i+e]=r[e];return t}return function(e,t=0){return(Wf[e[t+0]]+Wf[e[t+1]]+Wf[e[t+2]]+Wf[e[t+3]]+"-"+Wf[e[t+4]]+Wf[e[t+5]]+"-"+Wf[e[t+6]]+Wf[e[t+7]]+"-"+Wf[e[t+8]]+Wf[e[t+9]]+"-"+Wf[e[t+10]]+Wf[e[t+11]]+Wf[e[t+12]]+Wf[e[t+13]]+Wf[e[t+14]]+Wf[e[t+15]]).toLowerCase()}(r)}();class BA extends Kf{constructor(){super(...arguments),AA(this,"primaryLanguage",wA.primaryLanguage),AA(this,"secondaryLanguage"),AA(this,"session",!0),AA(this,"caching",!0),AA(this,"telemetry",!0),AA(this,"_unit","metric"),AA(this,"_apiKey","")}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,Sp.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){Sp.fetch=e}get fetch(){return Sp.fetch}}const CA=new BA,SA="localcache_source",EA="localcache",MA=typeof caches<"u";function IA(e,t){if(MA&&CA.caching&&CA.session&&e.host===wA.maptilerApiHost){if("Source"===t&&e.href.includes("tiles.json"))return e.href.replace("https://",`${SA}://`);if("Tile"===t||"Glyphs"===t)return e.href.replace("https://",`${EA}://`)}return e.href}let PA;async function LA(){return PA||(PA=await caches.open("maptiler_sdk")),PA}let FA=0;function kA(){we.exports.addProtocol(SA,(async(e,t)=>{if(!e.url)throw new Error("");e.url=e.url.replace(`${SA}://`,"https://");const i=e;i.signal=t.signal;const r=await fetch(e.url,i),n=await r.json();return n.tiles&&n.tiles.length>0&&(n.tiles[0]+=`&last-modified=${r.headers.get("Last-Modified")}`),{data:n,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}})),we.exports.addProtocol(EA,(async(e,t)=>{if(!e.url)throw new Error("");e.url=e.url.replace(`${EA}://`,"https://");const i=new URL(e.url),r=new URL(i);r.searchParams.delete("mtsid"),r.searchParams.delete("key");const n=r.toString(),o=new URL(i);o.searchParams.delete("last-modified");const s=o.toString(),a=async e=>({data:await e.arrayBuffer(),cacheControl:e.headers.get("Cache-Control"),expires:e.headers.get("Expires")}),l=await LA(),c=await l.match(n);if(c)return a(c);const u=e;u.signal=t.signal;const h=await fetch(s,u);return h.status>=200&&h.status<300&&(l.put(n,h.clone()).catch((()=>{})),++FA>100&&(async function(){const e=await LA(),t=await e.keys(),i=t.slice(0,Math.max(t.length-1e3,0));for(const t of i)e.delete(t)}(),FA=0)),a(h)}))}function zA(e,t){let i=null;try{i=new URL(e)}catch{return{url:e}}return i.host===wA.maptilerApiHost&&(i.searchParams.has("key")||i.searchParams.append("key",CA.apiKey),CA.session&&i.searchParams.append("mtsid",TA)),{url:IA(i,t)}}function RA(e){return(t,i)=>{if(null!=e){const r=e(t,i),n=zA((null==r?void 0:r.url)??"",i);return{...r,...n}}return zA(t,i)}}function DA(){return Math.random().toString(36).substring(2)}function OA(e){return/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(e)}function UA(){return document.createElement("canvas").getContext("webgl2")?null:typeof WebGL2RenderingContext<"u"?"Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed.":"Your browser does not support graphic rendering with WebGL2. The map cannot be displayed."}function NA(e,t){return!(!Array.isArray(e)||2!==e.length||"get"!==e[0]||"string"!=typeof e[1]||t&&!e[1].startsWith("name:")||!t&&"name"!==e[1])}function QA(e,t,i){const r=structuredClone(e),n=e=>{if("string"!=typeof e)for(let r=0;ri===n.length-1?[e]:[e,t]))]}function HA(e){var t;const i=/\{name(?:\:(?\S+))?\}/g,r=[];for(;;){const n=i.exec(e);if(!n)break;const o=(null==(t=n.groups)?void 0:t.language)??null;r.push(o)}return r}function GA(e){return Array.isArray(e)&&2===e.length&&"get"===e[0]&&"string"==typeof e[1]?"name"===e[1].trim()?{isLanguage:!0,localization:null}:e[1].trim().startsWith("name:")?{isLanguage:!0,localization:e[1].trim().split(":").pop()}:null:null}function $A(e){const t=[],i=structuredClone(e),r=e=>{if("string"!=typeof e)for(let i=0;i":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_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"}}};class vm{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function xm(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}class bm extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class wm{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new wm(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Tm={kind:"null"},Bm={kind:"number"},Cm={kind:"string"},Sm={kind:"boolean"},Em={kind:"color"},Mm={kind:"projectionDefinition"},Im={kind:"object"},Pm={kind:"value"},Lm={kind:"collator"},Fm={kind:"formatted"},km={kind:"padding"},zm={kind:"resolvedImage"},Rm={kind:"variableAnchorOffsetCollection"};function Dm(e,t){return{kind:"array",itemType:e,N:t}}function Om(e){if("array"===e.kind){const t=Om(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Um=[Tm,Bm,Cm,Sm,Em,Mm,Fm,Im,Dm(Pm),km,zm,Rm];function Nm(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Nm(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Um)if(!Nm(e,t))return null}return`Expected ${Om(e)} but found ${Om(t)} instead.`}function Qm(e,t){return t.some((t=>t.kind===e.kind))}function jm(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}function Vm(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const Hm=.96422,Gm=.82521,$m=4/29,Zm=6/29,qm=3*Zm*Zm,Km=Zm*Zm*Zm,Wm=Math.PI/180,Xm=180/Math.PI;function Ym(e){return(e%=360)<0&&(e+=360),e}function Jm([e,t,i,r]){let n,o;const s=tg((.2225045*(e=eg(e))+.7168786*(t=eg(t))+.0606169*(i=eg(i)))/1);e===t&&t===i?n=o=s:(n=tg((.4360747*e+.3850649*t+.1430804*i)/Hm),o=tg((.0139322*e+.0971045*t+.7141733*i)/Gm));const a=116*s-16;return[a<0?0:a,500*(n-s),200*(s-o),r]}function eg(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function tg(e){return e>Km?Math.pow(e,1/3):e/qm+$m}function ig([e,t,i,r]){let n=(e+16)/116,o=isNaN(t)?n:n+t/500,s=isNaN(i)?n:n-i/200;return n=1*ng(n),o=Hm*ng(o),s=Gm*ng(s),[rg(3.1338561*o-1.6168667*n-.4906146*s),rg(-.9787684*o+1.9161415*n+.033454*s),rg(.0719453*o-.2289914*n+1.4052427*s),r]}function rg(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function ng(e){return e>Zm?e*e*e:qm*(e-$m)}function og(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=ug[e];if(t){const[e,i,r]=t;return[e/255,i/255,r/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let i=1;return[sg(e.slice(i,i+=t)),sg(e.slice(i,i+=t)),sg(e.slice(i,i+=t)),sg(e.slice(i,i+t)||"ff")]}if(e.startsWith("rgb")){const t=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=e.match(t);if(i){const[e,t,r,n,o,s,a,l,c,u,h,d]=i,p=[n||" ",a||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[r,s,c].join(""),i="%%%"===e?100:""===e?255:0;if(i){const e=[lg(+t/i,0,1),lg(+o/i,0,1),lg(+l/i,0,1),h?ag(+h,d):1];if(cg(e))return e}}return}}const i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[e,t,r,n,o,s,a,l,c]=i,u=[r||" ",o||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,lg(+n,0,100),lg(+s,0,100),l?ag(+l,c):1];if(cg(e))return function([e,t,i,r]){function n(r){const n=(r+e/30)%12,o=t*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return e=Ym(e),t/=100,i/=100,[n(0),n(8),n(4),r]}(e)}}}function sg(e){return parseInt(e.padEnd(2,e),16)/255}function ag(e,t){return lg(t?e/100:e,0,1)}function lg(e,t,i){return Math.min(Math.max(t,e),i)}function cg(e){return!e.some(Number.isNaN)}const ug={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function hg(e,t,i){return e+i*(t-e)}function dg(e,t,i){return e.map(((e,r)=>hg(e,t[r],i)))}class pg{constructor(e,t,i,r=1,n=!0){this.r=e,this.g=t,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,i,r]))}static parse(e){if(e instanceof pg)return e;if("string"!=typeof e)return;const t=og(e);return t?new pg(...t,!1):void 0}get rgb(){const{r:e,g:t,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[e/n,t/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,i,r,n]=Jm(e),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?Ym(Math.atan2(r,i)*Xm):NaN,o,t,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Jm(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,r]=this.rgb;return`rgba(${[e,t,i].map((e=>Math.round(255*e))).join(",")},${r})`}static interpolate(e,t,i,r="rgb"){switch(r){case"rgb":{const[r,n,o,s]=dg(e.rgb,t.rgb,i);return new pg(r,n,o,s,!1)}case"hcl":{const[r,n,o,s]=e.hcl,[a,l,c,u]=t.hcl;let h,d;if(isNaN(r)||isNaN(a))isNaN(r)?isNaN(a)?h=NaN:(h=a,(1===o||0===o)&&(d=l)):(h=r,(1===c||0===c)&&(d=n));else{let e=a-r;a>r&&e>180?e-=360:a180&&(e+=360),h=r+i*e}const[p,f,A,m]=function([e,t,i,r]){return e=isNaN(e)?0:e*Wm,ig([i,Math.cos(e)*t,Math.sin(e)*t,r])}([h,d??hg(n,l,i),hg(o,c,i),hg(s,u,i)]);return new pg(p,f,A,m,!1)}case"lab":{const[r,n,o,s]=ig(dg(e.lab,t.lab,i));return new pg(r,n,o,s,!1)}}}}pg.black=new pg(0,0,0,1),pg.white=new pg(1,1,1,1),pg.transparent=new pg(0,0,0,0),pg.red=new pg(1,0,0,1);class fg{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Ag=["bottom","center","top"];class mg{constructor(e,t,i,r,n,o){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=o}}class gg{constructor(e){this.sections=e}static fromString(e){return new gg([new mg(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof gg?e:gg.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}}class _g{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof _g)return e;if("number"==typeof e)return new _g([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new _g(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new _g(dg(e.values,t.values,i))}}class yg{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const vg=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class xg{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof xg)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?typeof r>"u"||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Bg(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof wg||e instanceof pg||e instanceof fg||e instanceof gg||e instanceof _g||e instanceof xg||e instanceof bg)return!0;if(Array.isArray(e)){for(const t of e)if(!Bg(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Bg(e[t]))return!1;return!0}return!1}function Cg(e){if(null===e)return Tm;if("string"==typeof e)return Cm;if("boolean"==typeof e)return Sm;if("number"==typeof e)return Bm;if(e instanceof pg)return Em;if(e instanceof wg)return Mm;if(e instanceof fg)return Lm;if(e instanceof gg)return Fm;if(e instanceof _g)return km;if(e instanceof xg)return Rm;if(e instanceof bg)return zm;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=Cg(t);if(i){if(i===e)continue;i=Pm;break}i=e}return Dm(i||Pm,t)}return Im}function Sg(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof pg||e instanceof wg||e instanceof gg||e instanceof _g||e instanceof xg||e instanceof bg?e.toString():JSON.stringify(e)}class Eg{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Bg(e[1]))return t.error("invalid value");const i=e[1];let r=Cg(i);const n=t.expectedType;return"array"===r.kind&&0===r.N&&n&&"array"===n.kind&&("number"!=typeof n.N||0===n.N)&&(r=n),new Eg(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Mg={string:Cm,number:Bm,boolean:Sm,object:Im};class Ig{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in Mg)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=Mg[i],r++}else n=Pm;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],r++}i=Dm(n,o)}else{if(!Mg[n])throw new Error(`Types doesn't contain name = ${n}`);i=Mg[n]}const o=[];for(;re.outputDefined()))}}const Pg={"to-boolean":Sm,"to-color":Em,"to-number":Bm,"to-string":Cm};class Lg{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(!Pg[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!==e.length)return t.error("Expected one argument.");const r=Pg[i],n=[];for(let i=1;i4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Tg(t[0],t[1],t[2],t[3]),!i))return new pg(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new yg(i||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const r=_g.parse(t);if(r)return r}throw new yg(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const r=xg.parse(t);if(r)return r}throw new yg(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new yg(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return gg.fromString(Sg(this.args[0].evaluate(e)));case"resolvedImage":return bg.fromString(Sg(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Sg(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Fg=["Unknown","Point","LineString","Polygon"];class kg{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?Fg[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(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=pg.parse(e)),t}}class zg{constructor(e,t,i=[],r,n=new wm,o=[]){this.registry=e,this.path=i,this.key=i.map((e=>`[${e}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=t}parse(e,t,i,r,n={}){return t?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}_parse(e,t){function i(e,t,i){return"assert"===i?new Ig(t,[e]):"coerce"===i?new Lg(t,[e]):e}if((null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e)&&(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind)if("projectionDefinition"!==e.kind||"string"!==n.kind&&"array"!==n.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==e.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind)if("variableAnchorOffsetCollection"!==e.kind||"value"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof Eg)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new kg;try{r=new Eg(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const r="number"==typeof e?this.path.concat(e):this.path,n=i?this.scope.concat(i):this.scope;return new zg(this.registry,this._isConstant,r,t||null,n,this.errors)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new bm(i,e))}checkSubtype(e,t){const i=Nm(e,t);return i&&this.error(i),i}}class Rg{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let r=1;r=i.length)throw new yg(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new yg(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Ug{constructor(e,t){this.type=Sm,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Pm),r=t.parse(e[2],2,Pm);return i&&r?Qm(i.type,[Sm,Cm,Bm,Tm,Pm])?new Ug(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Om(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!jm(t,["boolean","string","number","null"]))throw new yg(`Expected first argument to be of type boolean, string, number or null, but found ${Om(Cg(t))} instead.`);if(!jm(i,["string","array"]))throw new yg(`Expected second argument to be of type array or string, but found ${Om(Cg(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Ng{constructor(e,t,i){this.type=Bm,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Pm),r=t.parse(e[2],2,Pm);if(!i||!r)return null;if(!Qm(i.type,[Sm,Cm,Bm,Tm,Pm]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Om(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Bm);return n?new Ng(i,r,n):null}return new Ng(i,r)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!jm(t,["boolean","string","number","null"]))throw new yg(`Expected first argument to be of type boolean, string, number or null, but found ${Om(Cg(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),jm(i,["string"])){const e=i.indexOf(t,r);return-1===e?-1:[...i.slice(0,e)].length}if(jm(i,["array"]))return i.indexOf(t,r);throw new yg(`Expected second argument to be of type array or string, but found ${Om(Cg(i))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Qg{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let s=2;sNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Cg(e)))return null}else i=Cg(e);if(typeof n[String(e)]<"u")return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(l,s,r);if(!u)return null;r=r||u.type,o.push(u)}const s=t.parse(e[1],1,Pm);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,r);return!a||"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new Qg(i,r,s,n,o,a)}evaluate(e){const t=this.input.evaluate(e);return(Cg(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class jg{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const r=[];for(let n=1;nt.outputDefined()))&&this.otherwise.outputDefined()}}class Vg{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Pm),r=t.parse(e[2],2,Bm);if(!i||!r)return null;if(!Qm(i.type,[Dm(Pm),Cm,Pm]))return t.error(`Expected first argument to be of type array or string, but found ${Om(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Bm);return n?new Vg(i.type,i,r,n):null}return new Vg(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),jm(t,["string"]))return[...t].slice(i,r).join("");if(jm(t,["array"]))return t.slice(i,r);throw new yg(`Expected first argument to be of type array or string, but found ${Om(Cg(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Hg(e,t){const i=e.length-1;let r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=e[a],n=e[a+1],r<=t){if(a===i||tt))throw new yg("Input is not a number.");s=a-1}return 0}class Gg{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,Bm);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new Gg(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);return i[Hg(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function $g(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zg,qg;var Kg=$g(function(){if(qg)return Zg;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return qg=1,Zg=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Zg}());class Wg{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=Xg(t,e.base,i,r);else if("linear"===e.name)n=Xg(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new Kg(o[0],o[1],o[2],o[3]).solve(Xg(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,Bm),!n)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=Em:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(r,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return Vm(a,Bm)||Vm(a,Mm)||Vm(a,Em)||Vm(a,km)||Vm(a,Rm)||Vm(a,Dm(Bm))?new Wg(a,i,r,n,s):t.error(`Type ${Om(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=Hg(t,r),s=t[o],a=t[o+1],l=Wg.interpolationFactor(this.interpolation,r,s,a),c=i[o].evaluate(e),u=i[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return hg(c,u,l);case"color":return pg.interpolate(c,u,l);case"padding":return _g.interpolate(c,u,l);case"variableAnchorOffsetCollection":return xg.interpolate(c,u,l);case"array":return dg(c,u,l);case"projectionDefinition":return wg.interpolate(c,u,l)}case"interpolate-hcl":return pg.interpolate(c,u,l,"hcl");case"interpolate-lab":return pg.interpolate(c,u,l,"lab")}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Xg(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}pg.interpolate,_g.interpolate,xg.interpolate;class Yg{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of e.slice(1)){const e=t.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}if(!i)throw new Error("No output type");return r&&n.some((e=>Nm(r,e.type)))?new Yg(Pm,n):new Yg(i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(e),i&&i instanceof bg&&!i.available&&(t||(t=i.name),i=null,r===this.args.length&&(i=t)),null!==i)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Jg(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function e_(e,t,i,r){return 0===r.compare(t,i)}function t_(e,t,i){const r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=Sm,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,Pm);if(!o)return null;if(!Jg(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${Om(o.type)}'.`);let s=t.parse(e[2],2,Pm);if(!s)return null;if(!Jg(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${Om(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${Om(o.type)}' and '${Om(s.type)}'.`);r&&("value"===o.type.kind&&"value"!==s.type.kind?o=new Ig(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new Ig(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,Lm),!a)return null}return new n(o,s,a)}evaluate(n){const o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=Cg(o),i=Cg(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new yg(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=Cg(o),i=Cg(s);if("string"!==e.kind||"string"!==i.kind)return t(n,o,s)}return this.collator?i(n,o,s,this.collator.evaluate(n)):t(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const i_=t_("==",(function(e,t,i){return t===i}),e_),r_=t_("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!e_(0,t,i,r)})),n_=t_("<",(function(e,t,i){return t",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),s_=t_("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),a_=t_(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0}));class l_{constructor(e,t,i){this.type=Lm,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");const r=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,Sm);if(!r)return null;const n=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,Sm);if(!n)return null;let o=null;return i.locale&&(o=t.parse(i.locale,1,Cm),!o)?null:new l_(r,n,o)}evaluate(e){return new fg(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class c_{constructor(e,t,i,r,n){this.type=Cm,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Bm);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parse(r.locale,1,Cm),!n))return null;let o=null;if(r.currency&&(o=t.parse(r.currency,1,Cm),!o))return null;let s=null;if(r["min-fraction-digits"]&&(s=t.parse(r["min-fraction-digits"],1,Bm),!s))return null;let a=null;return r["max-fraction-digits"]&&(a=t.parse(r["max-fraction-digits"],1,Bm),!a)?null:new c_(i,n,o,s,a)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class u_{constructor(e){this.type=Fm,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,Bm),!e))return null;let i=null;if(o["text-font"]&&(i=t.parse(o["text-font"],1,Dm(Cm)),!i))return null;let s=null;if(o["text-color"]&&(s=t.parse(o["text-color"],1,Em),!s))return null;let a=null;if(o["vertical-align"]){if("string"==typeof o["vertical-align"]&&!Ag.includes(o["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(a=t.parse(o["vertical-align"],1,Cm),!a)return null}const l=r[r.length-1];l.scale=e,l.font=i,l.textColor=s,l.verticalAlign=a}else{const o=t.parse(e[i],1,Pm);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null,verticalAlign:null})}}return new u_(r)}evaluate(e){return new gg(this.sections.map((t=>{const i=t.content.evaluate(e);return Cg(i)===zm?new mg("",i,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new mg(Sg(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class h_{constructor(e){this.type=zm,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Cm);return i?new h_(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=bg.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class d_{constructor(e){this.type=Bm,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${Om(i.type)} instead.`):new d_(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new yg(`Expected value to be of type string or array, but found ${Om(Cg(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const p_=8192;function f_(e,t){const i=function(e){return(180+e)/360}(e[0]),r=function(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}(e[1]),n=Math.pow(2,t.z);return[Math.round(i*n*p_),Math.round(r*n*p_)]}function A_(e,t){const i=Math.pow(2,t.z),r=(e[0]/p_+t.x)/i,n=(e[1]/p_+t.y)/i;return[m_(r),g_(n)]}function m_(e){return 360*e-180}function g_(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function __(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function y_(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function v_(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function x_(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],s=e[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function b_(e,t,i,r){const n=[t[0]-e[0],t[1]-e[1]];return 0!==function(e,t){return e[0]*t[1]-e[1]*t[0]}([r[0]-i[0],r[1]-i[1]],n)&&!(!E_(e,t,i,r)||!E_(i,r,e,t))}function w_(e,t,i){for(const r of i)for(let i=0;i0&&h<0||u<0&&h>0}function M_(e,t,i){const r=[];for(let n=0;ni[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}__(t,e)}function L_(e,t,i,r){const n=Math.pow(2,r.z)*p_,o=[r.x*p_,r.y*p_],s=[];for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];P_(r,t,i,n),s.push(r)}return s}function F_(e,t,i,r){const n=Math.pow(2,r.z)*p_,o=[r.x*p_,r.y*p_],s=[];for(const i of e){const e=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];__(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=n/2){!function(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}(t);for(const e of s)for(const r of e)P_(r,t,i,n)}return s}class k_{constructor(e,t){this.type=Sm,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Bg(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const i of t.features){const{type:t,coordinates:r}=i.geometry;"Polygon"===t&&e.push(r),"MultiPolygon"===t&&e.push(...r)}if(e.length){return new k_(t,{type:"MultiPolygon",coordinates:e})}}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new k_(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new k_(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=M_(t.coordinates,r,n),s=L_(e.geometry(),i,r,n);if(!y_(i,r))return!1;for(const e of s)if(!T_(e,o))return!1}if("MultiPolygon"===t.type){const o=I_(t.coordinates,r,n),s=L_(e.geometry(),i,r,n);if(!y_(i,r))return!1;for(const e of s)if(!B_(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=M_(t.coordinates,r,n),s=F_(e.geometry(),i,r,n);if(!y_(i,r))return!1;for(const e of s)if(!C_(e,o))return!1}if("MultiPolygon"===t.type){const o=I_(t.coordinates,r,n),s=F_(e.geometry(),i,r,n);if(!y_(i,r))return!1;for(const e of s)if(!S_(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class z_{constructor(e=[],t=(e,t)=>et?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e=0)break;t[e]=t[r],e=r}t[e]=n}}function R_(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n1?(l=e[a+1][0],c=e[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;p180;)e-=360;return e}}function Q_(e,t){return t[0]-e[0]}function j_(e){return e[1]-e[0]+1}function V_(e,t){return e[1]>=e[0]&&e[1]e[1])return[null,null];const i=j_(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===i)return[e,null];const r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function G_(e,t){if(!V_(t,e.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)__(i,e[r]);return i}function $_(e){const t=[1/0,1/0,-1/0,-1/0];for(const i of e)for(const e of i)__(t,e);return t}function Z_(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function q_(e,t,i){if(!Z_(e)||!Z_(t))return NaN;let r=0,n=0;return e[2]t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]=r)return r;if(y_(n,o)){if(ty(e,t))return 0}else if(ty(t,e))return 0;let s=1/0;for(const r of e)for(let e=0,n=r.length,o=n-1;e0;){const n=s.pop();if(n[0]>=o)continue;const l=n[1],c=t?50:100;if(j_(l)<=c){if(!V_(l,e.length))return NaN;if(t){const t=ey(e,l,i,r);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const n=J_(e[t],i,r);if(o=Math.min(o,n),0===o)return 0}}else{const i=H_(l,t);ry(s,o,r,e,a,i[0]),ry(s,o,r,e,a,i[1])}}return o}function sy(e,t,i,r,n,o=1/0){let s=Math.min(o,n.distance(e[0],i[0]));if(0===s)return s;const a=new z_([[0,[0,e.length-1],[0,i.length-1]]],Q_);for(;a.length>0;){const o=a.pop();if(o[0]>=s)continue;const l=o[1],c=o[2],u=t?50:100,h=r?50:100;if(j_(l)<=u&&j_(c)<=h){if(!V_(l,e.length)&&V_(c,i.length))return NaN;let o;if(t&&r)o=X_(e,l,i,c,n),s=Math.min(s,o);else if(t&&!r){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=K_(i[e],t,n),s=Math.min(s,o),0===s)return s}else if(!t&&r){const t=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(o=K_(e[i],t,n),s=Math.min(s,o),0===s)return s}else o=Y_(e,l,i,c,n),s=Math.min(s,o)}else{const o=H_(l,t),u=H_(c,r);ny(a,s,n,e,i,o[0],u[0]),ny(a,s,n,e,i,o[0],u[1]),ny(a,s,n,e,i,o[1],u[0]),ny(a,s,n,e,i,o[1],u[1])}}return s}function ay(e,t){const i=e.geometry();if(0===i.length||0===i[0].length)return NaN;const r=function(e){if(e.length<=1)return[e];const t=[];let i,r;for(const n of e){const e=R_(n);0!==e&&(n.area=Math.abs(e),void 0===r&&(r=e<0),r===e<0?(i&&t.push(i),i=[n]):i.push(n))}return i&&t.push(i),t}(i).map((t=>t.map((t=>t.map((t=>A_([t.x,t.y],e.canonical))))))),n=new N_(r[0][0][0][1]);let o=1/0;for(const e of t)for(const t of r){switch(e.type){case"Point":o=Math.min(o,oy([e.coordinates],!1,t,n,o));break;case"LineString":o=Math.min(o,oy(e.coordinates,!0,t,n,o));break;case"Polygon":o=Math.min(o,iy(t,e.coordinates,n,o))}if(0===o)return o}return o}function ly(e){return"MultiPolygon"===e.type?e.coordinates.map((e=>({type:"Polygon",coordinates:e}))):"MultiLineString"===e.type?e.coordinates.map((e=>({type:"LineString",coordinates:e}))):"MultiPoint"===e.type?e.coordinates.map((e=>({type:"Point",coordinates:e}))):[e]}class cy{constructor(e,t){this.type=Bm,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Bg(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new cy(t,t.features.map((e=>ly(e.geometry))).flat());if("Feature"===t.type)return new cy(t,ly(t.geometry));if("type"in t&&"coordinates"in t)return new cy(t,ly(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>A_([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new N_(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,sy(r,!1,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,sy(r,!1,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,oy(r,!1,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>A_([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new N_(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,sy(r,!0,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,sy(r,!0,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,oy(r,!0,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("Polygon"===e.geometryType())return ay(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const uy={"==":i_,"!=":r_,">":o_,"<":n_,">=":a_,"<=":s_,array:Ig,at:Og,boolean:Ig,case:jg,coalesce:Yg,collator:l_,format:u_,image:h_,in:Ug,"index-of":Ng,interpolate:Wg,"interpolate-hcl":Wg,"interpolate-lab":Wg,length:d_,let:Rg,literal:Eg,match:Qg,number:Ig,"number-format":c_,object:Ig,slice:Vg,step:Gg,string:Ig,"to-boolean":Lg,"to-color":Lg,"to-number":Lg,"to-string":Lg,var:Dg,within:k_,distance:cy};class hy{constructor(e,t,i,r){this.name=e,this.type=t,this._evaluate=i,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],r=hy.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let a=null;for(const[r,o]of s){a=new zg(t.registry,my,t.path,null,t.scope);const s=[];let l=!1;for(let t=1;t{return t=e,Array.isArray(t)?`(${t.map(Om).join(", ")})`:`(${Om(t.type)}...)`;var t})).join(" | "),r=[];for(let i=1;i"u"?null:i}function Ay(e){return{type:e}}function my(e){if(e instanceof Dg)return my(e.boundExpression);if(e instanceof hy&&"error"===e.name)return!1;if(e instanceof l_)return!1;if(e instanceof k_)return!1;if(e instanceof cy)return!1;const t=e instanceof Lg||e instanceof Ig;let i=!0;return e.eachChild((e=>{i=t?i&&my(e):i&&e instanceof Eg})),!!i&&(gy(e)&&yy(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]))}function gy(e){if(e instanceof hy){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof k_||e instanceof cy)return!1;let t=!0;return e.eachChild((e=>{t&&!gy(e)&&(t=!1)})),t}function _y(e){if(e instanceof hy&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!_y(e)&&(t=!1)})),t}function yy(e,t){if(e instanceof hy&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!yy(e,t)&&(i=!1)})),i}function vy(e){return{result:"success",value:e}}function xy(e){return{result:"error",value:e}}function by(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function wy(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Ty(e){return!!e.expression&&e.expression.interpolated}function By(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Cy(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}hy.register(uy,{error:[{kind:"error"},[Cm],(e,[t])=>{throw new yg(t.evaluate(e))}],typeof:[Cm,[Pm],(e,[t])=>Om(Cg(t.evaluate(e)))],"to-rgba":[Dm(Bm,4),[Em],(e,[t])=>{const[i,r,n,o]=t.evaluate(e).rgb;return[255*i,255*r,255*n,o]}],rgb:[Em,[Bm,Bm,Bm],dy],rgba:[Em,[Bm,Bm,Bm,Bm],dy],has:{type:Sm,overloads:[[[Cm],(e,[t])=>py(t.evaluate(e),e.properties())],[[Cm,Im],(e,[t,i])=>py(t.evaluate(e),i.evaluate(e))]]},get:{type:Pm,overloads:[[[Cm],(e,[t])=>fy(t.evaluate(e),e.properties())],[[Cm,Im],(e,[t,i])=>fy(t.evaluate(e),i.evaluate(e))]]},"feature-state":[Pm,[Cm],(e,[t])=>fy(t.evaluate(e),e.featureState||{})],properties:[Im,[],e=>e.properties()],"geometry-type":[Cm,[],e=>e.geometryType()],id:[Pm,[],e=>e.id()],zoom:[Bm,[],e=>e.globals.zoom],"heatmap-density":[Bm,[],e=>e.globals.heatmapDensity||0],"line-progress":[Bm,[],e=>e.globals.lineProgress||0],accumulated:[Pm,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Bm,Ay(Bm),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[Bm,Ay(Bm),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:Bm,overloads:[[[Bm,Bm],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[Bm],(e,[t])=>-t.evaluate(e)]]},"/":[Bm,[Bm,Bm],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[Bm,[Bm,Bm],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[Bm,[],()=>Math.LN2],pi:[Bm,[],()=>Math.PI],e:[Bm,[],()=>Math.E],"^":[Bm,[Bm,Bm],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[Bm,[Bm],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Bm,[Bm],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Bm,[Bm],(e,[t])=>Math.log(t.evaluate(e))],log2:[Bm,[Bm],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Bm,[Bm],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Bm,[Bm],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Bm,[Bm],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Bm,[Bm],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Bm,[Bm],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Bm,[Bm],(e,[t])=>Math.atan(t.evaluate(e))],min:[Bm,Ay(Bm),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[Bm,Ay(Bm),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[Bm,[Bm],(e,[t])=>Math.abs(t.evaluate(e))],round:[Bm,[Bm],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[Bm,[Bm],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Bm,[Bm],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[Sm,[Cm,Pm],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[Sm,[Pm],(e,[t])=>e.id()===t.value],"filter-type-==":[Sm,[Cm],(e,[t])=>e.geometryType()===t.value],"filter-<":[Sm,[Cm,Pm],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r{const i=e.id(),r=t.value;return typeof i==typeof r&&i":[Sm,[Cm,Pm],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[Sm,[Pm],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[Sm,[Cm,Pm],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[Sm,[Pm],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[Sm,[Cm,Pm],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[Sm,[Pm],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[Sm,[Pm],(e,[t])=>t.value in e.properties()],"filter-has-id":[Sm,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[Sm,[Dm(Cm)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[Sm,[Dm(Pm)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[Sm,[Cm,Dm(Pm)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[Sm,[Cm,Dm(Pm)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:Sm,overloads:[[[Sm,Sm],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Ay(Sm),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:Sm,overloads:[[[Sm,Sm],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Ay(Sm),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[Sm,[Sm],(e,[t])=>!t.evaluate(e)],"is-supported-script":[Sm,[Cm],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[Cm,[Cm],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Cm,[Cm],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Cm,Ay(Pm),(e,t)=>t.map((t=>Sg(t.evaluate(e)))).join("")],"resolved-locale":[Cm,[Lm],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Sy{constructor(e,t){var i;this.expression=e,this._warningHistory={},this._evaluator=new kg,this._defaultValue=t?"color"===(i=t).type&&Cy(i.default)?new pg(0,0,0,0):"color"===i.type?pg.parse(i.default)||null:"padding"===i.type?_g.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?xg.parse(i.default)||null:"projectionDefinition"===i.type?wg.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,o){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new yg(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,typeof console<"u"&&console.warn(e.message)),this._defaultValue}}}function Ey(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in uy}function My(e,t){const i=new zg(uy,my,[],t?function(e){const t={color:Em,string:Cm,number:Bm,enum:Cm,boolean:Sm,formatted:Fm,padding:km,projectionDefinition:Mm,resolvedImage:zm,variableAnchorOffsetCollection:Rm};return"array"===e.type?Dm(t[e.value]||Pm,e.length):t[e.type]}(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?vy(new Sy(r,t)):xy(i.errors)}class Iy{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!_y(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}}class Py{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!_y(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?Wg.interpolationFactor(this.interpolationType,e,t,i):0}}function Ly(e,t){const i=My(e,t);if("error"===i.result)return i;const r=i.value.expression,n=gy(r);if(!n&&!by(t))return xy([new bm("","data expressions not supported")]);const o=yy(r,["zoom"]);if(!o&&!wy(t))return xy([new bm("","zoom expressions not supported")]);const s=Fy(r);if(!s&&!o)return xy([new bm("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof bm)return xy([s]);if(s instanceof Wg&&!Ty(t))return xy([new bm("",'"interpolate" expressions cannot be used with this property')]);if(!s)return vy(new Iy(n?"constant":"source",i.value));const a=s instanceof Wg?s.interpolation:void 0;return vy(new Py(n?"camera":"composite",i.value,s.labels,a))}function Fy(e){let t=null;if(e instanceof Rg)t=Fy(e.result);else if(e instanceof Yg){for(const i of e.args)if(t=Fy(i),t)break}else(e instanceof Gg||e instanceof Wg)&&e.input instanceof hy&&"zoom"===e.input.name&&(t=e);return t instanceof bm||e.eachChild((e=>{const i=Fy(e);i instanceof bm?t=i:!t&&i?t=new bm("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new bm("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function ky(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!ky(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function zy(e){const t=e.key,i=e.value;return i?[new vm(t,i,"constants have been deprecated as of v8")]:[]}function Ry(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Dy(e){if(Array.isArray(e))return e.map(Dy);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=Dy(e[i]);return t}return Ry(e)}function Oy(e){const t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},o=e.style,s=e.styleSpec,a=e.validateSpec;let l=[];const c=By(i);if("object"!==c)return[new vm(t,i,`object expected, ${c} found`)];for(const e in i){const c=e.split(".")[0],u=r[c]||r["*"];let h;if(n[c])h=n[c];else if(r[c])h=a;else if(n["*"])h=n["*"];else{if(!r["*"]){l.push(new vm(t,i[e],`unknown property "${e}"`));continue}h=a}l=l.concat(h({key:(t&&`${t}.`)+e,value:i[e],valueSpec:u,style:o,styleSpec:s,object:i,objectKey:e,validateSpec:a},i))}for(const e in r)n[e]||r[e].required&&void 0===r[e].default&&void 0===i[e]&&l.push(new vm(t,i,`missing required property "${e}"`));return l}function Uy(e){const t=e.value,i=e.valueSpec,r=e.validateSpec,n=e.style,o=e.styleSpec,s=e.key,a=e.arrayElementValidator||r;if("array"!==By(t))return[new vm(s,t,`array expected, ${By(t)} found`)];if(i.length&&t.length!==i.length)return[new vm(s,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.lengthr.maximum?[new vm(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function Qy(e){const t=e.valueSpec,i=Ry(e.value.type);let r,n,o,s={};const a="categorical"!==i&&void 0===e.value.property,l=!a,c="array"===By(e.value.stops)&&"array"===By(e.value.stops[0])&&"object"===By(e.value.stops[0][0]),u=Oy({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new vm(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(Uy({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===By(r)&&0===r.length&&t.push(new vm(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&a&&u.push(new vm(e.key,e.value,'missing required property "property"')),"identity"!==i&&!e.value.stops&&u.push(new vm(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!Ty(e.valueSpec)&&u.push(new vm(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!by(e.valueSpec)?u.push(new vm(e.key,e.value,"property functions not supported")):a&&!wy(e.valueSpec)&&u.push(new vm(e.key,e.value,"zoom functions not supported"))),("categorical"===i||c)&&void 0===e.value.property&&u.push(new vm(e.key,e.value,'"property" property is required')),u;function h(e){let i=[];const r=e.value,a=e.key;if("array"!==By(r))return[new vm(a,r,`array expected, ${By(r)} found`)];if(2!==r.length)return[new vm(a,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==By(r[0]))return[new vm(a,r,`object expected, ${By(r[0])} found`)];if(void 0===r[0].zoom)return[new vm(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new vm(a,r,"object stop key must have value")];if(o&&o>Ry(r[0].zoom))return[new vm(a,r[0].zoom,"stop zoom values must appear in ascending order")];Ry(r[0].zoom)!==o&&(o=Ry(r[0].zoom),n=void 0,s={}),i=i.concat(Oy({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Ny,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:r[0],valueSpec:{},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return Ey(Dy(r[1]))?i.concat([new vm(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(e.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const a=By(e.value),l=Ry(e.value),c=null!==e.value?e.value:o;if(r){if(a!==r)return[new vm(e.key,c,`${a} stop domain type must match previous stop domain type ${r}`)]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new vm(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let r=`number expected, ${a} found`;return by(t)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new vm(e.key,c,r)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==n&&lnew vm(`${e.key}${t.key}`,e.value,t.message)));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new vm(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!_y(i))return[new vm(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!_y(i))return[new vm(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!yy(i,["zoom","feature-state"]))return[new vm(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!gy(i))return[new vm(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Vy(e){const t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(Ry(i))&&n.push(new vm(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(Ry(i))&&n.push(new vm(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function Hy(e){return ky(Dy(e.value))?jy(xm({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Gy(e)}function Gy(e){const t=e.value,i=e.key;if("array"!==By(t))return[new vm(i,t,`array expected, ${By(t)} found`)];const r=e.styleSpec;let n,o=[];if(t.length<1)return[new vm(i,t,"filter array must have at least 1 element")];switch(o=o.concat(Vy({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),Ry(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Ry(t[1])&&o.push(new vm(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new vm(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=By(t[1]),"string"!==n&&o.push(new vm(`${i}[1]`,t[1],`string expected, ${n} found`)));for(let s=2;s{e in i&&t.push(new vm(r,i[e],`"${e}" is prohibited for ref layers`))})),n.layers.forEach((t=>{Ry(t.id)===a&&(e=t)})),e?e.ref?t.push(new vm(r,i.ref,"ref cannot reference another ref layer")):s=Ry(e.type):t.push(new vm(r,i.ref,`ref layer "${a}" not found`))}else if("background"!==s)if(i.source){const e=n.sources&&n.sources[i.source],o=e&&Ry(e.type);e?"vector"===o&&"raster"===s?t.push(new vm(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===s?t.push(new vm(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==s?t.push(new vm(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==s?t.push(new vm(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===s&&i.paint&&i.paint["line-gradient"]&&("geojson"!==o||!e.lineMetrics)&&t.push(new vm(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new vm(r,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new vm(r,i.source,`source "${i.source}" not found`))}else t.push(new vm(r,i,'missing required property "source"'));return t=t.concat(Oy({key:r,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"}),filter:Hy,layout:e=>Oy({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>qy(xm({layerType:s},e))}}),paint:e=>Oy({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Zy(xm({layerType:s},e))}})}})),t}function Wy(e){const t=e.value,i=e.key,r=By(t);return"string"!==r?[new vm(i,t,`string expected, ${r} found`)]:[]}const Xy={promoteId:function({key:e,value:t}){if("string"===By(t))return Wy({key:e,value:t});{const i=[];for(const r in t)i.push(...Wy({key:`${e}.${r}`,value:t[r]}));return i}}};function Yy(e){const t=e.value,i=e.key,r=e.styleSpec,n=e.style,o=e.validateSpec;if(!t.type)return[new vm(i,t,'"type" is required')];const s=Ry(t.type);let a;switch(s){case"vector":case"raster":return a=Oy({key:i,value:t,valueSpec:r[`source_${s.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:Xy,validateSpec:o}),a;case"raster-dem":return a=function(e){var t;const i=null!==(t=e.sourceName)&&void 0!==t?t:"",r=e.value,n=e.styleSpec,o=n.source_raster_dem,s=e.style;let a=[];const l=By(r);if(void 0===r)return a;if("object"!==l)return a.push(new vm("source_raster_dem",r,`object expected, ${l} found`)),a;const c="custom"===Ry(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const t in r)!c&&u.includes(t)?a.push(new vm(t,r[t],`In "${i}": "${t}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[t]?a=a.concat(e.validateSpec({key:t,value:r[t],valueSpec:o[t],validateSpec:e.validateSpec,style:s,styleSpec:n})):a.push(new vm(t,r[t],`unknown property "${t}"`));return a}({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:o}),a;case"geojson":if(a=Oy({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:Xy}),t.cluster)for(const e in t.clusterProperties){const[r,n]=t.clusterProperties[e],s="string"==typeof r?[r,["accumulated"],["get",e]]:r;a.push(...jy({key:`${i}.${e}.map`,value:n,validateSpec:o,expressionContext:"cluster-map"})),a.push(...jy({key:`${i}.${e}.reduce`,value:s,validateSpec:o,expressionContext:"cluster-reduce"}))}return a;case"video":return Oy({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return Oy({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new vm(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Vy({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:o,styleSpec:r})}}function Jy(e){const t=e.value,i=e.styleSpec,r=i.light,n=e.style;let o=[];const s=By(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new vm("light",t,`object expected, ${s} found`)]),o;for(const s in t){const a=s.match(/^(.*)-transition$/);o=a&&r[a[1]]&&r[a[1]].transition?o.concat(e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i})):r[s]?o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i})):o.concat([new vm(s,t[s],`unknown property "${s}"`)])}return o}function ev(e){const t=e.value,i=e.styleSpec,r=i.sky,n=e.style,o=By(t);if(void 0===t)return[];if("object"!==o)return[new vm("sky",t,`object expected, ${o} found`)];let s=[];for(const o in t)s=r[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i})):s.concat([new vm(o,t[o],`unknown property "${o}"`)]);return s}function tv(e){const t=e.value,i=e.styleSpec,r=i.terrain,n=e.style;let o=[];const s=By(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new vm("terrain",t,`object expected, ${s} found`)]),o;for(const s in t)o=r[s]?o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i})):o.concat([new vm(s,t[s],`unknown property "${s}"`)]);return o}function iv(e){let t=[];const i=e.value,r=e.key;if(Array.isArray(i)){const n=[],o=[];for(const s in i){i[s].id&&n.includes(i[s].id)&&t.push(new vm(r,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),n.push(i[s].id),i[s].url&&o.includes(i[s].url)&&t.push(new vm(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),o.push(i[s].url);const a={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(Oy({key:`${r}[${s}]`,value:i[s],valueSpec:a,validateSpec:e.validateSpec}))}return t}return Wy({key:r,value:i})}const rv={"*":()=>[],array:Uy,boolean:function(e){const t=e.value,i=e.key,r=By(t);return"boolean"!==r?[new vm(i,t,`boolean expected, ${r} found`)]:[]},number:Ny,color:function(e){const t=e.key,i=e.value,r=By(i);return"string"!==r?[new vm(t,i,`color expected, ${r} found`)]:pg.parse(String(i))?[]:[new vm(t,i,`color expected, "${i}" found`)]},constants:zy,enum:Vy,filter:Hy,function:Qy,layer:Ky,object:Oy,source:Yy,light:Jy,sky:ev,terrain:tv,projection:function(e){const t=e.value,i=e.styleSpec,r=i.projection,n=e.style,o=By(t);if(void 0===t)return[];if("object"!==o)return[new vm("projection",t,`object expected, ${o} found`)];let s=[];for(const o in t)s=r[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i})):s.concat([new vm(o,t[o],`unknown property "${o}"`)]);return s},projectionDefinition:function(e){const t=e.key;let i=e.value;i=i instanceof String?i.valueOf():i;const r=By(i);return"array"!==r||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(i)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(i)?["array","string"].includes(r)?[]:[new vm(t,i,`projection expected, invalid type "${r}" found`)]:[new vm(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Wy,formatted:function(e){return 0===Wy(e).length?[]:jy(e)},resolvedImage:function(e){return 0===Wy(e).length?[]:jy(e)},padding:function(e){const t=e.key,i=e.value;if("array"===By(i)){if(i.length<1||i.length>4)return[new vm(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let o=0;o[]}})),e.constants&&(i=i.concat(zy({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:nv}))),lv(i)}function av(e){return function(t){return e({...t,validateSpec:nv})}}function lv(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function cv(e){return function(...t){return lv(e.apply(this,t))}}function uv(e){if(!e)return{style:tf[Yp[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0};if("string"==typeof e){const t=function(e){try{const t=JSON.parse(e),i=sv(t);return{isValidJSON:!0,isValidStyle:0===i.length,styleObject:0===i.length?t:null}}catch{return{isValidJSON:!1,isValidStyle:!1,styleObject:null}}}(e);return t.isValidStyle?{style:t.styleObject,requiresUrlMonitoring:!1,isFallback:!1}:t.isValidJSON?{style:tf[Yp[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0}:e.startsWith("http")?{style:e,requiresUrlMonitoring:!0,isFallback:!1}:e.toLowerCase().includes(".json")?{style:hv(e),requiresUrlMonitoring:!0,isFallback:!1}:{style:Kp(e),requiresUrlMonitoring:!0,isFallback:!1}}return e instanceof Wp?{style:e.getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!1}:e instanceof Xp?{style:e.getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!1}:0===sv(e).length?{style:e,requiresUrlMonitoring:!1,isFallback:!1}:{style:tf[Yp[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0}}function hv(e){try{return new URL(e).href}catch{}return new URL(e,location.origin).href}function dv(e,t,i){const r=window.document.createElement(e);return void 0!==t&&(r.className=t),i&&i.appendChild(r),r}function pv(e){e.parentNode&&e.parentNode.removeChild(e)}sv.source=cv(av(Yy)),sv.sprite=cv(av(iv)),sv.glyphs=cv(av(ov)),sv.light=cv(av(Jy)),sv.sky=cv(av(ev)),sv.terrain=cv(av(tv)),sv.layer=cv(av(Ky)),sv.filter=cv(av(Hy)),sv.paintProperty=cv(av(Zy)),sv.layoutProperty=cv(av(qy));class fv{constructor(){AA(this,"_map"),AA(this,"_container"),AA(this,"_terrainButton"),function(e,t){for(const i of e)"function"==typeof t[i]&&(t[i]=t[i].bind(t))}(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=dv("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=dv("button","maplibregl-ctrl-terrain",this._container),dv("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(){pv(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))}}class Av extends rm{constructor(e={}){super({showCompass:e.showCompass??!0,showZoom:e.showZoom??!0,visualizePitch:e.visualizePitch??!0}),AA(this,"_rotateCompassArrow",(()=>{const e=this._map.getBearing(),t=this._map.getPitch(),i=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.cos(t*(Math.PI/180))**.5)}) rotateX(${Math.min(70,t)}deg) rotateZ(${-e}deg)`:`rotate(${-e}deg)`;this._compassIcon.style.transform=i})),this._compass&&(this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",(e=>{0===this._map.getPitch()?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})))}_createButton(e,t){const i=super._createButton(e,t);return i.clickFunction=t,i}}const mv=Te.Marker,gv=Te.LngLat,_v=Te.LngLatBounds;class yv extends nm{constructor(){super(...arguments),AA(this,"lastUpdatedCenter",new gv(0,0)),AA(this,"_updateCamera",(e=>{var t;const i=new gv(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n={bearing:this._map.getBearing(),...this.options.fitBoundsOptions,linear:!0},o=this._map.getZoom();o>((null==(t=this.options.fitBoundsOptions)?void 0:t.maxZoom)??30)&&(n.zoom=o),this._map.fitBounds(_v.fromLngLat(i,r),n,{geolocateSource:!0});let s=!1;const a=()=>{s=!0};this._map.once("click",a),this._map.once("dblclick",a),this._map.once("dragstart",a),this._map.once("mousedown",a),this._map.once("touchstart",a),this._map.once("wheel",a),this._map.once("moveend",(()=>{this._map.off("click",a),this._map.off("dblclick",a),this._map.off("dragstart",a),this._map.off("mousedown",a),this._map.off("touchstart",a),this._map.off("wheel",a),!s&&(this.lastUpdatedCenter=this._map.getCenter())}))})),AA(this,"_finishSetupUI",(e=>{if(this._map){if(!1===e){const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=dv("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new mv({element:this._dotElement}),this._circleElement=dv("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new mv({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",(e=>{const t=e.originalEvent&&"resize"===e.originalEvent.type,i=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!e.geolocateSource&&"ACTIVE_LOCK"===this._watchState&&!t&&i>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))}))}})),AA(this,"_onZoom",(()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}))}_updateCircleRadius(){if("BACKGROUND"!==this._watchState&&"ACTIVE_LOCK"!==this._watchState)return;const e=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],t=this._map.project(e),i=this._map.unproject([t.x,t.y]),r=this._map.unproject([t.x+20,t.y]),n=i.distanceTo(r)/20,o=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_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":case"BACKGROUND_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}}var vv,xv,bv,wv,Tv,Bv,Cv,Sv,Ev,Mv;class Iv{constructor(e,t){_A(this,Cv),_A(this,vv),AA(this,"map"),_A(this,xv),_A(this,bv),_A(this,wv),_A(this,Tv,!1),_A(this,Bv),void 0!==e.style&&yA(this,Tv,!0),yA(this,vv,{zoomAdjust:-4,position:"top-right",...t,forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1,...e,containerStyle:{border:"1px solid #000",width:"400px",height:"300px",...e.containerStyle??{}}}),void 0!==e.lockZoom&&(gA(this,vv).minZoom=e.lockZoom,gA(this,vv).maxZoom=e.lockZoom)}setStyle(e,t){gA(this,Tv)||this.map.setStyle(e,t),vA(this,Cv,Ev).call(this)}addLayer(e,t){return gA(this,Tv)||this.map.addLayer(e,t),vA(this,Cv,Ev).call(this),this.map}moveLayer(e,t){return gA(this,Tv)||this.map.moveLayer(e,t),vA(this,Cv,Ev).call(this),this.map}removeLayer(e){return gA(this,Tv)||this.map.removeLayer(e),vA(this,Cv,Ev).call(this),this}setLayerZoomRange(e,t,i){return gA(this,Tv)||this.map.setLayerZoomRange(e,t,i),vA(this,Cv,Ev).call(this),this}setFilter(e,t,i){return gA(this,Tv)||this.map.setFilter(e,t,i),vA(this,Cv,Ev).call(this),this}setPaintProperty(e,t,i,r){return gA(this,Tv)||this.map.setPaintProperty(e,t,i,r),vA(this,Cv,Ev).call(this),this}setLayoutProperty(e,t,i,r){return gA(this,Tv)||this.map.setLayoutProperty(e,t,i,r),vA(this,Cv,Ev).call(this),this}setGlyphs(e,t){return gA(this,Tv)||this.map.setGlyphs(e,t),vA(this,Cv,Ev).call(this),this}onAdd(e){yA(this,xv,e),yA(this,bv,dv("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[e,t]of Object.entries(gA(this,vv).containerStyle))gA(this,bv).style.setProperty(e,t);return gA(this,vv).container=gA(this,bv),gA(this,vv).zoom=e.getZoom()+gA(this,vv).zoomAdjust,this.map=new zv(gA(this,vv)),this.map.once("style.load",(()=>{this.map.resize()})),this.map.once("load",(()=>{vA(this,Cv,Sv).call(this,gA(this,vv).parentRect),yA(this,Bv,vA(this,Cv,Mv).call(this))})),gA(this,bv)}onRemove(){var e;null==(e=gA(this,Bv))||e.call(this),pv(gA(this,bv))}}vv=new WeakMap,xv=new WeakMap,bv=new WeakMap,wv=new WeakMap,Tv=new WeakMap,Bv=new WeakMap,Cv=new WeakSet,Sv=function(e){void 0===e||void 0===e.linePaint&&void 0===e.fillPaint||(yA(this,wv,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:gA(this,wv)}),(void 0!==e.lineLayout||void 0!==e.linePaint)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:{...e.lineLayout},paint:{"line-color":"#FFF","line-width":1,"line-opacity":.85,...e.linePaint}}),void 0!==e.fillPaint&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:{"fill-color":"#08F","fill-opacity":.135,...e.fillPaint}}),vA(this,Cv,Ev).call(this))},Ev=function(){if(void 0===gA(this,wv))return;const{devicePixelRatio:e}=window,t=gA(this,xv).getCanvas(),i=t.width/e,r=t.height/e,n=gA(this,xv).unproject.bind(gA(this,xv)),o=n([0,0]),s=n([i,0]),a=n([0,r]),l=n([i,r]);gA(this,wv).geometry.coordinates=[[a.toArray(),l.toArray(),s.toArray(),o.toArray(),a.toArray()]];const c=this.map.getSource("parentRect");void 0!==c&&c.setData(gA(this,wv))},Mv=function(){const{pitchAdjust:e}=gA(this,vv),t=()=>{o("parent")},i=()=>{o("minimap")},r=()=>{gA(this,xv).on("move",t),this.map.on("move",i)},n=()=>{gA(this,xv).off("move",t),this.map.off("move",i)},o=t=>{n();const i="parent"===t?gA(this,xv):this.map,o="parent"===t?this.map:gA(this,xv),s=i.getCenter(),a=i.getZoom()+gA(this,vv).zoomAdjust*("parent"===t?1:-1),l=i.getBearing(),c=i.getPitch();o.jumpTo({center:s,zoom:a,bearing:l,pitch:e?c:0}),vA(this,Cv,Ev).call(this),r()};return r(),()=>{n()}};class Pv{constructor(){AA(this,"map"),AA(this,"container"),AA(this,"projectionButton")}onAdd(e){return this.map=e,this.container=dv("div","maplibregl-ctrl maplibregl-ctrl-group"),this.projectionButton=dv("button","maplibregl-ctrl-projection",this.container),dv("span","maplibregl-ctrl-icon",this.projectionButton).setAttribute("aria-hidden","true"),this.projectionButton.type="button",this.projectionButton.addEventListener("click",this.toggleProjection.bind(this)),e.on("projectiontransition",this.updateProjectionIcon.bind(this)),this.updateProjectionIcon(),this.container}onRemove(){pv(this.container),this.map.off("projectiontransition",this.updateProjectionIcon),this.map=void 0}toggleProjection(){void 0===this.map.getProjection()&&this.map.setProjection({type:"mercator"}),this.map.isGlobeProjection()?this.map.enableMercatorProjection():this.map.enableGlobeProjection(),this.updateProjectionIcon()}updateProjectionIcon(){this.projectionButton.classList.remove("maplibregl-ctrl-projection-globe"),this.projectionButton.classList.remove("maplibregl-ctrl-projection-mercator"),this.map.isGlobeProjection()?(this.projectionButton.classList.add("maplibregl-ctrl-projection-mercator"),this.projectionButton.title="Enable Mercator projection"):(this.projectionButton.classList.add("maplibregl-ctrl-projection-globe"),this.projectionButton.title="Enable Globe projection")}}const Lv="3.2.0";class Fv{constructor(e,t=2e3){AA(this,"map"),AA(this,"registeredModules",new Set),this.map=e,setTimeout((async()=>{if(!CA.telemetry)return;const e=this.preparePayload();try{(await fetch(e,{method:"POST"})).ok||console.warn("The metrics could not be sent to MapTiler Cloud")}catch(e){console.warn("The metrics could not be sent to MapTiler Cloud",e)}}),Math.max(1e3,t))}registerModule(e,t){this.registeredModules.add(`${e}:${t}`)}preparePayload(){const e=new URL(wA.telemetryURL);return e.searchParams.append("sdk",Lv),e.searchParams.append("key",CA.apiKey),e.searchParams.append("mtsid",TA),e.searchParams.append("session",CA.session?"1":"0"),e.searchParams.append("caching",CA.caching?"1":"0"),e.searchParams.append("lang-updated",this.map.isLanguageUpdated()?"1":"0"),e.searchParams.append("terrain",this.map.getTerrain()?"1":"0"),e.searchParams.append("globe",this.map.isGlobeProjection()?"1":"0"),this.registeredModules.size>0&&e.searchParams.append("modules",Array.from(this.registeredModules).join("|")),e.href}}const kv={POINT:"POINT",COUNTRY:"COUNTRY"};class zv extends Te.Map{constructor(e){(function(e){const t=UA();if(!t)return;let i=null;if("string"==typeof e?i=document.getElementById(e):e instanceof HTMLElement&&(i=e),!i)throw new Error("The Map container must be provided.");const r=document.createElement("div");throw r.innerHTML=t,r.classList.add("webgl-warning-div"),i.appendChild(r),new Error(t)})(e.container),e.apiKey&&(CA.apiKey=e.apiKey);const{style:t,requiresUrlMonitoring:i,isFallback:r}=uv(e.style);r&&console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style."),CA.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");const n=location.hash;let o={compact:!1};e.customAttribution?o.customAttribution=e.customAttribution:e.attributionControl&&"object"==typeof e.attributionControl&&(o={...o,...e.attributionControl});const s={...e,style:t,maplibreLogo:!1,transformRequest:RA(e.transformRequest),attributionControl:!0!==e.forceNoAttributionControl&&o};delete s.style,super(s),AA(this,"options"),AA(this,"telemetry"),AA(this,"isTerrainEnabled",!1),AA(this,"terrainExaggeration",1),AA(this,"primaryLanguage"),AA(this,"terrainGrowing",!1),AA(this,"terrainFlattening",!1),AA(this,"minimap"),AA(this,"forceLanguageUpdate"),AA(this,"languageAlwaysBeenStyle"),AA(this,"isReady",!1),AA(this,"terrainAnimationDuration",1e3),AA(this,"monitoredStyleUrls"),AA(this,"styleInProcess",!1),AA(this,"curentProjection"),AA(this,"originalLabelStyle",new window.Map),AA(this,"isStyleLocalized",!1),AA(this,"languageIsUpdated",!1),this.options=e,this.setStyle(t),i&&this.monitorStyleUrl(t);const a=()=>{let e="The distant style could not be loaded.";this.getStyle()?e+="Leaving the style as is.":(this.setStyle(tf.STREETS),e+=`Loading default MapTiler Cloud style "${tf.STREETS.getDefaultVariant().getId()}" as a fallback.`),console.warn(e)};if(this.on("style.load",(()=>{this.styleInProcess=!1})),this.on("error",(e=>{if(e.error instanceof Te.AJAXError){const t=e.error.url,i=new URL(t);i.search="";const r=i.href;this.monitoredStyleUrls&&this.monitoredStyleUrls.has(r)&&(this.monitoredStyleUrls.delete(r),a())}else this.styleInProcess&&a()})),CA.caching&&!MA&&console.warn("The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"),CA.caching&&MA&&kA(),typeof e.language>"u")this.primaryLanguage=CA.primaryLanguage;else{const t=kp(e.language,xA);this.primaryLanguage=t??CA.primaryLanguage}this.forceLanguageUpdate=!(this.primaryLanguage===xA.STYLE||this.primaryLanguage===xA.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===xA.STYLE,this.terrainExaggeration=e.terrainExaggeration??this.terrainExaggeration,this.curentProjection=e.projection,this.on("styledata",(()=>{"mercator"===this.curentProjection?this.setProjection({type:"mercator"}):"globe"===this.curentProjection&&this.setProjection({type:"globe"})})),this.once("styledata",(async()=>{if(!e.geolocate||e.center||e.hash&&n)return;try{if(e.geolocate===kv.COUNTRY)return void await this.fitToIpBounds()}catch(e){console.warn(e.message)}let t;try{await this.centerOnIpPoint(e.zoom),t=this.getCameraHash()}catch(e){console.warn(e.message)}"granted"===(await navigator.permissions.query({name:"geolocation"})).state&&navigator.geolocation.getCurrentPosition((i=>{t===this.getCameraHash()&&(this.terrain?this.easeTo({center:[i.coords.longitude,i.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",(()=>{this.easeTo({center:[i.coords.longitude,i.coords.latitude],zoom:e.zoom||12,duration:2e3})})))}),null,{maximumAge:864e5,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",(()=>{this.setPrimaryLanguage(this.primaryLanguage)})),this.on("styledata",(()=>{null===this.getTerrain()&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)})),this.once("load",(async()=>{let t={logo:null};try{const e=Object.keys(this.style.sourceCaches).map((e=>this.getSource(e))).filter((e=>e&&"url"in e&&"string"==typeof e.url&&e.url.includes("tiles.json"))),i=new URL(e[0].url);i.searchParams.has("key")||i.searchParams.append("key",CA.apiKey),t=await(await fetch(i.href)).json()}catch{}if(!0!==e.forceNoAttributionControl)if("logo"in t&&t.logo){const i=t.logo;this.addControl(new _m({logoURL:i}),e.logoPosition)}else e.maptilerLogo&&this.addControl(new _m,e.logoPosition);if(e.scaleControl){const t=!0===e.scaleControl||void 0===e.scaleControl?"bottom-right":e.scaleControl,i=new am({unit:CA.unit});this.addControl(i,t),CA.on("unit",(e=>{i.setUnit(e)}))}if(!1!==e.navigationControl){const t=!0===e.navigationControl||void 0===e.navigationControl?"top-right":e.navigationControl;this.addControl(new Av,t)}if(!1!==e.geolocateControl){const t=!0===e.geolocateControl||void 0===e.geolocateControl?"top-right":e.geolocateControl;this.addControl(new yv({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),t)}if(e.terrainControl){const t=!0===e.terrainControl||void 0===e.terrainControl?"top-right":e.terrainControl;this.addControl(new fv,t)}if(e.projectionControl){const t=!0===e.projectionControl||void 0===e.projectionControl?"top-right":e.projectionControl;this.addControl(new Pv,t)}if(e.fullscreenControl){const t=!0===e.fullscreenControl||void 0===e.fullscreenControl?"top-right":e.fullscreenControl;this.addControl(new lm({}),t)}this.isReady=!0,this.fire("ready",{target:this})}));let l,c=!1,u=!1;this.once("ready",(()=>{c=!0,u&&this.fire("loadWithTerrain",l)})),this.once("style.load",(()=>{const{minimap:t}=e;if("object"==typeof t){const{zoom:i,center:r,style:n,language:o,apiKey:s,maptilerLogo:a,canvasContextAttributes:l,refreshExpiredTiles:c,maxBounds:u,scrollZoom:h,minZoom:d,maxZoom:p,boxZoom:f,locale:A,fadeDuration:m,crossSourceCollisions:g,clickTolerance:_,bounds:y,fitBoundsOptions:v,pixelRatio:x,validateStyle:b}=e;this.minimap=new Iv(t,{zoom:i,center:r,style:n,language:o,apiKey:s,container:"null",maptilerLogo:a,canvasContextAttributes:l,refreshExpiredTiles:c,maxBounds:u,scrollZoom:h,minZoom:d,maxZoom:p,boxZoom:f,locale:A,fadeDuration:m,crossSourceCollisions:g,clickTolerance:_,bounds:y,fitBoundsOptions:v,pixelRatio:x,validateStyle:b}),this.addControl(this.minimap,t.position??"bottom-left")}else!0===t?(this.minimap=new Iv({},e),this.addControl(this.minimap,"bottom-left")):void 0!==t&&!1!==t&&(this.minimap=new Iv({},e),this.addControl(this.minimap,t))}));const h=e=>{e.terrain&&(u=!0,l={type:"loadWithTerrain",target:this,terrain:e.terrain},this.off("terrain",h),c&&this.fire("loadWithTerrain",l))};this.on("terrain",h),e.terrain&&this.enableTerrain(e.terrainExaggeration??this.terrainExaggeration),this.once("load",(()=>{this.getCanvas().addEventListener("webglcontextlost",(e=>{!0!==this._removed?(console.warn("[webglcontextlost]","Unexpected loss of WebGL context!"),this.fire("webglContextLost",e)):console.warn("[webglcontextlost]","WebGL context lost after map removal. This is harmless.")}))})),this.telemetry=new Fv(this)}recreate(){const e={center:this.getCenter(),zoom:this.getZoom(),bearing:this.getBearing(),pitch:this.getPitch()};this.remove(),Object.assign(this,new zv({...this.options})),this.once("load",(()=>{this.jumpTo(e)}))}setTerrainAnimationDuration(e){this.terrainAnimationDuration=Math.max(e,0)}async onLoadAsync(){return new Promise((e=>{this.loaded()?e(this):this.once("load",(()=>{e(this)}))}))}async onReadyAsync(){return new Promise((e=>{this.isReady?e(this):this.once("ready",(()=>{e(this)}))}))}async onLoadWithTerrainAsync(){return new Promise((e=>{this.isReady&&this.terrain?e(this):this.once("loadWithTerrain",(()=>{e(this)}))}))}monitorStyleUrl(e){typeof this.monitoredStyleUrls>"u"&&(this.monitoredStyleUrls=new Set);const t=new URL(e);t.search="",this.monitoredStyleUrls.add(t.href)}setStyle(e,t){var i;this.originalLabelStyle.clear(),null==(i=this.minimap)||i.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",(()=>{this.forceLanguageUpdate=!1}));const r=uv(e);if(r.requiresUrlMonitoring&&this.monitorStyleUrl(r.style),r.isFallback){if(this.getStyle())return console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Keeping the curent style instead."),this;console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style.")}return this.styleInProcess=!0,super.setStyle(r.style,t),this}addLayer(e,t){var i;return null==(i=this.minimap)||i.addLayer(e,t),super.addLayer(e,t)}moveLayer(e,t){var i;return null==(i=this.minimap)||i.moveLayer(e,t),super.moveLayer(e,t)}removeLayer(e){var t;return null==(t=this.minimap)||t.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,t,i){var r;return null==(r=this.minimap)||r.setLayerZoomRange(e,t,i),super.setLayerZoomRange(e,t,i)}setFilter(e,t,i){var r;return null==(r=this.minimap)||r.setFilter(e,t,i),super.setFilter(e,t,i)}setPaintProperty(e,t,i,r){var n;return null==(n=this.minimap)||n.setPaintProperty(e,t,i,r),super.setPaintProperty(e,t,i,r)}setLayoutProperty(e,t,i,r){var n;return null==(n=this.minimap)||n.setLayoutProperty(e,t,i,r),super.setLayoutProperty(e,t,i,r)}setGlyphs(e,t){var i;return null==(i=this.minimap)||i.setGlyphs(e,t),super.setGlyphs(e,t)}getStyleLanguage(){return this.style&&this.style.stylesheet&&this.style.stylesheet.metadata&&"object"==typeof this.style.stylesheet.metadata&&"maptiler:language"in this.style.stylesheet.metadata&&"string"==typeof this.style.stylesheet.metadata["maptiler:language"]?Pp(this.style.stylesheet.metadata["maptiler:language"]):null}setLanguage(e){var t;null==(t=this.minimap)||t.map.setLanguage(e),this.onStyleReady((()=>{this.setPrimaryLanguage(e)}))}setPrimaryLanguage(e){const t=this.getStyleLanguage(),i=kp(e,xA);if(!i)return void console.warn(`The language "${i}" is not supported.`);if((i.flag!==xA.STYLE.flag||!t||t.flag!==xA.AUTO.flag&&t.flag!==xA.VISITOR.flag)&&(i.flag!==xA.STYLE.flag&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===i&&!this.forceLanguageUpdate))return;if(this.primaryLanguage.flag===xA.STYLE_LOCK.flag)return void console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");this.primaryLanguage=i;let r=i;if(i.flag===xA.STYLE.flag){if(!t)return void console.warn("The style has no default languages or has an invalid one.");r=t}let n=xA.LOCAL.flag,o=["get",n];r.flag===xA.VISITOR.flag?(n=bA().flag,o=["case",["all",["has",n],["has",xA.LOCAL.flag]],["case",["==",["get",n],["get",xA.LOCAL.flag]],["get",xA.LOCAL.flag],["format",["get",n],{"font-scale":.8},"\n",["get",xA.LOCAL.flag],{"font-scale":1.1}]],["get",xA.LOCAL.flag]]):r.flag===xA.VISITOR_ENGLISH.flag?(n=xA.ENGLISH.flag,o=["case",["all",["has",n],["has",xA.LOCAL.flag]],["case",["==",["get",n],["get",xA.LOCAL.flag]],["get",xA.LOCAL.flag],["format",["get",n],{"font-scale":.8},"\n",["get",xA.LOCAL.flag],{"font-scale":1.1}]],["get",xA.LOCAL.flag]]):r.flag===xA.AUTO.flag?(n=bA().flag,o=["coalesce",["get",n],["get",xA.LOCAL.flag]]):r===xA.LOCAL?(n=xA.LOCAL.flag,o=["get",n]):(n=r.flag,o=["coalesce",["get",n],["get",xA.LOCAL.flag]]);const{layers:s}=this.getStyle(),a=0===this.originalLabelStyle.size;if(a){const e=function(e,t){const i=[];for(const r of e){if("symbol"!==r.type)continue;const e=r,{id:n,layout:o}=e;if(!o||!("text-field"in o))continue;const s=t.getLayoutProperty(n,"text-field");if(s)if("string"==typeof s){const e=HA(s);i.push(e)}else{const e=$A(s);i.push(e)}}const r=i.flat(),n={unlocalized:0,localized:{}};for(const e of r)null===e?n.unlocalized+=1:(e in n.localized||(n.localized[e]=0),n.localized[e]+=1);return n}(s,this);this.isStyleLocalized=Object.keys(e.localized).length>0}for(const e of s){if("symbol"!==e.type)continue;const t=e,i=this.getSource(t.source);if(!i||!("url"in i)||"string"!=typeof i.url||new URL(i.url).host!==wA.maptilerApiHost)continue;const{id:r,layout:n}=t;if(!n||!("text-field"in n))continue;let s;if(a?(s=this.getLayoutProperty(r,"text-field"),this.originalLabelStyle.set(r,s)):s=this.originalLabelStyle.get(r),"string"==typeof s){const{contains:e,exactMatch:t}=jA(s,this.isStyleLocalized);if(!e)continue;if(t)this.setLayoutProperty(r,"text-field",o);else{const e=VA(s,o,this.isStyleLocalized);this.setLayoutProperty(r,"text-field",e)}}else{const e=QA(s,o,this.isStyleLocalized);this.setLayoutProperty(r,"text-field",e)}}this.languageIsUpdated=!0}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(e){if(!this.terrain)return;const t=performance.now(),i=this.terrain.exaggeration,r=e-i,n=()=>{if(!this.terrain||this.terrainFlattening)return;const o=(performance.now()-t)/this.terrainAnimationDuration;if(o<.99){const e=i+(1-(1-o)**4)*r;this.terrain.exaggeration=e,requestAnimationFrame(n)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=e,this.fire("terrainAnimationStop",{terrain:this.terrain});this._elevationFreeze=!1,this.triggerRepaint()};!this.terrainGrowing&&!this.terrainFlattening&&this.fire("terrainAnimationStart",{terrain:this.terrain}),this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(n)}enableTerrain(e=this.terrainExaggeration){if(e<0)return void console.warn("Terrain exaggeration cannot be negative.");const t=i=>{!this.terrain||"data"!==i.type||"source"!==i.dataType||!("source"in i)||"maptiler-terrain"!==i.sourceId||"raster-dem"!==i.source.type||i.isSourceLoaded&&(this.off("data",t),this.growTerrain(e))},i=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=e,this.on("data",t),this.addSource(wA.terrainSourceId,{type:"raster-dem",url:wA.terrainSourceURL}),this.setTerrain({source:wA.terrainSourceId,exaggeration:0})};if(this.getTerrain())return this.isTerrainEnabled=!0,void this.growTerrain(e);this.loaded()||this.isTerrainEnabled?i():this.once("load",(()=>{this.getTerrain()&&this.getSource(wA.terrainSourceId)||i()}))}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const e=performance.now(),t=this.terrain.exaggeration,i=()=>{if(!this.terrain||this.terrainGrowing)return;const r=(performance.now()-e)/this.terrainAnimationDuration;if(this._elevationFreeze=!1,r<.99){const e=t*(1-r)**4;this.terrain.exaggeration=e,requestAnimationFrame(i)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(wA.terrainSourceId)&&this.removeSource(wA.terrainSourceId),this.fire("terrainAnimationStop",{terrain:null});this.triggerRepaint()};!this.terrainGrowing&&!this.terrainFlattening&&this.fire("terrainAnimationStart",{terrain:this.terrain}),this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(i)}setTerrainExaggeration(e,t=!0){!t&&this.terrain?(this.terrainExaggeration=e,this.terrain.exaggeration=e,this.triggerRepaint()):this.enableTerrain(e)}onStyleReady(e){this.isStyleLoaded()?e():this.once("styledata",(()=>{e()}))}async fitToIpBounds(){const e=await Hp.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})}async centerOnIpPoint(e){const t=await Hp.info();this.jumpTo({center:[t.longitude??0,t.latitude??0],zoom:e||11})}getCameraHash(){const e=new Float32Array(5),t=this.getCenter();return e[0]=t.lng,e[1]=t.lat,e[2]=this.getZoom(),e[3]=this.getPitch(),e[4]=this.getBearing(),dA(new Uint8Array(e.buffer))}getSdkConfig(){return CA}getMaptilerSessionId(){return TA}setTransformRequest(e){return super.setTransformRequest(RA(e)),this}isGlobeProjection(){const e=this.getProjection();return!!e&&"globe"===e.type}enableGlobeProjection(){!0!==this.isGlobeProjection()&&(this.setProjection({type:"globe"}),this.curentProjection="globe")}enableMercatorProjection(){!1!==this.isGlobeProjection()&&(this.setProjection({type:"mercator"}),this.curentProjection="mercator")}isLanguageUpdated(){return this.languageIsUpdated}}function Rv(e){if(typeof DOMParser<"u"){const t=(new DOMParser).parseFromString(e,"application/xml");if(t.querySelector("parsererror"))throw new Error("The provided string is not valid XML");return t}throw new Error("No XML parser found")}function Dv(e,t){if(!e.hasChildNodes())return!1;for(const i of Array.from(e.childNodes)){const e=i.nodeName;if("string"==typeof e&&e.trim().toLowerCase()===t.toLowerCase())return!0}return!1}function Ov(e){if(typeof XMLSerializer<"u")return(new XMLSerializer).serializeToString(e);throw new Error("No XML serializer found")}function Uv(e){const t="string"==typeof e?Rv(e):e;if(!Dv(t,"gpx"))throw new Error("The XML document is not valid GPX");const i=Jv(t,"trk"),r=Jv(t,"rte"),n=Jv(t,"wpt"),o={type:"FeatureCollection",features:[]};for(const e of Array.from(i)){const t=Zv(e);t&&o.features.push(t)}for(const e of Array.from(r)){const t=qv(e);t&&o.features.push(t)}for(const e of Array.from(n))o.features.push(Kv(e));return o}function Nv(e,t){let i=e;if("string"==typeof i&&(i=Rv(i)),!Dv(i,"kml"))throw new Error("The XML document is not valid KML");const r={type:"FeatureCollection",features:[]},n={},o={},s={},a=Jv(i,"Placemark"),l=Jv(i,"Style"),c=Jv(i,"StyleMap");for(const e of Array.from(l)){const i=Yv(void 0!==t?t(e):Ov(e)).toString(16);n[`#${ex(e,"id")}`]=i,o[i]=e}for(const e of Array.from(c)){n[`#${ex(e,"id")}`]=Yv(void 0!==t?t(e):Ov(e)).toString(16);const i=Jv(e,"Pair"),r={};for(const e of Array.from(i))r[nx(ix(e,"key"))??""]=nx(ix(e,"styleUrl"));s[`#${ex(e,"id")}`]=r}for(const e of Array.from(a))r.features=r.features.concat(Gv(e,n,o,s));return r}function Qv(e){if(null===e)return["#000000",1];let t="",i=1,r=e;return r.startsWith("#")&&(r=r.substring(1)),(6===r.length||3===r.length)&&(t=r),8===r.length&&(i=Number.parseInt(r.substring(0,2),16)/255,t=`#${r.substring(6,8)}${r.substring(4,6)}${r.substring(2,4)}`),[t??"#000000",i??1]}function jv(e){return rx(e.split(" "))}function Vv(e){let t=Jv(e,"coord");const i=[],r=[];0===t.length&&(t=Jv(e,"gx:coord"));for(const e of Array.from(t))i.push(jv(nx(e)??""));const n=Jv(e,"when");for(const e of Array.from(n))r.push(nx(e));return{coords:i,times:r}}function Hv(e){const t=["Polygon","LineString","Point","Track","gx:Track"];let i,r,n,o,s;const a=[],l=[];if(null!==ix(e,"MultiGeometry"))return Hv(ix(e,"MultiGeometry"));if(null!==ix(e,"MultiTrack"))return Hv(ix(e,"MultiTrack"));if(null!==ix(e,"gx:MultiTrack"))return Hv(ix(e,"gx:MultiTrack"));for(n=0;nNumber.isNaN(e)?null:e))}function nx(e){return e&&function(e){e.normalize&&e.normalize()}(e),e&&e.textContent}function ox(e,t){const i={};let r,n;for(n=0;n=e[e.length-1].zoom)return e[e.length-1].value;for(let i=0;i=e[i].zoom&&t[e.zoom,e.value]))]}function mx(e){return["interpolate",["linear"],["zoom"],...e.flatMap((e=>[e.zoom,e.value]))]}function gx(e,t){if("number"==typeof t&&"number"==typeof e)return 2*t+e;if("number"==typeof t&&Array.isArray(e))return["interpolate",["linear"],["zoom"],...e.flatMap((e=>[e.zoom,2*t+e.value]))];if("number"==typeof e&&Array.isArray(t))return["interpolate",["linear"],["zoom"],...t.flatMap((t=>[t.zoom,2*t.value+e]))];if(Array.isArray(e)&&Array.isArray(t)){return["interpolate",["linear"],["zoom"],...Array.from(new Set([...e.map((e=>e.zoom)),...t.map((e=>e.zoom))])).sort(((e,t)=>e[i,2*fx(t,i)+fx(e,i)]))]}return 0}function _x(e,t){return["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,e.value]))]}function yx(e){const t=e.trimStart(),i=`${t}${" ".repeat(e.length-t.length)}`,r=Array.from(i);if(!r.every((e=>" "===e||"_"===e)))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!r.some((e=>"_"===e))||!r.some((e=>" "===e)))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const n=[1];for(let e=1;e[e.value,e.color]))]}function xx(e,t,i=!0){return i?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.025*e.pointRadius]))],2,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.05*e.pointRadius]))],4,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.1*e.pointRadius]))],8,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.25*e.pointRadius]))],16,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,e.pointRadius]))]]:["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,e.pointRadius]))]}function bx(e,t,i=!0){return i?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.025*e.value]))],2,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.05*e.value]))],4,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.1*e.value]))],8,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.25*e.value]))],16,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,e.value]))]]:["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,e.value]))]}function wx(e,t){return e.every((t=>t.color[3]===e[0].color[3]))?e[0].color[3]?e[0].color[3]/255:1:["interpolate",["linear"],["get",t],...e.getRawColorStops().flatMap((e=>{const t=e.value,i=e.color;return[t,4===i.length?i[3]/255:1]}))]}function Tx(e,t=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:t+1},((i,r)=>{const n=r/t;return[n,e.getColorHex(n)]})).flat()]}function Bx(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}class Cx extends Array{constructor(e={}){super(),AA(this,"min",0),AA(this,"max",1),"min"in e&&(this.min=e.min),"max"in e&&(this.max=e.max),"stops"in e&&this.setStops(e.stops,{clone:!1})}static fromArrayDefinition(e){return new Cx({stops:e.map((e=>({value:e[0],color:e[1]})))})}setStops(e,t={clone:!0}){const i=t.clone?this.clone():this;i.length=0;let r=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(let t=0;te.value=this.at(-1).value)return this.at(-1).color;for(let i=0;ithis[i+1].value)continue;const r=this[i].color;if(!t.smooth)return r.slice();const n=this[i].value,o=this[i+1].value,s=this[i+1].color,a=(o-e)/(o-n);return r.map(((e,t)=>Math.round(e*a+s[t]*(1-a))))}return[0,0,0]}getColorHex(e,t={smooth:!0,withAlpha:!1}){return`#${Bx((i=this.getColor(e,t))[0])}${Bx(i[1])}${Bx(i[2])}${4===i.length?Bx(i[3]):""}`;var i}getColorRelative(e,t={smooth:!0}){const i=this.getBounds();return this.getColor(i.min+e*(i.max-i.min),t)}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){const t=document.createElement("canvas");t.width=e.horizontal?e.size:1,t.height=e.horizontal?1:e.size;const i=t.getContext("2d");if(!i)throw new Error("Canvs context is missing");const r=i.getImageData(0,0,t.width,t.height),n=r.data,o=e.size,s=this[0].value,a=(this.at(-1).value-s)/o;for(let t=0;t3?i[3]:255}return i.putImageData(r,0,0),t}resample(e,t=15){const i=this.getBounds(),r=this.scale(0,1),n=1/(t-1);let o;if("ease-in-square"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=i**2;return{value:i,color:r.getColor(o)}}));else if("ease-out-square"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=1-(1-i)**2;return{value:i,color:r.getColor(o)}}));else if("ease-out-sqrt"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=i**.5;return{value:i,color:r.getColor(o)}}));else if("ease-in-sqrt"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=1-(1-i)**.5;return{value:i,color:r.getColor(o)}}));else if("ease-out-exp"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=1-2**(-10*i);return{value:i,color:r.getColor(o)}}));else{if("ease-in-exp"!==e)throw new Error("Invalid ressampling method.");o=Array.from({length:t},((e,t)=>{const i=t*n,o=2**(10*i-10);return{value:i,color:r.getColor(o)}}))}return new Cx({stops:o}).scale(i.min,i.max)}transparentStart(){const e=this.getRawColorStops();e.unshift({value:e[0].value,color:e[0].color.slice()}),e[1].value+=.001;for(const t of e)3===t.color.length&&t.color.push(255);return e[0].color[3]=0,new Cx({stops:e})}hasTransparentStart(){return 4===this[0].color.length&&0===this[0].color[3]}}const Sx={NULL:new Cx({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new Cx({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new Cx({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),HSV:new Cx({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),HOT:new Cx({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),SPRING:new Cx({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new Cx({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new Cx({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new Cx({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new Cx({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),COPPER:new Cx({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new Cx({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new Cx({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]},{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),GREENS:new Cx({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),YIORRD:new Cx({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),BLUERED:new Cx({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new Cx({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),PICNIC:new Cx({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),RAINBOW:new Cx({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]},{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),PORTLAND:new Cx({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),BLACKBODY:new Cx({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),EARTH:new Cx({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),ELECTRIC:new Cx({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),VIRIDIS:new Cx({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),INFERNO:new Cx({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),MAGMA:new Cx({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),PLASMA:new Cx({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),WARM:new Cx({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),COOL:new Cx({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),RAINBOW_SOFT:new Cx({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),BATHYMETRY:new Cx({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]},{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),CDOM:new Cx({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),CHLOROPHYLL:new Cx({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),DENSITY:new Cx({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),FREESURFACE_BLUE:new Cx({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]},{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),FREESURFACE_RED:new Cx({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),OXYGEN:new Cx({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),PAR:new Cx({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),PHASE:new Cx({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),SALINITY:new Cx({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),TEMPERATURE:new Cx({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),TURBIDITY:new Cx({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),VELOCITY_BLUE:new Cx({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),VELOCITY_GREEN:new Cx({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),CUBEHELIX:new Cx({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),CIVIDIS:new Cx({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]},{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),TURBO:new Cx({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),ROCKET:new Cx({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),MAKO:new Cx({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]},{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]})};const Ex=Object.freeze(Object.defineProperty({__proto__:null,addHeatmap:function(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.sourceId??dx(),r=t.layerId??px(),n=t.minzoom??0,o=t.maxzoom??23,s=t.zoomCompensation??!0,a=t.opacity??[{zoom:n,value:0},{zoom:n+.25,value:1},{zoom:o-.25,value:1},{zoom:o,value:0}];let l=Array.isArray(t.colorRamp)?t.colorRamp:Sx.TURBO.transparentStart();const c=l.getBounds();(0!==c.min||1!==c.max)&&(l=l.scale(0,1)),l.hasTransparentStart()||(l=l.transparentStart());const u=t.intensity??[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],h=t.property??null,d=t.weight??1;let p=1;h?"number"==typeof d?(p=d,"number"==typeof t.weight&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(d)?p=_x(d,h):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):"number"==typeof d?p=d:Array.isArray(d)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const f=[{zoom:0,value:1.25},{zoom:2,value:2.5},{zoom:4,value:5},{zoom:8,value:12.5},{zoom:16,value:50}],A=t.radius??(s?f:10);let m=1;"number"==typeof A?m=A:Array.isArray(A)&&"zoom"in A[0]?m=mx(A):h&&Array.isArray(A)&&"propertyValue"in A[0]?m=bx(A,h,s):!h&&Array.isArray(A)&&"propertyValue"in A[0]?(m=mx(f),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):m=mx(f);const g={heatmapLayerId:r,heatmapSourceId:i};if(t.data&&!e.getSource(i)){let r=t.data;"string"==typeof r&&OA(r)&&(r=`https://api.maptiler.com/data/${r}/features.json?key=${CA.apiKey}`),e.addSource(i,{type:"geojson",data:r})}return e.addLayer({id:r,type:"heatmap",source:i,minzoom:n,maxzoom:o,paint:{"heatmap-weight":p,"heatmap-intensity":"number"==typeof u?u:mx(u),"heatmap-color":Tx(l),"heatmap-radius":m,"heatmap-opacity":"number"==typeof a?a:mx(a)}},t.beforeId),g},addPoint:function(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.minPointRadius??10,r=t.maxPointRadius??50,n=t.cluster??!1,o=20,s=Array.isArray(t.pointColor)?t.pointColor:Sx.TURBO.scale(10,t.cluster?1e4:1e3).resample("ease-out-square"),a=s.getBounds(),l=t.sourceId??dx(),c=t.layerId??px(),u=t.showLabel??n,h=t.alignOnViewport??!0,d=t.outline??!1,p=t.outlineOpacity??1,f=t.outlineWidth??1,A=t.outlineColor??"#FFFFFF";let m;const g=t.zoomCompensation??!0,_=t.minzoom??0,y=t.maxzoom??23;m="number"==typeof t.pointOpacity?t.pointOpacity:Array.isArray(t.pointOpacity)?mx(t.pointOpacity):t.cluster?wx(s,"point_count"):t.property?wx(s,t.property):mx([{zoom:_,value:0},{zoom:_+.25,value:1},{zoom:y-.25,value:1},{zoom:y,value:0}]);const v={pointLayerId:c,clusterLayerId:"",labelLayerId:"",pointSourceId:l};if(t.data&&!e.getSource(l)){let i=t.data;"string"==typeof i&&OA(i)&&(i=`https://api.maptiler.com/data/${i}/features.json?key=${CA.apiKey}`),e.addSource(l,{type:"geojson",data:i,cluster:n})}if(n){v.clusterLayerId=`${c}_cluster`;const n=Array.from({length:o},((e,t)=>{const n=a.min+t*(a.max-a.min)/19;return{value:n,pointRadius:i+(r-i)*(t/19)**.5,color:s.getColorHex(n)}}));e.addLayer({id:v.clusterLayerId,type:"circle",source:l,filter:["has","point_count"],paint:{"circle-color":"string"==typeof t.pointColor?t.pointColor:vx(n,"point_count"),"circle-radius":"number"==typeof t.pointRadius?t.pointRadius:Array.isArray(t.pointRadius)?mx(t.pointRadius):xx(n,"point_count",!1),"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-opacity":m,...d&&{"circle-stroke-opacity":"number"==typeof p?p:mx(p),"circle-stroke-width":"number"==typeof f?f:mx(f),"circle-stroke-color":"string"==typeof A?A:Ax(A)}},minzoom:_,maxzoom:y},t.beforeId),e.addLayer({id:v.pointLayerId,type:"circle",source:l,filter:["!",["has","point_count"]],paint:{"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-color":"string"==typeof t.pointColor?t.pointColor:s.getColorHex(s.getBounds().min),"circle-radius":"number"==typeof t.pointRadius?t.pointRadius:Array.isArray(t.pointRadius)?mx(t.pointRadius):.75*n[0].pointRadius,"circle-opacity":m,...d&&{"circle-stroke-opacity":"number"==typeof p?p:mx(p),"circle-stroke-width":"number"==typeof f?f:mx(f),"circle-stroke-color":"string"==typeof A?A:Ax(A)}},minzoom:_,maxzoom:y},t.beforeId)}else{let n="string"==typeof t.pointColor?t.pointColor:Array.isArray(t.pointColor)?t.pointColor.getColorHex(t.pointColor.getBounds().min):hx(),c="number"==typeof t.pointRadius?g?mx([{zoom:0,value:.025*t.pointRadius},{zoom:2,value:.05*t.pointRadius},{zoom:4,value:.1*t.pointRadius},{zoom:8,value:.25*t.pointRadius},{zoom:16,value:1*t.pointRadius}]):t.pointRadius:Array.isArray(t.pointRadius)?mx(t.pointRadius):g?mx([{zoom:0,value:.05*i},{zoom:2,value:.1*i},{zoom:4,value:.2*i},{zoom:8,value:.5*i},{zoom:16,value:1*i}]):i;if(t.property&&Array.isArray(t.pointColor)){const e=Array.from({length:o},((e,n)=>{const o=a.min+n*(a.max-a.min)/19;return{value:o,pointRadius:"number"==typeof t.pointRadius?t.pointRadius:i+(r-i)*(n/19)**.5,color:"string"==typeof t.pointColor?t.pointColor:s.getColorHex(o)}}));n=vx(e,t.property),c=xx(e,t.property,g)}e.addLayer({id:v.pointLayerId,type:"circle",source:l,layout:{"circle-sort-key":t.property?["/",1,["get",t.property]]:0},paint:{"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-color":n,"circle-opacity":m,"circle-radius":c,...d&&{"circle-stroke-opacity":"number"==typeof p?p:mx(p),"circle-stroke-width":"number"==typeof f?f:mx(f),"circle-stroke-color":"string"==typeof A?A:Ax(A)}},minzoom:_,maxzoom:y},t.beforeId)}if(!1!==u&&(t.cluster||t.property)){v.labelLayerId=`${c}_label`;const i=t.labelColor??"#fff",r=t.labelSize??12;e.addLayer({id:v.labelLayerId,type:"symbol",source:l,filter:["has",t.cluster?"point_count":t.property],layout:{"text-field":t.cluster?"{point_count_abbreviated}":`{${t.property}}`,"text-font":["Noto Sans Regular"],"text-size":r,"text-pitch-alignment":h?"viewport":"map","symbol-sort-key":["/",1,["get",t.cluster?"point_count":t.property]]},paint:{"text-color":i,"text-opacity":m},minzoom:_,maxzoom:y},t.beforeId)}return v},addPolygon:function(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.sourceId??dx(),r=t.layerId??px(),n={polygonLayerId:r,polygonOutlineLayerId:t.outline?`${r}_outline`:"",polygonSourceId:i};if(t.data&&!e.getSource(i)){let r=t.data;"string"==typeof r&&OA(r)&&(r=`https://api.maptiler.com/data/${r}/features.json?key=${CA.apiKey}`),e.addSource(i,{type:"geojson",data:r})}let o=t.outlineDashArray??null;const s=t.outlineWidth??1,a=t.outlineColor??"#FFFFFF",l=t.outlineOpacity??1,c=t.outlineBlur??0,u=t.fillColor??hx(),h=t.fillOpacity??1,d=t.outlinePosition??"center",p=t.pattern??null;"string"==typeof o&&(o=yx(o));const f=(p=null)=>{if(e.addLayer({id:r,type:"fill",source:i,minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"fill-color":"string"==typeof u?u:Ax(u),"fill-opacity":"number"==typeof h?h:mx(h),...p&&{"fill-pattern":p}}},t.beforeId),!0===t.outline){let r;r="inside"===d?"number"==typeof s?.5*s:mx(s.map((({zoom:e,value:t})=>({zoom:e,value:.5*t})))):"outside"===d?"number"==typeof s?-.5*s:mx(s.map((e=>({zoom:e.zoom,value:-.5*e.value})))):0,e.addLayer({id:n.polygonOutlineLayerId,type:"line",source:i,layout:{"line-join":t.outlineJoin??"round","line-cap":t.outlineCap??"butt"},minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"line-opacity":"number"==typeof l?l:mx(l),"line-color":"string"==typeof a?a:Ax(a),"line-width":"number"==typeof s?s:mx(s),"line-blur":"number"==typeof c?c:mx(c),"line-offset":r,...o&&{"line-dasharray":o}}},t.beforeId)}};return p?e.hasImage(p)?f(p):e.loadImage(p).then((t=>{e.addImage(p,t.data),f(p)})).catch((e=>{console.error("Could not load the pattern image.",e.message),f()})):f(),n},addPolyline:async function(e,t,i={}){var r,n;if(!t.sourceId&&!t.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let o=t.data;if("string"==typeof o){if(OA(o))o=`https://api.maptiler.com/data/${t.data}/features.json?key=${CA.apiKey}`;else if("gpx"===(null==(r=o.split(".").pop())?void 0:r.toLowerCase().trim())){o=Uv(await(await fetch(o,i)).text())}else if("kml"===(null==(n=o.split(".").pop())?void 0:n.toLowerCase().trim())){o=Nv(await(await fetch(o,i)).text())}else{const e=function(e){try{return JSON.parse(e)}catch{}return null}(o)??cx(o);e&&(o=e)}if(!o)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return function(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.sourceId??dx(),r=t.layerId??px(),n={polylineLayerId:r,polylineOutlineLayerId:"",polylineSourceId:i};t.data&&!e.getSource(i)&&e.addSource(i,{type:"geojson",data:t.data});const o=t.lineWidth??3,s=t.lineColor??hx(),a=t.lineOpacity??1,l=t.lineBlur??0,c=t.lineGapWidth??0;let u=t.lineDashArray??null;const h=t.outlineWidth??1,d=t.outlineColor??"#FFFFFF",p=t.outlineOpacity??1,f=t.outlineBlur??0;if("string"==typeof u&&(u=yx(u)),!0===t.outline){const s=`${r}_outline`;n.polylineOutlineLayerId=s,e.addLayer({id:s,type:"line",source:i,layout:{"line-join":t.lineJoin??"round","line-cap":t.lineCap??"round"},minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"line-opacity":"number"==typeof p?p:mx(p),"line-color":"string"==typeof d?d:Ax(d),"line-width":gx(o,h),"line-blur":"number"==typeof f?f:mx(f)}},t.beforeId)}return e.addLayer({id:r,type:"line",source:i,layout:{"line-join":t.lineJoin??"round","line-cap":t.lineCap??"round"},minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"line-opacity":"number"==typeof a?a:mx(a),"line-color":"string"==typeof s?s:Ax(s),"line-width":"number"==typeof o?o:mx(o),"line-blur":"number"==typeof l?l:mx(l),"line-gap-width":"number"==typeof c?c:mx(c),...u&&{"line-dasharray":u}}},t.beforeId),n}(e,{...t,data:o})},colorDrivenByProperty:vx,colorPalettes:ux,computeRampedOutlineWidth:gx,dashArrayMaker:yx,generateRandomLayerName:px,generateRandomSourceName:dx,getRandomColor:hx,heatmapIntensityFromColorRamp:Tx,lerpZoomNumberValues:fx,opacityDrivenByProperty:wx,paintColorOptionsToPaintSpec:Ax,radiusDrivenByProperty:xx,radiusDrivenByPropertyHeatmap:bx,rampedOptionsToLayerPaintSpec:mx,rampedPropertyValueWeight:_x,takeScreenshot:async function(e,t={}){const i=t.download??!1,r=await function(e){return new Promise(((t,i)=>{e.redraw(),e.once("idle",(()=>{e.getCanvas().toBlob((e=>{e?t(e):i(Error("Screenshot could not be created."))}),"image/png")}))}))}(e);if(i){const e=t.filename??"maptiler_screenshot.png",i=document.createElement("a");i.style.display="none",document.body.appendChild(i),i.href=URL.createObjectURL(r),i.download=e,i.click(),setTimeout((()=>{document.body.removeChild(i),URL.revokeObjectURL(i.href)}),0)}return r}},Symbol.toStringTag,{value:"Module"}));!function(){if(typeof window>"u")return;const e=Te.getRTLTextPluginStatus();if("unavailable"===e||"requested"===e)try{Te.setRTLTextPlugin(wA.rtlPluginURL,!0)}catch{}}();const Mx=Te.Map,Ix=Te.Marker,Px=Te.Popup,Lx=Te.Style,Fx=Te.CanvasSource,kx=Te.GeoJSONSource,zx=Te.ImageSource,Rx=Te.RasterTileSource,Dx=Te.RasterDEMTileSource,Ox=Te.VectorTileSource,Ux=Te.VideoSource,Nx=Te.NavigationControl,Qx=Te.GeolocateControl,jx=Te.AttributionControl,Vx=Te.LogoControl,Hx=Te.ScaleControl,Gx=Te.FullscreenControl,$x=Te.TerrainControl,Zx=Te.BoxZoomHandler,qx=Te.ScrollZoomHandler,Kx=Te.CooperativeGesturesHandler,Wx=Te.KeyboardHandler,Xx=Te.TwoFingersTouchPitchHandler,Yx=Te.MapWheelEvent,Jx=Te.MapTouchEvent,eb=Te.MapMouseEvent,tb=Te.config,ib=Te.getVersion,{setRTLTextPlugin:rb,getRTLTextPluginStatus:nb,LngLat:ob,LngLatBounds:sb,MercatorCoordinate:ab,Evented:lb,AJAXError:cb,prewarm:ub,clearPrewarmedResources:hb,Hash:db,Point:pb,EdgeInsets:fb,DragRotateHandler:Ab,DragPanHandler:mb,TwoFingersTouchZoomRotateHandler:gb,DoubleClickZoomHandler:_b,TwoFingersTouchZoomHandler:yb,TwoFingersTouchRotateHandler:vb,getWorkerCount:xb,setWorkerCount:bb,getMaxParallelImageRequests:wb,setMaxParallelImageRequests:Tb,getWorkerUrl:Bb,setWorkerUrl:Cb,addSourceType:Sb,importScriptInWorkers:Eb,addProtocol:Mb,removeProtocol:Ib}=Te;var Pb=Object.freeze({__proto__:null,AJAXError:cb,AttributionControl:om,AttributionControlMLGL:jx,BoxZoomHandler:um,BoxZoomHandlerMLGL:Zx,CanvasSource:WA,CanvasSourceMLGL:Fx,ColorRamp:Cx,ColorRampCollection:Sx,CooperativeGesturesHandler:dm,CooperativeGesturesHandlerMLGL:Kx,DOMcreate:dv,DOMremove:pv,DoubleClickZoomHandler:_b,DragPanHandler:mb,DragRotateHandler:Ab,EdgeInsets:fb,Evented:lb,FullscreenControl:lm,FullscreenControlMLGL:Gx,GeoJSONSource:XA,GeoJSONSourceMLGL:kx,GeolocateControl:nm,GeolocateControlMLGL:Qx,GeolocationType:kv,Hash:db,ImageSource:YA,ImageSourceMLGL:zx,KeyboardHandler:pm,KeyboardHandlerMLGL:Wx,Language:xA,LngLat:ob,LngLatBounds:sb,LogoControl:sm,LogoControlMLGL:Vx,Map:zv,MapMLGL:Mx,MapMouseEvent:gm,MapMouseEventMLGL:eb,MapStyle:tf,MapStyleVariant:Wp,MapTouchEvent:mm,MapTouchEventMLGL:Jx,MapWheelEvent:Am,MapWheelEventMLGL:Yx,MaptilerGeolocateControl:yv,MaptilerLogoControl:_m,MaptilerNavigationControl:Av,MaptilerProjectionControl:Pv,MaptilerTerrainControl:fv,Marker:ZA,MarkerMLGL:Ix,MercatorCoordinate:ab,NavigationControMLGL:Nx,NavigationControl:rm,Point:pb,Popup:qA,PopupMLGL:Px,RasterDEMTileSource:em,RasterDEMTileSourceMLGL:Dx,RasterTileSource:JA,RasterTileSourceMLGL:Rx,ReferenceMapStyle:Xp,ScaleControl:am,ScaleControlMLGL:Hx,ScrollZoomHandler:hm,ScrollZoomHandlerMLGL:qx,SdkConfig:BA,ServiceError:Dp,Style:KA,StyleMLGL:Lx,TerrainControMLGL:$x,TerrainControl:cm,TwoFingersTouchPitchHandler:fm,TwoFingersTouchPitchHandlerMLGL:Xx,TwoFingersTouchRotateHandler:vb,TwoFingersTouchZoomHandler:yb,TwoFingersTouchZoomRotateHandler:gb,VectorTileSource:tm,VectorTileSourceMLGL:Ox,VideoSource:im,VideoSourceMLGL:Ux,addProtocol:Mb,addSourceType:Sb,areSameLanguages:function(e,t,i=Ep){const r=kp(e,i),n=kp(t,i);return r&&n&&r.flag===n.flag},bufferToPixelDataBrowser:Cf,circumferenceAtLatitude:yf,clearPrewarmedResources:hb,config:CA,configMLGL:tb,coordinates:$p,data:qp,displayWebGLContextLostWarning:function(e){const t=e.getContainer(),i=document.createElement("div");i.innerHTML="The WebGL context was lost.",i.classList.add("webgl-warning-div"),t.appendChild(i)},elevation:Lf,expandMapStyle:Kp,geocoding:jp,geolocation:Hp,getAutoLanguage:Lp,getBrowserLanguage:bA,getBufferToPixelDataParser:Sf,getLanguageInfoFromCode:Ip,getLanguageInfoFromFlag:Pp,getLanguageInfoFromKey:Mp,getMapLibreVersion:ib,getMaxParallelImageRequests:wb,getRTLTextPluginStatus:nb,getTileCache:Bf,getVersion:function(){return"3.2.0"},getWebGLSupportError:UA,getWorkerCount:xb,getWorkerUrl:Bb,gpx:Uv,gpxOrKml:cx,hasChildNodeWithName:Dv,helpers:Ex,importScriptInWorkers:Eb,isLanguageInfo:Fp,kml:Nv,mapStylePresetList:Yp,math:wf,misc:sf,prewarm:ub,removeProtocol:Ib,setMaxParallelImageRequests:Tb,setRTLTextPlugin:rb,setWorkerCount:bb,setWorkerUrl:Cb,staticMaps:cf,str2xml:Rv,styleToStyle:ef,toLanguageInfo:kp,xml2str:Ov}),Lb=Object.freeze({__proto__:null,default:undefined});export{wp as startApp}; //# sourceMappingURL=bundle.js.map diff --git a/dist/bundle.js.map b/dist/bundle.js.map index 9c7ff3b..309d4df 100644 --- a/dist/bundle.js.map +++ b/dist/bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"bundle.js","sources":["../node_modules/svelte/internal/index.mjs","../node_modules/mapbox-gl/dist/mapbox-gl.js","../node_modules/maplibre-gl/dist/maplibre-gl.js","../node_modules/svelte/store/index.mjs","../src/stores.js","../src/presets-utils.js","../src/math.js","../node_modules/lodash.throttle/index.js","../node_modules/object-keys/implementation.js","../node_modules/object-keys/isArguments.js","../node_modules/object-keys/index.js","../node_modules/es-define-property/index.js","../node_modules/es-errors/syntax.js","../node_modules/es-errors/type.js","../node_modules/gopd/index.js","../node_modules/gopd/gOPD.js","../node_modules/define-data-property/index.js","../node_modules/has-property-descriptors/index.js","../node_modules/define-properties/index.js","../node_modules/dunder-proto/get.js","../node_modules/es-object-atoms/index.js","../node_modules/es-errors/index.js","../node_modules/es-errors/eval.js","../node_modules/es-errors/range.js","../node_modules/es-errors/ref.js","../node_modules/es-errors/uri.js","../node_modules/math-intrinsics/abs.js","../node_modules/math-intrinsics/floor.js","../node_modules/math-intrinsics/max.js","../node_modules/math-intrinsics/min.js","../node_modules/math-intrinsics/pow.js","../node_modules/math-intrinsics/round.js","../node_modules/math-intrinsics/sign.js","../node_modules/math-intrinsics/isNaN.js","../node_modules/has-symbols/shams.js","../node_modules/has-symbols/index.js","../node_modules/get-proto/Reflect.getPrototypeOf.js","../node_modules/get-proto/Object.getPrototypeOf.js","../node_modules/function-bind/implementation.js","../node_modules/function-bind/index.js","../node_modules/call-bind-apply-helpers/functionCall.js","../node_modules/call-bind-apply-helpers/functionApply.js","../node_modules/call-bind-apply-helpers/actualApply.js","../node_modules/call-bind-apply-helpers/reflectApply.js","../node_modules/call-bind-apply-helpers/index.js","../node_modules/get-intrinsic/index.js","../node_modules/get-proto/index.js","../node_modules/hasown/index.js","../node_modules/set-function-length/index.js","../node_modules/call-bind-apply-helpers/applyBind.js","../node_modules/call-bind/index.js","../node_modules/call-bound/index.js","../node_modules/object.assign/implementation.js","../node_modules/object.assign/polyfill.js","../node_modules/object.assign/shim.js","../node_modules/object.assign/index.js","../node_modules/call-bind/callBound.js","../node_modules/functions-have-names/index.js","../node_modules/set-function-name/index.js","../node_modules/regexp.prototype.flags/implementation.js","../node_modules/regexp.prototype.flags/polyfill.js","../node_modules/regexp.prototype.flags/shim.js","../node_modules/regexp.prototype.flags/index.js","../node_modules/es-get-iterator/node.js","../node_modules/object-inspect/index.js","../node_modules/side-channel-list/index.js","../node_modules/side-channel-map/index.js","../node_modules/side-channel-weakmap/index.js","../node_modules/side-channel/index.js","../node_modules/object-is/implementation.js","../node_modules/object-is/polyfill.js","../node_modules/object-is/shim.js","../node_modules/object-is/index.js","../node_modules/has-tostringtag/shams.js","../node_modules/is-arguments/index.js","../node_modules/is-regex/index.js","../node_modules/isarray/index.js","../node_modules/is-array-buffer/index.js","../node_modules/is-date-object/index.js","../node_modules/is-shared-array-buffer/index.js","../node_modules/is-string/index.js","../node_modules/is-number-object/index.js","../node_modules/is-boolean-object/index.js","../node_modules/safe-regex-test/index.js","../node_modules/is-symbol/index.js","../node_modules/has-bigints/index.js","../node_modules/is-bigint/index.js","../node_modules/which-boxed-primitive/index.js","../node_modules/is-map/index.js","../node_modules/is-set/index.js","../node_modules/is-weakmap/index.js","../node_modules/is-weakset/index.js","../node_modules/which-collection/index.js","../node_modules/is-callable/index.js","../node_modules/for-each/index.js","../node_modules/available-typed-arrays/index.js","../node_modules/possible-typed-array-names/index.js","../node_modules/which-typed-array/index.js","../node_modules/array-buffer-byte-length/index.js","../node_modules/deep-equal/index.js","../node_modules/@googlemaps/js-api-loader/dist/index.mjs","../src/components/GoogleMap.svelte","../src/components/GlMap.svelte","../src/components/LeafletMap.svelte","../node_modules/leaflet/dist/leaflet-src.js","../src/components/TangramMap.svelte","../node_modules/tangram/dist/tangram.min.js","../node_modules/@fortawesome/free-solid-svg-icons/index.mjs","../node_modules/svelte-fa/src/utils.js","../node_modules/svelte-fa/src/fa.svelte","../node_modules/hat/index.js","../src/branch-utils.js","../src/mapbox-urls.js","../src/renderers.js","../src/shortcut.js","../src/transform-urls.js","../src/fetch-url.js","../src/components/inputs/Dropdown/DropdownToggle.svelte","../src/components/inputs/Dropdown/Dropdown.svelte","../src/components/inputs/StylesDropdown.svelte","../src/components/MapStyleInput.svelte","../src/components/CustomJsUi.svelte","../src/components/MapStyleInputWrapper.svelte","../src/components/inputs/Button.svelte","../src/components/MapLocationControl.svelte","../src/components/MapLabel.svelte","../src/constants.js","../src/map-state-utils.js","../node_modules/lodash.isequal/index.js","../src/components/Map.svelte","../src/components/MapsMirrorLayout.svelte","../src/components/MapsPhoneLayout.svelte","../src/components/MapsSwipeLayout.svelte","../src/components/MapsResponsiveLayout.svelte","../src/components/Maps.svelte","../node_modules/html2canvas/dist/html2canvas.js","../node_modules/@beyonk/svelte-mapbox/src/lib/geocoder/geocoder-action.js","../node_modules/@beyonk/svelte-mapbox/src/lib/asset-loader.js","../node_modules/@beyonk/svelte-mapbox/src/lib/event-bindings.js","../node_modules/@beyonk/svelte-mapbox/src/lib/geocoder/Geocoder.svelte","../src/components/ViewModeControl.svelte","../src/components/MapLocationDropdown.svelte","../src/components/Tooltip.svelte","../src/components/MapControls.svelte","../src/query.js","../src/settings.js","../node_modules/stamen-attribution/dist/main.js","../src/App.svelte","../src/make-config.js","../src/main.js","../node_modules/quick-lru/index.js","../node_modules/@maptiler/client/dist/maptiler-client.mjs","../node_modules/events/events.js","../node_modules/uuid/dist/esm-browser/stringify.js","../node_modules/uuid/dist/esm-browser/rng.js","../node_modules/uuid/dist/esm-browser/native.js","../node_modules/js-base64/base64.mjs","../node_modules/@maptiler/sdk/dist/maptiler-sdk.mjs","../node_modules/uuid/dist/esm-browser/v4.js"],"sourcesContent":["function noop() { }\nconst identity = x => x;\nfunction assign(tar, src) {\n // @ts-ignore\n for (const k in src)\n tar[k] = src[k];\n return tar;\n}\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\nfunction is_promise(value) {\n return !!value && (typeof value === 'object' || typeof value === 'function') && typeof value.then === 'function';\n}\nfunction add_location(element, file, line, column, char) {\n element.__svelte_meta = {\n loc: { file, line, column, char }\n };\n}\nfunction run(fn) {\n return fn();\n}\nfunction blank_object() {\n return Object.create(null);\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === 'function';\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');\n}\nlet src_url_equal_anchor;\nfunction src_url_equal(element_src, url) {\n if (!src_url_equal_anchor) {\n src_url_equal_anchor = document.createElement('a');\n }\n src_url_equal_anchor.href = url;\n return element_src === src_url_equal_anchor.href;\n}\nfunction not_equal(a, b) {\n return a != a ? b == b : a !== b;\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nfunction validate_store(store, name) {\n if (store != null && typeof store.subscribe !== 'function') {\n throw new Error(`'${name}' is not a store with a 'subscribe' method`);\n }\n}\nfunction subscribe(store, ...callbacks) {\n if (store == null) {\n return noop;\n }\n const unsub = store.subscribe(...callbacks);\n return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\nfunction get_store_value(store) {\n let value;\n subscribe(store, _ => value = _)();\n return value;\n}\nfunction component_subscribe(component, store, callback) {\n component.$$.on_destroy.push(subscribe(store, callback));\n}\nfunction create_slot(definition, ctx, $$scope, fn) {\n if (definition) {\n const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n return definition[0](slot_ctx);\n }\n}\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n return definition[1] && fn\n ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))\n : $$scope.ctx;\n}\nfunction get_slot_changes(definition, $$scope, dirty, fn) {\n if (definition[2] && fn) {\n const lets = definition[2](fn(dirty));\n if ($$scope.dirty === undefined) {\n return lets;\n }\n if (typeof lets === 'object') {\n const merged = [];\n const len = Math.max($$scope.dirty.length, lets.length);\n for (let i = 0; i < len; i += 1) {\n merged[i] = $$scope.dirty[i] | lets[i];\n }\n return merged;\n }\n return $$scope.dirty | lets;\n }\n return $$scope.dirty;\n}\nfunction update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);\n}\nfunction get_all_dirty_from_scope($$scope) {\n if ($$scope.ctx.length > 32) {\n const dirty = [];\n const length = $$scope.ctx.length / 32;\n for (let i = 0; i < length; i++) {\n dirty[i] = -1;\n }\n return dirty;\n }\n return -1;\n}\nfunction exclude_internal_props(props) {\n const result = {};\n for (const k in props)\n if (k[0] !== '$')\n result[k] = props[k];\n return result;\n}\nfunction compute_rest_props(props, keys) {\n const rest = {};\n keys = new Set(keys);\n for (const k in props)\n if (!keys.has(k) && k[0] !== '$')\n rest[k] = props[k];\n return rest;\n}\nfunction compute_slots(slots) {\n const result = {};\n for (const key in slots) {\n result[key] = true;\n }\n return result;\n}\nfunction once(fn) {\n let ran = false;\n return function (...args) {\n if (ran)\n return;\n ran = true;\n fn.call(this, ...args);\n };\n}\nfunction null_to_empty(value) {\n return value == null ? '' : value;\n}\nfunction set_store_value(store, ret, value) {\n store.set(value);\n return ret;\n}\nconst has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nfunction action_destroyer(action_result) {\n return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\nfunction split_css_unit(value) {\n const split = typeof value === 'string' && value.match(/^\\s*(-?[\\d.]+)([^\\s]*)\\s*$/);\n return split ? [parseFloat(split[1]), split[2] || 'px'] : [value, 'px'];\n}\nconst contenteditable_truthy_values = ['', true, 1, 'true', 'contenteditable'];\n\nconst is_client = typeof window !== 'undefined';\nlet now = is_client\n ? () => window.performance.now()\n : () => Date.now();\nlet raf = is_client ? cb => requestAnimationFrame(cb) : noop;\n// used internally for testing\nfunction set_now(fn) {\n now = fn;\n}\nfunction set_raf(fn) {\n raf = fn;\n}\n\nconst tasks = new Set();\nfunction run_tasks(now) {\n tasks.forEach(task => {\n if (!task.c(now)) {\n tasks.delete(task);\n task.f();\n }\n });\n if (tasks.size !== 0)\n raf(run_tasks);\n}\n/**\n * For testing purposes only!\n */\nfunction clear_loops() {\n tasks.clear();\n}\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n */\nfunction loop(callback) {\n let task;\n if (tasks.size === 0)\n raf(run_tasks);\n return {\n promise: new Promise(fulfill => {\n tasks.add(task = { c: callback, f: fulfill });\n }),\n abort() {\n tasks.delete(task);\n }\n };\n}\n\nconst globals = (typeof window !== 'undefined'\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : global);\n\n/**\n * Resize observer singleton.\n * One listener per element only!\n * https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ\n */\nclass ResizeObserverSingleton {\n constructor(options) {\n this.options = options;\n this._listeners = 'WeakMap' in globals ? new WeakMap() : undefined;\n }\n observe(element, listener) {\n this._listeners.set(element, listener);\n this._getObserver().observe(element, this.options);\n return () => {\n this._listeners.delete(element);\n this._observer.unobserve(element); // this line can probably be removed\n };\n }\n _getObserver() {\n var _a;\n return (_a = this._observer) !== null && _a !== void 0 ? _a : (this._observer = new ResizeObserver((entries) => {\n var _a;\n for (const entry of entries) {\n ResizeObserverSingleton.entries.set(entry.target, entry);\n (_a = this._listeners.get(entry.target)) === null || _a === void 0 ? void 0 : _a(entry);\n }\n }));\n }\n}\n// Needs to be written like this to pass the tree-shake-test\nResizeObserverSingleton.entries = 'WeakMap' in globals ? new WeakMap() : undefined;\n\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\nfunction start_hydrating() {\n is_hydrating = true;\n}\nfunction end_hydrating() {\n is_hydrating = false;\n}\nfunction upper_bound(low, high, key, value) {\n // Return first index of value larger than input value in the range [low, high)\n while (low < high) {\n const mid = low + ((high - low) >> 1);\n if (key(mid) <= value) {\n low = mid + 1;\n }\n else {\n high = mid;\n }\n }\n return low;\n}\nfunction init_hydrate(target) {\n if (target.hydrate_init)\n return;\n target.hydrate_init = true;\n // We know that all children have claim_order values since the unclaimed have been detached if target is not \n let children = target.childNodes;\n // If target is , there may be children without claim_order\n if (target.nodeName === 'HEAD') {\n const myChildren = [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n if (node.claim_order !== undefined) {\n myChildren.push(node);\n }\n }\n children = myChildren;\n }\n /*\n * Reorder claimed children optimally.\n * We can reorder claimed children optimally by finding the longest subsequence of\n * nodes that are already claimed in order and only moving the rest. The longest\n * subsequence of nodes that are claimed in order can be found by\n * computing the longest increasing subsequence of .claim_order values.\n *\n * This algorithm is optimal in generating the least amount of reorder operations\n * possible.\n *\n * Proof:\n * We know that, given a set of reordering operations, the nodes that do not move\n * always form an increasing subsequence, since they do not move among each other\n * meaning that they must be already ordered among each other. Thus, the maximal\n * set of nodes that do not move form a longest increasing subsequence.\n */\n // Compute longest increasing subsequence\n // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n const m = new Int32Array(children.length + 1);\n // Predecessor indices + 1\n const p = new Int32Array(children.length);\n m[0] = -1;\n let longest = 0;\n for (let i = 0; i < children.length; i++) {\n const current = children[i].claim_order;\n // Find the largest subsequence length such that it ends in a value less than our current value\n // upper_bound returns first greater value, so we subtract one\n // with fast path for when we are on the current longest subsequence\n const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;\n p[i] = m[seqLen] + 1;\n const newLen = seqLen + 1;\n // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n m[newLen] = i;\n longest = Math.max(newLen, longest);\n }\n // The longest increasing subsequence of nodes (initially reversed)\n const lis = [];\n // The rest of the nodes, nodes that will be moved\n const toMove = [];\n let last = children.length - 1;\n for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n lis.push(children[cur - 1]);\n for (; last >= cur; last--) {\n toMove.push(children[last]);\n }\n last--;\n }\n for (; last >= 0; last--) {\n toMove.push(children[last]);\n }\n lis.reverse();\n // We sort the nodes being moved to guarantee that their insertion order matches the claim order\n toMove.sort((a, b) => a.claim_order - b.claim_order);\n // Finally, we move the nodes\n for (let i = 0, j = 0; i < toMove.length; i++) {\n while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {\n j++;\n }\n const anchor = j < lis.length ? lis[j] : null;\n target.insertBefore(toMove[i], anchor);\n }\n}\nfunction append(target, node) {\n target.appendChild(node);\n}\nfunction append_styles(target, style_sheet_id, styles) {\n const append_styles_to = get_root_for_style(target);\n if (!append_styles_to.getElementById(style_sheet_id)) {\n const style = element('style');\n style.id = style_sheet_id;\n style.textContent = styles;\n append_stylesheet(append_styles_to, style);\n }\n}\nfunction get_root_for_style(node) {\n if (!node)\n return document;\n const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n if (root && root.host) {\n return root;\n }\n return node.ownerDocument;\n}\nfunction append_empty_stylesheet(node) {\n const style_element = element('style');\n append_stylesheet(get_root_for_style(node), style_element);\n return style_element.sheet;\n}\nfunction append_stylesheet(node, style) {\n append(node.head || node, style);\n return style.sheet;\n}\nfunction append_hydration(target, node) {\n if (is_hydrating) {\n init_hydrate(target);\n if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentNode !== target))) {\n target.actual_end_child = target.firstChild;\n }\n // Skip nodes of undefined ordering\n while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {\n target.actual_end_child = target.actual_end_child.nextSibling;\n }\n if (node !== target.actual_end_child) {\n // We only insert if the ordering of this node should be modified or the parent node is not target\n if (node.claim_order !== undefined || node.parentNode !== target) {\n target.insertBefore(node, target.actual_end_child);\n }\n }\n else {\n target.actual_end_child = node.nextSibling;\n }\n }\n else if (node.parentNode !== target || node.nextSibling !== null) {\n target.appendChild(node);\n }\n}\nfunction insert(target, node, anchor) {\n target.insertBefore(node, anchor || null);\n}\nfunction insert_hydration(target, node, anchor) {\n if (is_hydrating && !anchor) {\n append_hydration(target, node);\n }\n else if (node.parentNode !== target || node.nextSibling != anchor) {\n target.insertBefore(node, anchor || null);\n }\n}\nfunction detach(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\nfunction destroy_each(iterations, detaching) {\n for (let i = 0; i < iterations.length; i += 1) {\n if (iterations[i])\n iterations[i].d(detaching);\n }\n}\nfunction element(name) {\n return document.createElement(name);\n}\nfunction element_is(name, is) {\n return document.createElement(name, { is });\n}\nfunction object_without_properties(obj, exclude) {\n const target = {};\n for (const k in obj) {\n if (has_prop(obj, k)\n // @ts-ignore\n && exclude.indexOf(k) === -1) {\n // @ts-ignore\n target[k] = obj[k];\n }\n }\n return target;\n}\nfunction svg_element(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n}\nfunction text(data) {\n return document.createTextNode(data);\n}\nfunction space() {\n return text(' ');\n}\nfunction empty() {\n return text('');\n}\nfunction comment(content) {\n return document.createComment(content);\n}\nfunction listen(node, event, handler, options) {\n node.addEventListener(event, handler, options);\n return () => node.removeEventListener(event, handler, options);\n}\nfunction prevent_default(fn) {\n return function (event) {\n event.preventDefault();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_propagation(fn) {\n return function (event) {\n event.stopPropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_immediate_propagation(fn) {\n return function (event) {\n event.stopImmediatePropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction self(fn) {\n return function (event) {\n // @ts-ignore\n if (event.target === this)\n fn.call(this, event);\n };\n}\nfunction trusted(fn) {\n return function (event) {\n // @ts-ignore\n if (event.isTrusted)\n fn.call(this, event);\n };\n}\nfunction attr(node, attribute, value) {\n if (value == null)\n node.removeAttribute(attribute);\n else if (node.getAttribute(attribute) !== value)\n node.setAttribute(attribute, value);\n}\n/**\n * List of attributes that should always be set through the attr method,\n * because updating them through the property setter doesn't work reliably.\n * In the example of `width`/`height`, the problem is that the setter only\n * accepts numeric values, but the attribute can also be set to a string like `50%`.\n * If this list becomes too big, rethink this approach.\n */\nconst always_set_through_set_attribute = ['width', 'height'];\nfunction set_attributes(node, attributes) {\n // @ts-ignore\n const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n for (const key in attributes) {\n if (attributes[key] == null) {\n node.removeAttribute(key);\n }\n else if (key === 'style') {\n node.style.cssText = attributes[key];\n }\n else if (key === '__value') {\n node.value = node[key] = attributes[key];\n }\n else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {\n node[key] = attributes[key];\n }\n else {\n attr(node, key, attributes[key]);\n }\n }\n}\nfunction set_svg_attributes(node, attributes) {\n for (const key in attributes) {\n attr(node, key, attributes[key]);\n }\n}\nfunction set_custom_element_data_map(node, data_map) {\n Object.keys(data_map).forEach((key) => {\n set_custom_element_data(node, key, data_map[key]);\n });\n}\nfunction set_custom_element_data(node, prop, value) {\n if (prop in node) {\n node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n }\n else {\n attr(node, prop, value);\n }\n}\nfunction set_dynamic_element_data(tag) {\n return (/-/.test(tag)) ? set_custom_element_data_map : set_attributes;\n}\nfunction xlink_attr(node, attribute, value) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\nfunction get_binding_group_value(group, __value, checked) {\n const value = new Set();\n for (let i = 0; i < group.length; i += 1) {\n if (group[i].checked)\n value.add(group[i].__value);\n }\n if (!checked) {\n value.delete(__value);\n }\n return Array.from(value);\n}\nfunction init_binding_group(group) {\n let _inputs;\n return {\n /* push */ p(...inputs) {\n _inputs = inputs;\n _inputs.forEach(input => group.push(input));\n },\n /* remove */ r() {\n _inputs.forEach(input => group.splice(group.indexOf(input), 1));\n }\n };\n}\nfunction init_binding_group_dynamic(group, indexes) {\n let _group = get_binding_group(group);\n let _inputs;\n function get_binding_group(group) {\n for (let i = 0; i < indexes.length; i++) {\n group = group[indexes[i]] = group[indexes[i]] || [];\n }\n return group;\n }\n function push() {\n _inputs.forEach(input => _group.push(input));\n }\n function remove() {\n _inputs.forEach(input => _group.splice(_group.indexOf(input), 1));\n }\n return {\n /* update */ u(new_indexes) {\n indexes = new_indexes;\n const new_group = get_binding_group(group);\n if (new_group !== _group) {\n remove();\n _group = new_group;\n push();\n }\n },\n /* push */ p(...inputs) {\n _inputs = inputs;\n push();\n },\n /* remove */ r: remove\n };\n}\nfunction to_number(value) {\n return value === '' ? null : +value;\n}\nfunction time_ranges_to_array(ranges) {\n const array = [];\n for (let i = 0; i < ranges.length; i += 1) {\n array.push({ start: ranges.start(i), end: ranges.end(i) });\n }\n return array;\n}\nfunction children(element) {\n return Array.from(element.childNodes);\n}\nfunction init_claim_info(nodes) {\n if (nodes.claim_info === undefined) {\n nodes.claim_info = { last_index: 0, total_claimed: 0 };\n }\n}\nfunction claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {\n // Try to find nodes in an order such that we lengthen the longest increasing subsequence\n init_claim_info(nodes);\n const resultNode = (() => {\n // We first try to find an element after the previous one\n for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n return node;\n }\n }\n // Otherwise, we try to find one before\n // We iterate in reverse so that we don't go too far back\n for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n else if (replacement === undefined) {\n // Since we spliced before the last_index, we decrease it\n nodes.claim_info.last_index--;\n }\n return node;\n }\n }\n // If we can't find any matching node, we create a new one\n return createNode();\n })();\n resultNode.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n return resultNode;\n}\nfunction claim_element_base(nodes, name, attributes, create_element) {\n return claim_node(nodes, (node) => node.nodeName === name, (node) => {\n const remove = [];\n for (let j = 0; j < node.attributes.length; j++) {\n const attribute = node.attributes[j];\n if (!attributes[attribute.name]) {\n remove.push(attribute.name);\n }\n }\n remove.forEach(v => node.removeAttribute(v));\n return undefined;\n }, () => create_element(name));\n}\nfunction claim_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, element);\n}\nfunction claim_svg_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, svg_element);\n}\nfunction claim_text(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 3, (node) => {\n const dataStr = '' + data;\n if (node.data.startsWith(dataStr)) {\n if (node.data.length !== dataStr.length) {\n return node.splitText(dataStr.length);\n }\n }\n else {\n node.data = dataStr;\n }\n }, () => text(data), true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n );\n}\nfunction claim_space(nodes) {\n return claim_text(nodes, ' ');\n}\nfunction claim_comment(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 8, (node) => {\n node.data = '' + data;\n return undefined;\n }, () => comment(data), true);\n}\nfunction find_comment(nodes, text, start) {\n for (let i = start; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n return i;\n }\n }\n return nodes.length;\n}\nfunction claim_html_tag(nodes, is_svg) {\n // find html opening tag\n const start_index = find_comment(nodes, 'HTML_TAG_START', 0);\n const end_index = find_comment(nodes, 'HTML_TAG_END', start_index);\n if (start_index === end_index) {\n return new HtmlTagHydration(undefined, is_svg);\n }\n init_claim_info(nodes);\n const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n detach(html_tag_nodes[0]);\n detach(html_tag_nodes[html_tag_nodes.length - 1]);\n const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n for (const n of claimed_nodes) {\n n.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n }\n return new HtmlTagHydration(claimed_nodes, is_svg);\n}\nfunction set_data(text, data) {\n data = '' + data;\n if (text.data === data)\n return;\n text.data = data;\n}\nfunction set_data_contenteditable(text, data) {\n data = '' + data;\n if (text.wholeText === data)\n return;\n text.data = data;\n}\nfunction set_data_maybe_contenteditable(text, data, attr_value) {\n if (~contenteditable_truthy_values.indexOf(attr_value)) {\n set_data_contenteditable(text, data);\n }\n else {\n set_data(text, data);\n }\n}\nfunction set_input_value(input, value) {\n input.value = value == null ? '' : value;\n}\nfunction set_input_type(input, type) {\n try {\n input.type = type;\n }\n catch (e) {\n // do nothing\n }\n}\nfunction set_style(node, key, value, important) {\n if (value == null) {\n node.style.removeProperty(key);\n }\n else {\n node.style.setProperty(key, value, important ? 'important' : '');\n }\n}\nfunction select_option(select, value, mounting) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n if (option.__value === value) {\n option.selected = true;\n return;\n }\n }\n if (!mounting || value !== undefined) {\n select.selectedIndex = -1; // no option should be selected\n }\n}\nfunction select_options(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n option.selected = ~value.indexOf(option.__value);\n }\n}\nfunction select_value(select) {\n const selected_option = select.querySelector(':checked');\n return selected_option && selected_option.__value;\n}\nfunction select_multiple_value(select) {\n return [].map.call(select.querySelectorAll(':checked'), option => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\nlet crossorigin;\nfunction is_crossorigin() {\n if (crossorigin === undefined) {\n crossorigin = false;\n try {\n if (typeof window !== 'undefined' && window.parent) {\n void window.parent.document;\n }\n }\n catch (error) {\n crossorigin = true;\n }\n }\n return crossorigin;\n}\nfunction add_iframe_resize_listener(node, fn) {\n const computed_style = getComputedStyle(node);\n if (computed_style.position === 'static') {\n node.style.position = 'relative';\n }\n const iframe = element('iframe');\n iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');\n iframe.setAttribute('aria-hidden', 'true');\n iframe.tabIndex = -1;\n const crossorigin = is_crossorigin();\n let unsubscribe;\n if (crossorigin) {\n iframe.src = \"data:text/html,\";\n unsubscribe = listen(window, 'message', (event) => {\n if (event.source === iframe.contentWindow)\n fn();\n });\n }\n else {\n iframe.src = 'about:blank';\n iframe.onload = () => {\n unsubscribe = listen(iframe.contentWindow, 'resize', fn);\n // make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)\n // see https://github.com/sveltejs/svelte/issues/4233\n fn();\n };\n }\n append(node, iframe);\n return () => {\n if (crossorigin) {\n unsubscribe();\n }\n else if (unsubscribe && iframe.contentWindow) {\n unsubscribe();\n }\n detach(iframe);\n };\n}\nconst resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'content-box' });\nconst resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'border-box' });\nconst resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'device-pixel-content-box' });\nfunction toggle_class(element, name, toggle) {\n element.classList[toggle ? 'add' : 'remove'](name);\n}\nfunction custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n const e = document.createEvent('CustomEvent');\n e.initCustomEvent(type, bubbles, cancelable, detail);\n return e;\n}\nfunction query_selector_all(selector, parent = document.body) {\n return Array.from(parent.querySelectorAll(selector));\n}\nfunction head_selector(nodeId, head) {\n const result = [];\n let started = 0;\n for (const node of head.childNodes) {\n if (node.nodeType === 8 /* comment node */) {\n const comment = node.textContent.trim();\n if (comment === `HEAD_${nodeId}_END`) {\n started -= 1;\n result.push(node);\n }\n else if (comment === `HEAD_${nodeId}_START`) {\n started += 1;\n result.push(node);\n }\n }\n else if (started > 0) {\n result.push(node);\n }\n }\n return result;\n}\nclass HtmlTag {\n constructor(is_svg = false) {\n this.is_svg = false;\n this.is_svg = is_svg;\n this.e = this.n = null;\n }\n c(html) {\n this.h(html);\n }\n m(html, target, anchor = null) {\n if (!this.e) {\n if (this.is_svg)\n this.e = svg_element(target.nodeName);\n /** #7364 target for