From 8bbead2b8e49570f80f83853b6bad93e85f079f5 Mon Sep 17 00:00:00 2001 From: dabreegster Date: Wed, 4 Sep 2024 15:28:31 +0000 Subject: [PATCH] deploy: fdb9cdb575739e0d77b4c1eddd14fd9c3b398433 --- ...ayout-b64294b5.css => Layout-50ced61d.css} | 2 +- ...{Layout-4cd70fb2.js => Layout-6a808470.js} | 30 ++++++++-------- assets/SidebarControls-547244ee.js | 9 ----- assets/SidebarControls-b43115a7.js | 9 +++++ assets/index-04d5ac6c.css | 1 + ...Function-e35500c2.js => index-34f7e0df.js} | 35 ++++++++++--------- assets/{main-4709fa84.js => main-e959e939.js} | 2 +- assets/x2-96aea9a1.js | 9 ----- assets/x2-c87eb6b7.js | 9 +++++ assets/{x3-b08fba3a.js => x3-92a919f2.js} | 8 ++--- edge_cost.html | 9 ++--- index.html | 8 ++--- interactive.html | 11 +++--- 13 files changed, 73 insertions(+), 69 deletions(-) rename assets/{Layout-b64294b5.css => Layout-50ced61d.css} (90%) rename assets/{Layout-4cd70fb2.js => Layout-6a808470.js} (68%) delete mode 100644 assets/SidebarControls-547244ee.js create mode 100644 assets/SidebarControls-b43115a7.js create mode 100644 assets/index-04d5ac6c.css rename assets/{CostFunction-e35500c2.js => index-34f7e0df.js} (68%) rename assets/{main-4709fa84.js => main-e959e939.js} (98%) delete mode 100644 assets/x2-96aea9a1.js create mode 100644 assets/x2-c87eb6b7.js rename assets/{x3-b08fba3a.js => x3-92a919f2.js} (73%) diff --git a/assets/Layout-b64294b5.css b/assets/Layout-50ced61d.css similarity index 90% rename from assets/Layout-b64294b5.css rename to assets/Layout-50ced61d.css index 5bde691..708c37b 100644 --- a/assets/Layout-b64294b5.css +++ b/assets/Layout-50ced61d.css @@ -1 +1 @@ -.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;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.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 (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 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 (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 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 (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-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 (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-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 (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23999' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-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 (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-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(0)}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 (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.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 (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.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:#ffffff80;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:#ffffff80;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:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;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:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;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;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 #00000059;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;top:0;right:0;bottom:0;left:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}.svelte-1ey54bq::backdrop{background-color:#000;opacity:.5}svg.svelte-d2loi5{display:block;fill:#e15042}li.svelte-ltkwvy.svelte-ltkwvy{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content}li.svelte-ltkwvy.svelte-ltkwvy:first-child{padding-top:10px}li.svelte-ltkwvy.svelte-ltkwvy:last-child{padding-bottom:10px}li.selected.svelte-ltkwvy.svelte-ltkwvy{background-color:#f3f6ff}li.selected.svelte-ltkwvy.svelte-ltkwvy{animation:svelte-ltkwvy-backAndForth 5s linear infinite}li.selected.svelte-ltkwvy .primary.svelte-ltkwvy{color:#2b8bfb}li.svelte-ltkwvy>img.svelte-ltkwvy{align-self:center;justify-self:center;opacity:.75}.texts.svelte-ltkwvy.svelte-ltkwvy{padding:0 17px 0 0}.texts.svelte-ltkwvy>.svelte-ltkwvy{white-space:nowrap;display:block;min-width:fit-content}.primary.svelte-ltkwvy.svelte-ltkwvy{font-weight:600}.secondary.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7;padding-left:4px}.line2.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7}@keyframes svelte-ltkwvy-backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}div.svelte-7cmwmc{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);pointer-events:none;display:flex;align-items:center}svg.svelte-7cmwmc{animation:svelte-7cmwmc-rotate .8s infinite cubic-bezier(.45,.05,.55,.95)}@keyframes svelte-7cmwmc-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}svg.svelte-gzo3ar.svelte-gzo3ar{display:block;fill:#6b7c93;stroke:#6b7c93}.list-icon.svelte-gzo3ar.svelte-gzo3ar{grid-row:1/3;align-self:center;margin:8px}.in-map.svelte-gzo3ar.svelte-gzo3ar{height:30px}.maplibregl-canvas-container .marker-selected{z-index:1}.maplibregl-canvas-container svg.svelte-gzo3ar path.svelte-gzo3ar,.leaflet-map-pane svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#3170fe;stroke:#3170fe}.marker-selected svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#98b7ff;stroke:#3170fe}.marker-reverse svg.svelte-gzo3ar path.svelte-gzo3ar{fill:silver;stroke:gray}.marker-interactive{cursor:pointer!important}.maptiler-gc-popup>.maplibregl-popup-content{padding:2px 8px}svg.svelte-en2qvf{display:block;fill:var(--color-icon-button)}svg.svelte-1bpbt60{display:block;stroke:var(--color-icon-button)}form.svelte-zh3kmv.svelte-zh3kmv{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text:#444952;--color-icon-button:#444952}form.svelte-zh3kmv.svelte-zh3kmv,form.svelte-zh3kmv .svelte-zh3kmv,form.svelte-zh3kmv .svelte-zh3kmv:after,form.svelte-zh3kmv .svelte-zh3kmv:before{box-sizing:border-box}form.can-collapse.svelte-zh3kmv.svelte-zh3kmv{max-width:29px}form.svelte-zh3kmv.svelte-zh3kmv,form.svelte-zh3kmv.svelte-zh3kmv:focus-within,form.svelte-zh3kmv.svelte-zh3kmv:hover{width:270px;max-width:270px}input.svelte-zh3kmv.svelte-zh3kmv{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input.svelte-zh3kmv.svelte-zh3kmv:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul.svelte-zh3kmv.svelte-zh3kmv,div.error.svelte-zh3kmv.svelte-zh3kmv,div.no-results.svelte-zh3kmv.svelte-zh3kmv{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul.svelte-zh3kmv.svelte-zh3kmv{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error.svelte-zh3kmv.svelte-zh3kmv,div.no-results.svelte-zh3kmv.svelte-zh3kmv{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error.svelte-zh3kmv.svelte-zh3kmv{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error.svelte-zh3kmv div.svelte-zh3kmv{flex-grow:1}div.error.svelte-zh3kmv svg{flex-shrink:0;width:20px;height:20px}div.error.svelte-zh3kmv button.svelte-zh3kmv{flex-shrink:0}div.error.svelte-zh3kmv button.svelte-zh3kmv>svg{width:13px;fill:#e25041}div.error.svelte-zh3kmv button.svelte-zh3kmv:hover svg,div.error.svelte-zh3kmv button.svelte-zh3kmv:active svg{fill:#444952}div.no-results.svelte-zh3kmv.svelte-zh3kmv{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results.svelte-zh3kmv svg{margin-top:4px;flex-shrink:0;width:20px;height:20px;width:30px;height:30px}.maplibregl-ctrl-bottom-left ul.svelte-zh3kmv.svelte-zh3kmv,.maplibregl-ctrl-bottom-right ul.svelte-zh3kmv.svelte-zh3kmv{top:auto;bottom:100%}button.svelte-zh3kmv.svelte-zh3kmv{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button.svelte-zh3kmv.svelte-zh3kmv:hover{background-color:transparent}button.svelte-zh3kmv:hover svg,button.svelte-zh3kmv:active svg{fill:#2b8bfb}.input-group.svelte-zh3kmv.svelte-zh3kmv{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group.svelte-zh3kmv.svelte-zh3kmv:focus-within{outline:#2b8bfb solid 2px}.search-button.svelte-zh3kmv.svelte-zh3kmv{flex-shrink:0}.maplibregl-ctrl-geocoder:not(.maptiler-ctrl) .search-button svg{width:12px!important;transform:translate(.5px)}.clear-button-container.svelte-zh3kmv.svelte-zh3kmv{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable.svelte-zh3kmv.svelte-zh3kmv{display:flex;flex-shrink:0}.maplibregl-ctrl-geocoder{position:relative;z-index:3}.maptiler-ctrl:not(:empty){box-shadow:none}.maptiler-ctrl .input-group.svelte-zh3kmv.svelte-zh3kmv{padding-inline:8px;border:white solid 2px}.maptiler-ctrl .input-group.svelte-zh3kmv.svelte-zh3kmv:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}.maptiler-ctrl form.can-collapse.svelte-zh3kmv.svelte-zh3kmv{max-width:33px}.maptiler-ctrl form.svelte-zh3kmv.svelte-zh3kmv,.maptiler-ctrl form.svelte-zh3kmv.svelte-zh3kmv:focus-within,.maptiler-ctrl form.svelte-zh3kmv.svelte-zh3kmv:hover{width:270px;max-width:270px}div.svelte-ixhnie{position:absolute;top:20px;left:50px}span.svelte-kzgqtg{display:block;float:left;height:16px;width:30px;margin-right:5px;border:1px solid #999}div.svelte-1uuov7f{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.5);display:flex;justify-content:center;align-items:center;z-index:999;color:#fff;font-size:32px}.ctrl-btn-center.svelte-1s83zbq{display:grid!important;height:100%;width:100%;place-items:center}.expand-map.svelte-p00lfq{position:absolute;top:0;bottom:0;left:0;right:0}table.svelte-lh2o9l{border:solid}.svelte-6kzmjs{box-sizing:border-box}body{margin:0}div.svelte-6kzmjs{float:left}.left.svelte-6kzmjs{width:25%;height:100vh;overflow:scroll;padding:8px}.main.svelte-6kzmjs{width:75%} +.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;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.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 (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 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 (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 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 (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-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 (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-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 (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23999' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-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 (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-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(0)}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 (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.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 (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.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:#ffffff80;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:#ffffff80;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:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;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:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;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;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 #00000059;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;top:0;right:0;bottom:0;left:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}.svelte-1ey54bq::backdrop{background-color:#000;opacity:.5}span.svelte-kzgqtg{display:block;float:left;height:16px;width:30px;margin-right:5px;border:1px solid #999}div.svelte-1uuov7f{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.5);display:flex;justify-content:center;align-items:center;z-index:999;color:#fff;font-size:32px}table.svelte-lh2o9l{border:solid}svg.svelte-d2loi5{display:block;fill:#e15042}li.svelte-ltkwvy.svelte-ltkwvy{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content}li.svelte-ltkwvy.svelte-ltkwvy:first-child{padding-top:10px}li.svelte-ltkwvy.svelte-ltkwvy:last-child{padding-bottom:10px}li.selected.svelte-ltkwvy.svelte-ltkwvy{background-color:#f3f6ff}li.selected.svelte-ltkwvy.svelte-ltkwvy{animation:svelte-ltkwvy-backAndForth 5s linear infinite}li.selected.svelte-ltkwvy .primary.svelte-ltkwvy{color:#2b8bfb}li.svelte-ltkwvy>img.svelte-ltkwvy{align-self:center;justify-self:center;opacity:.75}.texts.svelte-ltkwvy.svelte-ltkwvy{padding:0 17px 0 0}.texts.svelte-ltkwvy>.svelte-ltkwvy{white-space:nowrap;display:block;min-width:fit-content}.primary.svelte-ltkwvy.svelte-ltkwvy{font-weight:600}.secondary.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7;padding-left:4px}.line2.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7}@keyframes svelte-ltkwvy-backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}div.svelte-7cmwmc{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);pointer-events:none;display:flex;align-items:center}svg.svelte-7cmwmc{animation:svelte-7cmwmc-rotate .8s infinite cubic-bezier(.45,.05,.55,.95)}@keyframes svelte-7cmwmc-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}svg.svelte-gzo3ar.svelte-gzo3ar{display:block;fill:#6b7c93;stroke:#6b7c93}.list-icon.svelte-gzo3ar.svelte-gzo3ar{grid-row:1/3;align-self:center;margin:8px}.in-map.svelte-gzo3ar.svelte-gzo3ar{height:30px}.maplibregl-canvas-container .marker-selected{z-index:1}.maplibregl-canvas-container svg.svelte-gzo3ar path.svelte-gzo3ar,.leaflet-map-pane svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#3170fe;stroke:#3170fe}.marker-selected svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#98b7ff;stroke:#3170fe}.marker-reverse svg.svelte-gzo3ar path.svelte-gzo3ar{fill:silver;stroke:gray}.marker-interactive{cursor:pointer!important}.maptiler-gc-popup>.maplibregl-popup-content{padding:2px 8px}svg.svelte-en2qvf{display:block;fill:var(--color-icon-button)}svg.svelte-1bpbt60{display:block;stroke:var(--color-icon-button)}form.svelte-zh3kmv.svelte-zh3kmv{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text:#444952;--color-icon-button:#444952}form.svelte-zh3kmv.svelte-zh3kmv,form.svelte-zh3kmv .svelte-zh3kmv,form.svelte-zh3kmv .svelte-zh3kmv:after,form.svelte-zh3kmv .svelte-zh3kmv:before{box-sizing:border-box}form.can-collapse.svelte-zh3kmv.svelte-zh3kmv{max-width:29px}form.svelte-zh3kmv.svelte-zh3kmv,form.svelte-zh3kmv.svelte-zh3kmv:focus-within,form.svelte-zh3kmv.svelte-zh3kmv:hover{width:270px;max-width:270px}input.svelte-zh3kmv.svelte-zh3kmv{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input.svelte-zh3kmv.svelte-zh3kmv:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul.svelte-zh3kmv.svelte-zh3kmv,div.error.svelte-zh3kmv.svelte-zh3kmv,div.no-results.svelte-zh3kmv.svelte-zh3kmv{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul.svelte-zh3kmv.svelte-zh3kmv{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error.svelte-zh3kmv.svelte-zh3kmv,div.no-results.svelte-zh3kmv.svelte-zh3kmv{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error.svelte-zh3kmv.svelte-zh3kmv{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error.svelte-zh3kmv div.svelte-zh3kmv{flex-grow:1}div.error.svelte-zh3kmv svg{flex-shrink:0;width:20px;height:20px}div.error.svelte-zh3kmv button.svelte-zh3kmv{flex-shrink:0}div.error.svelte-zh3kmv button.svelte-zh3kmv>svg{width:13px;fill:#e25041}div.error.svelte-zh3kmv button.svelte-zh3kmv:hover svg,div.error.svelte-zh3kmv button.svelte-zh3kmv:active svg{fill:#444952}div.no-results.svelte-zh3kmv.svelte-zh3kmv{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results.svelte-zh3kmv svg{margin-top:4px;flex-shrink:0;width:20px;height:20px;width:30px;height:30px}.maplibregl-ctrl-bottom-left ul.svelte-zh3kmv.svelte-zh3kmv,.maplibregl-ctrl-bottom-right ul.svelte-zh3kmv.svelte-zh3kmv{top:auto;bottom:100%}button.svelte-zh3kmv.svelte-zh3kmv{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button.svelte-zh3kmv.svelte-zh3kmv:hover{background-color:transparent}button.svelte-zh3kmv:hover svg,button.svelte-zh3kmv:active svg{fill:#2b8bfb}.input-group.svelte-zh3kmv.svelte-zh3kmv{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group.svelte-zh3kmv.svelte-zh3kmv:focus-within{outline:#2b8bfb solid 2px}.search-button.svelte-zh3kmv.svelte-zh3kmv{flex-shrink:0}.maplibregl-ctrl-geocoder:not(.maptiler-ctrl) .search-button svg{width:12px!important;transform:translate(.5px)}.clear-button-container.svelte-zh3kmv.svelte-zh3kmv{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable.svelte-zh3kmv.svelte-zh3kmv{display:flex;flex-shrink:0}.maplibregl-ctrl-geocoder{position:relative;z-index:3}.maptiler-ctrl:not(:empty){box-shadow:none}.maptiler-ctrl .input-group.svelte-zh3kmv.svelte-zh3kmv{padding-inline:8px;border:white solid 2px}.maptiler-ctrl .input-group.svelte-zh3kmv.svelte-zh3kmv:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}.maptiler-ctrl form.can-collapse.svelte-zh3kmv.svelte-zh3kmv{max-width:33px}.maptiler-ctrl form.svelte-zh3kmv.svelte-zh3kmv,.maptiler-ctrl form.svelte-zh3kmv.svelte-zh3kmv:focus-within,.maptiler-ctrl form.svelte-zh3kmv.svelte-zh3kmv:hover{width:270px;max-width:270px}div.svelte-ixhnie{position:absolute;top:20px;left:50px}.ctrl-btn-center.svelte-1s83zbq{display:grid!important;height:100%;width:100%;place-items:center}.expand-map.svelte-p00lfq{position:absolute;top:0;bottom:0;left:0;right:0}.svelte-6kzmjs{box-sizing:border-box}body{margin:0}div.svelte-6kzmjs{float:left}.left.svelte-6kzmjs{width:25%;height:100vh;overflow:scroll;padding:8px}.main.svelte-6kzmjs{width:75%} diff --git a/assets/Layout-4cd70fb2.js b/assets/Layout-6a808470.js similarity index 68% rename from assets/Layout-4cd70fb2.js rename to assets/Layout-6a808470.js index 84b5f46..1542291 100644 --- a/assets/Layout-4cd70fb2.js +++ b/assets/Layout-6a808470.js @@ -1,9 +1,9 @@ -var Kx=Object.defineProperty;var Jx=(t,e,r)=>e in t?Kx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var pl=(t,e,r)=>(Jx(t,typeof e!="symbol"?e+"":e,r),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const p of l)if(p.type==="childList")for(const m of p.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&s(m)}).observe(document,{childList:!0,subtree:!0});function r(l){const p={};return l.integrity&&(p.integrity=l.integrity),l.referrerPolicy&&(p.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?p.credentials="include":l.crossOrigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function s(l){if(l.ep)return;l.ep=!0;const p=r(l);fetch(l.href,p)}})();function wr(){}function Qx(t,e){for(const r in e)t[r]=e[r];return t}function o0(t){return t()}function ay(){return Object.create(null)}function Cu(t){t.forEach(o0)}function cg(t){return typeof t=="function"}function Vr(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let of;function ly(t,e){return t===e?!0:(of||(of=document.createElement("a")),of.href=e,t===of.href)}function $x(t){return Object.keys(t).length===0}function s0(t,...e){if(t==null){for(const s of e)s(void 0);return wr}const r=t.subscribe(...e);return r.unsubscribe?()=>r.unsubscribe():r}function s2(t){let e;return s0(t,r=>e=r)(),e}function Qr(t,e,r){t.$$.on_destroy.push(s0(e,r))}function uu(t,e,r,s){if(t){const l=a0(t,e,r,s);return t[0](l)}}function a0(t,e,r,s){return t[1]&&s?Qx(r.ctx.slice(),t[1](s(e))):r.ctx}function cu(t,e,r,s){if(t[2]&&s){const l=t[2](s(r));if(e.dirty===void 0)return l;if(typeof l=="object"){const p=[],m=Math.max(e.dirty.length,l.length);for(let c=0;c32){const e=[],r=t.ctx.length/32;for(let s=0;st.removeEventListener(e,r,s)}function a2(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function Sn(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function l2(t){let e;return{p(...r){e=r,e.forEach(s=>t.push(s))},r(){e.forEach(r=>t.splice(t.indexOf(r),1))}}}function u2(t){return t===""?null:+t}function r1(t){return Array.from(t.childNodes)}function Tp(t,e){e=""+e,t.data!==e&&(t.data=e)}function Vm(t,e){t.value=e??""}function Ro(t,e,r,s){r==null?t.style.removeProperty(e):t.style.setProperty(e,r,s?"important":"")}function cy(t,e,r){for(let s=0;s{const l=t.$$.callbacks[e];if(l){const p=s1(e,r,{cancelable:s});return l.slice().forEach(m=>{m.call(t,p)}),!p.defaultPrevented}return!0}}function l0(t,e){return Gp().$$.context.set(t,e),e}function u0(t){return Gp().$$.context.get(t)}function Ac(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(s=>s.call(this,e))}const kc=[],Uc=[];let Bc=[];const Km=[],c0=Promise.resolve();let Jm=!1;function h0(){Jm||(Jm=!0,c0.then(p0))}function h2(){return h0(),c0}function pf(t){Bc.push(t)}function l1(t){Km.push(t)}const Um=new Set;let Mc=0;function p0(){if(Mc!==0)return;const t=Lp;do{try{for(;Mct.indexOf(s)===-1?e.push(s):r.push(s)),r.forEach(s=>s()),Bc=e}const lf=new Set;let ou;function sh(){ou={r:0,c:[],p:ou}}function ah(){ou.r||Cu(ou.c),ou=ou.p}function bn(t,e){t&&t.i&&(lf.delete(t),t.i(e))}function Jn(t,e,r,s){if(t&&t.o){if(lf.has(t))return;lf.add(t),ou.c.push(()=>{lf.delete(t),s&&(r&&t.d(1),s())}),t.o(e)}else s&&s()}function ml(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function h1(t,e,r){const s=t.$$.props[e];s!==void 0&&(t.$$.bound[s]=r,r(t.$$.ctx[s]))}function zc(t){t&&t.c()}function su(t,e,r){const{fragment:s,after_update:l}=t.$$;s&&s.m(e,r),pf(()=>{const p=t.$$.on_mount.map(o0).filter(cg);t.$$.on_destroy?t.$$.on_destroy.push(...p):Cu(p),t.$$.on_mount=[]}),l.forEach(pf)}function au(t,e){const r=t.$$;r.fragment!==null&&(c1(r.after_update),Cu(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function p1(t,e){t.$$.dirty[0]===-1&&(kc.push(t),h0(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const dt=ct.length?ct[0]:U;return L.ctx&&l(L.ctx[k],L.ctx[k]=dt)&&(!L.skip_bound&&L.bound[k]&&L.bound[k](dt),R&&p1(t,k)),U}):[],L.update(),R=!0,Cu(L.before_update),L.fragment=s?s(L.ctx):!1,e.target){if(e.hydrate){const k=r1(e.target);L.fragment&&L.fragment.l(k),k.forEach(on)}else L.fragment&&L.fragment.c();e.intro&&bn(t.$$.fragment),su(t,e.target,e.anchor),p0()}Ip(S)}class vo{constructor(){pl(this,"$$");pl(this,"$$set")}$destroy(){au(this,1),this.$destroy=wr}$on(e,r){if(!cg(r))return wr;const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(r),()=>{const l=s.indexOf(r);l!==-1&&s.splice(l,1)}}$set(e){this.$$set&&!$x(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const d1="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(d1);let Mo;const Aa=new Array(128).fill(void 0);Aa.push(void 0,null,!0,!1);function $e(t){return Aa[t]}let df=0,vp=null;function uf(){return(vp===null||vp.byteLength===0)&&(vp=new Uint8Array(Mo.memory.buffer)),vp}const cf=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},f1=typeof cf.encodeInto=="function"?function(t,e){return cf.encodeInto(t,e)}:function(t,e){const r=cf.encode(t);return e.set(r),{read:t.length,written:r.length}};function py(t,e,r){if(r===void 0){const c=cf.encode(t),S=e(c.length,1)>>>0;return uf().subarray(S,S+c.length).set(c),df=c.length,S}let s=t.length,l=e(s,1)>>>0;const p=uf();let m=0;for(;m127)break;p[l+m]=c}if(m!==s){m!==0&&(t=t.slice(m)),l=r(l,s,s=m+t.length*3,1)>>>0;const c=uf().subarray(l+m,l+s),S=f1(t,c);m+=S.written,l=r(l,s,m,1)>>>0}return df=m,l}function qm(t){return t==null}let xp=null;function pp(){return(xp===null||xp.byteLength===0)&&(xp=new Int32Array(Mo.memory.buffer)),xp}let Ep=Aa.length;function m1(t){t<132||(Aa[t]=Ep,Ep=t)}function sf(t){const e=$e(t);return m1(t),e}const d0=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&d0.decode();function Gm(t,e){return t=t>>>0,d0.decode(uf().subarray(t,t+e))}function ji(t){Ep===Aa.length&&Aa.push(Aa.length+1);const e=Ep;return Ep=Aa[e],Aa[e]=t,e}let bp=null;function g1(){return(bp===null||bp.byteLength===0)&&(bp=new Float64Array(Mo.memory.buffer)),bp}function Qm(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const l=t.description;return l==null?"Symbol":`Symbol(${l})`}if(e=="function"){const l=t.name;return typeof l=="string"&&l.length>0?`Function(${l})`:"Function"}if(Array.isArray(t)){const l=t.length;let p="[";l>0&&(p+=Qm(t[0]));for(let m=1;m1)s=r[1];else return toString.call(t);if(s=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} -${t.stack}`:s}function jm(t,e){try{return t.apply(this,e)}catch(r){Mo.__wbindgen_exn_store(ji(r))}}async function _1(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(s){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}const r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{const r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function y1(){const t={};return t.wbg={},t.wbg.__wbindgen_string_get=function(e,r){const s=$e(r),l=typeof s=="string"?s:void 0;var p=qm(l)?0:py(l,Mo.__wbindgen_malloc,Mo.__wbindgen_realloc),m=df;pp()[e/4+1]=m,pp()[e/4+0]=p},t.wbg.__wbindgen_object_drop_ref=function(e){sf(e)},t.wbg.__wbindgen_error_new=function(e,r){const s=new Error(Gm(e,r));return ji(s)},t.wbg.__wbindgen_is_object=function(e){const r=$e(e);return typeof r=="object"&&r!==null},t.wbg.__wbindgen_is_undefined=function(e){return $e(e)===void 0},t.wbg.__wbindgen_in=function(e,r){return $e(e)in $e(r)},t.wbg.__wbindgen_number_new=function(e){return ji(e)},t.wbg.__wbindgen_string_new=function(e,r){const s=Gm(e,r);return ji(s)},t.wbg.__wbindgen_jsval_loose_eq=function(e,r){return $e(e)==$e(r)},t.wbg.__wbindgen_boolean_get=function(e){const r=$e(e);return typeof r=="boolean"?r?1:0:2},t.wbg.__wbindgen_number_get=function(e,r){const s=$e(r),l=typeof s=="number"?s:void 0;g1()[e/8+1]=qm(l)?0:l,pp()[e/4+0]=!qm(l)},t.wbg.__wbindgen_object_clone_ref=function(e){const r=$e(e);return ji(r)},t.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(e,r){const s=$e(e)[$e(r)];return ji(s)},t.wbg.__wbg_set_841ac57cff3d672b=function(e,r,s){$e(e)[sf(r)]=sf(s)},t.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,r){const s=$e(e)[r>>>0];return ji(s)},t.wbg.__wbg_length_cd7af8117672b8b8=function(e){return $e(e).length},t.wbg.__wbg_new_16b304a2cfa7ff4a=function(){const e=new Array;return ji(e)},t.wbg.__wbindgen_is_function=function(e){return typeof $e(e)=="function"},t.wbg.__wbg_next_40fc327bfc8770e6=function(e){const r=$e(e).next;return ji(r)},t.wbg.__wbg_next_196c84450b364254=function(){return jm(function(e){const r=$e(e).next();return ji(r)},arguments)},t.wbg.__wbg_done_298b57d23c0fc80c=function(e){return $e(e).done},t.wbg.__wbg_value_d93c65011f51a456=function(e){const r=$e(e).value;return ji(r)},t.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return ji(Symbol.iterator)},t.wbg.__wbg_get_e3c254076557e348=function(){return jm(function(e,r){const s=Reflect.get($e(e),$e(r));return ji(s)},arguments)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return jm(function(e,r){const s=$e(e).call($e(r));return ji(s)},arguments)},t.wbg.__wbg_new_72fb9a18b5ae2624=function(){const e=new Object;return ji(e)},t.wbg.__wbg_set_d4638f722068f043=function(e,r,s){$e(e)[r>>>0]=sf(s)},t.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let r;try{r=$e(e)instanceof ArrayBuffer}catch{r=!1}return r},t.wbg.__wbg_entries_95cc2c823b285a09=function(e){const r=Object.entries($e(e));return ji(r)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const r=$e(e).buffer;return ji(r)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){const r=new Uint8Array($e(e));return ji(r)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,r,s){$e(e).set($e(r),s>>>0)},t.wbg.__wbg_length_c20a40f15020d68a=function(e){return $e(e).length},t.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let r;try{r=$e(e)instanceof Uint8Array}catch{r=!1}return r},t.wbg.__wbindgen_debug_string=function(e,r){const s=Qm($e(r)),l=py(s,Mo.__wbindgen_malloc,Mo.__wbindgen_realloc),p=df;pp()[e/4+1]=p,pp()[e/4+0]=l},t.wbg.__wbindgen_throw=function(e,r){throw new Error(Gm(e,r))},t.wbg.__wbindgen_memory=function(){const e=Mo.memory;return ji(e)},t}function v1(t,e){return Mo=t.exports,x1.__wbindgen_wasm_module=e,bp=null,xp=null,vp=null,Mo}async function x1(t){if(Mo!==void 0)return Mo;typeof t>"u"&&(t="/od2net/assets/lts_bg.wasm");const e=y1();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:r,module:s}=await _1(await t,e);return v1(r,s)}var Vc=Math.pow,br=(t,e,r)=>new Promise((s,l)=>{var p=S=>{try{c(r.next(S))}catch(L){l(L)}},m=S=>{try{c(r.throw(S))}catch(L){l(L)}},c=S=>S.done?s(S.value):Promise.resolve(S.value).then(p,m);c((r=r.apply(t,e)).next())}),Do=Uint8Array,Oc=Uint16Array,b1=Int32Array,f0=new Do([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]),m0=new Do([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]),w1=new Do([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),g0=function(t,e){for(var r=new Oc(31),s=0;s<31;++s)r[s]=e+=1<>1|(xn&21845)<<1,Pa=(Pa&52428)>>2|(Pa&13107)<<2,Pa=(Pa&61680)>>4|(Pa&3855)<<4,$m[xn]=((Pa&65280)>>8|(Pa&255)<<8)>>1;var Pa,xn,Sp=function(t,e,r){for(var s=t.length,l=0,p=new Oc(e);l>S]=L}else for(c=new Oc(s),l=0;l>15-t[l]);return c},jp=new Do(288);for(xn=0;xn<144;++xn)jp[xn]=8;var xn;for(xn=144;xn<256;++xn)jp[xn]=9;var xn;for(xn=256;xn<280;++xn)jp[xn]=7;var xn;for(xn=280;xn<288;++xn)jp[xn]=8;var xn,v0=new Do(32);for(xn=0;xn<32;++xn)v0[xn]=5;var xn,C1=Sp(jp,9,1),T1=Sp(v0,5,1),Zm=function(t){for(var e=t[0],r=1;re&&(e=t[r]);return e},Ss=function(t,e,r){var s=e/8|0;return(t[s]|t[s+1]<<8)>>(e&7)&r},Hm=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},L1=function(t){return(t+7)/8|0},P1=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var s=new Do(r-e);return s.set(t.subarray(e,r)),s},A1=["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"],Ao=function(t,e,r){var s=new Error(e||A1[t]);if(s.code=t,Error.captureStackTrace&&Error.captureStackTrace(s,Ao),!r)throw s;return s},pg=function(t,e,r,s){var l=t.length,p=s?s.length:0;if(!l||e.f&&!e.l)return r||new Do(0);var m=!r||e.i!=2,c=e.i;r||(r=new Do(l*3));var S=function(ni){var ai=r.length;if(ni>ai){var bi=new Do(Math.max(ai*2,ni));bi.set(r),r=bi}},L=e.f||0,R=e.p||0,k=e.b||0,U=e.l,ct=e.d,dt=e.m,bt=e.n,It=l*8;do{if(!U){L=Ss(t,R,1);var Dt=Ss(t,R+1,3);if(R+=3,Dt)if(Dt==1)U=C1,ct=T1,dt=9,bt=5;else if(Dt==2){var pe=Ss(t,R,31)+257,Be=Ss(t,R+10,15)+4,ue=pe+Ss(t,R+5,31)+1;R+=14;for(var Pe=new Do(ue),me=new Do(19),ve=0;ve>4;if(Rt<16)Pe[ve++]=Rt;else{var He=0,mn=0;for(Rt==16?(mn=3+Ss(t,R,3),R+=2,He=Pe[ve-1]):Rt==17?(mn=3+Ss(t,R,7),R+=3):Rt==18&&(mn=11+Ss(t,R,127),R+=7);mn--;)Pe[ve++]=He}}var ce=Pe.subarray(0,pe),en=Pe.subarray(pe);dt=Zm(ce),bt=Zm(en),U=Sp(ce,dt,1),ct=Sp(en,bt,1)}else Ao(1);else{var Rt=L1(R)+4,Gt=t[Rt-4]|t[Rt-3]<<8,re=Rt+Gt;if(re>l){c&&Ao(0);break}m&&S(k+Gt),r.set(t.subarray(Rt,re),k),e.b=k+=Gt,e.p=R=re*8,e.f=L;continue}if(R>It){c&&Ao(0);break}}m&&S(k+131072);for(var Rn=(1<>4;if(R+=He&15,R>It){c&&Ao(0);break}if(He||Ao(2),Me<256)r[k++]=Me;else if(Me==256){hn=R,U=null;break}else{var nn=Me-254;if(Me>264){var ve=Me-257,Ln=f0[ve];nn=Ss(t,R,(1<>4;an||Ao(3),R+=an&15;var en=S1[ln];if(ln>3){var Ln=m0[ln];en+=Hm(t,R)&(1<It){c&&Ao(0);break}m&&S(k+131072);var wn=k+nn;if(k>3&1)+(e>>4&1);s>0;s-=!t[r++]);return r+(e&2)},R1=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},N1=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&Ao(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&Ao(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function k1(t,e){return pg(t,{i:2},e&&e.out,e&&e.dictionary)}function z1(t,e){var r=D1(t);return r+8>t.length&&Ao(6,"invalid gzip data"),pg(t.subarray(r,-8),{i:2},e&&e.out||new Do(R1(t)),e&&e.dictionary)}function O1(t,e){return pg(t.subarray(N1(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function tg(t,e){return t[0]==31&&t[1]==139&&t[2]==8?z1(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?k1(t,e):O1(t,e)}var F1=typeof TextDecoder<"u"&&new TextDecoder,B1=0;try{F1.decode(M1,{stream:!0}),B1=1}catch{}var x0=(t,e)=>t*Vc(2,e),dp=(t,e)=>Math.floor(t/Vc(2,e)),ff=(t,e)=>x0(t.getUint16(e+1,!0),8)+t.getUint8(e),b0=(t,e)=>x0(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),V1=(t,e,r,s,l)=>{if(t!==s.getUint8(l))return t-s.getUint8(l);const p=ff(s,l+1);if(e!==p)return e-p;const m=ff(s,l+4);return r!==m?r-m:0},U1=(t,e,r,s)=>{const l=w0(t,e|128,r,s);return l?{z:e,x:r,y:s,offset:l[0],length:l[1],isDir:!0}:null},dy=(t,e,r,s)=>{const l=w0(t,e,r,s);return l?{z:e,x:r,y:s,offset:l[0],length:l[1],isDir:!1}:null},w0=(t,e,r,s)=>{let l=0,p=t.byteLength/17-1;for(;l<=p;){const m=p+l>>1,c=V1(e,r,s,t,m*17);if(c>0)l=m+1;else if(c<0)p=m-1;else return[b0(t,m*17+7),t.getUint32(m*17+13,!0)]}return null},q1=(t,e)=>t.isDir&&!e.isDir?1:!t.isDir&&e.isDir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,I0=(t,e)=>{const r=t.getUint8(e*17);return{z:r&127,x:ff(t,e*17+1),y:ff(t,e*17+4),offset:b0(t,e*17+7),length:t.getUint32(e*17+13,!0),isDir:r>>7===1}},fy=t=>{const e=[],r=new DataView(t);for(let s=0;s{t.sort(q1);const e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let s=0;s>8&255,r[s*17+3]=l.x>>16&255,r[s*17+4]=l.y&255,r[s*17+5]=l.y>>8&255,r[s*17+6]=l.y>>16&255,r[s*17+7]=l.offset&255,r[s*17+8]=dp(l.offset,8)&255,r[s*17+9]=dp(l.offset,16)&255,r[s*17+10]=dp(l.offset,24)&255,r[s*17+11]=dp(l.offset,32)&255,r[s*17+12]=dp(l.offset,48)&255,r[s*17+13]=l.length&255,r[s*17+14]=l.length>>8&255,r[s*17+15]=l.length>>16&255,r[s*17+16]=l.length>>24&255}return e},j1=(t,e)=>{if(t.byteLength<17)return null;const r=t.byteLength/17,s=I0(t,r-1);if(s.isDir){const l=s.z,p=e.z-l,m=Math.trunc(e.x/(1<(e,r)=>{if(r instanceof AbortController)return t(e,r);const s=new AbortController;return t(e,s).then(l=>r(void 0,l.data,l.cacheControl||"",l.expires||""),l=>r(l)).catch(l=>r(l)),{cancel:()=>s.abort()}},p2=class{constructor(){this.tilev4=(t,e)=>br(this,null,function*(){if(t.type==="json"){const k=t.url.substr(10);let U=this.tiles.get(k);U||(U=new my(k),this.tiles.set(k,U));const ct=yield U.getHeader();return{data:{tiles:[`${t.url}/{z}/{x}/{y}`],minzoom:ct.minZoom,maxzoom:ct.maxZoom,bounds:[ct.minLon,ct.minLat,ct.maxLon,ct.maxLat]}}}const r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),s=t.url.match(r);if(!s)throw new Error("Invalid PMTiles protocol URL");const l=s[1];let p=this.tiles.get(l);p||(p=new my(l),this.tiles.set(l,p));const m=s[2],c=s[3],S=s[4],L=yield p.getHeader(),R=yield p==null?void 0:p.getZxy(+m,+c,+S,e.signal);return R?{data:new Uint8Array(R.data),cacheControl:R.cacheControl,expires:R.expires}:L.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=W1(this.tilev4),this.tiles=new Map}add(t){this.tiles.set(t.source.getKey(),t)}get(t){return this.tiles.get(t)}};function Dc(t,e){return(e>>>0)*4294967296+(t>>>0)}function X1(t,e){const r=e.buf;let s=r[e.pos++],l=(s&112)>>4;if(s<128||(s=r[e.pos++],l|=(s&127)<<3,s<128)||(s=r[e.pos++],l|=(s&127)<<10,s<128)||(s=r[e.pos++],l|=(s&127)<<17,s<128)||(s=r[e.pos++],l|=(s&127)<<24,s<128)||(s=r[e.pos++],l|=(s&1)<<31,s<128))return Dc(t,l);throw new Error("Expected varint not more than 10 bytes")}function fp(t){const e=t.buf;let r=e[t.pos++],s=r&127;return r<128||(r=e[t.pos++],s|=(r&127)<<7,r<128)||(r=e[t.pos++],s|=(r&127)<<14,r<128)||(r=e[t.pos++],s|=(r&127)<<21,r<128)?s:(r=e[t.pos],s|=(r&15)<<28,X1(s,t))}function Y1(t,e,r,s){if(s===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const l=e[0];e[0]=e[1],e[1]=l}}var K1=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function J1(t,e,r){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>Vc(2,t)-1||r>Vc(2,t)-1)throw Error("tile x/y outside zoom level bounds");const s=K1[t],l=Vc(2,t);let p=0,m=0,c=0;const S=[e,r];let L=l/2;for(;L>0;)p=(S[0]&L)>0?1:0,m=(S[1]&L)>0?1:0,c+=L*L*(3*p^m),Y1(L,S,p,m),L=L/2;return s+c}function S0(t,e){return br(this,null,function*(){if(e===1||e===0)return t;if(e===2){if(typeof globalThis.DecompressionStream>"u")return tg(new Uint8Array(t));const r=new Response(t).body;if(!r)throw Error("Failed to read response stream");const s=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(s).arrayBuffer()}throw Error("Compression method not supported")})}var Q1=127;function $1(t,e){let r=0,s=t.length-1;for(;r<=s;){const l=s+r>>1,p=e-t[l].tileId;if(p>0)r=l+1;else if(p<0)s=l-1;else return t[l]}return s>=0&&(t[s].runLength===0||e-t[s].tileId=300)throw Error(`Bad response code: ${S.status}`);const R=S.headers.get("Content-Length");if(S.status===200&&(!R||+R>e))throw l&&l.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield S.arrayBuffer(),etag:L||void 0,cacheControl:S.headers.get("Cache-Control")||void 0,expires:S.headers.get("Expires")||void 0}})}};function Cs(t,e){const r=t.getUint32(e+4,!0),s=t.getUint32(e+0,!0);return r*Vc(2,32)+s}function eb(t,e){const r=new DataView(t),s=r.getUint8(7);if(s>3)throw Error(`Archive is spec version ${s} but this library supports up to spec version 3`);return{specVersion:s,rootDirectoryOffset:Cs(r,8),rootDirectoryLength:Cs(r,16),jsonMetadataOffset:Cs(r,24),jsonMetadataLength:Cs(r,32),leafDirectoryOffset:Cs(r,40),leafDirectoryLength:Cs(r,48),tileDataOffset:Cs(r,56),tileDataLength:Cs(r,64),numAddressedTiles:Cs(r,72),numTileEntries:Cs(r,80),numTileContents:Cs(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:e}}function C0(t){const e={buf:new Uint8Array(t),pos:0},r=fp(e),s=[];let l=0;for(let p=0;p0?s[p].offset=s[p-1].offset+s[p-1].length:s[p].offset=m-1}return s}function nb(t){const e=new DataView(t);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var eg=class extends Error{};function ib(t,e){return br(this,null,function*(){const r=yield t.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(nb(r.data)<3)return[yield E0.getHeader(t)];const l=r.data.slice(0,Q1),p=eb(l,r.etag),m=r.data.slice(p.rootDirectoryOffset,p.rootDirectoryOffset+p.rootDirectoryLength),c=`${t.getKey()}|${p.etag||""}|${p.rootDirectoryOffset}|${p.rootDirectoryLength}`,S=C0(yield e(m,p.internalCompression));return[p,[c,S.length,S]]})}function rb(t,e,r,s,l){return br(this,null,function*(){const p=yield t.getBytes(r,s,void 0,l.etag),m=yield e(p.data,l.internalCompression),c=C0(m);if(c.length===0)throw new Error("Empty directory is invalid");return c})}var ob=class{constructor(t=100,e=!0,r=S0){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=r}getHeader(t){return br(this,null,function*(){const e=t.getKey(),r=this.cache.get(e);if(r)return r.lastUsed=this.counter++,yield r.data;const s=new Promise((l,p)=>{ib(t,this.decompress).then(m=>{m[1]&&this.cache.set(m[1][0],{lastUsed:this.counter++,data:Promise.resolve(m[1][2])}),l(m[0]),this.prune()}).catch(m=>{p(m)})});return this.cache.set(e,{lastUsed:this.counter++,data:s}),s})}getDirectory(t,e,r,s){return br(this,null,function*(){const l=`${t.getKey()}|${s.etag||""}|${e}|${r}`,p=this.cache.get(l);if(p)return p.lastUsed=this.counter++,yield p.data;const m=new Promise((c,S)=>{rb(t,this.decompress,e,r,s).then(L=>{c(L),this.prune()}).catch(L=>{S(L)})});return this.cache.set(l,{lastUsed:this.counter++,data:m}),m})}getArrayBuffer(t,e,r,s){return br(this,null,function*(){const l=`${t.getKey()}|${s.etag||""}|${e}|${r}`,p=this.cache.get(l);if(p)return p.lastUsed=this.counter++,yield p.data;const m=new Promise((c,S)=>{t.getBytes(e,r,void 0,s.etag).then(L=>{c(L.data),this.cache.has(l),this.prune()}).catch(L=>{S(L)})});return this.cache.set(l,{lastUsed:this.counter++,data:m}),m})}prune(){if(this.cache.size>=this.maxCacheEntries){let t=1/0,e;this.cache.forEach((r,s)=>{r.lastUsed{this.getHeader(t).then(p=>{s(),this.invalidations.delete(e)}).catch(p=>{l(p)})});this.invalidations.set(e,r)})}},my=class{constructor(t,e,r){typeof t=="string"?this.source=new tb(t):this.source=t,r?this.decompress=r:this.decompress=S0,e?this.cache=e:this.cache=new ob}getHeader(){return br(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,r,s){return br(this,null,function*(){const l=J1(t,e,r),p=yield this.cache.getHeader(this.source);if(p.specVersion<3)return E0.getZxy(p,this.source,this.cache,t,e,r,s);if(tp.maxZoom)return;let m=p.rootDirectoryOffset,c=p.rootDirectoryLength;for(let S=0;S<=3;S++){const L=yield this.cache.getDirectory(this.source,m,c,p),R=$1(L,l);if(R){if(R.runLength>0){const k=yield this.source.getBytes(p.tileDataOffset+R.offset,R.length,s,p.etag);return{data:yield this.decompress(k.data,p.tileCompression),cacheControl:k.cacheControl,expires:k.expires}}m=p.leafDirectoryOffset+R.offset,c=R.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,r,s){return br(this,null,function*(){try{return yield this.getZxyAttempt(t,e,r,s)}catch(l){if(l instanceof eg)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,r,s);throw l}})}getMetadataAttempt(){return br(this,null,function*(){const t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength,void 0,t.etag),r=yield this.decompress(e.data,t.internalCompression),s=new TextDecoder("utf-8");return JSON.parse(s.decode(r))})}getMetadata(){return br(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof eg)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}})}};const Rc=[];function Wm(t,e){return{subscribe:ra(t,e).subscribe}}function ra(t,e=wr){let r;const s=new Set;function l(c){if(Vr(t,c)&&(t=c,r)){const S=!Rc.length;for(const L of s)L[1](),Rc.push(L,t);if(S){for(let L=0;L{s.delete(L),s.size===0&&r&&(r(),r=null)}}return{set:l,update:p,subscribe:m}}let sb=Date.now();function T0(t){return`${t}-${sb++}`}const dg=Symbol.for("svelte-maplibre");function Zp(){return u0(dg)}function ab(t){let e=new WeakMap;return r=>{var m;let s=e.get(r.originalEvent);if(s!==void 0)return s;let p=(m=r.target.queryRenderedFeatures(r.point).find(c=>{var S;return(S=t.get(c.layer.id))==null?void 0:S.interactive}))==null?void 0:m.layer.id;return e.set(r.originalEvent,p),p}}function lb(){let t=new Map;return l0(dg,{map:ra(null),source:Wm(null),layer:Wm(null),popupTarget:Wm(null),cluster:ra(),loadedImages:ra(new Set),minzoom:ra(0),maxzoom:ra(24),layerEvent:ra(null),layerInfo:t,eventTopMost:ab(t)})}function gy(t){return{subscribe:t.subscribe}}function fg({key:t,setPopupTarget:e=!1,setCluster:r=!1,setMouseEvent:s=!1}){let l=Zp(),p=ra(null),m=gy(p),c={...l,[t]:gy(p)};if(e&&(c.popupTarget=m),s){let S=ra(null);c.layerEvent=S,l.layerEvent=S}return r&&(c.cluster=ra()),l0(dg,c),{...l,self:p}}function f2(){return fg({key:"source",setCluster:!0})}function ub(t=!0){return fg({key:"layer",setPopupTarget:t,setMouseEvent:t})}function m2(){return fg({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}var cb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function g2(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function s(){return this instanceof s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(s){var l=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,l.get?l:{enumerable:!0,get:function(){return t[s]}})}),r}var L0={exports:{}};/** +var Kx=Object.defineProperty;var Jx=(t,e,r)=>e in t?Kx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Aa=(t,e,r)=>(Jx(t,typeof e!="symbol"?e+"":e,r),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const p of l)if(p.type==="childList")for(const m of p.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&s(m)}).observe(document,{childList:!0,subtree:!0});function r(l){const p={};return l.integrity&&(p.integrity=l.integrity),l.referrerPolicy&&(p.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?p.credentials="include":l.crossOrigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function s(l){if(l.ep)return;l.ep=!0;const p=r(l);fetch(l.href,p)}})();function Ir(){}function Qx(t,e){for(const r in e)t[r]=e[r];return t}function o0(t){return t()}function ay(){return Object.create(null)}function Cu(t){t.forEach(o0)}function cg(t){return typeof t=="function"}function Ur(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let of;function ly(t,e){return t===e?!0:(of||(of=document.createElement("a")),of.href=e,t===of.href)}function $x(t){return Object.keys(t).length===0}function s0(t,...e){if(t==null){for(const s of e)s(void 0);return Ir}const r=t.subscribe(...e);return r.unsubscribe?()=>r.unsubscribe():r}function a2(t){let e;return s0(t,r=>e=r)(),e}function $r(t,e,r){t.$$.on_destroy.push(s0(e,r))}function uu(t,e,r,s){if(t){const l=a0(t,e,r,s);return t[0](l)}}function a0(t,e,r,s){return t[1]&&s?Qx(r.ctx.slice(),t[1](s(e))):r.ctx}function cu(t,e,r,s){if(t[2]&&s){const l=t[2](s(r));if(e.dirty===void 0)return l;if(typeof l=="object"){const p=[],m=Math.max(e.dirty.length,l.length);for(let c=0;c32){const e=[],r=t.ctx.length/32;for(let s=0;st.removeEventListener(e,r,s)}function l2(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u2(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function Tn(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function c2(t){let e;return{p(...r){e=r,e.forEach(s=>t.push(s))},r(){e.forEach(r=>t.splice(t.indexOf(r),1))}}}function h2(t){return t===""?null:+t}function r1(t){return Array.from(t.childNodes)}function Tp(t,e){e=""+e,t.data!==e&&(t.data=e)}function Vm(t,e){t.value=e??""}function ko(t,e,r,s){r==null?t.style.removeProperty(e):t.style.setProperty(e,r,s?"important":"")}function cy(t,e,r){for(let s=0;s{const l=t.$$.callbacks[e];if(l){const p=s1(e,r,{cancelable:s});return l.slice().forEach(m=>{m.call(t,p)}),!p.defaultPrevented}return!0}}function l0(t,e){return Gp().$$.context.set(t,e),e}function u0(t){return Gp().$$.context.get(t)}function Ac(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(s=>s.call(this,e))}const kc=[],Uc=[];let Bc=[];const Km=[],c0=Promise.resolve();let Jm=!1;function h0(){Jm||(Jm=!0,c0.then(p0))}function d2(){return h0(),c0}function pf(t){Bc.push(t)}function l1(t){Km.push(t)}const Um=new Set;let Mc=0;function p0(){if(Mc!==0)return;const t=Lp;do{try{for(;Mct.indexOf(s)===-1?e.push(s):r.push(s)),r.forEach(s=>s()),Bc=e}const lf=new Set;let ou;function sh(){ou={r:0,c:[],p:ou}}function ah(){ou.r||Cu(ou.c),ou=ou.p}function wn(t,e){t&&t.i&&(lf.delete(t),t.i(e))}function Qn(t,e,r,s){if(t&&t.o){if(lf.has(t))return;lf.add(t),ou.c.push(()=>{lf.delete(t),s&&(r&&t.d(1),s())}),t.o(e)}else s&&s()}function ml(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function h1(t,e,r){const s=t.$$.props[e];s!==void 0&&(t.$$.bound[s]=r,r(t.$$.ctx[s]))}function zc(t){t&&t.c()}function su(t,e,r){const{fragment:s,after_update:l}=t.$$;s&&s.m(e,r),pf(()=>{const p=t.$$.on_mount.map(o0).filter(cg);t.$$.on_destroy?t.$$.on_destroy.push(...p):Cu(p),t.$$.on_mount=[]}),l.forEach(pf)}function au(t,e){const r=t.$$;r.fragment!==null&&(c1(r.after_update),Cu(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function p1(t,e){t.$$.dirty[0]===-1&&(kc.push(t),h0(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const pt=ut.length?ut[0]:U;return L.ctx&&l(L.ctx[k],L.ctx[k]=pt)&&(!L.skip_bound&&L.bound[k]&&L.bound[k](pt),R&&p1(t,k)),U}):[],L.update(),R=!0,Cu(L.before_update),L.fragment=s?s(L.ctx):!1,e.target){if(e.hydrate){const k=r1(e.target);L.fragment&&L.fragment.l(k),k.forEach(on)}else L.fragment&&L.fragment.c();e.intro&&wn(t.$$.fragment),su(t,e.target,e.anchor),p0()}Ip(S)}class xo{constructor(){Aa(this,"$$");Aa(this,"$$set")}$destroy(){au(this,1),this.$destroy=Ir}$on(e,r){if(!cg(r))return Ir;const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(r),()=>{const l=s.indexOf(r);l!==-1&&s.splice(l,1)}}$set(e){this.$$set&&!$x(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const d1="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(d1);let Ro;const Da=new Array(128).fill(void 0);Da.push(void 0,null,!0,!1);function en(t){return Da[t]}let df=0,vp=null;function uf(){return(vp===null||vp.byteLength===0)&&(vp=new Uint8Array(Ro.memory.buffer)),vp}const cf=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},f1=typeof cf.encodeInto=="function"?function(t,e){return cf.encodeInto(t,e)}:function(t,e){const r=cf.encode(t);return e.set(r),{read:t.length,written:r.length}};function py(t,e,r){if(r===void 0){const c=cf.encode(t),S=e(c.length,1)>>>0;return uf().subarray(S,S+c.length).set(c),df=c.length,S}let s=t.length,l=e(s,1)>>>0;const p=uf();let m=0;for(;m127)break;p[l+m]=c}if(m!==s){m!==0&&(t=t.slice(m)),l=r(l,s,s=m+t.length*3,1)>>>0;const c=uf().subarray(l+m,l+s),S=f1(t,c);m+=S.written,l=r(l,s,m,1)>>>0}return df=m,l}function qm(t){return t==null}let xp=null;function pp(){return(xp===null||xp.byteLength===0)&&(xp=new Int32Array(Ro.memory.buffer)),xp}let Ep=Da.length;function m1(t){t<132||(Da[t]=Ep,Ep=t)}function sf(t){const e=en(t);return m1(t),e}const d0=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&d0.decode();function Gm(t,e){return t=t>>>0,d0.decode(uf().subarray(t,t+e))}function Wi(t){Ep===Da.length&&Da.push(Da.length+1);const e=Ep;return Ep=Da[e],Da[e]=t,e}let bp=null;function g1(){return(bp===null||bp.byteLength===0)&&(bp=new Float64Array(Ro.memory.buffer)),bp}function Qm(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const l=t.description;return l==null?"Symbol":`Symbol(${l})`}if(e=="function"){const l=t.name;return typeof l=="string"&&l.length>0?`Function(${l})`:"Function"}if(Array.isArray(t)){const l=t.length;let p="[";l>0&&(p+=Qm(t[0]));for(let m=1;m1)s=r[1];else return toString.call(t);if(s=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} +${t.stack}`:s}function jm(t,e){try{return t.apply(this,e)}catch(r){Ro.__wbindgen_exn_store(Wi(r))}}async function _1(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(s){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}const r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{const r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function y1(){const t={};return t.wbg={},t.wbg.__wbindgen_string_get=function(e,r){const s=en(r),l=typeof s=="string"?s:void 0;var p=qm(l)?0:py(l,Ro.__wbindgen_malloc,Ro.__wbindgen_realloc),m=df;pp()[e/4+1]=m,pp()[e/4+0]=p},t.wbg.__wbindgen_object_drop_ref=function(e){sf(e)},t.wbg.__wbindgen_error_new=function(e,r){const s=new Error(Gm(e,r));return Wi(s)},t.wbg.__wbindgen_is_object=function(e){const r=en(e);return typeof r=="object"&&r!==null},t.wbg.__wbindgen_is_undefined=function(e){return en(e)===void 0},t.wbg.__wbindgen_in=function(e,r){return en(e)in en(r)},t.wbg.__wbindgen_number_new=function(e){return Wi(e)},t.wbg.__wbindgen_string_new=function(e,r){const s=Gm(e,r);return Wi(s)},t.wbg.__wbindgen_jsval_loose_eq=function(e,r){return en(e)==en(r)},t.wbg.__wbindgen_boolean_get=function(e){const r=en(e);return typeof r=="boolean"?r?1:0:2},t.wbg.__wbindgen_number_get=function(e,r){const s=en(r),l=typeof s=="number"?s:void 0;g1()[e/8+1]=qm(l)?0:l,pp()[e/4+0]=!qm(l)},t.wbg.__wbindgen_object_clone_ref=function(e){const r=en(e);return Wi(r)},t.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(e,r){const s=en(e)[en(r)];return Wi(s)},t.wbg.__wbg_set_841ac57cff3d672b=function(e,r,s){en(e)[sf(r)]=sf(s)},t.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,r){const s=en(e)[r>>>0];return Wi(s)},t.wbg.__wbg_length_cd7af8117672b8b8=function(e){return en(e).length},t.wbg.__wbg_new_16b304a2cfa7ff4a=function(){const e=new Array;return Wi(e)},t.wbg.__wbindgen_is_function=function(e){return typeof en(e)=="function"},t.wbg.__wbg_next_40fc327bfc8770e6=function(e){const r=en(e).next;return Wi(r)},t.wbg.__wbg_next_196c84450b364254=function(){return jm(function(e){const r=en(e).next();return Wi(r)},arguments)},t.wbg.__wbg_done_298b57d23c0fc80c=function(e){return en(e).done},t.wbg.__wbg_value_d93c65011f51a456=function(e){const r=en(e).value;return Wi(r)},t.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return Wi(Symbol.iterator)},t.wbg.__wbg_get_e3c254076557e348=function(){return jm(function(e,r){const s=Reflect.get(en(e),en(r));return Wi(s)},arguments)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return jm(function(e,r){const s=en(e).call(en(r));return Wi(s)},arguments)},t.wbg.__wbg_new_72fb9a18b5ae2624=function(){const e=new Object;return Wi(e)},t.wbg.__wbg_set_d4638f722068f043=function(e,r,s){en(e)[r>>>0]=sf(s)},t.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let r;try{r=en(e)instanceof ArrayBuffer}catch{r=!1}return r},t.wbg.__wbg_entries_95cc2c823b285a09=function(e){const r=Object.entries(en(e));return Wi(r)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const r=en(e).buffer;return Wi(r)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){const r=new Uint8Array(en(e));return Wi(r)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,r,s){en(e).set(en(r),s>>>0)},t.wbg.__wbg_length_c20a40f15020d68a=function(e){return en(e).length},t.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let r;try{r=en(e)instanceof Uint8Array}catch{r=!1}return r},t.wbg.__wbindgen_debug_string=function(e,r){const s=Qm(en(r)),l=py(s,Ro.__wbindgen_malloc,Ro.__wbindgen_realloc),p=df;pp()[e/4+1]=p,pp()[e/4+0]=l},t.wbg.__wbindgen_throw=function(e,r){throw new Error(Gm(e,r))},t.wbg.__wbindgen_memory=function(){const e=Ro.memory;return Wi(e)},t}function v1(t,e){return Ro=t.exports,x1.__wbindgen_wasm_module=e,bp=null,xp=null,vp=null,Ro}async function x1(t){if(Ro!==void 0)return Ro;typeof t>"u"&&(t="/od2net/assets/lts_bg.wasm");const e=y1();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:r,module:s}=await _1(await t,e);return v1(r,s)}var Vc=Math.pow,wr=(t,e,r)=>new Promise((s,l)=>{var p=S=>{try{c(r.next(S))}catch(L){l(L)}},m=S=>{try{c(r.throw(S))}catch(L){l(L)}},c=S=>S.done?s(S.value):Promise.resolve(S.value).then(p,m);c((r=r.apply(t,e)).next())}),No=Uint8Array,Oc=Uint16Array,b1=Int32Array,f0=new No([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]),m0=new No([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]),w1=new No([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),g0=function(t,e){for(var r=new Oc(31),s=0;s<31;++s)r[s]=e+=1<>1|(bn&21845)<<1,Ma=(Ma&52428)>>2|(Ma&13107)<<2,Ma=(Ma&61680)>>4|(Ma&3855)<<4,$m[bn]=((Ma&65280)>>8|(Ma&255)<<8)>>1;var Ma,bn,Sp=function(t,e,r){for(var s=t.length,l=0,p=new Oc(e);l>S]=L}else for(c=new Oc(s),l=0;l>15-t[l]);return c},jp=new No(288);for(bn=0;bn<144;++bn)jp[bn]=8;var bn;for(bn=144;bn<256;++bn)jp[bn]=9;var bn;for(bn=256;bn<280;++bn)jp[bn]=7;var bn;for(bn=280;bn<288;++bn)jp[bn]=8;var bn,v0=new No(32);for(bn=0;bn<32;++bn)v0[bn]=5;var bn,C1=Sp(jp,9,1),T1=Sp(v0,5,1),Zm=function(t){for(var e=t[0],r=1;re&&(e=t[r]);return e},Ts=function(t,e,r){var s=e/8|0;return(t[s]|t[s+1]<<8)>>(e&7)&r},Hm=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},L1=function(t){return(t+7)/8|0},P1=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var s=new No(r-e);return s.set(t.subarray(e,r)),s},A1=["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"],Do=function(t,e,r){var s=new Error(e||A1[t]);if(s.code=t,Error.captureStackTrace&&Error.captureStackTrace(s,Do),!r)throw s;return s},pg=function(t,e,r,s){var l=t.length,p=s?s.length:0;if(!l||e.f&&!e.l)return r||new No(0);var m=!r||e.i!=2,c=e.i;r||(r=new No(l*3));var S=function(li){var Wn=r.length;if(li>Wn){var ii=new No(Math.max(Wn*2,li));ii.set(r),r=ii}},L=e.f||0,R=e.p||0,k=e.b||0,U=e.l,ut=e.d,pt=e.m,vt=e.n,bt=l*8;do{if(!U){L=Ts(t,R,1);var Dt=Ts(t,R+1,3);if(R+=3,Dt)if(Dt==1)U=C1,ut=T1,pt=9,vt=5;else if(Dt==2){var de=Ts(t,R,31)+257,Ve=Ts(t,R+10,15)+4,he=de+Ts(t,R+5,31)+1;R+=14;for(var Me=new No(he),_e=new No(19),be=0;be>4;if(Rt<16)Me[be++]=Rt;else{var Xe=0,Cn=0;for(Rt==16?(Cn=3+Ts(t,R,3),R+=2,Xe=Me[be-1]):Rt==17?(Cn=3+Ts(t,R,7),R+=3):Rt==18&&(Cn=11+Ts(t,R,127),R+=7);Cn--;)Me[be++]=Xe}}var fe=Me.subarray(0,de),an=Me.subarray(de);pt=Zm(fe),vt=Zm(an),U=Sp(fe,pt,1),ut=Sp(an,vt,1)}else Do(1);else{var Rt=L1(R)+4,Gt=t[Rt-4]|t[Rt-3]<<8,se=Rt+Gt;if(se>l){c&&Do(0);break}m&&S(k+Gt),r.set(t.subarray(Rt,se),k),e.b=k+=Gt,e.p=R=se*8,e.f=L;continue}if(R>bt){c&&Do(0);break}}m&&S(k+131072);for(var Dn=(1<>4;if(R+=Xe&15,R>bt){c&&Do(0);break}if(Xe||Do(2),Re<256)r[k++]=Re;else if(Re==256){mn=R,U=null;break}else{var ln=Re-254;if(Re>264){var be=Re-257,In=f0[be];ln=Ts(t,R,(1<>4;hn||Do(3),R+=hn&15;var an=S1[Ue];if(Ue>3){var In=m0[Ue];an+=Hm(t,R)&(1<bt){c&&Do(0);break}m&&S(k+131072);var gn=k+ln;if(k>3&1)+(e>>4&1);s>0;s-=!t[r++]);return r+(e&2)},R1=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},N1=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&Do(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&Do(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function k1(t,e){return pg(t,{i:2},e&&e.out,e&&e.dictionary)}function z1(t,e){var r=D1(t);return r+8>t.length&&Do(6,"invalid gzip data"),pg(t.subarray(r,-8),{i:2},e&&e.out||new No(R1(t)),e&&e.dictionary)}function O1(t,e){return pg(t.subarray(N1(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function tg(t,e){return t[0]==31&&t[1]==139&&t[2]==8?z1(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?k1(t,e):O1(t,e)}var F1=typeof TextDecoder<"u"&&new TextDecoder,B1=0;try{F1.decode(M1,{stream:!0}),B1=1}catch{}var x0=(t,e)=>t*Vc(2,e),dp=(t,e)=>Math.floor(t/Vc(2,e)),ff=(t,e)=>x0(t.getUint16(e+1,!0),8)+t.getUint8(e),b0=(t,e)=>x0(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),V1=(t,e,r,s,l)=>{if(t!==s.getUint8(l))return t-s.getUint8(l);const p=ff(s,l+1);if(e!==p)return e-p;const m=ff(s,l+4);return r!==m?r-m:0},U1=(t,e,r,s)=>{const l=w0(t,e|128,r,s);return l?{z:e,x:r,y:s,offset:l[0],length:l[1],isDir:!0}:null},dy=(t,e,r,s)=>{const l=w0(t,e,r,s);return l?{z:e,x:r,y:s,offset:l[0],length:l[1],isDir:!1}:null},w0=(t,e,r,s)=>{let l=0,p=t.byteLength/17-1;for(;l<=p;){const m=p+l>>1,c=V1(e,r,s,t,m*17);if(c>0)l=m+1;else if(c<0)p=m-1;else return[b0(t,m*17+7),t.getUint32(m*17+13,!0)]}return null},q1=(t,e)=>t.isDir&&!e.isDir?1:!t.isDir&&e.isDir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,I0=(t,e)=>{const r=t.getUint8(e*17);return{z:r&127,x:ff(t,e*17+1),y:ff(t,e*17+4),offset:b0(t,e*17+7),length:t.getUint32(e*17+13,!0),isDir:r>>7===1}},fy=t=>{const e=[],r=new DataView(t);for(let s=0;s{t.sort(q1);const e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let s=0;s>8&255,r[s*17+3]=l.x>>16&255,r[s*17+4]=l.y&255,r[s*17+5]=l.y>>8&255,r[s*17+6]=l.y>>16&255,r[s*17+7]=l.offset&255,r[s*17+8]=dp(l.offset,8)&255,r[s*17+9]=dp(l.offset,16)&255,r[s*17+10]=dp(l.offset,24)&255,r[s*17+11]=dp(l.offset,32)&255,r[s*17+12]=dp(l.offset,48)&255,r[s*17+13]=l.length&255,r[s*17+14]=l.length>>8&255,r[s*17+15]=l.length>>16&255,r[s*17+16]=l.length>>24&255}return e},j1=(t,e)=>{if(t.byteLength<17)return null;const r=t.byteLength/17,s=I0(t,r-1);if(s.isDir){const l=s.z,p=e.z-l,m=Math.trunc(e.x/(1<(e,r)=>{if(r instanceof AbortController)return t(e,r);const s=new AbortController;return t(e,s).then(l=>r(void 0,l.data,l.cacheControl||"",l.expires||""),l=>r(l)).catch(l=>r(l)),{cancel:()=>s.abort()}},f2=class{constructor(){this.tilev4=(t,e)=>wr(this,null,function*(){if(t.type==="json"){const k=t.url.substr(10);let U=this.tiles.get(k);U||(U=new my(k),this.tiles.set(k,U));const ut=yield U.getHeader();return{data:{tiles:[`${t.url}/{z}/{x}/{y}`],minzoom:ut.minZoom,maxzoom:ut.maxZoom,bounds:[ut.minLon,ut.minLat,ut.maxLon,ut.maxLat]}}}const r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),s=t.url.match(r);if(!s)throw new Error("Invalid PMTiles protocol URL");const l=s[1];let p=this.tiles.get(l);p||(p=new my(l),this.tiles.set(l,p));const m=s[2],c=s[3],S=s[4],L=yield p.getHeader(),R=yield p==null?void 0:p.getZxy(+m,+c,+S,e.signal);return R?{data:new Uint8Array(R.data),cacheControl:R.cacheControl,expires:R.expires}:L.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=W1(this.tilev4),this.tiles=new Map}add(t){this.tiles.set(t.source.getKey(),t)}get(t){return this.tiles.get(t)}};function Dc(t,e){return(e>>>0)*4294967296+(t>>>0)}function X1(t,e){const r=e.buf;let s=r[e.pos++],l=(s&112)>>4;if(s<128||(s=r[e.pos++],l|=(s&127)<<3,s<128)||(s=r[e.pos++],l|=(s&127)<<10,s<128)||(s=r[e.pos++],l|=(s&127)<<17,s<128)||(s=r[e.pos++],l|=(s&127)<<24,s<128)||(s=r[e.pos++],l|=(s&1)<<31,s<128))return Dc(t,l);throw new Error("Expected varint not more than 10 bytes")}function fp(t){const e=t.buf;let r=e[t.pos++],s=r&127;return r<128||(r=e[t.pos++],s|=(r&127)<<7,r<128)||(r=e[t.pos++],s|=(r&127)<<14,r<128)||(r=e[t.pos++],s|=(r&127)<<21,r<128)?s:(r=e[t.pos],s|=(r&15)<<28,X1(s,t))}function Y1(t,e,r,s){if(s===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const l=e[0];e[0]=e[1],e[1]=l}}var K1=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function J1(t,e,r){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>Vc(2,t)-1||r>Vc(2,t)-1)throw Error("tile x/y outside zoom level bounds");const s=K1[t],l=Vc(2,t);let p=0,m=0,c=0;const S=[e,r];let L=l/2;for(;L>0;)p=(S[0]&L)>0?1:0,m=(S[1]&L)>0?1:0,c+=L*L*(3*p^m),Y1(L,S,p,m),L=L/2;return s+c}function S0(t,e){return wr(this,null,function*(){if(e===1||e===0)return t;if(e===2){if(typeof globalThis.DecompressionStream>"u")return tg(new Uint8Array(t));const r=new Response(t).body;if(!r)throw Error("Failed to read response stream");const s=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(s).arrayBuffer()}throw Error("Compression method not supported")})}var Q1=127;function $1(t,e){let r=0,s=t.length-1;for(;r<=s;){const l=s+r>>1,p=e-t[l].tileId;if(p>0)r=l+1;else if(p<0)s=l-1;else return t[l]}return s>=0&&(t[s].runLength===0||e-t[s].tileId=300)throw Error(`Bad response code: ${S.status}`);const R=S.headers.get("Content-Length");if(S.status===200&&(!R||+R>e))throw l&&l.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield S.arrayBuffer(),etag:L||void 0,cacheControl:S.headers.get("Cache-Control")||void 0,expires:S.headers.get("Expires")||void 0}})}};function Ls(t,e){const r=t.getUint32(e+4,!0),s=t.getUint32(e+0,!0);return r*Vc(2,32)+s}function eb(t,e){const r=new DataView(t),s=r.getUint8(7);if(s>3)throw Error(`Archive is spec version ${s} but this library supports up to spec version 3`);return{specVersion:s,rootDirectoryOffset:Ls(r,8),rootDirectoryLength:Ls(r,16),jsonMetadataOffset:Ls(r,24),jsonMetadataLength:Ls(r,32),leafDirectoryOffset:Ls(r,40),leafDirectoryLength:Ls(r,48),tileDataOffset:Ls(r,56),tileDataLength:Ls(r,64),numAddressedTiles:Ls(r,72),numTileEntries:Ls(r,80),numTileContents:Ls(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:e}}function C0(t){const e={buf:new Uint8Array(t),pos:0},r=fp(e),s=[];let l=0;for(let p=0;p0?s[p].offset=s[p-1].offset+s[p-1].length:s[p].offset=m-1}return s}function nb(t){const e=new DataView(t);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var eg=class extends Error{};function ib(t,e){return wr(this,null,function*(){const r=yield t.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(nb(r.data)<3)return[yield E0.getHeader(t)];const l=r.data.slice(0,Q1),p=eb(l,r.etag),m=r.data.slice(p.rootDirectoryOffset,p.rootDirectoryOffset+p.rootDirectoryLength),c=`${t.getKey()}|${p.etag||""}|${p.rootDirectoryOffset}|${p.rootDirectoryLength}`,S=C0(yield e(m,p.internalCompression));return[p,[c,S.length,S]]})}function rb(t,e,r,s,l){return wr(this,null,function*(){const p=yield t.getBytes(r,s,void 0,l.etag),m=yield e(p.data,l.internalCompression),c=C0(m);if(c.length===0)throw new Error("Empty directory is invalid");return c})}var ob=class{constructor(t=100,e=!0,r=S0){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=r}getHeader(t){return wr(this,null,function*(){const e=t.getKey(),r=this.cache.get(e);if(r)return r.lastUsed=this.counter++,yield r.data;const s=new Promise((l,p)=>{ib(t,this.decompress).then(m=>{m[1]&&this.cache.set(m[1][0],{lastUsed:this.counter++,data:Promise.resolve(m[1][2])}),l(m[0]),this.prune()}).catch(m=>{p(m)})});return this.cache.set(e,{lastUsed:this.counter++,data:s}),s})}getDirectory(t,e,r,s){return wr(this,null,function*(){const l=`${t.getKey()}|${s.etag||""}|${e}|${r}`,p=this.cache.get(l);if(p)return p.lastUsed=this.counter++,yield p.data;const m=new Promise((c,S)=>{rb(t,this.decompress,e,r,s).then(L=>{c(L),this.prune()}).catch(L=>{S(L)})});return this.cache.set(l,{lastUsed:this.counter++,data:m}),m})}getArrayBuffer(t,e,r,s){return wr(this,null,function*(){const l=`${t.getKey()}|${s.etag||""}|${e}|${r}`,p=this.cache.get(l);if(p)return p.lastUsed=this.counter++,yield p.data;const m=new Promise((c,S)=>{t.getBytes(e,r,void 0,s.etag).then(L=>{c(L.data),this.cache.has(l),this.prune()}).catch(L=>{S(L)})});return this.cache.set(l,{lastUsed:this.counter++,data:m}),m})}prune(){if(this.cache.size>=this.maxCacheEntries){let t=1/0,e;this.cache.forEach((r,s)=>{r.lastUsed{this.getHeader(t).then(p=>{s(),this.invalidations.delete(e)}).catch(p=>{l(p)})});this.invalidations.set(e,r)})}},my=class{constructor(t,e,r){typeof t=="string"?this.source=new tb(t):this.source=t,r?this.decompress=r:this.decompress=S0,e?this.cache=e:this.cache=new ob}getHeader(){return wr(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,r,s){return wr(this,null,function*(){const l=J1(t,e,r),p=yield this.cache.getHeader(this.source);if(p.specVersion<3)return E0.getZxy(p,this.source,this.cache,t,e,r,s);if(tp.maxZoom)return;let m=p.rootDirectoryOffset,c=p.rootDirectoryLength;for(let S=0;S<=3;S++){const L=yield this.cache.getDirectory(this.source,m,c,p),R=$1(L,l);if(R){if(R.runLength>0){const k=yield this.source.getBytes(p.tileDataOffset+R.offset,R.length,s,p.etag);return{data:yield this.decompress(k.data,p.tileCompression),cacheControl:k.cacheControl,expires:k.expires}}m=p.leafDirectoryOffset+R.offset,c=R.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,r,s){return wr(this,null,function*(){try{return yield this.getZxyAttempt(t,e,r,s)}catch(l){if(l instanceof eg)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,r,s);throw l}})}getMetadataAttempt(){return wr(this,null,function*(){const t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength,void 0,t.etag),r=yield this.decompress(e.data,t.internalCompression),s=new TextDecoder("utf-8");return JSON.parse(s.decode(r))})}getMetadata(){return wr(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof eg)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}})}};const Rc=[];function Wm(t,e){return{subscribe:oa(t,e).subscribe}}function oa(t,e=Ir){let r;const s=new Set;function l(c){if(Ur(t,c)&&(t=c,r)){const S=!Rc.length;for(const L of s)L[1](),Rc.push(L,t);if(S){for(let L=0;L{s.delete(L),s.size===0&&r&&(r(),r=null)}}return{set:l,update:p,subscribe:m}}let sb=Date.now();function T0(t){return`${t}-${sb++}`}const dg=Symbol.for("svelte-maplibre");function Zp(){return u0(dg)}function ab(t){let e=new WeakMap;return r=>{var m;let s=e.get(r.originalEvent);if(s!==void 0)return s;let p=(m=r.target.queryRenderedFeatures(r.point).find(c=>{var S;return(S=t.get(c.layer.id))==null?void 0:S.interactive}))==null?void 0:m.layer.id;return e.set(r.originalEvent,p),p}}function lb(){let t=new Map;return l0(dg,{map:oa(null),source:Wm(null),layer:Wm(null),popupTarget:Wm(null),cluster:oa(),loadedImages:oa(new Set),minzoom:oa(0),maxzoom:oa(24),layerEvent:oa(null),layerInfo:t,eventTopMost:ab(t),markerClickManager:new cb})}function gy(t){return{subscribe:t.subscribe}}function fg({key:t,setPopupTarget:e=!1,setCluster:r=!1,setMouseEvent:s=!1}){let l=Zp(),p=oa(null),m=gy(p),c={...l,[t]:gy(p)};if(e&&(c.popupTarget=m),s){let S=oa(null);c.layerEvent=S,l.layerEvent=S}return r&&(c.cluster=oa()),l0(dg,c),{...l,self:p}}function g2(){return fg({key:"source",setCluster:!0})}function ub(t=!0){return fg({key:"layer",setPopupTarget:t,setMouseEvent:t})}function _2(){return fg({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}class cb{constructor(){Aa(this,"_handlers",new Set)}add(e){this._handlers.add(e)}remove(e){this._handlers.delete(e)}handleClick(e){for(const r of this._handlers)r(e)}}var hb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function y2(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function s(){return this instanceof s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(s){var l=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,l.get?l:{enumerable:!0,get:function(){return t[s]}})}),r}var L0={exports:{}};/** * MapLibre GL JS * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.1.3/LICENSE.txt - */(function(t,e){(function(r,s){t.exports=s()})(cb,function(){var r={},s={};function l(m,c,S){if(s[m]=S,m==="index"){var L="var sharedModule = {}; ("+s.shared+")(sharedModule); ("+s.worker+")(sharedModule);",R={};return s.shared(R),s.index(r,R),typeof window<"u"&&r.setWorkerUrl(window.URL.createObjectURL(new Blob([L],{type:"text/javascript"}))),r}}l("shared",["exports"],function(m){function c(o,n,a,h){return new(a||(a=Promise))(function(g,v){function x(T){try{E(h.next(T))}catch(A){v(A)}}function b(T){try{E(h.throw(T))}catch(A){v(A)}}function E(T){var A;T.done?g(T.value):(A=T.value,A instanceof a?A:new a(function(M){M(A)})).then(x,b)}E((h=h.apply(o,n||[])).next())})}function S(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}typeof SuppressedError=="function"&&SuppressedError;var L=R;function R(o,n){this.x=o,this.y=n}R.prototype={clone:function(){return new R(this.x,this.y)},add:function(o){return this.clone()._add(o)},sub:function(o){return this.clone()._sub(o)},multByPoint:function(o){return this.clone()._multByPoint(o)},divByPoint:function(o){return this.clone()._divByPoint(o)},mult:function(o){return this.clone()._mult(o)},div:function(o){return this.clone()._div(o)},rotate:function(o){return this.clone()._rotate(o)},rotateAround:function(o,n){return this.clone()._rotateAround(o,n)},matMult:function(o){return this.clone()._matMult(o)},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(o){return this.x===o.x&&this.y===o.y},dist:function(o){return Math.sqrt(this.distSqr(o))},distSqr:function(o){var n=o.x-this.x,a=o.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(o){return Math.atan2(this.y-o.y,this.x-o.x)},angleWith:function(o){return this.angleWithSep(o.x,o.y)},angleWithSep:function(o,n){return Math.atan2(this.x*n-this.y*o,this.x*o+this.y*n)},_matMult:function(o){var n=o[2]*this.x+o[3]*this.y;return this.x=o[0]*this.x+o[1]*this.y,this.y=n,this},_add:function(o){return this.x+=o.x,this.y+=o.y,this},_sub:function(o){return this.x-=o.x,this.y-=o.y,this},_mult:function(o){return this.x*=o,this.y*=o,this},_div:function(o){return this.x/=o,this.y/=o,this},_multByPoint:function(o){return this.x*=o.x,this.y*=o.y,this},_divByPoint:function(o){return this.x/=o.x,this.y/=o.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var o=this.y;return this.y=this.x,this.x=-o,this},_rotate:function(o){var n=Math.cos(o),a=Math.sin(o),h=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=h,this},_rotateAround:function(o,n){var a=Math.cos(o),h=Math.sin(o),g=n.y+h*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-h*(this.y-n.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},R.convert=function(o){return o instanceof R?o:Array.isArray(o)?new R(o[0],o[1]):o};var k=S(L),U=ct;function ct(o,n,a,h){this.cx=3*o,this.bx=3*(a-o)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(h-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=o,this.p1y=n,this.p2x=a,this.p2y=h}ct.prototype={sampleCurveX:function(o){return((this.ax*o+this.bx)*o+this.cx)*o},sampleCurveY:function(o){return((this.ay*o+this.by)*o+this.cy)*o},sampleCurveDerivativeX:function(o){return(3*this.ax*o+2*this.bx)*o+this.cx},solveCurveX:function(o,n){if(n===void 0&&(n=1e-6),o<0)return 0;if(o>1)return 1;for(var a=o,h=0;h<8;h++){var g=this.sampleCurveX(a)-o;if(Math.abs(g)g?x=a:b=a,a=.5*(b-x)+x;return a},solve:function(o,n){return this.sampleCurveY(this.solveCurveX(o,n))}};var dt=S(U);let bt,It;function Dt(){return bt==null&&(bt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),bt}function Rt(){if(It==null&&(It=!1,Dt())){const n=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(n){for(let h=0;h<5*5;h++){const g=4*h;n.fillStyle=`rgb(${g},${g+1},${g+2})`,n.fillRect(h%5,Math.floor(h/5),1,1)}const a=n.getImageData(0,0,5,5).data;for(let h=0;h<5*5*4;h++)if(h%4!=3&&a[h]!==h){It=!0;break}}}return It||!1}function Gt(o,n,a,h){const g=new dt(o,n,a,h);return function(v){return g.solve(v)}}const re=Gt(.25,.1,.25,1);function pe(o,n,a){return Math.min(a,Math.max(n,o))}function Be(o,n,a){const h=a-n,g=((o-n)%h+h)%h+n;return g===n?a:g}function ue(o,...n){for(const a of n)for(const h in a)o[h]=a[h];return o}let Pe=1;function me(o,n,a){const h={};for(const g in o)h[g]=n.call(a||this,o[g],g,o);return h}function ve(o,n,a){const h={};for(const g in o)n.call(a||this,o[g],g,o)&&(h[g]=o[g]);return h}function Nt(o){return Array.isArray(o)?o.map(Nt):typeof o=="object"&&o?me(o,Nt):o}const sn={};function Re(o){sn[o]||(typeof console<"u"&&console.warn(o),sn[o]=!0)}function ge(o,n,a){return(a.y-o.y)*(n.x-o.x)>(n.y-o.y)*(a.x-o.x)}function He(o){let n=0;for(let a,h,g=0,v=o.length,x=v-1;g"u")throw new Error("VideoFrame not supported");const v=new VideoFrame(o,{timestamp:0});try{const x=v==null?void 0:v.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const b=x.startsWith("BGR"),E=new Uint8ClampedArray(h*g*4);if(yield v.copyTo(E,function(T,A,M,O,B){const q=4*Math.max(-A,0),Z=(Math.max(0,M)-M)*O*4+q,Y=4*O,$=Math.max(0,A),ut=Math.max(0,M);return{rect:{x:$,y:ut,width:Math.min(T.width,A+O)-$,height:Math.min(T.height,M+B)-ut},layout:[{offset:Z,stride:Y}]}}(o,n,a,h,g)),b)for(let T=0;Tmn(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ni=function(o,n){if(/:\/\//.test(o.url)&&!/^https?:|^file:/.test(o.url)){const h=ln(o.url);if(h)return h(o,n);if(mn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:o,targetMapId:wn},n)}if(!(/^file:/.test(a=o.url)||/^file:/.test(Ji())&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(h,g){return c(this,void 0,void 0,function*(){const v=new Request(h.url,{method:h.method||"GET",body:h.body,credentials:h.credentials,headers:h.headers,cache:h.cache,referrer:Ji(),signal:g.signal});h.type==="json"&&v.headers.set("Accept","application/json");const x=yield fetch(v);if(!x.ok){const T=yield x.blob();throw new Vn(x.status,x.statusText,h.url,T)}let b;b=h.type==="arrayBuffer"||h.type==="image"?x.arrayBuffer():h.type==="json"?x.json():x.text();const E=yield b;if(g.signal.aborted)throw Ln();return{data:E,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(o,n);if(mn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:o,mustQueue:!0,targetMapId:wn},n)}var a;return function(h,g){return new Promise((v,x)=>{const b=new XMLHttpRequest;b.open(h.method||"GET",h.url,!0),h.type!=="arrayBuffer"&&h.type!=="image"||(b.responseType="arraybuffer");for(const E in h.headers)b.setRequestHeader(E,h.headers[E]);h.type==="json"&&(b.responseType="text",b.setRequestHeader("Accept","application/json")),b.withCredentials=h.credentials==="include",b.onerror=()=>{x(new Error(b.statusText))},b.onload=()=>{if(!g.signal.aborted)if((b.status>=200&&b.status<300||b.status===0)&&b.response!==null){let E=b.response;if(h.type==="json")try{E=JSON.parse(b.response)}catch(T){return void x(T)}v({data:E,cacheControl:b.getResponseHeader("Cache-Control"),expires:b.getResponseHeader("Expires")})}else{const E=new Blob([b.response],{type:b.getResponseHeader("Content-Type")});x(new Vn(b.status,b.statusText,h.url,E))}},g.signal.addEventListener("abort",()=>{b.abort(),x(Ln())}),b.send(h.body)})}(o,n)};function ai(o){if(!o||o.indexOf("://")<=0||o.indexOf("data:image/")===0||o.indexOf("blob:")===0)return!0;const n=new URL(o),a=window.location;return n.protocol===a.protocol&&n.host===a.host}function bi(o,n,a){a[o]&&a[o].indexOf(n)!==-1||(a[o]=a[o]||[],a[o].push(n))}function at(o,n,a){if(a&&a[o]){const h=a[o].indexOf(n);h!==-1&&a[o].splice(h,1)}}class _t{constructor(n,a={}){ue(this,a),this.type=n}}class ze extends _t{constructor(n,a={}){super("error",ue({error:n},a))}}class Pn{on(n,a){return this._listeners=this._listeners||{},bi(n,a,this._listeners),this}off(n,a){return at(n,a,this._listeners),at(n,a,this._oneTimeListeners),this}once(n,a){return a?(this._oneTimeListeners=this._oneTimeListeners||{},bi(n,a,this._oneTimeListeners),this):new Promise(h=>this.once(n,h))}fire(n,a){typeof n=="string"&&(n=new _t(n,a||{}));const h=n.type;if(this.listens(h)){n.target=this;const g=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(const b of g)b.call(this,n);const v=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(const b of v)at(h,b,this._oneTimeListeners),b.call(this,n);const x=this._eventedParent;x&&(ue(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(n))}else n instanceof ze&&console.error(n.error);return this}listens(n){return this._listeners&&this._listeners[n]&&this._listeners[n].length>0||this._oneTimeListeners&&this._oneTimeListeners[n]&&this._oneTimeListeners[n].length>0||this._eventedParent&&this._eventedParent.listens(n)}setEventedParent(n,a){return this._eventedParent=n,this._eventedParentData=a,this}}var xt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",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-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-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}},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 hr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Us(o,n){const a={};for(const h in o)h!=="ref"&&(a[h]=o[h]);return hr.forEach(h=>{h in n&&(a[h]=n[h])}),a}function Oe(o,n){if(Array.isArray(o)){if(!Array.isArray(n)||o.length!==n.length)return!1;for(let a=0;a`:o.itemType.kind==="value"?"array":`array<${n}>`}return o.kind}const it=[Qi,jt,Ae,Ce,fi,Ii,Ho,G(be),K,z,F];function rt(o,n){if(n.kind==="error")return null;if(o.kind==="array"){if(n.kind==="array"&&(n.N===0&&n.itemType.kind==="value"||!rt(o.itemType,n.itemType))&&(typeof o.N!="number"||o.N===n.N))return null}else{if(o.kind===n.kind)return null;if(o.kind==="value"){for(const a of it)if(!rt(a,n))return null}}return`Expected ${H(o)} but found ${H(n)} instead.`}function lt(o,n){return n.some(a=>a.kind===o.kind)}function et(o,n){return n.some(a=>a==="null"?o===null:a==="array"?Array.isArray(o):a==="object"?o&&!Array.isArray(o)&&typeof o=="object":a===typeof o)}function pt(o,n){return o.kind==="array"&&n.kind==="array"?o.itemType.kind===n.itemType.kind&&typeof o.N=="number":o.kind===n.kind}const Lt=.96422,St=.82521,Ct=4/29,ee=6/29,se=3*ee*ee,we=ee*ee*ee,_e=Math.PI/180,qe=180/Math.PI;function gn(o){return(o%=360)<0&&(o+=360),o}function Nn([o,n,a,h]){let g,v;const x=Te((.2225045*(o=mi(o))+.7168786*(n=mi(n))+.0606169*(a=mi(a)))/1);o===n&&n===a?g=v=x:(g=Te((.4360747*o+.3850649*n+.1430804*a)/Lt),v=Te((.0139322*o+.0971045*n+.7141733*a)/St));const b=116*x-16;return[b<0?0:b,500*(g-x),200*(x-v),h]}function mi(o){return o<=.04045?o/12.92:Math.pow((o+.055)/1.055,2.4)}function Te(o){return o>we?Math.pow(o,1/3):o/se+Ct}function Wn([o,n,a,h]){let g=(o+16)/116,v=isNaN(n)?g:g+n/500,x=isNaN(a)?g:g-a/200;return g=1*pr(g),v=Lt*pr(v),x=St*pr(x),[Ei(3.1338561*v-1.6168667*g-.4906146*x),Ei(-.9787684*v+1.9161415*g+.033454*x),Ei(.0719453*v-.2289914*g+1.4052427*x),h]}function Ei(o){return(o=o<=.00304?12.92*o:1.055*Math.pow(o,1/2.4)-.055)<0?0:o>1?1:o}function pr(o){return o>ee?o*o*o:se*(o-Ct)}function Cr(o){return parseInt(o.padEnd(2,o),16)/255}function zi(o,n){return Wo(n?o/100:o,0,1)}function Wo(o,n,a){return Math.min(Math.max(n,o),a)}function $p(o){return!o.some(Number.isNaN)}const kf={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class pn{constructor(n,a,h,g=1,v=!0){this.r=n,this.g=a,this.b=h,this.a=g,v||(this.r*=g,this.g*=g,this.b*=g,g||this.overwriteGetter("rgb",[n,a,h,g]))}static parse(n){if(n instanceof pn)return n;if(typeof n!="string")return;const a=function(h){if((h=h.toLowerCase().trim())==="transparent")return[0,0,0,0];const g=kf[h];if(g){const[x,b,E]=g;return[x/255,b/255,E/255,1]}if(h.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(h)){const x=h.length<6?1:2;let b=1;return[Cr(h.slice(b,b+=x)),Cr(h.slice(b,b+=x)),Cr(h.slice(b,b+=x)),Cr(h.slice(b,b+x)||"ff")]}if(h.startsWith("rgb")){const x=h.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[b,E,T,A,M,O,B,q,Z,Y,$,ut]=x,tt=[A||" ",B||" ",Y].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const ot=[T,O,Z].join(""),Et=ot==="%%%"?100:ot===""?255:0;if(Et){const Tt=[Wo(+E/Et,0,1),Wo(+M/Et,0,1),Wo(+q/Et,0,1),$?zi(+$,ut):1];if($p(Tt))return Tt}}return}}const v=h.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[x,b,E,T,A,M,O,B,q]=v,Z=[E||" ",A||" ",O].join("");if(Z===" "||Z===" /"||Z===",,"||Z===",,,"){const Y=[+b,Wo(+T,0,100),Wo(+M,0,100),B?zi(+B,q):1];if($p(Y))return function([$,ut,tt,ot]){function Et(Tt){const Xt=(Tt+$/30)%12,Qt=ut*Math.min(tt,1-tt);return tt-Qt*Math.max(-1,Math.min(Xt-3,9-Xt,1))}return $=gn($),ut/=100,tt/=100,[Et(0),Et(8),Et(4),ot]}(Y)}}}(n);return a?new pn(...a,!1):void 0}get rgb(){const{r:n,g:a,b:h,a:g}=this,v=g||1/0;return this.overwriteGetter("rgb",[n/v,a/v,h/v,g])}get hcl(){return this.overwriteGetter("hcl",function(n){const[a,h,g,v]=Nn(n),x=Math.sqrt(h*h+g*g);return[Math.round(1e4*x)?gn(Math.atan2(g,h)*qe):NaN,x,a,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Nn(this.rgb))}overwriteGetter(n,a){return Object.defineProperty(this,n,{value:a}),a}toString(){const[n,a,h,g]=this.rgb;return`rgba(${[n,a,h].map(v=>Math.round(255*v)).join(",")},${g})`}}pn.black=new pn(0,0,0,1),pn.white=new pn(1,1,1,1),pn.transparent=new pn(0,0,0,0),pn.red=new pn(1,0,0,1);class ph{constructor(n,a,h){this.sensitivity=n?a?"variant":"case":a?"accent":"base",this.locale=h,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(n,a){return this.collator.compare(n,a)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class dh{constructor(n,a,h,g,v){this.text=n,this.image=a,this.scale=h,this.fontStack=g,this.textColor=v}}class qr{constructor(n){this.sections=n}static fromString(n){return new qr([new dh(n,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(n=>n.text.length!==0||n.image&&n.image.name.length!==0)}static factory(n){return n instanceof qr?n:qr.fromString(n)}toString(){return this.sections.length===0?"":this.sections.map(n=>n.text).join("")}}class Tr{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Tr)return n;if(typeof n=="number")return new Tr([n,n,n,n]);if(Array.isArray(n)&&!(n.length<1||n.length>4)){for(const a of n)if(typeof a!="number")return;switch(n.length){case 1:n=[n[0],n[0],n[0],n[0]];break;case 2:n=[n[0],n[1],n[0],n[1]];break;case 3:n=[n[0],n[1],n[2],n[1]]}return new Tr(n)}}toString(){return JSON.stringify(this.values)}}const Rl=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class so{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof so)return n;if(Array.isArray(n)&&!(n.length<1)&&n.length%2==0){for(let a=0;a=0&&o<=255&&typeof n=="number"&&n>=0&&n<=255&&typeof a=="number"&&a>=0&&a<=255?h===void 0||typeof h=="number"&&h>=0&&h<=1?null:`Invalid rgba value [${[o,n,a,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof h=="number"?[o,n,a,h]:[o,n,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ru(o){if(o===null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"||o instanceof pn||o instanceof ph||o instanceof qr||o instanceof Tr||o instanceof so||o instanceof ao)return!0;if(Array.isArray(o)){for(const n of o)if(!Ru(n))return!1;return!0}if(typeof o=="object"){for(const n in o)if(!Ru(o[n]))return!1;return!0}return!1}function gi(o){if(o===null)return Qi;if(typeof o=="string")return Ae;if(typeof o=="boolean")return Ce;if(typeof o=="number")return jt;if(o instanceof pn)return fi;if(o instanceof ph)return fa;if(o instanceof qr)return Ii;if(o instanceof Tr)return K;if(o instanceof so)return F;if(o instanceof ao)return z;if(Array.isArray(o)){const n=o.length;let a;for(const h of o){const g=gi(h);if(a){if(a===g)continue;a=be;break}a=g}return G(a||be,n)}return Ho}function Nl(o){const n=typeof o;return o===null?"":n==="string"||n==="number"||n==="boolean"?String(o):o instanceof pn||o instanceof qr||o instanceof Tr||o instanceof so||o instanceof ao?o.toString():JSON.stringify(o)}class Gs{constructor(n,a){this.type=n,this.value=a}static parse(n,a){if(n.length!==2)return a.error(`'literal' expression requires exactly one argument, but found ${n.length-1} instead.`);if(!Ru(n[1]))return a.error("invalid value");const h=n[1];let g=gi(h);const v=a.expectedType;return g.kind!=="array"||g.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(g=v),new Gs(g,h)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Un{constructor(n){this.name="ExpressionEvaluationError",this.message=n}toJSON(){return this.message}}const Nu={string:Ae,number:jt,boolean:Ce,object:Ho};class Gr{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");let h,g=1;const v=n[0];if(v==="array"){let b,E;if(n.length>2){const T=n[1];if(typeof T!="string"||!(T in Nu)||T==="object")return a.error('The item type argument of "array" must be one of string, number, boolean',1);b=Nu[T],g++}else b=be;if(n.length>3){if(n[2]!==null&&(typeof n[2]!="number"||n[2]<0||n[2]!==Math.floor(n[2])))return a.error('The length argument to "array" must be a positive integer literal',2);E=n[2],g++}h=G(b,E)}else{if(!Nu[v])throw new Error(`Types doesn't contain name = ${v}`);h=Nu[v]}const x=[];for(;gn.outputDefined())}}const ku={"to-boolean":Ce,"to-color":fi,"to-number":jt,"to-string":Ae};class Xo{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const h=n[0];if(!ku[h])throw new Error(`Can't parse ${h} as it is not part of the known types`);if((h==="to-boolean"||h==="to-string")&&n.length!==2)return a.error("Expected one argument.");const g=ku[h],v=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:Wa(a[0],a[1],a[2],a[3]),!h))return new pn(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new Un(h||`Could not parse color from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"padding":{let a;for(const h of this.args){a=h.evaluate(n);const g=Tr.parse(a);if(g)return g}throw new Un(`Could not parse padding from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"variableAnchorOffsetCollection":{let a;for(const h of this.args){a=h.evaluate(n);const g=so.parse(a);if(g)return g}throw new Un(`Could not parse variableAnchorOffsetCollection from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"number":{let a=null;for(const h of this.args){if(a=h.evaluate(n),a===null)return 0;const g=Number(a);if(!isNaN(g))return g}throw new Un(`Could not convert ${JSON.stringify(a)} to number.`)}case"formatted":return qr.fromString(Nl(this.args[0].evaluate(n)));case"resolvedImage":return ao.fromString(Nl(this.args[0].evaluate(n)));default:return Nl(this.args[0].evaluate(n))}}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}const kl=["Unknown","Point","LineString","Polygon"];class dn{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?typeof this.feature.type=="number"?kl[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(n){let a=this._parseColorCache[n];return a||(a=this._parseColorCache[n]=pn.parse(n)),a}}class zu{constructor(n,a,h=[],g,v=new Dl,x=[]){this.registry=n,this.path=h,this.key=h.map(b=>`[${b}]`).join(""),this.scope=v,this.errors=x,this.expectedType=g,this._isConstant=a}parse(n,a,h,g,v={}){return a?this.concat(a,h,g)._parse(n,v):this._parse(n,v)}_parse(n,a){function h(g,v,x){return x==="assert"?new Gr(v,[g]):x==="coerce"?new Xo(v,[g]):g}if(n!==null&&typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"||(n=["literal",n]),Array.isArray(n)){if(n.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=n[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[g];if(v){let x=v.parse(n,this);if(!x)return null;if(this.expectedType){const b=this.expectedType,E=x.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||E.kind!=="value")if(b.kind!=="color"&&b.kind!=="formatted"&&b.kind!=="resolvedImage"||E.kind!=="value"&&E.kind!=="string")if(b.kind!=="padding"||E.kind!=="value"&&E.kind!=="number"&&E.kind!=="array")if(b.kind!=="variableAnchorOffsetCollection"||E.kind!=="value"&&E.kind!=="array"){if(this.checkSubtype(b,E))return null}else x=h(x,b,a.typeAnnotation||"coerce");else x=h(x,b,a.typeAnnotation||"coerce");else x=h(x,b,a.typeAnnotation||"coerce");else x=h(x,b,a.typeAnnotation||"assert")}if(!(x instanceof Gs)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const b=new dn;try{x=new Gs(x.type,x.evaluate(b))}catch(E){return this.error(E.message),null}}return x}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(n===void 0?"'undefined' value invalid. Use null instead.":typeof n=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof n} instead.`)}concat(n,a,h){const g=typeof n=="number"?this.path.concat(n):this.path,v=h?this.scope.concat(h):this.scope;return new zu(this.registry,this._isConstant,g,a||null,v,this.errors)}error(n,...a){const h=`${this.key}${a.map(g=>`[${g}]`).join("")}`;this.errors.push(new Ur(h,n))}checkSubtype(n,a){const h=rt(n,a);return h&&this.error(h),h}}class Xa{constructor(n,a,h){this.type=fa,this.locale=h,this.caseSensitive=n,this.diacriticSensitive=a}static parse(n,a){if(n.length!==2)return a.error("Expected one argument.");const h=n[1];if(typeof h!="object"||Array.isArray(h))return a.error("Collator options argument must be an object.");const g=a.parse(h["case-sensitive"]!==void 0&&h["case-sensitive"],1,Ce);if(!g)return null;const v=a.parse(h["diacritic-sensitive"]!==void 0&&h["diacritic-sensitive"],1,Ce);if(!v)return null;let x=null;return h.locale&&(x=a.parse(h.locale,1,Ae),!x)?null:new Xa(g,v,x)}evaluate(n){return new ph(this.caseSensitive.evaluate(n),this.diacriticSensitive.evaluate(n),this.locale?this.locale.evaluate(n):null)}eachChild(n){n(this.caseSensitive),n(this.diacriticSensitive),this.locale&&n(this.locale)}outputDefined(){return!1}}const js=8192;function Ou(o,n){o[0]=Math.min(o[0],n[0]),o[1]=Math.min(o[1],n[1]),o[2]=Math.max(o[2],n[0]),o[3]=Math.max(o[3],n[1])}function zl(o,n){return!(o[0]<=n[0]||o[2]>=n[2]||o[1]<=n[1]||o[3]>=n[3])}function zf(o,n){const a=(180+o[0])/360,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o[1]*Math.PI/360)))/360,g=Math.pow(2,n.z);return[Math.round(a*g*js),Math.round(h*g*js)]}function td(o,n,a){const h=o[0]-n[0],g=o[1]-n[1],v=o[0]-a[0],x=o[1]-a[1];return h*x-v*g==0&&h*v<=0&&g*x<=0}function Fu(o,n){let a=!1;for(let x=0,b=n.length;x(h=o)[1]!=(v=E[T+1])[1]>h[1]&&h[0]<(v[0]-g[0])*(h[1]-g[1])/(v[1]-g[1])+g[0]&&(a=!a)}}var h,g,v;return a}function Of(o,n){for(let a=0;a0&&b<0||x<0&&b>0}function Ff(o,n,a){for(const T of a)for(let A=0;Aa[2]){const g=.5*h;let v=o[0]-a[0]>g?-h:a[0]-o[0]>g?h:0;v===0&&(v=o[0]-a[2]>g?-h:a[2]-o[0]>g?h:0),o[0]+=v}Ou(n,o)}function Vu(o,n,a,h){const g=Math.pow(2,h.z)*js,v=[h.x*js,h.y*js],x=[];for(const b of o)for(const E of b){const T=[E.x+v[0],E.y+v[1]];od(T,n,a,g),x.push(T)}return x}function sd(o,n,a,h){const g=Math.pow(2,h.z)*js,v=[h.x*js,h.y*js],x=[];for(const E of o){const T=[];for(const A of E){const M=[A.x+v[0],A.y+v[1]];Ou(n,M),T.push(M)}x.push(T)}if(n[2]-n[0]<=g/2){(b=n)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const E of x)for(const T of E)od(T,n,a,g)}var b;return x}class ma{constructor(n,a){this.type=Ce,this.geojson=n,this.geometries=a}static parse(n,a){if(n.length!==2)return a.error(`'within' expression requires exactly one argument, but found ${n.length-1} instead.`);if(Ru(n[1])){const h=n[1];if(h.type==="FeatureCollection"){const g=[];for(const v of h.features){const{type:x,coordinates:b}=v.geometry;x==="Polygon"&&g.push(b),x==="MultiPolygon"&&g.push(...b)}if(g.length)return new ma(h,{type:"MultiPolygon",coordinates:g})}else if(h.type==="Feature"){const g=h.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new ma(h,h.geometry)}else if(h.type==="Polygon"||h.type==="MultiPolygon")return new ma(h,h)}return a.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(a,h){const g=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],x=a.canonicalID();if(h.type==="Polygon"){const b=Bu(h.coordinates,v,x),E=Vu(a.geometry(),g,v,x);if(!zl(g,v))return!1;for(const T of E)if(!Fu(T,b))return!1}if(h.type==="MultiPolygon"){const b=rd(h.coordinates,v,x),E=Vu(a.geometry(),g,v,x);if(!zl(g,v))return!1;for(const T of E)if(!Of(T,b))return!1}return!0}(n,this.geometries);if(n.geometryType()==="LineString")return function(a,h){const g=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],x=a.canonicalID();if(h.type==="Polygon"){const b=Bu(h.coordinates,v,x),E=sd(a.geometry(),g,v,x);if(!zl(g,v))return!1;for(const T of E)if(!nd(T,b))return!1}if(h.type==="MultiPolygon"){const b=rd(h.coordinates,v,x),E=sd(a.geometry(),g,v,x);if(!zl(g,v))return!1;for(const T of E)if(!id(T,b))return!1}return!0}(n,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Uu{constructor(n,a){this.type=a.type,this.name=n,this.boundExpression=a}static parse(n,a){if(n.length!==2||typeof n[1]!="string")return a.error("'var' expression requires exactly one string literal argument.");const h=n[1];return a.scope.has(h)?new Uu(h,a.scope.get(h)):a.error(`Unknown variable "${h}". Make sure "${h}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(n){return this.boundExpression.evaluate(n)}eachChild(){}outputDefined(){return!1}}class jr{constructor(n,a,h,g){this.name=n,this.type=a,this._evaluate=h,this.args=g}evaluate(n){return this._evaluate(n,this.args)}eachChild(n){this.args.forEach(n)}outputDefined(){return!1}static parse(n,a){const h=n[0],g=jr.definitions[h];if(!g)return a.error(`Unknown expression "${h}". If you wanted a literal array, use ["literal", [...]].`,0);const v=Array.isArray(g)?g[0]:g.type,x=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,b=x.filter(([T])=>!Array.isArray(T)||T.length===n.length-1);let E=null;for(const[T,A]of b){E=new zu(a.registry,Ol,a.path,null,a.scope);const M=[];let O=!1;for(let B=1;B{return O=M,Array.isArray(O)?`(${O.map(H).join(", ")})`:`(${H(O.type)}...)`;var O}).join(" | "),A=[];for(let M=1;M{a=n?a&&Ol(h):a&&h instanceof Gs}),!!a&&qu(o)&&Bl(o,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function qu(o){if(o instanceof jr&&(o.name==="get"&&o.args.length===1||o.name==="feature-state"||o.name==="has"&&o.args.length===1||o.name==="properties"||o.name==="geometry-type"||o.name==="id"||/^filter-/.test(o.name))||o instanceof ma)return!1;let n=!0;return o.eachChild(a=>{n&&!qu(a)&&(n=!1)}),n}function Fl(o){if(o instanceof jr&&o.name==="feature-state")return!1;let n=!0;return o.eachChild(a=>{n&&!Fl(a)&&(n=!1)}),n}function Bl(o,n){if(o instanceof jr&&n.indexOf(o.name)>=0)return!1;let a=!0;return o.eachChild(h=>{a&&!Bl(h,n)&&(a=!1)}),a}function Vl(o,n){const a=o.length-1;let h,g,v=0,x=a,b=0;for(;v<=x;)if(b=Math.floor((v+x)/2),h=o[b],g=o[b+1],h<=n){if(b===a||nn))throw new Un("Input is not a number.");x=b-1}return 0}class Ul{constructor(n,a,h){this.type=n,this.input=a,this.labels=[],this.outputs=[];for(const[g,v]of h)this.labels.push(g),this.outputs.push(v)}static parse(n,a){if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");const h=a.parse(n[1],1,jt);if(!h)return null;const g=[];let v=null;a.expectedType&&a.expectedType.kind!=="value"&&(v=a.expectedType);for(let x=1;x=b)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',T);const M=a.parse(E,A,v);if(!M)return null;v=v||M.type,g.push([b,M])}return new Ul(v,h,g)}evaluate(n){const a=this.labels,h=this.outputs;if(a.length===1)return h[0].evaluate(n);const g=this.input.evaluate(n);if(g<=a[0])return h[0].evaluate(n);const v=a.length;return g>=a[v-1]?h[v-1].evaluate(n):h[Vl(a,g)].evaluate(n)}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function Bf(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Vf=ad;function ad(o,n,a,h){this.cx=3*o,this.bx=3*(a-o)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(h-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=o,this.p1y=n,this.p2x=a,this.p2y=h}ad.prototype={sampleCurveX:function(o){return((this.ax*o+this.bx)*o+this.cx)*o},sampleCurveY:function(o){return((this.ay*o+this.by)*o+this.cy)*o},sampleCurveDerivativeX:function(o){return(3*this.ax*o+2*this.bx)*o+this.cx},solveCurveX:function(o,n){if(n===void 0&&(n=1e-6),o<0)return 0;if(o>1)return 1;for(var a=o,h=0;h<8;h++){var g=this.sampleCurveX(a)-o;if(Math.abs(g)g?x=a:b=a,a=.5*(b-x)+x;return a},solve:function(o,n){return this.sampleCurveY(this.solveCurveX(o,n))}};var Uf=Bf(Vf);function ga(o,n,a){return o+a*(n-o)}function Gu(o,n,a){return o.map((h,g)=>ga(h,n[g],a))}const dr={number:ga,color:function(o,n,a,h="rgb"){switch(h){case"rgb":{const[g,v,x,b]=Gu(o.rgb,n.rgb,a);return new pn(g,v,x,b,!1)}case"hcl":{const[g,v,x,b]=o.hcl,[E,T,A,M]=n.hcl;let O,B;if(isNaN(g)||isNaN(E))isNaN(g)?isNaN(E)?O=NaN:(O=E,x!==1&&x!==0||(B=T)):(O=g,A!==1&&A!==0||(B=v));else{let ut=E-g;E>g&&ut>180?ut-=360:E180&&(ut+=360),O=g+a*ut}const[q,Z,Y,$]=function([ut,tt,ot,Et]){return ut=isNaN(ut)?0:ut*_e,Wn([ot,Math.cos(ut)*tt,Math.sin(ut)*tt,Et])}([O,B??ga(v,T,a),ga(x,A,a),ga(b,M,a)]);return new pn(q,Z,Y,$,!1)}case"lab":{const[g,v,x,b]=Wn(Gu(o.lab,n.lab,a));return new pn(g,v,x,b,!1)}}},array:Gu,padding:function(o,n,a){return new Tr(Gu(o.values,n.values,a))},variableAnchorOffsetCollection:function(o,n,a){const h=o.values,g=n.values;if(h.length!==g.length)throw new Un(`Cannot interpolate values of different length. from: ${o.toString()}, to: ${n.toString()}`);const v=[];for(let x=0;xtypeof A!="number"||A<0||A>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:T}}}if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(v=a.parse(v,2,jt),!v)return null;const b=[];let E=null;h==="interpolate-hcl"||h==="interpolate-lab"?E=fi:a.expectedType&&a.expectedType.kind!=="value"&&(E=a.expectedType);for(let T=0;T=A)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',O);const q=a.parse(M,B,E);if(!q)return null;E=E||q.type,b.push([A,q])}return pt(E,jt)||pt(E,fi)||pt(E,K)||pt(E,F)||pt(E,G(jt))?new $i(E,h,g,v,b):a.error(`Type ${H(E)} is not interpolatable.`)}evaluate(n){const a=this.labels,h=this.outputs;if(a.length===1)return h[0].evaluate(n);const g=this.input.evaluate(n);if(g<=a[0])return h[0].evaluate(n);const v=a.length;if(g>=a[v-1])return h[v-1].evaluate(n);const x=Vl(a,g),b=$i.interpolationFactor(this.interpolation,g,a[x],a[x+1]),E=h[x].evaluate(n),T=h[x+1].evaluate(n);switch(this.operator){case"interpolate":return dr[this.type.kind](E,T,b);case"interpolate-hcl":return dr.color(E,T,b,"hcl");case"interpolate-lab":return dr.color(E,T,b,"lab")}}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function Je(o,n,a,h){const g=h-a,v=o-a;return g===0?0:n===1?v/g:(Math.pow(n,v)-1)/(Math.pow(n,g)-1)}class ju{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expectected at least one argument.");let h=null;const g=a.expectedType;g&&g.kind!=="value"&&(h=g);const v=[];for(const b of n.slice(1)){const E=a.parse(b,1+v.length,h,void 0,{typeAnnotation:"omit"});if(!E)return null;h=h||E.type,v.push(E)}if(!h)throw new Error("No output type");const x=g&&v.some(b=>rt(g,b.type));return new ju(x?be:h,v)}evaluate(n){let a,h=null,g=0;for(const v of this.args)if(g++,h=v.evaluate(n),h&&h instanceof ao&&!h.available&&(a||(a=h.name),h=null,g===this.args.length&&(h=a)),h!==null)break;return h}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}class Zu{constructor(n,a){this.type=a.type,this.bindings=[].concat(n),this.result=a}evaluate(n){return this.result.evaluate(n)}eachChild(n){for(const a of this.bindings)n(a[1]);n(this.result)}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found ${n.length-1} instead.`);const h=[];for(let v=1;v=h.length)throw new Un(`Array index out of bounds: ${a} > ${h.length-1}.`);if(a!==Math.floor(a))throw new Un(`Array index must be an integer, but found ${a} instead.`);return h[a]}eachChild(n){n(this.index),n(this.input)}outputDefined(){return!1}}class mh{constructor(n,a){this.type=Ce,this.needle=n,this.haystack=a}static parse(n,a){if(n.length!==3)return a.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const h=a.parse(n[1],1,be),g=a.parse(n[2],2,be);return h&&g?lt(h.type,[Ce,Ae,jt,Qi,be])?new mh(h,g):a.error(`Expected first argument to be of type boolean, string, number or null, but found ${H(h.type)} instead`):null}evaluate(n){const a=this.needle.evaluate(n),h=this.haystack.evaluate(n);if(!h)return!1;if(!et(a,["boolean","string","number","null"]))throw new Un(`Expected first argument to be of type boolean, string, number or null, but found ${H(gi(a))} instead.`);if(!et(h,["string","array"]))throw new Un(`Expected second argument to be of type array or string, but found ${H(gi(h))} instead.`);return h.indexOf(a)>=0}eachChild(n){n(this.needle),n(this.haystack)}outputDefined(){return!0}}class Hu{constructor(n,a,h){this.type=jt,this.needle=n,this.haystack=a,this.fromIndex=h}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const h=a.parse(n[1],1,be),g=a.parse(n[2],2,be);if(!h||!g)return null;if(!lt(h.type,[Ce,Ae,jt,Qi,be]))return a.error(`Expected first argument to be of type boolean, string, number or null, but found ${H(h.type)} instead`);if(n.length===4){const v=a.parse(n[3],3,jt);return v?new Hu(h,g,v):null}return new Hu(h,g)}evaluate(n){const a=this.needle.evaluate(n),h=this.haystack.evaluate(n);if(!et(a,["boolean","string","number","null"]))throw new Un(`Expected first argument to be of type boolean, string, number or null, but found ${H(gi(a))} instead.`);if(!et(h,["string","array"]))throw new Un(`Expected second argument to be of type array or string, but found ${H(gi(h))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(n);return h.indexOf(a,g)}return h.indexOf(a)}eachChild(n){n(this.needle),n(this.haystack),this.fromIndex&&n(this.fromIndex)}outputDefined(){return!1}}class gh{constructor(n,a,h,g,v,x){this.inputType=n,this.type=a,this.input=h,this.cases=g,this.outputs=v,this.otherwise=x}static parse(n,a){if(n.length<5)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if(n.length%2!=1)return a.error("Expected an even number of arguments.");let h,g;a.expectedType&&a.expectedType.kind!=="value"&&(g=a.expectedType);const v={},x=[];for(let T=2;TNumber.MAX_SAFE_INTEGER)return O.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof q=="number"&&Math.floor(q)!==q)return O.error("Numeric branch labels must be integer values.");if(h){if(O.checkSubtype(h,gi(q)))return null}else h=gi(q);if(v[String(q)]!==void 0)return O.error("Branch labels must be unique.");v[String(q)]=x.length}const B=a.parse(M,T,g);if(!B)return null;g=g||B.type,x.push(B)}const b=a.parse(n[1],1,be);if(!b)return null;const E=a.parse(n[n.length-1],n.length-1,g);return E?b.type.kind!=="value"&&a.concat(1).checkSubtype(h,b.type)?null:new gh(h,g,b,v,x,E):null}evaluate(n){const a=this.input.evaluate(n);return(gi(a)===this.inputType&&this.outputs[this.cases[a]]||this.otherwise).evaluate(n)}eachChild(n){n(this.input),this.outputs.forEach(n),n(this.otherwise)}outputDefined(){return this.outputs.every(n=>n.outputDefined())&&this.otherwise.outputDefined()}}class _h{constructor(n,a,h){this.type=n,this.branches=a,this.otherwise=h}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found only ${n.length-1}.`);if(n.length%2!=0)return a.error("Expected an odd number of arguments.");let h;a.expectedType&&a.expectedType.kind!=="value"&&(h=a.expectedType);const g=[];for(let x=1;xa.outputDefined())&&this.otherwise.outputDefined()}}class Wu{constructor(n,a,h,g){this.type=n,this.input=a,this.beginIndex=h,this.endIndex=g}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const h=a.parse(n[1],1,be),g=a.parse(n[2],2,jt);if(!h||!g)return null;if(!lt(h.type,[G(be),Ae,be]))return a.error(`Expected first argument to be of type array or string, but found ${H(h.type)} instead`);if(n.length===4){const v=a.parse(n[3],3,jt);return v?new Wu(h.type,h,g,v):null}return new Wu(h.type,h,g)}evaluate(n){const a=this.input.evaluate(n),h=this.beginIndex.evaluate(n);if(!et(a,["string","array"]))throw new Un(`Expected first argument to be of type array or string, but found ${H(gi(a))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(n);return a.slice(h,g)}return a.slice(h)}eachChild(n){n(this.input),n(this.beginIndex),this.endIndex&&n(this.endIndex)}outputDefined(){return!1}}function ld(o,n){return o==="=="||o==="!="?n.kind==="boolean"||n.kind==="string"||n.kind==="number"||n.kind==="null"||n.kind==="value":n.kind==="string"||n.kind==="number"||n.kind==="value"}function ud(o,n,a,h){return h.compare(n,a)===0}function Ya(o,n,a){const h=o!=="=="&&o!=="!=";return class P0{constructor(v,x,b){this.type=Ce,this.lhs=v,this.rhs=x,this.collator=b,this.hasUntypedArgument=v.type.kind==="value"||x.type.kind==="value"}static parse(v,x){if(v.length!==3&&v.length!==4)return x.error("Expected two or three arguments.");const b=v[0];let E=x.parse(v[1],1,be);if(!E)return null;if(!ld(b,E.type))return x.concat(1).error(`"${b}" comparisons are not supported for type '${H(E.type)}'.`);let T=x.parse(v[2],2,be);if(!T)return null;if(!ld(b,T.type))return x.concat(2).error(`"${b}" comparisons are not supported for type '${H(T.type)}'.`);if(E.type.kind!==T.type.kind&&E.type.kind!=="value"&&T.type.kind!=="value")return x.error(`Cannot compare types '${H(E.type)}' and '${H(T.type)}'.`);h&&(E.type.kind==="value"&&T.type.kind!=="value"?E=new Gr(T.type,[E]):E.type.kind!=="value"&&T.type.kind==="value"&&(T=new Gr(E.type,[T])));let A=null;if(v.length===4){if(E.type.kind!=="string"&&T.type.kind!=="string"&&E.type.kind!=="value"&&T.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(A=x.parse(v[3],3,fa),!A)return null}return new P0(E,T,A)}evaluate(v){const x=this.lhs.evaluate(v),b=this.rhs.evaluate(v);if(h&&this.hasUntypedArgument){const E=gi(x),T=gi(b);if(E.kind!==T.kind||E.kind!=="string"&&E.kind!=="number")throw new Un(`Expected arguments for "${o}" to be (string, string) or (number, number), but found (${E.kind}, ${T.kind}) instead.`)}if(this.collator&&!h&&this.hasUntypedArgument){const E=gi(x),T=gi(b);if(E.kind!=="string"||T.kind!=="string")return n(v,x,b)}return this.collator?a(v,x,b,this.collator.evaluate(v)):n(v,x,b)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const qf=Ya("==",function(o,n,a){return n===a},ud),Gf=Ya("!=",function(o,n,a){return n!==a},function(o,n,a,h){return!ud(0,n,a,h)}),jf=Ya("<",function(o,n,a){return n",function(o,n,a){return n>a},function(o,n,a,h){return h.compare(n,a)>0}),Hf=Ya("<=",function(o,n,a){return n<=a},function(o,n,a,h){return h.compare(n,a)<=0}),Wf=Ya(">=",function(o,n,a){return n>=a},function(o,n,a,h){return h.compare(n,a)>=0});class yh{constructor(n,a,h,g,v){this.type=Ae,this.number=n,this.locale=a,this.currency=h,this.minFractionDigits=g,this.maxFractionDigits=v}static parse(n,a){if(n.length!==3)return a.error("Expected two arguments.");const h=a.parse(n[1],1,jt);if(!h)return null;const g=n[2];if(typeof g!="object"||Array.isArray(g))return a.error("NumberFormat options argument must be an object.");let v=null;if(g.locale&&(v=a.parse(g.locale,1,Ae),!v))return null;let x=null;if(g.currency&&(x=a.parse(g.currency,1,Ae),!x))return null;let b=null;if(g["min-fraction-digits"]&&(b=a.parse(g["min-fraction-digits"],1,jt),!b))return null;let E=null;return g["max-fraction-digits"]&&(E=a.parse(g["max-fraction-digits"],1,jt),!E)?null:new yh(h,v,x,b,E)}evaluate(n){return new Intl.NumberFormat(this.locale?this.locale.evaluate(n):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(n):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(n):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(n):void 0}).format(this.number.evaluate(n))}eachChild(n){n(this.number),this.locale&&n(this.locale),this.currency&&n(this.currency),this.minFractionDigits&&n(this.minFractionDigits),this.maxFractionDigits&&n(this.maxFractionDigits)}outputDefined(){return!1}}class Xu{constructor(n){this.type=Ii,this.sections=n}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const h=n[1];if(!Array.isArray(h)&&typeof h=="object")return a.error("First argument must be an image or text section.");const g=[];let v=!1;for(let x=1;x<=n.length-1;++x){const b=n[x];if(v&&typeof b=="object"&&!Array.isArray(b)){v=!1;let E=null;if(b["font-scale"]&&(E=a.parse(b["font-scale"],1,jt),!E))return null;let T=null;if(b["text-font"]&&(T=a.parse(b["text-font"],1,G(Ae)),!T))return null;let A=null;if(b["text-color"]&&(A=a.parse(b["text-color"],1,fi),!A))return null;const M=g[g.length-1];M.scale=E,M.font=T,M.textColor=A}else{const E=a.parse(n[x],1,be);if(!E)return null;const T=E.type.kind;if(T!=="string"&&T!=="value"&&T!=="null"&&T!=="resolvedImage")return a.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,g.push({content:E,scale:null,font:null,textColor:null})}}return new Xu(g)}evaluate(n){return new qr(this.sections.map(a=>{const h=a.content.evaluate(n);return gi(h)===z?new dh("",h,null,null,null):new dh(Nl(h),null,a.scale?a.scale.evaluate(n):null,a.font?a.font.evaluate(n).join(","):null,a.textColor?a.textColor.evaluate(n):null)}))}eachChild(n){for(const a of this.sections)n(a.content),a.scale&&n(a.scale),a.font&&n(a.font),a.textColor&&n(a.textColor)}outputDefined(){return!1}}class vh{constructor(n){this.type=z,this.input=n}static parse(n,a){if(n.length!==2)return a.error("Expected two arguments.");const h=a.parse(n[1],1,Ae);return h?new vh(h):a.error("No image name provided.")}evaluate(n){const a=this.input.evaluate(n),h=ao.fromString(a);return h&&n.availableImages&&(h.available=n.availableImages.indexOf(a)>-1),h}eachChild(n){n(this.input)}outputDefined(){return!1}}class xh{constructor(n){this.type=jt,this.input=n}static parse(n,a){if(n.length!==2)return a.error(`Expected 1 argument, but found ${n.length-1} instead.`);const h=a.parse(n[1],1);return h?h.type.kind!=="array"&&h.type.kind!=="string"&&h.type.kind!=="value"?a.error(`Expected argument of type string or array, but found ${H(h.type)} instead.`):new xh(h):null}evaluate(n){const a=this.input.evaluate(n);if(typeof a=="string"||Array.isArray(a))return a.length;throw new Un(`Expected value to be of type string or array, but found ${H(gi(a))} instead.`)}eachChild(n){n(this.input)}outputDefined(){return!1}}const Ka={"==":qf,"!=":Gf,">":Zf,"<":jf,">=":Wf,"<=":Hf,array:Gr,at:fh,boolean:Gr,case:_h,coalesce:ju,collator:Xa,format:Xu,image:vh,in:mh,"index-of":Hu,interpolate:$i,"interpolate-hcl":$i,"interpolate-lab":$i,length:xh,let:Zu,literal:Gs,match:gh,number:Gr,"number-format":yh,object:Gr,slice:Wu,step:Ul,string:Gr,"to-boolean":Xo,"to-color":Xo,"to-number":Xo,"to-string":Xo,var:Uu,within:ma};function cd(o,[n,a,h,g]){n=n.evaluate(o),a=a.evaluate(o),h=h.evaluate(o);const v=g?g.evaluate(o):1,x=Wa(n,a,h,v);if(x)throw new Un(x);return new pn(n/255,a/255,h/255,v,!1)}function hd(o,n){return o in n}function bh(o,n){const a=n[o];return a===void 0?null:a}function _a(o){return{type:o}}function pd(o){return{result:"success",value:o}}function Ja(o){return{result:"error",value:o}}function Qa(o){return o["property-type"]==="data-driven"||o["property-type"]==="cross-faded-data-driven"}function dd(o){return!!o.expression&&o.expression.parameters.indexOf("zoom")>-1}function wh(o){return!!o.expression&&o.expression.interpolated}function We(o){return o instanceof Number?"number":o instanceof String?"string":o instanceof Boolean?"boolean":Array.isArray(o)?"array":o===null?"null":typeof o}function Yu(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function Xf(o){return o}function fd(o,n){const a=n.type==="color",h=o.stops&&typeof o.stops[0][0]=="object",g=h||!(h||o.property!==void 0),v=o.type||(wh(n)?"exponential":"interval");if(a||n.type==="padding"){const A=a?pn.parse:Tr.parse;(o=Zo({},o)).stops&&(o.stops=o.stops.map(M=>[M[0],A(M[1])])),o.default=A(o.default?o.default:n.default)}if(o.colorSpace&&(x=o.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${o.colorSpace}"`);var x;let b,E,T;if(v==="exponential")b=Ge;else if(v==="interval")b=Yf;else if(v==="categorical"){b=li,E=Object.create(null);for(const A of o.stops)E[A[0]]=A[1];T=typeof o.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);b=Ih}if(h){const A={},M=[];for(let q=0;qq[0]),evaluate:({zoom:q},Z)=>Ge({stops:O,base:o.base},n,q).evaluate(q,Z)}}if(g){const A=v==="exponential"?{name:"exponential",base:o.base!==void 0?o.base:1}:null;return{kind:"camera",interpolationType:A,interpolationFactor:$i.interpolationFactor.bind(void 0,A),zoomStops:o.stops.map(M=>M[0]),evaluate:({zoom:M})=>b(o,n,M,E,T)}}return{kind:"source",evaluate(A,M){const O=M&&M.properties?M.properties[o.property]:void 0;return O===void 0?ql(o.default,n.default):b(o,n,O,E,T)}}}function ql(o,n,a){return o!==void 0?o:n!==void 0?n:a!==void 0?a:void 0}function li(o,n,a,h,g){return ql(typeof a===g?h[a]:void 0,o.default,n.default)}function Yf(o,n,a){if(We(a)!=="number")return ql(o.default,n.default);const h=o.stops.length;if(h===1||a<=o.stops[0][0])return o.stops[0][1];if(a>=o.stops[h-1][0])return o.stops[h-1][1];const g=Vl(o.stops.map(v=>v[0]),a);return o.stops[g][1]}function Ge(o,n,a){const h=o.base!==void 0?o.base:1;if(We(a)!=="number")return ql(o.default,n.default);const g=o.stops.length;if(g===1||a<=o.stops[0][0])return o.stops[0][1];if(a>=o.stops[g-1][0])return o.stops[g-1][1];const v=Vl(o.stops.map(A=>A[0]),a),x=function(A,M,O,B){const q=B-O,Z=A-O;return q===0?0:M===1?Z/q:(Math.pow(M,Z)-1)/(Math.pow(M,q)-1)}(a,h,o.stops[v][0],o.stops[v+1][0]),b=o.stops[v][1],E=o.stops[v+1][1],T=dr[n.type]||Xf;return typeof b.evaluate=="function"?{evaluate(...A){const M=b.evaluate.apply(void 0,A),O=E.evaluate.apply(void 0,A);if(M!==void 0&&O!==void 0)return T(M,O,x,o.colorSpace)}}:T(b,E,x,o.colorSpace)}function Ih(o,n,a){switch(n.type){case"color":a=pn.parse(a);break;case"formatted":a=qr.fromString(a.toString());break;case"resolvedImage":a=ao.fromString(a.toString());break;case"padding":a=Tr.parse(a);break;default:We(a)===n.type||n.type==="enum"&&n.values[a]||(a=void 0)}return ql(a,o.default,n.default)}jr.register(Ka,{error:[{kind:"error"},[Ae],(o,[n])=>{throw new Un(n.evaluate(o))}],typeof:[Ae,[be],(o,[n])=>H(gi(n.evaluate(o)))],"to-rgba":[G(jt,4),[fi],(o,[n])=>{const[a,h,g,v]=n.evaluate(o).rgb;return[255*a,255*h,255*g,v]}],rgb:[fi,[jt,jt,jt],cd],rgba:[fi,[jt,jt,jt,jt],cd],has:{type:Ce,overloads:[[[Ae],(o,[n])=>hd(n.evaluate(o),o.properties())],[[Ae,Ho],(o,[n,a])=>hd(n.evaluate(o),a.evaluate(o))]]},get:{type:be,overloads:[[[Ae],(o,[n])=>bh(n.evaluate(o),o.properties())],[[Ae,Ho],(o,[n,a])=>bh(n.evaluate(o),a.evaluate(o))]]},"feature-state":[be,[Ae],(o,[n])=>bh(n.evaluate(o),o.featureState||{})],properties:[Ho,[],o=>o.properties()],"geometry-type":[Ae,[],o=>o.geometryType()],id:[be,[],o=>o.id()],zoom:[jt,[],o=>o.globals.zoom],"heatmap-density":[jt,[],o=>o.globals.heatmapDensity||0],"line-progress":[jt,[],o=>o.globals.lineProgress||0],accumulated:[be,[],o=>o.globals.accumulated===void 0?null:o.globals.accumulated],"+":[jt,_a(jt),(o,n)=>{let a=0;for(const h of n)a+=h.evaluate(o);return a}],"*":[jt,_a(jt),(o,n)=>{let a=1;for(const h of n)a*=h.evaluate(o);return a}],"-":{type:jt,overloads:[[[jt,jt],(o,[n,a])=>n.evaluate(o)-a.evaluate(o)],[[jt],(o,[n])=>-n.evaluate(o)]]},"/":[jt,[jt,jt],(o,[n,a])=>n.evaluate(o)/a.evaluate(o)],"%":[jt,[jt,jt],(o,[n,a])=>n.evaluate(o)%a.evaluate(o)],ln2:[jt,[],()=>Math.LN2],pi:[jt,[],()=>Math.PI],e:[jt,[],()=>Math.E],"^":[jt,[jt,jt],(o,[n,a])=>Math.pow(n.evaluate(o),a.evaluate(o))],sqrt:[jt,[jt],(o,[n])=>Math.sqrt(n.evaluate(o))],log10:[jt,[jt],(o,[n])=>Math.log(n.evaluate(o))/Math.LN10],ln:[jt,[jt],(o,[n])=>Math.log(n.evaluate(o))],log2:[jt,[jt],(o,[n])=>Math.log(n.evaluate(o))/Math.LN2],sin:[jt,[jt],(o,[n])=>Math.sin(n.evaluate(o))],cos:[jt,[jt],(o,[n])=>Math.cos(n.evaluate(o))],tan:[jt,[jt],(o,[n])=>Math.tan(n.evaluate(o))],asin:[jt,[jt],(o,[n])=>Math.asin(n.evaluate(o))],acos:[jt,[jt],(o,[n])=>Math.acos(n.evaluate(o))],atan:[jt,[jt],(o,[n])=>Math.atan(n.evaluate(o))],min:[jt,_a(jt),(o,n)=>Math.min(...n.map(a=>a.evaluate(o)))],max:[jt,_a(jt),(o,n)=>Math.max(...n.map(a=>a.evaluate(o)))],abs:[jt,[jt],(o,[n])=>Math.abs(n.evaluate(o))],round:[jt,[jt],(o,[n])=>{const a=n.evaluate(o);return a<0?-Math.round(-a):Math.round(a)}],floor:[jt,[jt],(o,[n])=>Math.floor(n.evaluate(o))],ceil:[jt,[jt],(o,[n])=>Math.ceil(n.evaluate(o))],"filter-==":[Ce,[Ae,be],(o,[n,a])=>o.properties()[n.value]===a.value],"filter-id-==":[Ce,[be],(o,[n])=>o.id()===n.value],"filter-type-==":[Ce,[Ae],(o,[n])=>o.geometryType()===n.value],"filter-<":[Ce,[Ae,be],(o,[n,a])=>{const h=o.properties()[n.value],g=a.value;return typeof h==typeof g&&h{const a=o.id(),h=n.value;return typeof a==typeof h&&a":[Ce,[Ae,be],(o,[n,a])=>{const h=o.properties()[n.value],g=a.value;return typeof h==typeof g&&h>g}],"filter-id->":[Ce,[be],(o,[n])=>{const a=o.id(),h=n.value;return typeof a==typeof h&&a>h}],"filter-<=":[Ce,[Ae,be],(o,[n,a])=>{const h=o.properties()[n.value],g=a.value;return typeof h==typeof g&&h<=g}],"filter-id-<=":[Ce,[be],(o,[n])=>{const a=o.id(),h=n.value;return typeof a==typeof h&&a<=h}],"filter->=":[Ce,[Ae,be],(o,[n,a])=>{const h=o.properties()[n.value],g=a.value;return typeof h==typeof g&&h>=g}],"filter-id->=":[Ce,[be],(o,[n])=>{const a=o.id(),h=n.value;return typeof a==typeof h&&a>=h}],"filter-has":[Ce,[be],(o,[n])=>n.value in o.properties()],"filter-has-id":[Ce,[],o=>o.id()!==null&&o.id()!==void 0],"filter-type-in":[Ce,[G(Ae)],(o,[n])=>n.value.indexOf(o.geometryType())>=0],"filter-id-in":[Ce,[G(be)],(o,[n])=>n.value.indexOf(o.id())>=0],"filter-in-small":[Ce,[Ae,G(be)],(o,[n,a])=>a.value.indexOf(o.properties()[n.value])>=0],"filter-in-large":[Ce,[Ae,G(be)],(o,[n,a])=>function(h,g,v,x){for(;v<=x;){const b=v+x>>1;if(g[b]===h)return!0;g[b]>h?x=b-1:v=b+1}return!1}(o.properties()[n.value],a.value,0,a.value.length-1)],all:{type:Ce,overloads:[[[Ce,Ce],(o,[n,a])=>n.evaluate(o)&&a.evaluate(o)],[_a(Ce),(o,n)=>{for(const a of n)if(!a.evaluate(o))return!1;return!0}]]},any:{type:Ce,overloads:[[[Ce,Ce],(o,[n,a])=>n.evaluate(o)||a.evaluate(o)],[_a(Ce),(o,n)=>{for(const a of n)if(a.evaluate(o))return!0;return!1}]]},"!":[Ce,[Ce],(o,[n])=>!n.evaluate(o)],"is-supported-script":[Ce,[Ae],(o,[n])=>{const a=o.globals&&o.globals.isSupportedScript;return!a||a(n.evaluate(o))}],upcase:[Ae,[Ae],(o,[n])=>n.evaluate(o).toUpperCase()],downcase:[Ae,[Ae],(o,[n])=>n.evaluate(o).toLowerCase()],concat:[Ae,_a(be),(o,n)=>n.map(a=>Nl(a.evaluate(o))).join("")],"resolved-locale":[Ae,[fa],(o,[n])=>n.evaluate(o).resolvedLocale()]});class An{constructor(n,a){var h;this.expression=n,this._warningHistory={},this._evaluator=new dn,this._defaultValue=a?(h=a).type==="color"&&Yu(h.default)?new pn(0,0,0,0):h.type==="color"?pn.parse(h.default)||null:h.type==="padding"?Tr.parse(h.default)||null:h.type==="variableAnchorOffsetCollection"?so.parse(h.default)||null:h.default===void 0?null:h.default:null,this._enumValues=a&&a.type==="enum"?a.values:null}evaluateWithoutErrorHandling(n,a,h,g,v,x){return this._evaluator.globals=n,this._evaluator.feature=a,this._evaluator.featureState=h,this._evaluator.canonical=g,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(n,a,h,g,v,x){this._evaluator.globals=n,this._evaluator.feature=a||null,this._evaluator.featureState=h||null,this._evaluator.canonical=g,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=x||null;try{const b=this.expression.evaluate(this._evaluator);if(b==null||typeof b=="number"&&b!=b)return this._defaultValue;if(this._enumValues&&!(b in this._enumValues))throw new Un(`Expected value to be one of ${Object.keys(this._enumValues).map(E=>JSON.stringify(E)).join(", ")}, but found ${JSON.stringify(b)} instead.`);return b}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(b.message)),this._defaultValue}}}function In(o){return Array.isArray(o)&&o.length>0&&typeof o[0]=="string"&&o[0]in Ka}function ya(o,n){const a=new zu(Ka,Ol,[],n?function(g){const v={color:fi,string:Ae,number:jt,enum:Ae,boolean:Ce,formatted:Ii,padding:K,resolvedImage:z,variableAnchorOffsetCollection:F};return g.type==="array"?G(v[g.value]||be,g.length):v[g.type]}(n):void 0),h=a.parse(o,void 0,void 0,void 0,n&&n.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?pd(new An(h,n)):Ja(a.errors)}class Ku{constructor(n,a){this.kind=n,this._styleExpression=a,this.isStateDependent=n!=="constant"&&!Fl(a.expression)}evaluateWithoutErrorHandling(n,a,h,g,v,x){return this._styleExpression.evaluateWithoutErrorHandling(n,a,h,g,v,x)}evaluate(n,a,h,g,v,x){return this._styleExpression.evaluate(n,a,h,g,v,x)}}class Eh{constructor(n,a,h,g){this.kind=n,this.zoomStops=h,this._styleExpression=a,this.isStateDependent=n!=="camera"&&!Fl(a.expression),this.interpolationType=g}evaluateWithoutErrorHandling(n,a,h,g,v,x){return this._styleExpression.evaluateWithoutErrorHandling(n,a,h,g,v,x)}evaluate(n,a,h,g,v,x){return this._styleExpression.evaluate(n,a,h,g,v,x)}interpolationFactor(n,a,h){return this.interpolationType?$i.interpolationFactor(this.interpolationType,n,a,h):0}}function md(o,n){const a=ya(o,n);if(a.result==="error")return a;const h=a.value.expression,g=qu(h);if(!g&&!Qa(n))return Ja([new Ur("","data expressions not supported")]);const v=Bl(h,["zoom"]);if(!v&&!dd(n))return Ja([new Ur("","zoom expressions not supported")]);const x=Qu(h);return x||v?x instanceof Ur?Ja([x]):x instanceof $i&&!wh(n)?Ja([new Ur("",'"interpolate" expressions cannot be used with this property')]):pd(x?new Eh(g?"camera":"composite",a.value,x.labels,x instanceof $i?x.interpolation:void 0):new Ku(g?"constant":"source",a.value)):Ja([new Ur("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ju{constructor(n,a){this._parameters=n,this._specification=a,Zo(this,fd(this._parameters,this._specification))}static deserialize(n){return new Ju(n._parameters,n._specification)}static serialize(n){return{_parameters:n._parameters,_specification:n._specification}}}function Qu(o){let n=null;if(o instanceof Zu)n=Qu(o.result);else if(o instanceof ju){for(const a of o.args)if(n=Qu(a),n)break}else(o instanceof Ul||o instanceof $i)&&o.input instanceof jr&&o.input.name==="zoom"&&(n=o);return n instanceof Ur||o.eachChild(a=>{const h=Qu(a);h instanceof Ur?n=h:!n&&h?n=new Ur("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&h&&n!==h&&(n=new Ur("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}function $u(o){if(o===!0||o===!1)return!0;if(!Array.isArray(o)||o.length===0)return!1;switch(o[0]){case"has":return o.length>=2&&o[1]!=="$id"&&o[1]!=="$type";case"in":return o.length>=3&&(typeof o[1]!="string"||Array.isArray(o[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return o.length!==3||Array.isArray(o[1])||Array.isArray(o[2]);case"any":case"all":for(const n of o.slice(1))if(!$u(n)&&typeof n!="boolean")return!1;return!0;default:return!0}}const gd={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function tc(o){if(o==null)return{filter:()=>!0,needGeometry:!1};$u(o)||(o=nc(o));const n=ya(o,gd);if(n.result==="error")throw new Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,h,g)=>n.value.evaluate(a,h,{},g),needGeometry:ec(o)}}function _d(o,n){return on?1:0}function ec(o){if(!Array.isArray(o))return!1;if(o[0]==="within")return!0;for(let n=1;n"||n==="<="||n===">="?Sh(o[1],o[2],n):n==="any"?(a=o.slice(1),["any"].concat(a.map(nc))):n==="all"?["all"].concat(o.slice(1).map(nc)):n==="none"?["all"].concat(o.slice(1).map(nc).map(ic)):n==="in"?yd(o[1],o.slice(2)):n==="!in"?ic(yd(o[1],o.slice(2))):n==="has"?vd(o[1]):n==="!has"?ic(vd(o[1])):n!=="within"||o;var a}function Sh(o,n,a){switch(o){case"$type":return[`filter-type-${a}`,n];case"$id":return[`filter-id-${a}`,n];default:return[`filter-${a}`,o,n]}}function yd(o,n){if(n.length===0)return!1;switch(o){case"$type":return["filter-type-in",["literal",n]];case"$id":return["filter-id-in",["literal",n]];default:return n.length>200&&!n.some(a=>typeof a!=typeof n[0])?["filter-in-large",o,["literal",n.sort(_d)]]:["filter-in-small",o,["literal",n]]}}function vd(o){switch(o){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",o]}}function ic(o){return["!",o]}function Ch(o){const n=typeof o;if(n==="number"||n==="boolean"||n==="string"||o==null)return JSON.stringify(o);if(Array.isArray(o)){let g="[";for(const v of o)g+=`${Ch(v)},`;return`${g}]`}const a=Object.keys(o).sort();let h="{";for(let g=0;gh.maximum?[new Ot(n,a,`${a} is greater than the maximum value ${h.maximum}`)]:[]}function bd(o){const n=o.valueSpec,a=Xn(o.value.type);let h,g,v,x={};const b=a!=="categorical"&&o.value.property===void 0,E=!b,T=We(o.value.stops)==="array"&&We(o.value.stops[0])==="array"&&We(o.value.stops[0][0])==="object",A=fr({key:o.key,value:o.value,valueSpec:o.styleSpec.function,validateSpec:o.validateSpec,style:o.style,styleSpec:o.styleSpec,objectElementValidators:{stops:function(B){if(a==="identity")return[new Ot(B.key,B.value,'identity function may not have a "stops" property')];let q=[];const Z=B.value;return q=q.concat(Th({key:B.key,value:Z,valueSpec:B.valueSpec,validateSpec:B.validateSpec,style:B.style,styleSpec:B.styleSpec,arrayElementValidator:M})),We(Z)==="array"&&Z.length===0&&q.push(new Ot(B.key,Z,"array must have at least one stop")),q},default:function(B){return B.validateSpec({key:B.key,value:B.value,valueSpec:n,validateSpec:B.validateSpec,style:B.style,styleSpec:B.styleSpec})}}});return a==="identity"&&b&&A.push(new Ot(o.key,o.value,'missing required property "property"')),a==="identity"||o.value.stops||A.push(new Ot(o.key,o.value,'missing required property "stops"')),a==="exponential"&&o.valueSpec.expression&&!wh(o.valueSpec)&&A.push(new Ot(o.key,o.value,"exponential functions not supported")),o.styleSpec.$version>=8&&(E&&!Qa(o.valueSpec)?A.push(new Ot(o.key,o.value,"property functions not supported")):b&&!dd(o.valueSpec)&&A.push(new Ot(o.key,o.value,"zoom functions not supported"))),a!=="categorical"&&!T||o.value.property!==void 0||A.push(new Ot(o.key,o.value,'"property" property is required')),A;function M(B){let q=[];const Z=B.value,Y=B.key;if(We(Z)!=="array")return[new Ot(Y,Z,`array expected, ${We(Z)} found`)];if(Z.length!==2)return[new Ot(Y,Z,`array length 2 expected, length ${Z.length} found`)];if(T){if(We(Z[0])!=="object")return[new Ot(Y,Z,`object expected, ${We(Z[0])} found`)];if(Z[0].zoom===void 0)return[new Ot(Y,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new Ot(Y,Z,"object stop key must have value")];if(v&&v>Xn(Z[0].zoom))return[new Ot(Y,Z[0].zoom,"stop zoom values must appear in ascending order")];Xn(Z[0].zoom)!==v&&(v=Xn(Z[0].zoom),g=void 0,x={}),q=q.concat(fr({key:`${Y}[0]`,value:Z[0],valueSpec:{zoom:{}},validateSpec:B.validateSpec,style:B.style,styleSpec:B.styleSpec,objectElementValidators:{zoom:rc,value:O}}))}else q=q.concat(O({key:`${Y}[0]`,value:Z[0],valueSpec:{},validateSpec:B.validateSpec,style:B.style,styleSpec:B.styleSpec},Z));return In(Zs(Z[1]))?q.concat([new Ot(`${Y}[1]`,Z[1],"expressions are not allowed in function stops.")]):q.concat(B.validateSpec({key:`${Y}[1]`,value:Z[1],valueSpec:n,validateSpec:B.validateSpec,style:B.style,styleSpec:B.styleSpec}))}function O(B,q){const Z=We(B.value),Y=Xn(B.value),$=B.value!==null?B.value:q;if(h){if(Z!==h)return[new Ot(B.key,$,`${Z} stop domain type must match previous stop domain type ${h}`)]}else h=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new Ot(B.key,$,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&a!=="categorical"){let ut=`number expected, ${Z} found`;return Qa(n)&&a===void 0&&(ut+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ot(B.key,$,ut)]}return a!=="categorical"||Z!=="number"||isFinite(Y)&&Math.floor(Y)===Y?a!=="categorical"&&Z==="number"&&g!==void 0&&Ynew Ot(`${o.key}${h.key}`,o.value,h.message));const a=n.value.expression||n.value._styleExpression.expression;if(o.expressionContext==="property"&&o.propertyKey==="text-font"&&!a.outputDefined())return[new Ot(o.key,o.value,`Invalid data expression for "${o.propertyKey}". Output values must be contained as literals within the expression.`)];if(o.expressionContext==="property"&&o.propertyType==="layout"&&!Fl(a))return[new Ot(o.key,o.value,'"feature-state" data expressions are not supported with layout properties.')];if(o.expressionContext==="filter"&&!Fl(a))return[new Ot(o.key,o.value,'"feature-state" data expressions are not supported with filters.')];if(o.expressionContext&&o.expressionContext.indexOf("cluster")===0){if(!Bl(a,["zoom","feature-state"]))return[new Ot(o.key,o.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(o.expressionContext==="cluster-initial"&&!qu(a))return[new Ot(o.key,o.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ws(o){const n=o.key,a=o.value,h=o.valueSpec,g=[];return Array.isArray(h.values)?h.values.indexOf(Xn(a))===-1&&g.push(new Ot(n,a,`expected one of [${h.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(h.values).indexOf(Xn(a))===-1&&g.push(new Ot(n,a,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(a)} found`)),g}function $a(o){return $u(Zs(o.value))?Hs(Zo({},o,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Lh(o)}function Lh(o){const n=o.value,a=o.key;if(We(n)!=="array")return[new Ot(a,n,`array expected, ${We(n)} found`)];const h=o.styleSpec;let g,v=[];if(n.length<1)return[new Ot(a,n,"filter array must have at least 1 element")];switch(v=v.concat(Ws({key:`${a}[0]`,value:n[0],valueSpec:h.filter_operator,style:o.style,styleSpec:o.styleSpec})),Xn(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&Xn(n[1])==="$type"&&v.push(new Ot(a,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":n.length!==3&&v.push(new Ot(a,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(g=We(n[1]),g!=="string"&&v.push(new Ot(`${a}[1]`,n[1],`string expected, ${g} found`)));for(let x=2;x{T in a&&n.push(new Ot(h,a[T],`"${T}" is prohibited for ref layers`))}),g.layers.forEach(T=>{Xn(T.id)===b&&(E=T)}),E?E.ref?n.push(new Ot(h,a.ref,"ref cannot reference another ref layer")):x=Xn(E.type):n.push(new Ot(h,a.ref,`ref layer "${b}" not found`))}else if(x!=="background")if(a.source){const E=g.sources&&g.sources[a.source],T=E&&Xn(E.type);E?T==="vector"&&x==="raster"?n.push(new Ot(h,a.source,`layer "${a.id}" requires a raster source`)):T!=="raster-dem"&&x==="hillshade"?n.push(new Ot(h,a.source,`layer "${a.id}" requires a raster-dem source`)):T==="raster"&&x!=="raster"?n.push(new Ot(h,a.source,`layer "${a.id}" requires a vector source`)):T!=="vector"||a["source-layer"]?T==="raster-dem"&&x!=="hillshade"?n.push(new Ot(h,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!a.paint||!a.paint["line-gradient"]||T==="geojson"&&E.lineMetrics||n.push(new Ot(h,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new Ot(h,a,`layer "${a.id}" must specify a "source-layer"`)):n.push(new Ot(h,a.source,`source "${a.source}" not found`))}else n.push(new Ot(h,a,'missing required property "source"'));return n=n.concat(fr({key:h,value:a,valueSpec:v.layer,style:o.style,styleSpec:o.styleSpec,validateSpec:o.validateSpec,objectElementValidators:{"*":()=>[],type:()=>o.validateSpec({key:`${h}.type`,value:a.type,valueSpec:v.layer.type,style:o.style,styleSpec:o.styleSpec,validateSpec:o.validateSpec,object:a,objectKey:"type"}),filter:$a,layout:E=>fr({layer:a,key:E.key,value:E.value,style:E.style,styleSpec:E.styleSpec,validateSpec:E.validateSpec,objectElementValidators:{"*":T=>Ah(Zo({layerType:x},T))}}),paint:E=>fr({layer:a,key:E.key,value:E.value,style:E.style,styleSpec:E.styleSpec,validateSpec:E.validateSpec,objectElementValidators:{"*":T=>Ph(Zo({layerType:x},T))}})}})),n}function va(o){const n=o.value,a=o.key,h=We(n);return h!=="string"?[new Ot(a,n,`string expected, ${h} found`)]:[]}const wd={promoteId:function({key:o,value:n}){if(We(n)==="string")return va({key:o,value:n});{const a=[];for(const h in n)a.push(...va({key:`${o}.${h}`,value:n[h]}));return a}}};function Id(o){const n=o.value,a=o.key,h=o.styleSpec,g=o.style,v=o.validateSpec;if(!n.type)return[new Ot(a,n,'"type" is required')];const x=Xn(n.type);let b;switch(x){case"vector":case"raster":return b=fr({key:a,value:n,valueSpec:h[`source_${x.replace("-","_")}`],style:o.style,styleSpec:h,objectElementValidators:wd,validateSpec:v}),b;case"raster-dem":return b=function(E){var T;const A=(T=E.sourceName)!==null&&T!==void 0?T:"",M=E.value,O=E.styleSpec,B=O.source_raster_dem,q=E.style;let Z=[];const Y=We(M);if(M===void 0)return Z;if(Y!=="object")return Z.push(new Ot("source_raster_dem",M,`object expected, ${Y} found`)),Z;const $=Xn(M.encoding)==="custom",ut=["redFactor","greenFactor","blueFactor","baseShift"],tt=E.value.encoding?`"${E.value.encoding}"`:"Default";for(const ot in M)!$&&ut.includes(ot)?Z.push(new Ot(ot,M[ot],`In "${A}": "${ot}" is only valid when "encoding" is set to "custom". ${tt} encoding found`)):B[ot]?Z=Z.concat(E.validateSpec({key:ot,value:M[ot],valueSpec:B[ot],validateSpec:E.validateSpec,style:q,styleSpec:O})):Z.push(new Ot(ot,M[ot],`unknown property "${ot}"`));return Z}({sourceName:a,value:n,style:o.style,styleSpec:h,validateSpec:v}),b;case"geojson":if(b=fr({key:a,value:n,valueSpec:h.source_geojson,style:g,styleSpec:h,validateSpec:v,objectElementValidators:wd}),n.cluster)for(const E in n.clusterProperties){const[T,A]=n.clusterProperties[E],M=typeof T=="string"?[T,["accumulated"],["get",E]]:T;b.push(...Hs({key:`${a}.${E}.map`,value:A,validateSpec:v,expressionContext:"cluster-map"})),b.push(...Hs({key:`${a}.${E}.reduce`,value:M,validateSpec:v,expressionContext:"cluster-reduce"}))}return b;case"video":return fr({key:a,value:n,valueSpec:h.source_video,style:g,validateSpec:v,styleSpec:h});case"image":return fr({key:a,value:n,valueSpec:h.source_image,style:g,validateSpec:v,styleSpec:h});case"canvas":return[new Ot(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ws({key:`${a}.type`,value:n.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:g,validateSpec:v,styleSpec:h})}}function Ed(o){const n=o.value,a=o.styleSpec,h=a.light,g=o.style;let v=[];const x=We(n);if(n===void 0)return v;if(x!=="object")return v=v.concat([new Ot("light",n,`object expected, ${x} found`)]),v;for(const b in n){const E=b.match(/^(.*)-transition$/);v=v.concat(E&&h[E[1]]&&h[E[1]].transition?o.validateSpec({key:b,value:n[b],valueSpec:a.transition,validateSpec:o.validateSpec,style:g,styleSpec:a}):h[b]?o.validateSpec({key:b,value:n[b],valueSpec:h[b],validateSpec:o.validateSpec,style:g,styleSpec:a}):[new Ot(b,n[b],`unknown property "${b}"`)])}return v}function Sd(o){const n=o.value,a=o.styleSpec,h=a.sky,g=o.style,v=We(n);if(n===void 0)return[];if(v!=="object")return[new Ot("sky",n,`object expected, ${v} found`)];let x=[];for(const b in n)x=x.concat(h[b]?Yo({key:b,value:n[b],valueSpec:h[b],style:g,styleSpec:a}):[new Ot(b,n[b],`unknown property "${b}"`)]);return x}function jl(o){const n=o.value,a=o.styleSpec,h=a.terrain,g=o.style;let v=[];const x=We(n);if(n===void 0)return v;if(x!=="object")return v=v.concat([new Ot("terrain",n,`object expected, ${x} found`)]),v;for(const b in n)v=v.concat(h[b]?o.validateSpec({key:b,value:n[b],valueSpec:h[b],validateSpec:o.validateSpec,style:g,styleSpec:a}):[new Ot(b,n[b],`unknown property "${b}"`)]);return v}function Zl(o){let n=[];const a=o.value,h=o.key;if(Array.isArray(a)){const g=[],v=[];for(const x in a)a[x].id&&g.includes(a[x].id)&&n.push(new Ot(h,a,`all the sprites' ids must be unique, but ${a[x].id} is duplicated`)),g.push(a[x].id),a[x].url&&v.includes(a[x].url)&&n.push(new Ot(h,a,`all the sprites' URLs must be unique, but ${a[x].url} is duplicated`)),v.push(a[x].url),n=n.concat(fr({key:`${h}[${x}]`,value:a[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:o.validateSpec}));return n}return va({key:h,value:a})}const Lr={"*":()=>[],array:Th,boolean:function(o){const n=o.value,a=o.key,h=We(n);return h!=="boolean"?[new Ot(a,n,`boolean expected, ${h} found`)]:[]},number:rc,color:function(o){const n=o.key,a=o.value,h=We(a);return h!=="string"?[new Ot(n,a,`color expected, ${h} found`)]:pn.parse(String(a))?[]:[new Ot(n,a,`color expected, "${a}" found`)]},constants:xd,enum:Ws,filter:$a,function:bd,layer:Gl,object:fr,source:Id,light:Ed,sky:Sd,terrain:jl,string:va,formatted:function(o){return va(o).length===0?[]:Hs(o)},resolvedImage:function(o){return va(o).length===0?[]:Hs(o)},padding:function(o){const n=o.key,a=o.value;if(We(a)==="array"){if(a.length<1||a.length>4)return[new Ot(n,a,`padding requires 1 to 4 values; ${a.length} values found`)];const h={type:"number"};let g=[];for(let v=0;v[]}})),o.constants&&(a=a.concat(xd({key:"constants",value:o.constants,style:o,styleSpec:n,validateSpec:Yo}))),tl(a)}function Ko(o){return function(n){return o({...n,validateSpec:Yo})}}function tl(o){return[].concat(o).sort((n,a)=>n.line-a.line)}function Io(o){return function(...n){return tl(o.apply(this,n))}}wo.source=Io(Ko(Id)),wo.sprite=Io(Ko(Zl)),wo.glyphs=Io(Ko(Mh)),wo.light=Io(Ko(Ed)),wo.sky=Io(Ko(Sd)),wo.terrain=Io(Ko(jl)),wo.layer=Io(Ko(Gl)),wo.filter=Io(Ko($a)),wo.paintProperty=Io(Ko(Ph)),wo.layoutProperty=Io(Ko(Ah));const xa=wo,Jf=xa.light,Dh=xa.paintProperty,Qf=xa.layoutProperty;function el(o,n){let a=!1;if(n&&n.length)for(const h of n)o.fire(new ze(new Error(h.message))),a=!0;return a}class Hl{constructor(n,a,h){const g=this.cells=[];if(n instanceof ArrayBuffer){this.arrayBuffer=n;const x=new Int32Array(this.arrayBuffer);n=x[0],this.d=(a=x[1])+2*(h=x[2]);for(let E=0;E=M[q+0]&&g>=M[q+1])?(b[B]=!0,x.push(A[B])):b[B]=!1}}}}_forEachCell(n,a,h,g,v,x,b,E){const T=this._convertToCellCoord(n),A=this._convertToCellCoord(a),M=this._convertToCellCoord(h),O=this._convertToCellCoord(g);for(let B=T;B<=M;B++)for(let q=A;q<=O;q++){const Z=this.d*q+B;if((!E||E(this._convertFromCellCoord(B),this._convertFromCellCoord(q),this._convertFromCellCoord(B+1),this._convertFromCellCoord(q+1)))&&v.call(this,n,a,h,g,Z,x,b,E))return}}_convertFromCellCoord(n){return(n-this.padding)/this.scale}_convertToCellCoord(n){return Math.max(0,Math.min(this.d-1,Math.floor(n*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const n=this.cells,a=3+this.cells.length+1+1;let h=0;for(let x=0;x=0)continue;const x=o[v];g[v]=Jo[h].shallow.indexOf(v)>=0?x:nl(x,n)}o instanceof Error&&(g.message=o.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(g.$name=h),g}throw new Error("can't serialize object of type "+typeof o)}function il(o){if(o==null||typeof o=="boolean"||typeof o=="number"||typeof o=="string"||o instanceof Boolean||o instanceof Number||o instanceof String||o instanceof Date||o instanceof RegExp||o instanceof Blob||o instanceof Error||sc(o)||en(o)||ArrayBuffer.isView(o)||o instanceof ImageData)return o;if(Array.isArray(o))return o.map(il);if(typeof o=="object"){const n=o.$name||"Object";if(!Jo[n])throw new Error(`can't deserialize unregistered class ${n}`);const{klass:a}=Jo[n];if(!a)throw new Error(`can't deserialize unregistered class ${n}`);if(a.deserialize)return a.deserialize(o);const h=Object.create(a.prototype);for(const g of Object.keys(o)){if(g==="$name")continue;const v=o[g];h[g]=Jo[n].shallow.indexOf(g)>=0?v:il(v)}return h}throw new Error("can't deserialize object of type "+typeof o)}class Cd{constructor(){this.first=!0}update(n,a){const h=Math.floor(n);return this.first?(this.first=!1,this.lastIntegerZoom=h,this.lastIntegerZoomTime=0,this.lastZoom=n,this.lastFloorZoom=h,!0):(this.lastFloorZoom>h?(this.lastIntegerZoom=h+1,this.lastIntegerZoomTime=a):this.lastFloorZoomo>=128&&o<=255,Arabic:o=>o>=1536&&o<=1791,"Arabic Supplement":o=>o>=1872&&o<=1919,"Arabic Extended-A":o=>o>=2208&&o<=2303,"Hangul Jamo":o=>o>=4352&&o<=4607,"Unified Canadian Aboriginal Syllabics":o=>o>=5120&&o<=5759,Khmer:o=>o>=6016&&o<=6143,"Unified Canadian Aboriginal Syllabics Extended":o=>o>=6320&&o<=6399,"General Punctuation":o=>o>=8192&&o<=8303,"Letterlike Symbols":o=>o>=8448&&o<=8527,"Number Forms":o=>o>=8528&&o<=8591,"Miscellaneous Technical":o=>o>=8960&&o<=9215,"Control Pictures":o=>o>=9216&&o<=9279,"Optical Character Recognition":o=>o>=9280&&o<=9311,"Enclosed Alphanumerics":o=>o>=9312&&o<=9471,"Geometric Shapes":o=>o>=9632&&o<=9727,"Miscellaneous Symbols":o=>o>=9728&&o<=9983,"Miscellaneous Symbols and Arrows":o=>o>=11008&&o<=11263,"CJK Radicals Supplement":o=>o>=11904&&o<=12031,"Kangxi Radicals":o=>o>=12032&&o<=12255,"Ideographic Description Characters":o=>o>=12272&&o<=12287,"CJK Symbols and Punctuation":o=>o>=12288&&o<=12351,Hiragana:o=>o>=12352&&o<=12447,Katakana:o=>o>=12448&&o<=12543,Bopomofo:o=>o>=12544&&o<=12591,"Hangul Compatibility Jamo":o=>o>=12592&&o<=12687,Kanbun:o=>o>=12688&&o<=12703,"Bopomofo Extended":o=>o>=12704&&o<=12735,"CJK Strokes":o=>o>=12736&&o<=12783,"Katakana Phonetic Extensions":o=>o>=12784&&o<=12799,"Enclosed CJK Letters and Months":o=>o>=12800&&o<=13055,"CJK Compatibility":o=>o>=13056&&o<=13311,"CJK Unified Ideographs Extension A":o=>o>=13312&&o<=19903,"Yijing Hexagram Symbols":o=>o>=19904&&o<=19967,"CJK Unified Ideographs":o=>o>=19968&&o<=40959,"Yi Syllables":o=>o>=40960&&o<=42127,"Yi Radicals":o=>o>=42128&&o<=42191,"Hangul Jamo Extended-A":o=>o>=43360&&o<=43391,"Hangul Syllables":o=>o>=44032&&o<=55215,"Hangul Jamo Extended-B":o=>o>=55216&&o<=55295,"Private Use Area":o=>o>=57344&&o<=63743,"CJK Compatibility Ideographs":o=>o>=63744&&o<=64255,"Arabic Presentation Forms-A":o=>o>=64336&&o<=65023,"Vertical Forms":o=>o>=65040&&o<=65055,"CJK Compatibility Forms":o=>o>=65072&&o<=65103,"Small Form Variants":o=>o>=65104&&o<=65135,"Arabic Presentation Forms-B":o=>o>=65136&&o<=65279,"Halfwidth and Fullwidth Forms":o=>o>=65280&&o<=65519};function rl(o){for(const n of o)if(ac(n.charCodeAt(0)))return!0;return!1}function Td(o){for(const n of o)if(!Ld(n.charCodeAt(0)))return!1;return!0}function Ld(o){return!(Ht.Arabic(o)||Ht["Arabic Supplement"](o)||Ht["Arabic Extended-A"](o)||Ht["Arabic Presentation Forms-A"](o)||Ht["Arabic Presentation Forms-B"](o))}function ac(o){return!(o!==746&&o!==747&&(o<4352||!(Ht["Bopomofo Extended"](o)||Ht.Bopomofo(o)||Ht["CJK Compatibility Forms"](o)&&!(o>=65097&&o<=65103)||Ht["CJK Compatibility Ideographs"](o)||Ht["CJK Compatibility"](o)||Ht["CJK Radicals Supplement"](o)||Ht["CJK Strokes"](o)||!(!Ht["CJK Symbols and Punctuation"](o)||o>=12296&&o<=12305||o>=12308&&o<=12319||o===12336)||Ht["CJK Unified Ideographs Extension A"](o)||Ht["CJK Unified Ideographs"](o)||Ht["Enclosed CJK Letters and Months"](o)||Ht["Hangul Compatibility Jamo"](o)||Ht["Hangul Jamo Extended-A"](o)||Ht["Hangul Jamo Extended-B"](o)||Ht["Hangul Jamo"](o)||Ht["Hangul Syllables"](o)||Ht.Hiragana(o)||Ht["Ideographic Description Characters"](o)||Ht.Kanbun(o)||Ht["Kangxi Radicals"](o)||Ht["Katakana Phonetic Extensions"](o)||Ht.Katakana(o)&&o!==12540||!(!Ht["Halfwidth and Fullwidth Forms"](o)||o===65288||o===65289||o===65293||o>=65306&&o<=65310||o===65339||o===65341||o===65343||o>=65371&&o<=65503||o===65507||o>=65512&&o<=65519)||!(!Ht["Small Form Variants"](o)||o>=65112&&o<=65118||o>=65123&&o<=65126)||Ht["Unified Canadian Aboriginal Syllabics"](o)||Ht["Unified Canadian Aboriginal Syllabics Extended"](o)||Ht["Vertical Forms"](o)||Ht["Yijing Hexagram Symbols"](o)||Ht["Yi Syllables"](o)||Ht["Yi Radicals"](o))))}function Rh(o){return!(ac(o)||function(n){return!!(Ht["Latin-1 Supplement"](n)&&(n===167||n===169||n===174||n===177||n===188||n===189||n===190||n===215||n===247)||Ht["General Punctuation"](n)&&(n===8214||n===8224||n===8225||n===8240||n===8241||n===8251||n===8252||n===8258||n===8263||n===8264||n===8265||n===8273)||Ht["Letterlike Symbols"](n)||Ht["Number Forms"](n)||Ht["Miscellaneous Technical"](n)&&(n>=8960&&n<=8967||n>=8972&&n<=8991||n>=8996&&n<=9e3||n===9003||n>=9085&&n<=9114||n>=9150&&n<=9165||n===9167||n>=9169&&n<=9179||n>=9186&&n<=9215)||Ht["Control Pictures"](n)&&n!==9251||Ht["Optical Character Recognition"](n)||Ht["Enclosed Alphanumerics"](n)||Ht["Geometric Shapes"](n)||Ht["Miscellaneous Symbols"](n)&&!(n>=9754&&n<=9759)||Ht["Miscellaneous Symbols and Arrows"](n)&&(n>=11026&&n<=11055||n>=11088&&n<=11097||n>=11192&&n<=11243)||Ht["CJK Symbols and Punctuation"](n)||Ht.Katakana(n)||Ht["Private Use Area"](n)||Ht["CJK Compatibility Forms"](n)||Ht["Small Form Variants"](n)||Ht["Halfwidth and Fullwidth Forms"](n)||n===8734||n===8756||n===8757||n>=9984&&n<=10087||n>=10102&&n<=10131||n===65532||n===65533)}(o))}function lc(o){return o>=1424&&o<=2303||Ht["Arabic Presentation Forms-A"](o)||Ht["Arabic Presentation Forms-B"](o)}function Pd(o,n){return!(!n&&lc(o)||o>=2304&&o<=3583||o>=3840&&o<=4255||Ht.Khmer(o))}function $f(o){for(const n of o)if(lc(n.charCodeAt(0)))return!0;return!1}const Xs=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(o){this.pluginStatus=o.pluginStatus,this.pluginURL=o.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(o){this.applyArabicShaping=o.applyArabicShaping,this.processBidirectionalText=o.processBidirectionalText,this.processStyledBidirectionalText=o.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class kn{constructor(n,a){this.zoom=n,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Cd,this.transition={})}isSupportedScript(n){return function(a,h){for(const g of a)if(!Pd(g.charCodeAt(0),h))return!1;return!0}(n,Xs.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const n=this.zoom,a=n-Math.floor(n),h=this.crossFadingFactor();return n>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:a+(1-a)*h}:{fromScale:.5,toScale:1,t:1-(1-h)*a}}}class Wl{constructor(n,a){this.property=n,this.value=a,this.expression=function(h,g){if(Yu(h))return new Ju(h,g);if(In(h)){const v=md(h,g);if(v.result==="error")throw new Error(v.value.map(x=>`${x.key}: ${x.message}`).join(", "));return v.value}{let v=h;return g.type==="color"&&typeof h=="string"?v=pn.parse(h):g.type!=="padding"||typeof h!="number"&&!Array.isArray(h)?g.type==="variableAnchorOffsetCollection"&&Array.isArray(h)&&(v=so.parse(h)):v=Tr.parse(h),{kind:"constant",evaluate:()=>v}}}(a===void 0?n.specification.default:a,n.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(n,a,h){return this.property.possiblyEvaluate(this,n,a,h)}}class uc{constructor(n){this.property=n,this.value=new Wl(n,void 0)}transitioned(n,a){return new Ad(this.property,this.value,a,ue({},n.transition,this.transition),n.now)}untransitioned(){return new Ad(this.property,this.value,null,{},0)}}class Nh{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitionablePropertyValues)}getValue(n){return Nt(this._values[n].value.value)}setValue(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new uc(this._values[n].property)),this._values[n].value=new Wl(this._values[n].property,a===null?void 0:Nt(a))}getTransition(n){return Nt(this._values[n].transition)}setTransition(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new uc(this._values[n].property)),this._values[n].transition=Nt(a)||void 0}serialize(){const n={};for(const a of Object.keys(this._values)){const h=this.getValue(a);h!==void 0&&(n[a]=h);const g=this.getTransition(a);g!==void 0&&(n[`${a}-transition`]=g)}return n}transitioned(n,a){const h=new Md(this._properties);for(const g of Object.keys(this._values))h._values[g]=this._values[g].transitioned(n,a._values[g]);return h}untransitioned(){const n=new Md(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].untransitioned();return n}}class Ad{constructor(n,a,h,g,v){this.property=n,this.value=a,this.begin=v+g.delay||0,this.end=this.begin+g.duration||0,n.specification.transition&&(g.delay||g.duration)&&(this.prior=h)}possiblyEvaluate(n,a,h){const g=n.now||0,v=this.value.possiblyEvaluate(n,a,h),x=this.prior;if(x){if(g>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(g=1)return 1;const T=E*E,A=T*E;return 4*(E<.5?A:3*(E-T)+A-.75)}(b))}}return v}}class Md{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitioningPropertyValues)}possiblyEvaluate(n,a,h){const g=new Xl(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].possiblyEvaluate(n,a,h);return g}hasTransition(){for(const n of Object.keys(this._values))if(this._values[n].prior)return!0;return!1}}class Dd{constructor(n){this._properties=n,this._values=Object.create(n.defaultPropertyValues)}hasValue(n){return this._values[n].value!==void 0}getValue(n){return Nt(this._values[n].value)}setValue(n,a){this._values[n]=new Wl(this._values[n].property,a===null?void 0:Nt(a))}serialize(){const n={};for(const a of Object.keys(this._values)){const h=this.getValue(a);h!==void 0&&(n[a]=h)}return n}possiblyEvaluate(n,a,h){const g=new Xl(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].possiblyEvaluate(n,a,h);return g}}class Eo{constructor(n,a,h){this.property=n,this.value=a,this.parameters=h}isConstant(){return this.value.kind==="constant"}constantOr(n){return this.value.kind==="constant"?this.value.value:n}evaluate(n,a,h,g){return this.property.evaluate(this.value,this.parameters,n,a,h,g)}}class Xl{constructor(n){this._properties=n,this._values=Object.create(n.defaultPossiblyEvaluatedValues)}get(n){return this._values[n]}}class te{constructor(n){this.specification=n}possiblyEvaluate(n,a){if(n.isDataDriven())throw new Error("Value should not be data driven");return n.expression.evaluate(a)}interpolate(n,a,h){const g=dr[this.specification.type];return g?g(n,a,h):n}}class ae{constructor(n,a){this.specification=n,this.overrides=a}possiblyEvaluate(n,a,h,g){return new Eo(this,n.expression.kind==="constant"||n.expression.kind==="camera"?{kind:"constant",value:n.expression.evaluate(a,null,{},h,g)}:n.expression,a)}interpolate(n,a,h){if(n.value.kind!=="constant"||a.value.kind!=="constant")return n;if(n.value.value===void 0||a.value.value===void 0)return new Eo(this,{kind:"constant",value:void 0},n.parameters);const g=dr[this.specification.type];if(g){const v=g(n.value.value,a.value.value,h);return new Eo(this,{kind:"constant",value:v},n.parameters)}return n}evaluate(n,a,h,g,v,x){return n.kind==="constant"?n.value:n.evaluate(a,h,g,v,x)}}class cc extends ae{possiblyEvaluate(n,a,h,g){if(n.value===void 0)return new Eo(this,{kind:"constant",value:void 0},a);if(n.expression.kind==="constant"){const v=n.expression.evaluate(a,null,{},h,g),x=n.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,b=this._calculate(x,x,x,a);return new Eo(this,{kind:"constant",value:b},a)}if(n.expression.kind==="camera"){const v=this._calculate(n.expression.evaluate({zoom:a.zoom-1}),n.expression.evaluate({zoom:a.zoom}),n.expression.evaluate({zoom:a.zoom+1}),a);return new Eo(this,{kind:"constant",value:v},a)}return new Eo(this,n.expression,a)}evaluate(n,a,h,g,v,x){if(n.kind==="source"){const b=n.evaluate(a,h,g,v,x);return this._calculate(b,b,b,a)}return n.kind==="composite"?this._calculate(n.evaluate({zoom:Math.floor(a.zoom)-1},h,g),n.evaluate({zoom:Math.floor(a.zoom)},h,g),n.evaluate({zoom:Math.floor(a.zoom)+1},h,g),a):n.value}_calculate(n,a,h,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:h,to:a}}interpolate(n){return n}}class Yl{constructor(n){this.specification=n}possiblyEvaluate(n,a,h,g){if(n.value!==void 0){if(n.expression.kind==="constant"){const v=n.expression.evaluate(a,null,{},h,g);return this._calculate(v,v,v,a)}return this._calculate(n.expression.evaluate(new kn(Math.floor(a.zoom-1),a)),n.expression.evaluate(new kn(Math.floor(a.zoom),a)),n.expression.evaluate(new kn(Math.floor(a.zoom+1),a)),a)}}_calculate(n,a,h,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:h,to:a}}interpolate(n){return n}}class kh{constructor(n){this.specification=n}possiblyEvaluate(n,a,h,g){return!!n.expression.evaluate(a,null,{},h,g)}interpolate(){return!1}}class Pr{constructor(n){this.properties=n,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const a in n){const h=n[a];h.specification.overridable&&this.overridableProperties.push(a);const g=this.defaultPropertyValues[a]=new Wl(h,void 0),v=this.defaultTransitionablePropertyValues[a]=new uc(h);this.defaultTransitioningPropertyValues[a]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=g.possiblyEvaluate({})}}}Kt("DataDrivenProperty",ae),Kt("DataConstantProperty",te),Kt("CrossFadedDataDrivenProperty",cc),Kt("CrossFadedProperty",Yl),Kt("ColorRampProperty",kh);const zh="-transition";class So extends Pn{constructor(n,a){if(super(),this.id=n.id,this.type=n.type,this._featureFilter={filter:()=>!0,needGeometry:!1},n.type!=="custom"&&(this.metadata=n.metadata,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,n.type!=="background"&&(this.source=n.source,this.sourceLayer=n["source-layer"],this.filter=n.filter),a.layout&&(this._unevaluatedLayout=new Dd(a.layout)),a.paint)){this._transitionablePaint=new Nh(a.paint);for(const h in n.paint)this.setPaintProperty(h,n.paint[h],{validate:!1});for(const h in n.layout)this.setLayoutProperty(h,n.layout[h],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Xl(a.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(n){return n==="visibility"?this.visibility:this._unevaluatedLayout.getValue(n)}setLayoutProperty(n,a,h={}){a!=null&&this._validate(Qf,`layers.${this.id}.layout.${n}`,n,a,h)||(n!=="visibility"?this._unevaluatedLayout.setValue(n,a):this.visibility=a)}getPaintProperty(n){return n.endsWith(zh)?this._transitionablePaint.getTransition(n.slice(0,-11)):this._transitionablePaint.getValue(n)}setPaintProperty(n,a,h={}){if(a!=null&&this._validate(Dh,`layers.${this.id}.paint.${n}`,n,a,h))return!1;if(n.endsWith(zh))return this._transitionablePaint.setTransition(n.slice(0,-11),a||void 0),!1;{const g=this._transitionablePaint._values[n],v=g.property.specification["property-type"]==="cross-faded-data-driven",x=g.value.isDataDriven(),b=g.value;this._transitionablePaint.setValue(n,a),this._handleSpecialPaintPropertyUpdate(n);const E=this._transitionablePaint._values[n].value;return E.isDataDriven()||x||v||this._handleOverridablePaintPropertyUpdate(n,b,E)}}_handleSpecialPaintPropertyUpdate(n){}_handleOverridablePaintPropertyUpdate(n,a,h){return!1}isHidden(n){return!!(this.minzoom&&n=this.maxzoom)||this.visibility==="none"}updateTransitions(n){this._transitioningPaint=this._transitionablePaint.transitioned(n,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(n,a){n.getCrossfadeParameters&&(this._crossfadeParameters=n.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(n,void 0,a)),this.paint=this._transitioningPaint.possiblyEvaluate(n,void 0,a)}serialize(){const n={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&&(n.layout=n.layout||{},n.layout.visibility=this.visibility),ve(n,(a,h)=>!(a===void 0||h==="layout"&&!Object.keys(a).length||h==="paint"&&!Object.keys(a).length))}_validate(n,a,h,g,v={}){return(!v||v.validate!==!1)&&el(this,n.call(xa,{key:a,layerType:this.type,objectKey:h,value:g,styleSpec:xt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const n in this.paint._values){const a=this.paint.get(n);if(a instanceof Eo&&Qa(a.property.specification)&&(a.value.kind==="source"||a.value.kind==="composite")&&a.value.isStateDependent)return!0}return!1}}const Rd={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Kl{constructor(n,a){this._structArray=n,this._pos1=a*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Yn{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(n,a){return n._trim(),a&&(n.isTransferred=!0,a.push(n.arrayBuffer)),{length:n.length,arrayBuffer:n.arrayBuffer}}static deserialize(n){const a=Object.create(this.prototype);return a.arrayBuffer=n.arrayBuffer,a.length=n.length,a.capacity=n.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_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(n){this.reserve(n),this.length=n}reserve(n){if(n>this.capacity){this.capacity=Math.max(n,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const a=this.uint8;this._refreshViews(),a&&this.uint8.set(a)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ui(o,n=1){let a=0,h=0;return{members:o.map(g=>{const v=Rd[g.type].BYTES_PER_ELEMENT,x=a=Nd(a,Math.max(n,v)),b=g.components||1;return h=Math.max(h,v),a+=v*b,{name:g.name,type:g.type,components:b,offset:x}}),size:Nd(a,Math.max(h,n)),alignment:n}}function Nd(o,n){return Math.ceil(o/n)*n}class Jl extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a){const h=this.length;return this.resize(h+1),this.emplace(h,n,a)}emplace(n,a,h){const g=2*n;return this.int16[g+0]=a,this.int16[g+1]=h,n}}Jl.prototype.bytesPerElement=4,Kt("StructArrayLayout2i4",Jl);class vs extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h){const g=this.length;return this.resize(g+1),this.emplace(g,n,a,h)}emplace(n,a,h,g){const v=3*n;return this.int16[v+0]=a,this.int16[v+1]=h,this.int16[v+2]=g,n}}vs.prototype.bytesPerElement=6,Kt("StructArrayLayout3i6",vs);class Oh extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,a,h,g)}emplace(n,a,h,g,v){const x=4*n;return this.int16[x+0]=a,this.int16[x+1]=h,this.int16[x+2]=g,this.int16[x+3]=v,n}}Oh.prototype.bytesPerElement=8,Kt("StructArrayLayout4i8",Oh);class Fh extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,h,g,v,x)}emplace(n,a,h,g,v,x,b){const E=6*n;return this.int16[E+0]=a,this.int16[E+1]=h,this.int16[E+2]=g,this.int16[E+3]=v,this.int16[E+4]=x,this.int16[E+5]=b,n}}Fh.prototype.bytesPerElement=12,Kt("StructArrayLayout2i4i12",Fh);class Bh extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,h,g,v,x)}emplace(n,a,h,g,v,x,b){const E=4*n,T=8*n;return this.int16[E+0]=a,this.int16[E+1]=h,this.uint8[T+4]=g,this.uint8[T+5]=v,this.uint8[T+6]=x,this.uint8[T+7]=b,n}}Bh.prototype.bytesPerElement=8,Kt("StructArrayLayout2i4ub8",Bh);class Ql extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a){const h=this.length;return this.resize(h+1),this.emplace(h,n,a)}emplace(n,a,h){const g=2*n;return this.float32[g+0]=a,this.float32[g+1]=h,n}}Ql.prototype.bytesPerElement=8,Kt("StructArrayLayout2f8",Ql);class hc extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x,b,E,T,A){const M=this.length;return this.resize(M+1),this.emplace(M,n,a,h,g,v,x,b,E,T,A)}emplace(n,a,h,g,v,x,b,E,T,A,M){const O=10*n;return this.uint16[O+0]=a,this.uint16[O+1]=h,this.uint16[O+2]=g,this.uint16[O+3]=v,this.uint16[O+4]=x,this.uint16[O+5]=b,this.uint16[O+6]=E,this.uint16[O+7]=T,this.uint16[O+8]=A,this.uint16[O+9]=M,n}}hc.prototype.bytesPerElement=20,Kt("StructArrayLayout10ui20",hc);class Vh extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x,b,E,T,A,M,O){const B=this.length;return this.resize(B+1),this.emplace(B,n,a,h,g,v,x,b,E,T,A,M,O)}emplace(n,a,h,g,v,x,b,E,T,A,M,O,B){const q=12*n;return this.int16[q+0]=a,this.int16[q+1]=h,this.int16[q+2]=g,this.int16[q+3]=v,this.uint16[q+4]=x,this.uint16[q+5]=b,this.uint16[q+6]=E,this.uint16[q+7]=T,this.int16[q+8]=A,this.int16[q+9]=M,this.int16[q+10]=O,this.int16[q+11]=B,n}}Vh.prototype.bytesPerElement=24,Kt("StructArrayLayout4i4ui4i24",Vh);class Uh extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,h){const g=this.length;return this.resize(g+1),this.emplace(g,n,a,h)}emplace(n,a,h,g){const v=3*n;return this.float32[v+0]=a,this.float32[v+1]=h,this.float32[v+2]=g,n}}Uh.prototype.bytesPerElement=12,Kt("StructArrayLayout3f12",Uh);class xs extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint32[1*n+0]=a,n}}xs.prototype.bytesPerElement=4,Kt("StructArrayLayout1ul4",xs);class pc extends Yn{_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(n,a,h,g,v,x,b,E,T){const A=this.length;return this.resize(A+1),this.emplace(A,n,a,h,g,v,x,b,E,T)}emplace(n,a,h,g,v,x,b,E,T,A){const M=10*n,O=5*n;return this.int16[M+0]=a,this.int16[M+1]=h,this.int16[M+2]=g,this.int16[M+3]=v,this.int16[M+4]=x,this.int16[M+5]=b,this.uint32[O+3]=E,this.uint16[M+8]=T,this.uint16[M+9]=A,n}}pc.prototype.bytesPerElement=20,Kt("StructArrayLayout6i1ul2ui20",pc);class $l extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,h,g,v,x)}emplace(n,a,h,g,v,x,b){const E=6*n;return this.int16[E+0]=a,this.int16[E+1]=h,this.int16[E+2]=g,this.int16[E+3]=v,this.int16[E+4]=x,this.int16[E+5]=b,n}}$l.prototype.bytesPerElement=12,Kt("StructArrayLayout2i2i2i12",$l);class dc extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v){const x=this.length;return this.resize(x+1),this.emplace(x,n,a,h,g,v)}emplace(n,a,h,g,v,x){const b=4*n,E=8*n;return this.float32[b+0]=a,this.float32[b+1]=h,this.float32[b+2]=g,this.int16[E+6]=v,this.int16[E+7]=x,n}}dc.prototype.bytesPerElement=16,Kt("StructArrayLayout2f1f2i16",dc);class tu extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,a,h,g)}emplace(n,a,h,g,v){const x=12*n,b=3*n;return this.uint8[x+0]=a,this.uint8[x+1]=h,this.float32[b+1]=g,this.float32[b+2]=v,n}}tu.prototype.bytesPerElement=12,Kt("StructArrayLayout2ub2f12",tu);class fc extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,h){const g=this.length;return this.resize(g+1),this.emplace(g,n,a,h)}emplace(n,a,h,g){const v=3*n;return this.uint16[v+0]=a,this.uint16[v+1]=h,this.uint16[v+2]=g,n}}fc.prototype.bytesPerElement=6,Kt("StructArrayLayout3ui6",fc);class ol extends Yn{_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(n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$){const ut=this.length;return this.resize(ut+1),this.emplace(ut,n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$)}emplace(n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$,ut){const tt=24*n,ot=12*n,Et=48*n;return this.int16[tt+0]=a,this.int16[tt+1]=h,this.uint16[tt+2]=g,this.uint16[tt+3]=v,this.uint32[ot+2]=x,this.uint32[ot+3]=b,this.uint32[ot+4]=E,this.uint16[tt+10]=T,this.uint16[tt+11]=A,this.uint16[tt+12]=M,this.float32[ot+7]=O,this.float32[ot+8]=B,this.uint8[Et+36]=q,this.uint8[Et+37]=Z,this.uint8[Et+38]=Y,this.uint32[ot+10]=$,this.int16[tt+22]=ut,n}}ol.prototype.bytesPerElement=48,Kt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ol);class ba extends Yn{_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(n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$,ut,tt,ot,Et,Tt,Xt,Qt,Wt,Zt,Ft,Jt){const Ut=this.length;return this.resize(Ut+1),this.emplace(Ut,n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$,ut,tt,ot,Et,Tt,Xt,Qt,Wt,Zt,Ft,Jt)}emplace(n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$,ut,tt,ot,Et,Tt,Xt,Qt,Wt,Zt,Ft,Jt,Ut){const Mt=32*n,oe=16*n;return this.int16[Mt+0]=a,this.int16[Mt+1]=h,this.int16[Mt+2]=g,this.int16[Mt+3]=v,this.int16[Mt+4]=x,this.int16[Mt+5]=b,this.int16[Mt+6]=E,this.int16[Mt+7]=T,this.uint16[Mt+8]=A,this.uint16[Mt+9]=M,this.uint16[Mt+10]=O,this.uint16[Mt+11]=B,this.uint16[Mt+12]=q,this.uint16[Mt+13]=Z,this.uint16[Mt+14]=Y,this.uint16[Mt+15]=$,this.uint16[Mt+16]=ut,this.uint16[Mt+17]=tt,this.uint16[Mt+18]=ot,this.uint16[Mt+19]=Et,this.uint16[Mt+20]=Tt,this.uint16[Mt+21]=Xt,this.uint16[Mt+22]=Qt,this.uint32[oe+12]=Wt,this.float32[oe+13]=Zt,this.float32[oe+14]=Ft,this.uint16[Mt+30]=Jt,this.uint16[Mt+31]=Ut,n}}ba.prototype.bytesPerElement=64,Kt("StructArrayLayout8i15ui1ul2f2ui64",ba);class mc extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.float32[1*n+0]=a,n}}mc.prototype.bytesPerElement=4,Kt("StructArrayLayout1f4",mc);class gc extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,h){const g=this.length;return this.resize(g+1),this.emplace(g,n,a,h)}emplace(n,a,h,g){const v=3*n;return this.uint16[6*n+0]=a,this.float32[v+1]=h,this.float32[v+2]=g,n}}gc.prototype.bytesPerElement=12,Kt("StructArrayLayout1ui2f12",gc);class wa extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,h){const g=this.length;return this.resize(g+1),this.emplace(g,n,a,h)}emplace(n,a,h,g){const v=4*n;return this.uint32[2*n+0]=a,this.uint16[v+2]=h,this.uint16[v+3]=g,n}}wa.prototype.bytesPerElement=8,Kt("StructArrayLayout1ul2ui8",wa);class qh extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a){const h=this.length;return this.resize(h+1),this.emplace(h,n,a)}emplace(n,a,h){const g=2*n;return this.uint16[g+0]=a,this.uint16[g+1]=h,n}}qh.prototype.bytesPerElement=4,Kt("StructArrayLayout2ui4",qh);class Gh extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint16[1*n+0]=a,n}}Gh.prototype.bytesPerElement=2,Kt("StructArrayLayout1ui2",Gh);class _c extends Yn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,a,h,g)}emplace(n,a,h,g,v){const x=4*n;return this.float32[x+0]=a,this.float32[x+1]=h,this.float32[x+2]=g,this.float32[x+3]=v,n}}_c.prototype.bytesPerElement=16,Kt("StructArrayLayout4f16",_c);class kd extends Kl{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 k(this.anchorPointX,this.anchorPointY)}}kd.prototype.size=20;class _ extends pc{get(n){return new kd(this,n)}}Kt("CollisionBoxArray",_);class i extends Kl{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(n){this._structArray.uint8[this._pos1+37]=n}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(n){this._structArray.uint8[this._pos1+38]=n}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(n){this._structArray.uint32[this._pos4+10]=n}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}i.prototype.size=48;class u extends ol{get(n){return new i(this,n)}}Kt("PlacedSymbolArray",u);class d extends Kl{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(n){this._structArray.uint32[this._pos4+12]=n}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]}}d.prototype.size=64;class f extends ba{get(n){return new d(this,n)}}Kt("SymbolInstanceArray",f);class y extends mc{getoffsetX(n){return this.float32[1*n+0]}}Kt("GlyphOffsetArray",y);class w extends vs{getx(n){return this.int16[3*n+0]}gety(n){return this.int16[3*n+1]}gettileUnitDistanceFromAnchor(n){return this.int16[3*n+2]}}Kt("SymbolLineVertexArray",w);class I extends Kl{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]}}I.prototype.size=12;class C extends gc{get(n){return new I(this,n)}}Kt("TextAnchorOffsetArray",C);class P extends Kl{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]}}P.prototype.size=8;class D extends wa{get(n){return new P(this,n)}}Kt("FeatureIndexArray",D);class N extends Jl{}class V extends Jl{}class X extends Jl{}class W extends Fh{}class J extends Bh{}class j extends Ql{}class nt extends hc{}class mt extends Vh{}class Q extends Uh{}class st extends xs{}class gt extends $l{}class yt extends tu{}class wt extends fc{}class At extends qh{}const Pt=ui([{name:"a_pos",components:2,type:"Int16"}],4),{members:zt}=Pt;class Bt{constructor(n=[]){this.segments=n}prepareSegment(n,a,h,g){let v=this.segments[this.segments.length-1];return n>Bt.MAX_VERTEX_ARRAY_LENGTH&&Re(`Max vertices per segment is ${Bt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${n}`),(!v||v.vertexLength+n>Bt.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==g)&&(v={vertexOffset:a.length,primitiveOffset:h.length,vertexLength:0,primitiveLength:0},g!==void 0&&(v.sortKey=g),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const n of this.segments)for(const a in n.vaos)n.vaos[a].destroy()}static simpleSegment(n,a,h,g){return new Bt([{vertexOffset:n,primitiveOffset:a,vertexLength:h,primitiveLength:g,vaos:{},sortKey:0}])}}function Ie(o,n){return 256*(o=pe(Math.floor(o),0,255))+pe(Math.floor(n),0,255)}Bt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Kt("SegmentVector",Bt);const Vt=ui([{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 le={exports:{}},Ee={exports:{}};Ee.exports=function(o,n){var a,h,g,v,x,b,E,T;for(h=o.length-(a=3&o.length),g=n,x=3432918353,b=461845907,T=0;T>>16)*x&65535)<<16)&4294967295)<<15|E>>>17))*b+(((E>>>16)*b&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(E=0,a){case 3:E^=(255&o.charCodeAt(T+2))<<16;case 2:E^=(255&o.charCodeAt(T+1))<<8;case 1:g^=E=(65535&(E=(E=(65535&(E^=255&o.charCodeAt(T)))*x+(((E>>>16)*x&65535)<<16)&4294967295)<<15|E>>>17))*b+(((E>>>16)*b&65535)<<16)&4294967295}return g^=o.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var je=Ee.exports,fe={exports:{}};fe.exports=function(o,n){for(var a,h=o.length,g=n^h,v=0;h>=4;)a=1540483477*(65535&(a=255&o.charCodeAt(v)|(255&o.charCodeAt(++v))<<8|(255&o.charCodeAt(++v))<<16|(255&o.charCodeAt(++v))<<24))+((1540483477*(a>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),h-=4,++v;switch(h){case 3:g^=(255&o.charCodeAt(v+2))<<16;case 2:g^=(255&o.charCodeAt(v+1))<<8;case 1:g=1540483477*(65535&(g^=255&o.charCodeAt(v)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var Le=je,De=fe.exports;le.exports=Le,le.exports.murmur3=Le,le.exports.murmur2=De;var Kn=S(le.exports);class fn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(n,a,h,g){this.ids.push(Zr(n)),this.positions.push(a,h,g)}getPositions(n){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const a=Zr(n);let h=0,g=this.ids.length-1;for(;h>1;this.ids[x]>=a?g=x:h=x+1}const v=[];for(;this.ids[h]===a;)v.push({index:this.positions[3*h],start:this.positions[3*h+1],end:this.positions[3*h+2]}),h++;return v}static serialize(n,a){const h=new Float64Array(n.ids),g=new Uint32Array(n.positions);return Si(h,g,0,h.length-1),a&&a.push(h.buffer,g.buffer),{ids:h,positions:g}}static deserialize(n){const a=new fn;return a.ids=n.ids,a.positions=n.positions,a.indexed=!0,a}}function Zr(o){const n=+o;return!isNaN(n)&&n<=Number.MAX_SAFE_INTEGER?n:Kn(String(o))}function Si(o,n,a,h){for(;a>1];let v=a-1,x=h+1;for(;;){do v++;while(o[v]g);if(v>=x)break;qn(o,v,x),qn(n,3*v,3*x),qn(n,3*v+1,3*x+1),qn(n,3*v+2,3*x+2)}x-a`u_${g}`),this.type=h}setUniform(n,a,h){n.set(h.constantOr(this.value))}getBinding(n,a,h){return this.type==="color"?new Ys(n,a):new Hr(n,a)}}class _i{constructor(n,a){this.uniformNames=a.map(h=>`u_${h}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(n,a){this.pixelRatioFrom=a.pixelRatio,this.pixelRatioTo=n.pixelRatio,this.patternFrom=a.tlbr,this.patternTo=n.tlbr}setUniform(n,a,h,g){const v=g==="u_pattern_to"?this.patternTo:g==="u_pattern_from"?this.patternFrom:g==="u_pixel_ratio_to"?this.pixelRatioTo:g==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&n.set(v)}getBinding(n,a,h){return h.substr(0,9)==="u_pattern"?new Qo(n,a):new Hr(n,a)}}class Gn{constructor(n,a,h,g){this.expression=n,this.type=h,this.maxValue=0,this.paintVertexAttributes=a.map(v=>({name:`a_${v}`,type:"Float32",components:h==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(n,a,h,g,v){const x=this.paintVertexArray.length,b=this.expression.evaluate(new kn(0),a,{},g,[],v);this.paintVertexArray.resize(n),this._setPaintValue(x,n,b)}updatePaintArray(n,a,h,g){const v=this.expression.evaluate({zoom:0},h,g);this._setPaintValue(n,a,v)}_setPaintValue(n,a,h){if(this.type==="color"){const g=Ks(h);for(let v=n;v`u_${b}_t`),this.type=h,this.useIntegerZoom=g,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=a.map(b=>({name:`a_${b}`,type:"Float32",components:h==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(n,a,h,g,v){const x=this.expression.evaluate(new kn(this.zoom),a,{},g,[],v),b=this.expression.evaluate(new kn(this.zoom+1),a,{},g,[],v),E=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValue(E,n,x,b)}updatePaintArray(n,a,h,g){const v=this.expression.evaluate({zoom:this.zoom},h,g),x=this.expression.evaluate({zoom:this.zoom+1},h,g);this._setPaintValue(n,a,v,x)}_setPaintValue(n,a,h,g){if(this.type==="color"){const v=Ks(h),x=Ks(g);for(let b=n;b`#define HAS_UNIFORM_${g}`))}return n}getBinderAttributes(){const n=[];for(const a in this.binders){const h=this.binders[a];if(h instanceof Gn||h instanceof zn)for(let g=0;g!0){this.programConfigurations={};for(const g of n)this.programConfigurations[g.id]=new yi(g,a,h);this.needsUpload=!1,this._featureMap=new fn,this._bufferOffset=0}populatePaintArrays(n,a,h,g,v,x){for(const b in this.programConfigurations)this.programConfigurations[b].populatePaintArrays(n,a,g,v,x);a.id!==void 0&&this._featureMap.add(a.id,h,this._bufferOffset,n),this._bufferOffset=n,this.needsUpload=!0}updatePaintArrays(n,a,h,g){for(const v of h)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(n,this._featureMap,a,v,g)||this.needsUpload}get(n){return this.programConfigurations[n]}upload(n){if(this.needsUpload){for(const a in this.programConfigurations)this.programConfigurations[a].upload(n);this.needsUpload=!1}}destroy(){for(const n in this.programConfigurations)this.programConfigurations[n].destroy()}}function uo(o,n){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"]}[o]||[o.replace(`${n}-`,"").replace(/-/g,"_")]}function vi(o,n,a){const h={color:{source:Ql,composite:_c},number:{source:mc,composite:Ql}},g=function(v){return{"line-pattern":{source:nt,composite:nt},"fill-pattern":{source:nt,composite:nt},"fill-extrusion-pattern":{source:nt,composite:nt}}[v]}(o);return g&&g[a]||h[n][a]}Kt("ConstantBinder",$o),Kt("CrossFadedConstantBinder",_i),Kt("SourceExpressionBinder",Gn),Kt("CrossFadedCompositeBinder",lo),Kt("CompositeExpressionBinder",zn),Kt("ProgramConfiguration",yi,{omit:["_buffers"]}),Kt("ProgramConfigurationSet",jn);const ii=8192,jh=Math.pow(2,14)-1,zd=-jh-1;function Ia(o){const n=ii/o.extent,a=o.loadGeometry();for(let h=0;hx.x+1||Ex.y+1)&&Re("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return a}function Ea(o,n){return{type:o.type,id:o.id,properties:o.properties,geometry:n?Ia(o):[]}}function yc(o,n,a,h,g){o.emplaceBack(2*n+(h+1)/2,2*a+(g+1)/2)}class Js{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new V,this.indexArray=new wt,this.segments=new Bt,this.programConfigurations=new jn(n.layers,n.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,h){const g=this.layers[0],v=[];let x=null,b=!1;g.type==="circle"&&(x=g.layout.get("circle-sort-key"),b=!x.isConstant());for(const{feature:E,id:T,index:A,sourceLayerIndex:M}of n){const O=this.layers[0]._featureFilter.needGeometry,B=Ea(E,O);if(!this.layers[0]._featureFilter.filter(new kn(this.zoom),B,h))continue;const q=b?x.evaluate(B,{},h):void 0,Z={id:T,properties:E.properties,type:E.type,sourceLayerIndex:M,index:A,geometry:O?B.geometry:Ia(E),patterns:{},sortKey:q};v.push(Z)}b&&v.sort((E,T)=>E.sortKey-T.sortKey);for(const E of v){const{geometry:T,index:A,sourceLayerIndex:M}=E,O=n[A].feature;this.addFeature(E,T,A,h),a.featureIndex.insert(O,T,A,M,this.index)}}update(n,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,zt),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(n,a,h,g){for(const v of a)for(const x of v){const b=x.x,E=x.y;if(b<0||b>=ii||E<0||E>=ii)continue;const T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,n.sortKey),A=T.vertexLength;yc(this.layoutVertexArray,b,E,-1,-1),yc(this.layoutVertexArray,b,E,1,-1),yc(this.layoutVertexArray,b,E,1,1),yc(this.layoutVertexArray,b,E,-1,1),this.indexArray.emplaceBack(A,A+1,A+2),this.indexArray.emplaceBack(A,A+3,A+2),T.vertexLength+=4,T.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,h,{},g)}}function Zh(o,n){for(let a=0;a1){if(vc(o,n))return!0;for(let h=0;h1?a:a.sub(n)._mult(g)._add(n))}function Rg(o,n){let a,h,g,v=!1;for(let x=0;xn.y!=g.y>n.y&&n.x<(g.x-h.x)*(n.y-h.y)/(g.y-h.y)+h.x&&(v=!v)}return v}function xc(o,n){let a=!1;for(let h=0,g=o.length-1;hn.y!=x.y>n.y&&n.x<(x.x-v.x)*(n.y-v.y)/(x.y-v.y)+v.x&&(a=!a)}return a}function sv(o,n,a){const h=a[0],g=a[2];if(o.xg.x&&n.x>g.x||o.yg.y&&n.y>g.y)return!1;const v=ge(o,n,a[0]);return v!==ge(o,n,a[1])||v!==ge(o,n,a[2])||v!==ge(o,n,a[3])}function Yh(o,n,a){const h=n.paint.get(o).value;return h.kind==="constant"?h.value:a.programConfigurations.get(n.id).getMaxValue(o)}function Fd(o){return Math.sqrt(o[0]*o[0]+o[1]*o[1])}function Bd(o,n,a,h,g){if(!n[0]&&!n[1])return o;const v=k.convert(n)._mult(g);a==="viewport"&&v._rotate(-h);const x=[];for(let b=0;bOg(Y,Z))}(T,E),B=M?A*b:A;for(const q of g)for(const Z of q){const Y=M?Z:Og(Z,E);let $=B;const ut=Vd([],[Z.x,Z.y,0,1],E);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=ut[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=x.cameraToCenterDistance/ut[3]),Od(O,Y,$))return!0}return!1}}function Og(o,n){const a=Vd([],[o.x,o.y,0,1],n);return new k(a[0]/a[3],a[1]/a[3])}class Fg extends Js{}let Bg;Kt("HeatmapBucket",Fg,{omit:["layers"]});var cv={get paint(){return Bg=Bg||new Pr({"heatmap-radius":new ae(xt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ae(xt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new te(xt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new kh(xt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new te(xt.paint_heatmap["heatmap-opacity"])})}};function nm(o,{width:n,height:a},h,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==n*a*h)throw new RangeError(`mismatched image size. expected: ${g.length} but got: ${n*a*h}`)}else g=new Uint8Array(n*a*h);return o.width=n,o.height=a,o.data=g,o}function Vg(o,{width:n,height:a},h){if(n===o.width&&a===o.height)return;const g=nm({},{width:n,height:a},h);im(o,g,{x:0,y:0},{x:0,y:0},{width:Math.min(o.width,n),height:Math.min(o.height,a)},h),o.width=n,o.height=a,o.data=g.data}function im(o,n,a,h,g,v){if(g.width===0||g.height===0)return n;if(g.width>o.width||g.height>o.height||a.x>o.width-g.width||a.y>o.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>n.width||g.height>n.height||h.x>n.width-g.width||h.y>n.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const x=o.data,b=n.data;if(x===b)throw new Error("srcData equals dstData, so image is already copied");for(let E=0;E{n[o.evaluationKey]=E;const T=o.expression.evaluate(n);g.data[x+b+0]=Math.floor(255*T.r/T.a),g.data[x+b+1]=Math.floor(255*T.g/T.a),g.data[x+b+2]=Math.floor(255*T.b/T.a),g.data[x+b+3]=Math.floor(255*T.a)};if(o.clips)for(let x=0,b=0;x80*a){h=v=o[0],g=x=o[1];for(var q=a;qv&&(v=b),E>x&&(x=E);T=(T=Math.max(v-h,x-g))!==0?32767/T:0}return Qh(O,B,a,h,g,T,0),B}function Gg(o,n,a,h,g){var v,x;if(g===am(o,n,a,h)>0)for(v=n;v=n;v-=h)x=Hg(v,o[v],o[v+1],x);return x&&qd(x,x.next)&&(tp(x),x=x.next),x}function nu(o,n){if(!o)return o;n||(n=o);var a,h=o;do if(a=!1,h.steiner||!qd(h,h.next)&&ci(h.prev,h,h.next)!==0)h=h.next;else{if(tp(h),(h=n=h.prev)===h.next)break;a=!0}while(a||h!==n);return n}function Qh(o,n,a,h,g,v,x){if(o){!x&&v&&function(A,M,O,B){var q=A;do q.z===0&&(q.z=om(q.x,q.y,M,O,B)),q.prevZ=q.prev,q.nextZ=q.next,q=q.next;while(q!==A);q.prevZ.nextZ=null,q.prevZ=null,function(Z){var Y,$,ut,tt,ot,Et,Tt,Xt,Qt=1;do{for($=Z,Z=null,ot=null,Et=0;$;){for(Et++,ut=$,Tt=0,Y=0;Y0||Xt>0&&ut;)Tt!==0&&(Xt===0||!ut||$.z<=ut.z)?(tt=$,$=$.nextZ,Tt--):(tt=ut,ut=ut.nextZ,Xt--),ot?ot.nextZ=tt:Z=tt,tt.prevZ=ot,ot=tt;$=ut}ot.nextZ=null,Qt*=2}while(Et>1)}(q)}(o,h,g,v);for(var b,E,T=o;o.prev!==o.next;)if(b=o.prev,E=o.next,v?_v(o,h,g,v):gv(o))n.push(b.i/a|0),n.push(o.i/a|0),n.push(E.i/a|0),tp(o),o=E.next,T=E.next;else if((o=E)===T){x?x===1?Qh(o=yv(nu(o),n,a),n,a,h,g,v,2):x===2&&vv(o,n,a,h,g,v):Qh(nu(o),n,a,h,g,v,1);break}}}function gv(o){var n=o.prev,a=o,h=o.next;if(ci(n,a,h)>=0)return!1;for(var g=n.x,v=a.x,x=h.x,b=n.y,E=a.y,T=h.y,A=gv?g>x?g:x:v>x?v:x,B=b>E?b>T?b:T:E>T?E:T,q=h.next;q!==n;){if(q.x>=A&&q.x<=O&&q.y>=M&&q.y<=B&&wc(g,b,v,E,x,T,q.x,q.y)&&ci(q.prev,q,q.next)>=0)return!1;q=q.next}return!0}function _v(o,n,a,h){var g=o.prev,v=o,x=o.next;if(ci(g,v,x)>=0)return!1;for(var b=g.x,E=v.x,T=x.x,A=g.y,M=v.y,O=x.y,B=bE?b>T?b:T:E>T?E:T,Y=A>M?A>O?A:O:M>O?M:O,$=om(B,q,n,a,h),ut=om(Z,Y,n,a,h),tt=o.prevZ,ot=o.nextZ;tt&&tt.z>=$&&ot&&ot.z<=ut;){if(tt.x>=B&&tt.x<=Z&&tt.y>=q&&tt.y<=Y&&tt!==g&&tt!==x&&wc(b,A,E,M,T,O,tt.x,tt.y)&&ci(tt.prev,tt,tt.next)>=0||(tt=tt.prevZ,ot.x>=B&&ot.x<=Z&&ot.y>=q&&ot.y<=Y&&ot!==g&&ot!==x&&wc(b,A,E,M,T,O,ot.x,ot.y)&&ci(ot.prev,ot,ot.next)>=0))return!1;ot=ot.nextZ}for(;tt&&tt.z>=$;){if(tt.x>=B&&tt.x<=Z&&tt.y>=q&&tt.y<=Y&&tt!==g&&tt!==x&&wc(b,A,E,M,T,O,tt.x,tt.y)&&ci(tt.prev,tt,tt.next)>=0)return!1;tt=tt.prevZ}for(;ot&&ot.z<=ut;){if(ot.x>=B&&ot.x<=Z&&ot.y>=q&&ot.y<=Y&&ot!==g&&ot!==x&&wc(b,A,E,M,T,O,ot.x,ot.y)&&ci(ot.prev,ot,ot.next)>=0)return!1;ot=ot.nextZ}return!0}function yv(o,n,a){var h=o;do{var g=h.prev,v=h.next.next;!qd(g,v)&&jg(g,h,h.next,v)&&$h(g,v)&&$h(v,g)&&(n.push(g.i/a|0),n.push(h.i/a|0),n.push(v.i/a|0),tp(h),tp(h.next),h=o=v),h=h.next}while(h!==o);return nu(h)}function vv(o,n,a,h,g,v){var x=o;do{for(var b=x.next.next;b!==x.prev;){if(x.i!==b.i&&Ev(x,b)){var E=Zg(x,b);return x=nu(x,x.next),E=nu(E,E.next),Qh(x,n,a,h,g,v,0),void Qh(E,n,a,h,g,v,0)}b=b.next}x=x.next}while(x!==o)}function xv(o,n){return o.x-n.x}function bv(o,n){var a=function(g,v){var x,b=v,E=g.x,T=g.y,A=-1/0;do{if(T<=b.y&&T>=b.next.y&&b.next.y!==b.y){var M=b.x+(T-b.y)*(b.next.x-b.x)/(b.next.y-b.y);if(M<=E&&M>A&&(A=M,x=b.x=b.x&&b.x>=q&&E!==b.x&&wc(Tx.x||b.x===x.x&&wv(x,b)))&&(x=b,Y=O)),b=b.next;while(b!==B);return x}(o,n);if(!a)return n;var h=Zg(a,o);return nu(h,h.next),nu(a,a.next)}function wv(o,n){return ci(o.prev,o,n.prev)<0&&ci(n.next,o,o.next)<0}function om(o,n,a,h,g){return(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-a)*g|0)|o<<8))|o<<4))|o<<2))|o<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-h)*g|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function Iv(o){var n=o,a=o;do(n.x=(o-x)*(v-b)&&(o-x)*(h-b)>=(a-x)*(n-b)&&(a-x)*(v-b)>=(g-x)*(h-b)}function Ev(o,n){return o.next.i!==n.i&&o.prev.i!==n.i&&!function(a,h){var g=a;do{if(g.i!==a.i&&g.next.i!==a.i&&g.i!==h.i&&g.next.i!==h.i&&jg(g,g.next,a,h))return!0;g=g.next}while(g!==a);return!1}(o,n)&&($h(o,n)&&$h(n,o)&&function(a,h){var g=a,v=!1,x=(a.x+h.x)/2,b=(a.y+h.y)/2;do g.y>b!=g.next.y>b&&g.next.y!==g.y&&x<(g.next.x-g.x)*(b-g.y)/(g.next.y-g.y)+g.x&&(v=!v),g=g.next;while(g!==a);return v}(o,n)&&(ci(o.prev,o,n.prev)||ci(o,n.prev,n))||qd(o,n)&&ci(o.prev,o,o.next)>0&&ci(n.prev,n,n.next)>0)}function ci(o,n,a){return(n.y-o.y)*(a.x-n.x)-(n.x-o.x)*(a.y-n.y)}function qd(o,n){return o.x===n.x&&o.y===n.y}function jg(o,n,a,h){var g=jd(ci(o,n,a)),v=jd(ci(o,n,h)),x=jd(ci(a,h,o)),b=jd(ci(a,h,n));return g!==v&&x!==b||!(g!==0||!Gd(o,a,n))||!(v!==0||!Gd(o,h,n))||!(x!==0||!Gd(a,o,h))||!(b!==0||!Gd(a,n,h))}function Gd(o,n,a){return n.x<=Math.max(o.x,a.x)&&n.x>=Math.min(o.x,a.x)&&n.y<=Math.max(o.y,a.y)&&n.y>=Math.min(o.y,a.y)}function jd(o){return o>0?1:o<0?-1:0}function $h(o,n){return ci(o.prev,o,o.next)<0?ci(o,n,o.next)>=0&&ci(o,o.prev,n)>=0:ci(o,n,o.prev)<0||ci(o,o.next,n)<0}function Zg(o,n){var a=new sm(o.i,o.x,o.y),h=new sm(n.i,n.x,n.y),g=o.next,v=n.prev;return o.next=n,n.prev=o,a.next=g,g.prev=a,h.next=a,a.prev=h,v.next=h,h.prev=v,h}function Hg(o,n,a,h){var g=new sm(o,n,a);return h?(g.next=h.next,g.prev=h,h.next.prev=g,h.next=g):(g.prev=g,g.next=g),g}function tp(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function sm(o,n,a){this.i=o,this.x=n,this.y=a,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function am(o,n,a,h){for(var g=0,v=n,x=a-h;v0&&a.holes.push(h+=o[g-1].length)}return a};var Wg=S(rm.exports);function Sv(o,n,a,h,g){Xg(o,n,a||0,h||o.length-1,g||Cv)}function Xg(o,n,a,h,g){for(;h>a;){if(h-a>600){var v=h-a+1,x=n-a+1,b=Math.log(v),E=.5*Math.exp(2*b/3),T=.5*Math.sqrt(b*E*(v-E)/v)*(x-v/2<0?-1:1);Xg(o,n,Math.max(a,Math.floor(n-x*E/v+T)),Math.min(h,Math.floor(n+(v-x)*E/v+T)),g)}var A=o[n],M=a,O=h;for(ep(o,a,n),g(o[h],A)>0&&ep(o,a,h);M0;)O--}g(o[a],A)===0?ep(o,a,O):ep(o,++O,h),O<=n&&(a=O+1),n<=O&&(h=O-1)}}function ep(o,n,a){var h=o[n];o[n]=o[a],o[a]=h}function Cv(o,n){return on?1:0}function lm(o,n){const a=o.length;if(a<=1)return[o];const h=[];let g,v;for(let x=0;x1)for(let x=0;xa.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new X,this.indexArray=new wt,this.indexArray2=new At,this.programConfigurations=new jn(n.layers,n.zoom),this.segments=new Bt,this.segments2=new Bt,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,h){this.hasPattern=um("fill",this.layers,a);const g=this.layers[0].layout.get("fill-sort-key"),v=!g.isConstant(),x=[];for(const{feature:b,id:E,index:T,sourceLayerIndex:A}of n){const M=this.layers[0]._featureFilter.needGeometry,O=Ea(b,M);if(!this.layers[0]._featureFilter.filter(new kn(this.zoom),O,h))continue;const B=v?g.evaluate(O,{},h,a.availableImages):void 0,q={id:E,properties:b.properties,type:b.type,sourceLayerIndex:A,index:T,geometry:M?O.geometry:Ia(b),patterns:{},sortKey:B};x.push(q)}v&&x.sort((b,E)=>b.sortKey-E.sortKey);for(const b of x){const{geometry:E,index:T,sourceLayerIndex:A}=b;if(this.hasPattern){const M=cm("fill",this.layers,b,this.zoom,a);this.patternFeatures.push(M)}else this.addFeature(b,E,T,h,{});a.featureIndex.insert(n[T].feature,E,T,A,this.index)}}update(n,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,h)}addFeatures(n,a,h){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,a,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,mv),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.indexBuffer2=n.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(n),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(n,a,h,g,v){for(const x of lm(a,500)){let b=0;for(const B of x)b+=B.length;const E=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray),T=E.vertexLength,A=[],M=[];for(const B of x){if(B.length===0)continue;B!==x[0]&&M.push(A.length/2);const q=this.segments2.prepareSegment(B.length,this.layoutVertexArray,this.indexArray2),Z=q.vertexLength;this.layoutVertexArray.emplaceBack(B[0].x,B[0].y),this.indexArray2.emplaceBack(Z+B.length-1,Z),A.push(B[0].x),A.push(B[0].y);for(let Y=1;Y>3}if(g--,h===1||h===2)v+=o.readSVarint(),x+=o.readSVarint(),h===1&&(n&&b.push(n),n=[]),n.push(new Rv(v,x));else{if(h!==7)throw new Error("unknown command "+h);n&&n.push(n[0].clone())}}return n&&b.push(n),b},Ic.prototype.bbox=function(){var o=this._pbf;o.pos=this._geometry;for(var n=o.readVarint()+o.pos,a=1,h=0,g=0,v=0,x=1/0,b=-1/0,E=1/0,T=-1/0;o.pos>3}if(h--,a===1||a===2)(g+=o.readSVarint())b&&(b=g),(v+=o.readSVarint())T&&(T=v);else if(a!==7)throw new Error("unknown command "+a)}return[x,E,b,T]},Ic.prototype.toGeoJSON=function(o,n,a){var h,g,v=this.extent*Math.pow(2,a),x=this.extent*o,b=this.extent*n,E=this.loadGeometry(),T=Ic.types[this.type];function A(B){for(var q=0;q>3;g=x===1?h.readString():x===2?h.readFloat():x===3?h.readDouble():x===4?h.readVarint64():x===5?h.readVarint():x===6?h.readSVarint():x===7?h.readBoolean():null}return g}(a))}$g.prototype.feature=function(o){if(o<0||o>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[o];var n=this._pbf.readVarint()+this._pbf.pos;return new zv(this._pbf,n,this.extent,this._keys,this._values)};var Fv=Qg;function Bv(o,n,a){if(o===3){var h=new Fv(a,a.readVarint()+a.pos);h.length&&(n[h.name]=h)}}sl.VectorTile=function(o,n){this.layers=o.readFields(Bv,{},n)},sl.VectorTileFeature=Jg,sl.VectorTileLayer=Qg;const Vv=sl.VectorTileFeature.types,pm=Math.pow(2,13);function np(o,n,a,h,g,v,x,b){o.emplaceBack(n,a,2*Math.floor(h*pm)+x,g*pm*2,v*pm*2,Math.round(b))}class dm{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new W,this.centroidVertexArray=new N,this.indexArray=new wt,this.programConfigurations=new jn(n.layers,n.zoom),this.segments=new Bt,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,h){this.features=[],this.hasPattern=um("fill-extrusion",this.layers,a);for(const{feature:g,id:v,index:x,sourceLayerIndex:b}of n){const E=this.layers[0]._featureFilter.needGeometry,T=Ea(g,E);if(!this.layers[0]._featureFilter.filter(new kn(this.zoom),T,h))continue;const A={id:v,sourceLayerIndex:b,index:x,geometry:E?T.geometry:Ia(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(cm("fill-extrusion",this.layers,A,this.zoom,a)):this.addFeature(A,A.geometry,x,h,{}),a.featureIndex.insert(g,A.geometry,x,b,this.index,!0)}}addFeatures(n,a,h){for(const g of this.features){const{geometry:v}=g;this.addFeature(g,v,g.index,a,h)}}update(n,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Dv),this.centroidVertexBuffer=n.createVertexBuffer(this.centroidVertexArray,Mv.members,!0),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(n,a,h,g,v){const x={x:0,y:0,vertexCount:0};for(const b of lm(a,500)){let E=0;for(const q of b)E+=q.length;let T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const q of b){if(q.length===0||qv(q))continue;let Z=0;for(let Y=0;Y=1){const ut=q[Y-1];if(!Uv($,ut)){T.vertexLength+4>Bt.MAX_VERTEX_ARRAY_LENGTH&&(T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const tt=$.sub(ut)._perp()._unit(),ot=ut.dist($);Z+ot>32768&&(Z=0),np(this.layoutVertexArray,$.x,$.y,tt.x,tt.y,0,0,Z),np(this.layoutVertexArray,$.x,$.y,tt.x,tt.y,0,1,Z),x.x+=2*$.x,x.y+=2*$.y,x.vertexCount+=2,Z+=ot,np(this.layoutVertexArray,ut.x,ut.y,tt.x,tt.y,0,0,Z),np(this.layoutVertexArray,ut.x,ut.y,tt.x,tt.y,0,1,Z),x.x+=2*ut.x,x.y+=2*ut.y,x.vertexCount+=2;const Et=T.vertexLength;this.indexArray.emplaceBack(Et,Et+2,Et+1),this.indexArray.emplaceBack(Et+1,Et+2,Et+3),T.vertexLength+=4,T.primitiveLength+=2}}}}if(T.vertexLength+E>Bt.MAX_VERTEX_ARRAY_LENGTH&&(T=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray)),Vv[n.type]!=="Polygon")continue;const A=[],M=[],O=T.vertexLength;for(const q of b)if(q.length!==0){q!==b[0]&&M.push(A.length/2);for(let Z=0;Zii)||o.y===n.y&&(o.y<0||o.y>ii)}function qv(o){return o.every(n=>n.x<0)||o.every(n=>n.x>ii)||o.every(n=>n.y<0)||o.every(n=>n.y>ii)}let t_;Kt("FillExtrusionBucket",dm,{omit:["layers","features"]});var Gv={get paint(){return t_=t_||new Pr({"fill-extrusion-opacity":new te(xt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ae(xt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new te(xt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new te(xt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new cc(xt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ae(xt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ae(xt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new te(xt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class jv extends So{constructor(n){super(n,Gv)}createBucket(n){return new dm(n)}queryRadius(){return Fd(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(n,a,h,g,v,x,b,E){const T=Bd(n,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,b),A=this.paint.get("fill-extrusion-height").evaluate(a,h),M=this.paint.get("fill-extrusion-base").evaluate(a,h),O=function(q,Z,Y,$){const ut=[];for(const tt of q){const ot=[tt.x,tt.y,0,1];Vd(ot,ot,Z),ut.push(new k(ot[0]/ot[3],ot[1]/ot[3]))}return ut}(T,E),B=function(q,Z,Y,$){const ut=[],tt=[],ot=$[8]*Z,Et=$[9]*Z,Tt=$[10]*Z,Xt=$[11]*Z,Qt=$[8]*Y,Wt=$[9]*Y,Zt=$[10]*Y,Ft=$[11]*Y;for(const Jt of q){const Ut=[],Mt=[];for(const oe of Jt){const $t=oe.x,Ne=oe.y,Mn=$[0]*$t+$[4]*Ne+$[12],On=$[1]*$t+$[5]*Ne+$[13],Li=$[2]*$t+$[6]*Ne+$[14],co=$[3]*$t+$[7]*Ne+$[15],Mr=Li+Tt,xi=co+Xt,Gi=Mn+Qt,er=On+Wt,Dr=Li+Zt,Rr=co+Ft,Pi=new k((Mn+ot)/xi,(On+Et)/xi);Pi.z=Mr/xi,Ut.push(Pi);const Ai=new k(Gi/Rr,er/Rr);Ai.z=Dr/Rr,Mt.push(Ai)}ut.push(Ut),tt.push(Mt)}return[ut,tt]}(g,M,A,E);return function(q,Z,Y){let $=1/0;Hh(Y,Z)&&($=e_(Y,Z[0]));for(let ut=0;uta.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new J,this.layoutVertexArray2=new j,this.indexArray=new wt,this.programConfigurations=new jn(n.layers,n.zoom),this.segments=new Bt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,h){this.hasPattern=um("line",this.layers,a);const g=this.layers[0].layout.get("line-sort-key"),v=!g.isConstant(),x=[];for(const{feature:b,id:E,index:T,sourceLayerIndex:A}of n){const M=this.layers[0]._featureFilter.needGeometry,O=Ea(b,M);if(!this.layers[0]._featureFilter.filter(new kn(this.zoom),O,h))continue;const B=v?g.evaluate(O,{},h):void 0,q={id:E,properties:b.properties,type:b.type,sourceLayerIndex:A,index:T,geometry:M?O.geometry:Ia(b),patterns:{},sortKey:B};x.push(q)}v&&x.sort((b,E)=>b.sortKey-E.sortKey);for(const b of x){const{geometry:E,index:T,sourceLayerIndex:A}=b;if(this.hasPattern){const M=cm("line",this.layers,b,this.zoom,a);this.patternFeatures.push(M)}else this.addFeature(b,E,T,h,{});a.featureIndex.insert(n[T].feature,E,T,A,this.index)}}update(n,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,h)}addFeatures(n,a,h){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,a,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=n.createVertexBuffer(this.layoutVertexArray2,Xv)),this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Hv),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(n){if(n.properties&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_end"))return{start:+n.properties.mapbox_clip_start,end:+n.properties.mapbox_clip_end}}addFeature(n,a,h,g,v){const x=this.layers[0].layout,b=x.get("line-join").evaluate(n,{}),E=x.get("line-cap"),T=x.get("line-miter-limit"),A=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(n);for(const M of a)this.addLine(M,n,b,E,T,A);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,h,v,g)}addLine(n,a,h,g,v,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $=0;$=2&&n[E-1].equals(n[E-2]);)E--;let T=0;for(;T0;if(Xt&&$>T){const Ft=O.dist(B);if(Ft>2*A){const Jt=O.sub(O.sub(B)._mult(A/Ft)._round());this.updateDistance(B,Jt),this.addCurrentVertex(Jt,Z,0,0,M),B=Jt}}const Wt=B&&q;let Zt=Wt?h:b?"butt":g;if(Wt&&Zt==="round"&&(Etv&&(Zt="bevel"),Zt==="bevel"&&(Et>2&&(Zt="flipbevel"),Et100)ut=Y.mult(-1);else{const Ft=Et*Z.add(Y).mag()/Z.sub(Y).mag();ut._perp()._mult(Ft*(Qt?-1:1))}this.addCurrentVertex(O,ut,0,0,M),this.addCurrentVertex(O,ut.mult(-1),0,0,M)}else if(Zt==="bevel"||Zt==="fakeround"){const Ft=-Math.sqrt(Et*Et-1),Jt=Qt?Ft:0,Ut=Qt?0:Ft;if(B&&this.addCurrentVertex(O,Z,Jt,Ut,M),Zt==="fakeround"){const Mt=Math.round(180*Tt/Math.PI/20);for(let oe=1;oe2*A){const Jt=O.add(q.sub(O)._mult(A/Ft)._round());this.updateDistance(O,Jt),this.addCurrentVertex(Jt,Y,0,0,M),O=Jt}}}}addCurrentVertex(n,a,h,g,v,x=!1){const b=a.y*g-a.x,E=-a.y-a.x*g;this.addHalfVertex(n,a.x+a.y*h,a.y-a.x*h,x,!1,h,v),this.addHalfVertex(n,b,E,x,!0,-g,v),this.distance>n_/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(n,a,h,g,v,x))}addHalfVertex({x:n,y:a},h,g,v,x,b,E){const T=.5*(this.lineClips?this.scaledDistance*(n_-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((n<<1)+(v?1:0),(a<<1)+(x?1:0),Math.round(63*h)+128,Math.round(63*g)+128,1+(b===0?0:b<0?-1:1)|(63&T)<<2,T>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const A=E.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,A),E.primitiveLength++),x?this.e2=A:this.e1=A}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(n,a){this.distance+=n.dist(a),this.updateScaledDistance()}}let i_,r_;Kt("LineBucket",fm,{omit:["layers","patternFeatures"]});var o_={get paint(){return r_=r_||new Pr({"line-opacity":new ae(xt.paint_line["line-opacity"]),"line-color":new ae(xt.paint_line["line-color"]),"line-translate":new te(xt.paint_line["line-translate"]),"line-translate-anchor":new te(xt.paint_line["line-translate-anchor"]),"line-width":new ae(xt.paint_line["line-width"]),"line-gap-width":new ae(xt.paint_line["line-gap-width"]),"line-offset":new ae(xt.paint_line["line-offset"]),"line-blur":new ae(xt.paint_line["line-blur"]),"line-dasharray":new Yl(xt.paint_line["line-dasharray"]),"line-pattern":new cc(xt.paint_line["line-pattern"]),"line-gradient":new kh(xt.paint_line["line-gradient"])})},get layout(){return i_=i_||new Pr({"line-cap":new te(xt.layout_line["line-cap"]),"line-join":new ae(xt.layout_line["line-join"]),"line-miter-limit":new te(xt.layout_line["line-miter-limit"]),"line-round-limit":new te(xt.layout_line["line-round-limit"]),"line-sort-key":new ae(xt.layout_line["line-sort-key"])})}};class Jv extends ae{possiblyEvaluate(n,a){return a=new kn(Math.floor(a.zoom),{now:a.now,fadeDuration:a.fadeDuration,zoomHistory:a.zoomHistory,transition:a.transition}),super.possiblyEvaluate(n,a)}evaluate(n,a,h,g){return a=ue({},a,{zoom:Math.floor(a.zoom)}),super.evaluate(n,a,h,g)}}let Zd;class Qv extends So{constructor(n){super(n,o_),this.gradientVersion=0,Zd||(Zd=new Jv(o_.paint.properties["line-width"].specification),Zd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(n){if(n==="line-gradient"){const a=this.gradientExpression();this.stepInterpolant=!!function(h){return h._styleExpression!==void 0}(a)&&a._styleExpression.expression instanceof Ul,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(n,a){super.recalculate(n,a),this.paint._values["line-floorwidth"]=Zd.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,n)}createBucket(n){return new fm(n)}queryRadius(n){const a=n,h=s_(Yh("line-width",this,a),Yh("line-gap-width",this,a)),g=Yh("line-offset",this,a);return h/2+Math.abs(g)+Fd(this.paint.get("line-translate"))}queryIntersectsFeature(n,a,h,g,v,x,b){const E=Bd(n,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,b),T=b/2*s_(this.paint.get("line-width").evaluate(a,h),this.paint.get("line-gap-width").evaluate(a,h)),A=this.paint.get("line-offset").evaluate(a,h);return A&&(g=function(M,O){const B=[];for(let q=0;q=3){for(let Y=0;Y0?n+2*o:o}const $v=ui([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),tx=ui([{name:"a_projected_pos",components:3,type:"Float32"}],4);ui([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ex=ui([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ui([{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 a_=ui([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),nx=ui([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ix(o,n,a){return o.sections.forEach(h=>{h.text=function(g,v,x){const b=v.layout.get("text-transform").evaluate(x,{});return b==="uppercase"?g=g.toLocaleUpperCase():b==="lowercase"&&(g=g.toLocaleLowerCase()),Xs.applyArabicShaping&&(g=Xs.applyArabicShaping(g)),g}(h.text,n,a)}),o}ui([{name:"triangle",components:3,type:"Uint16"}]),ui([{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"}]),ui([{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"}]),ui([{type:"Float32",name:"offsetX"}]),ui([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ui([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const rp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ti=24,l_=_n,u_=function(o,n,a,h,g){var v,x,b=8*g-h-1,E=(1<>1,A=-7,M=a?g-1:0,O=a?-1:1,B=o[n+M];for(M+=O,v=B&(1<<-A)-1,B>>=-A,A+=b;A>0;v=256*v+o[n+M],M+=O,A-=8);for(x=v&(1<<-A)-1,v>>=-A,A+=h;A>0;x=256*x+o[n+M],M+=O,A-=8);if(v===0)v=1-T;else{if(v===E)return x?NaN:1/0*(B?-1:1);x+=Math.pow(2,h),v-=T}return(B?-1:1)*x*Math.pow(2,v-h)},c_=function(o,n,a,h,g,v){var x,b,E,T=8*v-g-1,A=(1<>1,O=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,B=h?0:v-1,q=h?1:-1,Z=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(b=isNaN(n)?1:0,x=A):(x=Math.floor(Math.log(n)/Math.LN2),n*(E=Math.pow(2,-x))<1&&(x--,E*=2),(n+=x+M>=1?O/E:O*Math.pow(2,1-M))*E>=2&&(x++,E/=2),x+M>=A?(b=0,x=A):x+M>=1?(b=(n*E-1)*Math.pow(2,g),x+=M):(b=n*Math.pow(2,M-1)*Math.pow(2,g),x=0));g>=8;o[a+B]=255&b,B+=q,b/=256,g-=8);for(x=x<0;o[a+B]=255&x,B+=q,x/=256,T-=8);o[a+B-q]|=128*Z};function _n(o){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(o)?o:new Uint8Array(o||0),this.pos=0,this.type=0,this.length=this.buf.length}_n.Varint=0,_n.Fixed64=1,_n.Bytes=2,_n.Fixed32=5;var mm=4294967296,h_=1/mm,p_=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Sa(o){return o.type===_n.Bytes?o.readVarint()+o.pos:o.pos+1}function Ec(o,n,a){return a?4294967296*n+(o>>>0):4294967296*(n>>>0)+(o>>>0)}function d_(o,n,a){var h=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));a.realloc(h);for(var g=a.pos-1;g>=o;g--)a.buf[g+h]=a.buf[g]}function rx(o,n){for(var a=0;a>>8,o[a+2]=n>>>16,o[a+3]=n>>>24}function f_(o,n){return(o[n]|o[n+1]<<8|o[n+2]<<16)+(o[n+3]<<24)}_n.prototype={destroy:function(){this.buf=null},readFields:function(o,n,a){for(a=a||this.length;this.pos>3,v=this.pos;this.type=7&h,o(g,n,this),this.pos===v&&this.skip(h)}return n},readMessage:function(o,n){return this.readFields(o,n,this.readVarint()+this.pos)},readFixed32:function(){var o=Hd(this.buf,this.pos);return this.pos+=4,o},readSFixed32:function(){var o=f_(this.buf,this.pos);return this.pos+=4,o},readFixed64:function(){var o=Hd(this.buf,this.pos)+Hd(this.buf,this.pos+4)*mm;return this.pos+=8,o},readSFixed64:function(){var o=Hd(this.buf,this.pos)+f_(this.buf,this.pos+4)*mm;return this.pos+=8,o},readFloat:function(){var o=u_(this.buf,this.pos,!0,23,4);return this.pos+=4,o},readDouble:function(){var o=u_(this.buf,this.pos,!0,52,8);return this.pos+=8,o},readVarint:function(o){var n,a,h=this.buf;return n=127&(a=h[this.pos++]),a<128?n:(n|=(127&(a=h[this.pos++]))<<7,a<128?n:(n|=(127&(a=h[this.pos++]))<<14,a<128?n:(n|=(127&(a=h[this.pos++]))<<21,a<128?n:function(g,v,x){var b,E,T=x.buf;if(b=(112&(E=T[x.pos++]))>>4,E<128||(b|=(127&(E=T[x.pos++]))<<3,E<128)||(b|=(127&(E=T[x.pos++]))<<10,E<128)||(b|=(127&(E=T[x.pos++]))<<17,E<128)||(b|=(127&(E=T[x.pos++]))<<24,E<128)||(b|=(1&(E=T[x.pos++]))<<31,E<128))return Ec(g,b,v);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(a=h[this.pos]))<<28,o,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var o=this.readVarint();return o%2==1?(o+1)/-2:o/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var o=this.readVarint()+this.pos,n=this.pos;return this.pos=o,o-n>=12&&p_?function(a,h,g){return p_.decode(a.subarray(h,g))}(this.buf,n,o):function(a,h,g){for(var v="",x=h;x239?4:A>223?3:A>191?2:1;if(x+O>g)break;O===1?A<128&&(M=A):O===2?(192&(b=a[x+1]))==128&&(M=(31&A)<<6|63&b)<=127&&(M=null):O===3?(E=a[x+2],(192&(b=a[x+1]))==128&&(192&E)==128&&((M=(15&A)<<12|(63&b)<<6|63&E)<=2047||M>=55296&&M<=57343)&&(M=null)):O===4&&(E=a[x+2],T=a[x+3],(192&(b=a[x+1]))==128&&(192&E)==128&&(192&T)==128&&((M=(15&A)<<18|(63&b)<<12|(63&E)<<6|63&T)<=65535||M>=1114112)&&(M=null)),M===null?(M=65533,O=1):M>65535&&(M-=65536,v+=String.fromCharCode(M>>>10&1023|55296),M=56320|1023&M),v+=String.fromCharCode(M),x+=O}return v}(this.buf,n,o)},readBytes:function(){var o=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,o);return this.pos=o,n},readPackedVarint:function(o,n){if(this.type!==_n.Bytes)return o.push(this.readVarint(n));var a=Sa(this);for(o=o||[];this.pos127;);else if(n===_n.Bytes)this.pos=this.readVarint()+this.pos;else if(n===_n.Fixed32)this.pos+=4;else{if(n!==_n.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(o,n){this.writeVarint(o<<3|n)},realloc:function(o){for(var n=this.length||16;n268435455||o<0?function(n,a){var h,g;if(n>=0?(h=n%4294967296|0,g=n/4294967296|0):(g=~(-n/4294967296),4294967295^(h=~(-n%4294967296))?h=h+1|0:(h=0,g=g+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.realloc(10),function(v,x,b){b.buf[b.pos++]=127&v|128,v>>>=7,b.buf[b.pos++]=127&v|128,v>>>=7,b.buf[b.pos++]=127&v|128,v>>>=7,b.buf[b.pos++]=127&v|128,b.buf[b.pos]=127&(v>>>=7)}(h,0,a),function(v,x){var b=(7&v)<<4;x.buf[x.pos++]|=b|((v>>>=3)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v)))))}(g,a)}(o,this):(this.realloc(4),this.buf[this.pos++]=127&o|(o>127?128:0),o<=127||(this.buf[this.pos++]=127&(o>>>=7)|(o>127?128:0),o<=127||(this.buf[this.pos++]=127&(o>>>=7)|(o>127?128:0),o<=127||(this.buf[this.pos++]=o>>>7&127))))},writeSVarint:function(o){this.writeVarint(o<0?2*-o-1:2*o)},writeBoolean:function(o){this.writeVarint(!!o)},writeString:function(o){o=String(o),this.realloc(4*o.length),this.pos++;var n=this.pos;this.pos=function(h,g,v){for(var x,b,E=0;E55295&&x<57344){if(!b){x>56319||E+1===g.length?(h[v++]=239,h[v++]=191,h[v++]=189):b=x;continue}if(x<56320){h[v++]=239,h[v++]=191,h[v++]=189,b=x;continue}x=b-55296<<10|x-56320|65536,b=null}else b&&(h[v++]=239,h[v++]=191,h[v++]=189,b=null);x<128?h[v++]=x:(x<2048?h[v++]=x>>6|192:(x<65536?h[v++]=x>>12|224:(h[v++]=x>>18|240,h[v++]=x>>12&63|128),h[v++]=x>>6&63|128),h[v++]=63&x|128)}return v}(this.buf,o,this.pos);var a=this.pos-n;a>=128&&d_(n,a,this),this.pos=n-1,this.writeVarint(a),this.pos+=a},writeFloat:function(o){this.realloc(4),c_(this.buf,o,this.pos,!0,23,4),this.pos+=4},writeDouble:function(o){this.realloc(8),c_(this.buf,o,this.pos,!0,52,8),this.pos+=8},writeBytes:function(o){var n=o.length;this.writeVarint(n),this.realloc(n);for(var a=0;a=128&&d_(a,h,this),this.pos=a-1,this.writeVarint(h),this.pos+=h},writeMessage:function(o,n,a){this.writeTag(o,_n.Bytes),this.writeRawMessage(n,a)},writePackedVarint:function(o,n){n.length&&this.writeMessage(o,rx,n)},writePackedSVarint:function(o,n){n.length&&this.writeMessage(o,ox,n)},writePackedBoolean:function(o,n){n.length&&this.writeMessage(o,lx,n)},writePackedFloat:function(o,n){n.length&&this.writeMessage(o,sx,n)},writePackedDouble:function(o,n){n.length&&this.writeMessage(o,ax,n)},writePackedFixed32:function(o,n){n.length&&this.writeMessage(o,ux,n)},writePackedSFixed32:function(o,n){n.length&&this.writeMessage(o,cx,n)},writePackedFixed64:function(o,n){n.length&&this.writeMessage(o,hx,n)},writePackedSFixed64:function(o,n){n.length&&this.writeMessage(o,px,n)},writeBytesField:function(o,n){this.writeTag(o,_n.Bytes),this.writeBytes(n)},writeFixed32Field:function(o,n){this.writeTag(o,_n.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(o,n){this.writeTag(o,_n.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(o,n){this.writeTag(o,_n.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(o,n){this.writeTag(o,_n.Fixed64),this.writeSFixed64(n)},writeVarintField:function(o,n){this.writeTag(o,_n.Varint),this.writeVarint(n)},writeSVarintField:function(o,n){this.writeTag(o,_n.Varint),this.writeSVarint(n)},writeStringField:function(o,n){this.writeTag(o,_n.Bytes),this.writeString(n)},writeFloatField:function(o,n){this.writeTag(o,_n.Fixed32),this.writeFloat(n)},writeDoubleField:function(o,n){this.writeTag(o,_n.Fixed64),this.writeDouble(n)},writeBooleanField:function(o,n){this.writeVarintField(o,!!n)}};var gm=S(l_);const _m=3;function dx(o,n,a){o===1&&a.readMessage(fx,n)}function fx(o,n,a){if(o===3){const{id:h,bitmap:g,width:v,height:x,left:b,top:E,advance:T}=a.readMessage(mx,{});n.push({id:h,bitmap:new Jh({width:v+2*_m,height:x+2*_m},g),metrics:{width:v,height:x,left:b,top:E,advance:T}})}}function mx(o,n,a){o===1?n.id=a.readVarint():o===2?n.bitmap=a.readBytes():o===3?n.width=a.readVarint():o===4?n.height=a.readVarint():o===5?n.left=a.readSVarint():o===6?n.top=a.readSVarint():o===7&&(n.advance=a.readVarint())}const m_=_m;function g_(o){let n=0,a=0;for(const x of o)n+=x.w*x.h,a=Math.max(a,x.w);o.sort((x,b)=>b.h-x.h);const h=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(n/.95)),a),h:1/0}];let g=0,v=0;for(const x of o)for(let b=h.length-1;b>=0;b--){const E=h[b];if(!(x.w>E.w||x.h>E.h)){if(x.x=E.x,x.y=E.y,v=Math.max(v,x.y+x.h),g=Math.max(g,x.x+x.w),x.w===E.w&&x.h===E.h){const T=h.pop();b=0&&h>=n&&Xd[this.text.charCodeAt(h)];h--)a--;this.text=this.text.substring(n,a),this.sectionIndex=this.sectionIndex.slice(n,a)}substring(n,a){const h=new Cc;return h.text=this.text.substring(n,a),h.sectionIndex=this.sectionIndex.slice(n,a),h.sections=this.sections,h}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((n,a)=>Math.max(n,this.sections[a].scale),0)}addTextSection(n,a){this.text+=n.text,this.sections.push(sp.forText(n.scale,n.fontStack||a));const h=this.sections.length-1;for(let g=0;g=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Wd(o,n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z){const Y=Cc.fromFeature(o,g);let $;M===m.ah.vertical&&Y.verticalizePunctuation();const{processBidirectionalText:ut,processStyledBidirectionalText:tt}=Xs;if(ut&&Y.sections.length===1){$=[];const Tt=ut(Y.toString(),vm(Y,T,v,n,h,B,q));for(const Xt of Tt){const Qt=new Cc;Qt.text=Xt,Qt.sections=Y.sections;for(let Wt=0;Wt0&&Ta>Xr&&(Xr=Ta)}else{const Lo=Qt[Ve.fontStack],Kr=Lo&&Lo[nr];if(Kr&&Kr.rect)bs=Kr.rect,ts=Kr.metrics;else{const Ta=Xt[Ve.fontStack],hp=Ta&&Ta[nr];if(!hp)continue;ts=hp.metrics}Di=(Ai-Ve.scale)*Ti}es?(Tt.verticalizable=!0,gr.push({glyph:nr,imageName:ws,x:Mn,y:On+Di,vertical:es,scale:Ve.scale,fontStack:Ve.fontStack,sectionIndex:_r,metrics:ts,rect:bs}),Mn+=Ca*Ve.scale+oe):(gr.push({glyph:nr,imageName:ws,x:Mn,y:On+Di,vertical:es,scale:Ve.scale,fontStack:Ve.fontStack,sectionIndex:_r,metrics:ts,rect:bs}),Mn+=ts.advance*Ve.scale+oe)}gr.length!==0&&(Li=Math.max(Mn-oe,Li),yx(gr,0,gr.length-1,Mr,Xr)),Mn=0;const Yr=Ft*Ai+Xr;Nr.lineOffset=Math.max(Xr,mr),On+=Yr,co=Math.max(Yr,co),++xi}var Gi;const er=On-op,{horizontalAlign:Dr,verticalAlign:Rr}=xm(Jt);(function(Pi,Ai,mr,Nr,gr,Xr,Yr,Mi,Ve){const _r=(Ai-mr)*gr;let nr=0;nr=Xr!==Yr?-Mi*Nr-op:(-Nr*Ve+.5)*Yr;for(const Di of Pi)for(const ts of Di.positionedGlyphs)ts.x+=_r,ts.y+=nr})(Tt.positionedLines,Mr,Dr,Rr,Li,co,Ft,er,Zt.length),Tt.top+=-Rr*er,Tt.bottom=Tt.top+er,Tt.left+=-Dr*Li,Tt.right=Tt.left+Li}(Et,n,a,h,$,x,b,E,M,T,O,Z),!function(Tt){for(const Xt of Tt)if(Xt.positionedGlyphs.length!==0)return!1;return!0}(ot)&&Et}const Xd={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},gx={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function y_(o,n,a,h,g,v){if(n.imageName){const x=h[n.imageName];return x?x.displaySize[0]*n.scale*Ti/v+g:0}{const x=a[n.fontStack],b=x&&x[o];return b?b.metrics.advance*n.scale+g:0}}function v_(o,n,a,h){const g=Math.pow(o-n,2);return h?o=0;let A=0;for(let O=0;Ox.id),this.index=n.index,this.pixelRatio=n.pixelRatio,this.sourceLayerIndex=n.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=em([]),this.placementViewportMatrix=em([]);const a=this.layers[0]._unevaluatedLayout._values;this.textSizeData=I_(this.zoom,a["text-size"]),this.iconSizeData=I_(this.zoom,a["icon-size"]);const h=this.layers[0].layout,g=h.get("symbol-sort-key"),v=h.get("symbol-z-order");this.canOverlap=bm(h,"text-overlap","text-allow-overlap")!=="never"||bm(h,"icon-overlap","icon-allow-overlap")!=="never"||h.get("text-ignore-placement")||h.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!g.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,h.get("symbol-placement")==="point"&&(this.writingModes=h.get("text-writing-mode").map(x=>m.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=n.sourceID}createArrays(){this.text=new Im(new jn(this.layers,this.zoom,n=>/^text/.test(n))),this.icon=new Im(new jn(this.layers,this.zoom,n=>/^icon/.test(n))),this.glyphOffsetArray=new y,this.lineVertexArray=new w,this.symbolInstances=new f,this.textAnchorOffsets=new C}calculateGlyphDependencies(n,a,h,g,v){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),A=E.value.kind!=="constant"||!!E.value.value||Object.keys(E.parameters).length>0,M=v.get("symbol-sort-key");if(this.features=[],!T&&!A)return;const O=a.iconDependencies,B=a.glyphDependencies,q=a.availableImages,Z=new kn(this.zoom);for(const{feature:Y,id:$,index:ut,sourceLayerIndex:tt}of n){const ot=g._featureFilter.needGeometry,Et=Ea(Y,ot);if(!g._featureFilter.filter(Z,Et,h))continue;let Tt,Xt;if(ot||(Et.geometry=Ia(Y)),T){const Wt=g.getValueAndResolveTokens("text-field",Et,h,q),Zt=qr.factory(Wt),Ft=this.hasRTLText=this.hasRTLText||wx(Zt);(!Ft||Xs.getRTLTextPluginStatus()==="unavailable"||Ft&&Xs.isParsed())&&(Tt=ix(Zt,g,Et))}if(A){const Wt=g.getValueAndResolveTokens("icon-image",Et,h,q);Xt=Wt instanceof ao?Wt:ao.fromString(Wt)}if(!Tt&&!Xt)continue;const Qt=this.sortFeaturesByKey?M.evaluate(Et,{},h):void 0;if(this.features.push({id:$,text:Tt,icon:Xt,index:ut,sourceLayerIndex:tt,geometry:Et.geometry,properties:Y.properties,type:xx[Y.type],sortKey:Qt}),Xt&&(O[Xt.name]=!0),Tt){const Wt=x.evaluate(Et,{},h).join(","),Zt=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(m.ah.vertical)>=0;for(const Ft of Tt.sections)if(Ft.image)O[Ft.image.name]=!0;else{const Jt=rl(Tt.toString()),Ut=Ft.fontStack||Wt,Mt=B[Ut]=B[Ut]||{};this.calculateGlyphDependencies(Ft.text,Mt,Zt,this.allowVerticalPlacement,Jt)}}}v.get("symbol-placement")==="line"&&(this.features=function(Y){const $={},ut={},tt=[];let ot=0;function Et(Wt){tt.push(Y[Wt]),ot++}function Tt(Wt,Zt,Ft){const Jt=ut[Wt];return delete ut[Wt],ut[Zt]=Jt,tt[Jt].geometry[0].pop(),tt[Jt].geometry[0]=tt[Jt].geometry[0].concat(Ft[0]),Jt}function Xt(Wt,Zt,Ft){const Jt=$[Zt];return delete $[Zt],$[Wt]=Jt,tt[Jt].geometry[0].shift(),tt[Jt].geometry[0]=Ft[0].concat(tt[Jt].geometry[0]),Jt}function Qt(Wt,Zt,Ft){const Jt=Ft?Zt[0][Zt[0].length-1]:Zt[0][0];return`${Wt}:${Jt.x}:${Jt.y}`}for(let Wt=0;WtWt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Y,$)=>Y.sortKey-$.sortKey)}update(n,a,h){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(n,a,this.layers,h),this.icon.programConfigurations.updatePaintArrays(n,a,this.layers,h))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(n),this.iconCollisionBox.upload(n)),this.text.upload(n,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(n,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(n,a){const h=this.lineVertexArray.length;if(n.segment!==void 0){let g=n.dist(a[n.segment+1]),v=n.dist(a[n.segment]);const x={};for(let b=n.segment+1;b=0;b--)x[b]={x:a[b].x,y:a[b].y,tileUnitDistanceFromAnchor:v},b>0&&(v+=a[b-1].dist(a[b]));for(let b=0;b0}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(n,a){const h=n.placedSymbolArray.get(a),g=h.vertexStartIndex+4*h.numGlyphs;for(let v=h.vertexStartIndex;vg[b]-g[E]||v[E]-v[b]),x}addToSortKeyRanges(n,a){const h=this.sortKeyRanges[this.sortKeyRanges.length-1];h&&h.sortKey===a?h.symbolInstanceEnd=n+1:this.sortKeyRanges.push({sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:n+1})}sortFeatures(n){if(this.sortFeaturesByY&&this.sortedAngle!==n&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(n),this.sortedAngle=n,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const a of this.symbolInstanceIndexes){const h=this.symbolInstances.get(a);this.featureSortOrder.push(h.featureIndex),[h.rightJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.leftJustifiedTextSymbolIndex].forEach((g,v,x)=>{g>=0&&x.indexOf(g)===v&&this.addIndicesForPlacedSymbol(this.text,g)}),h.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,h.verticalPlacedTextSymbolIndex),h.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.placedIconSymbolIndex),h.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let E_,S_;Kt("SymbolBucket",Tc,{omit:["layers","collisionBoxArray","features","compareText"]}),Tc.MAX_GLYPHS=65535,Tc.addDynamicAttributes=wm;var Sm={get paint(){return S_=S_||new Pr({"icon-opacity":new ae(xt.paint_symbol["icon-opacity"]),"icon-color":new ae(xt.paint_symbol["icon-color"]),"icon-halo-color":new ae(xt.paint_symbol["icon-halo-color"]),"icon-halo-width":new ae(xt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ae(xt.paint_symbol["icon-halo-blur"]),"icon-translate":new te(xt.paint_symbol["icon-translate"]),"icon-translate-anchor":new te(xt.paint_symbol["icon-translate-anchor"]),"text-opacity":new ae(xt.paint_symbol["text-opacity"]),"text-color":new ae(xt.paint_symbol["text-color"],{runtimeType:fi,getOverride:o=>o.textColor,hasOverride:o=>!!o.textColor}),"text-halo-color":new ae(xt.paint_symbol["text-halo-color"]),"text-halo-width":new ae(xt.paint_symbol["text-halo-width"]),"text-halo-blur":new ae(xt.paint_symbol["text-halo-blur"]),"text-translate":new te(xt.paint_symbol["text-translate"]),"text-translate-anchor":new te(xt.paint_symbol["text-translate-anchor"])})},get layout(){return E_=E_||new Pr({"symbol-placement":new te(xt.layout_symbol["symbol-placement"]),"symbol-spacing":new te(xt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new te(xt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ae(xt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new te(xt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new te(xt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new te(xt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new te(xt.layout_symbol["icon-ignore-placement"]),"icon-optional":new te(xt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new te(xt.layout_symbol["icon-rotation-alignment"]),"icon-size":new ae(xt.layout_symbol["icon-size"]),"icon-text-fit":new te(xt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new te(xt.layout_symbol["icon-text-fit-padding"]),"icon-image":new ae(xt.layout_symbol["icon-image"]),"icon-rotate":new ae(xt.layout_symbol["icon-rotate"]),"icon-padding":new ae(xt.layout_symbol["icon-padding"]),"icon-keep-upright":new te(xt.layout_symbol["icon-keep-upright"]),"icon-offset":new ae(xt.layout_symbol["icon-offset"]),"icon-anchor":new ae(xt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new te(xt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new te(xt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new te(xt.layout_symbol["text-rotation-alignment"]),"text-field":new ae(xt.layout_symbol["text-field"]),"text-font":new ae(xt.layout_symbol["text-font"]),"text-size":new ae(xt.layout_symbol["text-size"]),"text-max-width":new ae(xt.layout_symbol["text-max-width"]),"text-line-height":new te(xt.layout_symbol["text-line-height"]),"text-letter-spacing":new ae(xt.layout_symbol["text-letter-spacing"]),"text-justify":new ae(xt.layout_symbol["text-justify"]),"text-radial-offset":new ae(xt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new te(xt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ae(xt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ae(xt.layout_symbol["text-anchor"]),"text-max-angle":new te(xt.layout_symbol["text-max-angle"]),"text-writing-mode":new te(xt.layout_symbol["text-writing-mode"]),"text-rotate":new ae(xt.layout_symbol["text-rotate"]),"text-padding":new te(xt.layout_symbol["text-padding"]),"text-keep-upright":new te(xt.layout_symbol["text-keep-upright"]),"text-transform":new ae(xt.layout_symbol["text-transform"]),"text-offset":new ae(xt.layout_symbol["text-offset"]),"text-allow-overlap":new te(xt.layout_symbol["text-allow-overlap"]),"text-overlap":new te(xt.layout_symbol["text-overlap"]),"text-ignore-placement":new te(xt.layout_symbol["text-ignore-placement"]),"text-optional":new te(xt.layout_symbol["text-optional"])})}};class C_{constructor(n){if(n.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=n.property.overrides?n.property.overrides.runtimeType:Qi,this.defaultValue=n}evaluate(n){if(n.formattedSection){const a=this.defaultValue.property.overrides;if(a&&a.hasOverride(n.formattedSection))return a.getOverride(n.formattedSection)}return n.feature&&n.featureState?this.defaultValue.evaluate(n.feature,n.featureState):this.defaultValue.property.specification.default}eachChild(n){this.defaultValue.isConstant()||n(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Kt("FormatSectionOverride",C_,{omit:["defaultValue"]});class Kd extends So{constructor(n){super(n,Sm)}recalculate(n,a){if(super.recalculate(n,a),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const h=this.layout.get("text-writing-mode");if(h){const g=[];for(const v of h)g.indexOf(v)<0&&g.push(v);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(n,a,h,g){const v=this.layout.get(n).evaluate(a,{},h,g),x=this._unevaluatedLayout._values[n];return x.isDataDriven()||In(x.value)||!v?v:function(b,E){return E.replace(/{([^{}]+)}/g,(T,A)=>b&&A in b?String(b[A]):"")}(a.properties,v)}createBucket(n){return new Tc(n)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const n of Sm.paint.overridableProperties){if(!Kd.hasPaintOverride(this.layout,n))continue;const a=this.paint.get(n),h=new C_(a),g=new An(h,a.property.specification);let v=null;v=a.value.kind==="constant"||a.value.kind==="source"?new Ku("source",g):new Eh("composite",g,a.value.zoomStops),this.paint._values[n]=new Eo(a.property,v,a.parameters)}}_handleOverridablePaintPropertyUpdate(n,a,h){return!(!this.layout||a.isDataDriven()||h.isDataDriven())&&Kd.hasPaintOverride(this.layout,n)}static hasPaintOverride(n,a){const h=n.get("text-field"),g=Sm.paint.properties[a];let v=!1;const x=b=>{for(const E of b)if(g.overrides&&g.overrides.hasOverride(E))return void(v=!0)};if(h.value.kind==="constant"&&h.value.value instanceof qr)x(h.value.value.sections);else if(h.value.kind==="source"){const b=T=>{v||(T instanceof Gs&&gi(T.value)===Ii?x(T.value.sections):T instanceof Xu?x(T.sections):T.eachChild(b))},E=h.value;E._styleExpression&&b(E._styleExpression.expression)}return v}}let T_;var Ix={get paint(){return T_=T_||new Pr({"background-color":new te(xt.paint_background["background-color"]),"background-pattern":new Yl(xt.paint_background["background-pattern"]),"background-opacity":new te(xt.paint_background["background-opacity"])})}};class Ex extends So{constructor(n){super(n,Ix)}}let L_;var Sx={get paint(){return L_=L_||new Pr({"raster-opacity":new te(xt.paint_raster["raster-opacity"]),"raster-hue-rotate":new te(xt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new te(xt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new te(xt.paint_raster["raster-brightness-max"]),"raster-saturation":new te(xt.paint_raster["raster-saturation"]),"raster-contrast":new te(xt.paint_raster["raster-contrast"]),"raster-resampling":new te(xt.paint_raster["raster-resampling"]),"raster-fade-duration":new te(xt.paint_raster["raster-fade-duration"])})}};class Cx extends So{constructor(n){super(n,Sx)}}class Tx extends So{constructor(n){super(n,{}),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=n}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Lx{constructor(n){this._methodToThrottle=n,this._triggered=!1,typeof MessageChannel<"u"&&(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 Cm=63710088e-1;class ul{constructor(n,a){if(isNaN(n)||isNaN(a))throw new Error(`Invalid LngLat object: (${n}, ${a})`);if(this.lng=+n,this.lat=+a,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ul(Be(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(n){const a=Math.PI/180,h=this.lat*a,g=n.lat*a,v=Math.sin(h)*Math.sin(g)+Math.cos(h)*Math.cos(g)*Math.cos((n.lng-this.lng)*a);return Cm*Math.acos(Math.min(v,1))}static convert(n){if(n instanceof ul)return n;if(Array.isArray(n)&&(n.length===2||n.length===3))return new ul(Number(n[0]),Number(n[1]));if(!Array.isArray(n)&&typeof n=="object"&&n!==null)return new ul(Number("lng"in n?n.lng:n.lon),Number(n.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 P_=2*Math.PI*Cm;function A_(o){return P_*Math.cos(o*Math.PI/180)}function M_(o){return(180+o)/360}function D_(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}function R_(o,n){return o/A_(n)}function Tm(o){return 360/Math.PI*Math.atan(Math.exp((180-360*o)*Math.PI/180))-90}class Jd{constructor(n,a,h=0){this.x=+n,this.y=+a,this.z=+h}static fromLngLat(n,a=0){const h=ul.convert(n);return new Jd(M_(h.lng),D_(h.lat),R_(a,h.lat))}toLngLat(){return new ul(360*this.x-180,Tm(this.y))}toAltitude(){return this.z*A_(Tm(this.y))}meterInMercatorCoordinateUnits(){return 1/P_*(n=Tm(this.y),1/Math.cos(n*Math.PI/180));var n}}function N_(o,n,a){var h=2*Math.PI*6378137/256/Math.pow(2,a);return[o*h-2*Math.PI*6378137/2,n*h-2*Math.PI*6378137/2]}class Lm{constructor(n,a,h){if(n<0||n>25||h<0||h>=Math.pow(2,n)||a<0||a>=Math.pow(2,n))throw new Error(`x=${a}, y=${h}, z=${n} outside of bounds. 0<=x<${Math.pow(2,n)}, 0<=y<${Math.pow(2,n)} 0<=z<=25 `);this.z=n,this.x=a,this.y=h,this.key=lp(0,n,n,a,h)}equals(n){return this.z===n.z&&this.x===n.x&&this.y===n.y}url(n,a,h){const g=(x=this.y,b=this.z,E=N_(256*(v=this.x),256*(x=Math.pow(2,b)-x-1),b),T=N_(256*(v+1),256*(x+1),b),E[0]+","+E[1]+","+T[0]+","+T[1]);var v,x,b,E,T;const A=function(M,O,B){let q,Z="";for(let Y=M;Y>0;Y--)q=1<1?"@2x":"").replace(/{quadkey}/g,A).replace(/{bbox-epsg-3857}/g,g)}isChildOf(n){const a=this.z-n.z;return a>0&&n.x===this.x>>a&&n.y===this.y>>a}getTilePoint(n){const a=Math.pow(2,this.z);return new k((n.x*a-this.x)*ii,(n.y*a-this.y)*ii)}toString(){return`${this.z}/${this.x}/${this.y}`}}class k_{constructor(n,a){this.wrap=n,this.canonical=a,this.key=lp(n,a.z,a.z,a.x,a.y)}}class To{constructor(n,a,h,g,v){if(n= z; overscaledZ = ${n}; z = ${h}`);this.overscaledZ=n,this.wrap=a,this.canonical=new Lm(h,+g,+v),this.key=lp(a,n,h,g,v)}clone(){return new To(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(n){return this.overscaledZ===n.overscaledZ&&this.wrap===n.wrap&&this.canonical.equals(n.canonical)}scaledTo(n){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-n;return n>this.canonical.z?new To(n,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new To(n,this.wrap,n,this.canonical.x>>a,this.canonical.y>>a)}calculateScaledKey(n,a){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-n;return n>this.canonical.z?lp(this.wrap*+a,n,this.canonical.z,this.canonical.x,this.canonical.y):lp(this.wrap*+a,n,n,this.canonical.x>>h,this.canonical.y>>h)}isChildOf(n){if(n.wrap!==this.wrap)return!1;const a=this.canonical.z-n.canonical.z;return n.overscaledZ===0||n.overscaledZ>a&&n.canonical.y===this.canonical.y>>a}children(n){if(this.overscaledZ>=n)return[new To(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const a=this.canonical.z+1,h=2*this.canonical.x,g=2*this.canonical.y;return[new To(a,this.wrap,a,h,g),new To(a,this.wrap,a,h+1,g),new To(a,this.wrap,a,h,g+1),new To(a,this.wrap,a,h+1,g+1)]}isLessThan(n){return this.wrapn.wrap)&&(this.overscaledZn.overscaledZ)&&(this.canonical.xn.canonical.x)&&this.canonical.ythis.max&&(this.max=M),M=this.dim+1||a<-1||a>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(a+1)*this.stride+(n+1)}unpack(n,a,h){return n*this.redFactor+a*this.greenFactor+h*this.blueFactor-this.baseShift}getPixels(){return new Co({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(n,a,h){if(this.dim!==n.dim)throw new Error("dem dimension mismatch");let g=a*this.dim,v=a*this.dim+this.dim,x=h*this.dim,b=h*this.dim+this.dim;switch(a){case-1:g=v-1;break;case 1:v=g+1}switch(h){case-1:x=b-1;break;case 1:b=x+1}const E=-a*this.dim,T=-h*this.dim;for(let A=x;A=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${n} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[n]}}class F_{constructor(n,a,h,g,v){this.type="Feature",this._vectorTileFeature=n,n._z=a,n._x=h,n._y=g,this.properties=n.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(n){this._geometry=n}toJSON(){const n={geometry:this.geometry};for(const a in this)a!=="_geometry"&&a!=="_vectorTileFeature"&&(n[a]=this[a]);return n}}class B_{constructor(n,a){this.tileID=n,this.x=n.canonical.x,this.y=n.canonical.y,this.z=n.canonical.z,this.grid=new Hl(ii,16,0),this.grid3D=new Hl(ii,16,0),this.featureIndexArray=new D,this.promoteId=a}insert(n,a,h,g,v,x){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(h,g,v);const E=x?this.grid3D:this.grid;for(let T=0;T=0&&M[3]>=0&&E.insert(b,M[0],M[1],M[2],M[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new sl.VectorTile(new gm(this.rawTileData)).layers,this.sourceLayerCoder=new O_(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(n,a,h,g){this.loadVTLayers();const v=n.params||{},x=ii/n.tileSize/n.scale,b=tc(v.filter),E=n.queryGeometry,T=n.queryPadding*x,A=U_(E),M=this.grid.query(A.minX-T,A.minY-T,A.maxX+T,A.maxY+T),O=U_(n.cameraQueryGeometry),B=this.grid3D.query(O.minX-T,O.minY-T,O.maxX+T,O.maxY+T,(Y,$,ut,tt)=>function(ot,Et,Tt,Xt,Qt){for(const Zt of ot)if(Et<=Zt.x&&Tt<=Zt.y&&Xt>=Zt.x&&Qt>=Zt.y)return!0;const Wt=[new k(Et,Tt),new k(Et,Qt),new k(Xt,Qt),new k(Xt,Tt)];if(ot.length>2){for(const Zt of Wt)if(xc(ot,Zt))return!0}for(let Zt=0;Zt(tt||(tt=Ia(ot)),Et.queryIntersectsFeature(E,ot,Tt,tt,this.z,n.transform,x,n.pixelPosMatrix)))}return q}loadMatchingFeature(n,a,h,g,v,x,b,E,T,A,M){const O=this.bucketLayerIDs[a];if(x&&!function(Y,$){for(let ut=0;ut=0)return!0;return!1}(x,O))return;const B=this.sourceLayerCoder.decode(h),q=this.vtLayers[B].feature(g);if(v.needGeometry){const Y=Ea(q,!0);if(!v.filter(new kn(this.tileID.overscaledZ),Y,this.tileID.canonical))return}else if(!v.filter(new kn(this.tileID.overscaledZ),q))return;const Z=this.getId(q,B);for(let Y=0;Y{const b=n instanceof Xl?n.get(x):null;return b&&b.evaluate?b.evaluate(a,h,g):b})}function U_(o){let n=1/0,a=1/0,h=-1/0,g=-1/0;for(const v of o)n=Math.min(n,v.x),a=Math.min(a,v.y),h=Math.max(h,v.x),g=Math.max(g,v.y);return{minX:n,minY:a,maxX:h,maxY:g}}function Px(o,n){return n-o}function q_(o,n,a,h,g){const v=[];for(let x=0;x=h&&M.x>=h||(A.x>=h?A=new k(h,A.y+(h-A.x)/(M.x-A.x)*(M.y-A.y))._round():M.x>=h&&(M=new k(h,A.y+(h-A.x)/(M.x-A.x)*(M.y-A.y))._round()),A.y>=g&&M.y>=g||(A.y>=g?A=new k(A.x+(g-A.y)/(M.y-A.y)*(M.x-A.x),g)._round():M.y>=g&&(M=new k(A.x+(g-A.y)/(M.y-A.y)*(M.x-A.x),g)._round()),E&&A.equals(E[E.length-1])||(E=[A],v.push(E)),E.push(M)))))}}return v}Kt("FeatureIndex",B_,{omit:["rawTileData","sourceLayerCoder"]});class cl extends k{constructor(n,a,h,g){super(n,a),this.angle=h,g!==void 0&&(this.segment=g)}clone(){return new cl(this.x,this.y,this.angle,this.segment)}}function G_(o,n,a,h,g){if(n.segment===void 0||a===0)return!0;let v=n,x=n.segment+1,b=0;for(;b>-a/2;){if(x--,x<0)return!1;b-=o[x].dist(v),v=o[x]}b+=o[x].dist(o[x+1]),x++;const E=[];let T=0;for(;bh;)T-=E.shift().angleDelta;if(T>g)return!1;x++,b+=A.dist(M)}return!0}function j_(o){let n=0;for(let a=0;aT){const q=(T-E)/B,Z=dr.number(M.x,O.x,q),Y=dr.number(M.y,O.y,q),$=new cl(Z,Y,O.angleTo(M),A);return $._round(),!x||G_(o,$,b,x,n)?$:void 0}E+=B}}function Mx(o,n,a,h,g,v,x,b,E){const T=Z_(h,v,x),A=H_(h,g),M=A*x,O=o[0].x===0||o[0].x===E||o[0].y===0||o[0].y===E;return n-M=0&&ot=0&&Et=0&&O+T<=A){const Tt=new cl(ot,Et,ut,q);Tt._round(),h&&!G_(o,Tt,v,h,g)||B.push(Tt)}}M+=$}return b||B.length||x||(B=W_(o,M/2,a,h,g,v,x,!0,E)),B}Kt("Anchor",cl);const Lc=Wr;function X_(o,n,a,h){const g=[],v=o.image,x=v.pixelRatio,b=v.paddedRect.w-2*Lc,E=v.paddedRect.h-2*Lc,T=o.right-o.left,A=o.bottom-o.top,M=v.stretchX||[[0,b]],O=v.stretchY||[[0,E]],B=(Ft,Jt)=>Ft+Jt[1]-Jt[0],q=M.reduce(B,0),Z=O.reduce(B,0),Y=b-q,$=E-Z;let ut=0,tt=q,ot=0,Et=Z,Tt=0,Xt=Y,Qt=0,Wt=$;if(v.content&&h){const Ft=v.content;ut=Qd(M,0,Ft[0]),ot=Qd(O,0,Ft[1]),tt=Qd(M,Ft[0],Ft[2]),Et=Qd(O,Ft[1],Ft[3]),Tt=Ft[0]-ut,Qt=Ft[1]-ot,Xt=Ft[2]-Ft[0]-tt,Wt=Ft[3]-Ft[1]-Et}const Zt=(Ft,Jt,Ut,Mt)=>{const oe=$d(Ft.stretch-ut,tt,T,o.left),$t=tf(Ft.fixed-Tt,Xt,Ft.stretch,q),Ne=$d(Jt.stretch-ot,Et,A,o.top),Mn=tf(Jt.fixed-Qt,Wt,Jt.stretch,Z),On=$d(Ut.stretch-ut,tt,T,o.left),Li=tf(Ut.fixed-Tt,Xt,Ut.stretch,q),co=$d(Mt.stretch-ot,Et,A,o.top),Mr=tf(Mt.fixed-Qt,Wt,Mt.stretch,Z),xi=new k(oe,Ne),Gi=new k(On,Ne),er=new k(On,co),Dr=new k(oe,co),Rr=new k($t/x,Mn/x),Pi=new k(Li/x,Mr/x),Ai=n*Math.PI/180;if(Ai){const gr=Math.sin(Ai),Xr=Math.cos(Ai),Yr=[Xr,-gr,gr,Xr];xi._matMult(Yr),Gi._matMult(Yr),Dr._matMult(Yr),er._matMult(Yr)}const mr=Ft.stretch+Ft.fixed,Nr=Jt.stretch+Jt.fixed;return{tl:xi,tr:Gi,bl:Dr,br:er,tex:{x:v.paddedRect.x+Lc+mr,y:v.paddedRect.y+Lc+Nr,w:Ut.stretch+Ut.fixed-mr,h:Mt.stretch+Mt.fixed-Nr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Rr,pixelOffsetBR:Pi,minFontScaleX:Xt/x/T,minFontScaleY:Wt/x/A,isSDF:a}};if(h&&(v.stretchX||v.stretchY)){const Ft=Y_(M,Y,q),Jt=Y_(O,$,Z);for(let Ut=0;Ut0&&(q=Math.max(10,q),this.circleDiameter=q)}else{let M=x.top*b-E[0],O=x.bottom*b+E[2],B=x.left*b-E[3],q=x.right*b+E[1];const Z=x.collisionPadding;if(Z&&(B-=Z[0]*b,M-=Z[1]*b,q+=Z[2]*b,O+=Z[3]*b),A){const Y=new k(B,M),$=new k(q,M),ut=new k(B,O),tt=new k(q,O),ot=A*Math.PI/180;Y._rotate(ot),$._rotate(ot),ut._rotate(ot),tt._rotate(ot),B=Math.min(Y.x,$.x,ut.x,tt.x),q=Math.max(Y.x,$.x,ut.x,tt.x),M=Math.min(Y.y,$.y,ut.y,tt.y),O=Math.max(Y.y,$.y,ut.y,tt.y)}n.emplaceBack(a.x,a.y,B,M,q,O,h,g,v)}this.boxEndIndex=n.length}}class Dx{constructor(n=[],a=Rx){if(this.data=n,this.length=this.data.length,this.compare=a,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(n){this.data.push(n),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const n=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:a,compare:h}=this,g=a[n];for(;n>0;){const v=n-1>>1,x=a[v];if(h(g,x)>=0)break;a[n]=x,n=v}a[n]=g}_down(n){const{data:a,compare:h}=this,g=this.length>>1,v=a[n];for(;n=0)break;a[n]=b,n=x}a[n]=v}}function Rx(o,n){return on?1:0}function Nx(o,n=1,a=!1){let h=1/0,g=1/0,v=-1/0,x=-1/0;const b=o[0];for(let B=0;Bv)&&(v=q.x),(!B||q.y>x)&&(x=q.y)}const E=Math.min(v-h,x-g);let T=E/2;const A=new Dx([],kx);if(E===0)return new k(h,g);for(let B=h;BM.d||!M.d)&&(M=B,a&&console.log("found best %d after %d probes",Math.round(1e4*B.d)/1e4,O)),B.max-M.d<=n||(T=B.h/2,A.push(new Pc(B.p.x-T,B.p.y-T,T,o)),A.push(new Pc(B.p.x+T,B.p.y-T,T,o)),A.push(new Pc(B.p.x-T,B.p.y+T,T,o)),A.push(new Pc(B.p.x+T,B.p.y+T,T,o)),O+=4)}return a&&(console.log(`num probes: ${O}`),console.log(`best distance: ${M.d}`)),M.p}function kx(o,n){return n.max-o.max}function Pc(o,n,a,h){this.p=new k(o,n),this.h=a,this.d=function(g,v){let x=!1,b=1/0;for(let E=0;Eg.y!=q.y>g.y&&g.x<(q.x-B.x)*(g.y-B.y)/(q.y-B.y)+B.x&&(x=!x),b=Math.min(b,Dg(g,B,q))}}return(x?1:-1)*Math.sqrt(b)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}var tr;m.ap=void 0,(tr=m.ap||(m.ap={}))[tr.center=1]="center",tr[tr.left=2]="left",tr[tr.right=3]="right",tr[tr.top=4]="top",tr[tr.bottom=5]="bottom",tr[tr["top-left"]=6]="top-left",tr[tr["top-right"]=7]="top-right",tr[tr["bottom-left"]=8]="bottom-left",tr[tr["bottom-right"]=9]="bottom-right";const hl=7,Pm=Number.POSITIVE_INFINITY;function K_(o,n){return n[1]!==Pm?function(a,h,g){let v=0,x=0;switch(h=Math.abs(h),g=Math.abs(g),a){case"top-right":case"top-left":case"top":x=g-hl;break;case"bottom-right":case"bottom-left":case"bottom":x=-g+hl}switch(a){case"top-right":case"bottom-right":case"right":v=-h;break;case"top-left":case"bottom-left":case"left":v=h}return[v,x]}(o,n[0],n[1]):function(a,h){let g=0,v=0;h<0&&(h=0);const x=h/Math.SQRT2;switch(a){case"top-right":case"top-left":v=x-hl;break;case"bottom-right":case"bottom-left":v=-x+hl;break;case"bottom":v=-h+hl;break;case"top":v=h-hl}switch(a){case"top-right":case"bottom-right":g=-x;break;case"top-left":case"bottom-left":g=x;break;case"left":g=h;break;case"right":g=-h}return[g,v]}(o,n[0])}function J_(o,n,a){var h;const g=o.layout,v=(h=g.get("text-variable-anchor-offset"))===null||h===void 0?void 0:h.evaluate(n,{},a);if(v){const b=v.values,E=[];for(let T=0;TO*Ti);A.startsWith("top")?M[1]-=hl:A.startsWith("bottom")&&(M[1]+=hl),E[T+1]=M}return new so(E)}const x=g.get("text-variable-anchor");if(x){let b;b=o._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[g.get("text-radial-offset").evaluate(n,{},a)*Ti,Pm]:g.get("text-offset").evaluate(n,{},a).map(T=>T*Ti);const E=[];for(const T of x)E.push(T,K_(T,b));return new so(E)}return null}function Am(o){switch(o){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function zx(o,n,a,h,g,v,x,b,E,T,A){let M=v.textMaxSize.evaluate(n,{});M===void 0&&(M=x);const O=o.layers[0].layout,B=O.get("icon-offset").evaluate(n,{},A),q=$_(a.horizontal),Z=x/24,Y=o.tilePixelRatio*Z,$=o.tilePixelRatio*M/24,ut=o.tilePixelRatio*b,tt=o.tilePixelRatio*O.get("symbol-spacing"),ot=O.get("text-padding")*o.tilePixelRatio,Et=function(Mt,oe,$t,Ne=1){const Mn=Mt.get("icon-padding").evaluate(oe,{},$t),On=Mn&&Mn.values;return[On[0]*Ne,On[1]*Ne,On[2]*Ne,On[3]*Ne]}(O,n,A,o.tilePixelRatio),Tt=O.get("text-max-angle")/180*Math.PI,Xt=O.get("text-rotation-alignment")!=="viewport"&&O.get("symbol-placement")!=="point",Qt=O.get("icon-rotation-alignment")==="map"&&O.get("symbol-placement")!=="point",Wt=O.get("symbol-placement"),Zt=tt/2,Ft=O.get("icon-text-fit");let Jt;h&&Ft!=="none"&&(o.allowVerticalPlacement&&a.vertical&&(Jt=w_(h,a.vertical,Ft,O.get("icon-text-fit-padding"),B,Z)),q&&(h=w_(h,q,Ft,O.get("icon-text-fit-padding"),B,Z)));const Ut=(Mt,oe)=>{oe.x<0||oe.x>=ii||oe.y<0||oe.y>=ii||function($t,Ne,Mn,On,Li,co,Mr,xi,Gi,er,Dr,Rr,Pi,Ai,mr,Nr,gr,Xr,Yr,Mi,Ve,_r,nr,Di,ts){const bs=$t.addToLineVertexArray(Ne,Mn);let ws,Ca,es,Lo,Kr=0,Ta=0,hp=0,iy=0,Fm=-1,Bm=-1;const La={};let ry=Kn("");if($t.allowVerticalPlacement&&On.vertical){const yr=xi.layout.get("text-rotate").evaluate(Ve,{},Di)+90;es=new ef(Gi,Ne,er,Dr,Rr,On.vertical,Pi,Ai,mr,yr),Mr&&(Lo=new ef(Gi,Ne,er,Dr,Rr,Mr,gr,Xr,mr,yr))}if(Li){const yr=xi.layout.get("icon-rotate").evaluate(Ve,{}),Po=xi.layout.get("icon-text-fit")!=="none",iu=X_(Li,yr,nr,Po),Es=Mr?X_(Mr,yr,nr,Po):void 0;Ca=new ef(Gi,Ne,er,Dr,Rr,Li,gr,Xr,!1,yr),Kr=4*iu.length;const ru=$t.iconSizeData;let $s=null;ru.kind==="source"?($s=[Qs*xi.layout.get("icon-size").evaluate(Ve,{})],$s[0]>ll&&Re(`${$t.layerIds[0]}: Value for "icon-size" is >= ${ap}. Reduce your "icon-size".`)):ru.kind==="composite"&&($s=[Qs*_r.compositeIconSizes[0].evaluate(Ve,{},Di),Qs*_r.compositeIconSizes[1].evaluate(Ve,{},Di)],($s[0]>ll||$s[1]>ll)&&Re(`${$t.layerIds[0]}: Value for "icon-size" is >= ${ap}. Reduce your "icon-size".`)),$t.addSymbols($t.icon,iu,$s,Mi,Yr,Ve,m.ah.none,Ne,bs.lineStartIndex,bs.lineLength,-1,Di),Fm=$t.icon.placedSymbolArray.length-1,Es&&(Ta=4*Es.length,$t.addSymbols($t.icon,Es,$s,Mi,Yr,Ve,m.ah.vertical,Ne,bs.lineStartIndex,bs.lineLength,-1,Di),Bm=$t.icon.placedSymbolArray.length-1)}const oy=Object.keys(On.horizontal);for(const yr of oy){const Po=On.horizontal[yr];if(!ws){ry=Kn(Po.text);const Es=xi.layout.get("text-rotate").evaluate(Ve,{},Di);ws=new ef(Gi,Ne,er,Dr,Rr,Po,Pi,Ai,mr,Es)}const iu=Po.positionedLines.length===1;if(hp+=Q_($t,Ne,Po,co,xi,mr,Ve,Nr,bs,On.vertical?m.ah.horizontal:m.ah.horizontalOnly,iu?oy:[yr],La,Fm,_r,Di),iu)break}On.vertical&&(iy+=Q_($t,Ne,On.vertical,co,xi,mr,Ve,Nr,bs,m.ah.vertical,["vertical"],La,Bm,_r,Di));const Bx=ws?ws.boxStartIndex:$t.collisionBoxArray.length,Vx=ws?ws.boxEndIndex:$t.collisionBoxArray.length,Ux=es?es.boxStartIndex:$t.collisionBoxArray.length,qx=es?es.boxEndIndex:$t.collisionBoxArray.length,Gx=Ca?Ca.boxStartIndex:$t.collisionBoxArray.length,jx=Ca?Ca.boxEndIndex:$t.collisionBoxArray.length,Zx=Lo?Lo.boxStartIndex:$t.collisionBoxArray.length,Hx=Lo?Lo.boxEndIndex:$t.collisionBoxArray.length;let Is=-1;const rf=(yr,Po)=>yr&&yr.circleDiameter?Math.max(yr.circleDiameter,Po):Po;Is=rf(ws,Is),Is=rf(es,Is),Is=rf(Ca,Is),Is=rf(Lo,Is);const sy=Is>-1?1:0;sy&&(Is*=ts/Ti),$t.glyphOffsetArray.length>=Tc.MAX_GLYPHS&&Re("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ve.sortKey!==void 0&&$t.addToSortKeyRanges($t.symbolInstances.length,Ve.sortKey);const Wx=J_(xi,Ve,Di),[Xx,Yx]=function(yr,Po){const iu=yr.length,Es=Po==null?void 0:Po.values;if((Es==null?void 0:Es.length)>0)for(let ru=0;ru=0?La.right:-1,La.center>=0?La.center:-1,La.left>=0?La.left:-1,La.vertical||-1,Fm,Bm,ry,Bx,Vx,Ux,qx,Gx,jx,Zx,Hx,er,hp,iy,Kr,Ta,sy,0,Pi,Is,Xx,Yx)}(o,oe,Mt,a,h,g,Jt,o.layers[0],o.collisionBoxArray,n.index,n.sourceLayerIndex,o.index,Y,[ot,ot,ot,ot],Xt,E,ut,Et,Qt,B,n,v,T,A,x)};if(Wt==="line")for(const Mt of q_(n.geometry,0,0,ii,ii)){const oe=Mx(Mt,tt,Tt,a.vertical||q,h,24,$,o.overscaling,ii);for(const $t of oe)q&&Ox(o,q.text,Zt,$t)||Ut(Mt,$t)}else if(Wt==="line-center"){for(const Mt of n.geometry)if(Mt.length>1){const oe=Ax(Mt,Tt,a.vertical||q,h,24,$);oe&&Ut(Mt,oe)}}else if(n.type==="Polygon")for(const Mt of lm(n.geometry,0)){const oe=Nx(Mt,16);Ut(Mt[0],new cl(oe.x,oe.y,0))}else if(n.type==="LineString")for(const Mt of n.geometry)Ut(Mt,new cl(Mt[0].x,Mt[0].y,0));else if(n.type==="Point")for(const Mt of n.geometry)for(const oe of Mt)Ut([oe],new cl(oe.x,oe.y,0))}function Q_(o,n,a,h,g,v,x,b,E,T,A,M,O,B,q){const Z=function(ut,tt,ot,Et,Tt,Xt,Qt,Wt){const Zt=Et.layout.get("text-rotate").evaluate(Xt,{})*Math.PI/180,Ft=[];for(const Jt of tt.positionedLines)for(const Ut of Jt.positionedGlyphs){if(!Ut.rect)continue;const Mt=Ut.rect||{};let oe=m_+1,$t=!0,Ne=1,Mn=0;const On=(Tt||Wt)&&Ut.vertical,Li=Ut.metrics.advance*Ut.scale/2;if(Wt&&tt.verticalizable&&(Mn=Jt.lineOffset/2-(Ut.imageName?-(Ti-Ut.metrics.width*Ut.scale)/2:(Ut.scale-1)*Ti)),Ut.imageName){const Mi=Qt[Ut.imageName];$t=Mi.sdf,Ne=Mi.pixelRatio,oe=Wr/Ne}const co=Tt?[Ut.x+Li,Ut.y]:[0,0];let Mr=Tt?[0,0]:[Ut.x+Li+ot[0],Ut.y+ot[1]-Mn],xi=[0,0];On&&(xi=Mr,Mr=[0,0]);const Gi=Ut.metrics.isDoubleResolution?2:1,er=(Ut.metrics.left-oe)*Ut.scale-Li+Mr[0],Dr=(-Ut.metrics.top-oe)*Ut.scale+Mr[1],Rr=er+Mt.w/Gi*Ut.scale/Ne,Pi=Dr+Mt.h/Gi*Ut.scale/Ne,Ai=new k(er,Dr),mr=new k(Rr,Dr),Nr=new k(er,Pi),gr=new k(Rr,Pi);if(On){const Mi=new k(-Li,Li-op),Ve=-Math.PI/2,_r=Ti/2-Li,nr=new k(5-op-_r,-(Ut.imageName?_r:0)),Di=new k(...xi);Ai._rotateAround(Ve,Mi)._add(nr)._add(Di),mr._rotateAround(Ve,Mi)._add(nr)._add(Di),Nr._rotateAround(Ve,Mi)._add(nr)._add(Di),gr._rotateAround(Ve,Mi)._add(nr)._add(Di)}if(Zt){const Mi=Math.sin(Zt),Ve=Math.cos(Zt),_r=[Ve,-Mi,Mi,Ve];Ai._matMult(_r),mr._matMult(_r),Nr._matMult(_r),gr._matMult(_r)}const Xr=new k(0,0),Yr=new k(0,0);Ft.push({tl:Ai,tr:mr,bl:Nr,br:gr,tex:Mt,writingMode:tt.writingMode,glyphOffset:co,sectionIndex:Ut.sectionIndex,isSDF:$t,pixelOffsetTL:Xr,pixelOffsetBR:Yr,minFontScaleX:0,minFontScaleY:0})}return Ft}(0,a,b,g,v,x,h,o.allowVerticalPlacement),Y=o.textSizeData;let $=null;Y.kind==="source"?($=[Qs*g.layout.get("text-size").evaluate(x,{})],$[0]>ll&&Re(`${o.layerIds[0]}: Value for "text-size" is >= ${ap}. Reduce your "text-size".`)):Y.kind==="composite"&&($=[Qs*B.compositeTextSizes[0].evaluate(x,{},q),Qs*B.compositeTextSizes[1].evaluate(x,{},q)],($[0]>ll||$[1]>ll)&&Re(`${o.layerIds[0]}: Value for "text-size" is >= ${ap}. Reduce your "text-size".`)),o.addSymbols(o.text,Z,$,b,v,x,T,n,E.lineStartIndex,E.lineLength,O,q);for(const ut of A)M[ut]=o.text.placedSymbolArray.length-1;return 4*Z.length}function $_(o){for(const n in o)return o[n];return null}function Ox(o,n,a,h){const g=o.compareText;if(n in g){const v=g[n];for(let x=v.length-1;x>=0;x--)if(h.dist(v[x])>4;if(g!==1)throw new Error(`Got v${g} data when expected v1.`);const v=ty[15&h];if(!v)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(n,2,1),[b]=new Uint32Array(n,4,1);return new Mm(b,x,v,n)}constructor(n,a=64,h=Float64Array,g){if(isNaN(n)||n<0)throw new Error(`Unpexpected numItems value: ${n}.`);this.numItems=+n,this.nodeSize=Math.min(Math.max(+a,2),65535),this.ArrayType=h,this.IndexArrayType=n<65536?Uint16Array:Uint32Array;const v=ty.indexOf(this.ArrayType),x=2*n*this.ArrayType.BYTES_PER_ELEMENT,b=n*this.IndexArrayType.BYTES_PER_ELEMENT,E=(8-b%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${h}.`);g&&g instanceof ArrayBuffer?(this.data=g,this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+E,2*n),this._pos=2*n,this._finished=!0):(this.data=new ArrayBuffer(8+x+b+E),this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+E,2*n),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=a,new Uint32Array(this.data,4,1)[0]=n)}add(n,a){const h=this._pos>>1;return this.ids[h]=h,this.coords[this._pos++]=n,this.coords[this._pos++]=a,h}finish(){const n=this._pos>>1;if(n!==this.numItems)throw new Error(`Added ${n} items when expected ${this.numItems}.`);return Dm(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(n,a,h,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:x,nodeSize:b}=this,E=[0,v.length-1,0],T=[];for(;E.length;){const A=E.pop()||0,M=E.pop()||0,O=E.pop()||0;if(M-O<=b){for(let Y=O;Y<=M;Y++){const $=x[2*Y],ut=x[2*Y+1];$>=n&&$<=h&&ut>=a&&ut<=g&&T.push(v[Y])}continue}const B=O+M>>1,q=x[2*B],Z=x[2*B+1];q>=n&&q<=h&&Z>=a&&Z<=g&&T.push(v[B]),(A===0?n<=q:a<=Z)&&(E.push(O),E.push(B-1),E.push(1-A)),(A===0?h>=q:g>=Z)&&(E.push(B+1),E.push(M),E.push(1-A))}return T}within(n,a,h){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:v,nodeSize:x}=this,b=[0,g.length-1,0],E=[],T=h*h;for(;b.length;){const A=b.pop()||0,M=b.pop()||0,O=b.pop()||0;if(M-O<=x){for(let Y=O;Y<=M;Y++)ny(v[2*Y],v[2*Y+1],n,a)<=T&&E.push(g[Y]);continue}const B=O+M>>1,q=v[2*B],Z=v[2*B+1];ny(q,Z,n,a)<=T&&E.push(g[B]),(A===0?n-h<=q:a-h<=Z)&&(b.push(O),b.push(B-1),b.push(1-A)),(A===0?n+h>=q:a+h>=Z)&&(b.push(B+1),b.push(M),b.push(1-A))}return E}}function Dm(o,n,a,h,g,v){if(g-h<=a)return;const x=h+g>>1;ey(o,n,x,h,g,v),Dm(o,n,a,h,x-1,1-v),Dm(o,n,a,x+1,g,1-v)}function ey(o,n,a,h,g,v){for(;g>h;){if(g-h>600){const T=g-h+1,A=a-h+1,M=Math.log(T),O=.5*Math.exp(2*M/3),B=.5*Math.sqrt(M*O*(T-O)/T)*(A-T/2<0?-1:1);ey(o,n,a,Math.max(h,Math.floor(a-A*O/T+B)),Math.min(g,Math.floor(a+(T-A)*O/T+B)),v)}const x=n[2*a+v];let b=h,E=g;for(up(o,n,h,a),n[2*g+v]>x&&up(o,n,h,g);bx;)E--}n[2*h+v]===x?up(o,n,h,E):(E++,up(o,n,E,g)),E<=a&&(h=E+1),a<=E&&(g=E-1)}}function up(o,n,a,h){Rm(o,a,h),Rm(n,2*a,2*h),Rm(n,2*a+1,2*h+1)}function Rm(o,n,a){const h=o[n];o[n]=o[a],o[a]=h}function ny(o,n,a,h){const g=o-a,v=n-h;return g*g+v*v}var Nm;m.bd=void 0,(Nm=m.bd||(m.bd={})).create="create",Nm.load="load",Nm.fullLoad="fullLoad";let nf=null,cp=[];const km=1e3/60,zm="loadTime",Om="fullLoadTime",Fx={mark(o){performance.mark(o)},frame(o){const n=o;nf!=null&&cp.push(n-nf),nf=n},clearMetrics(){nf=null,cp=[],performance.clearMeasures(zm),performance.clearMeasures(Om);for(const o in m.bd)performance.clearMarks(m.bd[o])},getPerformanceMetrics(){performance.measure(zm,m.bd.create,m.bd.load),performance.measure(Om,m.bd.create,m.bd.fullLoad);const o=performance.getEntriesByName(zm)[0].duration,n=performance.getEntriesByName(Om)[0].duration,a=cp.length,h=1/(cp.reduce((v,x)=>v+x,0)/a/1e3),g=cp.filter(v=>v>km).reduce((v,x)=>v+(x-km)/km,0);return{loadTime:o,fullLoadTime:n,fps:h,percentDroppedFrames:g/(a+g)*100,totalFrames:a}}};m.$=Bt,m.A=bc,m.B=function(o){if(ce==null){const n=o.navigator?o.navigator.userAgent:null;ce=!!o.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return ce},m.C=class{constructor(o,n){this.target=o,this.mapId=n,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Lx(()=>this.process()),this.subscription=function(a,h,g,v){return a.addEventListener(h,g,!1),{unsubscribe:()=>{a.removeEventListener(h,g,!1)}}}(this.target,"message",a=>this.receive(a)),this.globalScope=mn(self)?o:window}registerMessageHandler(o,n){this.messageHandlers[o]=n}sendAsync(o,n){return new Promise((a,h)=>{const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[g]={resolve:a,reject:h},n&&n.signal.addEventListener("abort",()=>{delete this.resolveRejects[g];const b={id:g,type:"",origin:location.origin,targetMapId:o.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)},{once:!0});const v=[],x=Object.assign(Object.assign({},o),{id:g,sourceMapId:this.mapId,origin:location.origin,data:nl(o.data,v)});this.target.postMessage(x,{transfer:v})})}receive(o){const n=o.data,a=n.id;if(!(n.origin!=="file://"&&location.origin!=="file://"&&n.origin!==location.origin||n.targetMapId&&this.mapId!==n.targetMapId)){if(n.type===""){delete this.tasks[a];const h=this.abortControllers[a];return delete this.abortControllers[a],void(h&&h.abort())}if(mn(self)||n.mustQueue)return this.tasks[a]=n,this.taskQueue.push(a),void this.invoker.trigger();this.processTask(a,n)}}process(){if(this.taskQueue.length===0)return;const o=this.taskQueue.shift(),n=this.tasks[o];delete this.tasks[o],this.taskQueue.length>0&&this.invoker.trigger(),n&&this.processTask(o,n)}processTask(o,n){return c(this,void 0,void 0,function*(){if(n.type===""){const g=this.resolveRejects[o];return delete this.resolveRejects[o],g?void(n.error?g.reject(il(n.error)):g.resolve(il(n.data))):void 0}if(!this.messageHandlers[n.type])return void this.completeTask(o,new Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const a=il(n.data),h=new AbortController;this.abortControllers[o]=h;try{const g=yield this.messageHandlers[n.type](n.sourceMapId,a,h);this.completeTask(o,null,g)}catch(g){this.completeTask(o,g)}})}completeTask(o,n,a){const h=[];delete this.abortControllers[o];const g={id:o,type:"",sourceMapId:this.mapId,origin:location.origin,error:n?nl(n):null,data:nl(a,h)};this.target.postMessage(g,{transfer:h})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},m.D=te,m.E=Pn,m.F=function(){var o=new bc(16);return bc!=Float32Array&&(o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[11]=0,o[12]=0,o[13]=0,o[14]=0),o[0]=1,o[5]=1,o[10]=1,o[15]=1,o},m.G=wn,m.H=function(o,n,a){var h,g,v,x,b,E,T,A,M,O,B,q,Z=a[0],Y=a[1],$=a[2];return n===o?(o[12]=n[0]*Z+n[4]*Y+n[8]*$+n[12],o[13]=n[1]*Z+n[5]*Y+n[9]*$+n[13],o[14]=n[2]*Z+n[6]*Y+n[10]*$+n[14],o[15]=n[3]*Z+n[7]*Y+n[11]*$+n[15]):(g=n[1],v=n[2],x=n[3],b=n[4],E=n[5],T=n[6],A=n[7],M=n[8],O=n[9],B=n[10],q=n[11],o[0]=h=n[0],o[1]=g,o[2]=v,o[3]=x,o[4]=b,o[5]=E,o[6]=T,o[7]=A,o[8]=M,o[9]=O,o[10]=B,o[11]=q,o[12]=h*Z+b*Y+M*$+n[12],o[13]=g*Z+E*Y+O*$+n[13],o[14]=v*Z+T*Y+B*$+n[14],o[15]=x*Z+A*Y+q*$+n[15]),o},m.I=ym,m.J=function(o,n,a){var h=a[0],g=a[1],v=a[2];return o[0]=n[0]*h,o[1]=n[1]*h,o[2]=n[2]*h,o[3]=n[3]*h,o[4]=n[4]*g,o[5]=n[5]*g,o[6]=n[6]*g,o[7]=n[7]*g,o[8]=n[8]*v,o[9]=n[9]*v,o[10]=n[10]*v,o[11]=n[11]*v,o[12]=n[12],o[13]=n[13],o[14]=n[14],o[15]=n[15],o},m.K=zg,m.L=function(o,n){const a={};for(let h=0;h{const n=window.document.createElement("video");return n.muted=!0,new Promise(a=>{n.onloadstart=()=>{a(n)};for(const h of o){const g=window.document.createElement("source");ai(h)||(n.crossOrigin="Anonymous"),g.src=h,n.appendChild(g)}})},m.a3=function(){return Pe++},m.a4=_,m.a5=Tc,m.a6=tc,m.a7=Ea,m.a8=kn,m.a9=F_,m.aA=Nt,m.aB=function(o,n){if(!o)return[{command:"setStyle",args:[n]}];let a=[];try{if(!Oe(o.version,n.version))return[{command:"setStyle",args:[n]}];Oe(o.center,n.center)||a.push({command:"setCenter",args:[n.center]}),Oe(o.zoom,n.zoom)||a.push({command:"setZoom",args:[n.zoom]}),Oe(o.bearing,n.bearing)||a.push({command:"setBearing",args:[n.bearing]}),Oe(o.pitch,n.pitch)||a.push({command:"setPitch",args:[n.pitch]}),Oe(o.sprite,n.sprite)||a.push({command:"setSprite",args:[n.sprite]}),Oe(o.glyphs,n.glyphs)||a.push({command:"setGlyphs",args:[n.glyphs]}),Oe(o.transition,n.transition)||a.push({command:"setTransition",args:[n.transition]}),Oe(o.light,n.light)||a.push({command:"setLight",args:[n.light]}),Oe(o.terrain,n.terrain)||a.push({command:"setTerrain",args:[n.terrain]}),Oe(o.sky,n.sky)||a.push({command:"setSky",args:[n.sky]});const h={},g=[];(function(x,b,E,T){let A;for(A in b=b||{},x=x||{})Object.prototype.hasOwnProperty.call(x,A)&&(Object.prototype.hasOwnProperty.call(b,A)||ja(A,E,T));for(A in b)Object.prototype.hasOwnProperty.call(b,A)&&(Object.prototype.hasOwnProperty.call(x,A)?Oe(x[A],b[A])||(x[A].type==="geojson"&&b[A].type==="geojson"&&Ha(x,b,A)?wi(E,{command:"setGeoJSONSourceData",args:[A,b[A].data]}):Za(A,b,E,T)):Ga(A,b,E))})(o.sources,n.sources,g,h);const v=[];o.layers&&o.layers.forEach(x=>{"source"in x&&h[x.source]?a.push({command:"removeLayer",args:[x.id]}):v.push(x)}),a=a.concat(g),function(x,b,E){b=b||[];const T=(x=x||[]).map(Du),A=b.map(Du),M=x.reduce(da,{}),O=b.reduce(da,{}),B=T.slice(),q=Object.create(null);let Z,Y,$,ut,tt;for(let ot=0,Et=0;ot@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,h,g,v)=>{const x=g||v;return n[h]=!x||x.toLowerCase(),""}),n["max-age"]){const a=parseInt(n["max-age"],10);isNaN(a)?delete n["max-age"]:n["max-age"]=a}return n},m.ab=function(o,n){const a=[];for(const h in o)h in n||a.push(h);return a},m.ac=pe,m.ad=function(o,n,a){var h=Math.sin(a),g=Math.cos(a),v=n[0],x=n[1],b=n[2],E=n[3],T=n[4],A=n[5],M=n[6],O=n[7];return n!==o&&(o[8]=n[8],o[9]=n[9],o[10]=n[10],o[11]=n[11],o[12]=n[12],o[13]=n[13],o[14]=n[14],o[15]=n[15]),o[0]=v*g+T*h,o[1]=x*g+A*h,o[2]=b*g+M*h,o[3]=E*g+O*h,o[4]=T*g-v*h,o[5]=A*g-x*h,o[6]=M*g-b*h,o[7]=O*g-E*h,o},m.ae=function(o){var n=new bc(16);return n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=o[3],n[4]=o[4],n[5]=o[5],n[6]=o[6],n[7]=o[7],n[8]=o[8],n[9]=o[9],n[10]=o[10],n[11]=o[11],n[12]=o[12],n[13]=o[13],n[14]=o[14],n[15]=o[15],n},m.af=Vd,m.ag=function(o,n){let a=0,h=0;if(o.kind==="constant")h=o.layoutSize;else if(o.kind!=="source"){const{interpolationType:g,minZoom:v,maxZoom:x}=o,b=g?pe($i.interpolationFactor(g,n,v,x),0,1):0;o.kind==="camera"?h=dr.number(o.minSize,o.maxSize,b):a=b}return{uSizeT:a,uSize:h}},m.ai=function(o,{uSize:n,uSizeT:a},{lowerSize:h,upperSize:g}){return o.kind==="source"?h/Qs:o.kind==="composite"?dr.number(h/Qs,g/Qs,a):n},m.aj=wm,m.ak=function(o,n,a,h){const g=n.y-o.y,v=n.x-o.x,x=h.y-a.y,b=h.x-a.x,E=x*v-b*g;if(E===0)return null;const T=(b*(o.y-a.y)-x*(o.x-a.x))/E;return new k(o.x+T*v,o.y+T*g)},m.al=q_,m.am=Zh,m.an=em,m.ao=Ti,m.aq=bm,m.ar=function(o,n){var a=n[0],h=n[1],g=n[2],v=n[3],x=n[4],b=n[5],E=n[6],T=n[7],A=n[8],M=n[9],O=n[10],B=n[11],q=n[12],Z=n[13],Y=n[14],$=n[15],ut=a*b-h*x,tt=a*E-g*x,ot=a*T-v*x,Et=h*E-g*b,Tt=h*T-v*b,Xt=g*T-v*E,Qt=A*Z-M*q,Wt=A*Y-O*q,Zt=A*$-B*q,Ft=M*Y-O*Z,Jt=M*$-B*Z,Ut=O*$-B*Y,Mt=ut*Ut-tt*Jt+ot*Ft+Et*Zt-Tt*Wt+Xt*Qt;return Mt?(o[0]=(b*Ut-E*Jt+T*Ft)*(Mt=1/Mt),o[1]=(g*Jt-h*Ut-v*Ft)*Mt,o[2]=(Z*Xt-Y*Tt+$*Et)*Mt,o[3]=(O*Tt-M*Xt-B*Et)*Mt,o[4]=(E*Zt-x*Ut-T*Wt)*Mt,o[5]=(a*Ut-g*Zt+v*Wt)*Mt,o[6]=(Y*ot-q*Xt-$*tt)*Mt,o[7]=(A*Xt-O*ot+B*tt)*Mt,o[8]=(x*Jt-b*Zt+T*Qt)*Mt,o[9]=(h*Zt-a*Jt-v*Qt)*Mt,o[10]=(q*Tt-Z*ot+$*ut)*Mt,o[11]=(M*ot-A*Tt-B*ut)*Mt,o[12]=(b*Wt-x*Ft-E*Qt)*Mt,o[13]=(a*Ft-h*Wt+g*Qt)*Mt,o[14]=(Z*tt-q*Et-Y*ut)*Mt,o[15]=(A*Et-M*tt+O*ut)*Mt,o):null},m.as=Am,m.at=xm,m.au=Mm,m.av=function(){const o={},n=xt.$version;for(const a in xt.$root){const h=xt.$root[a];if(h.required){let g=null;g=a==="version"?n:h.type==="array"?[]:{},g!=null&&(o[a]=g)}}return o},m.aw=Cd,m.ax=Ji,m.ay=function(o){o=o.slice();const n=Object.create(null);for(let a=0;aMt*Ti)}let Wt=x?"center":a.get("text-justify").evaluate(T,{},o.canonical);const Zt=a.get("symbol-placement"),Ft=Zt==="point"?a.get("text-max-width").evaluate(T,{},o.canonical)*Ti:0,Jt=()=>{o.bucket.allowVerticalPlacement&&rl(ot)&&(q.vertical=Wd(Z,o.glyphMap,o.glyphPositions,o.imagePositions,A,Ft,v,Xt,"left",Tt,$,m.ah.vertical,!0,Zt,O,M))};if(!x&&Qt){const Ut=new Set;if(Wt==="auto")for(let oe=0;oec(void 0,void 0,void 0,function*(){if(o.byteLength===0)return createImageBitmap(new ImageData(1,1));const n=new Blob([new Uint8Array(o)],{type:"image/png"});try{return createImageBitmap(n)}catch(a){throw new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),m.e=ue,m.f=o=>new Promise((n,a)=>{const h=new Image;h.onload=()=>{n(h),URL.revokeObjectURL(h.src),h.onload=null,window.requestAnimationFrame(()=>{h.src=Rn})},h.onerror=()=>a(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 g=new Blob([new Uint8Array(o)],{type:"image/png"});h.src=o.byteLength?URL.createObjectURL(g):Rn}),m.g=ln,m.h=(o,n)=>ni(ue(o,{type:"json"}),n),m.i=mn,m.j=ze,m.k=_t,m.l=(o,n)=>ni(ue(o,{type:"arrayBuffer"}),n),m.m=ni,m.n=function(o){return new gm(o).readFields(dx,[])},m.o=Jh,m.p=g_,m.q=Pr,m.r=Jf,m.s=ai,m.t=el,m.u=Ht,m.v=xt,m.w=Re,m.x=xa,m.y=function([o,n,a]){return n+=90,n*=Math.PI/180,a*=Math.PI/180,{x:o*Math.cos(n)*Math.sin(a),y:o*Math.sin(n)*Math.sin(a),z:o*Math.cos(a)}},m.z=dr}),l("worker",["./shared"],function(m){class c{constructor(z){this.keyCache={},z&&this.replace(z)}replace(z){this._layerConfigs={},this._layers={},this.update(z,[])}update(z,F){for(const H of z){this._layerConfigs[H.id]=H;const it=this._layers[H.id]=m.az(H);it._featureFilter=m.a6(it.filter),this.keyCache[H.id]&&delete this.keyCache[H.id]}for(const H of F)delete this.keyCache[H],delete this._layerConfigs[H],delete this._layers[H];this.familiesBySource={};const G=m.bh(Object.values(this._layerConfigs),this.keyCache);for(const H of G){const it=H.map(St=>this._layers[St.id]),rt=it[0];if(rt.visibility==="none")continue;const lt=rt.source||"";let et=this.familiesBySource[lt];et||(et=this.familiesBySource[lt]={});const pt=rt.sourceLayer||"_geojsonTileLayer";let Lt=et[pt];Lt||(Lt=et[pt]=[]),Lt.push(it)}}}class S{constructor(z){const F={},G=[];for(const lt in z){const et=z[lt],pt=F[lt]={};for(const Lt in et){const St=et[+Lt];if(!St||St.bitmap.width===0||St.bitmap.height===0)continue;const Ct={x:0,y:0,w:St.bitmap.width+2,h:St.bitmap.height+2};G.push(Ct),pt[Lt]={rect:Ct,metrics:St.metrics}}}const{w:H,h:it}=m.p(G),rt=new m.o({width:H||1,height:it||1});for(const lt in z){const et=z[lt];for(const pt in et){const Lt=et[+pt];if(!Lt||Lt.bitmap.width===0||Lt.bitmap.height===0)continue;const St=F[lt][pt].rect;m.o.copy(Lt.bitmap,rt,{x:0,y:0},{x:St.x+1,y:St.y+1},Lt.bitmap)}}this.image=rt,this.positions=F}}m.bi("GlyphAtlas",S);class L{constructor(z){this.tileID=new m.Q(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId,this.inFlightDependencies=[]}parse(z,F,G,H){return m._(this,void 0,void 0,function*(){this.status="parsing",this.data=z,this.collisionBoxArray=new m.a4;const it=new m.bj(Object.keys(z.layers).sort()),rt=new m.bk(this.tileID,this.promoteId);rt.bucketLayerIDs=[];const lt={},et={featureIndex:rt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G},pt=F.familiesBySource[this.source];for(const Te in pt){const Wn=z.layers[Te];if(!Wn)continue;Wn.version===1&&m.w(`Vector tile source "${this.source}" layer "${Te}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ei=it.encode(Te),pr=[];for(let Cr=0;Cr=zi.maxzoom||zi.visibility!=="none"&&(R(Cr,this.zoom,G),(lt[zi.id]=zi.createBucket({index:rt.bucketLayerIDs.length,layers:Cr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ei,sourceID:this.source})).populate(pr,et,this.tileID.canonical),rt.bucketLayerIDs.push(Cr.map(Wo=>Wo.id)))}}const Lt=m.aE(et.glyphDependencies,Te=>Object.keys(Te).map(Number));this.inFlightDependencies.forEach(Te=>Te==null?void 0:Te.abort()),this.inFlightDependencies=[];let St=Promise.resolve({});if(Object.keys(Lt).length){const Te=new AbortController;this.inFlightDependencies.push(Te),St=H.sendAsync({type:"GG",data:{stacks:Lt,source:this.source,tileID:this.tileID,type:"glyphs"}},Te)}const Ct=Object.keys(et.iconDependencies);let ee=Promise.resolve({});if(Ct.length){const Te=new AbortController;this.inFlightDependencies.push(Te),ee=H.sendAsync({type:"GI",data:{icons:Ct,source:this.source,tileID:this.tileID,type:"icons"}},Te)}const se=Object.keys(et.patternDependencies);let we=Promise.resolve({});if(se.length){const Te=new AbortController;this.inFlightDependencies.push(Te),we=H.sendAsync({type:"GI",data:{icons:se,source:this.source,tileID:this.tileID,type:"patterns"}},Te)}const[_e,qe,gn]=yield Promise.all([St,ee,we]),Nn=new S(_e),mi=new m.bl(qe,gn);for(const Te in lt){const Wn=lt[Te];Wn instanceof m.a5?(R(Wn.layers,this.zoom,G),m.bm({bucket:Wn,glyphMap:_e,glyphPositions:Nn.positions,imageMap:qe,imagePositions:mi.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Wn.hasPattern&&(Wn instanceof m.bn||Wn instanceof m.bo||Wn instanceof m.bp)&&(R(Wn.layers,this.zoom,G),Wn.addFeatures(et,this.tileID.canonical,mi.patternPositions))}return this.status="done",{buckets:Object.values(lt).filter(Te=>!Te.isEmpty()),featureIndex:rt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Nn.image,imageAtlas:mi,glyphMap:this.returnDependencies?_e:null,iconMap:this.returnDependencies?qe:null,glyphPositions:this.returnDependencies?Nn.positions:null}})}}function R(K,z,F){const G=new m.a8(z);for(const H of K)H.recalculate(G,F)}class k{constructor(z,F,G){this.actor=z,this.layerIndex=F,this.availableImages=G,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(z,F){return m._(this,void 0,void 0,function*(){const G=yield m.l(z.request,F);try{return{vectorTile:new m.bq.VectorTile(new m.br(G.data)),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(H){const it=new Uint8Array(G.data);let rt=`Unable to parse the tile at ${z.request.url}, `;throw rt+=it[0]===31&&it[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${H.messge}`,new Error(rt)}})}loadTile(z){return m._(this,void 0,void 0,function*(){const F=z.uid,G=!!(z&&z.request&&z.request.collectResourceTiming)&&new m.bs(z.request),H=new L(z);this.loading[F]=H;const it=new AbortController;H.abort=it;try{const rt=yield this.loadVectorTile(z,it);if(delete this.loading[F],!rt)return null;const lt=rt.rawData,et={};rt.expires&&(et.expires=rt.expires),rt.cacheControl&&(et.cacheControl=rt.cacheControl);const pt={};if(G){const St=G.finish();St&&(pt.resourceTiming=JSON.parse(JSON.stringify(St)))}H.vectorTile=rt.vectorTile;const Lt=H.parse(rt.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[F]=H,this.fetching[F]={rawTileData:lt,cacheControl:et,resourceTiming:pt};try{const St=yield Lt;return m.e({rawTileData:lt.slice(0)},St,et,pt)}finally{delete this.fetching[F]}}catch(rt){throw delete this.loading[F],H.status="done",this.loaded[F]=H,rt}})}reloadTile(z){return m._(this,void 0,void 0,function*(){const F=z.uid;if(!this.loaded||!this.loaded[F])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[F];if(G.showCollisionBoxes=z.showCollisionBoxes,G.status==="parsing"){const H=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor);let it;if(this.fetching[F]){const{rawTileData:rt,cacheControl:lt,resourceTiming:et}=this.fetching[F];delete this.fetching[F],it=m.e({rawTileData:rt.slice(0)},H,lt,et)}else it=H;return it}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(z){return m._(this,void 0,void 0,function*(){const F=this.loading,G=z.uid;F&&F[G]&&F[G].abort&&(F[G].abort.abort(),delete F[G])})}removeTile(z){return m._(this,void 0,void 0,function*(){this.loaded&&this.loaded[z.uid]&&delete this.loaded[z.uid]})}}class U{constructor(){this.loaded={}}loadTile(z){return m._(this,void 0,void 0,function*(){const{uid:F,encoding:G,rawImageData:H,redFactor:it,greenFactor:rt,blueFactor:lt,baseShift:et}=z,pt=H.width+2,Lt=H.height+2,St=m.b(H)?new m.R({width:pt,height:Lt},yield m.bt(H,-1,-1,pt,Lt)):H,Ct=new m.bu(F,St,G,it,rt,lt,et);return this.loaded=this.loaded||{},this.loaded[F]=Ct,Ct})}removeTile(z){const F=this.loaded,G=z.uid;F&&F[G]&&delete F[G]}}function ct(K,z){if(K.length!==0){dt(K[0],z);for(var F=1;F=Math.abs(lt)?F-et+lt:lt-et+F,F=et}F+G>=0!=!!z&&K.reverse()}var bt=m.bv(function K(z,F){var G,H=z&&z.type;if(H==="FeatureCollection")for(G=0;G>31}function He(K,z){for(var F=K.loadGeometry(),G=K.type,H=0,it=0,rt=F.length,lt=0;ltK},Rn=Math.fround||(Tn=new Float32Array(1),K=>(Tn[0]=+K,Tn[0]));var Tn;const hn=3,Me=5,nn=6;class Ln{constructor(z){this.options=Object.assign(Object.create(en),z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(z){const{log:F,minZoom:G,maxZoom:H}=this.options;F&&console.time("total time");const it=`prepare ${z.length} points`;F&&console.time(it),this.points=z;const rt=[];for(let et=0;et=G;et--){const pt=+Date.now();lt=this.trees[et]=this._createTree(this._cluster(lt,et)),F&&console.log("z%d: %d clusters in %dms",et,lt.numItems,+Date.now()-pt)}return F&&console.timeEnd("total time"),this}getClusters(z,F){let G=((z[0]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,z[1]));let it=z[2]===180?180:((z[2]+180)%360+360)%360-180;const rt=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)G=-180,it=180;else if(G>it){const St=this.getClusters([G,H,180,rt],F),Ct=this.getClusters([-180,H,it,rt],F);return St.concat(Ct)}const lt=this.trees[this._limitZoom(F)],et=lt.range(wn(G),Vn(rt),wn(it),Vn(H)),pt=lt.data,Lt=[];for(const St of et){const Ct=this.stride*St;Lt.push(pt[Ct+Me]>1?an(pt,Ct,this.clusterProps):this.points[pt[Ct+hn]])}return Lt}getChildren(z){const F=this._getOriginId(z),G=this._getOriginZoom(z),H="No cluster with the specified id.",it=this.trees[G];if(!it)throw new Error(H);const rt=it.data;if(F*this.stride>=rt.length)throw new Error(H);const lt=this.options.radius/(this.options.extent*Math.pow(2,G-1)),et=it.within(rt[F*this.stride],rt[F*this.stride+1],lt),pt=[];for(const Lt of et){const St=Lt*this.stride;rt[St+4]===z&&pt.push(rt[St+Me]>1?an(rt,St,this.clusterProps):this.points[rt[St+hn]])}if(pt.length===0)throw new Error(H);return pt}getLeaves(z,F,G){const H=[];return this._appendLeaves(H,z,F=F||10,G=G||0,0),H}getTile(z,F,G){const H=this.trees[this._limitZoom(z)],it=Math.pow(2,z),{extent:rt,radius:lt}=this.options,et=lt/rt,pt=(G-et)/it,Lt=(G+1+et)/it,St={features:[]};return this._addTileFeatures(H.range((F-et)/it,pt,(F+1+et)/it,Lt),H.data,F,G,it,St),F===0&&this._addTileFeatures(H.range(1-et/it,pt,1,Lt),H.data,it,G,it,St),F===it-1&&this._addTileFeatures(H.range(0,pt,et/it,Lt),H.data,-1,G,it,St),St.features.length?St:null}getClusterExpansionZoom(z){let F=this._getOriginZoom(z)-1;for(;F<=this.options.maxZoom;){const G=this.getChildren(z);if(F++,G.length!==1)break;z=G[0].properties.cluster_id}return F}_appendLeaves(z,F,G,H,it){const rt=this.getChildren(F);for(const lt of rt){const et=lt.properties;if(et&&et.cluster?it+et.point_count<=H?it+=et.point_count:it=this._appendLeaves(z,et.cluster_id,G,H,it):it1;let Lt,St,Ct;if(pt)Lt=ln(F,et,this.clusterProps),St=F[et],Ct=F[et+1];else{const we=this.points[F[et+hn]];Lt=we.properties;const[_e,qe]=we.geometry.coordinates;St=wn(_e),Ct=Vn(qe)}const ee={type:1,geometry:[[Math.round(this.options.extent*(St*it-G)),Math.round(this.options.extent*(Ct*it-H))]],tags:Lt};let se;se=pt||this.options.generateId?F[et+hn]:this.points[F[et+hn]].id,se!==void 0&&(ee.id=se),rt.features.push(ee)}}_limitZoom(z){return Math.max(this.options.minZoom,Math.min(Math.floor(+z),this.options.maxZoom+1))}_cluster(z,F){const{radius:G,extent:H,reduce:it,minPoints:rt}=this.options,lt=G/(H*Math.pow(2,F)),et=z.data,pt=[],Lt=this.stride;for(let St=0;StF&&(_e+=et[gn+Me])}if(_e>we&&_e>=rt){let qe,gn=Ct*we,Nn=ee*we,mi=-1;const Te=((St/Lt|0)<<5)+(F+1)+this.points.length;for(const Wn of se){const Ei=Wn*Lt;if(et[Ei+2]<=F)continue;et[Ei+2]=F;const pr=et[Ei+Me];gn+=et[Ei]*pr,Nn+=et[Ei+1]*pr,et[Ei+4]=Te,it&&(qe||(qe=this._map(et,St,!0),mi=this.clusterProps.length,this.clusterProps.push(qe)),it(qe,this._map(et,Ei)))}et[St+4]=Te,pt.push(gn/_e,Nn/_e,1/0,Te,-1,_e),it&&pt.push(mi)}else{for(let qe=0;qe1)for(const qe of se){const gn=qe*Lt;if(!(et[gn+2]<=F)){et[gn+2]=F;for(let Nn=0;Nn>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,F,G){if(z[F+Me]>1){const rt=this.clusterProps[z[F+nn]];return G?Object.assign({},rt):rt}const H=this.points[z[F+hn]].properties,it=this.options.map(H);return G&&it===H?Object.assign({},it):it}}function an(K,z,F){return{type:"Feature",id:K[z+hn],properties:ln(K,z,F),geometry:{type:"Point",coordinates:[(G=K[z],360*(G-.5)),Ji(K[z+1])]}};var G}function ln(K,z,F){const G=K[z+Me],H=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,it=K[z+nn],rt=it===-1?{}:Object.assign({},F[it]);return Object.assign(rt,{cluster:!0,cluster_id:K[z+hn],point_count:G,point_count_abbreviated:H})}function wn(K){return K/360+.5}function Vn(K){const z=Math.sin(K*Math.PI/180),F=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return F<0?0:F>1?1:F}function Ji(K){const z=(180-360*K)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function ni(K,z,F,G){for(var H,it=G,rt=F-z>>1,lt=F-z,et=K[z],pt=K[z+1],Lt=K[F],St=K[F+1],Ct=z+3;Ctit)H=Ct,it=ee;else if(ee===it){var se=Math.abs(Ct-rt);seG&&(H-z>3&&ni(K,z,H,G),K[H+2]=it,F-H>3&&ni(K,H,F,G))}function ai(K,z,F,G,H,it){var rt=H-F,lt=it-G;if(rt!==0||lt!==0){var et=((K-F)*rt+(z-G)*lt)/(rt*rt+lt*lt);et>1?(F=H,G=it):et>0&&(F+=rt*et,G+=lt*et)}return(rt=K-F)*rt+(lt=z-G)*lt}function bi(K,z,F,G){var H={id:K===void 0?null:K,type:z,geometry:F,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(it){var rt=it.geometry,lt=it.type;if(lt==="Point"||lt==="MultiPoint"||lt==="LineString")at(it,rt);else if(lt==="Polygon"||lt==="MultiLineString")for(var et=0;et0&&(rt+=G?(H*pt-et*it)/2:Math.sqrt(Math.pow(et-H,2)+Math.pow(pt-it,2))),H=et,it=pt}var Lt=z.length-3;z[2]=1,ni(z,0,Lt,F),z[Lt+2]=1,z.size=Math.abs(rt),z.start=0,z.end=z.size}function xt(K,z,F,G){for(var H=0;H1?1:F}function Oe(K,z,F,G,H,it,rt,lt){if(G/=z,it>=(F/=z)&&rt=G)return null;for(var et=[],pt=0;pt=F&&se=G)){var we=[];if(Ct==="Point"||Ct==="MultiPoint")wi(St,we,F,G,H);else if(Ct==="LineString")Ga(St,we,F,G,H,!1,lt.lineMetrics);else if(Ct==="MultiLineString")Za(St,we,F,G,H,!1);else if(Ct==="Polygon")Za(St,we,F,G,H,!0);else if(Ct==="MultiPolygon")for(var _e=0;_e=F&&rt<=G&&(z.push(K[it]),z.push(K[it+1]),z.push(K[it+2]))}}function Ga(K,z,F,G,H,it,rt){for(var lt,et,pt=ja(K),Lt=H===0?qs:Du,St=K.start,Ct=0;CtF&&(et=Lt(pt,ee,se,_e,qe,F),rt&&(pt.start=St+lt*et)):gn>G?Nn=F&&(et=Lt(pt,ee,se,_e,qe,F),mi=!0),Nn>G&&gn<=G&&(et=Lt(pt,ee,se,_e,qe,G),mi=!0),!it&&mi&&(rt&&(pt.end=St+lt*et),z.push(pt),pt=ja(K)),rt&&(St+=lt)}var Te=K.length-3;ee=K[Te],se=K[Te+1],we=K[Te+2],(gn=H===0?ee:se)>=F&&gn<=G&&Ha(pt,ee,se,we),Te=pt.length-3,it&&Te>=3&&(pt[Te]!==pt[0]||pt[Te+1]!==pt[1])&&Ha(pt,pt[0],pt[1],pt[2]),pt.length&&z.push(pt)}function ja(K){var z=[];return z.size=K.size,z.start=K.start,z.end=K.end,z}function Za(K,z,F,G,H,it){for(var rt=0;rtrt.maxX&&(rt.maxX=Lt),St>rt.maxY&&(rt.maxY=St)}return rt}function Qi(K,z,F,G){var H=z.geometry,it=z.type,rt=[];if(it==="Point"||it==="MultiPoint")for(var lt=0;lt0&&z.size<(H?rt:G))F.numPoints+=z.length/3;else{for(var lt=[],et=0;etrt)&&(F.numSimplified++,lt.push(z[et]),lt.push(z[et+1])),F.numPoints++;H&&function(pt,Lt){for(var St=0,Ct=0,ee=pt.length,se=ee-2;Ct0===Lt)for(Ct=0,ee=pt.length;Ct24)throw new Error("maxZoom should be in the 0-24 range");if(z.promoteId&&z.generateId)throw new Error("promoteId and generateId cannot be used together.");var G=function(H,it){var rt=[];if(H.type==="FeatureCollection")for(var lt=0;lt1&&console.time("creation"),Ct=this.tiles[St]=Dl(K,z,F,G,et),this.tileCoords.push({z,x:F,y:G}),pt)){pt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",z,F,G,Ct.numFeatures,Ct.numPoints,Ct.numSimplified),console.timeEnd("creation"));var ee="z"+z;this.stats[ee]=(this.stats[ee]||0)+1,this.total++}if(Ct.source=K,H){if(z===et.maxZoom||z===H)continue;var se=1<1&&console.time("clipping");var we,_e,qe,gn,Nn,mi,Te=.5*et.buffer/et.extent,Wn=.5-Te,Ei=.5+Te,pr=1+Te;we=_e=qe=gn=null,Nn=Oe(K,Lt,F-Te,F+Ei,0,Ct.minX,Ct.maxX,et),mi=Oe(K,Lt,F+Wn,F+pr,0,Ct.minX,Ct.maxX,et),K=null,Nn&&(we=Oe(Nn,Lt,G-Te,G+Ei,1,Ct.minY,Ct.maxY,et),_e=Oe(Nn,Lt,G+Wn,G+pr,1,Ct.minY,Ct.maxY,et),Nn=null),mi&&(qe=Oe(mi,Lt,G-Te,G+Ei,1,Ct.minY,Ct.maxY,et),gn=Oe(mi,Lt,G+Wn,G+pr,1,Ct.minY,Ct.maxY,et),mi=null),pt>1&&console.timeEnd("clipping"),lt.push(we||[],z+1,2*F,2*G),lt.push(_e||[],z+1,2*F,2*G+1),lt.push(qe||[],z+1,2*F+1,2*G),lt.push(gn||[],z+1,2*F+1,2*G+1)}}},Ae.prototype.getTile=function(K,z,F){var G=this.options,H=G.extent,it=G.debug;if(K<0||K>24)return null;var rt=1<1&&console.log("drilling down to z%d-%d-%d",K,z,F);for(var et,pt=K,Lt=z,St=F;!et&&pt>0;)pt--,Lt=Math.floor(Lt/2),St=Math.floor(St/2),et=this.tiles[Ce(pt,Lt,St)];return et&&et.source?(it>1&&console.log("found parent tile z%d-%d-%d",pt,Lt,St),it>1&&console.time("drilling down"),this.splitTile(et.source,pt,Lt,St,K,z,F),it>1&&console.timeEnd("drilling down"),this.tiles[lt]?Zo(this.tiles[lt],H):null):null};class fa extends k{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(z,F){return m._(this,void 0,void 0,function*(){const G=z.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const H=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!H)return null;const it=new class{constructor(lt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=m.W,this.length=lt.length,this._features=lt}feature(lt){return new class{constructor(et){this._feature=et,this.extent=m.W,this.type=et.type,this.properties=et.tags,"id"in et&&!isNaN(et.id)&&(this.id=parseInt(et.id,10))}loadGeometry(){if(this._feature.type===1){const et=[];for(const pt of this._feature.geometry)et.push([new m.P(pt[0],pt[1])]);return et}{const et=[];for(const pt of this._feature.geometry){const Lt=[];for(const St of pt)Lt.push(new m.P(St[0],St[1]));et.push(Lt)}return et}}toGeoJSON(et,pt,Lt){return It.call(this,et,pt,Lt)}}(this._features[lt])}}(H.features);let rt=ce(it);return rt.byteOffset===0&&rt.byteLength===rt.buffer.byteLength||(rt=new Uint8Array(rt)),{vectorTile:it,rawData:rt.buffer}})}loadData(z){return m._(this,void 0,void 0,function*(){var F;(F=this._pendingRequest)===null||F===void 0||F.abort();const G=!!(z&&z.request&&z.request.collectResourceTiming)&&new m.bs(z.request);this._pendingRequest=new AbortController;try{let H=yield this.loadGeoJSON(z,this._pendingRequest);if(delete this._pendingRequest,typeof H!="object")throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(bt(H,!0),z.filter){const rt=m.by(z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(rt.result==="error")throw new Error(rt.value.map(et=>`${et.key}: ${et.message}`).join(", "));H={type:"FeatureCollection",features:H.features.filter(et=>rt.value.evaluate({zoom:0},et))}}this._geoJSONIndex=z.cluster?new Ln(function({superclusterOptions:rt,clusterProperties:lt}){if(!lt||!rt)return rt;const et={},pt={},Lt={accumulated:null,zoom:0},St={properties:null},Ct=Object.keys(lt);for(const ee of Ct){const[se,we]=lt[ee],_e=m.by(we),qe=m.by(typeof se=="string"?[se,["accumulated"],["get",ee]]:se);et[ee]=_e.value,pt[ee]=qe.value}return rt.map=ee=>{St.properties=ee;const se={};for(const we of Ct)se[we]=et[we].evaluate(Lt,St);return se},rt.reduce=(ee,se)=>{St.properties=se;for(const we of Ct)Lt.accumulated=ee[we],ee[we]=pt[we].evaluate(Lt,St)},rt}(z)).load(H.features):function(rt,lt){return new Ae(rt,lt)}(H,z.geojsonVtOptions),this.loaded={};const it={};if(G){const rt=G.finish();rt&&(it.resourceTiming={},it.resourceTiming[z.source]=JSON.parse(JSON.stringify(rt)))}return it}catch(H){if(delete this._pendingRequest,m.bz(H))return{abandoned:!0};throw H}})}reloadTile(z){const F=this.loaded;return F&&F[z.uid]?super.reloadTile(z):this.loadTile(z)}loadGeoJSON(z,F){return m._(this,void 0,void 0,function*(){const{promoteId:G}=z;if(z.request){const H=yield m.h(z.request,F);return this._dataUpdateable=Ho(H.data,G)?be(H.data,G):void 0,H.data}if(typeof z.data=="string")try{const H=JSON.parse(z.data);return this._dataUpdateable=Ho(H,G)?be(H,G):void 0,H}catch{throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`)}if(!z.dataDiff)throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${z.source}`);return function(H,it,rt){var lt,et,pt,Lt;if(it.removeAll&&H.clear(),it.remove)for(const St of it.remove)H.delete(St);if(it.add)for(const St of it.add){const Ct=fi(St,rt);Ct!=null&&H.set(Ct,St)}if(it.update)for(const St of it.update){let Ct=H.get(St.id);if(Ct==null)continue;const ee=!St.removeAllProperties&&(((lt=St.removeProperties)===null||lt===void 0?void 0:lt.length)>0||((et=St.addOrUpdateProperties)===null||et===void 0?void 0:et.length)>0);if((St.newGeometry||St.removeAllProperties||ee)&&(Ct=Object.assign({},Ct),H.set(St.id,Ct),ee&&(Ct.properties=Object.assign({},Ct.properties))),St.newGeometry&&(Ct.geometry=St.newGeometry),St.removeAllProperties)Ct.properties={};else if(((pt=St.removeProperties)===null||pt===void 0?void 0:pt.length)>0)for(const se of St.removeProperties)Object.prototype.hasOwnProperty.call(Ct.properties,se)&&delete Ct.properties[se];if(((Lt=St.addOrUpdateProperties)===null||Lt===void 0?void 0:Lt.length)>0)for(const{key:se,value:we}of St.addOrUpdateProperties)Ct.properties[se]=we}}(this._dataUpdateable,z.dataDiff,G),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(z){return m._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(z){return this._geoJSONIndex.getClusterExpansionZoom(z.clusterId)}getClusterChildren(z){return this._geoJSONIndex.getChildren(z.clusterId)}getClusterLeaves(z){return this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset)}}class Ii{constructor(z){this.self=z,this.actor=new m.C(z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(F,G)=>{if(this.externalWorkerSourceTypes[F])throw new Error(`Worker source with name "${F}" already registered.`);this.externalWorkerSourceTypes[F]=G},this.self.addProtocol=m.bf,this.self.removeProtocol=m.bg,this.self.registerRTLTextPlugin=F=>{if(m.bA.isParsed())throw new Error("RTL text plugin already registered.");m.bA.setMethods(F)},this.actor.registerMessageHandler("LDT",(F,G)=>this._getDEMWorkerSource(F,G.source).loadTile(G)),this.actor.registerMessageHandler("RDT",(F,G)=>m._(this,void 0,void 0,function*(){this._getDEMWorkerSource(F,G.source).removeTile(G)})),this.actor.registerMessageHandler("GCEZ",(F,G)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,G.type,G.source).getClusterExpansionZoom(G)})),this.actor.registerMessageHandler("GCC",(F,G)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,G.type,G.source).getClusterChildren(G)})),this.actor.registerMessageHandler("GCL",(F,G)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,G.type,G.source).getClusterLeaves(G)})),this.actor.registerMessageHandler("LD",(F,G)=>this._getWorkerSource(F,G.type,G.source).loadData(G)),this.actor.registerMessageHandler("LT",(F,G)=>this._getWorkerSource(F,G.type,G.source).loadTile(G)),this.actor.registerMessageHandler("RT",(F,G)=>this._getWorkerSource(F,G.type,G.source).reloadTile(G)),this.actor.registerMessageHandler("AT",(F,G)=>this._getWorkerSource(F,G.type,G.source).abortTile(G)),this.actor.registerMessageHandler("RMT",(F,G)=>this._getWorkerSource(F,G.type,G.source).removeTile(G)),this.actor.registerMessageHandler("RS",(F,G)=>m._(this,void 0,void 0,function*(){if(!this.workerSources[F]||!this.workerSources[F][G.type]||!this.workerSources[F][G.type][G.source])return;const H=this.workerSources[F][G.type][G.source];delete this.workerSources[F][G.type][G.source],H.removeSource!==void 0&&H.removeSource(G)})),this.actor.registerMessageHandler("RM",F=>m._(this,void 0,void 0,function*(){delete this.layerIndexes[F],delete this.availableImages[F],delete this.workerSources[F],delete this.demWorkerSources[F]})),this.actor.registerMessageHandler("SR",(F,G)=>m._(this,void 0,void 0,function*(){this.referrer=G})),this.actor.registerMessageHandler("SRPS",(F,G)=>this._syncRTLPluginState(F,G)),this.actor.registerMessageHandler("IS",(F,G)=>m._(this,void 0,void 0,function*(){this.self.importScripts(G)})),this.actor.registerMessageHandler("SI",(F,G)=>this._setImages(F,G)),this.actor.registerMessageHandler("UL",(F,G)=>m._(this,void 0,void 0,function*(){this._getLayerIndex(F).update(G.layers,G.removedIds)})),this.actor.registerMessageHandler("SL",(F,G)=>m._(this,void 0,void 0,function*(){this._getLayerIndex(F).replace(G)}))}_setImages(z,F){return m._(this,void 0,void 0,function*(){this.availableImages[z]=F;for(const G in this.workerSources[z]){const H=this.workerSources[z][G];for(const it in H)H[it].availableImages=F}})}_syncRTLPluginState(z,F){return m._(this,void 0,void 0,function*(){if(m.bA.isParsed())return m.bA.getState();if(F.pluginStatus!=="loading")return m.bA.setState(F),F;const G=F.pluginURL;if(this.self.importScripts(G),m.bA.isParsed()){const H={pluginStatus:"loaded",pluginURL:G};return m.bA.setState(H),H}throw m.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${G}`)})}_getAvailableImages(z){let F=this.availableImages[z];return F||(F=[]),F}_getLayerIndex(z){let F=this.layerIndexes[z];return F||(F=this.layerIndexes[z]=new c),F}_getWorkerSource(z,F,G){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][F]||(this.workerSources[z][F]={}),!this.workerSources[z][F][G]){const H={sendAsync:(it,rt)=>(it.targetMapId=z,this.actor.sendAsync(it,rt))};switch(F){case"vector":this.workerSources[z][F][G]=new k(H,this._getLayerIndex(z),this._getAvailableImages(z));break;case"geojson":this.workerSources[z][F][G]=new fa(H,this._getLayerIndex(z),this._getAvailableImages(z));break;default:this.workerSources[z][F][G]=new this.externalWorkerSourceTypes[F](H,this._getLayerIndex(z),this._getAvailableImages(z))}}return this.workerSources[z][F][G]}_getDEMWorkerSource(z,F){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][F]||(this.demWorkerSources[z][F]=new U),this.demWorkerSources[z][F]}}return m.i(self)&&(self.worker=new Ii(self)),Ii}),l("index",["exports","./shared"],function(m,c){var S="4.1.3";let L,R;const k={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((i,u)=>{const d=requestAnimationFrame(i);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),u(c.c())})}),getImageData(_,i=0){return this.getImageCanvasContext(_).getImageData(-i,-i,_.width+2*i,_.height+2*i)},getImageCanvasContext(_){const i=window.document.createElement("canvas"),u=i.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("failed to create canvas 2d context");return i.width=_.width,i.height=_.height,u.drawImage(_,0,0,_.width,_.height),u},resolveURL:_=>(L||(L=document.createElement("a")),L.href=_,L.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(R==null&&(R=matchMedia("(prefers-reduced-motion: reduce)")),R.matches)}};class U{static testProp(i){if(!U.docStyle)return i[0];for(let u=0;u{window.removeEventListener("click",U.suppressClickInternal,!0)},0)}static getScale(i){const u=i.getBoundingClientRect();return{x:u.width/i.offsetWidth||1,y:u.height/i.offsetHeight||1,boundingClientRect:u}}static getPoint(i,u,d){const f=u.boundingClientRect;return new c.P((d.clientX-f.left)/u.x-i.clientLeft,(d.clientY-f.top)/u.y-i.clientTop)}static mousePos(i,u){const d=U.getScale(i);return U.getPoint(i,d,u)}static touchPos(i,u){const d=[],f=U.getScale(i);for(let y=0;y{i=[],u=0,d=0,f={}},_.addThrottleControl=C=>{const P=d++;return f[P]=C,P},_.removeThrottleControl=C=>{delete f[C],w()},_.getImage=(C,P,D=!0)=>new Promise((N,V)=>{ct.supported&&(C.headers||(C.headers={}),C.headers.accept="image/webp,*/*"),c.e(C,{type:"image"}),i.push({abortController:P,requestParameters:C,supportImageRefresh:D,state:"queued",onError:X=>{V(X)},onSuccess:X=>{N(X)}}),w()});const y=C=>c._(this,void 0,void 0,function*(){C.state="running";const{requestParameters:P,supportImageRefresh:D,onError:N,onSuccess:V,abortController:X}=C,W=D===!1&&!c.i(self)&&!c.g(P.url)&&(!P.headers||Object.keys(P.headers).reduce((nt,mt)=>nt&&mt==="accept",!0));u++;const J=W?I(P,X):c.m(P,X);try{const nt=yield J;delete C.abortController,C.state="completed",nt.data instanceof HTMLImageElement||c.b(nt.data)?V(nt):nt.data&&V({data:yield(j=nt.data,typeof createImageBitmap=="function"?c.d(j):c.f(j)),cacheControl:nt.cacheControl,expires:nt.expires})}catch(nt){delete C.abortController,N(nt)}finally{u--,w()}var j}),w=()=>{const C=(()=>{for(const P of Object.keys(f))if(f[P]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let P=u;P0;P++){const D=i.shift();D.abortController.signal.aborted?P--:y(D)}},I=(C,P)=>new Promise((D,N)=>{const V=new Image,X=C.url,W=C.credentials;W&&W==="include"?V.crossOrigin="use-credentials":(W&&W==="same-origin"||!c.s(X))&&(V.crossOrigin="anonymous"),P.signal.addEventListener("abort",()=>{V.src="",N(c.c())}),V.fetchPriority="high",V.onload=()=>{V.onerror=V.onload=null,D({data:V})},V.onerror=()=>{V.onerror=V.onload=null,P.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."))},V.src=X})}(Gt||(Gt={})),Gt.resetRequestQueue();class re{constructor(i){this._transformRequestFn=i}transformRequest(i,u){return this._transformRequestFn&&this._transformRequestFn(i,u)||{url:i}}normalizeSpriteURL(i,u,d){const f=function(y){const w=y.match(pe);if(!w)throw new Error(`Unable to parse URL "${y}"`);return{protocol:w[1],authority:w[2],path:w[3]||"/",params:w[4]?w[4].split("&"):[]}}(i);return f.path+=`${u}${d}`,function(y){const w=y.params.length?`?${y.params.join("&")}`:"";return`${y.protocol}://${y.authority}${y.path}${w}`}(f)}setTransformRequest(i){this._transformRequestFn=i}}const pe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Be(_){var i=new c.A(3);return i[0]=_[0],i[1]=_[1],i[2]=_[2],i}var ue,Pe=function(_,i,u){return _[0]=i[0]-u[0],_[1]=i[1]-u[1],_[2]=i[2]-u[2],_};ue=new c.A(3),c.A!=Float32Array&&(ue[0]=0,ue[1]=0,ue[2]=0);var me=function(_){var i=_[0],u=_[1];return i*i+u*u};function ve(_){const i=[];if(typeof _=="string")i.push({id:"default",url:_});else if(_&&_.length>0){const u=[];for(const{id:d,url:f}of _){const y=`${d}${f}`;u.indexOf(y)===-1&&(u.push(y),i.push({id:d,url:f}))}}return i}(function(){var _=new c.A(2);c.A!=Float32Array&&(_[0]=0,_[1]=0)})();class Nt{constructor(i,u,d,f){this.context=i,this.format=d,this.texture=i.gl.createTexture(),this.update(u,f)}update(i,u,d){const{width:f,height:y}=i,w=!(this.size&&this.size[0]===f&&this.size[1]===y||d),{context:I}=this,{gl:C}=I;if(this.useMipmap=!!(u&&u.useMipmap),C.bindTexture(C.TEXTURE_2D,this.texture),I.pixelStoreUnpackFlipY.set(!1),I.pixelStoreUnpack.set(1),I.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA&&(!u||u.premultiply!==!1)),w)this.size=[f,y],i instanceof HTMLImageElement||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageData||c.b(i)?C.texImage2D(C.TEXTURE_2D,0,this.format,this.format,C.UNSIGNED_BYTE,i):C.texImage2D(C.TEXTURE_2D,0,this.format,f,y,0,this.format,C.UNSIGNED_BYTE,i.data);else{const{x:P,y:D}=d||{x:0,y:0};i instanceof HTMLImageElement||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageData||c.b(i)?C.texSubImage2D(C.TEXTURE_2D,0,P,D,C.RGBA,C.UNSIGNED_BYTE,i):C.texSubImage2D(C.TEXTURE_2D,0,P,D,f,y,C.RGBA,C.UNSIGNED_BYTE,i.data)}this.useMipmap&&this.isSizePowerOfTwo()&&C.generateMipmap(C.TEXTURE_2D)}bind(i,u,d){const{context:f}=this,{gl:y}=f;y.bindTexture(y.TEXTURE_2D,this.texture),d!==y.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=y.LINEAR),i!==this.filter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,i),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,d||i),this.filter=i),u!==this.wrap&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,u),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,u),this.wrap=u)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}}function sn(_){const{userImage:i}=_;return!!(i&&i.render&&i.render())&&(_.data.replace(new Uint8Array(i.data.buffer)),!0)}class Re extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(i){if(this.loaded!==i&&(this.loaded=i,i)){for(const{ids:u,promiseResolve:d}of this.requestors)d(this._getImagesForIds(u));this.requestors=[]}}getImage(i){const u=this.images[i];if(u&&!u.data&&u.spriteData){const d=u.spriteData;u.data=new c.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),u.spriteData=null}return u}addImage(i,u){if(this.images[i])throw new Error(`Image id ${i} already exist, use updateImage instead`);this._validate(i,u)&&(this.images[i]=u)}_validate(i,u){let d=!0;const f=u.data||u.spriteData;return this._validateStretch(u.stretchX,f&&f.width)||(this.fire(new c.j(new Error(`Image "${i}" has invalid "stretchX" value`))),d=!1),this._validateStretch(u.stretchY,f&&f.height)||(this.fire(new c.j(new Error(`Image "${i}" has invalid "stretchY" value`))),d=!1),this._validateContent(u.content,u)||(this.fire(new c.j(new Error(`Image "${i}" has invalid "content" value`))),d=!1),d}_validateStretch(i,u){if(!i)return!0;let d=0;for(const f of i){if(f[0]{let f=!0;if(!this.isLoaded())for(const y of i)this.images[y]||(f=!1);this.isLoaded()||f?u(this._getImagesForIds(i)):this.requestors.push({ids:i,promiseResolve:u})})}_getImagesForIds(i){const u={};for(const d of i){let f=this.getImage(d);f||(this.fire(new c.k("styleimagemissing",{id:d})),f=this.getImage(d)),f?u[d]={data:f.data.clone(),pixelRatio:f.pixelRatio,sdf:f.sdf,version:f.version,stretchX:f.stretchX,stretchY:f.stretchY,content:f.content,hasRenderCallback:!!(f.userImage&&f.userImage.render)}:c.w(`Image "${d}" 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 u}getPixelSize(){const{width:i,height:u}=this.atlasImage;return{width:i,height:u}}getPattern(i){const u=this.patterns[i],d=this.getImage(i);if(!d)return null;if(u&&u.position.version===d.version)return u.position;if(u)u.position.version=d.version;else{const f={w:d.data.width+2,h:d.data.height+2,x:0,y:0},y=new c.I(f,d);this.patterns[i]={bin:f,position:y}}return this._updatePatternAtlas(),this.patterns[i].position}bind(i){const u=i.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Nt(i,this.atlasImage,u.RGBA),this.atlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(){const i=[];for(const y in this.patterns)i.push(this.patterns[y].bin);const{w:u,h:d}=c.p(i),f=this.atlasImage;f.resize({width:u||1,height:d||1});for(const y in this.patterns){const{bin:w}=this.patterns[y],I=w.x+1,C=w.y+1,P=this.getImage(y).data,D=P.width,N=P.height;c.R.copy(P,f,{x:0,y:0},{x:I,y:C},{width:D,height:N}),c.R.copy(P,f,{x:0,y:N-1},{x:I,y:C-1},{width:D,height:1}),c.R.copy(P,f,{x:0,y:0},{x:I,y:C+N},{width:D,height:1}),c.R.copy(P,f,{x:D-1,y:0},{x:I-1,y:C},{width:1,height:N}),c.R.copy(P,f,{x:0,y:0},{x:I+D,y:C},{width:1,height:N})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(i){for(const u of i){if(this.callbackDispatchedThisFrame[u])continue;this.callbackDispatchedThisFrame[u]=!0;const d=this.getImage(u);d||c.w(`Image with ID: "${u}" was not found`),sn(d)&&this.updateImage(u,d)}}}const ge=1e20;function He(_,i,u,d,f,y,w,I,C){for(let P=i;P-1);C++,y[C]=I,w[C]=P,w[C+1]=ge}for(let I=0,C=0;I65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[y])return{stack:i,id:u,glyph:f};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[y]){const I=ce.loadGlyphRange(i,y,this.url,this.requestManager);d.requests[y]=I}const w=yield d.requests[y];for(const I in w)this._doesCharSupportLocalGlyph(+I)||(d.glyphs[+I]=w[+I]);return d.ranges[y]=!0,{stack:i,id:u,glyph:w[u]||null}})}_doesCharSupportLocalGlyph(i){return!!this.localIdeographFontFamily&&(c.u["CJK Unified Ideographs"](i)||c.u["Hangul Syllables"](i)||c.u.Hiragana(i)||c.u.Katakana(i))}_tinySDF(i,u,d){const f=this.localIdeographFontFamily;if(!f||!this._doesCharSupportLocalGlyph(d))return;let y=i.tinySDF;if(!y){let I="400";/bold/i.test(u)?I="900":/medium/i.test(u)?I="500":/light/i.test(u)&&(I="200"),y=i.tinySDF=new ce.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:f,fontWeight:I})}const w=y.draw(String.fromCharCode(d));return{id:d,bitmap:new c.o({width:w.width||60,height:w.height||60},w.data),metrics:{width:w.glyphWidth/2||24,height:w.glyphHeight/2||24,left:w.glyphLeft/2+.5||0,top:w.glyphTop/2-27.5||-8,advance:w.glyphAdvance/2||24,isDoubleResolution:!0}}}}ce.loadGlyphRange=function(_,i,u,d){return c._(this,void 0,void 0,function*(){const f=256*i,y=f+255,w=d.transformRequest(u.replace("{fontstack}",_).replace("{range}",`${f}-${y}`),"Glyphs"),I=yield c.l(w,new AbortController);if(!I||!I.data)throw new Error(`Could not load glyph range. range: ${i}, ${f}-${y}`);const C={};for(const P of c.n(I.data))C[P.id]=P;return C})},ce.TinySDF=class{constructor({fontSize:_=24,buffer:i=3,radius:u=8,cutoff:d=.25,fontFamily:f="sans-serif",fontWeight:y="normal",fontStyle:w="normal"}={}){this.buffer=i,this.cutoff=d,this.radius=u;const I=this.size=_+4*i,C=this._createCanvas(I),P=this.ctx=C.getContext("2d",{willReadFrequently:!0});P.font=`${w} ${y} ${_}px ${f}`,P.textBaseline="alphabetic",P.textAlign="left",P.fillStyle="black",this.gridOuter=new Float64Array(I*I),this.gridInner=new Float64Array(I*I),this.f=new Float64Array(I),this.z=new Float64Array(I+1),this.v=new Uint16Array(I)}_createCanvas(_){const i=document.createElement("canvas");return i.width=i.height=_,i}draw(_){const{width:i,actualBoundingBoxAscent:u,actualBoundingBoxDescent:d,actualBoundingBoxLeft:f,actualBoundingBoxRight:y}=this.ctx.measureText(_),w=Math.ceil(u),I=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(y-f))),C=Math.min(this.size-this.buffer,w+Math.ceil(d)),P=I+2*this.buffer,D=C+2*this.buffer,N=Math.max(P*D,0),V=new Uint8ClampedArray(N),X={data:V,width:P,height:D,glyphWidth:I,glyphHeight:C,glyphTop:w,glyphLeft:0,glyphAdvance:i};if(I===0||C===0)return X;const{ctx:W,buffer:J,gridInner:j,gridOuter:nt}=this;W.clearRect(J,J,I,C),W.fillText(_,J,J+w);const mt=W.getImageData(J,J,I,C);nt.fill(ge,0,N),j.fill(0,0,N);for(let Q=0;Q0?wt*wt:0,j[yt]=wt<0?wt*wt:0}}He(nt,0,0,P,D,P,this.f,this.v,this.z),He(j,J,J,I,C,P,this.f,this.v,this.z);for(let Q=0;Q1&&(C=i[++I]);const D=Math.abs(P-C.left),N=Math.abs(P-C.right),V=Math.min(D,N);let X;const W=y/d*(f+1);if(C.isDash){const J=f-Math.abs(W);X=Math.sqrt(V*V+J*J)}else X=f-Math.sqrt(V*V+W*W);this.data[w+P]=Math.max(0,Math.min(255,X+128))}}}addRegularDash(i){for(let I=i.length-1;I>=0;--I){const C=i[I],P=i[I+1];C.zeroLength?i.splice(I,1):P&&P.isDash===C.isDash&&(P.left=C.left,i.splice(I,1))}const u=i[0],d=i[i.length-1];u.isDash===d.isDash&&(u.left=d.left-this.width,d.right=u.right+this.width);const f=this.width*this.nextRow;let y=0,w=i[y];for(let I=0;I1&&(w=i[++y]);const C=Math.abs(I-w.left),P=Math.abs(I-w.right),D=Math.min(C,P);this.data[f+I]=Math.max(0,Math.min(255,(w.isDash?D:-D)+128))}}addDash(i,u){const d=u?7:0,f=2*d+1;if(this.nextRow+f>this.height)return c.w("LineAtlas out of space"),null;let y=0;for(let I=0;I{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Me]}numActive(){return Object.keys(this.active).length}}const Ln=Math.floor(k.hardwareConcurrency/2);let an,ln;function wn(){return an||(an=new nn),an}nn.workerCount=c.B(globalThis)?Math.max(Math.min(Ln,3),1):1;class Vn{constructor(i,u){this.workerPool=i,this.actors=[],this.currentActor=0,this.id=u;const d=this.workerPool.acquire(u);for(let f=0;f{u.remove()}),this.actors=[],i&&this.workerPool.release(this.id)}registerMessageHandler(i,u){for(const d of this.actors)d.registerMessageHandler(i,u)}}function Ji(){return ln||(ln=new Vn(wn(),c.G),ln.registerMessageHandler("GR",(_,i,u)=>c.m(i,u))),ln}function ni(_,i){const u=c.F();return c.H(u,u,[1,1,0]),c.J(u,u,[.5*_.width,.5*_.height,1]),c.K(u,u,_.calculatePosMatrix(i.toUnwrapped()))}function ai(_,i,u,d,f,y){const w=function(N,V,X){if(N)for(const W of N){const J=V[W];if(J&&J.source===X&&J.type==="fill-extrusion")return!0}else for(const W in V){const J=V[W];if(J.source===X&&J.type==="fill-extrusion")return!0}return!1}(f&&f.layers,i,_.id),I=y.maxPitchScaleFactor(),C=_.tilesIn(d,I,w);C.sort(bi);const P=[];for(const N of C)P.push({wrappedTileID:N.tileID.wrapped().key,queryResults:N.tile.queryRenderedFeatures(i,u,_._state,N.queryGeometry,N.cameraQueryGeometry,N.scale,f,y,I,ni(_.transform,N.tileID))});const D=function(N){const V={},X={};for(const W of N){const J=W.queryResults,j=W.wrappedTileID,nt=X[j]=X[j]||{};for(const mt in J){const Q=J[mt],st=nt[mt]=nt[mt]||{},gt=V[mt]=V[mt]||[];for(const yt of Q)st[yt.featureIndex]||(st[yt.featureIndex]=!0,gt.push(yt))}}return V}(P);for(const N in D)D[N].forEach(V=>{const X=V.feature,W=_.getFeatureState(X.layer["source-layer"],X.id);X.source=X.layer.source,X.layer["source-layer"]&&(X.sourceLayer=X.layer["source-layer"]),X.state=W});return D}function bi(_,i){const u=_.tileID,d=i.tileID;return u.overscaledZ-d.overscaledZ||u.canonical.y-d.canonical.y||u.wrap-d.wrap||u.canonical.x-d.canonical.x}function at(_,i,u){return c._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield c.h(i.transformRequest(_.url,"Source"),u)).data:yield k.frameAsync(u),!d)return null;const f=c.L(c.e(d,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(f.vectorLayerIds=d.vector_layers.map(y=>y.id)),f})}class _t{constructor(i,u){i&&(u?this.setSouthWest(i).setNorthEast(u):Array.isArray(i)&&(i.length===4?this.setSouthWest([i[0],i[1]]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1])))}setNorthEast(i){return this._ne=i instanceof c.M?new c.M(i.lng,i.lat):c.M.convert(i),this}setSouthWest(i){return this._sw=i instanceof c.M?new c.M(i.lng,i.lat):c.M.convert(i),this}extend(i){const u=this._sw,d=this._ne;let f,y;if(i instanceof c.M)f=i,y=i;else{if(!(i instanceof _t))return Array.isArray(i)?i.length===4||i.every(Array.isArray)?this.extend(_t.convert(i)):this.extend(c.M.convert(i)):i&&("lng"in i||"lon"in i)&&"lat"in i?this.extend(c.M.convert(i)):this;if(f=i._sw,y=i._ne,!f||!y)return this}return u||d?(u.lng=Math.min(f.lng,u.lng),u.lat=Math.min(f.lat,u.lat),d.lng=Math.max(y.lng,d.lng),d.lat=Math.max(y.lat,d.lat)):(this._sw=new c.M(f.lng,f.lat),this._ne=new c.M(y.lng,y.lat)),this}getCenter(){return new c.M((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 c.M(this.getWest(),this.getNorth())}getSouthEast(){return new c.M(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(i){const{lng:u,lat:d}=c.M.convert(i);let f=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(f=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&f}static convert(i){return i instanceof _t?i:i&&new _t(i)}static fromLngLat(i,u=0){const d=360*u/40075017,f=d/Math.cos(Math.PI/180*i.lat);return new _t(new c.M(i.lng-f,i.lat-d),new c.M(i.lng+f,i.lat+d))}}class ze{constructor(i,u,d){this.bounds=_t.convert(this.validateBounds(i)),this.minzoom=u||0,this.maxzoom=d||24}validateBounds(i){return Array.isArray(i)&&i.length===4?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}contains(i){const u=Math.pow(2,i.z),d=Math.floor(c.N(this.bounds.getWest())*u),f=Math.floor(c.O(this.bounds.getNorth())*u),y=Math.ceil(c.N(this.bounds.getEast())*u),w=Math.ceil(c.O(this.bounds.getSouth())*u);return i.x>=d&&i.x=f&&i.y{this._options.tiles=i}),this}setUrl(i){return this.setSourceProperty(()=>{this.url=i,this._options.url=i}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(i){return c._(this,void 0,void 0,function*(){const u=i.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(u,"Tile"),uid:i.uid,tileID:i.tileID,zoom:i.tileID.overscaledZ,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};d.request.collectResourceTiming=this._collectResourceTiming;let f="RT";if(i.actor&&i.state!=="expired"){if(i.state==="loading")return new Promise((y,w)=>{i.reloadPromise={resolve:y,reject:w}})}else i.actor=this.dispatcher.getActor(),f="LT";i.abortController=new AbortController;try{const y=yield i.actor.sendAsync({type:f,data:d},i.abortController);if(delete i.abortController,i.aborted)return;this._afterTileLoadWorkerResponse(i,y)}catch(y){if(delete i.abortController,i.aborted)return;if(y&&y.status!==404)throw y;this._afterTileLoadWorkerResponse(i,null)}})}_afterTileLoadWorkerResponse(i,u){if(u&&u.resourceTiming&&(i.resourceTiming=u.resourceTiming),u&&this.map._refreshExpiredTiles&&i.setExpiryData(u),i.loadVectorData(u,this.map.painter),i.reloadPromise){const d=i.reloadPromise;i.reloadPromise=null,this.loadTile(i).then(d.resolve).catch(d.reject)}}abortTile(i){return c._(this,void 0,void 0,function*(){i.abortController&&(i.abortController.abort(),delete i.abortController),i.actor&&(yield i.actor.sendAsync({type:"AT",data:{uid:i.uid,type:this.type,source:this.id}}))})}unloadTile(i){return c._(this,void 0,void 0,function*(){i.unloadVectorData(),i.actor&&(yield i.actor.sendAsync({type:"RMT",data:{uid:i.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class xt extends c.E{constructor(i,u,d,f){super(),this.id=i,this.dispatcher=d,this.setEventedParent(f),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},u),c.e(this,c.L(u,["url","scheme","tileSize"]))}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield at(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(c.e(this,i),i.bounds&&(this.tileBounds=new ze(i.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(i){this._tileJSONRequest=null,this.fire(new c.j(i))}})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(i){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),i(),this.load()}setTiles(i){return this.setSourceProperty(()=>{this._options.tiles=i}),this}setUrl(i){return this.setSourceProperty(()=>{this.url=i,this._options.url=i}),this}serialize(){return c.e({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(i){return c._(this,void 0,void 0,function*(){const u=i.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);i.abortController=new AbortController;try{const d=yield Gt.getImage(this.map._requestManager.transformRequest(u,"Tile"),i.abortController,this.map._refreshExpiredTiles);if(delete i.abortController,i.aborted)return void(i.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&i.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const f=this.map.painter.context,y=f.gl,w=d.data;i.texture=this.map.painter.getTileTexture(w.width),i.texture?i.texture.update(w,{useMipmap:!0}):(i.texture=new Nt(f,w,y.RGBA,{useMipmap:!0}),i.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),f.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,f.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,f.extTextureFilterAnisotropicMax)),i.state="loaded"}}catch(d){if(delete i.abortController,i.aborted)i.state="unloaded";else if(d)throw i.state="errored",d}})}abortTile(i){return c._(this,void 0,void 0,function*(){i.abortController&&(i.abortController.abort(),delete i.abortController)})}unloadTile(i){return c._(this,void 0,void 0,function*(){i.texture&&this.map.painter.saveTileTexture(i.texture)})}hasTransition(){return!1}}class hr extends xt{constructor(i,u,d,f){super(i,u,d,f),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},u),this.encoding=u.encoding||"mapbox",this.redFactor=u.redFactor,this.greenFactor=u.greenFactor,this.blueFactor=u.blueFactor,this.baseShift=u.baseShift}loadTile(i){return c._(this,void 0,void 0,function*(){const u=i.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(u,"Tile");i.neighboringTiles=this._getNeighboringTiles(i.tileID),i.abortController=new AbortController;try{const f=yield Gt.getImage(d,i.abortController,this.map._refreshExpiredTiles);if(delete i.abortController,i.aborted)return void(i.state="unloaded");if(f&&f.data){const y=f.data;this.map._refreshExpiredTiles&&f.cacheControl&&f.expires&&i.setExpiryData({cacheControl:f.cacheControl,expires:f.expires});const w=c.b(y)&&c.S()?y:yield this.readImageNow(y),I={type:this.type,uid:i.uid,source:this.id,rawImageData:w,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!i.actor||i.state==="expired"){i.actor=this.dispatcher.getActor();const C=yield i.actor.sendAsync({type:"LDT",data:I});i.dem=C,i.needsHillshadePrepare=!0,i.needsTerrainPrepare=!0,i.state="loaded"}}}catch(f){if(delete i.abortController,i.aborted)i.state="unloaded";else if(f)throw i.state="errored",f}})}readImageNow(i){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.U()){const u=i.width+2,d=i.height+2;try{return new c.R({width:u,height:d},yield c.V(i,-1,-1,u,d))}catch{}}return k.getImageData(i,1)})}_getNeighboringTiles(i){const u=i.canonical,d=Math.pow(2,u.z),f=(u.x-1+d)%d,y=u.x===0?i.wrap-1:i.wrap,w=(u.x+1+d)%d,I=u.x+1===d?i.wrap+1:i.wrap,C={};return C[new c.Q(i.overscaledZ,y,u.z,f,u.y).key]={backfilled:!1},C[new c.Q(i.overscaledZ,I,u.z,w,u.y).key]={backfilled:!1},u.y>0&&(C[new c.Q(i.overscaledZ,y,u.z,f,u.y-1).key]={backfilled:!1},C[new c.Q(i.overscaledZ,i.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},C[new c.Q(i.overscaledZ,I,u.z,w,u.y-1).key]={backfilled:!1}),u.y+10&&c.e(y,{resourceTiming:f}),this.fire(new c.k("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},y),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(i){return c._(this,void 0,void 0,function*(){const u=i.actor?"RT":"LT";i.actor=this.actor;const d={type:this.type,uid:i.uid,tileID:i.tileID,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};i.abortController=new AbortController;const f=yield this.actor.sendAsync({type:u,data:d},i.abortController);delete i.abortController,i.unloadVectorData(),i.aborted||i.loadVectorData(f,this.map.painter,u==="RT")})}abortTile(i){return c._(this,void 0,void 0,function*(){i.abortController&&(i.abortController.abort(),delete i.abortController),i.aborted=!0})}unloadTile(i){return c._(this,void 0,void 0,function*(){i.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:i.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 c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Oe=c.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class wi extends c.E{constructor(i,u,d,f){super(),this.id=i,this.dispatcher=d,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(f),this.options=u}load(i){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const u=yield Gt.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,u&&u.data&&(this.image=u.data,i&&(this.coordinates=i),this._finishLoading())}catch(u){this._request=null,this._loaded=!0,this.fire(new c.j(u))}})}loaded(){return this._loaded}updateImage(i){return i.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=i.url,this.load(i.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(i){this.coordinates=i;const u=i.map(c.Y.fromLngLat);this.tileID=function(f){let y=1/0,w=1/0,I=-1/0,C=-1/0;for(const V of f)y=Math.min(y,V.x),w=Math.min(w,V.y),I=Math.max(I,V.x),C=Math.max(C,V.y);const P=Math.max(I-y,C-w),D=Math.max(0,Math.floor(-Math.log(P)/Math.LN2)),N=Math.pow(2,D);return new c.a0(D,Math.floor((y+I)/2*N),Math.floor((w+C)/2*N))}(u),this.minzoom=this.maxzoom=this.tileID.z;const d=u.map(f=>this.tileID.getTilePoint(f)._round());return this._boundsArray=new c.Z,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,c.W,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,c.W),this._boundsArray.emplaceBack(d[2].x,d[2].y,c.W,c.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const i=this.map.painter.context,u=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,Oe.members)),this.boundsSegments||(this.boundsSegments=c.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Nt(i,this.image,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let d=!1;for(const f in this.tiles){const y=this.tiles[f];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,d=!0)}d&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(i){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={}):i.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Ga extends wi{constructor(i,u,d,f){super(i,u,d,f),this.roundZoom=!0,this.type="video",this.options=u}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const i=this.options;this.urls=[];for(const u of i.urls)this.urls.push(this.map._requestManager.transformRequest(u,"Source").url);try{const u=yield c.a2(this.urls);if(this._loaded=!0,!u)return;this.video=u,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(u){this.fire(new c.j(u))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(i){if(this.video){const u=this.video.seekable;iu.end(0)?this.fire(new c.j(new c.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.end(0)}-second mark.`))):this.video.currentTime=i}}getVideo(){return this.video}onAdd(i){this.map||(this.map=i,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const i=this.map.painter.context,u=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,Oe.members)),this.boundsSegments||(this.boundsSegments=c.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new Nt(i,this.video,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let d=!1;for(const f in this.tiles){const y=this.tiles[f];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,d=!0)}d&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ja extends wi{constructor(i,u,d,f){super(i,u,d,f),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.coordinates.some(y=>!Array.isArray(y)||y.length!==2||y.some(w=>typeof w!="number"))||this.fire(new c.j(new c.a1(`sources.${i}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.a1(`sources.${i}`,null,'missing required property "coordinates"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new c.j(new c.a1(`sources.${i}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.a1(`sources.${i}`,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 c.j(new c.a1(`sources.${i}`,null,'missing required property "canvas"'))),this.options=u,this.animate=u.animate===void 0||u.animate}load(){return c._(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 c.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let i=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,i=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,i=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const u=this.map.painter.context,d=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,Oe.members)),this.boundsSegments||(this.boundsSegments=c.$.simpleSegment(0,0,4,2)),this.texture?(i||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Nt(u,this.canvas,d.RGBA,{premultiply:!0});let f=!1;for(const y in this.tiles){const w=this.tiles[y];w.state!=="loaded"&&(w.state="loaded",w.texture=this.texture,f=!0)}f&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const i of[this.canvas.width,this.canvas.height])if(isNaN(i)||i<=0)return!0;return!1}}const Za={},Ha=_=>{switch(_){case"geojson":return Us;case"image":return wi;case"raster":return xt;case"raster-dem":return hr;case"vector":return Pn;case"video":return Ga;case"canvas":return ja}return Za[_]},qs="RTLPluginLoaded";class Du extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Ji()}_syncState(i){return this.status=i,this.dispatcher.broadcast("SRPS",{pluginStatus:i,pluginURL:this.url}).catch(u=>{throw this.status="error",u})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(i){return c._(this,arguments,void 0,function*(u,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=k.resolveURL(u),!this.url)throw new Error(`requested url ${u} is invalid`);if(this.status==="unavailable"){if(!d)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(qs))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let da=null;function Ot(){return da||(da=new Du),da}class Zo{constructor(i,u){this.timeAdded=0,this.fadeEndTime=0,this.tileID=i,this.uid=c.a3(),this.uses=0,this.tileSize=u,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(i){const u=i+this.timeAdded;uy.getLayer(P)).filter(Boolean);if(C.length!==0){I.layers=C,I.stateDependentLayerIds&&(I.stateDependentLayers=I.stateDependentLayerIds.map(P=>C.filter(D=>D.id===P)[0]));for(const P of C)w[P.id]=I}}return w}(i.buckets,u.style),this.hasSymbolBuckets=!1;for(const f in this.buckets){const y=this.buckets[f];if(y instanceof c.a5){if(this.hasSymbolBuckets=!0,!d)break;y.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const f in this.buckets){const y=this.buckets[f];if(y instanceof c.a5&&y.hasRTLText){this.hasRTLText=!0,Ot().lazyLoad();break}}this.queryPadding=0;for(const f in this.buckets){const y=this.buckets[f];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(f).queryRadius(y))}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage)}else this.collisionBoxArray=new c.a4}unloadVectorData(){for(const i in this.buckets)this.buckets[i].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(i){return this.buckets[i.id]}upload(i){for(const d in this.buckets){const f=this.buckets[d];f.uploadPending()&&f.upload(i)}const u=i.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Nt(i,this.imageAtlas.image,u.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Nt(i,this.glyphAtlasImage,u.ALPHA),this.glyphAtlasImage=null)}prepare(i){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture)}queryRenderedFeatures(i,u,d,f,y,w,I,C,P,D){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:f,cameraQueryGeometry:y,scale:w,tileSize:this.tileSize,pixelPosMatrix:D,transform:C,params:I,queryPadding:this.queryPadding*P},i,u,d):{}}querySourceFeatures(i,u){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const f=d.loadVTLayers(),y=u&&u.sourceLayer?u.sourceLayer:"",w=f._geojsonTileLayer||f[y];if(!w)return;const I=c.a6(u&&u.filter),{z:C,x:P,y:D}=this.tileID.canonical,N={z:C,x:P,y:D};for(let V=0;Vd)f=!1;else if(u)if(this.expirationTime{this.remove(i,y)},d)),this.data[f].push(y),this.order.push(f),this.order.length>this.max){const w=this._getAndRemoveByKey(this.order[0]);w&&this.onRemove(w)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){const u=this.data[i].shift();return u.timeout&&clearTimeout(u.timeout),this.data[i].length===0&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),u.value}getByKey(i){const u=this.data[i];return u?u[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,u){if(!this.has(i))return this;const d=i.wrapped().key,f=u===void 0?0:this.data[d].indexOf(u),y=this.data[d][f];return this.data[d].splice(f,1),y.timeout&&clearTimeout(y.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(y.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){const u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}filter(i){const u=[];for(const d in this.data)for(const f of this.data[d])i(f.value)||u.push(f);for(const d of u)this.remove(d.value.tileID,d)}}class Dl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,u,d){const f=String(u);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][f]=this.stateChanges[i][f]||{},c.e(this.stateChanges[i][f],d),this.deletedStates[i]===null){this.deletedStates[i]={};for(const y in this.state[i])y!==f&&(this.deletedStates[i][y]=null)}else if(this.deletedStates[i]&&this.deletedStates[i][f]===null){this.deletedStates[i][f]={};for(const y in this.state[i][f])d[y]||(this.deletedStates[i][f][y]=null)}else for(const y in d)this.deletedStates[i]&&this.deletedStates[i][f]&&this.deletedStates[i][f][y]===null&&delete this.deletedStates[i][f][y]}removeFeatureState(i,u,d){if(this.deletedStates[i]===null)return;const f=String(u);if(this.deletedStates[i]=this.deletedStates[i]||{},d&&u!==void 0)this.deletedStates[i][f]!==null&&(this.deletedStates[i][f]=this.deletedStates[i][f]||{},this.deletedStates[i][f][d]=null);else if(u!==void 0)if(this.stateChanges[i]&&this.stateChanges[i][f])for(d in this.deletedStates[i][f]={},this.stateChanges[i][f])this.deletedStates[i][f][d]=null;else this.deletedStates[i][f]=null;else this.deletedStates[i]=null}getState(i,u){const d=String(u),f=c.e({},(this.state[i]||{})[d],(this.stateChanges[i]||{})[d]);if(this.deletedStates[i]===null)return{};if(this.deletedStates[i]){const y=this.deletedStates[i][u];if(y===null)return{};for(const w in y)delete f[w]}return f}initializeTileState(i,u){i.setFeatureState(this.state,u)}coalesceChanges(i,u){const d={};for(const f in this.stateChanges){this.state[f]=this.state[f]||{};const y={};for(const w in this.stateChanges[f])this.state[f][w]||(this.state[f][w]={}),c.e(this.state[f][w],this.stateChanges[f][w]),y[w]=this.state[f][w];d[f]=y}for(const f in this.deletedStates){this.state[f]=this.state[f]||{};const y={};if(this.deletedStates[f]===null)for(const w in this.state[f])y[w]={},this.state[f][w]={};else for(const w in this.deletedStates[f]){if(this.deletedStates[f][w]===null)this.state[f][w]={};else for(const I of Object.keys(this.deletedStates[f][w]))delete this.state[f][w][I];y[w]=this.state[f][w]}d[f]=d[f]||{},c.e(d[f],y)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const f in i)i[f].setFeatureState(d,u)}}class Qi extends c.E{constructor(i,u,d){super(),this.id=i,this.dispatcher=d,this.on("data",f=>this._dataHandler(f)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((f,y,w,I)=>{const C=new(Ha(y.type))(f,y,w,I);if(C.id!==f)throw new Error(`Expected Source id to be ${f} instead of ${C.id}`);return C})(i,u,d,this),this._tiles={},this._cache=new Ur(0,f=>this._unloadTile(f)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Dl,this._didEmitContent=!1,this._updated=!1}onAdd(i){this.map=i,this._maxTileCacheSize=i?i._maxTileCacheSize:null,this._maxTileCacheZoomLevels=i?i._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(i)}onRemove(i){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(i)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const i in this._tiles){const u=this._tiles[i];if(u.state!=="loaded"&&u.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(i,u,d){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(i),this._tileLoaded(i,u,d)}catch(f){i.state="errored",f.status!==404?this._source.fire(new c.j(f,{tile:i})):this.update(this.transform,this.terrain)}})}_unloadTile(i){this._source.unloadTile&&this._source.unloadTile(i)}_abortTile(i){this._source.abortTile&&this._source.abortTile(i),this._source.fire(new c.k("dataabort",{tile:i,coord:i.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(i){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const u in this._tiles){const d=this._tiles[u];d.upload(i),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(i=>i.tileID).sort(jt).map(i=>i.key)}getRenderableIds(i){const u=[];for(const d in this._tiles)this._isIdRenderable(d,i)&&u.push(this._tiles[d]);return i?u.sort((d,f)=>{const y=d.tileID,w=f.tileID,I=new c.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle),C=new c.P(w.canonical.x,w.canonical.y)._rotate(this.transform.angle);return y.overscaledZ-w.overscaledZ||C.y-I.y||C.x-I.x}).map(d=>d.tileID.key):u.map(d=>d.tileID).sort(jt).map(d=>d.key)}hasRenderableParent(i){const u=this.findLoadedParent(i,0);return!!u&&this._isIdRenderable(u.tileID.key)}_isIdRenderable(i,u){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(u||!this._tiles[i].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)this._tiles[i].state!=="errored"&&this._reloadTile(i,"reloading")}}_reloadTile(i,u){return c._(this,void 0,void 0,function*(){const d=this._tiles[i];d&&(d.state!=="loading"&&(d.state=u),yield this._loadTile(d,i,u))})}_tileLoaded(i,u,d){i.timeAdded=k.now(),d==="expired"&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(u,i),this.getSource().type==="raster-dem"&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),i.aborted||this._source.fire(new c.k("data",{dataType:"source",tile:i,coord:i.tileID}))}_backfillDEM(i){const u=this.getRenderableIds();for(let f=0;f1||(Math.abs(w)>1&&(Math.abs(w+C)===1?w+=C:Math.abs(w-C)===1&&(w-=C)),y.dem&&f.dem&&(f.dem.backfillBorder(y.dem,w,I),f.neighboringTiles&&f.neighboringTiles[P]&&(f.neighboringTiles[P].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,u,d,f){for(const y in this._tiles){let w=this._tiles[y];if(f[y]||!w.hasData()||w.tileID.overscaledZ<=u||w.tileID.overscaledZ>d)continue;let I=w.tileID;for(;w&&w.tileID.overscaledZ>u+1;){const P=w.tileID.scaledTo(w.tileID.overscaledZ-1);w=this._tiles[P.key],w&&w.hasData()&&(I=P)}let C=I;for(;C.overscaledZ>u;)if(C=C.scaledTo(C.overscaledZ-1),i[C.key]){f[I.key]=I;break}}}findLoadedParent(i,u){if(i.key in this._loadedParentTiles){const d=this._loadedParentTiles[i.key];return d&&d.tileID.overscaledZ>=u?d:null}for(let d=i.overscaledZ-1;d>=u;d--){const f=i.scaledTo(d),y=this._getLoadedTile(f);if(y)return y}}_getLoadedTile(i){const u=this._tiles[i.key];return u&&u.hasData()?u:this._cache.getByKey(i.wrapped().key)}updateCacheSize(i){const u=Math.ceil(i.width/this._source.tileSize)+1,d=Math.ceil(i.height/this._source.tileSize)+1,f=Math.floor(u*d*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,f):f;this._cache.setMaxSize(y)}handleWrapJump(i){const u=Math.round((i-(this._prevLng===void 0?i:this._prevLng))/360);if(this._prevLng=i,u){const d={};for(const f in this._tiles){const y=this._tiles[f];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+u),d[y.tileID.key]=y}this._tiles=d;for(const f in this._timers)clearTimeout(this._timers[f]),delete this._timers[f];for(const f in this._tiles)this._setTileReloadTimer(f,this._tiles[f])}}update(i,u){if(!this._sourceLoaded||this._paused)return;let d;this.transform=i,this.terrain=u,this.updateCacheSize(i),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(D=>new c.Q(D.canonical.z,D.wrap,D.canonical.z,D.canonical.x,D.canonical.y)):(d=i.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:u}),this._source.hasTile&&(d=d.filter(D=>this._source.hasTile(D)))):d=[];const f=i.coveringZoomLevel(this._source),y=Math.max(f-Qi.maxOverzooming,this._source.minzoom),w=Math.max(f+Qi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const D={};for(const N of d)if(N.canonical.z>this._source.minzoom){const V=N.scaledTo(N.canonical.z-1);D[V.key]=V;const X=N.scaledTo(Math.max(this._source.minzoom,Math.min(N.canonical.z,5)));D[X.key]=X}d=d.concat(Object.values(D))}const I=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,I&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const C=this._updateRetainedTiles(d,f);if(Ae(this._source.type)){const D={},N={},V=Object.keys(C),X=k.now();for(const W of V){const J=C[W],j=this._tiles[W];if(!j||j.fadeEndTime!==0&&j.fadeEndTime<=X)continue;const nt=this.findLoadedParent(J,y);nt&&(this._addTile(nt.tileID),D[nt.tileID.key]=nt.tileID),N[W]=J}this._retainLoadedChildren(N,f,w,C);for(const W in D)C[W]||(this._coveredTiles[W]=!0,C[W]=D[W]);if(u){const W={},J={};for(const j of d)this._tiles[j.key].hasData()?W[j.key]=j:J[j.key]=j;for(const j in J){const nt=J[j].children(this._source.maxzoom);this._tiles[nt[0].key]&&this._tiles[nt[1].key]&&this._tiles[nt[2].key]&&this._tiles[nt[3].key]&&(W[nt[0].key]=C[nt[0].key]=nt[0],W[nt[1].key]=C[nt[1].key]=nt[1],W[nt[2].key]=C[nt[2].key]=nt[2],W[nt[3].key]=C[nt[3].key]=nt[3],delete J[j])}for(const j in J){const nt=this.findLoadedParent(J[j],this._source.minzoom);if(nt){W[nt.tileID.key]=C[nt.tileID.key]=nt.tileID;for(const mt in W)W[mt].isChildOf(nt.tileID)&&delete W[mt]}}for(const j in this._tiles)W[j]||(this._coveredTiles[j]=!0)}}for(const D in C)this._tiles[D].clearFadeHold();const P=c.ab(this._tiles,C);for(const D of P){const N=this._tiles[D];N.hasSymbolBuckets&&!N.holdingForFade()?N.setHoldDuration(this.map._fadeDuration):N.hasSymbolBuckets&&!N.symbolFadeFinished()||this._removeTile(D)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(i)}_updateRetainedTiles(i,u){const d={},f={},y=Math.max(u-Qi.maxOverzooming,this._source.minzoom),w=Math.max(u+Qi.maxUnderzooming,this._source.minzoom),I={};for(const C of i){const P=this._addTile(C);d[C.key]=C,P.hasData()||uthis._source.maxzoom){const N=C.children(this._source.maxzoom)[0],V=this.getTile(N);if(V&&V.hasData()){d[N.key]=N;continue}}else{const N=C.children(this._source.maxzoom);if(d[N[0].key]&&d[N[1].key]&&d[N[2].key]&&d[N[3].key])continue}let D=P.wasRequested();for(let N=C.overscaledZ-1;N>=y;--N){const V=C.scaledTo(N);if(f[V.key])break;if(f[V.key]=!0,P=this.getTile(V),!P&&D&&(P=this._addTile(V)),P){const X=P.hasData();if((D||X)&&(d[V.key]=V),D=P.wasRequested(),X)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const i in this._tiles){const u=[];let d,f=this._tiles[i].tileID;for(;f.overscaledZ>0;){if(f.key in this._loadedParentTiles){d=this._loadedParentTiles[f.key];break}u.push(f.key);const y=f.scaledTo(f.overscaledZ-1);if(d=this._getLoadedTile(y),d)break;f=y}for(const y of u)this._loadedParentTiles[y]=d}}_addTile(i){let u=this._tiles[i.key];if(u)return u;u=this._cache.getAndRemove(i),u&&(this._setTileReloadTimer(i.key,u),u.tileID=i,this._state.initializeTileState(u,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,u)));const d=u;return u||(u=new Zo(i,this._source.tileSize*i.overscaleFactor()),this._loadTile(u,i.key,u.state)),u.uses++,this._tiles[i.key]=u,d||this._source.fire(new c.k("dataloading",{tile:u,coord:u.tileID,dataType:"source"})),u}_setTileReloadTimer(i,u){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);const d=u.getExpiryTimeout();d&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},d))}_removeTile(i){const u=this._tiles[i];u&&(u.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),u.uses>0||(u.hasData()&&u.state!=="reloading"?this._cache.add(u.tileID,u,u.getExpiryTimeout()):(u.aborted=!0,this._abortTile(u),this._unloadTile(u))))}_dataHandler(i){const u=i.sourceDataType;i.dataType==="source"&&u==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&i.dataType==="source"&&u==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const i in this._tiles)this._removeTile(i);this._cache.reset()}tilesIn(i,u,d){const f=[],y=this.transform;if(!y)return f;const w=d?y.getCameraQueryGeometry(i):i,I=i.map(W=>y.pointCoordinate(W,this.terrain)),C=w.map(W=>y.pointCoordinate(W,this.terrain)),P=this.getIds();let D=1/0,N=1/0,V=-1/0,X=-1/0;for(const W of C)D=Math.min(D,W.x),N=Math.min(N,W.y),V=Math.max(V,W.x),X=Math.max(X,W.y);for(let W=0;W=0&&Q[1].y+mt>=0){const st=I.map(yt=>j.getTilePoint(yt)),gt=C.map(yt=>j.getTilePoint(yt));f.push({tile:J,tileID:j,queryGeometry:st,cameraQueryGeometry:gt,scale:nt})}}return f}getVisibleCoordinates(i){const u=this.getRenderableIds(i).map(d=>this._tiles[d].tileID);for(const d of u)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return u}hasTransition(){if(this._source.hasTransition())return!0;if(Ae(this._source.type)){const i=k.now();for(const u in this._tiles)if(this._tiles[u].fadeEndTime>=i)return!0}return!1}setFeatureState(i,u,d){this._state.updateState(i=i||"_geojsonTileLayer",u,d)}removeFeatureState(i,u,d){this._state.removeFeatureState(i=i||"_geojsonTileLayer",u,d)}getFeatureState(i,u){return this._state.getState(i=i||"_geojsonTileLayer",u)}setDependencies(i,u,d){const f=this._tiles[i];f&&f.setDependencies(u,d)}reloadTilesForDependencies(i,u){for(const d in this._tiles)this._tiles[d].hasDependency(i,u)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(i,u))}}function jt(_,i){const u=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*i.wrap)-+(i.wrap<0);return _.overscaledZ-i.overscaledZ||d-u||i.canonical.y-_.canonical.y||i.canonical.x-_.canonical.x}function Ae(_){return _==="raster"||_==="image"||_==="video"}Qi.maxOverzooming=10,Qi.maxUnderzooming=3;class Ce{constructor(i,u){this.reset(i,u)}reset(i,u){this.points=i||[],this._distances=[0];for(let d=1;d0?(f-w)/I:0;return this.points[y].mult(1-C).add(this.points[u].mult(C))}}function fi(_,i){let u=!0;return _==="always"||_!=="never"&&i!=="never"||(u=!1),u}class Ho{constructor(i,u,d){const f=this.boxCells=[],y=this.circleCells=[];this.xCellCount=Math.ceil(i/d),this.yCellCount=Math.ceil(u/d);for(let w=0;wthis.width||f<0||u>this.height)return[];const C=[];if(i<=0&&u<=0&&this.width<=d&&this.height<=f){if(y)return[{key:null,x1:i,y1:u,x2:d,y2:f}];for(let P=0;P0}hitTestCircle(i,u,d,f,y){const w=i-d,I=i+d,C=u-d,P=u+d;if(I<0||w>this.width||P<0||C>this.height)return!1;const D=[];return this._forEachCell(w,C,I,P,this._queryCellCircle,D,{hitTest:!0,overlapMode:f,circle:{x:i,y:u,radius:d},seenUids:{box:{},circle:{}}},y),D.length>0}_queryCell(i,u,d,f,y,w,I,C){const{seenUids:P,hitTest:D,overlapMode:N}=I,V=this.boxCells[y];if(V!==null){const W=this.bboxes;for(const J of V)if(!P.box[J]){P.box[J]=!0;const j=4*J,nt=this.boxKeys[J];if(i<=W[j+2]&&u<=W[j+3]&&d>=W[j+0]&&f>=W[j+1]&&(!C||C(nt))&&(!D||!fi(N,nt.overlapMode))&&(w.push({key:nt,x1:W[j],y1:W[j+1],x2:W[j+2],y2:W[j+3]}),D))return!0}}const X=this.circleCells[y];if(X!==null){const W=this.circles;for(const J of X)if(!P.circle[J]){P.circle[J]=!0;const j=3*J,nt=this.circleKeys[J];if(this._circleAndRectCollide(W[j],W[j+1],W[j+2],i,u,d,f)&&(!C||C(nt))&&(!D||!fi(N,nt.overlapMode))){const mt=W[j],Q=W[j+1],st=W[j+2];if(w.push({key:nt,x1:mt-st,y1:Q-st,x2:mt+st,y2:Q+st}),D)return!0}}}return!1}_queryCellCircle(i,u,d,f,y,w,I,C){const{circle:P,seenUids:D,overlapMode:N}=I,V=this.boxCells[y];if(V!==null){const W=this.bboxes;for(const J of V)if(!D.box[J]){D.box[J]=!0;const j=4*J,nt=this.boxKeys[J];if(this._circleAndRectCollide(P.x,P.y,P.radius,W[j+0],W[j+1],W[j+2],W[j+3])&&(!C||C(nt))&&!fi(N,nt.overlapMode))return w.push(!0),!0}}const X=this.circleCells[y];if(X!==null){const W=this.circles;for(const J of X)if(!D.circle[J]){D.circle[J]=!0;const j=3*J,nt=this.circleKeys[J];if(this._circlesCollide(W[j],W[j+1],W[j+2],P.x,P.y,P.radius)&&(!C||C(nt))&&!fi(N,nt.overlapMode))return w.push(!0),!0}}}_forEachCell(i,u,d,f,y,w,I,C){const P=this._convertToXCellCoord(i),D=this._convertToYCellCoord(u),N=this._convertToXCellCoord(d),V=this._convertToYCellCoord(f);for(let X=P;X<=N;X++)for(let W=D;W<=V;W++)if(y.call(this,i,u,d,f,this.xCellCount*W+X,w,I,C))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,u,d,f,y,w){const I=f-i,C=y-u,P=d+w;return P*P>I*I+C*C}_circleAndRectCollide(i,u,d,f,y,w,I){const C=(w-f)/2,P=Math.abs(i-(f+C));if(P>C+d)return!1;const D=(I-y)/2,N=Math.abs(u-(y+D));if(N>D+d)return!1;if(P<=C||N<=D)return!0;const V=P-C,X=N-D;return V*V+X*X<=d*d}}function be(_,i,u,d,f){const y=c.F();return i?(c.J(y,y,[1/f,1/f,1]),u||c.ad(y,y,d.angle)):c.K(y,d.labelPlaneMatrix,_),y}function fa(_,i,u,d,f){if(i){const y=c.ae(_);return c.J(y,y,[f,f,1]),u||c.ad(y,y,-d.angle),y}return d.glCoordMatrix}function Ii(_,i,u){let d;u?(d=[_.x,_.y,u(_.x,_.y),1],c.af(d,d,i)):(d=[_.x,_.y,0,1],ee(d,d,i));const f=d[3];return{point:new c.P(d[0]/f,d[1]/f),signedDistanceFromCamera:f}}function K(_,i){return .5+_/i*.5}function z(_,i){const u=_[0]/_[3],d=_[1]/_[3];return u>=-i[0]&&u<=i[0]&&d>=-i[1]&&d<=i[1]}function F(_,i,u,d,f,y,w,I,C,P){const D=d?_.textSizeData:_.iconSizeData,N=c.ag(D,u.transform.zoom),V=[256/u.width*2+1,256/u.height*2+1],X=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;X.clear();const W=_.lineVertexArray,J=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,j=u.transform.width/u.transform.height;let nt=!1;for(let mt=0;mtMath.abs(u.x-i.x)*d?{useVertical:!0}:(_===c.ah.vertical?i.yu.x)?{needsFlipping:!0}:null}function it(_,i,u,d,f,y,w,I,C,P,D,N,V,X,W,J){const j=i/24,nt=_.lineOffsetX*j,mt=_.lineOffsetY*j;let Q;if(_.numGlyphs>1){const st=_.glyphStartIndex+_.numGlyphs,gt=_.lineStartIndex,yt=_.lineStartIndex+_.lineLength,wt=G(j,I,nt,mt,u,D,N,_,C,y,V,W,J);if(!wt)return{notEnoughRoom:!0};const At=Ii(wt.first.point,w,J).point,Pt=Ii(wt.last.point,w,J).point;if(d&&!u){const zt=H(_.writingMode,At,Pt,X);if(zt)return zt}Q=[wt.first];for(let zt=_.glyphStartIndex+1;zt0?At.point:rt(N,wt,gt,1,f,J),zt=H(_.writingMode,gt,Pt,X);if(zt)return zt}const st=Lt(j*I.getoffsetX(_.glyphStartIndex),nt,mt,u,D,N,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,C,y,V,W,J);if(!st)return{notEnoughRoom:!0};Q=[st]}for(const st of Q)c.aj(P,st.point,st.angle);return{}}function rt(_,i,u,d,f,y){const w=Ii(_.add(_.sub(i)._unit()),f,y).point,I=u.sub(w);return u.add(I._mult(d/I.mag()))}function lt(_,i){const{projectionCache:u,lineVertexArray:d,labelPlaneMatrix:f,tileAnchorPoint:y,distanceFromAnchor:w,getElevation:I,previousVertex:C,direction:P,absOffsetX:D}=i;if(u.projections[_])return u.projections[_];const N=new c.P(d.getx(_),d.gety(_)),V=Ii(N,f,I);if(V.signedDistanceFromCamera>0)return u.projections[_]=V.point,V.point;const X=_-P;return rt(w===0?y:new c.P(d.getx(X),d.gety(X)),N,C,D-w+1,f,I)}function et(_,i,u){return _._unit()._perp()._mult(i*u)}function pt(_,i,u,d,f,y,w,I){const{projectionCache:C,direction:P}=I;if(C.offsets[_])return C.offsets[_];const D=u.add(i);if(_+P=f)return C.offsets[_]=D,D;const N=lt(_+P,I),V=et(N.sub(u),w,P),X=u.add(V),W=N.add(V);return C.offsets[_]=c.ak(y,D,X,W)||D,C.offsets[_]}function Lt(_,i,u,d,f,y,w,I,C,P,D,N,V,X){const W=d?_-i:_+i;let J=W>0?1:-1,j=0;d&&(J*=-1,j=Math.PI),J<0&&(j+=Math.PI);let nt,mt,Q=J>0?I+w:I+w+1,st=f,gt=f,yt=0,wt=0;const At=Math.abs(W),Pt=[];let zt;for(;yt+wt<=At;){if(Q+=J,Q=C)return null;yt+=wt,gt=st,mt=nt;const Vt={projectionCache:N,lineVertexArray:P,labelPlaneMatrix:D,tileAnchorPoint:y,distanceFromAnchor:yt,getElevation:X,previousVertex:gt,direction:J,absOffsetX:At};if(st=lt(Q,Vt),u===0)Pt.push(gt),zt=st.sub(gt);else{let le;const Ee=st.sub(gt);le=Ee.mag()===0?et(lt(Q+J,Vt).sub(st),u,J):et(Ee,u,J),mt||(mt=gt.add(le)),nt=pt(Q,le,st,I,C,mt,u,Vt),Pt.push(mt),zt=nt.sub(mt)}wt=zt.mag()}const Bt=zt._mult((At-yt)/wt)._add(mt||gt),Ie=j+Math.atan2(st.y-gt.y,st.x-gt.x);return Pt.push(Bt),{point:Bt,angle:V?Ie:0,path:Pt}}const St=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ct(_,i){for(let u=0;u<_;u++){const d=i.length;i.resize(d+4),i.float32.set(St,3*d)}}function ee(_,i,u){const d=i[0],f=i[1];return _[0]=u[0]*d+u[4]*f+u[12],_[1]=u[1]*d+u[5]*f+u[13],_[3]=u[3]*d+u[7]*f+u[15],_}const se=100;class we{constructor(i,u=new Ho(i.width+200,i.height+200,25),d=new Ho(i.width+200,i.height+200,25)){this.transform=i,this.grid=u,this.ignoredGrid=d,this.pitchfactor=Math.cos(i._pitch)*i.cameraToCenterDistance,this.screenRightBoundary=i.width+se,this.screenBottomBoundary=i.height+se,this.gridRightBoundary=i.width+200,this.gridBottomBoundary=i.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(i,u,d,f,y,w){const I=this.projectAndGetPerspectiveRatio(f,i.anchorPointX,i.anchorPointY,w),C=d*I.perspectiveRatio,P=i.x1*C+I.point.x,D=i.y1*C+I.point.y,N=i.x2*C+I.point.x,V=i.y2*C+I.point.y;return!this.isInsideGrid(P,D,N,V)||u!=="always"&&this.grid.hitTest(P,D,N,V,u,y)||I.perspectiveRatio=1;Le--)Ee.push(Vt.path[Le]);for(let Le=1;LeIi(De,C,W));Ee=Le.some(De=>De.signedDistanceFromCamera<=0)?[]:Le.map(De=>De.point)}let fe=[];if(Ee.length>0){const Le=Ee[0].clone(),De=Ee[0].clone();for(let Kn=1;Kn=zt.x&&De.x<=Bt.x&&Le.y>=zt.y&&De.y<=Bt.y?[Ee]:De.xBt.x||De.yBt.y?[]:c.al([Ee],zt.x,zt.y,Bt.x,Bt.y)}for(const Le of fe){Ie.reset(Le,.25*Pt);let De=0;De=Ie.length<=.5*Pt?1:Math.ceil(Ie.paddedLength/je)+1;for(let Kn=0;Kn=this.screenRightBoundary||fthis.screenBottomBoundary}isInsideGrid(i,u,d,f){return d>=0&&i=0&&ud.collisionGroupID===u}}return this.collisionGroups[i]}}function Ei(_,i,u,d,f){const{horizontalAlign:y,verticalAlign:w}=c.at(_);return new c.P(-(y-.5)*i+d[0]*f,-(w-.5)*u+d[1]*f)}function pr(_,i,u,d,f,y){const{x1:w,x2:I,y1:C,y2:P,anchorPointX:D,anchorPointY:N}=_,V=new c.P(i,u);return d&&V._rotate(f?y:-y),{x1:w+V.x,y1:C+V.y,x2:I+V.x,y2:P+V.y,anchorPointX:D,anchorPointY:N}}class Cr{constructor(i,u,d,f,y){this.transform=i.clone(),this.terrain=u,this.collisionIndex=new we(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Wn(f),this.collisionCircleArrays={},this.prevPlacement=y,y&&(y.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(i,u,d,f){const y=d.getBucket(u),w=d.latestFeatureIndex;if(!y||!w||u.id!==y.layerIds[0])return;const I=d.collisionBoxArray,C=y.layers[0].layout,P=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),D=d.tileSize/c.W,N=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),V=C.get("text-pitch-alignment")==="map",X=C.get("text-rotation-alignment")==="map",W=_e(d,1,this.transform.zoom),J=be(N,V,X,this.transform,W);let j=null;if(V){const mt=fa(N,V,X,this.transform,W);j=c.K([],this.transform.labelPlaneMatrix,mt)}this.retainedQueryData[y.bucketInstanceId]=new Te(y.bucketInstanceId,w,y.sourceLayerIndex,y.index,d.tileID);const nt={bucket:y,layout:C,posMatrix:N,textLabelPlaneMatrix:J,labelToScreenMatrix:j,scale:P,textPixelRatio:D,holdingForFade:d.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:c.ag(y.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(y.sourceID)};if(f)for(const mt of y.sortKeyRanges){const{sortKey:Q,symbolInstanceStart:st,symbolInstanceEnd:gt}=mt;i.push({sortKey:Q,symbolInstanceStart:st,symbolInstanceEnd:gt,parameters:nt})}else i.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:nt})}attemptAnchorPlacement(i,u,d,f,y,w,I,C,P,D,N,V,X,W,J,j){const nt=c.ap[i.textAnchor],mt=[i.textOffset0,i.textOffset1],Q=Ei(nt,d,f,mt,y),st=this.collisionIndex.placeCollisionBox(pr(u,Q.x,Q.y,w,I,this.transform.angle),N,C,P,D.predicate,j);if((!J||this.collisionIndex.placeCollisionBox(pr(J,Q.x,Q.y,w,I,this.transform.angle),N,C,P,D.predicate,j).box.length!==0)&&st.box.length>0){let gt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[V.crossTileID]&&this.prevPlacement.placements[V.crossTileID]&&this.prevPlacement.placements[V.crossTileID].text&&(gt=this.prevPlacement.variableOffsets[V.crossTileID].anchor),V.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[V.crossTileID]={textOffset:mt,width:d,height:f,anchor:nt,textBoxScale:y,prevAnchor:gt},this.markUsedJustification(X,nt,V,W),X.allowVerticalPlacement&&(this.markUsedOrientation(X,W,V),this.placedOrientations[V.crossTileID]=W),{shift:Q,placedGlyphBoxes:st}}}placeLayerBucketPart(i,u,d){const{bucket:f,layout:y,posMatrix:w,textLabelPlaneMatrix:I,labelToScreenMatrix:C,textPixelRatio:P,holdingForFade:D,collisionBoxArray:N,partiallyEvaluatedTextSize:V,collisionGroup:X}=i.parameters,W=y.get("text-optional"),J=y.get("icon-optional"),j=c.aq(y,"text-overlap","text-allow-overlap"),nt=j==="always",mt=c.aq(y,"icon-overlap","icon-allow-overlap"),Q=mt==="always",st=y.get("text-rotation-alignment")==="map",gt=y.get("text-pitch-alignment")==="map",yt=y.get("icon-text-fit")!=="none",wt=y.get("symbol-z-order")==="viewport-y",At=nt&&(Q||!f.hasIconData()||J),Pt=Q&&(nt||!f.hasTextData()||W);!f.collisionArrays&&N&&f.deserializeCollisionBoxes(N);const zt=this.retainedQueryData[f.bucketInstanceId].tileID,Bt=this.terrain?(Vt,le)=>this.terrain.getElevation(zt,Vt,le):null,Ie=(Vt,le)=>{var Ee,je;if(u[Vt.crossTileID])return;if(D)return void(this.placements[Vt.crossTileID]=new Nn(!1,!1,!1));let fe=!1,Le=!1,De=!0,Kn=null,fn={box:null,offscreen:null},Zr={box:null,offscreen:null},Si=null,qn=null,Ci=null,Hr=0,Qo=0,Ys=0;le.textFeatureIndex?Hr=le.textFeatureIndex:Vt.useRuntimeCollisionCircles&&(Hr=Vt.featureIndex),le.verticalTextFeatureIndex&&(Qo=le.verticalTextFeatureIndex);const eu=le.textBox;if(eu){const _i=yi=>{let jn=c.ah.horizontal;if(f.allowVerticalPlacement&&!yi&&this.prevPlacement){const uo=this.prevPlacement.placedOrientations[Vt.crossTileID];uo&&(this.placedOrientations[Vt.crossTileID]=uo,jn=uo,this.markUsedOrientation(f,jn,Vt))}return jn},Gn=(yi,jn)=>{if(f.allowVerticalPlacement&&Vt.numVerticalGlyphVertices>0&&le.verticalTextBox){for(const uo of f.writingModes)if(uo===c.ah.vertical?(fn=jn(),Zr=fn):fn=yi(),fn&&fn.box&&fn.box.length)break}else fn=yi()},zn=Vt.textAnchorOffsetStartIndex,lo=Vt.textAnchorOffsetEndIndex;if(lo===zn){const yi=(jn,uo)=>{const vi=this.collisionIndex.placeCollisionBox(jn,j,P,w,X.predicate,Bt);return vi&&vi.box&&vi.box.length&&(this.markUsedOrientation(f,uo,Vt),this.placedOrientations[Vt.crossTileID]=uo),vi};Gn(()=>yi(eu,c.ah.horizontal),()=>{const jn=le.verticalTextBox;return f.allowVerticalPlacement&&Vt.numVerticalGlyphVertices>0&&jn?yi(jn,c.ah.vertical):{box:null,offscreen:null}}),_i(fn&&fn.box&&fn.box.length)}else{let yi=c.ap[(je=(Ee=this.prevPlacement)===null||Ee===void 0?void 0:Ee.variableOffsets[Vt.crossTileID])===null||je===void 0?void 0:je.anchor];const jn=(vi,ii,jh)=>{const zd=vi.x2-vi.x1,Ia=vi.y2-vi.y1,Ea=Vt.textBoxScale,yc=yt&&mt==="never"?ii:null;let Js={box:[],offscreen:!1},Zh=j==="never"?1:2,Od="never";yi&&Zh++;for(let Hh=0;Hhjn(eu,le.iconBox,c.ah.horizontal),()=>{const vi=le.verticalTextBox;return f.allowVerticalPlacement&&!(fn&&fn.box&&fn.box.length)&&Vt.numVerticalGlyphVertices>0&&vi?jn(vi,le.verticalIconBox,c.ah.vertical):{box:null,offscreen:null}}),fn&&(fe=fn.box,De=fn.offscreen);const uo=_i(fn&&fn.box);if(!fe&&this.prevPlacement){const vi=this.prevPlacement.variableOffsets[Vt.crossTileID];vi&&(this.variableOffsets[Vt.crossTileID]=vi,this.markUsedJustification(f,vi.anchor,Vt,uo))}}}if(Si=fn,fe=Si&&Si.box&&Si.box.length>0,De=Si&&Si.offscreen,Vt.useRuntimeCollisionCircles){const _i=f.text.placedSymbolArray.get(Vt.centerJustifiedTextSymbolIndex),Gn=c.ai(f.textSizeData,V,_i),zn=y.get("text-padding");qn=this.collisionIndex.placeCollisionCircles(j,_i,f.lineVertexArray,f.glyphOffsetArray,Gn,w,I,C,d,gt,X.predicate,Vt.collisionCircleDiameter,zn,Bt),qn.circles.length&&qn.collisionDetected&&!d&&c.w("Collisions detected, but collision boxes are not shown"),fe=nt||qn.circles.length>0&&!qn.collisionDetected,De=De&&qn.offscreen}if(le.iconFeatureIndex&&(Ys=le.iconFeatureIndex),le.iconBox){const _i=Gn=>{const zn=yt&&Kn?pr(Gn,Kn.x,Kn.y,st,gt,this.transform.angle):Gn;return this.collisionIndex.placeCollisionBox(zn,mt,P,w,X.predicate,Bt)};Zr&&Zr.box&&Zr.box.length&&le.verticalIconBox?(Ci=_i(le.verticalIconBox),Le=Ci.box.length>0):(Ci=_i(le.iconBox),Le=Ci.box.length>0),De=De&&Ci.offscreen}const Ks=W||Vt.numHorizontalGlyphVertices===0&&Vt.numVerticalGlyphVertices===0,$o=J||Vt.numIconVertices===0;if(Ks||$o?$o?Ks||(Le=Le&&fe):fe=Le&&fe:Le=fe=Le&&fe,fe&&Si&&Si.box&&this.collisionIndex.insertCollisionBox(Si.box,j,y.get("text-ignore-placement"),f.bucketInstanceId,Zr&&Zr.box&&Qo?Qo:Hr,X.ID),Le&&Ci&&this.collisionIndex.insertCollisionBox(Ci.box,mt,y.get("icon-ignore-placement"),f.bucketInstanceId,Ys,X.ID),qn&&(fe&&this.collisionIndex.insertCollisionCircles(qn.circles,j,y.get("text-ignore-placement"),f.bucketInstanceId,Hr,X.ID),d)){const _i=f.bucketInstanceId;let Gn=this.collisionCircleArrays[_i];Gn===void 0&&(Gn=this.collisionCircleArrays[_i]=new mi);for(let zn=0;zn=0;--le){const Ee=Vt[le];Ie(f.symbolInstances.get(Ee),f.collisionArrays[Ee])}}else for(let Vt=i.symbolInstanceStart;Vt=0&&(i.text.placedSymbolArray.get(I).crossTileID=y>=0&&I!==y?0:d.crossTileID)}markUsedOrientation(i,u,d){const f=u===c.ah.horizontal||u===c.ah.horizontalOnly?u:0,y=u===c.ah.vertical?u:0,w=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const I of w)i.text.placedSymbolArray.get(I).placedOrientation=f;d.verticalPlacedTextSymbolIndex&&(i.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=y)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;const u=this.prevPlacement;let d=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;const f=u?u.symbolFadeChange(i):1,y=u?u.opacities:{},w=u?u.variableOffsets:{},I=u?u.placedOrientations:{};for(const C in this.placements){const P=this.placements[C],D=y[C];D?(this.opacities[C]=new gn(D,f,P.text,P.icon),d=d||P.text!==D.text.placed||P.icon!==D.icon.placed):(this.opacities[C]=new gn(null,f,P.text,P.icon,P.skipFade),d=d||P.text||P.icon)}for(const C in y){const P=y[C];if(!this.opacities[C]){const D=new gn(P,f,!1,!1);D.isHidden()||(this.opacities[C]=D,d=d||P.text.placed||P.icon.placed)}}for(const C in w)this.variableOffsets[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.variableOffsets[C]=w[C]);for(const C in I)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=I[C]);if(u&&u.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=i:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=u?u.lastPlacementChangeTime:i)}updateLayerOpacities(i,u){const d={};for(const f of u){const y=f.getBucket(i);y&&f.latestFeatureIndex&&i.id===y.layerIds[0]&&this.updateBucketOpacities(y,d,f.collisionBoxArray)}}updateBucketOpacities(i,u,d){i.hasTextData()&&(i.text.opacityVertexArray.clear(),i.text.hasVisibleVertices=!1),i.hasIconData()&&(i.icon.opacityVertexArray.clear(),i.icon.hasVisibleVertices=!1),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexArray.clear(),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexArray.clear();const f=i.layers[0],y=f.layout,w=new gn(null,0,!1,!1,!0),I=y.get("text-allow-overlap"),C=y.get("icon-allow-overlap"),P=f._unevaluatedLayout.hasValue("text-variable-anchor")||f._unevaluatedLayout.hasValue("text-variable-anchor-offset"),D=y.get("text-rotation-alignment")==="map",N=y.get("text-pitch-alignment")==="map",V=y.get("icon-text-fit")!=="none",X=new gn(null,0,I&&(C||!i.hasIconData()||y.get("icon-optional")),C&&(I||!i.hasTextData()||y.get("text-optional")),!0);!i.collisionArrays&&d&&(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData())&&i.deserializeCollisionBoxes(d);const W=(J,j,nt)=>{for(let mt=0;mt0,yt=this.placedOrientations[j.crossTileID],wt=yt===c.ah.vertical,At=yt===c.ah.horizontal||yt===c.ah.horizontalOnly;if(nt>0||mt>0){const Pt=Tr(st.text);W(i.text,nt,wt?Rl:Pt),W(i.text,mt,At?Rl:Pt);const zt=st.text.isHidden();[j.rightJustifiedTextSymbolIndex,j.centerJustifiedTextSymbolIndex,j.leftJustifiedTextSymbolIndex].forEach(Vt=>{Vt>=0&&(i.text.placedSymbolArray.get(Vt).hidden=zt||wt?1:0)}),j.verticalPlacedTextSymbolIndex>=0&&(i.text.placedSymbolArray.get(j.verticalPlacedTextSymbolIndex).hidden=zt||At?1:0);const Bt=this.variableOffsets[j.crossTileID];Bt&&this.markUsedJustification(i,Bt.anchor,j,yt);const Ie=this.placedOrientations[j.crossTileID];Ie&&(this.markUsedJustification(i,"left",j,Ie),this.markUsedOrientation(i,Ie,j))}if(gt){const Pt=Tr(st.icon),zt=!(V&&j.verticalPlacedIconSymbolIndex&&wt);j.placedIconSymbolIndex>=0&&(W(i.icon,j.numIconVertices,zt?Pt:Rl),i.icon.placedSymbolArray.get(j.placedIconSymbolIndex).hidden=st.icon.isHidden()),j.verticalPlacedIconSymbolIndex>=0&&(W(i.icon,j.numVerticalIconVertices,zt?Rl:Pt),i.icon.placedSymbolArray.get(j.verticalPlacedIconSymbolIndex).hidden=st.icon.isHidden())}if(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData()){const Pt=i.collisionArrays[J];if(Pt){let zt=new c.P(0,0);if(Pt.textBox||Pt.verticalTextBox){let Ie=!0;if(P){const Vt=this.variableOffsets[Q];Vt?(zt=Ei(Vt.anchor,Vt.width,Vt.height,Vt.textOffset,Vt.textBoxScale),D&&zt._rotate(N?this.transform.angle:-this.transform.angle)):Ie=!1}Pt.textBox&&zi(i.textCollisionBox.collisionVertexArray,st.text.placed,!Ie||wt,zt.x,zt.y),Pt.verticalTextBox&&zi(i.textCollisionBox.collisionVertexArray,st.text.placed,!Ie||At,zt.x,zt.y)}const Bt=!!(!At&&Pt.verticalIconBox);Pt.iconBox&&zi(i.iconCollisionBox.collisionVertexArray,st.icon.placed,Bt,V?zt.x:0,V?zt.y:0),Pt.verticalIconBox&&zi(i.iconCollisionBox.collisionVertexArray,st.icon.placed,!Bt,V?zt.x:0,V?zt.y:0)}}}if(i.sortFeatures(this.transform.angle),this.retainedQueryData[i.bucketInstanceId]&&(this.retainedQueryData[i.bucketInstanceId].featureSortOrder=i.featureSortOrder),i.hasTextData()&&i.text.opacityVertexBuffer&&i.text.opacityVertexBuffer.updateData(i.text.opacityVertexArray),i.hasIconData()&&i.icon.opacityVertexBuffer&&i.icon.opacityVertexBuffer.updateData(i.icon.opacityVertexArray),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexBuffer&&i.iconCollisionBox.collisionVertexBuffer.updateData(i.iconCollisionBox.collisionVertexArray),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexBuffer&&i.textCollisionBox.collisionVertexBuffer.updateData(i.textCollisionBox.collisionVertexArray),i.text.opacityVertexArray.length!==i.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${i.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${i.text.layoutVertexArray.length}) / 4`);if(i.icon.opacityVertexArray.length!==i.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${i.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${i.icon.layoutVertexArray.length}) / 4`);if(i.bucketInstanceId in this.collisionCircleArrays){const J=this.collisionCircleArrays[i.bucketInstanceId];i.placementInvProjMatrix=J.invProjMatrix,i.placementViewportMatrix=J.viewportMatrix,i.collisionCircleArray=J.circles,delete this.collisionCircleArrays[i.bucketInstanceId]}}symbolFadeChange(i){return this.fadeDuration===0?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return this.stale||i-this.lastPlacementChangeTimei}setStale(){this.stale=!0}}function zi(_,i,u,d,f){_.emplaceBack(i?1:0,u?1:0,d||0,f||0),_.emplaceBack(i?1:0,u?1:0,d||0,f||0),_.emplaceBack(i?1:0,u?1:0,d||0,f||0),_.emplaceBack(i?1:0,u?1:0,d||0,f||0)}const Wo=Math.pow(2,25),$p=Math.pow(2,24),kf=Math.pow(2,17),pn=Math.pow(2,16),ph=Math.pow(2,9),dh=Math.pow(2,8),qr=Math.pow(2,1);function Tr(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const i=_.placed?1:0,u=Math.floor(127*_.opacity);return u*Wo+i*$p+u*kf+i*pn+u*ph+i*dh+u*qr+i}const Rl=0;class so{constructor(i){this._sortAcrossTiles=i.layout.get("symbol-z-order")!=="viewport-y"&&!i.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(i,u,d,f,y){const w=this._bucketParts;for(;this._currentTileIndexI.sortKey-C.sortKey));this._currentPartIndex!this._forceFullPlacement&&k.now()-f>2;for(;this._currentPlacementIndex>=0;){const w=u[i[this._currentPlacementIndex]],I=this.placement.collisionIndex.transform.zoom;if(w.type==="symbol"&&(!w.minzoom||w.minzoom<=I)&&(!w.maxzoom||w.maxzoom>I)){if(this._inProgressLayer||(this._inProgressLayer=new so(w)),this._inProgressLayer.continuePlacement(d[w.source],this.placement,this._showCollisionBoxes,w,y))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(i){return this.placement.commit(i),this.placement}}const Wa=512/c.W/2;class Ru{constructor(i,u,d){this.tileID=i,this.bucketInstanceId=d,this._symbolsByKey={};const f=new Map;for(let y=0;y({x:Math.floor(C.anchorX*Wa),y:Math.floor(C.anchorY*Wa)})),crossTileIDs:w.map(C=>C.crossTileID)};if(I.positions.length>128){const C=new c.au(I.positions.length,16,Uint16Array);for(const{x:P,y:D}of I.positions)C.add(P,D);C.finish(),delete I.positions,I.index=C}this._symbolsByKey[y]=I}}getScaledCoordinates(i,u){const{x:d,y:f,z:y}=this.tileID.canonical,{x:w,y:I,z:C}=u.canonical,P=Wa/Math.pow(2,C-y),D=(I*c.W+i.anchorY)*P,N=f*c.W*Wa;return{x:Math.floor((w*c.W+i.anchorX)*P-d*c.W*Wa),y:Math.floor(D-N)}}findMatches(i,u,d){const f=this.tileID.canonical.zi)}}class gi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Nl{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(i){const u=Math.round((i-this.lng)/360);if(u!==0)for(const d in this.indexes){const f=this.indexes[d],y={};for(const w in f){const I=f[w];I.tileID=I.tileID.unwrapTo(I.tileID.wrap+u),y[I.tileID.key]=I}this.indexes[d]=y}this.lng=i}addBucket(i,u,d){if(this.indexes[i.overscaledZ]&&this.indexes[i.overscaledZ][i.key]){if(this.indexes[i.overscaledZ][i.key].bucketInstanceId===u.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(i.overscaledZ,this.indexes[i.overscaledZ][i.key])}for(let y=0;yi.overscaledZ)for(const I in w){const C=w[I];C.tileID.isChildOf(i)&&C.findMatches(u.symbolInstances,i,f)}else{const I=w[i.scaledTo(Number(y)).key];I&&I.findMatches(u.symbolInstances,i,f)}}for(let y=0;y{u[d]=!0});for(const d in this.layerIndexes)u[d]||delete this.layerIndexes[d]}}const Un=(_,i)=>c.t(_,i&&i.filter(u=>u.identifier!=="source.canvas")),Nu=c.av();class Gr extends c.E{constructor(i,u={}){super(),this._rtlPluginLoaded=()=>{for(const d in this.sourceCaches){const f=this.sourceCaches[d].getSource().type;f!=="vector"&&f!=="geojson"||this.sourceCaches[d].reload()}},this.map=i,this.dispatcher=new Vn(wn(),i._getMapId()),this.dispatcher.registerMessageHandler("GG",(d,f)=>this.getGlyphs(d,f)),this.dispatcher.registerMessageHandler("GI",(d,f)=>this.getImages(d,f)),this.imageManager=new Re,this.imageManager.setEventedParent(this),this.glyphManager=new ce(i._requestManager,u.localIdeographFontFamily),this.lineAtlas=new hn(256,512),this.crossTileSymbolIndex=new Gs,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.ax()),Ot().on(qs,this._rtlPluginLoaded),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const f=this.sourceCaches[d.sourceId];if(!f)return;const y=f.getSource();if(y&&y.vectorLayerIds)for(const w in this._layers){const I=this._layers[w];I.source===y.id&&this._validateLayer(I)}})}loadURL(i,u={},d){this.fire(new c.k("dataloading",{dataType:"style"})),u.validate=typeof u.validate!="boolean"||u.validate;const f=this.map._requestManager.transformRequest(i,"Style");this._loadStyleRequest=new AbortController,c.h(f,this._loadStyleRequest).then(y=>{this._loadStyleRequest=null,this._load(y.data,u,d)}).catch(y=>{this._loadStyleRequest=null,y&&this.fire(new c.j(y))})}loadJSON(i,u={},d){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,k.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,u.validate=u.validate!==!1,this._load(i,u,d)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(Nu,{validate:!1})}_load(i,u,d){var f;const y=u.transformStyle?u.transformStyle(d,i):i;if(!u.validate||!Un(this,c.x(y))){this._loaded=!0,this.stylesheet=y;for(const w in y.sources)this.addSource(w,y.sources[w],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new Tn(this.stylesheet.light),this.map.setTerrain((f=this.stylesheet.terrain)!==null&&f!==void 0?f:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const i=c.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",i),this._order=i.map(u=>u.id),this._layers={},this._serializedLayers=null;for(const u of i){const d=c.az(u);d.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=d}}_loadSprite(i,u=!1,d=void 0){let f;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(y,w,I,C){return c._(this,void 0,void 0,function*(){const P=ve(y),D=I>1?"@2x":"",N={},V={};for(const{id:X,url:W}of P){const J=w.transformRequest(w.normalizeSpriteURL(W,D,".json"),"SpriteJSON");N[X]=c.h(J,C);const j=w.transformRequest(w.normalizeSpriteURL(W,D,".png"),"SpriteImage");V[X]=Gt.getImage(j,C)}return yield Promise.all([...Object.values(N),...Object.values(V)]),function(X,W){return c._(this,void 0,void 0,function*(){const J={};for(const j in X){J[j]={};const nt=k.getImageCanvasContext((yield W[j]).data),mt=(yield X[j]).data;for(const Q in mt){const{width:st,height:gt,x:yt,y:wt,sdf:At,pixelRatio:Pt,stretchX:zt,stretchY:Bt,content:Ie}=mt[Q];J[j][Q]={data:null,pixelRatio:Pt,sdf:At,stretchX:zt,stretchY:Bt,content:Ie,spriteData:{width:st,height:gt,x:yt,y:wt,context:nt}}}}return J})}(N,V)})}(i,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(y=>{if(this._spriteRequest=null,y)for(const w in y){this._spritesImagesIds[w]=[];const I=this._spritesImagesIds[w]?this._spritesImagesIds[w].filter(C=>!(C in y)):[];for(const C of I)this.imageManager.removeImage(C),this._changedImages[C]=!0;for(const C in y[w]){const P=w==="default"?C:`${w}:${C}`;this._spritesImagesIds[w].push(P),P in this.imageManager.images?this.imageManager.updateImage(P,y[w][C],!1):this.imageManager.addImage(P,y[w][C]),u&&(this._changedImages[P]=!0)}}}).catch(y=>{this._spriteRequest=null,f=y,this.fire(new c.j(f))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),u&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),d&&d(f)})}_unloadSprite(){for(const i of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(i),this._changedImages[i]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(i){const u=this.sourceCaches[i.source];if(!u)return;const d=i.sourceLayer;if(!d)return;const f=u.getSource();(f.type==="geojson"||f.vectorLayerIds&&f.vectorLayerIds.indexOf(d)===-1)&&this.fire(new c.j(new Error(`Source layer "${d}" does not exist on source "${f.id}" as specified by style layer "${i.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const i in this.sourceCaches)if(!this.sourceCaches[i].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(i){const u=this._serializedAllLayers();if(!i||i.length===0)return Object.values(u);const d=[];for(const f of i)u[f]&&d.push(u[f]);return d}_serializedAllLayers(){let i=this._serializedLayers;if(i)return i;i=this._serializedLayers={};const u=Object.keys(this._layers);for(const d of u){const f=this._layers[d];f.type!=="custom"&&(i[d]=f.serialize())}return i}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const i in this.sourceCaches)if(this.sourceCaches[i].hasTransition())return!0;for(const i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(i){if(!this._loaded)return;const u=this._changed;if(u){const f=Object.keys(this._updatedLayers),y=Object.keys(this._removedLayers);(f.length||y.length)&&this._updateWorkerLayers(f,y);for(const w in this._updatedSources){const I=this._updatedSources[w];if(I==="reload")this._reloadSource(w);else{if(I!=="clear")throw new Error(`Invalid action ${I}`);this._clearSource(w)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const w in this._updatedPaintProps)this._layers[w].updateTransitions(i);this.light.updateTransitions(i),this._resetUpdates()}const d={};for(const f in this.sourceCaches){const y=this.sourceCaches[f];d[f]=y.used,y.used=!1}for(const f of this._order){const y=this._layers[f];y.recalculate(i,this._availableImages),!y.isHidden(i.zoom)&&y.source&&(this.sourceCaches[y.source].used=!0)}for(const f in d){const y=this.sourceCaches[f];!!d[f]!=!!y.used&&y.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:f}))}this.light.recalculate(i),this.z=i.zoom,u&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const i=Object.keys(this._changedImages);if(i.length){for(const u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["icons","patterns"],i);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const i in this.sourceCaches)this.sourceCaches[i].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(i,u){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(i),removedIds:u})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(i,u={}){var d;this._checkLoaded();const f=this.serialize();if(i=u.transformStyle?u.transformStyle(f,i):i,((d=u.validate)===null||d===void 0||d)&&Un(this,c.x(i)))return!1;(i=c.aA(i)).layers=c.ay(i.layers);const y=c.aB(f,i),w=this._getOperationsToPerform(y);if(w.unimplemented.length>0)throw new Error(`Unimplemented: ${w.unimplemented.join(", ")}.`);if(w.operations.length===0)return!1;for(const I of w.operations)I();return this.stylesheet=i,this._serializedLayers=null,!0}_getOperationsToPerform(i){const u=[],d=[];for(const f of i)switch(f.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":u.push(()=>this.addLayer.apply(this,f.args));break;case"removeLayer":u.push(()=>this.removeLayer.apply(this,f.args));break;case"setPaintProperty":u.push(()=>this.setPaintProperty.apply(this,f.args));break;case"setLayoutProperty":u.push(()=>this.setLayoutProperty.apply(this,f.args));break;case"setFilter":u.push(()=>this.setFilter.apply(this,f.args));break;case"addSource":u.push(()=>this.addSource.apply(this,f.args));break;case"removeSource":u.push(()=>this.removeSource.apply(this,f.args));break;case"setLayerZoomRange":u.push(()=>this.setLayerZoomRange.apply(this,f.args));break;case"setLight":u.push(()=>this.setLight.apply(this,f.args));break;case"setGeoJSONSourceData":u.push(()=>this.setGeoJSONSourceData.apply(this,f.args));break;case"setGlyphs":u.push(()=>this.setGlyphs.apply(this,f.args));break;case"setSprite":u.push(()=>this.setSprite.apply(this,f.args));break;case"setTerrain":u.push(()=>this.map.setTerrain.apply(this,f.args));break;case"setTransition":u.push(()=>{});break;default:d.push(f.command)}return{operations:u,unimplemented:d}}addImage(i,u){if(this.getImage(i))return this.fire(new c.j(new Error(`An image named "${i}" already exists.`)));this.imageManager.addImage(i,u),this._afterImageUpdated(i)}updateImage(i,u){this.imageManager.updateImage(i,u)}getImage(i){return this.imageManager.getImage(i)}removeImage(i){if(!this.getImage(i))return this.fire(new c.j(new Error(`An image named "${i}" does not exist.`)));this.imageManager.removeImage(i),this._afterImageUpdated(i)}_afterImageUpdated(i){this._availableImages=this.imageManager.listImages(),this._changedImages[i]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(i,u,d={}){if(this._checkLoaded(),this.sourceCaches[i]!==void 0)throw new Error(`Source "${i}" already exists.`);if(!u.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(u).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(u.type)>=0&&this._validate(c.x.source,`sources.${i}`,u,null,d))return;this.map&&this.map._collectResourceTiming&&(u.collectResourceTiming=!0);const f=this.sourceCaches[i]=new Qi(i,u,this.dispatcher);f.style=this,f.setEventedParent(this,()=>({isSourceLoaded:f.loaded(),source:f.serialize(),sourceId:i})),f.onAdd(this.map),this._changed=!0}removeSource(i){if(this._checkLoaded(),this.sourceCaches[i]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===i)return this.fire(new c.j(new Error(`Source "${i}" cannot be removed while layer "${d}" is using it.`)));const u=this.sourceCaches[i];delete this.sourceCaches[i],delete this._updatedSources[i],u.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:i})),u.setEventedParent(null),u.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(i,u){if(this._checkLoaded(),this.sourceCaches[i]===void 0)throw new Error(`There is no source with this ID=${i}`);const d=this.sourceCaches[i].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(u),this._changed=!0}getSource(i){return this.sourceCaches[i]&&this.sourceCaches[i].getSource()}addLayer(i,u,d={}){this._checkLoaded();const f=i.id;if(this.getLayer(f))return void this.fire(new c.j(new Error(`Layer "${f}" already exists on this map.`)));let y;if(i.type==="custom"){if(Un(this,c.aC(i)))return;y=c.az(i)}else{if("source"in i&&typeof i.source=="object"&&(this.addSource(f,i.source),i=c.aA(i),i=c.e(i,{source:f})),this._validate(c.x.layer,`layers.${f}`,i,{arrayIndex:-1},d))return;y=c.az(i),this._validateLayer(y),y.setEventedParent(this,{layer:{id:f}})}const w=u?this._order.indexOf(u):this._order.length;if(u&&w===-1)this.fire(new c.j(new Error(`Cannot add layer "${f}" before non-existing layer "${u}".`)));else{if(this._order.splice(w,0,f),this._layerOrderChanged=!0,this._layers[f]=y,this._removedLayers[f]&&y.source&&y.type!=="custom"){const I=this._removedLayers[f];delete this._removedLayers[f],I.type!==y.type?this._updatedSources[y.source]="clear":(this._updatedSources[y.source]="reload",this.sourceCaches[y.source].pause())}this._updateLayer(y),y.onAdd&&y.onAdd(this.map)}}moveLayer(i,u){if(this._checkLoaded(),this._changed=!0,!this._layers[i])return void this.fire(new c.j(new Error(`The layer '${i}' does not exist in the map's style and cannot be moved.`)));if(i===u)return;const d=this._order.indexOf(i);this._order.splice(d,1);const f=u?this._order.indexOf(u):this._order.length;u&&f===-1?this.fire(new c.j(new Error(`Cannot move layer "${i}" before non-existing layer "${u}".`))):(this._order.splice(f,0,i),this._layerOrderChanged=!0)}removeLayer(i){this._checkLoaded();const u=this._layers[i];if(!u)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${i}".`)));u.setEventedParent(null);const d=this._order.indexOf(i);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[i]=u,delete this._layers[i],this._serializedLayers&&delete this._serializedLayers[i],delete this._updatedLayers[i],delete this._updatedPaintProps[i],u.onRemove&&u.onRemove(this.map)}getLayer(i){return this._layers[i]}getLayersOrder(){return[...this._order]}hasLayer(i){return i in this._layers}setLayerZoomRange(i,u,d){this._checkLoaded();const f=this.getLayer(i);f?f.minzoom===u&&f.maxzoom===d||(u!=null&&(f.minzoom=u),d!=null&&(f.maxzoom=d),this._updateLayer(f)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${i}".`)))}setFilter(i,u,d={}){this._checkLoaded();const f=this.getLayer(i);if(f){if(!c.aD(f.filter,u))return u==null?(f.filter=void 0,void this._updateLayer(f)):void(this._validate(c.x.filter,`layers.${f.id}.filter`,u,null,d)||(f.filter=c.aA(u),this._updateLayer(f)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${i}".`)))}getFilter(i){return c.aA(this.getLayer(i).filter)}setLayoutProperty(i,u,d,f={}){this._checkLoaded();const y=this.getLayer(i);y?c.aD(y.getLayoutProperty(u),d)||(y.setLayoutProperty(u,d,f),this._updateLayer(y)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${i}".`)))}getLayoutProperty(i,u){const d=this.getLayer(i);if(d)return d.getLayoutProperty(u);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${i}".`)))}setPaintProperty(i,u,d,f={}){this._checkLoaded();const y=this.getLayer(i);y?c.aD(y.getPaintProperty(u),d)||(y.setPaintProperty(u,d,f)&&this._updateLayer(y),this._changed=!0,this._updatedPaintProps[i]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${i}".`)))}getPaintProperty(i,u){return this.getLayer(i).getPaintProperty(u)}setFeatureState(i,u){this._checkLoaded();const d=i.source,f=i.sourceLayer,y=this.sourceCaches[d];if(y===void 0)return void this.fire(new c.j(new Error(`The source '${d}' does not exist in the map's style.`)));const w=y.getSource().type;w==="geojson"&&f?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):w!=="vector"||f?(i.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),y.setFeatureState(f,i.id,u)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(i,u){this._checkLoaded();const d=i.source,f=this.sourceCaches[d];if(f===void 0)return void this.fire(new c.j(new Error(`The source '${d}' does not exist in the map's style.`)));const y=f.getSource().type,w=y==="vector"?i.sourceLayer:void 0;y!=="vector"||w?u&&typeof i.id!="string"&&typeof i.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):f.removeFeatureState(w,i.id,u):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(i){this._checkLoaded();const u=i.source,d=i.sourceLayer,f=this.sourceCaches[u];if(f!==void 0)return f.getSource().type!=="vector"||d?(i.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),f.getFeatureState(d,i.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${u}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const i=c.aE(this.sourceCaches,y=>y.serialize()),u=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,f=this.stylesheet;return c.aF({version:f.version,name:f.name,metadata:f.metadata,light:f.light,center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch,sprite:f.sprite,glyphs:f.glyphs,transition:f.transition,sources:i,layers:u,terrain:d},y=>y!==void 0)}_updateLayer(i){this._updatedLayers[i.id]=!0,i.source&&!this._updatedSources[i.source]&&this.sourceCaches[i.source].getSource().type!=="raster"&&(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(i){const u=w=>this._layers[w].type==="fill-extrusion",d={},f=[];for(let w=this._order.length-1;w>=0;w--){const I=this._order[w];if(u(I)){d[I]=w;for(const C of i){const P=C[I];if(P)for(const D of P)f.push(D)}}}f.sort((w,I)=>I.intersectionZ-w.intersectionZ);const y=[];for(let w=this._order.length-1;w>=0;w--){const I=this._order[w];if(u(I))for(let C=f.length-1;C>=0;C--){const P=f[C].feature;if(d[P.layer.id]{const At=nt.featureSortOrder;if(At){const Pt=At.indexOf(yt.featureIndex);return At.indexOf(wt.featureIndex)-Pt}return wt.featureIndex-yt.featureIndex});for(const yt of gt)st.push(yt)}}for(const nt in W)W[nt].forEach(mt=>{const Q=mt.feature,st=P[I[nt].source].getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=st});return W}(this._layers,w,this.sourceCaches,i,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(y)}querySourceFeatures(i,u){u&&u.filter&&this._validate(c.x.filter,"querySourceFeatures.filter",u.filter,null,u);const d=this.sourceCaches[i];return d?function(f,y){const w=f.getRenderableIds().map(P=>f.getTileByID(P)),I=[],C={};for(let P=0;PV.getTileByID(X)).sort((X,W)=>W.tileID.overscaledZ-X.tileID.overscaledZ||(X.tileID.isLessThan(W.tileID)?-1:1))}const N=this.crossTileSymbolIndex.addLayer(D,C[D.source],i.center.lng);w=w||N}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((y=y||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(k.now(),i.zoom))&&(this.pauseablePlacement=new ao(i,this.map.terrain,this._order,y,u,d,f,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,C),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(k.now()),I=!0),w&&this.pauseablePlacement.placement.setStale()),I||w)for(const P of this._order){const D=this._layers[P];D.type==="symbol"&&this.placement.updateLayerOpacities(D,C[D.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(k.now())}_releaseSymbolFadeTiles(){for(const i in this.sourceCaches)this.sourceCaches[i].releaseSymbolFadeTiles()}getImages(i,u){return c._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(u.icons);this._updateTilesForChangedImages();const f=this.sourceCaches[u.source];return f&&f.setDependencies(u.tileID.key,u.type,u.icons),d})}getGlyphs(i,u){return c._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(u.stacks),f=this.sourceCaches[u.source];return f&&f.setDependencies(u.tileID.key,u.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(i,u={}){this._checkLoaded(),i&&this._validate(c.x.glyphs,"glyphs",i,null,u)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=i,this.glyphManager.entries={},this.glyphManager.setURL(i))}addSprite(i,u,d={},f){this._checkLoaded();const y=[{id:i,url:u}],w=[...ve(this.stylesheet.sprite),...y];this._validate(c.x.sprite,"sprite",w,null,d)||(this.stylesheet.sprite=w,this._loadSprite(y,!0,f))}removeSprite(i){this._checkLoaded();const u=ve(this.stylesheet.sprite);if(u.find(d=>d.id===i)){if(this._spritesImagesIds[i])for(const d of this._spritesImagesIds[i])this.imageManager.removeImage(d),this._changedImages[d]=!0;u.splice(u.findIndex(d=>d.id===i),1),this.stylesheet.sprite=u.length>0?u:void 0,delete this._spritesImagesIds[i],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${i}" doesn't exists on this map.`)))}getSprite(){return ve(this.stylesheet.sprite)}setSprite(i,u={},d){this._checkLoaded(),i&&this._validate(c.x.sprite,"sprite",i,null,u)||(this.stylesheet.sprite=i,i?this._loadSprite(i,!0,d):(this._unloadSprite(),d&&d(null)))}}var ku=c.X([{name:"a_pos",type:"Int16",components:2}]),Xo="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const kl={prelude:dn(`#ifdef GL_ES + */(function(t,e){(function(r,s){t.exports=s()})(hb,function(){var r={},s={};function l(m,c,S){if(s[m]=S,m==="index"){var L="var sharedModule = {}; ("+s.shared+")(sharedModule); ("+s.worker+")(sharedModule);",R={};return s.shared(R),s.index(r,R),typeof window<"u"&&r.setWorkerUrl(window.URL.createObjectURL(new Blob([L],{type:"text/javascript"}))),r}}l("shared",["exports"],function(m){function c(o,n,a,h){return new(a||(a=Promise))(function(g,v){function x(T){try{E(h.next(T))}catch(A){v(A)}}function b(T){try{E(h.throw(T))}catch(A){v(A)}}function E(T){var A;T.done?g(T.value):(A=T.value,A instanceof a?A:new a(function(M){M(A)})).then(x,b)}E((h=h.apply(o,n||[])).next())})}function S(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}typeof SuppressedError=="function"&&SuppressedError;var L=R;function R(o,n){this.x=o,this.y=n}R.prototype={clone:function(){return new R(this.x,this.y)},add:function(o){return this.clone()._add(o)},sub:function(o){return this.clone()._sub(o)},multByPoint:function(o){return this.clone()._multByPoint(o)},divByPoint:function(o){return this.clone()._divByPoint(o)},mult:function(o){return this.clone()._mult(o)},div:function(o){return this.clone()._div(o)},rotate:function(o){return this.clone()._rotate(o)},rotateAround:function(o,n){return this.clone()._rotateAround(o,n)},matMult:function(o){return this.clone()._matMult(o)},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(o){return this.x===o.x&&this.y===o.y},dist:function(o){return Math.sqrt(this.distSqr(o))},distSqr:function(o){var n=o.x-this.x,a=o.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(o){return Math.atan2(this.y-o.y,this.x-o.x)},angleWith:function(o){return this.angleWithSep(o.x,o.y)},angleWithSep:function(o,n){return Math.atan2(this.x*n-this.y*o,this.x*o+this.y*n)},_matMult:function(o){var n=o[2]*this.x+o[3]*this.y;return this.x=o[0]*this.x+o[1]*this.y,this.y=n,this},_add:function(o){return this.x+=o.x,this.y+=o.y,this},_sub:function(o){return this.x-=o.x,this.y-=o.y,this},_mult:function(o){return this.x*=o,this.y*=o,this},_div:function(o){return this.x/=o,this.y/=o,this},_multByPoint:function(o){return this.x*=o.x,this.y*=o.y,this},_divByPoint:function(o){return this.x/=o.x,this.y/=o.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var o=this.y;return this.y=this.x,this.x=-o,this},_rotate:function(o){var n=Math.cos(o),a=Math.sin(o),h=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=h,this},_rotateAround:function(o,n){var a=Math.cos(o),h=Math.sin(o),g=n.y+h*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-h*(this.y-n.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},R.convert=function(o){return o instanceof R?o:Array.isArray(o)?new R(o[0],o[1]):o};var k=S(L),U=ut;function ut(o,n,a,h){this.cx=3*o,this.bx=3*(a-o)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(h-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=o,this.p1y=n,this.p2x=a,this.p2y=h}ut.prototype={sampleCurveX:function(o){return((this.ax*o+this.bx)*o+this.cx)*o},sampleCurveY:function(o){return((this.ay*o+this.by)*o+this.cy)*o},sampleCurveDerivativeX:function(o){return(3*this.ax*o+2*this.bx)*o+this.cx},solveCurveX:function(o,n){if(n===void 0&&(n=1e-6),o<0)return 0;if(o>1)return 1;for(var a=o,h=0;h<8;h++){var g=this.sampleCurveX(a)-o;if(Math.abs(g)g?x=a:b=a,a=.5*(b-x)+x;return a},solve:function(o,n){return this.sampleCurveY(this.solveCurveX(o,n))}};var pt=S(U);let vt,bt;function Dt(){return vt==null&&(vt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),vt}function Rt(){if(bt==null&&(bt=!1,Dt())){const n=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(n){for(let h=0;h<5*5;h++){const g=4*h;n.fillStyle=`rgb(${g},${g+1},${g+2})`,n.fillRect(h%5,Math.floor(h/5),1,1)}const a=n.getImageData(0,0,5,5).data;for(let h=0;h<5*5*4;h++)if(h%4!=3&&a[h]!==h){bt=!0;break}}}return bt||!1}function Gt(o,n,a,h){const g=new pt(o,n,a,h);return function(v){return g.solve(v)}}const se=Gt(.25,.1,.25,1);function de(o,n,a){return Math.min(a,Math.max(n,o))}function Ve(o,n,a){const h=a-n,g=((o-n)%h+h)%h+n;return g===n?a:g}function he(o,...n){for(const a of n)for(const h in a)o[h]=a[h];return o}let Me=1;function _e(o,n,a){const h={};for(const g in o)h[g]=n.call(a||this,o[g],g,o);return h}function be(o,n,a){const h={};for(const g in o)n.call(a||this,o[g],g,o)&&(h[g]=o[g]);return h}function Nt(o){return Array.isArray(o)?o.map(Nt):typeof o=="object"&&o?_e(o,Nt):o}const sn={};function ke(o){sn[o]||(typeof console<"u"&&console.warn(o),sn[o]=!0)}function ye(o,n,a){return(a.y-o.y)*(n.x-o.x)>(n.y-o.y)*(a.x-o.x)}function Xe(o){let n=0;for(let a,h,g=0,v=o.length,x=v-1;g"u")throw new Error("VideoFrame not supported");const v=new VideoFrame(o,{timestamp:0});try{const x=v==null?void 0:v.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const b=x.startsWith("BGR"),E=new Uint8ClampedArray(h*g*4);if(yield v.copyTo(E,function(T,A,M,O,B){const q=4*Math.max(-A,0),Z=(Math.max(0,M)-M)*O*4+q,Y=4*O,$=Math.max(0,A),lt=Math.max(0,M);return{rect:{x:$,y:lt,width:Math.min(T.width,A+O)-$,height:Math.min(T.height,M+B)-lt},layout:[{offset:Z,stride:Y}]}}(o,n,a,h,g)),b)for(let T=0;TCn(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,li=function(o,n){if(/:\/\//.test(o.url)&&!/^https?:|^file:/.test(o.url)){const h=Ue(o.url);if(h)return h(o,n);if(Cn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:o,targetMapId:gn},n)}if(!(/^file:/.test(a=o.url)||/^file:/.test(gi())&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(h,g){return c(this,void 0,void 0,function*(){const v=new Request(h.url,{method:h.method||"GET",body:h.body,credentials:h.credentials,headers:h.headers,cache:h.cache,referrer:gi(),signal:g.signal});h.type==="json"&&v.headers.set("Accept","application/json");const x=yield fetch(v);if(!x.ok){const T=yield x.blob();throw new Rn(x.status,x.statusText,h.url,T)}let b;b=h.type==="arrayBuffer"||h.type==="image"?x.arrayBuffer():h.type==="json"?x.json():x.text();const E=yield b;if(g.signal.aborted)throw In();return{data:E,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(o,n);if(Cn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:o,mustQueue:!0,targetMapId:gn},n)}var a;return function(h,g){return new Promise((v,x)=>{const b=new XMLHttpRequest;b.open(h.method||"GET",h.url,!0),h.type!=="arrayBuffer"&&h.type!=="image"||(b.responseType="arraybuffer");for(const E in h.headers)b.setRequestHeader(E,h.headers[E]);h.type==="json"&&(b.responseType="text",b.setRequestHeader("Accept","application/json")),b.withCredentials=h.credentials==="include",b.onerror=()=>{x(new Error(b.statusText))},b.onload=()=>{if(!g.signal.aborted)if((b.status>=200&&b.status<300||b.status===0)&&b.response!==null){let E=b.response;if(h.type==="json")try{E=JSON.parse(b.response)}catch(T){return void x(T)}v({data:E,cacheControl:b.getResponseHeader("Cache-Control"),expires:b.getResponseHeader("Expires")})}else{const E=new Blob([b.response],{type:b.getResponseHeader("Content-Type")});x(new Rn(b.status,b.statusText,h.url,E))}},g.signal.addEventListener("abort",()=>{b.abort(),x(In())}),b.send(h.body)})}(o,n)};function Wn(o){if(!o||o.indexOf("://")<=0||o.indexOf("data:image/")===0||o.indexOf("blob:")===0)return!0;const n=new URL(o),a=window.location;return n.protocol===a.protocol&&n.host===a.host}function ii(o,n,a){a[o]&&a[o].indexOf(n)!==-1||(a[o]=a[o]||[],a[o].push(n))}function jt(o,n,a){if(a&&a[o]){const h=a[o].indexOf(n);h!==-1&&a[o].splice(h,1)}}class St{constructor(n,a={}){he(this,a),this.type=n}}class ui extends St{constructor(n,a={}){super("error",he({error:n},a))}}class Nn{on(n,a){return this._listeners=this._listeners||{},ii(n,a,this._listeners),this}off(n,a){return jt(n,a,this._listeners),jt(n,a,this._oneTimeListeners),this}once(n,a){return a?(this._oneTimeListeners=this._oneTimeListeners||{},ii(n,a,this._oneTimeListeners),this):new Promise(h=>this.once(n,h))}fire(n,a){typeof n=="string"&&(n=new St(n,a||{}));const h=n.type;if(this.listens(h)){n.target=this;const g=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(const b of g)b.call(this,n);const v=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(const b of v)jt(h,b,this._oneTimeListeners),b.call(this,n);const x=this._eventedParent;x&&(he(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(n))}else n instanceof ui&&console.error(n.error);return this}listens(n){return this._listeners&&this._listeners[n]&&this._listeners[n].length>0||this._oneTimeListeners&&this._oneTimeListeners[n]&&this._oneTimeListeners[n].length>0||this._eventedParent&&this._eventedParent.listens(n)}setEventedParent(n,a){return this._eventedParent=n,this._eventedParentData=a,this}}var _t={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",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-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-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}},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 Zi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ct(o,n){const a={};for(const h in o)h!=="ref"&&(a[h]=o[h]);return Zi.forEach(h=>{h in n&&(a[h]=n[h])}),a}function Jt(o,n){if(Array.isArray(o)){if(!Array.isArray(n)||o.length!==n.length)return!1;for(let a=0;a`:o.itemType.kind==="value"?"array":`array<${n}>`}return o.kind}const it=[tr,Zt,De,Le,_i,Ei,Xo,G(Ie),K,z,F];function rt(o,n){if(n.kind==="error")return null;if(o.kind==="array"){if(n.kind==="array"&&(n.N===0&&n.itemType.kind==="value"||!rt(o.itemType,n.itemType))&&(typeof o.N!="number"||o.N===n.N))return null}else{if(o.kind===n.kind)return null;if(o.kind==="value"){for(const a of it)if(!rt(a,n))return null}}return`Expected ${H(o)} but found ${H(n)} instead.`}function at(o,n){return n.some(a=>a.kind===o.kind)}function et(o,n){return n.some(a=>a==="null"?o===null:a==="array"?Array.isArray(o):a==="object"?o&&!Array.isArray(o)&&typeof o=="object":a===typeof o)}function ht(o,n){return o.kind==="array"&&n.kind==="array"?o.itemType.kind===n.itemType.kind&&typeof o.N=="number":o.kind===n.kind}const Lt=.96422,It=.82521,Et=4/29,ie=6/29,le=3*ie*ie,Ee=ie*ie*ie,ve=Math.PI/180,je=180/Math.PI;function _n(o){return(o%=360)<0&&(o+=360),o}function kn([o,n,a,h]){let g,v;const x=Pe((.2225045*(o=yi(o))+.7168786*(n=yi(n))+.0606169*(a=yi(a)))/1);o===n&&n===a?g=v=x:(g=Pe((.4360747*o+.3850649*n+.1430804*a)/Lt),v=Pe((.0139322*o+.0971045*n+.7141733*a)/It));const b=116*x-16;return[b<0?0:b,500*(g-x),200*(x-v),h]}function yi(o){return o<=.04045?o/12.92:Math.pow((o+.055)/1.055,2.4)}function Pe(o){return o>Ee?Math.pow(o,1/3):o/le+Et}function Xn([o,n,a,h]){let g=(o+16)/116,v=isNaN(n)?g:g+n/500,x=isNaN(a)?g:g-a/200;return g=1*dr(g),v=Lt*dr(v),x=It*dr(x),[Si(3.1338561*v-1.6168667*g-.4906146*x),Si(-.9787684*v+1.9161415*g+.033454*x),Si(.0719453*v-.2289914*g+1.4052427*x),h]}function Si(o){return(o=o<=.00304?12.92*o:1.055*Math.pow(o,1/2.4)-.055)<0?0:o>1?1:o}function dr(o){return o>ie?o*o*o:le*(o-Et)}function Tr(o){return parseInt(o.padEnd(2,o),16)/255}function Oi(o,n){return Yo(n?o/100:o,0,1)}function Yo(o,n,a){return Math.min(Math.max(n,o),a)}function $p(o){return!o.some(Number.isNaN)}const kf={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class pn{constructor(n,a,h,g=1,v=!0){this.r=n,this.g=a,this.b=h,this.a=g,v||(this.r*=g,this.g*=g,this.b*=g,g||this.overwriteGetter("rgb",[n,a,h,g]))}static parse(n){if(n instanceof pn)return n;if(typeof n!="string")return;const a=function(h){if((h=h.toLowerCase().trim())==="transparent")return[0,0,0,0];const g=kf[h];if(g){const[x,b,E]=g;return[x/255,b/255,E/255,1]}if(h.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(h)){const x=h.length<6?1:2;let b=1;return[Tr(h.slice(b,b+=x)),Tr(h.slice(b,b+=x)),Tr(h.slice(b,b+=x)),Tr(h.slice(b,b+x)||"ff")]}if(h.startsWith("rgb")){const x=h.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[b,E,T,A,M,O,B,q,Z,Y,$,lt]=x,tt=[A||" ",B||" ",Y].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const ot=[T,O,Z].join(""),wt=ot==="%%%"?100:ot===""?255:0;if(wt){const Tt=[Yo(+E/wt,0,1),Yo(+M/wt,0,1),Yo(+q/wt,0,1),$?Oi(+$,lt):1];if($p(Tt))return Tt}}return}}const v=h.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[x,b,E,T,A,M,O,B,q]=v,Z=[E||" ",A||" ",O].join("");if(Z===" "||Z===" /"||Z===",,"||Z===",,,"){const Y=[+b,Yo(+T,0,100),Yo(+M,0,100),B?Oi(+B,q):1];if($p(Y))return function([$,lt,tt,ot]){function wt(Tt){const Yt=(Tt+$/30)%12,te=lt*Math.min(tt,1-tt);return tt-te*Math.max(-1,Math.min(Yt-3,9-Yt,1))}return $=_n($),lt/=100,tt/=100,[wt(0),wt(8),wt(4),ot]}(Y)}}}(n);return a?new pn(...a,!1):void 0}get rgb(){const{r:n,g:a,b:h,a:g}=this,v=g||1/0;return this.overwriteGetter("rgb",[n/v,a/v,h/v,g])}get hcl(){return this.overwriteGetter("hcl",function(n){const[a,h,g,v]=kn(n),x=Math.sqrt(h*h+g*g);return[Math.round(1e4*x)?_n(Math.atan2(g,h)*je):NaN,x,a,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",kn(this.rgb))}overwriteGetter(n,a){return Object.defineProperty(this,n,{value:a}),a}toString(){const[n,a,h,g]=this.rgb;return`rgba(${[n,a,h].map(v=>Math.round(255*v)).join(",")},${g})`}}pn.black=new pn(0,0,0,1),pn.white=new pn(1,1,1,1),pn.transparent=new pn(0,0,0,0),pn.red=new pn(1,0,0,1);class ph{constructor(n,a,h){this.sensitivity=n?a?"variant":"case":a?"accent":"base",this.locale=h,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(n,a){return this.collator.compare(n,a)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class dh{constructor(n,a,h,g,v){this.text=n,this.image=a,this.scale=h,this.fontStack=g,this.textColor=v}}class Gr{constructor(n){this.sections=n}static fromString(n){return new Gr([new dh(n,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(n=>n.text.length!==0||n.image&&n.image.name.length!==0)}static factory(n){return n instanceof Gr?n:Gr.fromString(n)}toString(){return this.sections.length===0?"":this.sections.map(n=>n.text).join("")}}class Lr{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Lr)return n;if(typeof n=="number")return new Lr([n,n,n,n]);if(Array.isArray(n)&&!(n.length<1||n.length>4)){for(const a of n)if(typeof a!="number")return;switch(n.length){case 1:n=[n[0],n[0],n[0],n[0]];break;case 2:n=[n[0],n[1],n[0],n[1]];break;case 3:n=[n[0],n[1],n[2],n[1]]}return new Lr(n)}}toString(){return JSON.stringify(this.values)}}const Rl=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ao{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof ao)return n;if(Array.isArray(n)&&!(n.length<1)&&n.length%2==0){for(let a=0;a=0&&o<=255&&typeof n=="number"&&n>=0&&n<=255&&typeof a=="number"&&a>=0&&a<=255?h===void 0||typeof h=="number"&&h>=0&&h<=1?null:`Invalid rgba value [${[o,n,a,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof h=="number"?[o,n,a,h]:[o,n,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ru(o){if(o===null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"||o instanceof pn||o instanceof ph||o instanceof Gr||o instanceof Lr||o instanceof ao||o instanceof lo)return!0;if(Array.isArray(o)){for(const n of o)if(!Ru(n))return!1;return!0}if(typeof o=="object"){for(const n in o)if(!Ru(o[n]))return!1;return!0}return!1}function vi(o){if(o===null)return tr;if(typeof o=="string")return De;if(typeof o=="boolean")return Le;if(typeof o=="number")return Zt;if(o instanceof pn)return _i;if(o instanceof ph)return ma;if(o instanceof Gr)return Ei;if(o instanceof Lr)return K;if(o instanceof ao)return F;if(o instanceof lo)return z;if(Array.isArray(o)){const n=o.length;let a;for(const h of o){const g=vi(h);if(a){if(a===g)continue;a=Ie;break}a=g}return G(a||Ie,n)}return Xo}function Nl(o){const n=typeof o;return o===null?"":n==="string"||n==="number"||n==="boolean"?String(o):o instanceof pn||o instanceof Gr||o instanceof Lr||o instanceof ao||o instanceof lo?o.toString():JSON.stringify(o)}class js{constructor(n,a){this.type=n,this.value=a}static parse(n,a){if(n.length!==2)return a.error(`'literal' expression requires exactly one argument, but found ${n.length-1} instead.`);if(!Ru(n[1]))return a.error("invalid value");const h=n[1];let g=vi(h);const v=a.expectedType;return g.kind!=="array"||g.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(g=v),new js(g,h)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Un{constructor(n){this.name="ExpressionEvaluationError",this.message=n}toJSON(){return this.message}}const Nu={string:De,number:Zt,boolean:Le,object:Xo};class jr{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");let h,g=1;const v=n[0];if(v==="array"){let b,E;if(n.length>2){const T=n[1];if(typeof T!="string"||!(T in Nu)||T==="object")return a.error('The item type argument of "array" must be one of string, number, boolean',1);b=Nu[T],g++}else b=Ie;if(n.length>3){if(n[2]!==null&&(typeof n[2]!="number"||n[2]<0||n[2]!==Math.floor(n[2])))return a.error('The length argument to "array" must be a positive integer literal',2);E=n[2],g++}h=G(b,E)}else{if(!Nu[v])throw new Error(`Types doesn't contain name = ${v}`);h=Nu[v]}const x=[];for(;gn.outputDefined())}}const ku={"to-boolean":Le,"to-color":_i,"to-number":Zt,"to-string":De};class Ko{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const h=n[0];if(!ku[h])throw new Error(`Can't parse ${h} as it is not part of the known types`);if((h==="to-boolean"||h==="to-string")&&n.length!==2)return a.error("Expected one argument.");const g=ku[h],v=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:Xa(a[0],a[1],a[2],a[3]),!h))return new pn(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new Un(h||`Could not parse color from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"padding":{let a;for(const h of this.args){a=h.evaluate(n);const g=Lr.parse(a);if(g)return g}throw new Un(`Could not parse padding from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"variableAnchorOffsetCollection":{let a;for(const h of this.args){a=h.evaluate(n);const g=ao.parse(a);if(g)return g}throw new Un(`Could not parse variableAnchorOffsetCollection from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"number":{let a=null;for(const h of this.args){if(a=h.evaluate(n),a===null)return 0;const g=Number(a);if(!isNaN(g))return g}throw new Un(`Could not convert ${JSON.stringify(a)} to number.`)}case"formatted":return Gr.fromString(Nl(this.args[0].evaluate(n)));case"resolvedImage":return lo.fromString(Nl(this.args[0].evaluate(n)));default:return Nl(this.args[0].evaluate(n))}}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}const kl=["Unknown","Point","LineString","Polygon"];class dn{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?typeof this.feature.type=="number"?kl[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(n){let a=this._parseColorCache[n];return a||(a=this._parseColorCache[n]=pn.parse(n)),a}}class zu{constructor(n,a,h=[],g,v=new Dl,x=[]){this.registry=n,this.path=h,this.key=h.map(b=>`[${b}]`).join(""),this.scope=v,this.errors=x,this.expectedType=g,this._isConstant=a}parse(n,a,h,g,v={}){return a?this.concat(a,h,g)._parse(n,v):this._parse(n,v)}_parse(n,a){function h(g,v,x){return x==="assert"?new jr(v,[g]):x==="coerce"?new Ko(v,[g]):g}if(n!==null&&typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"||(n=["literal",n]),Array.isArray(n)){if(n.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=n[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[g];if(v){let x=v.parse(n,this);if(!x)return null;if(this.expectedType){const b=this.expectedType,E=x.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||E.kind!=="value")if(b.kind!=="color"&&b.kind!=="formatted"&&b.kind!=="resolvedImage"||E.kind!=="value"&&E.kind!=="string")if(b.kind!=="padding"||E.kind!=="value"&&E.kind!=="number"&&E.kind!=="array")if(b.kind!=="variableAnchorOffsetCollection"||E.kind!=="value"&&E.kind!=="array"){if(this.checkSubtype(b,E))return null}else x=h(x,b,a.typeAnnotation||"coerce");else x=h(x,b,a.typeAnnotation||"coerce");else x=h(x,b,a.typeAnnotation||"coerce");else x=h(x,b,a.typeAnnotation||"assert")}if(!(x instanceof js)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const b=new dn;try{x=new js(x.type,x.evaluate(b))}catch(E){return this.error(E.message),null}}return x}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(n===void 0?"'undefined' value invalid. Use null instead.":typeof n=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof n} instead.`)}concat(n,a,h){const g=typeof n=="number"?this.path.concat(n):this.path,v=h?this.scope.concat(h):this.scope;return new zu(this.registry,this._isConstant,g,a||null,v,this.errors)}error(n,...a){const h=`${this.key}${a.map(g=>`[${g}]`).join("")}`;this.errors.push(new qr(h,n))}checkSubtype(n,a){const h=rt(n,a);return h&&this.error(h),h}}class Ya{constructor(n,a,h){this.type=ma,this.locale=h,this.caseSensitive=n,this.diacriticSensitive=a}static parse(n,a){if(n.length!==2)return a.error("Expected one argument.");const h=n[1];if(typeof h!="object"||Array.isArray(h))return a.error("Collator options argument must be an object.");const g=a.parse(h["case-sensitive"]!==void 0&&h["case-sensitive"],1,Le);if(!g)return null;const v=a.parse(h["diacritic-sensitive"]!==void 0&&h["diacritic-sensitive"],1,Le);if(!v)return null;let x=null;return h.locale&&(x=a.parse(h.locale,1,De),!x)?null:new Ya(g,v,x)}evaluate(n){return new ph(this.caseSensitive.evaluate(n),this.diacriticSensitive.evaluate(n),this.locale?this.locale.evaluate(n):null)}eachChild(n){n(this.caseSensitive),n(this.diacriticSensitive),this.locale&&n(this.locale)}outputDefined(){return!1}}const Zs=8192;function Ou(o,n){o[0]=Math.min(o[0],n[0]),o[1]=Math.min(o[1],n[1]),o[2]=Math.max(o[2],n[0]),o[3]=Math.max(o[3],n[1])}function zl(o,n){return!(o[0]<=n[0]||o[2]>=n[2]||o[1]<=n[1]||o[3]>=n[3])}function zf(o,n){const a=(180+o[0])/360,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o[1]*Math.PI/360)))/360,g=Math.pow(2,n.z);return[Math.round(a*g*Zs),Math.round(h*g*Zs)]}function td(o,n,a){const h=o[0]-n[0],g=o[1]-n[1],v=o[0]-a[0],x=o[1]-a[1];return h*x-v*g==0&&h*v<=0&&g*x<=0}function Fu(o,n){let a=!1;for(let x=0,b=n.length;x(h=o)[1]!=(v=E[T+1])[1]>h[1]&&h[0]<(v[0]-g[0])*(h[1]-g[1])/(v[1]-g[1])+g[0]&&(a=!a)}}var h,g,v;return a}function Of(o,n){for(let a=0;a0&&b<0||x<0&&b>0}function Ff(o,n,a){for(const T of a)for(let A=0;Aa[2]){const g=.5*h;let v=o[0]-a[0]>g?-h:a[0]-o[0]>g?h:0;v===0&&(v=o[0]-a[2]>g?-h:a[2]-o[0]>g?h:0),o[0]+=v}Ou(n,o)}function Vu(o,n,a,h){const g=Math.pow(2,h.z)*Zs,v=[h.x*Zs,h.y*Zs],x=[];for(const b of o)for(const E of b){const T=[E.x+v[0],E.y+v[1]];od(T,n,a,g),x.push(T)}return x}function sd(o,n,a,h){const g=Math.pow(2,h.z)*Zs,v=[h.x*Zs,h.y*Zs],x=[];for(const E of o){const T=[];for(const A of E){const M=[A.x+v[0],A.y+v[1]];Ou(n,M),T.push(M)}x.push(T)}if(n[2]-n[0]<=g/2){(b=n)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const E of x)for(const T of E)od(T,n,a,g)}var b;return x}class ga{constructor(n,a){this.type=Le,this.geojson=n,this.geometries=a}static parse(n,a){if(n.length!==2)return a.error(`'within' expression requires exactly one argument, but found ${n.length-1} instead.`);if(Ru(n[1])){const h=n[1];if(h.type==="FeatureCollection"){const g=[];for(const v of h.features){const{type:x,coordinates:b}=v.geometry;x==="Polygon"&&g.push(b),x==="MultiPolygon"&&g.push(...b)}if(g.length)return new ga(h,{type:"MultiPolygon",coordinates:g})}else if(h.type==="Feature"){const g=h.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new ga(h,h.geometry)}else if(h.type==="Polygon"||h.type==="MultiPolygon")return new ga(h,h)}return a.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(a,h){const g=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],x=a.canonicalID();if(h.type==="Polygon"){const b=Bu(h.coordinates,v,x),E=Vu(a.geometry(),g,v,x);if(!zl(g,v))return!1;for(const T of E)if(!Fu(T,b))return!1}if(h.type==="MultiPolygon"){const b=rd(h.coordinates,v,x),E=Vu(a.geometry(),g,v,x);if(!zl(g,v))return!1;for(const T of E)if(!Of(T,b))return!1}return!0}(n,this.geometries);if(n.geometryType()==="LineString")return function(a,h){const g=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],x=a.canonicalID();if(h.type==="Polygon"){const b=Bu(h.coordinates,v,x),E=sd(a.geometry(),g,v,x);if(!zl(g,v))return!1;for(const T of E)if(!nd(T,b))return!1}if(h.type==="MultiPolygon"){const b=rd(h.coordinates,v,x),E=sd(a.geometry(),g,v,x);if(!zl(g,v))return!1;for(const T of E)if(!id(T,b))return!1}return!0}(n,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Uu{constructor(n,a){this.type=a.type,this.name=n,this.boundExpression=a}static parse(n,a){if(n.length!==2||typeof n[1]!="string")return a.error("'var' expression requires exactly one string literal argument.");const h=n[1];return a.scope.has(h)?new Uu(h,a.scope.get(h)):a.error(`Unknown variable "${h}". Make sure "${h}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(n){return this.boundExpression.evaluate(n)}eachChild(){}outputDefined(){return!1}}class Zr{constructor(n,a,h,g){this.name=n,this.type=a,this._evaluate=h,this.args=g}evaluate(n){return this._evaluate(n,this.args)}eachChild(n){this.args.forEach(n)}outputDefined(){return!1}static parse(n,a){const h=n[0],g=Zr.definitions[h];if(!g)return a.error(`Unknown expression "${h}". If you wanted a literal array, use ["literal", [...]].`,0);const v=Array.isArray(g)?g[0]:g.type,x=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,b=x.filter(([T])=>!Array.isArray(T)||T.length===n.length-1);let E=null;for(const[T,A]of b){E=new zu(a.registry,Ol,a.path,null,a.scope);const M=[];let O=!1;for(let B=1;B{return O=M,Array.isArray(O)?`(${O.map(H).join(", ")})`:`(${H(O.type)}...)`;var O}).join(" | "),A=[];for(let M=1;M{a=n?a&&Ol(h):a&&h instanceof js}),!!a&&qu(o)&&Bl(o,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function qu(o){if(o instanceof Zr&&(o.name==="get"&&o.args.length===1||o.name==="feature-state"||o.name==="has"&&o.args.length===1||o.name==="properties"||o.name==="geometry-type"||o.name==="id"||/^filter-/.test(o.name))||o instanceof ga)return!1;let n=!0;return o.eachChild(a=>{n&&!qu(a)&&(n=!1)}),n}function Fl(o){if(o instanceof Zr&&o.name==="feature-state")return!1;let n=!0;return o.eachChild(a=>{n&&!Fl(a)&&(n=!1)}),n}function Bl(o,n){if(o instanceof Zr&&n.indexOf(o.name)>=0)return!1;let a=!0;return o.eachChild(h=>{a&&!Bl(h,n)&&(a=!1)}),a}function Vl(o,n){const a=o.length-1;let h,g,v=0,x=a,b=0;for(;v<=x;)if(b=Math.floor((v+x)/2),h=o[b],g=o[b+1],h<=n){if(b===a||nn))throw new Un("Input is not a number.");x=b-1}return 0}class Ul{constructor(n,a,h){this.type=n,this.input=a,this.labels=[],this.outputs=[];for(const[g,v]of h)this.labels.push(g),this.outputs.push(v)}static parse(n,a){if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");const h=a.parse(n[1],1,Zt);if(!h)return null;const g=[];let v=null;a.expectedType&&a.expectedType.kind!=="value"&&(v=a.expectedType);for(let x=1;x=b)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',T);const M=a.parse(E,A,v);if(!M)return null;v=v||M.type,g.push([b,M])}return new Ul(v,h,g)}evaluate(n){const a=this.labels,h=this.outputs;if(a.length===1)return h[0].evaluate(n);const g=this.input.evaluate(n);if(g<=a[0])return h[0].evaluate(n);const v=a.length;return g>=a[v-1]?h[v-1].evaluate(n):h[Vl(a,g)].evaluate(n)}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function Bf(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Vf=ad;function ad(o,n,a,h){this.cx=3*o,this.bx=3*(a-o)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(h-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=o,this.p1y=n,this.p2x=a,this.p2y=h}ad.prototype={sampleCurveX:function(o){return((this.ax*o+this.bx)*o+this.cx)*o},sampleCurveY:function(o){return((this.ay*o+this.by)*o+this.cy)*o},sampleCurveDerivativeX:function(o){return(3*this.ax*o+2*this.bx)*o+this.cx},solveCurveX:function(o,n){if(n===void 0&&(n=1e-6),o<0)return 0;if(o>1)return 1;for(var a=o,h=0;h<8;h++){var g=this.sampleCurveX(a)-o;if(Math.abs(g)g?x=a:b=a,a=.5*(b-x)+x;return a},solve:function(o,n){return this.sampleCurveY(this.solveCurveX(o,n))}};var Uf=Bf(Vf);function _a(o,n,a){return o+a*(n-o)}function Gu(o,n,a){return o.map((h,g)=>_a(h,n[g],a))}const fr={number:_a,color:function(o,n,a,h="rgb"){switch(h){case"rgb":{const[g,v,x,b]=Gu(o.rgb,n.rgb,a);return new pn(g,v,x,b,!1)}case"hcl":{const[g,v,x,b]=o.hcl,[E,T,A,M]=n.hcl;let O,B;if(isNaN(g)||isNaN(E))isNaN(g)?isNaN(E)?O=NaN:(O=E,x!==1&&x!==0||(B=T)):(O=g,A!==1&&A!==0||(B=v));else{let lt=E-g;E>g&<>180?lt-=360:E180&&(lt+=360),O=g+a*lt}const[q,Z,Y,$]=function([lt,tt,ot,wt]){return lt=isNaN(lt)?0:lt*ve,Xn([ot,Math.cos(lt)*tt,Math.sin(lt)*tt,wt])}([O,B??_a(v,T,a),_a(x,A,a),_a(b,M,a)]);return new pn(q,Z,Y,$,!1)}case"lab":{const[g,v,x,b]=Xn(Gu(o.lab,n.lab,a));return new pn(g,v,x,b,!1)}}},array:Gu,padding:function(o,n,a){return new Lr(Gu(o.values,n.values,a))},variableAnchorOffsetCollection:function(o,n,a){const h=o.values,g=n.values;if(h.length!==g.length)throw new Un(`Cannot interpolate values of different length. from: ${o.toString()}, to: ${n.toString()}`);const v=[];for(let x=0;xtypeof A!="number"||A<0||A>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:T}}}if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(v=a.parse(v,2,Zt),!v)return null;const b=[];let E=null;h==="interpolate-hcl"||h==="interpolate-lab"?E=_i:a.expectedType&&a.expectedType.kind!=="value"&&(E=a.expectedType);for(let T=0;T=A)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',O);const q=a.parse(M,B,E);if(!q)return null;E=E||q.type,b.push([A,q])}return ht(E,Zt)||ht(E,_i)||ht(E,K)||ht(E,F)||ht(E,G(Zt))?new er(E,h,g,v,b):a.error(`Type ${H(E)} is not interpolatable.`)}evaluate(n){const a=this.labels,h=this.outputs;if(a.length===1)return h[0].evaluate(n);const g=this.input.evaluate(n);if(g<=a[0])return h[0].evaluate(n);const v=a.length;if(g>=a[v-1])return h[v-1].evaluate(n);const x=Vl(a,g),b=er.interpolationFactor(this.interpolation,g,a[x],a[x+1]),E=h[x].evaluate(n),T=h[x+1].evaluate(n);switch(this.operator){case"interpolate":return fr[this.type.kind](E,T,b);case"interpolate-hcl":return fr.color(E,T,b,"hcl");case"interpolate-lab":return fr.color(E,T,b,"lab")}}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function $e(o,n,a,h){const g=h-a,v=o-a;return g===0?0:n===1?v/g:(Math.pow(n,v)-1)/(Math.pow(n,g)-1)}class ju{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expectected at least one argument.");let h=null;const g=a.expectedType;g&&g.kind!=="value"&&(h=g);const v=[];for(const b of n.slice(1)){const E=a.parse(b,1+v.length,h,void 0,{typeAnnotation:"omit"});if(!E)return null;h=h||E.type,v.push(E)}if(!h)throw new Error("No output type");const x=g&&v.some(b=>rt(g,b.type));return new ju(x?Ie:h,v)}evaluate(n){let a,h=null,g=0;for(const v of this.args)if(g++,h=v.evaluate(n),h&&h instanceof lo&&!h.available&&(a||(a=h.name),h=null,g===this.args.length&&(h=a)),h!==null)break;return h}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}class Zu{constructor(n,a){this.type=a.type,this.bindings=[].concat(n),this.result=a}evaluate(n){return this.result.evaluate(n)}eachChild(n){for(const a of this.bindings)n(a[1]);n(this.result)}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found ${n.length-1} instead.`);const h=[];for(let v=1;v=h.length)throw new Un(`Array index out of bounds: ${a} > ${h.length-1}.`);if(a!==Math.floor(a))throw new Un(`Array index must be an integer, but found ${a} instead.`);return h[a]}eachChild(n){n(this.index),n(this.input)}outputDefined(){return!1}}class mh{constructor(n,a){this.type=Le,this.needle=n,this.haystack=a}static parse(n,a){if(n.length!==3)return a.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const h=a.parse(n[1],1,Ie),g=a.parse(n[2],2,Ie);return h&&g?at(h.type,[Le,De,Zt,tr,Ie])?new mh(h,g):a.error(`Expected first argument to be of type boolean, string, number or null, but found ${H(h.type)} instead`):null}evaluate(n){const a=this.needle.evaluate(n),h=this.haystack.evaluate(n);if(!h)return!1;if(!et(a,["boolean","string","number","null"]))throw new Un(`Expected first argument to be of type boolean, string, number or null, but found ${H(vi(a))} instead.`);if(!et(h,["string","array"]))throw new Un(`Expected second argument to be of type array or string, but found ${H(vi(h))} instead.`);return h.indexOf(a)>=0}eachChild(n){n(this.needle),n(this.haystack)}outputDefined(){return!0}}class Hu{constructor(n,a,h){this.type=Zt,this.needle=n,this.haystack=a,this.fromIndex=h}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const h=a.parse(n[1],1,Ie),g=a.parse(n[2],2,Ie);if(!h||!g)return null;if(!at(h.type,[Le,De,Zt,tr,Ie]))return a.error(`Expected first argument to be of type boolean, string, number or null, but found ${H(h.type)} instead`);if(n.length===4){const v=a.parse(n[3],3,Zt);return v?new Hu(h,g,v):null}return new Hu(h,g)}evaluate(n){const a=this.needle.evaluate(n),h=this.haystack.evaluate(n);if(!et(a,["boolean","string","number","null"]))throw new Un(`Expected first argument to be of type boolean, string, number or null, but found ${H(vi(a))} instead.`);if(!et(h,["string","array"]))throw new Un(`Expected second argument to be of type array or string, but found ${H(vi(h))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(n);return h.indexOf(a,g)}return h.indexOf(a)}eachChild(n){n(this.needle),n(this.haystack),this.fromIndex&&n(this.fromIndex)}outputDefined(){return!1}}class gh{constructor(n,a,h,g,v,x){this.inputType=n,this.type=a,this.input=h,this.cases=g,this.outputs=v,this.otherwise=x}static parse(n,a){if(n.length<5)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if(n.length%2!=1)return a.error("Expected an even number of arguments.");let h,g;a.expectedType&&a.expectedType.kind!=="value"&&(g=a.expectedType);const v={},x=[];for(let T=2;TNumber.MAX_SAFE_INTEGER)return O.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof q=="number"&&Math.floor(q)!==q)return O.error("Numeric branch labels must be integer values.");if(h){if(O.checkSubtype(h,vi(q)))return null}else h=vi(q);if(v[String(q)]!==void 0)return O.error("Branch labels must be unique.");v[String(q)]=x.length}const B=a.parse(M,T,g);if(!B)return null;g=g||B.type,x.push(B)}const b=a.parse(n[1],1,Ie);if(!b)return null;const E=a.parse(n[n.length-1],n.length-1,g);return E?b.type.kind!=="value"&&a.concat(1).checkSubtype(h,b.type)?null:new gh(h,g,b,v,x,E):null}evaluate(n){const a=this.input.evaluate(n);return(vi(a)===this.inputType&&this.outputs[this.cases[a]]||this.otherwise).evaluate(n)}eachChild(n){n(this.input),this.outputs.forEach(n),n(this.otherwise)}outputDefined(){return this.outputs.every(n=>n.outputDefined())&&this.otherwise.outputDefined()}}class _h{constructor(n,a,h){this.type=n,this.branches=a,this.otherwise=h}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found only ${n.length-1}.`);if(n.length%2!=0)return a.error("Expected an odd number of arguments.");let h;a.expectedType&&a.expectedType.kind!=="value"&&(h=a.expectedType);const g=[];for(let x=1;xa.outputDefined())&&this.otherwise.outputDefined()}}class Wu{constructor(n,a,h,g){this.type=n,this.input=a,this.beginIndex=h,this.endIndex=g}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const h=a.parse(n[1],1,Ie),g=a.parse(n[2],2,Zt);if(!h||!g)return null;if(!at(h.type,[G(Ie),De,Ie]))return a.error(`Expected first argument to be of type array or string, but found ${H(h.type)} instead`);if(n.length===4){const v=a.parse(n[3],3,Zt);return v?new Wu(h.type,h,g,v):null}return new Wu(h.type,h,g)}evaluate(n){const a=this.input.evaluate(n),h=this.beginIndex.evaluate(n);if(!et(a,["string","array"]))throw new Un(`Expected first argument to be of type array or string, but found ${H(vi(a))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(n);return a.slice(h,g)}return a.slice(h)}eachChild(n){n(this.input),n(this.beginIndex),this.endIndex&&n(this.endIndex)}outputDefined(){return!1}}function ld(o,n){return o==="=="||o==="!="?n.kind==="boolean"||n.kind==="string"||n.kind==="number"||n.kind==="null"||n.kind==="value":n.kind==="string"||n.kind==="number"||n.kind==="value"}function ud(o,n,a,h){return h.compare(n,a)===0}function Ka(o,n,a){const h=o!=="=="&&o!=="!=";return class P0{constructor(v,x,b){this.type=Le,this.lhs=v,this.rhs=x,this.collator=b,this.hasUntypedArgument=v.type.kind==="value"||x.type.kind==="value"}static parse(v,x){if(v.length!==3&&v.length!==4)return x.error("Expected two or three arguments.");const b=v[0];let E=x.parse(v[1],1,Ie);if(!E)return null;if(!ld(b,E.type))return x.concat(1).error(`"${b}" comparisons are not supported for type '${H(E.type)}'.`);let T=x.parse(v[2],2,Ie);if(!T)return null;if(!ld(b,T.type))return x.concat(2).error(`"${b}" comparisons are not supported for type '${H(T.type)}'.`);if(E.type.kind!==T.type.kind&&E.type.kind!=="value"&&T.type.kind!=="value")return x.error(`Cannot compare types '${H(E.type)}' and '${H(T.type)}'.`);h&&(E.type.kind==="value"&&T.type.kind!=="value"?E=new jr(T.type,[E]):E.type.kind!=="value"&&T.type.kind==="value"&&(T=new jr(E.type,[T])));let A=null;if(v.length===4){if(E.type.kind!=="string"&&T.type.kind!=="string"&&E.type.kind!=="value"&&T.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(A=x.parse(v[3],3,ma),!A)return null}return new P0(E,T,A)}evaluate(v){const x=this.lhs.evaluate(v),b=this.rhs.evaluate(v);if(h&&this.hasUntypedArgument){const E=vi(x),T=vi(b);if(E.kind!==T.kind||E.kind!=="string"&&E.kind!=="number")throw new Un(`Expected arguments for "${o}" to be (string, string) or (number, number), but found (${E.kind}, ${T.kind}) instead.`)}if(this.collator&&!h&&this.hasUntypedArgument){const E=vi(x),T=vi(b);if(E.kind!=="string"||T.kind!=="string")return n(v,x,b)}return this.collator?a(v,x,b,this.collator.evaluate(v)):n(v,x,b)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const qf=Ka("==",function(o,n,a){return n===a},ud),Gf=Ka("!=",function(o,n,a){return n!==a},function(o,n,a,h){return!ud(0,n,a,h)}),jf=Ka("<",function(o,n,a){return n",function(o,n,a){return n>a},function(o,n,a,h){return h.compare(n,a)>0}),Hf=Ka("<=",function(o,n,a){return n<=a},function(o,n,a,h){return h.compare(n,a)<=0}),Wf=Ka(">=",function(o,n,a){return n>=a},function(o,n,a,h){return h.compare(n,a)>=0});class yh{constructor(n,a,h,g,v){this.type=De,this.number=n,this.locale=a,this.currency=h,this.minFractionDigits=g,this.maxFractionDigits=v}static parse(n,a){if(n.length!==3)return a.error("Expected two arguments.");const h=a.parse(n[1],1,Zt);if(!h)return null;const g=n[2];if(typeof g!="object"||Array.isArray(g))return a.error("NumberFormat options argument must be an object.");let v=null;if(g.locale&&(v=a.parse(g.locale,1,De),!v))return null;let x=null;if(g.currency&&(x=a.parse(g.currency,1,De),!x))return null;let b=null;if(g["min-fraction-digits"]&&(b=a.parse(g["min-fraction-digits"],1,Zt),!b))return null;let E=null;return g["max-fraction-digits"]&&(E=a.parse(g["max-fraction-digits"],1,Zt),!E)?null:new yh(h,v,x,b,E)}evaluate(n){return new Intl.NumberFormat(this.locale?this.locale.evaluate(n):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(n):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(n):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(n):void 0}).format(this.number.evaluate(n))}eachChild(n){n(this.number),this.locale&&n(this.locale),this.currency&&n(this.currency),this.minFractionDigits&&n(this.minFractionDigits),this.maxFractionDigits&&n(this.maxFractionDigits)}outputDefined(){return!1}}class Xu{constructor(n){this.type=Ei,this.sections=n}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const h=n[1];if(!Array.isArray(h)&&typeof h=="object")return a.error("First argument must be an image or text section.");const g=[];let v=!1;for(let x=1;x<=n.length-1;++x){const b=n[x];if(v&&typeof b=="object"&&!Array.isArray(b)){v=!1;let E=null;if(b["font-scale"]&&(E=a.parse(b["font-scale"],1,Zt),!E))return null;let T=null;if(b["text-font"]&&(T=a.parse(b["text-font"],1,G(De)),!T))return null;let A=null;if(b["text-color"]&&(A=a.parse(b["text-color"],1,_i),!A))return null;const M=g[g.length-1];M.scale=E,M.font=T,M.textColor=A}else{const E=a.parse(n[x],1,Ie);if(!E)return null;const T=E.type.kind;if(T!=="string"&&T!=="value"&&T!=="null"&&T!=="resolvedImage")return a.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,g.push({content:E,scale:null,font:null,textColor:null})}}return new Xu(g)}evaluate(n){return new Gr(this.sections.map(a=>{const h=a.content.evaluate(n);return vi(h)===z?new dh("",h,null,null,null):new dh(Nl(h),null,a.scale?a.scale.evaluate(n):null,a.font?a.font.evaluate(n).join(","):null,a.textColor?a.textColor.evaluate(n):null)}))}eachChild(n){for(const a of this.sections)n(a.content),a.scale&&n(a.scale),a.font&&n(a.font),a.textColor&&n(a.textColor)}outputDefined(){return!1}}class vh{constructor(n){this.type=z,this.input=n}static parse(n,a){if(n.length!==2)return a.error("Expected two arguments.");const h=a.parse(n[1],1,De);return h?new vh(h):a.error("No image name provided.")}evaluate(n){const a=this.input.evaluate(n),h=lo.fromString(a);return h&&n.availableImages&&(h.available=n.availableImages.indexOf(a)>-1),h}eachChild(n){n(this.input)}outputDefined(){return!1}}class xh{constructor(n){this.type=Zt,this.input=n}static parse(n,a){if(n.length!==2)return a.error(`Expected 1 argument, but found ${n.length-1} instead.`);const h=a.parse(n[1],1);return h?h.type.kind!=="array"&&h.type.kind!=="string"&&h.type.kind!=="value"?a.error(`Expected argument of type string or array, but found ${H(h.type)} instead.`):new xh(h):null}evaluate(n){const a=this.input.evaluate(n);if(typeof a=="string"||Array.isArray(a))return a.length;throw new Un(`Expected value to be of type string or array, but found ${H(vi(a))} instead.`)}eachChild(n){n(this.input)}outputDefined(){return!1}}const Ja={"==":qf,"!=":Gf,">":Zf,"<":jf,">=":Wf,"<=":Hf,array:jr,at:fh,boolean:jr,case:_h,coalesce:ju,collator:Ya,format:Xu,image:vh,in:mh,"index-of":Hu,interpolate:er,"interpolate-hcl":er,"interpolate-lab":er,length:xh,let:Zu,literal:js,match:gh,number:jr,"number-format":yh,object:jr,slice:Wu,step:Ul,string:jr,"to-boolean":Ko,"to-color":Ko,"to-number":Ko,"to-string":Ko,var:Uu,within:ga};function cd(o,[n,a,h,g]){n=n.evaluate(o),a=a.evaluate(o),h=h.evaluate(o);const v=g?g.evaluate(o):1,x=Xa(n,a,h,v);if(x)throw new Un(x);return new pn(n/255,a/255,h/255,v,!1)}function hd(o,n){return o in n}function bh(o,n){const a=n[o];return a===void 0?null:a}function ya(o){return{type:o}}function pd(o){return{result:"success",value:o}}function Qa(o){return{result:"error",value:o}}function $a(o){return o["property-type"]==="data-driven"||o["property-type"]==="cross-faded-data-driven"}function dd(o){return!!o.expression&&o.expression.parameters.indexOf("zoom")>-1}function wh(o){return!!o.expression&&o.expression.interpolated}function Ye(o){return o instanceof Number?"number":o instanceof String?"string":o instanceof Boolean?"boolean":Array.isArray(o)?"array":o===null?"null":typeof o}function Yu(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function Xf(o){return o}function fd(o,n){const a=n.type==="color",h=o.stops&&typeof o.stops[0][0]=="object",g=h||!(h||o.property!==void 0),v=o.type||(wh(n)?"exponential":"interval");if(a||n.type==="padding"){const A=a?pn.parse:Lr.parse;(o=Wo({},o)).stops&&(o.stops=o.stops.map(M=>[M[0],A(M[1])])),o.default=A(o.default?o.default:n.default)}if(o.colorSpace&&(x=o.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${o.colorSpace}"`);var x;let b,E,T;if(v==="exponential")b=Ze;else if(v==="interval")b=Yf;else if(v==="categorical"){b=ci,E=Object.create(null);for(const A of o.stops)E[A[0]]=A[1];T=typeof o.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);b=Ih}if(h){const A={},M=[];for(let q=0;qq[0]),evaluate:({zoom:q},Z)=>Ze({stops:O,base:o.base},n,q).evaluate(q,Z)}}if(g){const A=v==="exponential"?{name:"exponential",base:o.base!==void 0?o.base:1}:null;return{kind:"camera",interpolationType:A,interpolationFactor:er.interpolationFactor.bind(void 0,A),zoomStops:o.stops.map(M=>M[0]),evaluate:({zoom:M})=>b(o,n,M,E,T)}}return{kind:"source",evaluate(A,M){const O=M&&M.properties?M.properties[o.property]:void 0;return O===void 0?ql(o.default,n.default):b(o,n,O,E,T)}}}function ql(o,n,a){return o!==void 0?o:n!==void 0?n:a!==void 0?a:void 0}function ci(o,n,a,h,g){return ql(typeof a===g?h[a]:void 0,o.default,n.default)}function Yf(o,n,a){if(Ye(a)!=="number")return ql(o.default,n.default);const h=o.stops.length;if(h===1||a<=o.stops[0][0])return o.stops[0][1];if(a>=o.stops[h-1][0])return o.stops[h-1][1];const g=Vl(o.stops.map(v=>v[0]),a);return o.stops[g][1]}function Ze(o,n,a){const h=o.base!==void 0?o.base:1;if(Ye(a)!=="number")return ql(o.default,n.default);const g=o.stops.length;if(g===1||a<=o.stops[0][0])return o.stops[0][1];if(a>=o.stops[g-1][0])return o.stops[g-1][1];const v=Vl(o.stops.map(A=>A[0]),a),x=function(A,M,O,B){const q=B-O,Z=A-O;return q===0?0:M===1?Z/q:(Math.pow(M,Z)-1)/(Math.pow(M,q)-1)}(a,h,o.stops[v][0],o.stops[v+1][0]),b=o.stops[v][1],E=o.stops[v+1][1],T=fr[n.type]||Xf;return typeof b.evaluate=="function"?{evaluate(...A){const M=b.evaluate.apply(void 0,A),O=E.evaluate.apply(void 0,A);if(M!==void 0&&O!==void 0)return T(M,O,x,o.colorSpace)}}:T(b,E,x,o.colorSpace)}function Ih(o,n,a){switch(n.type){case"color":a=pn.parse(a);break;case"formatted":a=Gr.fromString(a.toString());break;case"resolvedImage":a=lo.fromString(a.toString());break;case"padding":a=Lr.parse(a);break;default:Ye(a)===n.type||n.type==="enum"&&n.values[a]||(a=void 0)}return ql(a,o.default,n.default)}Zr.register(Ja,{error:[{kind:"error"},[De],(o,[n])=>{throw new Un(n.evaluate(o))}],typeof:[De,[Ie],(o,[n])=>H(vi(n.evaluate(o)))],"to-rgba":[G(Zt,4),[_i],(o,[n])=>{const[a,h,g,v]=n.evaluate(o).rgb;return[255*a,255*h,255*g,v]}],rgb:[_i,[Zt,Zt,Zt],cd],rgba:[_i,[Zt,Zt,Zt,Zt],cd],has:{type:Le,overloads:[[[De],(o,[n])=>hd(n.evaluate(o),o.properties())],[[De,Xo],(o,[n,a])=>hd(n.evaluate(o),a.evaluate(o))]]},get:{type:Ie,overloads:[[[De],(o,[n])=>bh(n.evaluate(o),o.properties())],[[De,Xo],(o,[n,a])=>bh(n.evaluate(o),a.evaluate(o))]]},"feature-state":[Ie,[De],(o,[n])=>bh(n.evaluate(o),o.featureState||{})],properties:[Xo,[],o=>o.properties()],"geometry-type":[De,[],o=>o.geometryType()],id:[Ie,[],o=>o.id()],zoom:[Zt,[],o=>o.globals.zoom],"heatmap-density":[Zt,[],o=>o.globals.heatmapDensity||0],"line-progress":[Zt,[],o=>o.globals.lineProgress||0],accumulated:[Ie,[],o=>o.globals.accumulated===void 0?null:o.globals.accumulated],"+":[Zt,ya(Zt),(o,n)=>{let a=0;for(const h of n)a+=h.evaluate(o);return a}],"*":[Zt,ya(Zt),(o,n)=>{let a=1;for(const h of n)a*=h.evaluate(o);return a}],"-":{type:Zt,overloads:[[[Zt,Zt],(o,[n,a])=>n.evaluate(o)-a.evaluate(o)],[[Zt],(o,[n])=>-n.evaluate(o)]]},"/":[Zt,[Zt,Zt],(o,[n,a])=>n.evaluate(o)/a.evaluate(o)],"%":[Zt,[Zt,Zt],(o,[n,a])=>n.evaluate(o)%a.evaluate(o)],ln2:[Zt,[],()=>Math.LN2],pi:[Zt,[],()=>Math.PI],e:[Zt,[],()=>Math.E],"^":[Zt,[Zt,Zt],(o,[n,a])=>Math.pow(n.evaluate(o),a.evaluate(o))],sqrt:[Zt,[Zt],(o,[n])=>Math.sqrt(n.evaluate(o))],log10:[Zt,[Zt],(o,[n])=>Math.log(n.evaluate(o))/Math.LN10],ln:[Zt,[Zt],(o,[n])=>Math.log(n.evaluate(o))],log2:[Zt,[Zt],(o,[n])=>Math.log(n.evaluate(o))/Math.LN2],sin:[Zt,[Zt],(o,[n])=>Math.sin(n.evaluate(o))],cos:[Zt,[Zt],(o,[n])=>Math.cos(n.evaluate(o))],tan:[Zt,[Zt],(o,[n])=>Math.tan(n.evaluate(o))],asin:[Zt,[Zt],(o,[n])=>Math.asin(n.evaluate(o))],acos:[Zt,[Zt],(o,[n])=>Math.acos(n.evaluate(o))],atan:[Zt,[Zt],(o,[n])=>Math.atan(n.evaluate(o))],min:[Zt,ya(Zt),(o,n)=>Math.min(...n.map(a=>a.evaluate(o)))],max:[Zt,ya(Zt),(o,n)=>Math.max(...n.map(a=>a.evaluate(o)))],abs:[Zt,[Zt],(o,[n])=>Math.abs(n.evaluate(o))],round:[Zt,[Zt],(o,[n])=>{const a=n.evaluate(o);return a<0?-Math.round(-a):Math.round(a)}],floor:[Zt,[Zt],(o,[n])=>Math.floor(n.evaluate(o))],ceil:[Zt,[Zt],(o,[n])=>Math.ceil(n.evaluate(o))],"filter-==":[Le,[De,Ie],(o,[n,a])=>o.properties()[n.value]===a.value],"filter-id-==":[Le,[Ie],(o,[n])=>o.id()===n.value],"filter-type-==":[Le,[De],(o,[n])=>o.geometryType()===n.value],"filter-<":[Le,[De,Ie],(o,[n,a])=>{const h=o.properties()[n.value],g=a.value;return typeof h==typeof g&&h{const a=o.id(),h=n.value;return typeof a==typeof h&&a":[Le,[De,Ie],(o,[n,a])=>{const h=o.properties()[n.value],g=a.value;return typeof h==typeof g&&h>g}],"filter-id->":[Le,[Ie],(o,[n])=>{const a=o.id(),h=n.value;return typeof a==typeof h&&a>h}],"filter-<=":[Le,[De,Ie],(o,[n,a])=>{const h=o.properties()[n.value],g=a.value;return typeof h==typeof g&&h<=g}],"filter-id-<=":[Le,[Ie],(o,[n])=>{const a=o.id(),h=n.value;return typeof a==typeof h&&a<=h}],"filter->=":[Le,[De,Ie],(o,[n,a])=>{const h=o.properties()[n.value],g=a.value;return typeof h==typeof g&&h>=g}],"filter-id->=":[Le,[Ie],(o,[n])=>{const a=o.id(),h=n.value;return typeof a==typeof h&&a>=h}],"filter-has":[Le,[Ie],(o,[n])=>n.value in o.properties()],"filter-has-id":[Le,[],o=>o.id()!==null&&o.id()!==void 0],"filter-type-in":[Le,[G(De)],(o,[n])=>n.value.indexOf(o.geometryType())>=0],"filter-id-in":[Le,[G(Ie)],(o,[n])=>n.value.indexOf(o.id())>=0],"filter-in-small":[Le,[De,G(Ie)],(o,[n,a])=>a.value.indexOf(o.properties()[n.value])>=0],"filter-in-large":[Le,[De,G(Ie)],(o,[n,a])=>function(h,g,v,x){for(;v<=x;){const b=v+x>>1;if(g[b]===h)return!0;g[b]>h?x=b-1:v=b+1}return!1}(o.properties()[n.value],a.value,0,a.value.length-1)],all:{type:Le,overloads:[[[Le,Le],(o,[n,a])=>n.evaluate(o)&&a.evaluate(o)],[ya(Le),(o,n)=>{for(const a of n)if(!a.evaluate(o))return!1;return!0}]]},any:{type:Le,overloads:[[[Le,Le],(o,[n,a])=>n.evaluate(o)||a.evaluate(o)],[ya(Le),(o,n)=>{for(const a of n)if(a.evaluate(o))return!0;return!1}]]},"!":[Le,[Le],(o,[n])=>!n.evaluate(o)],"is-supported-script":[Le,[De],(o,[n])=>{const a=o.globals&&o.globals.isSupportedScript;return!a||a(n.evaluate(o))}],upcase:[De,[De],(o,[n])=>n.evaluate(o).toUpperCase()],downcase:[De,[De],(o,[n])=>n.evaluate(o).toLowerCase()],concat:[De,ya(Ie),(o,n)=>n.map(a=>Nl(a.evaluate(o))).join("")],"resolved-locale":[De,[ma],(o,[n])=>n.evaluate(o).resolvedLocale()]});class Pn{constructor(n,a){var h;this.expression=n,this._warningHistory={},this._evaluator=new dn,this._defaultValue=a?(h=a).type==="color"&&Yu(h.default)?new pn(0,0,0,0):h.type==="color"?pn.parse(h.default)||null:h.type==="padding"?Lr.parse(h.default)||null:h.type==="variableAnchorOffsetCollection"?ao.parse(h.default)||null:h.default===void 0?null:h.default:null,this._enumValues=a&&a.type==="enum"?a.values:null}evaluateWithoutErrorHandling(n,a,h,g,v,x){return this._evaluator.globals=n,this._evaluator.feature=a,this._evaluator.featureState=h,this._evaluator.canonical=g,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(n,a,h,g,v,x){this._evaluator.globals=n,this._evaluator.feature=a||null,this._evaluator.featureState=h||null,this._evaluator.canonical=g,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=x||null;try{const b=this.expression.evaluate(this._evaluator);if(b==null||typeof b=="number"&&b!=b)return this._defaultValue;if(this._enumValues&&!(b in this._enumValues))throw new Un(`Expected value to be one of ${Object.keys(this._enumValues).map(E=>JSON.stringify(E)).join(", ")}, but found ${JSON.stringify(b)} instead.`);return b}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(b.message)),this._defaultValue}}}function En(o){return Array.isArray(o)&&o.length>0&&typeof o[0]=="string"&&o[0]in Ja}function va(o,n){const a=new zu(Ja,Ol,[],n?function(g){const v={color:_i,string:De,number:Zt,enum:De,boolean:Le,formatted:Ei,padding:K,resolvedImage:z,variableAnchorOffsetCollection:F};return g.type==="array"?G(v[g.value]||Ie,g.length):v[g.type]}(n):void 0),h=a.parse(o,void 0,void 0,void 0,n&&n.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?pd(new Pn(h,n)):Qa(a.errors)}class Ku{constructor(n,a){this.kind=n,this._styleExpression=a,this.isStateDependent=n!=="constant"&&!Fl(a.expression)}evaluateWithoutErrorHandling(n,a,h,g,v,x){return this._styleExpression.evaluateWithoutErrorHandling(n,a,h,g,v,x)}evaluate(n,a,h,g,v,x){return this._styleExpression.evaluate(n,a,h,g,v,x)}}class Eh{constructor(n,a,h,g){this.kind=n,this.zoomStops=h,this._styleExpression=a,this.isStateDependent=n!=="camera"&&!Fl(a.expression),this.interpolationType=g}evaluateWithoutErrorHandling(n,a,h,g,v,x){return this._styleExpression.evaluateWithoutErrorHandling(n,a,h,g,v,x)}evaluate(n,a,h,g,v,x){return this._styleExpression.evaluate(n,a,h,g,v,x)}interpolationFactor(n,a,h){return this.interpolationType?er.interpolationFactor(this.interpolationType,n,a,h):0}}function md(o,n){const a=va(o,n);if(a.result==="error")return a;const h=a.value.expression,g=qu(h);if(!g&&!$a(n))return Qa([new qr("","data expressions not supported")]);const v=Bl(h,["zoom"]);if(!v&&!dd(n))return Qa([new qr("","zoom expressions not supported")]);const x=Qu(h);return x||v?x instanceof qr?Qa([x]):x instanceof er&&!wh(n)?Qa([new qr("",'"interpolate" expressions cannot be used with this property')]):pd(x?new Eh(g?"camera":"composite",a.value,x.labels,x instanceof er?x.interpolation:void 0):new Ku(g?"constant":"source",a.value)):Qa([new qr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ju{constructor(n,a){this._parameters=n,this._specification=a,Wo(this,fd(this._parameters,this._specification))}static deserialize(n){return new Ju(n._parameters,n._specification)}static serialize(n){return{_parameters:n._parameters,_specification:n._specification}}}function Qu(o){let n=null;if(o instanceof Zu)n=Qu(o.result);else if(o instanceof ju){for(const a of o.args)if(n=Qu(a),n)break}else(o instanceof Ul||o instanceof er)&&o.input instanceof Zr&&o.input.name==="zoom"&&(n=o);return n instanceof qr||o.eachChild(a=>{const h=Qu(a);h instanceof qr?n=h:!n&&h?n=new qr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&h&&n!==h&&(n=new qr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}function $u(o){if(o===!0||o===!1)return!0;if(!Array.isArray(o)||o.length===0)return!1;switch(o[0]){case"has":return o.length>=2&&o[1]!=="$id"&&o[1]!=="$type";case"in":return o.length>=3&&(typeof o[1]!="string"||Array.isArray(o[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return o.length!==3||Array.isArray(o[1])||Array.isArray(o[2]);case"any":case"all":for(const n of o.slice(1))if(!$u(n)&&typeof n!="boolean")return!1;return!0;default:return!0}}const gd={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function tc(o){if(o==null)return{filter:()=>!0,needGeometry:!1};$u(o)||(o=nc(o));const n=va(o,gd);if(n.result==="error")throw new Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,h,g)=>n.value.evaluate(a,h,{},g),needGeometry:ec(o)}}function _d(o,n){return on?1:0}function ec(o){if(!Array.isArray(o))return!1;if(o[0]==="within")return!0;for(let n=1;n"||n==="<="||n===">="?Sh(o[1],o[2],n):n==="any"?(a=o.slice(1),["any"].concat(a.map(nc))):n==="all"?["all"].concat(o.slice(1).map(nc)):n==="none"?["all"].concat(o.slice(1).map(nc).map(ic)):n==="in"?yd(o[1],o.slice(2)):n==="!in"?ic(yd(o[1],o.slice(2))):n==="has"?vd(o[1]):n==="!has"?ic(vd(o[1])):n!=="within"||o;var a}function Sh(o,n,a){switch(o){case"$type":return[`filter-type-${a}`,n];case"$id":return[`filter-id-${a}`,n];default:return[`filter-${a}`,o,n]}}function yd(o,n){if(n.length===0)return!1;switch(o){case"$type":return["filter-type-in",["literal",n]];case"$id":return["filter-id-in",["literal",n]];default:return n.length>200&&!n.some(a=>typeof a!=typeof n[0])?["filter-in-large",o,["literal",n.sort(_d)]]:["filter-in-small",o,["literal",n]]}}function vd(o){switch(o){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",o]}}function ic(o){return["!",o]}function Ch(o){const n=typeof o;if(n==="number"||n==="boolean"||n==="string"||o==null)return JSON.stringify(o);if(Array.isArray(o)){let g="[";for(const v of o)g+=`${Ch(v)},`;return`${g}]`}const a=Object.keys(o).sort();let h="{";for(let g=0;gh.maximum?[new Ot(n,a,`${a} is greater than the maximum value ${h.maximum}`)]:[]}function bd(o){const n=o.valueSpec,a=Yn(o.value.type);let h,g,v,x={};const b=a!=="categorical"&&o.value.property===void 0,E=!b,T=Ye(o.value.stops)==="array"&&Ye(o.value.stops[0])==="array"&&Ye(o.value.stops[0][0])==="object",A=mr({key:o.key,value:o.value,valueSpec:o.styleSpec.function,validateSpec:o.validateSpec,style:o.style,styleSpec:o.styleSpec,objectElementValidators:{stops:function(B){if(a==="identity")return[new Ot(B.key,B.value,'identity function may not have a "stops" property')];let q=[];const Z=B.value;return q=q.concat(Th({key:B.key,value:Z,valueSpec:B.valueSpec,validateSpec:B.validateSpec,style:B.style,styleSpec:B.styleSpec,arrayElementValidator:M})),Ye(Z)==="array"&&Z.length===0&&q.push(new Ot(B.key,Z,"array must have at least one stop")),q},default:function(B){return B.validateSpec({key:B.key,value:B.value,valueSpec:n,validateSpec:B.validateSpec,style:B.style,styleSpec:B.styleSpec})}}});return a==="identity"&&b&&A.push(new Ot(o.key,o.value,'missing required property "property"')),a==="identity"||o.value.stops||A.push(new Ot(o.key,o.value,'missing required property "stops"')),a==="exponential"&&o.valueSpec.expression&&!wh(o.valueSpec)&&A.push(new Ot(o.key,o.value,"exponential functions not supported")),o.styleSpec.$version>=8&&(E&&!$a(o.valueSpec)?A.push(new Ot(o.key,o.value,"property functions not supported")):b&&!dd(o.valueSpec)&&A.push(new Ot(o.key,o.value,"zoom functions not supported"))),a!=="categorical"&&!T||o.value.property!==void 0||A.push(new Ot(o.key,o.value,'"property" property is required')),A;function M(B){let q=[];const Z=B.value,Y=B.key;if(Ye(Z)!=="array")return[new Ot(Y,Z,`array expected, ${Ye(Z)} found`)];if(Z.length!==2)return[new Ot(Y,Z,`array length 2 expected, length ${Z.length} found`)];if(T){if(Ye(Z[0])!=="object")return[new Ot(Y,Z,`object expected, ${Ye(Z[0])} found`)];if(Z[0].zoom===void 0)return[new Ot(Y,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new Ot(Y,Z,"object stop key must have value")];if(v&&v>Yn(Z[0].zoom))return[new Ot(Y,Z[0].zoom,"stop zoom values must appear in ascending order")];Yn(Z[0].zoom)!==v&&(v=Yn(Z[0].zoom),g=void 0,x={}),q=q.concat(mr({key:`${Y}[0]`,value:Z[0],valueSpec:{zoom:{}},validateSpec:B.validateSpec,style:B.style,styleSpec:B.styleSpec,objectElementValidators:{zoom:rc,value:O}}))}else q=q.concat(O({key:`${Y}[0]`,value:Z[0],valueSpec:{},validateSpec:B.validateSpec,style:B.style,styleSpec:B.styleSpec},Z));return En(Hs(Z[1]))?q.concat([new Ot(`${Y}[1]`,Z[1],"expressions are not allowed in function stops.")]):q.concat(B.validateSpec({key:`${Y}[1]`,value:Z[1],valueSpec:n,validateSpec:B.validateSpec,style:B.style,styleSpec:B.styleSpec}))}function O(B,q){const Z=Ye(B.value),Y=Yn(B.value),$=B.value!==null?B.value:q;if(h){if(Z!==h)return[new Ot(B.key,$,`${Z} stop domain type must match previous stop domain type ${h}`)]}else h=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new Ot(B.key,$,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&a!=="categorical"){let lt=`number expected, ${Z} found`;return $a(n)&&a===void 0&&(lt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ot(B.key,$,lt)]}return a!=="categorical"||Z!=="number"||isFinite(Y)&&Math.floor(Y)===Y?a!=="categorical"&&Z==="number"&&g!==void 0&&Ynew Ot(`${o.key}${h.key}`,o.value,h.message));const a=n.value.expression||n.value._styleExpression.expression;if(o.expressionContext==="property"&&o.propertyKey==="text-font"&&!a.outputDefined())return[new Ot(o.key,o.value,`Invalid data expression for "${o.propertyKey}". Output values must be contained as literals within the expression.`)];if(o.expressionContext==="property"&&o.propertyType==="layout"&&!Fl(a))return[new Ot(o.key,o.value,'"feature-state" data expressions are not supported with layout properties.')];if(o.expressionContext==="filter"&&!Fl(a))return[new Ot(o.key,o.value,'"feature-state" data expressions are not supported with filters.')];if(o.expressionContext&&o.expressionContext.indexOf("cluster")===0){if(!Bl(a,["zoom","feature-state"]))return[new Ot(o.key,o.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(o.expressionContext==="cluster-initial"&&!qu(a))return[new Ot(o.key,o.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Xs(o){const n=o.key,a=o.value,h=o.valueSpec,g=[];return Array.isArray(h.values)?h.values.indexOf(Yn(a))===-1&&g.push(new Ot(n,a,`expected one of [${h.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(h.values).indexOf(Yn(a))===-1&&g.push(new Ot(n,a,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(a)} found`)),g}function tl(o){return $u(Hs(o.value))?Ws(Wo({},o,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Lh(o)}function Lh(o){const n=o.value,a=o.key;if(Ye(n)!=="array")return[new Ot(a,n,`array expected, ${Ye(n)} found`)];const h=o.styleSpec;let g,v=[];if(n.length<1)return[new Ot(a,n,"filter array must have at least 1 element")];switch(v=v.concat(Xs({key:`${a}[0]`,value:n[0],valueSpec:h.filter_operator,style:o.style,styleSpec:o.styleSpec})),Yn(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&Yn(n[1])==="$type"&&v.push(new Ot(a,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":n.length!==3&&v.push(new Ot(a,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(g=Ye(n[1]),g!=="string"&&v.push(new Ot(`${a}[1]`,n[1],`string expected, ${g} found`)));for(let x=2;x{T in a&&n.push(new Ot(h,a[T],`"${T}" is prohibited for ref layers`))}),g.layers.forEach(T=>{Yn(T.id)===b&&(E=T)}),E?E.ref?n.push(new Ot(h,a.ref,"ref cannot reference another ref layer")):x=Yn(E.type):n.push(new Ot(h,a.ref,`ref layer "${b}" not found`))}else if(x!=="background")if(a.source){const E=g.sources&&g.sources[a.source],T=E&&Yn(E.type);E?T==="vector"&&x==="raster"?n.push(new Ot(h,a.source,`layer "${a.id}" requires a raster source`)):T!=="raster-dem"&&x==="hillshade"?n.push(new Ot(h,a.source,`layer "${a.id}" requires a raster-dem source`)):T==="raster"&&x!=="raster"?n.push(new Ot(h,a.source,`layer "${a.id}" requires a vector source`)):T!=="vector"||a["source-layer"]?T==="raster-dem"&&x!=="hillshade"?n.push(new Ot(h,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!a.paint||!a.paint["line-gradient"]||T==="geojson"&&E.lineMetrics||n.push(new Ot(h,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new Ot(h,a,`layer "${a.id}" must specify a "source-layer"`)):n.push(new Ot(h,a.source,`source "${a.source}" not found`))}else n.push(new Ot(h,a,'missing required property "source"'));return n=n.concat(mr({key:h,value:a,valueSpec:v.layer,style:o.style,styleSpec:o.styleSpec,validateSpec:o.validateSpec,objectElementValidators:{"*":()=>[],type:()=>o.validateSpec({key:`${h}.type`,value:a.type,valueSpec:v.layer.type,style:o.style,styleSpec:o.styleSpec,validateSpec:o.validateSpec,object:a,objectKey:"type"}),filter:tl,layout:E=>mr({layer:a,key:E.key,value:E.value,style:E.style,styleSpec:E.styleSpec,validateSpec:E.validateSpec,objectElementValidators:{"*":T=>Ah(Wo({layerType:x},T))}}),paint:E=>mr({layer:a,key:E.key,value:E.value,style:E.style,styleSpec:E.styleSpec,validateSpec:E.validateSpec,objectElementValidators:{"*":T=>Ph(Wo({layerType:x},T))}})}})),n}function xa(o){const n=o.value,a=o.key,h=Ye(n);return h!=="string"?[new Ot(a,n,`string expected, ${h} found`)]:[]}const wd={promoteId:function({key:o,value:n}){if(Ye(n)==="string")return xa({key:o,value:n});{const a=[];for(const h in n)a.push(...xa({key:`${o}.${h}`,value:n[h]}));return a}}};function Id(o){const n=o.value,a=o.key,h=o.styleSpec,g=o.style,v=o.validateSpec;if(!n.type)return[new Ot(a,n,'"type" is required')];const x=Yn(n.type);let b;switch(x){case"vector":case"raster":return b=mr({key:a,value:n,valueSpec:h[`source_${x.replace("-","_")}`],style:o.style,styleSpec:h,objectElementValidators:wd,validateSpec:v}),b;case"raster-dem":return b=function(E){var T;const A=(T=E.sourceName)!==null&&T!==void 0?T:"",M=E.value,O=E.styleSpec,B=O.source_raster_dem,q=E.style;let Z=[];const Y=Ye(M);if(M===void 0)return Z;if(Y!=="object")return Z.push(new Ot("source_raster_dem",M,`object expected, ${Y} found`)),Z;const $=Yn(M.encoding)==="custom",lt=["redFactor","greenFactor","blueFactor","baseShift"],tt=E.value.encoding?`"${E.value.encoding}"`:"Default";for(const ot in M)!$&<.includes(ot)?Z.push(new Ot(ot,M[ot],`In "${A}": "${ot}" is only valid when "encoding" is set to "custom". ${tt} encoding found`)):B[ot]?Z=Z.concat(E.validateSpec({key:ot,value:M[ot],valueSpec:B[ot],validateSpec:E.validateSpec,style:q,styleSpec:O})):Z.push(new Ot(ot,M[ot],`unknown property "${ot}"`));return Z}({sourceName:a,value:n,style:o.style,styleSpec:h,validateSpec:v}),b;case"geojson":if(b=mr({key:a,value:n,valueSpec:h.source_geojson,style:g,styleSpec:h,validateSpec:v,objectElementValidators:wd}),n.cluster)for(const E in n.clusterProperties){const[T,A]=n.clusterProperties[E],M=typeof T=="string"?[T,["accumulated"],["get",E]]:T;b.push(...Ws({key:`${a}.${E}.map`,value:A,validateSpec:v,expressionContext:"cluster-map"})),b.push(...Ws({key:`${a}.${E}.reduce`,value:M,validateSpec:v,expressionContext:"cluster-reduce"}))}return b;case"video":return mr({key:a,value:n,valueSpec:h.source_video,style:g,validateSpec:v,styleSpec:h});case"image":return mr({key:a,value:n,valueSpec:h.source_image,style:g,validateSpec:v,styleSpec:h});case"canvas":return[new Ot(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Xs({key:`${a}.type`,value:n.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:g,validateSpec:v,styleSpec:h})}}function Ed(o){const n=o.value,a=o.styleSpec,h=a.light,g=o.style;let v=[];const x=Ye(n);if(n===void 0)return v;if(x!=="object")return v=v.concat([new Ot("light",n,`object expected, ${x} found`)]),v;for(const b in n){const E=b.match(/^(.*)-transition$/);v=v.concat(E&&h[E[1]]&&h[E[1]].transition?o.validateSpec({key:b,value:n[b],valueSpec:a.transition,validateSpec:o.validateSpec,style:g,styleSpec:a}):h[b]?o.validateSpec({key:b,value:n[b],valueSpec:h[b],validateSpec:o.validateSpec,style:g,styleSpec:a}):[new Ot(b,n[b],`unknown property "${b}"`)])}return v}function Sd(o){const n=o.value,a=o.styleSpec,h=a.sky,g=o.style,v=Ye(n);if(n===void 0)return[];if(v!=="object")return[new Ot("sky",n,`object expected, ${v} found`)];let x=[];for(const b in n)x=x.concat(h[b]?Jo({key:b,value:n[b],valueSpec:h[b],style:g,styleSpec:a}):[new Ot(b,n[b],`unknown property "${b}"`)]);return x}function jl(o){const n=o.value,a=o.styleSpec,h=a.terrain,g=o.style;let v=[];const x=Ye(n);if(n===void 0)return v;if(x!=="object")return v=v.concat([new Ot("terrain",n,`object expected, ${x} found`)]),v;for(const b in n)v=v.concat(h[b]?o.validateSpec({key:b,value:n[b],valueSpec:h[b],validateSpec:o.validateSpec,style:g,styleSpec:a}):[new Ot(b,n[b],`unknown property "${b}"`)]);return v}function Zl(o){let n=[];const a=o.value,h=o.key;if(Array.isArray(a)){const g=[],v=[];for(const x in a)a[x].id&&g.includes(a[x].id)&&n.push(new Ot(h,a,`all the sprites' ids must be unique, but ${a[x].id} is duplicated`)),g.push(a[x].id),a[x].url&&v.includes(a[x].url)&&n.push(new Ot(h,a,`all the sprites' URLs must be unique, but ${a[x].url} is duplicated`)),v.push(a[x].url),n=n.concat(mr({key:`${h}[${x}]`,value:a[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:o.validateSpec}));return n}return xa({key:h,value:a})}const Pr={"*":()=>[],array:Th,boolean:function(o){const n=o.value,a=o.key,h=Ye(n);return h!=="boolean"?[new Ot(a,n,`boolean expected, ${h} found`)]:[]},number:rc,color:function(o){const n=o.key,a=o.value,h=Ye(a);return h!=="string"?[new Ot(n,a,`color expected, ${h} found`)]:pn.parse(String(a))?[]:[new Ot(n,a,`color expected, "${a}" found`)]},constants:xd,enum:Xs,filter:tl,function:bd,layer:Gl,object:mr,source:Id,light:Ed,sky:Sd,terrain:jl,string:xa,formatted:function(o){return xa(o).length===0?[]:Ws(o)},resolvedImage:function(o){return xa(o).length===0?[]:Ws(o)},padding:function(o){const n=o.key,a=o.value;if(Ye(a)==="array"){if(a.length<1||a.length>4)return[new Ot(n,a,`padding requires 1 to 4 values; ${a.length} values found`)];const h={type:"number"};let g=[];for(let v=0;v[]}})),o.constants&&(a=a.concat(xd({key:"constants",value:o.constants,style:o,styleSpec:n,validateSpec:Jo}))),el(a)}function Qo(o){return function(n){return o({...n,validateSpec:Jo})}}function el(o){return[].concat(o).sort((n,a)=>n.line-a.line)}function So(o){return function(...n){return el(o.apply(this,n))}}Eo.source=So(Qo(Id)),Eo.sprite=So(Qo(Zl)),Eo.glyphs=So(Qo(Mh)),Eo.light=So(Qo(Ed)),Eo.sky=So(Qo(Sd)),Eo.terrain=So(Qo(jl)),Eo.layer=So(Qo(Gl)),Eo.filter=So(Qo(tl)),Eo.paintProperty=So(Qo(Ph)),Eo.layoutProperty=So(Qo(Ah));const ba=Eo,Jf=ba.light,Dh=ba.paintProperty,Qf=ba.layoutProperty;function nl(o,n){let a=!1;if(n&&n.length)for(const h of n)o.fire(new ui(new Error(h.message))),a=!0;return a}class Hl{constructor(n,a,h){const g=this.cells=[];if(n instanceof ArrayBuffer){this.arrayBuffer=n;const x=new Int32Array(this.arrayBuffer);n=x[0],this.d=(a=x[1])+2*(h=x[2]);for(let E=0;E=M[q+0]&&g>=M[q+1])?(b[B]=!0,x.push(A[B])):b[B]=!1}}}}_forEachCell(n,a,h,g,v,x,b,E){const T=this._convertToCellCoord(n),A=this._convertToCellCoord(a),M=this._convertToCellCoord(h),O=this._convertToCellCoord(g);for(let B=T;B<=M;B++)for(let q=A;q<=O;q++){const Z=this.d*q+B;if((!E||E(this._convertFromCellCoord(B),this._convertFromCellCoord(q),this._convertFromCellCoord(B+1),this._convertFromCellCoord(q+1)))&&v.call(this,n,a,h,g,Z,x,b,E))return}}_convertFromCellCoord(n){return(n-this.padding)/this.scale}_convertToCellCoord(n){return Math.max(0,Math.min(this.d-1,Math.floor(n*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const n=this.cells,a=3+this.cells.length+1+1;let h=0;for(let x=0;x=0)continue;const x=o[v];g[v]=$o[h].shallow.indexOf(v)>=0?x:il(x,n)}o instanceof Error&&(g.message=o.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(g.$name=h),g}throw new Error("can't serialize object of type "+typeof o)}function rl(o){if(o==null||typeof o=="boolean"||typeof o=="number"||typeof o=="string"||o instanceof Boolean||o instanceof Number||o instanceof String||o instanceof Date||o instanceof RegExp||o instanceof Blob||o instanceof Error||sc(o)||an(o)||ArrayBuffer.isView(o)||o instanceof ImageData)return o;if(Array.isArray(o))return o.map(rl);if(typeof o=="object"){const n=o.$name||"Object";if(!$o[n])throw new Error(`can't deserialize unregistered class ${n}`);const{klass:a}=$o[n];if(!a)throw new Error(`can't deserialize unregistered class ${n}`);if(a.deserialize)return a.deserialize(o);const h=Object.create(a.prototype);for(const g of Object.keys(o)){if(g==="$name")continue;const v=o[g];h[g]=$o[n].shallow.indexOf(g)>=0?v:rl(v)}return h}throw new Error("can't deserialize object of type "+typeof o)}class Cd{constructor(){this.first=!0}update(n,a){const h=Math.floor(n);return this.first?(this.first=!1,this.lastIntegerZoom=h,this.lastIntegerZoomTime=0,this.lastZoom=n,this.lastFloorZoom=h,!0):(this.lastFloorZoom>h?(this.lastIntegerZoom=h+1,this.lastIntegerZoomTime=a):this.lastFloorZoomo>=128&&o<=255,Arabic:o=>o>=1536&&o<=1791,"Arabic Supplement":o=>o>=1872&&o<=1919,"Arabic Extended-A":o=>o>=2208&&o<=2303,"Hangul Jamo":o=>o>=4352&&o<=4607,"Unified Canadian Aboriginal Syllabics":o=>o>=5120&&o<=5759,Khmer:o=>o>=6016&&o<=6143,"Unified Canadian Aboriginal Syllabics Extended":o=>o>=6320&&o<=6399,"General Punctuation":o=>o>=8192&&o<=8303,"Letterlike Symbols":o=>o>=8448&&o<=8527,"Number Forms":o=>o>=8528&&o<=8591,"Miscellaneous Technical":o=>o>=8960&&o<=9215,"Control Pictures":o=>o>=9216&&o<=9279,"Optical Character Recognition":o=>o>=9280&&o<=9311,"Enclosed Alphanumerics":o=>o>=9312&&o<=9471,"Geometric Shapes":o=>o>=9632&&o<=9727,"Miscellaneous Symbols":o=>o>=9728&&o<=9983,"Miscellaneous Symbols and Arrows":o=>o>=11008&&o<=11263,"CJK Radicals Supplement":o=>o>=11904&&o<=12031,"Kangxi Radicals":o=>o>=12032&&o<=12255,"Ideographic Description Characters":o=>o>=12272&&o<=12287,"CJK Symbols and Punctuation":o=>o>=12288&&o<=12351,Hiragana:o=>o>=12352&&o<=12447,Katakana:o=>o>=12448&&o<=12543,Bopomofo:o=>o>=12544&&o<=12591,"Hangul Compatibility Jamo":o=>o>=12592&&o<=12687,Kanbun:o=>o>=12688&&o<=12703,"Bopomofo Extended":o=>o>=12704&&o<=12735,"CJK Strokes":o=>o>=12736&&o<=12783,"Katakana Phonetic Extensions":o=>o>=12784&&o<=12799,"Enclosed CJK Letters and Months":o=>o>=12800&&o<=13055,"CJK Compatibility":o=>o>=13056&&o<=13311,"CJK Unified Ideographs Extension A":o=>o>=13312&&o<=19903,"Yijing Hexagram Symbols":o=>o>=19904&&o<=19967,"CJK Unified Ideographs":o=>o>=19968&&o<=40959,"Yi Syllables":o=>o>=40960&&o<=42127,"Yi Radicals":o=>o>=42128&&o<=42191,"Hangul Jamo Extended-A":o=>o>=43360&&o<=43391,"Hangul Syllables":o=>o>=44032&&o<=55215,"Hangul Jamo Extended-B":o=>o>=55216&&o<=55295,"Private Use Area":o=>o>=57344&&o<=63743,"CJK Compatibility Ideographs":o=>o>=63744&&o<=64255,"Arabic Presentation Forms-A":o=>o>=64336&&o<=65023,"Vertical Forms":o=>o>=65040&&o<=65055,"CJK Compatibility Forms":o=>o>=65072&&o<=65103,"Small Form Variants":o=>o>=65104&&o<=65135,"Arabic Presentation Forms-B":o=>o>=65136&&o<=65279,"Halfwidth and Fullwidth Forms":o=>o>=65280&&o<=65519};function ol(o){for(const n of o)if(ac(n.charCodeAt(0)))return!0;return!1}function Td(o){for(const n of o)if(!Ld(n.charCodeAt(0)))return!1;return!0}function Ld(o){return!(Wt.Arabic(o)||Wt["Arabic Supplement"](o)||Wt["Arabic Extended-A"](o)||Wt["Arabic Presentation Forms-A"](o)||Wt["Arabic Presentation Forms-B"](o))}function ac(o){return!(o!==746&&o!==747&&(o<4352||!(Wt["Bopomofo Extended"](o)||Wt.Bopomofo(o)||Wt["CJK Compatibility Forms"](o)&&!(o>=65097&&o<=65103)||Wt["CJK Compatibility Ideographs"](o)||Wt["CJK Compatibility"](o)||Wt["CJK Radicals Supplement"](o)||Wt["CJK Strokes"](o)||!(!Wt["CJK Symbols and Punctuation"](o)||o>=12296&&o<=12305||o>=12308&&o<=12319||o===12336)||Wt["CJK Unified Ideographs Extension A"](o)||Wt["CJK Unified Ideographs"](o)||Wt["Enclosed CJK Letters and Months"](o)||Wt["Hangul Compatibility Jamo"](o)||Wt["Hangul Jamo Extended-A"](o)||Wt["Hangul Jamo Extended-B"](o)||Wt["Hangul Jamo"](o)||Wt["Hangul Syllables"](o)||Wt.Hiragana(o)||Wt["Ideographic Description Characters"](o)||Wt.Kanbun(o)||Wt["Kangxi Radicals"](o)||Wt["Katakana Phonetic Extensions"](o)||Wt.Katakana(o)&&o!==12540||!(!Wt["Halfwidth and Fullwidth Forms"](o)||o===65288||o===65289||o===65293||o>=65306&&o<=65310||o===65339||o===65341||o===65343||o>=65371&&o<=65503||o===65507||o>=65512&&o<=65519)||!(!Wt["Small Form Variants"](o)||o>=65112&&o<=65118||o>=65123&&o<=65126)||Wt["Unified Canadian Aboriginal Syllabics"](o)||Wt["Unified Canadian Aboriginal Syllabics Extended"](o)||Wt["Vertical Forms"](o)||Wt["Yijing Hexagram Symbols"](o)||Wt["Yi Syllables"](o)||Wt["Yi Radicals"](o))))}function Rh(o){return!(ac(o)||function(n){return!!(Wt["Latin-1 Supplement"](n)&&(n===167||n===169||n===174||n===177||n===188||n===189||n===190||n===215||n===247)||Wt["General Punctuation"](n)&&(n===8214||n===8224||n===8225||n===8240||n===8241||n===8251||n===8252||n===8258||n===8263||n===8264||n===8265||n===8273)||Wt["Letterlike Symbols"](n)||Wt["Number Forms"](n)||Wt["Miscellaneous Technical"](n)&&(n>=8960&&n<=8967||n>=8972&&n<=8991||n>=8996&&n<=9e3||n===9003||n>=9085&&n<=9114||n>=9150&&n<=9165||n===9167||n>=9169&&n<=9179||n>=9186&&n<=9215)||Wt["Control Pictures"](n)&&n!==9251||Wt["Optical Character Recognition"](n)||Wt["Enclosed Alphanumerics"](n)||Wt["Geometric Shapes"](n)||Wt["Miscellaneous Symbols"](n)&&!(n>=9754&&n<=9759)||Wt["Miscellaneous Symbols and Arrows"](n)&&(n>=11026&&n<=11055||n>=11088&&n<=11097||n>=11192&&n<=11243)||Wt["CJK Symbols and Punctuation"](n)||Wt.Katakana(n)||Wt["Private Use Area"](n)||Wt["CJK Compatibility Forms"](n)||Wt["Small Form Variants"](n)||Wt["Halfwidth and Fullwidth Forms"](n)||n===8734||n===8756||n===8757||n>=9984&&n<=10087||n>=10102&&n<=10131||n===65532||n===65533)}(o))}function lc(o){return o>=1424&&o<=2303||Wt["Arabic Presentation Forms-A"](o)||Wt["Arabic Presentation Forms-B"](o)}function Pd(o,n){return!(!n&&lc(o)||o>=2304&&o<=3583||o>=3840&&o<=4255||Wt.Khmer(o))}function $f(o){for(const n of o)if(lc(n.charCodeAt(0)))return!0;return!1}const Ys=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(o){this.pluginStatus=o.pluginStatus,this.pluginURL=o.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(o){this.applyArabicShaping=o.applyArabicShaping,this.processBidirectionalText=o.processBidirectionalText,this.processStyledBidirectionalText=o.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class zn{constructor(n,a){this.zoom=n,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Cd,this.transition={})}isSupportedScript(n){return function(a,h){for(const g of a)if(!Pd(g.charCodeAt(0),h))return!1;return!0}(n,Ys.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const n=this.zoom,a=n-Math.floor(n),h=this.crossFadingFactor();return n>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:a+(1-a)*h}:{fromScale:.5,toScale:1,t:1-(1-h)*a}}}class Wl{constructor(n,a){this.property=n,this.value=a,this.expression=function(h,g){if(Yu(h))return new Ju(h,g);if(En(h)){const v=md(h,g);if(v.result==="error")throw new Error(v.value.map(x=>`${x.key}: ${x.message}`).join(", "));return v.value}{let v=h;return g.type==="color"&&typeof h=="string"?v=pn.parse(h):g.type!=="padding"||typeof h!="number"&&!Array.isArray(h)?g.type==="variableAnchorOffsetCollection"&&Array.isArray(h)&&(v=ao.parse(h)):v=Lr.parse(h),{kind:"constant",evaluate:()=>v}}}(a===void 0?n.specification.default:a,n.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(n,a,h){return this.property.possiblyEvaluate(this,n,a,h)}}class uc{constructor(n){this.property=n,this.value=new Wl(n,void 0)}transitioned(n,a){return new Ad(this.property,this.value,a,he({},n.transition,this.transition),n.now)}untransitioned(){return new Ad(this.property,this.value,null,{},0)}}class Nh{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitionablePropertyValues)}getValue(n){return Nt(this._values[n].value.value)}setValue(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new uc(this._values[n].property)),this._values[n].value=new Wl(this._values[n].property,a===null?void 0:Nt(a))}getTransition(n){return Nt(this._values[n].transition)}setTransition(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new uc(this._values[n].property)),this._values[n].transition=Nt(a)||void 0}serialize(){const n={};for(const a of Object.keys(this._values)){const h=this.getValue(a);h!==void 0&&(n[a]=h);const g=this.getTransition(a);g!==void 0&&(n[`${a}-transition`]=g)}return n}transitioned(n,a){const h=new Md(this._properties);for(const g of Object.keys(this._values))h._values[g]=this._values[g].transitioned(n,a._values[g]);return h}untransitioned(){const n=new Md(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].untransitioned();return n}}class Ad{constructor(n,a,h,g,v){this.property=n,this.value=a,this.begin=v+g.delay||0,this.end=this.begin+g.duration||0,n.specification.transition&&(g.delay||g.duration)&&(this.prior=h)}possiblyEvaluate(n,a,h){const g=n.now||0,v=this.value.possiblyEvaluate(n,a,h),x=this.prior;if(x){if(g>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(g=1)return 1;const T=E*E,A=T*E;return 4*(E<.5?A:3*(E-T)+A-.75)}(b))}}return v}}class Md{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitioningPropertyValues)}possiblyEvaluate(n,a,h){const g=new Xl(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].possiblyEvaluate(n,a,h);return g}hasTransition(){for(const n of Object.keys(this._values))if(this._values[n].prior)return!0;return!1}}class Dd{constructor(n){this._properties=n,this._values=Object.create(n.defaultPropertyValues)}hasValue(n){return this._values[n].value!==void 0}getValue(n){return Nt(this._values[n].value)}setValue(n,a){this._values[n]=new Wl(this._values[n].property,a===null?void 0:Nt(a))}serialize(){const n={};for(const a of Object.keys(this._values)){const h=this.getValue(a);h!==void 0&&(n[a]=h)}return n}possiblyEvaluate(n,a,h){const g=new Xl(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].possiblyEvaluate(n,a,h);return g}}class Co{constructor(n,a,h){this.property=n,this.value=a,this.parameters=h}isConstant(){return this.value.kind==="constant"}constantOr(n){return this.value.kind==="constant"?this.value.value:n}evaluate(n,a,h,g){return this.property.evaluate(this.value,this.parameters,n,a,h,g)}}class Xl{constructor(n){this._properties=n,this._values=Object.create(n.defaultPossiblyEvaluatedValues)}get(n){return this._values[n]}}class ne{constructor(n){this.specification=n}possiblyEvaluate(n,a){if(n.isDataDriven())throw new Error("Value should not be data driven");return n.expression.evaluate(a)}interpolate(n,a,h){const g=fr[this.specification.type];return g?g(n,a,h):n}}class ue{constructor(n,a){this.specification=n,this.overrides=a}possiblyEvaluate(n,a,h,g){return new Co(this,n.expression.kind==="constant"||n.expression.kind==="camera"?{kind:"constant",value:n.expression.evaluate(a,null,{},h,g)}:n.expression,a)}interpolate(n,a,h){if(n.value.kind!=="constant"||a.value.kind!=="constant")return n;if(n.value.value===void 0||a.value.value===void 0)return new Co(this,{kind:"constant",value:void 0},n.parameters);const g=fr[this.specification.type];if(g){const v=g(n.value.value,a.value.value,h);return new Co(this,{kind:"constant",value:v},n.parameters)}return n}evaluate(n,a,h,g,v,x){return n.kind==="constant"?n.value:n.evaluate(a,h,g,v,x)}}class cc extends ue{possiblyEvaluate(n,a,h,g){if(n.value===void 0)return new Co(this,{kind:"constant",value:void 0},a);if(n.expression.kind==="constant"){const v=n.expression.evaluate(a,null,{},h,g),x=n.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,b=this._calculate(x,x,x,a);return new Co(this,{kind:"constant",value:b},a)}if(n.expression.kind==="camera"){const v=this._calculate(n.expression.evaluate({zoom:a.zoom-1}),n.expression.evaluate({zoom:a.zoom}),n.expression.evaluate({zoom:a.zoom+1}),a);return new Co(this,{kind:"constant",value:v},a)}return new Co(this,n.expression,a)}evaluate(n,a,h,g,v,x){if(n.kind==="source"){const b=n.evaluate(a,h,g,v,x);return this._calculate(b,b,b,a)}return n.kind==="composite"?this._calculate(n.evaluate({zoom:Math.floor(a.zoom)-1},h,g),n.evaluate({zoom:Math.floor(a.zoom)},h,g),n.evaluate({zoom:Math.floor(a.zoom)+1},h,g),a):n.value}_calculate(n,a,h,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:h,to:a}}interpolate(n){return n}}class Yl{constructor(n){this.specification=n}possiblyEvaluate(n,a,h,g){if(n.value!==void 0){if(n.expression.kind==="constant"){const v=n.expression.evaluate(a,null,{},h,g);return this._calculate(v,v,v,a)}return this._calculate(n.expression.evaluate(new zn(Math.floor(a.zoom-1),a)),n.expression.evaluate(new zn(Math.floor(a.zoom),a)),n.expression.evaluate(new zn(Math.floor(a.zoom+1),a)),a)}}_calculate(n,a,h,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:h,to:a}}interpolate(n){return n}}class kh{constructor(n){this.specification=n}possiblyEvaluate(n,a,h,g){return!!n.expression.evaluate(a,null,{},h,g)}interpolate(){return!1}}class Ar{constructor(n){this.properties=n,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const a in n){const h=n[a];h.specification.overridable&&this.overridableProperties.push(a);const g=this.defaultPropertyValues[a]=new Wl(h,void 0),v=this.defaultTransitionablePropertyValues[a]=new uc(h);this.defaultTransitioningPropertyValues[a]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=g.possiblyEvaluate({})}}}Qt("DataDrivenProperty",ue),Qt("DataConstantProperty",ne),Qt("CrossFadedDataDrivenProperty",cc),Qt("CrossFadedProperty",Yl),Qt("ColorRampProperty",kh);const zh="-transition";class To extends Nn{constructor(n,a){if(super(),this.id=n.id,this.type=n.type,this._featureFilter={filter:()=>!0,needGeometry:!1},n.type!=="custom"&&(this.metadata=n.metadata,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,n.type!=="background"&&(this.source=n.source,this.sourceLayer=n["source-layer"],this.filter=n.filter),a.layout&&(this._unevaluatedLayout=new Dd(a.layout)),a.paint)){this._transitionablePaint=new Nh(a.paint);for(const h in n.paint)this.setPaintProperty(h,n.paint[h],{validate:!1});for(const h in n.layout)this.setLayoutProperty(h,n.layout[h],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Xl(a.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(n){return n==="visibility"?this.visibility:this._unevaluatedLayout.getValue(n)}setLayoutProperty(n,a,h={}){a!=null&&this._validate(Qf,`layers.${this.id}.layout.${n}`,n,a,h)||(n!=="visibility"?this._unevaluatedLayout.setValue(n,a):this.visibility=a)}getPaintProperty(n){return n.endsWith(zh)?this._transitionablePaint.getTransition(n.slice(0,-11)):this._transitionablePaint.getValue(n)}setPaintProperty(n,a,h={}){if(a!=null&&this._validate(Dh,`layers.${this.id}.paint.${n}`,n,a,h))return!1;if(n.endsWith(zh))return this._transitionablePaint.setTransition(n.slice(0,-11),a||void 0),!1;{const g=this._transitionablePaint._values[n],v=g.property.specification["property-type"]==="cross-faded-data-driven",x=g.value.isDataDriven(),b=g.value;this._transitionablePaint.setValue(n,a),this._handleSpecialPaintPropertyUpdate(n);const E=this._transitionablePaint._values[n].value;return E.isDataDriven()||x||v||this._handleOverridablePaintPropertyUpdate(n,b,E)}}_handleSpecialPaintPropertyUpdate(n){}_handleOverridablePaintPropertyUpdate(n,a,h){return!1}isHidden(n){return!!(this.minzoom&&n=this.maxzoom)||this.visibility==="none"}updateTransitions(n){this._transitioningPaint=this._transitionablePaint.transitioned(n,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(n,a){n.getCrossfadeParameters&&(this._crossfadeParameters=n.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(n,void 0,a)),this.paint=this._transitioningPaint.possiblyEvaluate(n,void 0,a)}serialize(){const n={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&&(n.layout=n.layout||{},n.layout.visibility=this.visibility),be(n,(a,h)=>!(a===void 0||h==="layout"&&!Object.keys(a).length||h==="paint"&&!Object.keys(a).length))}_validate(n,a,h,g,v={}){return(!v||v.validate!==!1)&&nl(this,n.call(ba,{key:a,layerType:this.type,objectKey:h,value:g,styleSpec:_t,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const n in this.paint._values){const a=this.paint.get(n);if(a instanceof Co&&$a(a.property.specification)&&(a.value.kind==="source"||a.value.kind==="composite")&&a.value.isStateDependent)return!0}return!1}}const Rd={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Kl{constructor(n,a){this._structArray=n,this._pos1=a*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Kn{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(n,a){return n._trim(),a&&(n.isTransferred=!0,a.push(n.arrayBuffer)),{length:n.length,arrayBuffer:n.arrayBuffer}}static deserialize(n){const a=Object.create(this.prototype);return a.arrayBuffer=n.arrayBuffer,a.length=n.length,a.capacity=n.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_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(n){this.reserve(n),this.length=n}reserve(n){if(n>this.capacity){this.capacity=Math.max(n,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const a=this.uint8;this._refreshViews(),a&&this.uint8.set(a)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function hi(o,n=1){let a=0,h=0;return{members:o.map(g=>{const v=Rd[g.type].BYTES_PER_ELEMENT,x=a=Nd(a,Math.max(n,v)),b=g.components||1;return h=Math.max(h,v),a+=v*b,{name:g.name,type:g.type,components:b,offset:x}}),size:Nd(a,Math.max(h,n)),alignment:n}}function Nd(o,n){return Math.ceil(o/n)*n}class Jl extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a){const h=this.length;return this.resize(h+1),this.emplace(h,n,a)}emplace(n,a,h){const g=2*n;return this.int16[g+0]=a,this.int16[g+1]=h,n}}Jl.prototype.bytesPerElement=4,Qt("StructArrayLayout2i4",Jl);class bs extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h){const g=this.length;return this.resize(g+1),this.emplace(g,n,a,h)}emplace(n,a,h,g){const v=3*n;return this.int16[v+0]=a,this.int16[v+1]=h,this.int16[v+2]=g,n}}bs.prototype.bytesPerElement=6,Qt("StructArrayLayout3i6",bs);class Oh extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,a,h,g)}emplace(n,a,h,g,v){const x=4*n;return this.int16[x+0]=a,this.int16[x+1]=h,this.int16[x+2]=g,this.int16[x+3]=v,n}}Oh.prototype.bytesPerElement=8,Qt("StructArrayLayout4i8",Oh);class Fh extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,h,g,v,x)}emplace(n,a,h,g,v,x,b){const E=6*n;return this.int16[E+0]=a,this.int16[E+1]=h,this.int16[E+2]=g,this.int16[E+3]=v,this.int16[E+4]=x,this.int16[E+5]=b,n}}Fh.prototype.bytesPerElement=12,Qt("StructArrayLayout2i4i12",Fh);class Bh extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,h,g,v,x)}emplace(n,a,h,g,v,x,b){const E=4*n,T=8*n;return this.int16[E+0]=a,this.int16[E+1]=h,this.uint8[T+4]=g,this.uint8[T+5]=v,this.uint8[T+6]=x,this.uint8[T+7]=b,n}}Bh.prototype.bytesPerElement=8,Qt("StructArrayLayout2i4ub8",Bh);class Ql extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a){const h=this.length;return this.resize(h+1),this.emplace(h,n,a)}emplace(n,a,h){const g=2*n;return this.float32[g+0]=a,this.float32[g+1]=h,n}}Ql.prototype.bytesPerElement=8,Qt("StructArrayLayout2f8",Ql);class hc extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x,b,E,T,A){const M=this.length;return this.resize(M+1),this.emplace(M,n,a,h,g,v,x,b,E,T,A)}emplace(n,a,h,g,v,x,b,E,T,A,M){const O=10*n;return this.uint16[O+0]=a,this.uint16[O+1]=h,this.uint16[O+2]=g,this.uint16[O+3]=v,this.uint16[O+4]=x,this.uint16[O+5]=b,this.uint16[O+6]=E,this.uint16[O+7]=T,this.uint16[O+8]=A,this.uint16[O+9]=M,n}}hc.prototype.bytesPerElement=20,Qt("StructArrayLayout10ui20",hc);class Vh extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x,b,E,T,A,M,O){const B=this.length;return this.resize(B+1),this.emplace(B,n,a,h,g,v,x,b,E,T,A,M,O)}emplace(n,a,h,g,v,x,b,E,T,A,M,O,B){const q=12*n;return this.int16[q+0]=a,this.int16[q+1]=h,this.int16[q+2]=g,this.int16[q+3]=v,this.uint16[q+4]=x,this.uint16[q+5]=b,this.uint16[q+6]=E,this.uint16[q+7]=T,this.int16[q+8]=A,this.int16[q+9]=M,this.int16[q+10]=O,this.int16[q+11]=B,n}}Vh.prototype.bytesPerElement=24,Qt("StructArrayLayout4i4ui4i24",Vh);class Uh extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,h){const g=this.length;return this.resize(g+1),this.emplace(g,n,a,h)}emplace(n,a,h,g){const v=3*n;return this.float32[v+0]=a,this.float32[v+1]=h,this.float32[v+2]=g,n}}Uh.prototype.bytesPerElement=12,Qt("StructArrayLayout3f12",Uh);class ws extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint32[1*n+0]=a,n}}ws.prototype.bytesPerElement=4,Qt("StructArrayLayout1ul4",ws);class pc extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x,b,E,T){const A=this.length;return this.resize(A+1),this.emplace(A,n,a,h,g,v,x,b,E,T)}emplace(n,a,h,g,v,x,b,E,T,A){const M=10*n,O=5*n;return this.int16[M+0]=a,this.int16[M+1]=h,this.int16[M+2]=g,this.int16[M+3]=v,this.int16[M+4]=x,this.int16[M+5]=b,this.uint32[O+3]=E,this.uint16[M+8]=T,this.uint16[M+9]=A,n}}pc.prototype.bytesPerElement=20,Qt("StructArrayLayout6i1ul2ui20",pc);class $l extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,h,g,v,x)}emplace(n,a,h,g,v,x,b){const E=6*n;return this.int16[E+0]=a,this.int16[E+1]=h,this.int16[E+2]=g,this.int16[E+3]=v,this.int16[E+4]=x,this.int16[E+5]=b,n}}$l.prototype.bytesPerElement=12,Qt("StructArrayLayout2i2i2i12",$l);class dc extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v){const x=this.length;return this.resize(x+1),this.emplace(x,n,a,h,g,v)}emplace(n,a,h,g,v,x){const b=4*n,E=8*n;return this.float32[b+0]=a,this.float32[b+1]=h,this.float32[b+2]=g,this.int16[E+6]=v,this.int16[E+7]=x,n}}dc.prototype.bytesPerElement=16,Qt("StructArrayLayout2f1f2i16",dc);class tu extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,a,h,g)}emplace(n,a,h,g,v){const x=12*n,b=3*n;return this.uint8[x+0]=a,this.uint8[x+1]=h,this.float32[b+1]=g,this.float32[b+2]=v,n}}tu.prototype.bytesPerElement=12,Qt("StructArrayLayout2ub2f12",tu);class fc extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,h){const g=this.length;return this.resize(g+1),this.emplace(g,n,a,h)}emplace(n,a,h,g){const v=3*n;return this.uint16[v+0]=a,this.uint16[v+1]=h,this.uint16[v+2]=g,n}}fc.prototype.bytesPerElement=6,Qt("StructArrayLayout3ui6",fc);class sl extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$){const lt=this.length;return this.resize(lt+1),this.emplace(lt,n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$)}emplace(n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$,lt){const tt=24*n,ot=12*n,wt=48*n;return this.int16[tt+0]=a,this.int16[tt+1]=h,this.uint16[tt+2]=g,this.uint16[tt+3]=v,this.uint32[ot+2]=x,this.uint32[ot+3]=b,this.uint32[ot+4]=E,this.uint16[tt+10]=T,this.uint16[tt+11]=A,this.uint16[tt+12]=M,this.float32[ot+7]=O,this.float32[ot+8]=B,this.uint8[wt+36]=q,this.uint8[wt+37]=Z,this.uint8[wt+38]=Y,this.uint32[ot+10]=$,this.int16[tt+22]=lt,n}}sl.prototype.bytesPerElement=48,Qt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",sl);class wa extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$,lt,tt,ot,wt,Tt,Yt,te,Xt,Ht,Ft,$t){const Ut=this.length;return this.resize(Ut+1),this.emplace(Ut,n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$,lt,tt,ot,wt,Tt,Yt,te,Xt,Ht,Ft,$t)}emplace(n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z,Y,$,lt,tt,ot,wt,Tt,Yt,te,Xt,Ht,Ft,$t,Ut){const Mt=32*n,ae=16*n;return this.int16[Mt+0]=a,this.int16[Mt+1]=h,this.int16[Mt+2]=g,this.int16[Mt+3]=v,this.int16[Mt+4]=x,this.int16[Mt+5]=b,this.int16[Mt+6]=E,this.int16[Mt+7]=T,this.uint16[Mt+8]=A,this.uint16[Mt+9]=M,this.uint16[Mt+10]=O,this.uint16[Mt+11]=B,this.uint16[Mt+12]=q,this.uint16[Mt+13]=Z,this.uint16[Mt+14]=Y,this.uint16[Mt+15]=$,this.uint16[Mt+16]=lt,this.uint16[Mt+17]=tt,this.uint16[Mt+18]=ot,this.uint16[Mt+19]=wt,this.uint16[Mt+20]=Tt,this.uint16[Mt+21]=Yt,this.uint16[Mt+22]=te,this.uint32[ae+12]=Xt,this.float32[ae+13]=Ht,this.float32[ae+14]=Ft,this.uint16[Mt+30]=$t,this.uint16[Mt+31]=Ut,n}}wa.prototype.bytesPerElement=64,Qt("StructArrayLayout8i15ui1ul2f2ui64",wa);class mc extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.float32[1*n+0]=a,n}}mc.prototype.bytesPerElement=4,Qt("StructArrayLayout1f4",mc);class gc extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,h){const g=this.length;return this.resize(g+1),this.emplace(g,n,a,h)}emplace(n,a,h,g){const v=3*n;return this.uint16[6*n+0]=a,this.float32[v+1]=h,this.float32[v+2]=g,n}}gc.prototype.bytesPerElement=12,Qt("StructArrayLayout1ui2f12",gc);class Ia extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,h){const g=this.length;return this.resize(g+1),this.emplace(g,n,a,h)}emplace(n,a,h,g){const v=4*n;return this.uint32[2*n+0]=a,this.uint16[v+2]=h,this.uint16[v+3]=g,n}}Ia.prototype.bytesPerElement=8,Qt("StructArrayLayout1ul2ui8",Ia);class qh extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a){const h=this.length;return this.resize(h+1),this.emplace(h,n,a)}emplace(n,a,h){const g=2*n;return this.uint16[g+0]=a,this.uint16[g+1]=h,n}}qh.prototype.bytesPerElement=4,Qt("StructArrayLayout2ui4",qh);class Gh extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint16[1*n+0]=a,n}}Gh.prototype.bytesPerElement=2,Qt("StructArrayLayout1ui2",Gh);class _c extends Kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,n,a,h,g)}emplace(n,a,h,g,v){const x=4*n;return this.float32[x+0]=a,this.float32[x+1]=h,this.float32[x+2]=g,this.float32[x+3]=v,n}}_c.prototype.bytesPerElement=16,Qt("StructArrayLayout4f16",_c);class kd extends Kl{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 k(this.anchorPointX,this.anchorPointY)}}kd.prototype.size=20;class _ extends pc{get(n){return new kd(this,n)}}Qt("CollisionBoxArray",_);class i extends Kl{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(n){this._structArray.uint8[this._pos1+37]=n}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(n){this._structArray.uint8[this._pos1+38]=n}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(n){this._structArray.uint32[this._pos4+10]=n}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}i.prototype.size=48;class u extends sl{get(n){return new i(this,n)}}Qt("PlacedSymbolArray",u);class d extends Kl{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(n){this._structArray.uint32[this._pos4+12]=n}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]}}d.prototype.size=64;class f extends wa{get(n){return new d(this,n)}}Qt("SymbolInstanceArray",f);class y extends mc{getoffsetX(n){return this.float32[1*n+0]}}Qt("GlyphOffsetArray",y);class w extends bs{getx(n){return this.int16[3*n+0]}gety(n){return this.int16[3*n+1]}gettileUnitDistanceFromAnchor(n){return this.int16[3*n+2]}}Qt("SymbolLineVertexArray",w);class I extends Kl{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]}}I.prototype.size=12;class C extends gc{get(n){return new I(this,n)}}Qt("TextAnchorOffsetArray",C);class P extends Kl{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]}}P.prototype.size=8;class D extends Ia{get(n){return new P(this,n)}}Qt("FeatureIndexArray",D);class N extends Jl{}class V extends Jl{}class X extends Jl{}class W extends Fh{}class J extends Bh{}class j extends Ql{}class nt extends hc{}class ft extends Vh{}class Q extends Uh{}class st extends ws{}class mt extends $l{}class gt extends tu{}class xt extends fc{}class At extends qh{}const Pt=hi([{name:"a_pos",components:2,type:"Int16"}],4),{members:zt}=Pt;class Bt{constructor(n=[]){this.segments=n}prepareSegment(n,a,h,g){let v=this.segments[this.segments.length-1];return n>Bt.MAX_VERTEX_ARRAY_LENGTH&&ke(`Max vertices per segment is ${Bt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${n}`),(!v||v.vertexLength+n>Bt.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==g)&&(v={vertexOffset:a.length,primitiveOffset:h.length,vertexLength:0,primitiveLength:0},g!==void 0&&(v.sortKey=g),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const n of this.segments)for(const a in n.vaos)n.vaos[a].destroy()}static simpleSegment(n,a,h,g){return new Bt([{vertexOffset:n,primitiveOffset:a,vertexLength:h,primitiveLength:g,vaos:{},sortKey:0}])}}function Se(o,n){return 256*(o=de(Math.floor(o),0,255))+de(Math.floor(n),0,255)}Bt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Qt("SegmentVector",Bt);const Vt=hi([{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 ce={exports:{}},Ce={exports:{}};Ce.exports=function(o,n){var a,h,g,v,x,b,E,T;for(h=o.length-(a=3&o.length),g=n,x=3432918353,b=461845907,T=0;T>>16)*x&65535)<<16)&4294967295)<<15|E>>>17))*b+(((E>>>16)*b&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(E=0,a){case 3:E^=(255&o.charCodeAt(T+2))<<16;case 2:E^=(255&o.charCodeAt(T+1))<<8;case 1:g^=E=(65535&(E=(E=(65535&(E^=255&o.charCodeAt(T)))*x+(((E>>>16)*x&65535)<<16)&4294967295)<<15|E>>>17))*b+(((E>>>16)*b&65535)<<16)&4294967295}return g^=o.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var He=Ce.exports,ge={exports:{}};ge.exports=function(o,n){for(var a,h=o.length,g=n^h,v=0;h>=4;)a=1540483477*(65535&(a=255&o.charCodeAt(v)|(255&o.charCodeAt(++v))<<8|(255&o.charCodeAt(++v))<<16|(255&o.charCodeAt(++v))<<24))+((1540483477*(a>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),h-=4,++v;switch(h){case 3:g^=(255&o.charCodeAt(v+2))<<16;case 2:g^=(255&o.charCodeAt(v+1))<<8;case 1:g=1540483477*(65535&(g^=255&o.charCodeAt(v)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var Ae=He,Ne=ge.exports;ce.exports=Ae,ce.exports.murmur3=Ae,ce.exports.murmur2=Ne;var Jn=S(ce.exports);class fn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(n,a,h,g){this.ids.push(Hr(n)),this.positions.push(a,h,g)}getPositions(n){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const a=Hr(n);let h=0,g=this.ids.length-1;for(;h>1;this.ids[x]>=a?g=x:h=x+1}const v=[];for(;this.ids[h]===a;)v.push({index:this.positions[3*h],start:this.positions[3*h+1],end:this.positions[3*h+2]}),h++;return v}static serialize(n,a){const h=new Float64Array(n.ids),g=new Uint32Array(n.positions);return Ci(h,g,0,h.length-1),a&&a.push(h.buffer,g.buffer),{ids:h,positions:g}}static deserialize(n){const a=new fn;return a.ids=n.ids,a.positions=n.positions,a.indexed=!0,a}}function Hr(o){const n=+o;return!isNaN(n)&&n<=Number.MAX_SAFE_INTEGER?n:Jn(String(o))}function Ci(o,n,a,h){for(;a>1];let v=a-1,x=h+1;for(;;){do v++;while(o[v]g);if(v>=x)break;qn(o,v,x),qn(n,3*v,3*x),qn(n,3*v+1,3*x+1),qn(n,3*v+2,3*x+2)}x-a`u_${g}`),this.type=h}setUniform(n,a,h){n.set(h.constantOr(this.value))}getBinding(n,a,h){return this.type==="color"?new Ks(n,a):new Wr(n,a)}}class xi{constructor(n,a){this.uniformNames=a.map(h=>`u_${h}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(n,a){this.pixelRatioFrom=a.pixelRatio,this.pixelRatioTo=n.pixelRatio,this.patternFrom=a.tlbr,this.patternTo=n.tlbr}setUniform(n,a,h,g){const v=g==="u_pattern_to"?this.patternTo:g==="u_pattern_from"?this.patternFrom:g==="u_pixel_ratio_to"?this.pixelRatioTo:g==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&n.set(v)}getBinding(n,a,h){return h.substr(0,9)==="u_pattern"?new ts(n,a):new Wr(n,a)}}class Gn{constructor(n,a,h,g){this.expression=n,this.type=h,this.maxValue=0,this.paintVertexAttributes=a.map(v=>({name:`a_${v}`,type:"Float32",components:h==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(n,a,h,g,v){const x=this.paintVertexArray.length,b=this.expression.evaluate(new zn(0),a,{},g,[],v);this.paintVertexArray.resize(n),this._setPaintValue(x,n,b)}updatePaintArray(n,a,h,g){const v=this.expression.evaluate({zoom:0},h,g);this._setPaintValue(n,a,v)}_setPaintValue(n,a,h){if(this.type==="color"){const g=Js(h);for(let v=n;v`u_${b}_t`),this.type=h,this.useIntegerZoom=g,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=a.map(b=>({name:`a_${b}`,type:"Float32",components:h==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(n,a,h,g,v){const x=this.expression.evaluate(new zn(this.zoom),a,{},g,[],v),b=this.expression.evaluate(new zn(this.zoom+1),a,{},g,[],v),E=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValue(E,n,x,b)}updatePaintArray(n,a,h,g){const v=this.expression.evaluate({zoom:this.zoom},h,g),x=this.expression.evaluate({zoom:this.zoom+1},h,g);this._setPaintValue(n,a,v,x)}_setPaintValue(n,a,h,g){if(this.type==="color"){const v=Js(h),x=Js(g);for(let b=n;b`#define HAS_UNIFORM_${g}`))}return n}getBinderAttributes(){const n=[];for(const a in this.binders){const h=this.binders[a];if(h instanceof Gn||h instanceof On)for(let g=0;g!0){this.programConfigurations={};for(const g of n)this.programConfigurations[g.id]=new bi(g,a,h);this.needsUpload=!1,this._featureMap=new fn,this._bufferOffset=0}populatePaintArrays(n,a,h,g,v,x){for(const b in this.programConfigurations)this.programConfigurations[b].populatePaintArrays(n,a,g,v,x);a.id!==void 0&&this._featureMap.add(a.id,h,this._bufferOffset,n),this._bufferOffset=n,this.needsUpload=!0}updatePaintArrays(n,a,h,g){for(const v of h)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(n,this._featureMap,a,v,g)||this.needsUpload}get(n){return this.programConfigurations[n]}upload(n){if(this.needsUpload){for(const a in this.programConfigurations)this.programConfigurations[a].upload(n);this.needsUpload=!1}}destroy(){for(const n in this.programConfigurations)this.programConfigurations[n].destroy()}}function co(o,n){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"]}[o]||[o.replace(`${n}-`,"").replace(/-/g,"_")]}function wi(o,n,a){const h={color:{source:Ql,composite:_c},number:{source:mc,composite:Ql}},g=function(v){return{"line-pattern":{source:nt,composite:nt},"fill-pattern":{source:nt,composite:nt},"fill-extrusion-pattern":{source:nt,composite:nt}}[v]}(o);return g&&g[a]||h[n][a]}Qt("ConstantBinder",es),Qt("CrossFadedConstantBinder",xi),Qt("SourceExpressionBinder",Gn),Qt("CrossFadedCompositeBinder",uo),Qt("CompositeExpressionBinder",On),Qt("ProgramConfiguration",bi,{omit:["_buffers"]}),Qt("ProgramConfigurationSet",jn);const ri=8192,jh=Math.pow(2,14)-1,zd=-jh-1;function Ea(o){const n=ri/o.extent,a=o.loadGeometry();for(let h=0;hx.x+1||Ex.y+1)&&ke("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return a}function Sa(o,n){return{type:o.type,id:o.id,properties:o.properties,geometry:n?Ea(o):[]}}function yc(o,n,a,h,g){o.emplaceBack(2*n+(h+1)/2,2*a+(g+1)/2)}class Qs{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new V,this.indexArray=new xt,this.segments=new Bt,this.programConfigurations=new jn(n.layers,n.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,h){const g=this.layers[0],v=[];let x=null,b=!1;g.type==="circle"&&(x=g.layout.get("circle-sort-key"),b=!x.isConstant());for(const{feature:E,id:T,index:A,sourceLayerIndex:M}of n){const O=this.layers[0]._featureFilter.needGeometry,B=Sa(E,O);if(!this.layers[0]._featureFilter.filter(new zn(this.zoom),B,h))continue;const q=b?x.evaluate(B,{},h):void 0,Z={id:T,properties:E.properties,type:E.type,sourceLayerIndex:M,index:A,geometry:O?B.geometry:Ea(E),patterns:{},sortKey:q};v.push(Z)}b&&v.sort((E,T)=>E.sortKey-T.sortKey);for(const E of v){const{geometry:T,index:A,sourceLayerIndex:M}=E,O=n[A].feature;this.addFeature(E,T,A,h),a.featureIndex.insert(O,T,A,M,this.index)}}update(n,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,zt),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(n,a,h,g){for(const v of a)for(const x of v){const b=x.x,E=x.y;if(b<0||b>=ri||E<0||E>=ri)continue;const T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,n.sortKey),A=T.vertexLength;yc(this.layoutVertexArray,b,E,-1,-1),yc(this.layoutVertexArray,b,E,1,-1),yc(this.layoutVertexArray,b,E,1,1),yc(this.layoutVertexArray,b,E,-1,1),this.indexArray.emplaceBack(A,A+1,A+2),this.indexArray.emplaceBack(A,A+3,A+2),T.vertexLength+=4,T.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,h,{},g)}}function Zh(o,n){for(let a=0;a1){if(vc(o,n))return!0;for(let h=0;h1?a:a.sub(n)._mult(g)._add(n))}function Rg(o,n){let a,h,g,v=!1;for(let x=0;xn.y!=g.y>n.y&&n.x<(g.x-h.x)*(n.y-h.y)/(g.y-h.y)+h.x&&(v=!v)}return v}function xc(o,n){let a=!1;for(let h=0,g=o.length-1;hn.y!=x.y>n.y&&n.x<(x.x-v.x)*(n.y-v.y)/(x.y-v.y)+v.x&&(a=!a)}return a}function sv(o,n,a){const h=a[0],g=a[2];if(o.xg.x&&n.x>g.x||o.yg.y&&n.y>g.y)return!1;const v=ye(o,n,a[0]);return v!==ye(o,n,a[1])||v!==ye(o,n,a[2])||v!==ye(o,n,a[3])}function Yh(o,n,a){const h=n.paint.get(o).value;return h.kind==="constant"?h.value:a.programConfigurations.get(n.id).getMaxValue(o)}function Fd(o){return Math.sqrt(o[0]*o[0]+o[1]*o[1])}function Bd(o,n,a,h,g){if(!n[0]&&!n[1])return o;const v=k.convert(n)._mult(g);a==="viewport"&&v._rotate(-h);const x=[];for(let b=0;bOg(Y,Z))}(T,E),B=M?A*b:A;for(const q of g)for(const Z of q){const Y=M?Z:Og(Z,E);let $=B;const lt=Vd([],[Z.x,Z.y,0,1],E);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=lt[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=x.cameraToCenterDistance/lt[3]),Od(O,Y,$))return!0}return!1}}function Og(o,n){const a=Vd([],[o.x,o.y,0,1],n);return new k(a[0]/a[3],a[1]/a[3])}class Fg extends Qs{}let Bg;Qt("HeatmapBucket",Fg,{omit:["layers"]});var cv={get paint(){return Bg=Bg||new Ar({"heatmap-radius":new ue(_t.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ue(_t.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ne(_t.paint_heatmap["heatmap-intensity"]),"heatmap-color":new kh(_t.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ne(_t.paint_heatmap["heatmap-opacity"])})}};function nm(o,{width:n,height:a},h,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==n*a*h)throw new RangeError(`mismatched image size. expected: ${g.length} but got: ${n*a*h}`)}else g=new Uint8Array(n*a*h);return o.width=n,o.height=a,o.data=g,o}function Vg(o,{width:n,height:a},h){if(n===o.width&&a===o.height)return;const g=nm({},{width:n,height:a},h);im(o,g,{x:0,y:0},{x:0,y:0},{width:Math.min(o.width,n),height:Math.min(o.height,a)},h),o.width=n,o.height=a,o.data=g.data}function im(o,n,a,h,g,v){if(g.width===0||g.height===0)return n;if(g.width>o.width||g.height>o.height||a.x>o.width-g.width||a.y>o.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>n.width||g.height>n.height||h.x>n.width-g.width||h.y>n.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const x=o.data,b=n.data;if(x===b)throw new Error("srcData equals dstData, so image is already copied");for(let E=0;E{n[o.evaluationKey]=E;const T=o.expression.evaluate(n);g.data[x+b+0]=Math.floor(255*T.r/T.a),g.data[x+b+1]=Math.floor(255*T.g/T.a),g.data[x+b+2]=Math.floor(255*T.b/T.a),g.data[x+b+3]=Math.floor(255*T.a)};if(o.clips)for(let x=0,b=0;x80*a){h=v=o[0],g=x=o[1];for(var q=a;qv&&(v=b),E>x&&(x=E);T=(T=Math.max(v-h,x-g))!==0?32767/T:0}return Qh(O,B,a,h,g,T,0),B}function Gg(o,n,a,h,g){var v,x;if(g===am(o,n,a,h)>0)for(v=n;v=n;v-=h)x=Hg(v,o[v],o[v+1],x);return x&&qd(x,x.next)&&(tp(x),x=x.next),x}function nu(o,n){if(!o)return o;n||(n=o);var a,h=o;do if(a=!1,h.steiner||!qd(h,h.next)&&pi(h.prev,h,h.next)!==0)h=h.next;else{if(tp(h),(h=n=h.prev)===h.next)break;a=!0}while(a||h!==n);return n}function Qh(o,n,a,h,g,v,x){if(o){!x&&v&&function(A,M,O,B){var q=A;do q.z===0&&(q.z=om(q.x,q.y,M,O,B)),q.prevZ=q.prev,q.nextZ=q.next,q=q.next;while(q!==A);q.prevZ.nextZ=null,q.prevZ=null,function(Z){var Y,$,lt,tt,ot,wt,Tt,Yt,te=1;do{for($=Z,Z=null,ot=null,wt=0;$;){for(wt++,lt=$,Tt=0,Y=0;Y0||Yt>0&<)Tt!==0&&(Yt===0||!lt||$.z<=lt.z)?(tt=$,$=$.nextZ,Tt--):(tt=lt,lt=lt.nextZ,Yt--),ot?ot.nextZ=tt:Z=tt,tt.prevZ=ot,ot=tt;$=lt}ot.nextZ=null,te*=2}while(wt>1)}(q)}(o,h,g,v);for(var b,E,T=o;o.prev!==o.next;)if(b=o.prev,E=o.next,v?_v(o,h,g,v):gv(o))n.push(b.i/a|0),n.push(o.i/a|0),n.push(E.i/a|0),tp(o),o=E.next,T=E.next;else if((o=E)===T){x?x===1?Qh(o=yv(nu(o),n,a),n,a,h,g,v,2):x===2&&vv(o,n,a,h,g,v):Qh(nu(o),n,a,h,g,v,1);break}}}function gv(o){var n=o.prev,a=o,h=o.next;if(pi(n,a,h)>=0)return!1;for(var g=n.x,v=a.x,x=h.x,b=n.y,E=a.y,T=h.y,A=gv?g>x?g:x:v>x?v:x,B=b>E?b>T?b:T:E>T?E:T,q=h.next;q!==n;){if(q.x>=A&&q.x<=O&&q.y>=M&&q.y<=B&&wc(g,b,v,E,x,T,q.x,q.y)&&pi(q.prev,q,q.next)>=0)return!1;q=q.next}return!0}function _v(o,n,a,h){var g=o.prev,v=o,x=o.next;if(pi(g,v,x)>=0)return!1;for(var b=g.x,E=v.x,T=x.x,A=g.y,M=v.y,O=x.y,B=bE?b>T?b:T:E>T?E:T,Y=A>M?A>O?A:O:M>O?M:O,$=om(B,q,n,a,h),lt=om(Z,Y,n,a,h),tt=o.prevZ,ot=o.nextZ;tt&&tt.z>=$&&ot&&ot.z<=lt;){if(tt.x>=B&&tt.x<=Z&&tt.y>=q&&tt.y<=Y&&tt!==g&&tt!==x&&wc(b,A,E,M,T,O,tt.x,tt.y)&&pi(tt.prev,tt,tt.next)>=0||(tt=tt.prevZ,ot.x>=B&&ot.x<=Z&&ot.y>=q&&ot.y<=Y&&ot!==g&&ot!==x&&wc(b,A,E,M,T,O,ot.x,ot.y)&&pi(ot.prev,ot,ot.next)>=0))return!1;ot=ot.nextZ}for(;tt&&tt.z>=$;){if(tt.x>=B&&tt.x<=Z&&tt.y>=q&&tt.y<=Y&&tt!==g&&tt!==x&&wc(b,A,E,M,T,O,tt.x,tt.y)&&pi(tt.prev,tt,tt.next)>=0)return!1;tt=tt.prevZ}for(;ot&&ot.z<=lt;){if(ot.x>=B&&ot.x<=Z&&ot.y>=q&&ot.y<=Y&&ot!==g&&ot!==x&&wc(b,A,E,M,T,O,ot.x,ot.y)&&pi(ot.prev,ot,ot.next)>=0)return!1;ot=ot.nextZ}return!0}function yv(o,n,a){var h=o;do{var g=h.prev,v=h.next.next;!qd(g,v)&&jg(g,h,h.next,v)&&$h(g,v)&&$h(v,g)&&(n.push(g.i/a|0),n.push(h.i/a|0),n.push(v.i/a|0),tp(h),tp(h.next),h=o=v),h=h.next}while(h!==o);return nu(h)}function vv(o,n,a,h,g,v){var x=o;do{for(var b=x.next.next;b!==x.prev;){if(x.i!==b.i&&Ev(x,b)){var E=Zg(x,b);return x=nu(x,x.next),E=nu(E,E.next),Qh(x,n,a,h,g,v,0),void Qh(E,n,a,h,g,v,0)}b=b.next}x=x.next}while(x!==o)}function xv(o,n){return o.x-n.x}function bv(o,n){var a=function(g,v){var x,b=v,E=g.x,T=g.y,A=-1/0;do{if(T<=b.y&&T>=b.next.y&&b.next.y!==b.y){var M=b.x+(T-b.y)*(b.next.x-b.x)/(b.next.y-b.y);if(M<=E&&M>A&&(A=M,x=b.x=b.x&&b.x>=q&&E!==b.x&&wc(Tx.x||b.x===x.x&&wv(x,b)))&&(x=b,Y=O)),b=b.next;while(b!==B);return x}(o,n);if(!a)return n;var h=Zg(a,o);return nu(h,h.next),nu(a,a.next)}function wv(o,n){return pi(o.prev,o,n.prev)<0&&pi(n.next,o,o.next)<0}function om(o,n,a,h,g){return(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-a)*g|0)|o<<8))|o<<4))|o<<2))|o<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-h)*g|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function Iv(o){var n=o,a=o;do(n.x=(o-x)*(v-b)&&(o-x)*(h-b)>=(a-x)*(n-b)&&(a-x)*(v-b)>=(g-x)*(h-b)}function Ev(o,n){return o.next.i!==n.i&&o.prev.i!==n.i&&!function(a,h){var g=a;do{if(g.i!==a.i&&g.next.i!==a.i&&g.i!==h.i&&g.next.i!==h.i&&jg(g,g.next,a,h))return!0;g=g.next}while(g!==a);return!1}(o,n)&&($h(o,n)&&$h(n,o)&&function(a,h){var g=a,v=!1,x=(a.x+h.x)/2,b=(a.y+h.y)/2;do g.y>b!=g.next.y>b&&g.next.y!==g.y&&x<(g.next.x-g.x)*(b-g.y)/(g.next.y-g.y)+g.x&&(v=!v),g=g.next;while(g!==a);return v}(o,n)&&(pi(o.prev,o,n.prev)||pi(o,n.prev,n))||qd(o,n)&&pi(o.prev,o,o.next)>0&&pi(n.prev,n,n.next)>0)}function pi(o,n,a){return(n.y-o.y)*(a.x-n.x)-(n.x-o.x)*(a.y-n.y)}function qd(o,n){return o.x===n.x&&o.y===n.y}function jg(o,n,a,h){var g=jd(pi(o,n,a)),v=jd(pi(o,n,h)),x=jd(pi(a,h,o)),b=jd(pi(a,h,n));return g!==v&&x!==b||!(g!==0||!Gd(o,a,n))||!(v!==0||!Gd(o,h,n))||!(x!==0||!Gd(a,o,h))||!(b!==0||!Gd(a,n,h))}function Gd(o,n,a){return n.x<=Math.max(o.x,a.x)&&n.x>=Math.min(o.x,a.x)&&n.y<=Math.max(o.y,a.y)&&n.y>=Math.min(o.y,a.y)}function jd(o){return o>0?1:o<0?-1:0}function $h(o,n){return pi(o.prev,o,o.next)<0?pi(o,n,o.next)>=0&&pi(o,o.prev,n)>=0:pi(o,n,o.prev)<0||pi(o,o.next,n)<0}function Zg(o,n){var a=new sm(o.i,o.x,o.y),h=new sm(n.i,n.x,n.y),g=o.next,v=n.prev;return o.next=n,n.prev=o,a.next=g,g.prev=a,h.next=a,a.prev=h,v.next=h,h.prev=v,h}function Hg(o,n,a,h){var g=new sm(o,n,a);return h?(g.next=h.next,g.prev=h,h.next.prev=g,h.next=g):(g.prev=g,g.next=g),g}function tp(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function sm(o,n,a){this.i=o,this.x=n,this.y=a,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function am(o,n,a,h){for(var g=0,v=n,x=a-h;v0&&a.holes.push(h+=o[g-1].length)}return a};var Wg=S(rm.exports);function Sv(o,n,a,h,g){Xg(o,n,a||0,h||o.length-1,g||Cv)}function Xg(o,n,a,h,g){for(;h>a;){if(h-a>600){var v=h-a+1,x=n-a+1,b=Math.log(v),E=.5*Math.exp(2*b/3),T=.5*Math.sqrt(b*E*(v-E)/v)*(x-v/2<0?-1:1);Xg(o,n,Math.max(a,Math.floor(n-x*E/v+T)),Math.min(h,Math.floor(n+(v-x)*E/v+T)),g)}var A=o[n],M=a,O=h;for(ep(o,a,n),g(o[h],A)>0&&ep(o,a,h);M0;)O--}g(o[a],A)===0?ep(o,a,O):ep(o,++O,h),O<=n&&(a=O+1),n<=O&&(h=O-1)}}function ep(o,n,a){var h=o[n];o[n]=o[a],o[a]=h}function Cv(o,n){return on?1:0}function lm(o,n){const a=o.length;if(a<=1)return[o];const h=[];let g,v;for(let x=0;x1)for(let x=0;xa.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new X,this.indexArray=new xt,this.indexArray2=new At,this.programConfigurations=new jn(n.layers,n.zoom),this.segments=new Bt,this.segments2=new Bt,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,h){this.hasPattern=um("fill",this.layers,a);const g=this.layers[0].layout.get("fill-sort-key"),v=!g.isConstant(),x=[];for(const{feature:b,id:E,index:T,sourceLayerIndex:A}of n){const M=this.layers[0]._featureFilter.needGeometry,O=Sa(b,M);if(!this.layers[0]._featureFilter.filter(new zn(this.zoom),O,h))continue;const B=v?g.evaluate(O,{},h,a.availableImages):void 0,q={id:E,properties:b.properties,type:b.type,sourceLayerIndex:A,index:T,geometry:M?O.geometry:Ea(b),patterns:{},sortKey:B};x.push(q)}v&&x.sort((b,E)=>b.sortKey-E.sortKey);for(const b of x){const{geometry:E,index:T,sourceLayerIndex:A}=b;if(this.hasPattern){const M=cm("fill",this.layers,b,this.zoom,a);this.patternFeatures.push(M)}else this.addFeature(b,E,T,h,{});a.featureIndex.insert(n[T].feature,E,T,A,this.index)}}update(n,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,h)}addFeatures(n,a,h){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,a,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,mv),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.indexBuffer2=n.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(n),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(n,a,h,g,v){for(const x of lm(a,500)){let b=0;for(const B of x)b+=B.length;const E=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray),T=E.vertexLength,A=[],M=[];for(const B of x){if(B.length===0)continue;B!==x[0]&&M.push(A.length/2);const q=this.segments2.prepareSegment(B.length,this.layoutVertexArray,this.indexArray2),Z=q.vertexLength;this.layoutVertexArray.emplaceBack(B[0].x,B[0].y),this.indexArray2.emplaceBack(Z+B.length-1,Z),A.push(B[0].x),A.push(B[0].y);for(let Y=1;Y>3}if(g--,h===1||h===2)v+=o.readSVarint(),x+=o.readSVarint(),h===1&&(n&&b.push(n),n=[]),n.push(new Rv(v,x));else{if(h!==7)throw new Error("unknown command "+h);n&&n.push(n[0].clone())}}return n&&b.push(n),b},Ic.prototype.bbox=function(){var o=this._pbf;o.pos=this._geometry;for(var n=o.readVarint()+o.pos,a=1,h=0,g=0,v=0,x=1/0,b=-1/0,E=1/0,T=-1/0;o.pos>3}if(h--,a===1||a===2)(g+=o.readSVarint())b&&(b=g),(v+=o.readSVarint())T&&(T=v);else if(a!==7)throw new Error("unknown command "+a)}return[x,E,b,T]},Ic.prototype.toGeoJSON=function(o,n,a){var h,g,v=this.extent*Math.pow(2,a),x=this.extent*o,b=this.extent*n,E=this.loadGeometry(),T=Ic.types[this.type];function A(B){for(var q=0;q>3;g=x===1?h.readString():x===2?h.readFloat():x===3?h.readDouble():x===4?h.readVarint64():x===5?h.readVarint():x===6?h.readSVarint():x===7?h.readBoolean():null}return g}(a))}$g.prototype.feature=function(o){if(o<0||o>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[o];var n=this._pbf.readVarint()+this._pbf.pos;return new zv(this._pbf,n,this.extent,this._keys,this._values)};var Fv=Qg;function Bv(o,n,a){if(o===3){var h=new Fv(a,a.readVarint()+a.pos);h.length&&(n[h.name]=h)}}al.VectorTile=function(o,n){this.layers=o.readFields(Bv,{},n)},al.VectorTileFeature=Jg,al.VectorTileLayer=Qg;const Vv=al.VectorTileFeature.types,pm=Math.pow(2,13);function np(o,n,a,h,g,v,x,b){o.emplaceBack(n,a,2*Math.floor(h*pm)+x,g*pm*2,v*pm*2,Math.round(b))}class dm{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new W,this.centroidVertexArray=new N,this.indexArray=new xt,this.programConfigurations=new jn(n.layers,n.zoom),this.segments=new Bt,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,h){this.features=[],this.hasPattern=um("fill-extrusion",this.layers,a);for(const{feature:g,id:v,index:x,sourceLayerIndex:b}of n){const E=this.layers[0]._featureFilter.needGeometry,T=Sa(g,E);if(!this.layers[0]._featureFilter.filter(new zn(this.zoom),T,h))continue;const A={id:v,sourceLayerIndex:b,index:x,geometry:E?T.geometry:Ea(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(cm("fill-extrusion",this.layers,A,this.zoom,a)):this.addFeature(A,A.geometry,x,h,{}),a.featureIndex.insert(g,A.geometry,x,b,this.index,!0)}}addFeatures(n,a,h){for(const g of this.features){const{geometry:v}=g;this.addFeature(g,v,g.index,a,h)}}update(n,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Dv),this.centroidVertexBuffer=n.createVertexBuffer(this.centroidVertexArray,Mv.members,!0),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(n,a,h,g,v){const x={x:0,y:0,vertexCount:0};for(const b of lm(a,500)){let E=0;for(const q of b)E+=q.length;let T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const q of b){if(q.length===0||qv(q))continue;let Z=0;for(let Y=0;Y=1){const lt=q[Y-1];if(!Uv($,lt)){T.vertexLength+4>Bt.MAX_VERTEX_ARRAY_LENGTH&&(T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const tt=$.sub(lt)._perp()._unit(),ot=lt.dist($);Z+ot>32768&&(Z=0),np(this.layoutVertexArray,$.x,$.y,tt.x,tt.y,0,0,Z),np(this.layoutVertexArray,$.x,$.y,tt.x,tt.y,0,1,Z),x.x+=2*$.x,x.y+=2*$.y,x.vertexCount+=2,Z+=ot,np(this.layoutVertexArray,lt.x,lt.y,tt.x,tt.y,0,0,Z),np(this.layoutVertexArray,lt.x,lt.y,tt.x,tt.y,0,1,Z),x.x+=2*lt.x,x.y+=2*lt.y,x.vertexCount+=2;const wt=T.vertexLength;this.indexArray.emplaceBack(wt,wt+2,wt+1),this.indexArray.emplaceBack(wt+1,wt+2,wt+3),T.vertexLength+=4,T.primitiveLength+=2}}}}if(T.vertexLength+E>Bt.MAX_VERTEX_ARRAY_LENGTH&&(T=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray)),Vv[n.type]!=="Polygon")continue;const A=[],M=[],O=T.vertexLength;for(const q of b)if(q.length!==0){q!==b[0]&&M.push(A.length/2);for(let Z=0;Zri)||o.y===n.y&&(o.y<0||o.y>ri)}function qv(o){return o.every(n=>n.x<0)||o.every(n=>n.x>ri)||o.every(n=>n.y<0)||o.every(n=>n.y>ri)}let t_;Qt("FillExtrusionBucket",dm,{omit:["layers","features"]});var Gv={get paint(){return t_=t_||new Ar({"fill-extrusion-opacity":new ne(_t["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ue(_t["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ne(_t["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ne(_t["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new cc(_t["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ue(_t["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ue(_t["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ne(_t["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class jv extends To{constructor(n){super(n,Gv)}createBucket(n){return new dm(n)}queryRadius(){return Fd(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(n,a,h,g,v,x,b,E){const T=Bd(n,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,b),A=this.paint.get("fill-extrusion-height").evaluate(a,h),M=this.paint.get("fill-extrusion-base").evaluate(a,h),O=function(q,Z,Y,$){const lt=[];for(const tt of q){const ot=[tt.x,tt.y,0,1];Vd(ot,ot,Z),lt.push(new k(ot[0]/ot[3],ot[1]/ot[3]))}return lt}(T,E),B=function(q,Z,Y,$){const lt=[],tt=[],ot=$[8]*Z,wt=$[9]*Z,Tt=$[10]*Z,Yt=$[11]*Z,te=$[8]*Y,Xt=$[9]*Y,Ht=$[10]*Y,Ft=$[11]*Y;for(const $t of q){const Ut=[],Mt=[];for(const ae of $t){const ee=ae.x,ze=ae.y,An=$[0]*ee+$[4]*ze+$[12],Fn=$[1]*ee+$[5]*ze+$[13],Pi=$[2]*ee+$[6]*ze+$[14],ho=$[3]*ee+$[7]*ze+$[15],Dr=Pi+Tt,Ii=ho+Yt,Hi=An+te,ir=Fn+Xt,Rr=Pi+Ht,Nr=ho+Ft,Ai=new k((An+ot)/Ii,(Fn+wt)/Ii);Ai.z=Dr/Ii,Ut.push(Ai);const Mi=new k(Hi/Nr,ir/Nr);Mi.z=Rr/Nr,Mt.push(Mi)}lt.push(Ut),tt.push(Mt)}return[lt,tt]}(g,M,A,E);return function(q,Z,Y){let $=1/0;Hh(Y,Z)&&($=e_(Y,Z[0]));for(let lt=0;lta.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new J,this.layoutVertexArray2=new j,this.indexArray=new xt,this.programConfigurations=new jn(n.layers,n.zoom),this.segments=new Bt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,h){this.hasPattern=um("line",this.layers,a);const g=this.layers[0].layout.get("line-sort-key"),v=!g.isConstant(),x=[];for(const{feature:b,id:E,index:T,sourceLayerIndex:A}of n){const M=this.layers[0]._featureFilter.needGeometry,O=Sa(b,M);if(!this.layers[0]._featureFilter.filter(new zn(this.zoom),O,h))continue;const B=v?g.evaluate(O,{},h):void 0,q={id:E,properties:b.properties,type:b.type,sourceLayerIndex:A,index:T,geometry:M?O.geometry:Ea(b),patterns:{},sortKey:B};x.push(q)}v&&x.sort((b,E)=>b.sortKey-E.sortKey);for(const b of x){const{geometry:E,index:T,sourceLayerIndex:A}=b;if(this.hasPattern){const M=cm("line",this.layers,b,this.zoom,a);this.patternFeatures.push(M)}else this.addFeature(b,E,T,h,{});a.featureIndex.insert(n[T].feature,E,T,A,this.index)}}update(n,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,h)}addFeatures(n,a,h){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,a,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=n.createVertexBuffer(this.layoutVertexArray2,Xv)),this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Hv),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(n){if(n.properties&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_end"))return{start:+n.properties.mapbox_clip_start,end:+n.properties.mapbox_clip_end}}addFeature(n,a,h,g,v){const x=this.layers[0].layout,b=x.get("line-join").evaluate(n,{}),E=x.get("line-cap"),T=x.get("line-miter-limit"),A=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(n);for(const M of a)this.addLine(M,n,b,E,T,A);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,h,v,g)}addLine(n,a,h,g,v,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $=0;$=2&&n[E-1].equals(n[E-2]);)E--;let T=0;for(;T0;if(Yt&&$>T){const Ft=O.dist(B);if(Ft>2*A){const $t=O.sub(O.sub(B)._mult(A/Ft)._round());this.updateDistance(B,$t),this.addCurrentVertex($t,Z,0,0,M),B=$t}}const Xt=B&&q;let Ht=Xt?h:b?"butt":g;if(Xt&&Ht==="round"&&(wtv&&(Ht="bevel"),Ht==="bevel"&&(wt>2&&(Ht="flipbevel"),wt100)lt=Y.mult(-1);else{const Ft=wt*Z.add(Y).mag()/Z.sub(Y).mag();lt._perp()._mult(Ft*(te?-1:1))}this.addCurrentVertex(O,lt,0,0,M),this.addCurrentVertex(O,lt.mult(-1),0,0,M)}else if(Ht==="bevel"||Ht==="fakeround"){const Ft=-Math.sqrt(wt*wt-1),$t=te?Ft:0,Ut=te?0:Ft;if(B&&this.addCurrentVertex(O,Z,$t,Ut,M),Ht==="fakeround"){const Mt=Math.round(180*Tt/Math.PI/20);for(let ae=1;ae2*A){const $t=O.add(q.sub(O)._mult(A/Ft)._round());this.updateDistance(O,$t),this.addCurrentVertex($t,Y,0,0,M),O=$t}}}}addCurrentVertex(n,a,h,g,v,x=!1){const b=a.y*g-a.x,E=-a.y-a.x*g;this.addHalfVertex(n,a.x+a.y*h,a.y-a.x*h,x,!1,h,v),this.addHalfVertex(n,b,E,x,!0,-g,v),this.distance>n_/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(n,a,h,g,v,x))}addHalfVertex({x:n,y:a},h,g,v,x,b,E){const T=.5*(this.lineClips?this.scaledDistance*(n_-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((n<<1)+(v?1:0),(a<<1)+(x?1:0),Math.round(63*h)+128,Math.round(63*g)+128,1+(b===0?0:b<0?-1:1)|(63&T)<<2,T>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const A=E.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,A),E.primitiveLength++),x?this.e2=A:this.e1=A}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(n,a){this.distance+=n.dist(a),this.updateScaledDistance()}}let i_,r_;Qt("LineBucket",fm,{omit:["layers","patternFeatures"]});var o_={get paint(){return r_=r_||new Ar({"line-opacity":new ue(_t.paint_line["line-opacity"]),"line-color":new ue(_t.paint_line["line-color"]),"line-translate":new ne(_t.paint_line["line-translate"]),"line-translate-anchor":new ne(_t.paint_line["line-translate-anchor"]),"line-width":new ue(_t.paint_line["line-width"]),"line-gap-width":new ue(_t.paint_line["line-gap-width"]),"line-offset":new ue(_t.paint_line["line-offset"]),"line-blur":new ue(_t.paint_line["line-blur"]),"line-dasharray":new Yl(_t.paint_line["line-dasharray"]),"line-pattern":new cc(_t.paint_line["line-pattern"]),"line-gradient":new kh(_t.paint_line["line-gradient"])})},get layout(){return i_=i_||new Ar({"line-cap":new ne(_t.layout_line["line-cap"]),"line-join":new ue(_t.layout_line["line-join"]),"line-miter-limit":new ne(_t.layout_line["line-miter-limit"]),"line-round-limit":new ne(_t.layout_line["line-round-limit"]),"line-sort-key":new ue(_t.layout_line["line-sort-key"])})}};class Jv extends ue{possiblyEvaluate(n,a){return a=new zn(Math.floor(a.zoom),{now:a.now,fadeDuration:a.fadeDuration,zoomHistory:a.zoomHistory,transition:a.transition}),super.possiblyEvaluate(n,a)}evaluate(n,a,h,g){return a=he({},a,{zoom:Math.floor(a.zoom)}),super.evaluate(n,a,h,g)}}let Zd;class Qv extends To{constructor(n){super(n,o_),this.gradientVersion=0,Zd||(Zd=new Jv(o_.paint.properties["line-width"].specification),Zd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(n){if(n==="line-gradient"){const a=this.gradientExpression();this.stepInterpolant=!!function(h){return h._styleExpression!==void 0}(a)&&a._styleExpression.expression instanceof Ul,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(n,a){super.recalculate(n,a),this.paint._values["line-floorwidth"]=Zd.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,n)}createBucket(n){return new fm(n)}queryRadius(n){const a=n,h=s_(Yh("line-width",this,a),Yh("line-gap-width",this,a)),g=Yh("line-offset",this,a);return h/2+Math.abs(g)+Fd(this.paint.get("line-translate"))}queryIntersectsFeature(n,a,h,g,v,x,b){const E=Bd(n,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,b),T=b/2*s_(this.paint.get("line-width").evaluate(a,h),this.paint.get("line-gap-width").evaluate(a,h)),A=this.paint.get("line-offset").evaluate(a,h);return A&&(g=function(M,O){const B=[];for(let q=0;q=3){for(let Y=0;Y0?n+2*o:o}const $v=hi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),tx=hi([{name:"a_projected_pos",components:3,type:"Float32"}],4);hi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ex=hi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);hi([{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 a_=hi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),nx=hi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ix(o,n,a){return o.sections.forEach(h=>{h.text=function(g,v,x){const b=v.layout.get("text-transform").evaluate(x,{});return b==="uppercase"?g=g.toLocaleUpperCase():b==="lowercase"&&(g=g.toLocaleLowerCase()),Ys.applyArabicShaping&&(g=Ys.applyArabicShaping(g)),g}(h.text,n,a)}),o}hi([{name:"triangle",components:3,type:"Uint16"}]),hi([{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"}]),hi([{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"}]),hi([{type:"Float32",name:"offsetX"}]),hi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),hi([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const rp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Li=24,l_=yn,u_=function(o,n,a,h,g){var v,x,b=8*g-h-1,E=(1<>1,A=-7,M=a?g-1:0,O=a?-1:1,B=o[n+M];for(M+=O,v=B&(1<<-A)-1,B>>=-A,A+=b;A>0;v=256*v+o[n+M],M+=O,A-=8);for(x=v&(1<<-A)-1,v>>=-A,A+=h;A>0;x=256*x+o[n+M],M+=O,A-=8);if(v===0)v=1-T;else{if(v===E)return x?NaN:1/0*(B?-1:1);x+=Math.pow(2,h),v-=T}return(B?-1:1)*x*Math.pow(2,v-h)},c_=function(o,n,a,h,g,v){var x,b,E,T=8*v-g-1,A=(1<>1,O=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,B=h?0:v-1,q=h?1:-1,Z=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(b=isNaN(n)?1:0,x=A):(x=Math.floor(Math.log(n)/Math.LN2),n*(E=Math.pow(2,-x))<1&&(x--,E*=2),(n+=x+M>=1?O/E:O*Math.pow(2,1-M))*E>=2&&(x++,E/=2),x+M>=A?(b=0,x=A):x+M>=1?(b=(n*E-1)*Math.pow(2,g),x+=M):(b=n*Math.pow(2,M-1)*Math.pow(2,g),x=0));g>=8;o[a+B]=255&b,B+=q,b/=256,g-=8);for(x=x<0;o[a+B]=255&x,B+=q,x/=256,T-=8);o[a+B-q]|=128*Z};function yn(o){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(o)?o:new Uint8Array(o||0),this.pos=0,this.type=0,this.length=this.buf.length}yn.Varint=0,yn.Fixed64=1,yn.Bytes=2,yn.Fixed32=5;var mm=4294967296,h_=1/mm,p_=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Ca(o){return o.type===yn.Bytes?o.readVarint()+o.pos:o.pos+1}function Ec(o,n,a){return a?4294967296*n+(o>>>0):4294967296*(n>>>0)+(o>>>0)}function d_(o,n,a){var h=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));a.realloc(h);for(var g=a.pos-1;g>=o;g--)a.buf[g+h]=a.buf[g]}function rx(o,n){for(var a=0;a>>8,o[a+2]=n>>>16,o[a+3]=n>>>24}function f_(o,n){return(o[n]|o[n+1]<<8|o[n+2]<<16)+(o[n+3]<<24)}yn.prototype={destroy:function(){this.buf=null},readFields:function(o,n,a){for(a=a||this.length;this.pos>3,v=this.pos;this.type=7&h,o(g,n,this),this.pos===v&&this.skip(h)}return n},readMessage:function(o,n){return this.readFields(o,n,this.readVarint()+this.pos)},readFixed32:function(){var o=Hd(this.buf,this.pos);return this.pos+=4,o},readSFixed32:function(){var o=f_(this.buf,this.pos);return this.pos+=4,o},readFixed64:function(){var o=Hd(this.buf,this.pos)+Hd(this.buf,this.pos+4)*mm;return this.pos+=8,o},readSFixed64:function(){var o=Hd(this.buf,this.pos)+f_(this.buf,this.pos+4)*mm;return this.pos+=8,o},readFloat:function(){var o=u_(this.buf,this.pos,!0,23,4);return this.pos+=4,o},readDouble:function(){var o=u_(this.buf,this.pos,!0,52,8);return this.pos+=8,o},readVarint:function(o){var n,a,h=this.buf;return n=127&(a=h[this.pos++]),a<128?n:(n|=(127&(a=h[this.pos++]))<<7,a<128?n:(n|=(127&(a=h[this.pos++]))<<14,a<128?n:(n|=(127&(a=h[this.pos++]))<<21,a<128?n:function(g,v,x){var b,E,T=x.buf;if(b=(112&(E=T[x.pos++]))>>4,E<128||(b|=(127&(E=T[x.pos++]))<<3,E<128)||(b|=(127&(E=T[x.pos++]))<<10,E<128)||(b|=(127&(E=T[x.pos++]))<<17,E<128)||(b|=(127&(E=T[x.pos++]))<<24,E<128)||(b|=(1&(E=T[x.pos++]))<<31,E<128))return Ec(g,b,v);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(a=h[this.pos]))<<28,o,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var o=this.readVarint();return o%2==1?(o+1)/-2:o/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var o=this.readVarint()+this.pos,n=this.pos;return this.pos=o,o-n>=12&&p_?function(a,h,g){return p_.decode(a.subarray(h,g))}(this.buf,n,o):function(a,h,g){for(var v="",x=h;x239?4:A>223?3:A>191?2:1;if(x+O>g)break;O===1?A<128&&(M=A):O===2?(192&(b=a[x+1]))==128&&(M=(31&A)<<6|63&b)<=127&&(M=null):O===3?(E=a[x+2],(192&(b=a[x+1]))==128&&(192&E)==128&&((M=(15&A)<<12|(63&b)<<6|63&E)<=2047||M>=55296&&M<=57343)&&(M=null)):O===4&&(E=a[x+2],T=a[x+3],(192&(b=a[x+1]))==128&&(192&E)==128&&(192&T)==128&&((M=(15&A)<<18|(63&b)<<12|(63&E)<<6|63&T)<=65535||M>=1114112)&&(M=null)),M===null?(M=65533,O=1):M>65535&&(M-=65536,v+=String.fromCharCode(M>>>10&1023|55296),M=56320|1023&M),v+=String.fromCharCode(M),x+=O}return v}(this.buf,n,o)},readBytes:function(){var o=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,o);return this.pos=o,n},readPackedVarint:function(o,n){if(this.type!==yn.Bytes)return o.push(this.readVarint(n));var a=Ca(this);for(o=o||[];this.pos127;);else if(n===yn.Bytes)this.pos=this.readVarint()+this.pos;else if(n===yn.Fixed32)this.pos+=4;else{if(n!==yn.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(o,n){this.writeVarint(o<<3|n)},realloc:function(o){for(var n=this.length||16;n268435455||o<0?function(n,a){var h,g;if(n>=0?(h=n%4294967296|0,g=n/4294967296|0):(g=~(-n/4294967296),4294967295^(h=~(-n%4294967296))?h=h+1|0:(h=0,g=g+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.realloc(10),function(v,x,b){b.buf[b.pos++]=127&v|128,v>>>=7,b.buf[b.pos++]=127&v|128,v>>>=7,b.buf[b.pos++]=127&v|128,v>>>=7,b.buf[b.pos++]=127&v|128,b.buf[b.pos]=127&(v>>>=7)}(h,0,a),function(v,x){var b=(7&v)<<4;x.buf[x.pos++]|=b|((v>>>=3)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v)))))}(g,a)}(o,this):(this.realloc(4),this.buf[this.pos++]=127&o|(o>127?128:0),o<=127||(this.buf[this.pos++]=127&(o>>>=7)|(o>127?128:0),o<=127||(this.buf[this.pos++]=127&(o>>>=7)|(o>127?128:0),o<=127||(this.buf[this.pos++]=o>>>7&127))))},writeSVarint:function(o){this.writeVarint(o<0?2*-o-1:2*o)},writeBoolean:function(o){this.writeVarint(!!o)},writeString:function(o){o=String(o),this.realloc(4*o.length),this.pos++;var n=this.pos;this.pos=function(h,g,v){for(var x,b,E=0;E55295&&x<57344){if(!b){x>56319||E+1===g.length?(h[v++]=239,h[v++]=191,h[v++]=189):b=x;continue}if(x<56320){h[v++]=239,h[v++]=191,h[v++]=189,b=x;continue}x=b-55296<<10|x-56320|65536,b=null}else b&&(h[v++]=239,h[v++]=191,h[v++]=189,b=null);x<128?h[v++]=x:(x<2048?h[v++]=x>>6|192:(x<65536?h[v++]=x>>12|224:(h[v++]=x>>18|240,h[v++]=x>>12&63|128),h[v++]=x>>6&63|128),h[v++]=63&x|128)}return v}(this.buf,o,this.pos);var a=this.pos-n;a>=128&&d_(n,a,this),this.pos=n-1,this.writeVarint(a),this.pos+=a},writeFloat:function(o){this.realloc(4),c_(this.buf,o,this.pos,!0,23,4),this.pos+=4},writeDouble:function(o){this.realloc(8),c_(this.buf,o,this.pos,!0,52,8),this.pos+=8},writeBytes:function(o){var n=o.length;this.writeVarint(n),this.realloc(n);for(var a=0;a=128&&d_(a,h,this),this.pos=a-1,this.writeVarint(h),this.pos+=h},writeMessage:function(o,n,a){this.writeTag(o,yn.Bytes),this.writeRawMessage(n,a)},writePackedVarint:function(o,n){n.length&&this.writeMessage(o,rx,n)},writePackedSVarint:function(o,n){n.length&&this.writeMessage(o,ox,n)},writePackedBoolean:function(o,n){n.length&&this.writeMessage(o,lx,n)},writePackedFloat:function(o,n){n.length&&this.writeMessage(o,sx,n)},writePackedDouble:function(o,n){n.length&&this.writeMessage(o,ax,n)},writePackedFixed32:function(o,n){n.length&&this.writeMessage(o,ux,n)},writePackedSFixed32:function(o,n){n.length&&this.writeMessage(o,cx,n)},writePackedFixed64:function(o,n){n.length&&this.writeMessage(o,hx,n)},writePackedSFixed64:function(o,n){n.length&&this.writeMessage(o,px,n)},writeBytesField:function(o,n){this.writeTag(o,yn.Bytes),this.writeBytes(n)},writeFixed32Field:function(o,n){this.writeTag(o,yn.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(o,n){this.writeTag(o,yn.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(o,n){this.writeTag(o,yn.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(o,n){this.writeTag(o,yn.Fixed64),this.writeSFixed64(n)},writeVarintField:function(o,n){this.writeTag(o,yn.Varint),this.writeVarint(n)},writeSVarintField:function(o,n){this.writeTag(o,yn.Varint),this.writeSVarint(n)},writeStringField:function(o,n){this.writeTag(o,yn.Bytes),this.writeString(n)},writeFloatField:function(o,n){this.writeTag(o,yn.Fixed32),this.writeFloat(n)},writeDoubleField:function(o,n){this.writeTag(o,yn.Fixed64),this.writeDouble(n)},writeBooleanField:function(o,n){this.writeVarintField(o,!!n)}};var gm=S(l_);const _m=3;function dx(o,n,a){o===1&&a.readMessage(fx,n)}function fx(o,n,a){if(o===3){const{id:h,bitmap:g,width:v,height:x,left:b,top:E,advance:T}=a.readMessage(mx,{});n.push({id:h,bitmap:new Jh({width:v+2*_m,height:x+2*_m},g),metrics:{width:v,height:x,left:b,top:E,advance:T}})}}function mx(o,n,a){o===1?n.id=a.readVarint():o===2?n.bitmap=a.readBytes():o===3?n.width=a.readVarint():o===4?n.height=a.readVarint():o===5?n.left=a.readSVarint():o===6?n.top=a.readSVarint():o===7&&(n.advance=a.readVarint())}const m_=_m;function g_(o){let n=0,a=0;for(const x of o)n+=x.w*x.h,a=Math.max(a,x.w);o.sort((x,b)=>b.h-x.h);const h=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(n/.95)),a),h:1/0}];let g=0,v=0;for(const x of o)for(let b=h.length-1;b>=0;b--){const E=h[b];if(!(x.w>E.w||x.h>E.h)){if(x.x=E.x,x.y=E.y,v=Math.max(v,x.y+x.h),g=Math.max(g,x.x+x.w),x.w===E.w&&x.h===E.h){const T=h.pop();b=0&&h>=n&&Xd[this.text.charCodeAt(h)];h--)a--;this.text=this.text.substring(n,a),this.sectionIndex=this.sectionIndex.slice(n,a)}substring(n,a){const h=new Cc;return h.text=this.text.substring(n,a),h.sectionIndex=this.sectionIndex.slice(n,a),h.sections=this.sections,h}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((n,a)=>Math.max(n,this.sections[a].scale),0)}addTextSection(n,a){this.text+=n.text,this.sections.push(sp.forText(n.scale,n.fontStack||a));const h=this.sections.length-1;for(let g=0;g=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Wd(o,n,a,h,g,v,x,b,E,T,A,M,O,B,q,Z){const Y=Cc.fromFeature(o,g);let $;M===m.ah.vertical&&Y.verticalizePunctuation();const{processBidirectionalText:lt,processStyledBidirectionalText:tt}=Ys;if(lt&&Y.sections.length===1){$=[];const Tt=lt(Y.toString(),vm(Y,T,v,n,h,B,q));for(const Yt of Tt){const te=new Cc;te.text=Yt,te.sections=Y.sections;for(let Xt=0;Xt0&&La>Yr&&(Yr=La)}else{const Ao=te[qe.fontStack],Jr=Ao&&Ao[rr];if(Jr&&Jr.rect)Is=Jr.rect,ns=Jr.metrics;else{const La=Yt[qe.fontStack],hp=La&&La[rr];if(!hp)continue;ns=hp.metrics}Ri=(Mi-qe.scale)*Li}is?(Tt.verticalizable=!0,_r.push({glyph:rr,imageName:Es,x:An,y:Fn+Ri,vertical:is,scale:qe.scale,fontStack:qe.fontStack,sectionIndex:yr,metrics:ns,rect:Is}),An+=Ta*qe.scale+ae):(_r.push({glyph:rr,imageName:Es,x:An,y:Fn+Ri,vertical:is,scale:qe.scale,fontStack:qe.fontStack,sectionIndex:yr,metrics:ns,rect:Is}),An+=ns.advance*qe.scale+ae)}_r.length!==0&&(Pi=Math.max(An-ae,Pi),yx(_r,0,_r.length-1,Dr,Yr)),An=0;const Kr=Ft*Mi+Yr;kr.lineOffset=Math.max(Yr,gr),Fn+=Kr,ho=Math.max(Kr,ho),++Ii}var Hi;const ir=Fn-op,{horizontalAlign:Rr,verticalAlign:Nr}=xm($t);(function(Ai,Mi,gr,kr,_r,Yr,Kr,Di,qe){const yr=(Mi-gr)*_r;let rr=0;rr=Yr!==Kr?-Di*kr-op:(-kr*qe+.5)*Kr;for(const Ri of Ai)for(const ns of Ri.positionedGlyphs)ns.x+=yr,ns.y+=rr})(Tt.positionedLines,Dr,Rr,Nr,Pi,ho,Ft,ir,Ht.length),Tt.top+=-Nr*ir,Tt.bottom=Tt.top+ir,Tt.left+=-Rr*Pi,Tt.right=Tt.left+Pi}(wt,n,a,h,$,x,b,E,M,T,O,Z),!function(Tt){for(const Yt of Tt)if(Yt.positionedGlyphs.length!==0)return!1;return!0}(ot)&&wt}const Xd={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},gx={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function y_(o,n,a,h,g,v){if(n.imageName){const x=h[n.imageName];return x?x.displaySize[0]*n.scale*Li/v+g:0}{const x=a[n.fontStack],b=x&&x[o];return b?b.metrics.advance*n.scale+g:0}}function v_(o,n,a,h){const g=Math.pow(o-n,2);return h?o=0;let A=0;for(let O=0;Ox.id),this.index=n.index,this.pixelRatio=n.pixelRatio,this.sourceLayerIndex=n.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=em([]),this.placementViewportMatrix=em([]);const a=this.layers[0]._unevaluatedLayout._values;this.textSizeData=I_(this.zoom,a["text-size"]),this.iconSizeData=I_(this.zoom,a["icon-size"]);const h=this.layers[0].layout,g=h.get("symbol-sort-key"),v=h.get("symbol-z-order");this.canOverlap=bm(h,"text-overlap","text-allow-overlap")!=="never"||bm(h,"icon-overlap","icon-allow-overlap")!=="never"||h.get("text-ignore-placement")||h.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!g.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,h.get("symbol-placement")==="point"&&(this.writingModes=h.get("text-writing-mode").map(x=>m.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=n.sourceID}createArrays(){this.text=new Im(new jn(this.layers,this.zoom,n=>/^text/.test(n))),this.icon=new Im(new jn(this.layers,this.zoom,n=>/^icon/.test(n))),this.glyphOffsetArray=new y,this.lineVertexArray=new w,this.symbolInstances=new f,this.textAnchorOffsets=new C}calculateGlyphDependencies(n,a,h,g,v){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),A=E.value.kind!=="constant"||!!E.value.value||Object.keys(E.parameters).length>0,M=v.get("symbol-sort-key");if(this.features=[],!T&&!A)return;const O=a.iconDependencies,B=a.glyphDependencies,q=a.availableImages,Z=new zn(this.zoom);for(const{feature:Y,id:$,index:lt,sourceLayerIndex:tt}of n){const ot=g._featureFilter.needGeometry,wt=Sa(Y,ot);if(!g._featureFilter.filter(Z,wt,h))continue;let Tt,Yt;if(ot||(wt.geometry=Ea(Y)),T){const Xt=g.getValueAndResolveTokens("text-field",wt,h,q),Ht=Gr.factory(Xt),Ft=this.hasRTLText=this.hasRTLText||wx(Ht);(!Ft||Ys.getRTLTextPluginStatus()==="unavailable"||Ft&&Ys.isParsed())&&(Tt=ix(Ht,g,wt))}if(A){const Xt=g.getValueAndResolveTokens("icon-image",wt,h,q);Yt=Xt instanceof lo?Xt:lo.fromString(Xt)}if(!Tt&&!Yt)continue;const te=this.sortFeaturesByKey?M.evaluate(wt,{},h):void 0;if(this.features.push({id:$,text:Tt,icon:Yt,index:lt,sourceLayerIndex:tt,geometry:wt.geometry,properties:Y.properties,type:xx[Y.type],sortKey:te}),Yt&&(O[Yt.name]=!0),Tt){const Xt=x.evaluate(wt,{},h).join(","),Ht=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(m.ah.vertical)>=0;for(const Ft of Tt.sections)if(Ft.image)O[Ft.image.name]=!0;else{const $t=ol(Tt.toString()),Ut=Ft.fontStack||Xt,Mt=B[Ut]=B[Ut]||{};this.calculateGlyphDependencies(Ft.text,Mt,Ht,this.allowVerticalPlacement,$t)}}}v.get("symbol-placement")==="line"&&(this.features=function(Y){const $={},lt={},tt=[];let ot=0;function wt(Xt){tt.push(Y[Xt]),ot++}function Tt(Xt,Ht,Ft){const $t=lt[Xt];return delete lt[Xt],lt[Ht]=$t,tt[$t].geometry[0].pop(),tt[$t].geometry[0]=tt[$t].geometry[0].concat(Ft[0]),$t}function Yt(Xt,Ht,Ft){const $t=$[Ht];return delete $[Ht],$[Xt]=$t,tt[$t].geometry[0].shift(),tt[$t].geometry[0]=Ft[0].concat(tt[$t].geometry[0]),$t}function te(Xt,Ht,Ft){const $t=Ft?Ht[0][Ht[0].length-1]:Ht[0][0];return`${Xt}:${$t.x}:${$t.y}`}for(let Xt=0;XtXt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Y,$)=>Y.sortKey-$.sortKey)}update(n,a,h){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(n,a,this.layers,h),this.icon.programConfigurations.updatePaintArrays(n,a,this.layers,h))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(n),this.iconCollisionBox.upload(n)),this.text.upload(n,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(n,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(n,a){const h=this.lineVertexArray.length;if(n.segment!==void 0){let g=n.dist(a[n.segment+1]),v=n.dist(a[n.segment]);const x={};for(let b=n.segment+1;b=0;b--)x[b]={x:a[b].x,y:a[b].y,tileUnitDistanceFromAnchor:v},b>0&&(v+=a[b-1].dist(a[b]));for(let b=0;b0}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(n,a){const h=n.placedSymbolArray.get(a),g=h.vertexStartIndex+4*h.numGlyphs;for(let v=h.vertexStartIndex;vg[b]-g[E]||v[E]-v[b]),x}addToSortKeyRanges(n,a){const h=this.sortKeyRanges[this.sortKeyRanges.length-1];h&&h.sortKey===a?h.symbolInstanceEnd=n+1:this.sortKeyRanges.push({sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:n+1})}sortFeatures(n){if(this.sortFeaturesByY&&this.sortedAngle!==n&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(n),this.sortedAngle=n,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const a of this.symbolInstanceIndexes){const h=this.symbolInstances.get(a);this.featureSortOrder.push(h.featureIndex),[h.rightJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.leftJustifiedTextSymbolIndex].forEach((g,v,x)=>{g>=0&&x.indexOf(g)===v&&this.addIndicesForPlacedSymbol(this.text,g)}),h.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,h.verticalPlacedTextSymbolIndex),h.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.placedIconSymbolIndex),h.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let E_,S_;Qt("SymbolBucket",Tc,{omit:["layers","collisionBoxArray","features","compareText"]}),Tc.MAX_GLYPHS=65535,Tc.addDynamicAttributes=wm;var Sm={get paint(){return S_=S_||new Ar({"icon-opacity":new ue(_t.paint_symbol["icon-opacity"]),"icon-color":new ue(_t.paint_symbol["icon-color"]),"icon-halo-color":new ue(_t.paint_symbol["icon-halo-color"]),"icon-halo-width":new ue(_t.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ue(_t.paint_symbol["icon-halo-blur"]),"icon-translate":new ne(_t.paint_symbol["icon-translate"]),"icon-translate-anchor":new ne(_t.paint_symbol["icon-translate-anchor"]),"text-opacity":new ue(_t.paint_symbol["text-opacity"]),"text-color":new ue(_t.paint_symbol["text-color"],{runtimeType:_i,getOverride:o=>o.textColor,hasOverride:o=>!!o.textColor}),"text-halo-color":new ue(_t.paint_symbol["text-halo-color"]),"text-halo-width":new ue(_t.paint_symbol["text-halo-width"]),"text-halo-blur":new ue(_t.paint_symbol["text-halo-blur"]),"text-translate":new ne(_t.paint_symbol["text-translate"]),"text-translate-anchor":new ne(_t.paint_symbol["text-translate-anchor"])})},get layout(){return E_=E_||new Ar({"symbol-placement":new ne(_t.layout_symbol["symbol-placement"]),"symbol-spacing":new ne(_t.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ne(_t.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ue(_t.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ne(_t.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ne(_t.layout_symbol["icon-allow-overlap"]),"icon-overlap":new ne(_t.layout_symbol["icon-overlap"]),"icon-ignore-placement":new ne(_t.layout_symbol["icon-ignore-placement"]),"icon-optional":new ne(_t.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ne(_t.layout_symbol["icon-rotation-alignment"]),"icon-size":new ue(_t.layout_symbol["icon-size"]),"icon-text-fit":new ne(_t.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ne(_t.layout_symbol["icon-text-fit-padding"]),"icon-image":new ue(_t.layout_symbol["icon-image"]),"icon-rotate":new ue(_t.layout_symbol["icon-rotate"]),"icon-padding":new ue(_t.layout_symbol["icon-padding"]),"icon-keep-upright":new ne(_t.layout_symbol["icon-keep-upright"]),"icon-offset":new ue(_t.layout_symbol["icon-offset"]),"icon-anchor":new ue(_t.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ne(_t.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ne(_t.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ne(_t.layout_symbol["text-rotation-alignment"]),"text-field":new ue(_t.layout_symbol["text-field"]),"text-font":new ue(_t.layout_symbol["text-font"]),"text-size":new ue(_t.layout_symbol["text-size"]),"text-max-width":new ue(_t.layout_symbol["text-max-width"]),"text-line-height":new ne(_t.layout_symbol["text-line-height"]),"text-letter-spacing":new ue(_t.layout_symbol["text-letter-spacing"]),"text-justify":new ue(_t.layout_symbol["text-justify"]),"text-radial-offset":new ue(_t.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ne(_t.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ue(_t.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ue(_t.layout_symbol["text-anchor"]),"text-max-angle":new ne(_t.layout_symbol["text-max-angle"]),"text-writing-mode":new ne(_t.layout_symbol["text-writing-mode"]),"text-rotate":new ue(_t.layout_symbol["text-rotate"]),"text-padding":new ne(_t.layout_symbol["text-padding"]),"text-keep-upright":new ne(_t.layout_symbol["text-keep-upright"]),"text-transform":new ue(_t.layout_symbol["text-transform"]),"text-offset":new ue(_t.layout_symbol["text-offset"]),"text-allow-overlap":new ne(_t.layout_symbol["text-allow-overlap"]),"text-overlap":new ne(_t.layout_symbol["text-overlap"]),"text-ignore-placement":new ne(_t.layout_symbol["text-ignore-placement"]),"text-optional":new ne(_t.layout_symbol["text-optional"])})}};class C_{constructor(n){if(n.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=n.property.overrides?n.property.overrides.runtimeType:tr,this.defaultValue=n}evaluate(n){if(n.formattedSection){const a=this.defaultValue.property.overrides;if(a&&a.hasOverride(n.formattedSection))return a.getOverride(n.formattedSection)}return n.feature&&n.featureState?this.defaultValue.evaluate(n.feature,n.featureState):this.defaultValue.property.specification.default}eachChild(n){this.defaultValue.isConstant()||n(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Qt("FormatSectionOverride",C_,{omit:["defaultValue"]});class Kd extends To{constructor(n){super(n,Sm)}recalculate(n,a){if(super.recalculate(n,a),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const h=this.layout.get("text-writing-mode");if(h){const g=[];for(const v of h)g.indexOf(v)<0&&g.push(v);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(n,a,h,g){const v=this.layout.get(n).evaluate(a,{},h,g),x=this._unevaluatedLayout._values[n];return x.isDataDriven()||En(x.value)||!v?v:function(b,E){return E.replace(/{([^{}]+)}/g,(T,A)=>b&&A in b?String(b[A]):"")}(a.properties,v)}createBucket(n){return new Tc(n)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const n of Sm.paint.overridableProperties){if(!Kd.hasPaintOverride(this.layout,n))continue;const a=this.paint.get(n),h=new C_(a),g=new Pn(h,a.property.specification);let v=null;v=a.value.kind==="constant"||a.value.kind==="source"?new Ku("source",g):new Eh("composite",g,a.value.zoomStops),this.paint._values[n]=new Co(a.property,v,a.parameters)}}_handleOverridablePaintPropertyUpdate(n,a,h){return!(!this.layout||a.isDataDriven()||h.isDataDriven())&&Kd.hasPaintOverride(this.layout,n)}static hasPaintOverride(n,a){const h=n.get("text-field"),g=Sm.paint.properties[a];let v=!1;const x=b=>{for(const E of b)if(g.overrides&&g.overrides.hasOverride(E))return void(v=!0)};if(h.value.kind==="constant"&&h.value.value instanceof Gr)x(h.value.value.sections);else if(h.value.kind==="source"){const b=T=>{v||(T instanceof js&&vi(T.value)===Ei?x(T.value.sections):T instanceof Xu?x(T.sections):T.eachChild(b))},E=h.value;E._styleExpression&&b(E._styleExpression.expression)}return v}}let T_;var Ix={get paint(){return T_=T_||new Ar({"background-color":new ne(_t.paint_background["background-color"]),"background-pattern":new Yl(_t.paint_background["background-pattern"]),"background-opacity":new ne(_t.paint_background["background-opacity"])})}};class Ex extends To{constructor(n){super(n,Ix)}}let L_;var Sx={get paint(){return L_=L_||new Ar({"raster-opacity":new ne(_t.paint_raster["raster-opacity"]),"raster-hue-rotate":new ne(_t.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ne(_t.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ne(_t.paint_raster["raster-brightness-max"]),"raster-saturation":new ne(_t.paint_raster["raster-saturation"]),"raster-contrast":new ne(_t.paint_raster["raster-contrast"]),"raster-resampling":new ne(_t.paint_raster["raster-resampling"]),"raster-fade-duration":new ne(_t.paint_raster["raster-fade-duration"])})}};class Cx extends To{constructor(n){super(n,Sx)}}class Tx extends To{constructor(n){super(n,{}),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=n}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Lx{constructor(n){this._methodToThrottle=n,this._triggered=!1,typeof MessageChannel<"u"&&(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 Cm=63710088e-1;class cl{constructor(n,a){if(isNaN(n)||isNaN(a))throw new Error(`Invalid LngLat object: (${n}, ${a})`);if(this.lng=+n,this.lat=+a,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new cl(Ve(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(n){const a=Math.PI/180,h=this.lat*a,g=n.lat*a,v=Math.sin(h)*Math.sin(g)+Math.cos(h)*Math.cos(g)*Math.cos((n.lng-this.lng)*a);return Cm*Math.acos(Math.min(v,1))}static convert(n){if(n instanceof cl)return n;if(Array.isArray(n)&&(n.length===2||n.length===3))return new cl(Number(n[0]),Number(n[1]));if(!Array.isArray(n)&&typeof n=="object"&&n!==null)return new cl(Number("lng"in n?n.lng:n.lon),Number(n.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 P_=2*Math.PI*Cm;function A_(o){return P_*Math.cos(o*Math.PI/180)}function M_(o){return(180+o)/360}function D_(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}function R_(o,n){return o/A_(n)}function Tm(o){return 360/Math.PI*Math.atan(Math.exp((180-360*o)*Math.PI/180))-90}class Jd{constructor(n,a,h=0){this.x=+n,this.y=+a,this.z=+h}static fromLngLat(n,a=0){const h=cl.convert(n);return new Jd(M_(h.lng),D_(h.lat),R_(a,h.lat))}toLngLat(){return new cl(360*this.x-180,Tm(this.y))}toAltitude(){return this.z*A_(Tm(this.y))}meterInMercatorCoordinateUnits(){return 1/P_*(n=Tm(this.y),1/Math.cos(n*Math.PI/180));var n}}function N_(o,n,a){var h=2*Math.PI*6378137/256/Math.pow(2,a);return[o*h-2*Math.PI*6378137/2,n*h-2*Math.PI*6378137/2]}class Lm{constructor(n,a,h){if(n<0||n>25||h<0||h>=Math.pow(2,n)||a<0||a>=Math.pow(2,n))throw new Error(`x=${a}, y=${h}, z=${n} outside of bounds. 0<=x<${Math.pow(2,n)}, 0<=y<${Math.pow(2,n)} 0<=z<=25 `);this.z=n,this.x=a,this.y=h,this.key=lp(0,n,n,a,h)}equals(n){return this.z===n.z&&this.x===n.x&&this.y===n.y}url(n,a,h){const g=(x=this.y,b=this.z,E=N_(256*(v=this.x),256*(x=Math.pow(2,b)-x-1),b),T=N_(256*(v+1),256*(x+1),b),E[0]+","+E[1]+","+T[0]+","+T[1]);var v,x,b,E,T;const A=function(M,O,B){let q,Z="";for(let Y=M;Y>0;Y--)q=1<1?"@2x":"").replace(/{quadkey}/g,A).replace(/{bbox-epsg-3857}/g,g)}isChildOf(n){const a=this.z-n.z;return a>0&&n.x===this.x>>a&&n.y===this.y>>a}getTilePoint(n){const a=Math.pow(2,this.z);return new k((n.x*a-this.x)*ri,(n.y*a-this.y)*ri)}toString(){return`${this.z}/${this.x}/${this.y}`}}class k_{constructor(n,a){this.wrap=n,this.canonical=a,this.key=lp(n,a.z,a.z,a.x,a.y)}}class Po{constructor(n,a,h,g,v){if(n= z; overscaledZ = ${n}; z = ${h}`);this.overscaledZ=n,this.wrap=a,this.canonical=new Lm(h,+g,+v),this.key=lp(a,n,h,g,v)}clone(){return new Po(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(n){return this.overscaledZ===n.overscaledZ&&this.wrap===n.wrap&&this.canonical.equals(n.canonical)}scaledTo(n){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-n;return n>this.canonical.z?new Po(n,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Po(n,this.wrap,n,this.canonical.x>>a,this.canonical.y>>a)}calculateScaledKey(n,a){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-n;return n>this.canonical.z?lp(this.wrap*+a,n,this.canonical.z,this.canonical.x,this.canonical.y):lp(this.wrap*+a,n,n,this.canonical.x>>h,this.canonical.y>>h)}isChildOf(n){if(n.wrap!==this.wrap)return!1;const a=this.canonical.z-n.canonical.z;return n.overscaledZ===0||n.overscaledZ>a&&n.canonical.y===this.canonical.y>>a}children(n){if(this.overscaledZ>=n)return[new Po(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const a=this.canonical.z+1,h=2*this.canonical.x,g=2*this.canonical.y;return[new Po(a,this.wrap,a,h,g),new Po(a,this.wrap,a,h+1,g),new Po(a,this.wrap,a,h,g+1),new Po(a,this.wrap,a,h+1,g+1)]}isLessThan(n){return this.wrapn.wrap)&&(this.overscaledZn.overscaledZ)&&(this.canonical.xn.canonical.x)&&this.canonical.ythis.max&&(this.max=M),M=this.dim+1||a<-1||a>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(a+1)*this.stride+(n+1)}unpack(n,a,h){return n*this.redFactor+a*this.greenFactor+h*this.blueFactor-this.baseShift}getPixels(){return new Lo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(n,a,h){if(this.dim!==n.dim)throw new Error("dem dimension mismatch");let g=a*this.dim,v=a*this.dim+this.dim,x=h*this.dim,b=h*this.dim+this.dim;switch(a){case-1:g=v-1;break;case 1:v=g+1}switch(h){case-1:x=b-1;break;case 1:b=x+1}const E=-a*this.dim,T=-h*this.dim;for(let A=x;A=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${n} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[n]}}class F_{constructor(n,a,h,g,v){this.type="Feature",this._vectorTileFeature=n,n._z=a,n._x=h,n._y=g,this.properties=n.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(n){this._geometry=n}toJSON(){const n={geometry:this.geometry};for(const a in this)a!=="_geometry"&&a!=="_vectorTileFeature"&&(n[a]=this[a]);return n}}class B_{constructor(n,a){this.tileID=n,this.x=n.canonical.x,this.y=n.canonical.y,this.z=n.canonical.z,this.grid=new Hl(ri,16,0),this.grid3D=new Hl(ri,16,0),this.featureIndexArray=new D,this.promoteId=a}insert(n,a,h,g,v,x){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(h,g,v);const E=x?this.grid3D:this.grid;for(let T=0;T=0&&M[3]>=0&&E.insert(b,M[0],M[1],M[2],M[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new al.VectorTile(new gm(this.rawTileData)).layers,this.sourceLayerCoder=new O_(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(n,a,h,g){this.loadVTLayers();const v=n.params||{},x=ri/n.tileSize/n.scale,b=tc(v.filter),E=n.queryGeometry,T=n.queryPadding*x,A=U_(E),M=this.grid.query(A.minX-T,A.minY-T,A.maxX+T,A.maxY+T),O=U_(n.cameraQueryGeometry),B=this.grid3D.query(O.minX-T,O.minY-T,O.maxX+T,O.maxY+T,(Y,$,lt,tt)=>function(ot,wt,Tt,Yt,te){for(const Ht of ot)if(wt<=Ht.x&&Tt<=Ht.y&&Yt>=Ht.x&&te>=Ht.y)return!0;const Xt=[new k(wt,Tt),new k(wt,te),new k(Yt,te),new k(Yt,Tt)];if(ot.length>2){for(const Ht of Xt)if(xc(ot,Ht))return!0}for(let Ht=0;Ht(tt||(tt=Ea(ot)),wt.queryIntersectsFeature(E,ot,Tt,tt,this.z,n.transform,x,n.pixelPosMatrix)))}return q}loadMatchingFeature(n,a,h,g,v,x,b,E,T,A,M){const O=this.bucketLayerIDs[a];if(x&&!function(Y,$){for(let lt=0;lt=0)return!0;return!1}(x,O))return;const B=this.sourceLayerCoder.decode(h),q=this.vtLayers[B].feature(g);if(v.needGeometry){const Y=Sa(q,!0);if(!v.filter(new zn(this.tileID.overscaledZ),Y,this.tileID.canonical))return}else if(!v.filter(new zn(this.tileID.overscaledZ),q))return;const Z=this.getId(q,B);for(let Y=0;Y{const b=n instanceof Xl?n.get(x):null;return b&&b.evaluate?b.evaluate(a,h,g):b})}function U_(o){let n=1/0,a=1/0,h=-1/0,g=-1/0;for(const v of o)n=Math.min(n,v.x),a=Math.min(a,v.y),h=Math.max(h,v.x),g=Math.max(g,v.y);return{minX:n,minY:a,maxX:h,maxY:g}}function Px(o,n){return n-o}function q_(o,n,a,h,g){const v=[];for(let x=0;x=h&&M.x>=h||(A.x>=h?A=new k(h,A.y+(h-A.x)/(M.x-A.x)*(M.y-A.y))._round():M.x>=h&&(M=new k(h,A.y+(h-A.x)/(M.x-A.x)*(M.y-A.y))._round()),A.y>=g&&M.y>=g||(A.y>=g?A=new k(A.x+(g-A.y)/(M.y-A.y)*(M.x-A.x),g)._round():M.y>=g&&(M=new k(A.x+(g-A.y)/(M.y-A.y)*(M.x-A.x),g)._round()),E&&A.equals(E[E.length-1])||(E=[A],v.push(E)),E.push(M)))))}}return v}Qt("FeatureIndex",B_,{omit:["rawTileData","sourceLayerCoder"]});class hl extends k{constructor(n,a,h,g){super(n,a),this.angle=h,g!==void 0&&(this.segment=g)}clone(){return new hl(this.x,this.y,this.angle,this.segment)}}function G_(o,n,a,h,g){if(n.segment===void 0||a===0)return!0;let v=n,x=n.segment+1,b=0;for(;b>-a/2;){if(x--,x<0)return!1;b-=o[x].dist(v),v=o[x]}b+=o[x].dist(o[x+1]),x++;const E=[];let T=0;for(;bh;)T-=E.shift().angleDelta;if(T>g)return!1;x++,b+=A.dist(M)}return!0}function j_(o){let n=0;for(let a=0;aT){const q=(T-E)/B,Z=fr.number(M.x,O.x,q),Y=fr.number(M.y,O.y,q),$=new hl(Z,Y,O.angleTo(M),A);return $._round(),!x||G_(o,$,b,x,n)?$:void 0}E+=B}}function Mx(o,n,a,h,g,v,x,b,E){const T=Z_(h,v,x),A=H_(h,g),M=A*x,O=o[0].x===0||o[0].x===E||o[0].y===0||o[0].y===E;return n-M=0&&ot=0&&wt=0&&O+T<=A){const Tt=new hl(ot,wt,lt,q);Tt._round(),h&&!G_(o,Tt,v,h,g)||B.push(Tt)}}M+=$}return b||B.length||x||(B=W_(o,M/2,a,h,g,v,x,!0,E)),B}Qt("Anchor",hl);const Lc=Xr;function X_(o,n,a,h){const g=[],v=o.image,x=v.pixelRatio,b=v.paddedRect.w-2*Lc,E=v.paddedRect.h-2*Lc,T=o.right-o.left,A=o.bottom-o.top,M=v.stretchX||[[0,b]],O=v.stretchY||[[0,E]],B=(Ft,$t)=>Ft+$t[1]-$t[0],q=M.reduce(B,0),Z=O.reduce(B,0),Y=b-q,$=E-Z;let lt=0,tt=q,ot=0,wt=Z,Tt=0,Yt=Y,te=0,Xt=$;if(v.content&&h){const Ft=v.content;lt=Qd(M,0,Ft[0]),ot=Qd(O,0,Ft[1]),tt=Qd(M,Ft[0],Ft[2]),wt=Qd(O,Ft[1],Ft[3]),Tt=Ft[0]-lt,te=Ft[1]-ot,Yt=Ft[2]-Ft[0]-tt,Xt=Ft[3]-Ft[1]-wt}const Ht=(Ft,$t,Ut,Mt)=>{const ae=$d(Ft.stretch-lt,tt,T,o.left),ee=tf(Ft.fixed-Tt,Yt,Ft.stretch,q),ze=$d($t.stretch-ot,wt,A,o.top),An=tf($t.fixed-te,Xt,$t.stretch,Z),Fn=$d(Ut.stretch-lt,tt,T,o.left),Pi=tf(Ut.fixed-Tt,Yt,Ut.stretch,q),ho=$d(Mt.stretch-ot,wt,A,o.top),Dr=tf(Mt.fixed-te,Xt,Mt.stretch,Z),Ii=new k(ae,ze),Hi=new k(Fn,ze),ir=new k(Fn,ho),Rr=new k(ae,ho),Nr=new k(ee/x,An/x),Ai=new k(Pi/x,Dr/x),Mi=n*Math.PI/180;if(Mi){const _r=Math.sin(Mi),Yr=Math.cos(Mi),Kr=[Yr,-_r,_r,Yr];Ii._matMult(Kr),Hi._matMult(Kr),Rr._matMult(Kr),ir._matMult(Kr)}const gr=Ft.stretch+Ft.fixed,kr=$t.stretch+$t.fixed;return{tl:Ii,tr:Hi,bl:Rr,br:ir,tex:{x:v.paddedRect.x+Lc+gr,y:v.paddedRect.y+Lc+kr,w:Ut.stretch+Ut.fixed-gr,h:Mt.stretch+Mt.fixed-kr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Nr,pixelOffsetBR:Ai,minFontScaleX:Yt/x/T,minFontScaleY:Xt/x/A,isSDF:a}};if(h&&(v.stretchX||v.stretchY)){const Ft=Y_(M,Y,q),$t=Y_(O,$,Z);for(let Ut=0;Ut0&&(q=Math.max(10,q),this.circleDiameter=q)}else{let M=x.top*b-E[0],O=x.bottom*b+E[2],B=x.left*b-E[3],q=x.right*b+E[1];const Z=x.collisionPadding;if(Z&&(B-=Z[0]*b,M-=Z[1]*b,q+=Z[2]*b,O+=Z[3]*b),A){const Y=new k(B,M),$=new k(q,M),lt=new k(B,O),tt=new k(q,O),ot=A*Math.PI/180;Y._rotate(ot),$._rotate(ot),lt._rotate(ot),tt._rotate(ot),B=Math.min(Y.x,$.x,lt.x,tt.x),q=Math.max(Y.x,$.x,lt.x,tt.x),M=Math.min(Y.y,$.y,lt.y,tt.y),O=Math.max(Y.y,$.y,lt.y,tt.y)}n.emplaceBack(a.x,a.y,B,M,q,O,h,g,v)}this.boxEndIndex=n.length}}class Dx{constructor(n=[],a=Rx){if(this.data=n,this.length=this.data.length,this.compare=a,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(n){this.data.push(n),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const n=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:a,compare:h}=this,g=a[n];for(;n>0;){const v=n-1>>1,x=a[v];if(h(g,x)>=0)break;a[n]=x,n=v}a[n]=g}_down(n){const{data:a,compare:h}=this,g=this.length>>1,v=a[n];for(;n=0)break;a[n]=b,n=x}a[n]=v}}function Rx(o,n){return on?1:0}function Nx(o,n=1,a=!1){let h=1/0,g=1/0,v=-1/0,x=-1/0;const b=o[0];for(let B=0;Bv)&&(v=q.x),(!B||q.y>x)&&(x=q.y)}const E=Math.min(v-h,x-g);let T=E/2;const A=new Dx([],kx);if(E===0)return new k(h,g);for(let B=h;BM.d||!M.d)&&(M=B,a&&console.log("found best %d after %d probes",Math.round(1e4*B.d)/1e4,O)),B.max-M.d<=n||(T=B.h/2,A.push(new Pc(B.p.x-T,B.p.y-T,T,o)),A.push(new Pc(B.p.x+T,B.p.y-T,T,o)),A.push(new Pc(B.p.x-T,B.p.y+T,T,o)),A.push(new Pc(B.p.x+T,B.p.y+T,T,o)),O+=4)}return a&&(console.log(`num probes: ${O}`),console.log(`best distance: ${M.d}`)),M.p}function kx(o,n){return n.max-o.max}function Pc(o,n,a,h){this.p=new k(o,n),this.h=a,this.d=function(g,v){let x=!1,b=1/0;for(let E=0;Eg.y!=q.y>g.y&&g.x<(q.x-B.x)*(g.y-B.y)/(q.y-B.y)+B.x&&(x=!x),b=Math.min(b,Dg(g,B,q))}}return(x?1:-1)*Math.sqrt(b)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}var nr;m.ap=void 0,(nr=m.ap||(m.ap={}))[nr.center=1]="center",nr[nr.left=2]="left",nr[nr.right=3]="right",nr[nr.top=4]="top",nr[nr.bottom=5]="bottom",nr[nr["top-left"]=6]="top-left",nr[nr["top-right"]=7]="top-right",nr[nr["bottom-left"]=8]="bottom-left",nr[nr["bottom-right"]=9]="bottom-right";const pl=7,Pm=Number.POSITIVE_INFINITY;function K_(o,n){return n[1]!==Pm?function(a,h,g){let v=0,x=0;switch(h=Math.abs(h),g=Math.abs(g),a){case"top-right":case"top-left":case"top":x=g-pl;break;case"bottom-right":case"bottom-left":case"bottom":x=-g+pl}switch(a){case"top-right":case"bottom-right":case"right":v=-h;break;case"top-left":case"bottom-left":case"left":v=h}return[v,x]}(o,n[0],n[1]):function(a,h){let g=0,v=0;h<0&&(h=0);const x=h/Math.SQRT2;switch(a){case"top-right":case"top-left":v=x-pl;break;case"bottom-right":case"bottom-left":v=-x+pl;break;case"bottom":v=-h+pl;break;case"top":v=h-pl}switch(a){case"top-right":case"bottom-right":g=-x;break;case"top-left":case"bottom-left":g=x;break;case"left":g=h;break;case"right":g=-h}return[g,v]}(o,n[0])}function J_(o,n,a){var h;const g=o.layout,v=(h=g.get("text-variable-anchor-offset"))===null||h===void 0?void 0:h.evaluate(n,{},a);if(v){const b=v.values,E=[];for(let T=0;TO*Li);A.startsWith("top")?M[1]-=pl:A.startsWith("bottom")&&(M[1]+=pl),E[T+1]=M}return new ao(E)}const x=g.get("text-variable-anchor");if(x){let b;b=o._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[g.get("text-radial-offset").evaluate(n,{},a)*Li,Pm]:g.get("text-offset").evaluate(n,{},a).map(T=>T*Li);const E=[];for(const T of x)E.push(T,K_(T,b));return new ao(E)}return null}function Am(o){switch(o){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function zx(o,n,a,h,g,v,x,b,E,T,A){let M=v.textMaxSize.evaluate(n,{});M===void 0&&(M=x);const O=o.layers[0].layout,B=O.get("icon-offset").evaluate(n,{},A),q=$_(a.horizontal),Z=x/24,Y=o.tilePixelRatio*Z,$=o.tilePixelRatio*M/24,lt=o.tilePixelRatio*b,tt=o.tilePixelRatio*O.get("symbol-spacing"),ot=O.get("text-padding")*o.tilePixelRatio,wt=function(Mt,ae,ee,ze=1){const An=Mt.get("icon-padding").evaluate(ae,{},ee),Fn=An&&An.values;return[Fn[0]*ze,Fn[1]*ze,Fn[2]*ze,Fn[3]*ze]}(O,n,A,o.tilePixelRatio),Tt=O.get("text-max-angle")/180*Math.PI,Yt=O.get("text-rotation-alignment")!=="viewport"&&O.get("symbol-placement")!=="point",te=O.get("icon-rotation-alignment")==="map"&&O.get("symbol-placement")!=="point",Xt=O.get("symbol-placement"),Ht=tt/2,Ft=O.get("icon-text-fit");let $t;h&&Ft!=="none"&&(o.allowVerticalPlacement&&a.vertical&&($t=w_(h,a.vertical,Ft,O.get("icon-text-fit-padding"),B,Z)),q&&(h=w_(h,q,Ft,O.get("icon-text-fit-padding"),B,Z)));const Ut=(Mt,ae)=>{ae.x<0||ae.x>=ri||ae.y<0||ae.y>=ri||function(ee,ze,An,Fn,Pi,ho,Dr,Ii,Hi,ir,Rr,Nr,Ai,Mi,gr,kr,_r,Yr,Kr,Di,qe,yr,rr,Ri,ns){const Is=ee.addToLineVertexArray(ze,An);let Es,Ta,is,Ao,Jr=0,La=0,hp=0,iy=0,Fm=-1,Bm=-1;const Pa={};let ry=Jn("");if(ee.allowVerticalPlacement&&Fn.vertical){const vr=Ii.layout.get("text-rotate").evaluate(qe,{},Ri)+90;is=new ef(Hi,ze,ir,Rr,Nr,Fn.vertical,Ai,Mi,gr,vr),Dr&&(Ao=new ef(Hi,ze,ir,Rr,Nr,Dr,_r,Yr,gr,vr))}if(Pi){const vr=Ii.layout.get("icon-rotate").evaluate(qe,{}),Mo=Ii.layout.get("icon-text-fit")!=="none",iu=X_(Pi,vr,rr,Mo),Cs=Dr?X_(Dr,vr,rr,Mo):void 0;Ta=new ef(Hi,ze,ir,Rr,Nr,Pi,_r,Yr,!1,vr),Jr=4*iu.length;const ru=ee.iconSizeData;let ta=null;ru.kind==="source"?(ta=[$s*Ii.layout.get("icon-size").evaluate(qe,{})],ta[0]>ul&&ke(`${ee.layerIds[0]}: Value for "icon-size" is >= ${ap}. Reduce your "icon-size".`)):ru.kind==="composite"&&(ta=[$s*yr.compositeIconSizes[0].evaluate(qe,{},Ri),$s*yr.compositeIconSizes[1].evaluate(qe,{},Ri)],(ta[0]>ul||ta[1]>ul)&&ke(`${ee.layerIds[0]}: Value for "icon-size" is >= ${ap}. Reduce your "icon-size".`)),ee.addSymbols(ee.icon,iu,ta,Di,Kr,qe,m.ah.none,ze,Is.lineStartIndex,Is.lineLength,-1,Ri),Fm=ee.icon.placedSymbolArray.length-1,Cs&&(La=4*Cs.length,ee.addSymbols(ee.icon,Cs,ta,Di,Kr,qe,m.ah.vertical,ze,Is.lineStartIndex,Is.lineLength,-1,Ri),Bm=ee.icon.placedSymbolArray.length-1)}const oy=Object.keys(Fn.horizontal);for(const vr of oy){const Mo=Fn.horizontal[vr];if(!Es){ry=Jn(Mo.text);const Cs=Ii.layout.get("text-rotate").evaluate(qe,{},Ri);Es=new ef(Hi,ze,ir,Rr,Nr,Mo,Ai,Mi,gr,Cs)}const iu=Mo.positionedLines.length===1;if(hp+=Q_(ee,ze,Mo,ho,Ii,gr,qe,kr,Is,Fn.vertical?m.ah.horizontal:m.ah.horizontalOnly,iu?oy:[vr],Pa,Fm,yr,Ri),iu)break}Fn.vertical&&(iy+=Q_(ee,ze,Fn.vertical,ho,Ii,gr,qe,kr,Is,m.ah.vertical,["vertical"],Pa,Bm,yr,Ri));const Bx=Es?Es.boxStartIndex:ee.collisionBoxArray.length,Vx=Es?Es.boxEndIndex:ee.collisionBoxArray.length,Ux=is?is.boxStartIndex:ee.collisionBoxArray.length,qx=is?is.boxEndIndex:ee.collisionBoxArray.length,Gx=Ta?Ta.boxStartIndex:ee.collisionBoxArray.length,jx=Ta?Ta.boxEndIndex:ee.collisionBoxArray.length,Zx=Ao?Ao.boxStartIndex:ee.collisionBoxArray.length,Hx=Ao?Ao.boxEndIndex:ee.collisionBoxArray.length;let Ss=-1;const rf=(vr,Mo)=>vr&&vr.circleDiameter?Math.max(vr.circleDiameter,Mo):Mo;Ss=rf(Es,Ss),Ss=rf(is,Ss),Ss=rf(Ta,Ss),Ss=rf(Ao,Ss);const sy=Ss>-1?1:0;sy&&(Ss*=ns/Li),ee.glyphOffsetArray.length>=Tc.MAX_GLYPHS&&ke("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),qe.sortKey!==void 0&&ee.addToSortKeyRanges(ee.symbolInstances.length,qe.sortKey);const Wx=J_(Ii,qe,Ri),[Xx,Yx]=function(vr,Mo){const iu=vr.length,Cs=Mo==null?void 0:Mo.values;if((Cs==null?void 0:Cs.length)>0)for(let ru=0;ru=0?Pa.right:-1,Pa.center>=0?Pa.center:-1,Pa.left>=0?Pa.left:-1,Pa.vertical||-1,Fm,Bm,ry,Bx,Vx,Ux,qx,Gx,jx,Zx,Hx,ir,hp,iy,Jr,La,sy,0,Ai,Ss,Xx,Yx)}(o,ae,Mt,a,h,g,$t,o.layers[0],o.collisionBoxArray,n.index,n.sourceLayerIndex,o.index,Y,[ot,ot,ot,ot],Yt,E,lt,wt,te,B,n,v,T,A,x)};if(Xt==="line")for(const Mt of q_(n.geometry,0,0,ri,ri)){const ae=Mx(Mt,tt,Tt,a.vertical||q,h,24,$,o.overscaling,ri);for(const ee of ae)q&&Ox(o,q.text,Ht,ee)||Ut(Mt,ee)}else if(Xt==="line-center"){for(const Mt of n.geometry)if(Mt.length>1){const ae=Ax(Mt,Tt,a.vertical||q,h,24,$);ae&&Ut(Mt,ae)}}else if(n.type==="Polygon")for(const Mt of lm(n.geometry,0)){const ae=Nx(Mt,16);Ut(Mt[0],new hl(ae.x,ae.y,0))}else if(n.type==="LineString")for(const Mt of n.geometry)Ut(Mt,new hl(Mt[0].x,Mt[0].y,0));else if(n.type==="Point")for(const Mt of n.geometry)for(const ae of Mt)Ut([ae],new hl(ae.x,ae.y,0))}function Q_(o,n,a,h,g,v,x,b,E,T,A,M,O,B,q){const Z=function(lt,tt,ot,wt,Tt,Yt,te,Xt){const Ht=wt.layout.get("text-rotate").evaluate(Yt,{})*Math.PI/180,Ft=[];for(const $t of tt.positionedLines)for(const Ut of $t.positionedGlyphs){if(!Ut.rect)continue;const Mt=Ut.rect||{};let ae=m_+1,ee=!0,ze=1,An=0;const Fn=(Tt||Xt)&&Ut.vertical,Pi=Ut.metrics.advance*Ut.scale/2;if(Xt&&tt.verticalizable&&(An=$t.lineOffset/2-(Ut.imageName?-(Li-Ut.metrics.width*Ut.scale)/2:(Ut.scale-1)*Li)),Ut.imageName){const Di=te[Ut.imageName];ee=Di.sdf,ze=Di.pixelRatio,ae=Xr/ze}const ho=Tt?[Ut.x+Pi,Ut.y]:[0,0];let Dr=Tt?[0,0]:[Ut.x+Pi+ot[0],Ut.y+ot[1]-An],Ii=[0,0];Fn&&(Ii=Dr,Dr=[0,0]);const Hi=Ut.metrics.isDoubleResolution?2:1,ir=(Ut.metrics.left-ae)*Ut.scale-Pi+Dr[0],Rr=(-Ut.metrics.top-ae)*Ut.scale+Dr[1],Nr=ir+Mt.w/Hi*Ut.scale/ze,Ai=Rr+Mt.h/Hi*Ut.scale/ze,Mi=new k(ir,Rr),gr=new k(Nr,Rr),kr=new k(ir,Ai),_r=new k(Nr,Ai);if(Fn){const Di=new k(-Pi,Pi-op),qe=-Math.PI/2,yr=Li/2-Pi,rr=new k(5-op-yr,-(Ut.imageName?yr:0)),Ri=new k(...Ii);Mi._rotateAround(qe,Di)._add(rr)._add(Ri),gr._rotateAround(qe,Di)._add(rr)._add(Ri),kr._rotateAround(qe,Di)._add(rr)._add(Ri),_r._rotateAround(qe,Di)._add(rr)._add(Ri)}if(Ht){const Di=Math.sin(Ht),qe=Math.cos(Ht),yr=[qe,-Di,Di,qe];Mi._matMult(yr),gr._matMult(yr),kr._matMult(yr),_r._matMult(yr)}const Yr=new k(0,0),Kr=new k(0,0);Ft.push({tl:Mi,tr:gr,bl:kr,br:_r,tex:Mt,writingMode:tt.writingMode,glyphOffset:ho,sectionIndex:Ut.sectionIndex,isSDF:ee,pixelOffsetTL:Yr,pixelOffsetBR:Kr,minFontScaleX:0,minFontScaleY:0})}return Ft}(0,a,b,g,v,x,h,o.allowVerticalPlacement),Y=o.textSizeData;let $=null;Y.kind==="source"?($=[$s*g.layout.get("text-size").evaluate(x,{})],$[0]>ul&&ke(`${o.layerIds[0]}: Value for "text-size" is >= ${ap}. Reduce your "text-size".`)):Y.kind==="composite"&&($=[$s*B.compositeTextSizes[0].evaluate(x,{},q),$s*B.compositeTextSizes[1].evaluate(x,{},q)],($[0]>ul||$[1]>ul)&&ke(`${o.layerIds[0]}: Value for "text-size" is >= ${ap}. Reduce your "text-size".`)),o.addSymbols(o.text,Z,$,b,v,x,T,n,E.lineStartIndex,E.lineLength,O,q);for(const lt of A)M[lt]=o.text.placedSymbolArray.length-1;return 4*Z.length}function $_(o){for(const n in o)return o[n];return null}function Ox(o,n,a,h){const g=o.compareText;if(n in g){const v=g[n];for(let x=v.length-1;x>=0;x--)if(h.dist(v[x])>4;if(g!==1)throw new Error(`Got v${g} data when expected v1.`);const v=ty[15&h];if(!v)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(n,2,1),[b]=new Uint32Array(n,4,1);return new Mm(b,x,v,n)}constructor(n,a=64,h=Float64Array,g){if(isNaN(n)||n<0)throw new Error(`Unpexpected numItems value: ${n}.`);this.numItems=+n,this.nodeSize=Math.min(Math.max(+a,2),65535),this.ArrayType=h,this.IndexArrayType=n<65536?Uint16Array:Uint32Array;const v=ty.indexOf(this.ArrayType),x=2*n*this.ArrayType.BYTES_PER_ELEMENT,b=n*this.IndexArrayType.BYTES_PER_ELEMENT,E=(8-b%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${h}.`);g&&g instanceof ArrayBuffer?(this.data=g,this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+E,2*n),this._pos=2*n,this._finished=!0):(this.data=new ArrayBuffer(8+x+b+E),this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+E,2*n),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=a,new Uint32Array(this.data,4,1)[0]=n)}add(n,a){const h=this._pos>>1;return this.ids[h]=h,this.coords[this._pos++]=n,this.coords[this._pos++]=a,h}finish(){const n=this._pos>>1;if(n!==this.numItems)throw new Error(`Added ${n} items when expected ${this.numItems}.`);return Dm(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(n,a,h,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:x,nodeSize:b}=this,E=[0,v.length-1,0],T=[];for(;E.length;){const A=E.pop()||0,M=E.pop()||0,O=E.pop()||0;if(M-O<=b){for(let Y=O;Y<=M;Y++){const $=x[2*Y],lt=x[2*Y+1];$>=n&&$<=h&<>=a&<<=g&&T.push(v[Y])}continue}const B=O+M>>1,q=x[2*B],Z=x[2*B+1];q>=n&&q<=h&&Z>=a&&Z<=g&&T.push(v[B]),(A===0?n<=q:a<=Z)&&(E.push(O),E.push(B-1),E.push(1-A)),(A===0?h>=q:g>=Z)&&(E.push(B+1),E.push(M),E.push(1-A))}return T}within(n,a,h){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:v,nodeSize:x}=this,b=[0,g.length-1,0],E=[],T=h*h;for(;b.length;){const A=b.pop()||0,M=b.pop()||0,O=b.pop()||0;if(M-O<=x){for(let Y=O;Y<=M;Y++)ny(v[2*Y],v[2*Y+1],n,a)<=T&&E.push(g[Y]);continue}const B=O+M>>1,q=v[2*B],Z=v[2*B+1];ny(q,Z,n,a)<=T&&E.push(g[B]),(A===0?n-h<=q:a-h<=Z)&&(b.push(O),b.push(B-1),b.push(1-A)),(A===0?n+h>=q:a+h>=Z)&&(b.push(B+1),b.push(M),b.push(1-A))}return E}}function Dm(o,n,a,h,g,v){if(g-h<=a)return;const x=h+g>>1;ey(o,n,x,h,g,v),Dm(o,n,a,h,x-1,1-v),Dm(o,n,a,x+1,g,1-v)}function ey(o,n,a,h,g,v){for(;g>h;){if(g-h>600){const T=g-h+1,A=a-h+1,M=Math.log(T),O=.5*Math.exp(2*M/3),B=.5*Math.sqrt(M*O*(T-O)/T)*(A-T/2<0?-1:1);ey(o,n,a,Math.max(h,Math.floor(a-A*O/T+B)),Math.min(g,Math.floor(a+(T-A)*O/T+B)),v)}const x=n[2*a+v];let b=h,E=g;for(up(o,n,h,a),n[2*g+v]>x&&up(o,n,h,g);bx;)E--}n[2*h+v]===x?up(o,n,h,E):(E++,up(o,n,E,g)),E<=a&&(h=E+1),a<=E&&(g=E-1)}}function up(o,n,a,h){Rm(o,a,h),Rm(n,2*a,2*h),Rm(n,2*a+1,2*h+1)}function Rm(o,n,a){const h=o[n];o[n]=o[a],o[a]=h}function ny(o,n,a,h){const g=o-a,v=n-h;return g*g+v*v}var Nm;m.bd=void 0,(Nm=m.bd||(m.bd={})).create="create",Nm.load="load",Nm.fullLoad="fullLoad";let nf=null,cp=[];const km=1e3/60,zm="loadTime",Om="fullLoadTime",Fx={mark(o){performance.mark(o)},frame(o){const n=o;nf!=null&&cp.push(n-nf),nf=n},clearMetrics(){nf=null,cp=[],performance.clearMeasures(zm),performance.clearMeasures(Om);for(const o in m.bd)performance.clearMarks(m.bd[o])},getPerformanceMetrics(){performance.measure(zm,m.bd.create,m.bd.load),performance.measure(Om,m.bd.create,m.bd.fullLoad);const o=performance.getEntriesByName(zm)[0].duration,n=performance.getEntriesByName(Om)[0].duration,a=cp.length,h=1/(cp.reduce((v,x)=>v+x,0)/a/1e3),g=cp.filter(v=>v>km).reduce((v,x)=>v+(x-km)/km,0);return{loadTime:o,fullLoadTime:n,fps:h,percentDroppedFrames:g/(a+g)*100,totalFrames:a}}};m.$=Bt,m.A=bc,m.B=function(o){if(fe==null){const n=o.navigator?o.navigator.userAgent:null;fe=!!o.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return fe},m.C=class{constructor(o,n){this.target=o,this.mapId=n,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Lx(()=>this.process()),this.subscription=function(a,h,g,v){return a.addEventListener(h,g,!1),{unsubscribe:()=>{a.removeEventListener(h,g,!1)}}}(this.target,"message",a=>this.receive(a)),this.globalScope=Cn(self)?o:window}registerMessageHandler(o,n){this.messageHandlers[o]=n}sendAsync(o,n){return new Promise((a,h)=>{const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[g]={resolve:a,reject:h},n&&n.signal.addEventListener("abort",()=>{delete this.resolveRejects[g];const b={id:g,type:"",origin:location.origin,targetMapId:o.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)},{once:!0});const v=[],x=Object.assign(Object.assign({},o),{id:g,sourceMapId:this.mapId,origin:location.origin,data:il(o.data,v)});this.target.postMessage(x,{transfer:v})})}receive(o){const n=o.data,a=n.id;if(!(n.origin!=="file://"&&location.origin!=="file://"&&n.origin!==location.origin||n.targetMapId&&this.mapId!==n.targetMapId)){if(n.type===""){delete this.tasks[a];const h=this.abortControllers[a];return delete this.abortControllers[a],void(h&&h.abort())}if(Cn(self)||n.mustQueue)return this.tasks[a]=n,this.taskQueue.push(a),void this.invoker.trigger();this.processTask(a,n)}}process(){if(this.taskQueue.length===0)return;const o=this.taskQueue.shift(),n=this.tasks[o];delete this.tasks[o],this.taskQueue.length>0&&this.invoker.trigger(),n&&this.processTask(o,n)}processTask(o,n){return c(this,void 0,void 0,function*(){if(n.type===""){const g=this.resolveRejects[o];return delete this.resolveRejects[o],g?void(n.error?g.reject(rl(n.error)):g.resolve(rl(n.data))):void 0}if(!this.messageHandlers[n.type])return void this.completeTask(o,new Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const a=rl(n.data),h=new AbortController;this.abortControllers[o]=h;try{const g=yield this.messageHandlers[n.type](n.sourceMapId,a,h);this.completeTask(o,null,g)}catch(g){this.completeTask(o,g)}})}completeTask(o,n,a){const h=[];delete this.abortControllers[o];const g={id:o,type:"",sourceMapId:this.mapId,origin:location.origin,error:n?il(n):null,data:il(a,h)};this.target.postMessage(g,{transfer:h})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},m.D=ne,m.E=Nn,m.F=function(){var o=new bc(16);return bc!=Float32Array&&(o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[11]=0,o[12]=0,o[13]=0,o[14]=0),o[0]=1,o[5]=1,o[10]=1,o[15]=1,o},m.G=gn,m.H=function(o,n,a){var h,g,v,x,b,E,T,A,M,O,B,q,Z=a[0],Y=a[1],$=a[2];return n===o?(o[12]=n[0]*Z+n[4]*Y+n[8]*$+n[12],o[13]=n[1]*Z+n[5]*Y+n[9]*$+n[13],o[14]=n[2]*Z+n[6]*Y+n[10]*$+n[14],o[15]=n[3]*Z+n[7]*Y+n[11]*$+n[15]):(g=n[1],v=n[2],x=n[3],b=n[4],E=n[5],T=n[6],A=n[7],M=n[8],O=n[9],B=n[10],q=n[11],o[0]=h=n[0],o[1]=g,o[2]=v,o[3]=x,o[4]=b,o[5]=E,o[6]=T,o[7]=A,o[8]=M,o[9]=O,o[10]=B,o[11]=q,o[12]=h*Z+b*Y+M*$+n[12],o[13]=g*Z+E*Y+O*$+n[13],o[14]=v*Z+T*Y+B*$+n[14],o[15]=x*Z+A*Y+q*$+n[15]),o},m.I=ym,m.J=function(o,n,a){var h=a[0],g=a[1],v=a[2];return o[0]=n[0]*h,o[1]=n[1]*h,o[2]=n[2]*h,o[3]=n[3]*h,o[4]=n[4]*g,o[5]=n[5]*g,o[6]=n[6]*g,o[7]=n[7]*g,o[8]=n[8]*v,o[9]=n[9]*v,o[10]=n[10]*v,o[11]=n[11]*v,o[12]=n[12],o[13]=n[13],o[14]=n[14],o[15]=n[15],o},m.K=zg,m.L=function(o,n){const a={};for(let h=0;h{const n=window.document.createElement("video");return n.muted=!0,new Promise(a=>{n.onloadstart=()=>{a(n)};for(const h of o){const g=window.document.createElement("source");Wn(h)||(n.crossOrigin="Anonymous"),g.src=h,n.appendChild(g)}})},m.a3=function(){return Me++},m.a4=_,m.a5=Tc,m.a6=tc,m.a7=Sa,m.a8=zn,m.a9=F_,m.aA=Nt,m.aB=function(o,n){if(!o)return[{command:"setStyle",args:[n]}];let a=[];try{if(!Jt(o.version,n.version))return[{command:"setStyle",args:[n]}];Jt(o.center,n.center)||a.push({command:"setCenter",args:[n.center]}),Jt(o.zoom,n.zoom)||a.push({command:"setZoom",args:[n.zoom]}),Jt(o.bearing,n.bearing)||a.push({command:"setBearing",args:[n.bearing]}),Jt(o.pitch,n.pitch)||a.push({command:"setPitch",args:[n.pitch]}),Jt(o.sprite,n.sprite)||a.push({command:"setSprite",args:[n.sprite]}),Jt(o.glyphs,n.glyphs)||a.push({command:"setGlyphs",args:[n.glyphs]}),Jt(o.transition,n.transition)||a.push({command:"setTransition",args:[n.transition]}),Jt(o.light,n.light)||a.push({command:"setLight",args:[n.light]}),Jt(o.terrain,n.terrain)||a.push({command:"setTerrain",args:[n.terrain]}),Jt(o.sky,n.sky)||a.push({command:"setSky",args:[n.sky]});const h={},g=[];(function(x,b,E,T){let A;for(A in b=b||{},x=x||{})Object.prototype.hasOwnProperty.call(x,A)&&(Object.prototype.hasOwnProperty.call(b,A)||Za(A,E,T));for(A in b)Object.prototype.hasOwnProperty.call(b,A)&&(Object.prototype.hasOwnProperty.call(x,A)?Jt(x[A],b[A])||(x[A].type==="geojson"&&b[A].type==="geojson"&&Wa(x,b,A)?Fe(E,{command:"setGeoJSONSourceData",args:[A,b[A].data]}):Ha(A,b,E,T)):Io(A,b,E))})(o.sources,n.sources,g,h);const v=[];o.layers&&o.layers.forEach(x=>{"source"in x&&h[x.source]?a.push({command:"removeLayer",args:[x.id]}):v.push(x)}),a=a.concat(g),function(x,b,E){b=b||[];const T=(x=x||[]).map(Du),A=b.map(Du),M=x.reduce(fa,{}),O=b.reduce(fa,{}),B=T.slice(),q=Object.create(null);let Z,Y,$,lt,tt;for(let ot=0,wt=0;ot@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,h,g,v)=>{const x=g||v;return n[h]=!x||x.toLowerCase(),""}),n["max-age"]){const a=parseInt(n["max-age"],10);isNaN(a)?delete n["max-age"]:n["max-age"]=a}return n},m.ab=function(o,n){const a=[];for(const h in o)h in n||a.push(h);return a},m.ac=de,m.ad=function(o,n,a){var h=Math.sin(a),g=Math.cos(a),v=n[0],x=n[1],b=n[2],E=n[3],T=n[4],A=n[5],M=n[6],O=n[7];return n!==o&&(o[8]=n[8],o[9]=n[9],o[10]=n[10],o[11]=n[11],o[12]=n[12],o[13]=n[13],o[14]=n[14],o[15]=n[15]),o[0]=v*g+T*h,o[1]=x*g+A*h,o[2]=b*g+M*h,o[3]=E*g+O*h,o[4]=T*g-v*h,o[5]=A*g-x*h,o[6]=M*g-b*h,o[7]=O*g-E*h,o},m.ae=function(o){var n=new bc(16);return n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=o[3],n[4]=o[4],n[5]=o[5],n[6]=o[6],n[7]=o[7],n[8]=o[8],n[9]=o[9],n[10]=o[10],n[11]=o[11],n[12]=o[12],n[13]=o[13],n[14]=o[14],n[15]=o[15],n},m.af=Vd,m.ag=function(o,n){let a=0,h=0;if(o.kind==="constant")h=o.layoutSize;else if(o.kind!=="source"){const{interpolationType:g,minZoom:v,maxZoom:x}=o,b=g?de(er.interpolationFactor(g,n,v,x),0,1):0;o.kind==="camera"?h=fr.number(o.minSize,o.maxSize,b):a=b}return{uSizeT:a,uSize:h}},m.ai=function(o,{uSize:n,uSizeT:a},{lowerSize:h,upperSize:g}){return o.kind==="source"?h/$s:o.kind==="composite"?fr.number(h/$s,g/$s,a):n},m.aj=wm,m.ak=function(o,n,a,h){const g=n.y-o.y,v=n.x-o.x,x=h.y-a.y,b=h.x-a.x,E=x*v-b*g;if(E===0)return null;const T=(b*(o.y-a.y)-x*(o.x-a.x))/E;return new k(o.x+T*v,o.y+T*g)},m.al=q_,m.am=Zh,m.an=em,m.ao=Li,m.aq=bm,m.ar=function(o,n){var a=n[0],h=n[1],g=n[2],v=n[3],x=n[4],b=n[5],E=n[6],T=n[7],A=n[8],M=n[9],O=n[10],B=n[11],q=n[12],Z=n[13],Y=n[14],$=n[15],lt=a*b-h*x,tt=a*E-g*x,ot=a*T-v*x,wt=h*E-g*b,Tt=h*T-v*b,Yt=g*T-v*E,te=A*Z-M*q,Xt=A*Y-O*q,Ht=A*$-B*q,Ft=M*Y-O*Z,$t=M*$-B*Z,Ut=O*$-B*Y,Mt=lt*Ut-tt*$t+ot*Ft+wt*Ht-Tt*Xt+Yt*te;return Mt?(o[0]=(b*Ut-E*$t+T*Ft)*(Mt=1/Mt),o[1]=(g*$t-h*Ut-v*Ft)*Mt,o[2]=(Z*Yt-Y*Tt+$*wt)*Mt,o[3]=(O*Tt-M*Yt-B*wt)*Mt,o[4]=(E*Ht-x*Ut-T*Xt)*Mt,o[5]=(a*Ut-g*Ht+v*Xt)*Mt,o[6]=(Y*ot-q*Yt-$*tt)*Mt,o[7]=(A*Yt-O*ot+B*tt)*Mt,o[8]=(x*$t-b*Ht+T*te)*Mt,o[9]=(h*Ht-a*$t-v*te)*Mt,o[10]=(q*Tt-Z*ot+$*lt)*Mt,o[11]=(M*ot-A*Tt-B*lt)*Mt,o[12]=(b*Xt-x*Ft-E*te)*Mt,o[13]=(a*Ft-h*Xt+g*te)*Mt,o[14]=(Z*tt-q*wt-Y*lt)*Mt,o[15]=(A*wt-M*tt+O*lt)*Mt,o):null},m.as=Am,m.at=xm,m.au=Mm,m.av=function(){const o={},n=_t.$version;for(const a in _t.$root){const h=_t.$root[a];if(h.required){let g=null;g=a==="version"?n:h.type==="array"?[]:{},g!=null&&(o[a]=g)}}return o},m.aw=Cd,m.ax=gi,m.ay=function(o){o=o.slice();const n=Object.create(null);for(let a=0;aMt*Li)}let Xt=x?"center":a.get("text-justify").evaluate(T,{},o.canonical);const Ht=a.get("symbol-placement"),Ft=Ht==="point"?a.get("text-max-width").evaluate(T,{},o.canonical)*Li:0,$t=()=>{o.bucket.allowVerticalPlacement&&ol(ot)&&(q.vertical=Wd(Z,o.glyphMap,o.glyphPositions,o.imagePositions,A,Ft,v,Yt,"left",Tt,$,m.ah.vertical,!0,Ht,O,M))};if(!x&&te){const Ut=new Set;if(Xt==="auto")for(let ae=0;aec(void 0,void 0,void 0,function*(){if(o.byteLength===0)return createImageBitmap(new ImageData(1,1));const n=new Blob([new Uint8Array(o)],{type:"image/png"});try{return createImageBitmap(n)}catch(a){throw new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),m.e=he,m.f=o=>new Promise((n,a)=>{const h=new Image;h.onload=()=>{n(h),URL.revokeObjectURL(h.src),h.onload=null,window.requestAnimationFrame(()=>{h.src=Dn})},h.onerror=()=>a(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 g=new Blob([new Uint8Array(o)],{type:"image/png"});h.src=o.byteLength?URL.createObjectURL(g):Dn}),m.g=Ue,m.h=(o,n)=>li(he(o,{type:"json"}),n),m.i=Cn,m.j=ui,m.k=St,m.l=(o,n)=>li(he(o,{type:"arrayBuffer"}),n),m.m=li,m.n=function(o){return new gm(o).readFields(dx,[])},m.o=Jh,m.p=g_,m.q=Ar,m.r=Jf,m.s=Wn,m.t=nl,m.u=Wt,m.v=_t,m.w=ke,m.x=ba,m.y=function([o,n,a]){return n+=90,n*=Math.PI/180,a*=Math.PI/180,{x:o*Math.cos(n)*Math.sin(a),y:o*Math.sin(n)*Math.sin(a),z:o*Math.cos(a)}},m.z=fr}),l("worker",["./shared"],function(m){class c{constructor(z){this.keyCache={},z&&this.replace(z)}replace(z){this._layerConfigs={},this._layers={},this.update(z,[])}update(z,F){for(const H of z){this._layerConfigs[H.id]=H;const it=this._layers[H.id]=m.az(H);it._featureFilter=m.a6(it.filter),this.keyCache[H.id]&&delete this.keyCache[H.id]}for(const H of F)delete this.keyCache[H],delete this._layerConfigs[H],delete this._layers[H];this.familiesBySource={};const G=m.bh(Object.values(this._layerConfigs),this.keyCache);for(const H of G){const it=H.map(It=>this._layers[It.id]),rt=it[0];if(rt.visibility==="none")continue;const at=rt.source||"";let et=this.familiesBySource[at];et||(et=this.familiesBySource[at]={});const ht=rt.sourceLayer||"_geojsonTileLayer";let Lt=et[ht];Lt||(Lt=et[ht]=[]),Lt.push(it)}}}class S{constructor(z){const F={},G=[];for(const at in z){const et=z[at],ht=F[at]={};for(const Lt in et){const It=et[+Lt];if(!It||It.bitmap.width===0||It.bitmap.height===0)continue;const Et={x:0,y:0,w:It.bitmap.width+2,h:It.bitmap.height+2};G.push(Et),ht[Lt]={rect:Et,metrics:It.metrics}}}const{w:H,h:it}=m.p(G),rt=new m.o({width:H||1,height:it||1});for(const at in z){const et=z[at];for(const ht in et){const Lt=et[+ht];if(!Lt||Lt.bitmap.width===0||Lt.bitmap.height===0)continue;const It=F[at][ht].rect;m.o.copy(Lt.bitmap,rt,{x:0,y:0},{x:It.x+1,y:It.y+1},Lt.bitmap)}}this.image=rt,this.positions=F}}m.bi("GlyphAtlas",S);class L{constructor(z){this.tileID=new m.Q(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId,this.inFlightDependencies=[]}parse(z,F,G,H){return m._(this,void 0,void 0,function*(){this.status="parsing",this.data=z,this.collisionBoxArray=new m.a4;const it=new m.bj(Object.keys(z.layers).sort()),rt=new m.bk(this.tileID,this.promoteId);rt.bucketLayerIDs=[];const at={},et={featureIndex:rt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G},ht=F.familiesBySource[this.source];for(const Pe in ht){const Xn=z.layers[Pe];if(!Xn)continue;Xn.version===1&&m.w(`Vector tile source "${this.source}" layer "${Pe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Si=it.encode(Pe),dr=[];for(let Tr=0;Tr=Oi.maxzoom||Oi.visibility!=="none"&&(R(Tr,this.zoom,G),(at[Oi.id]=Oi.createBucket({index:rt.bucketLayerIDs.length,layers:Tr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Si,sourceID:this.source})).populate(dr,et,this.tileID.canonical),rt.bucketLayerIDs.push(Tr.map(Yo=>Yo.id)))}}const Lt=m.aE(et.glyphDependencies,Pe=>Object.keys(Pe).map(Number));this.inFlightDependencies.forEach(Pe=>Pe==null?void 0:Pe.abort()),this.inFlightDependencies=[];let It=Promise.resolve({});if(Object.keys(Lt).length){const Pe=new AbortController;this.inFlightDependencies.push(Pe),It=H.sendAsync({type:"GG",data:{stacks:Lt,source:this.source,tileID:this.tileID,type:"glyphs"}},Pe)}const Et=Object.keys(et.iconDependencies);let ie=Promise.resolve({});if(Et.length){const Pe=new AbortController;this.inFlightDependencies.push(Pe),ie=H.sendAsync({type:"GI",data:{icons:Et,source:this.source,tileID:this.tileID,type:"icons"}},Pe)}const le=Object.keys(et.patternDependencies);let Ee=Promise.resolve({});if(le.length){const Pe=new AbortController;this.inFlightDependencies.push(Pe),Ee=H.sendAsync({type:"GI",data:{icons:le,source:this.source,tileID:this.tileID,type:"patterns"}},Pe)}const[ve,je,_n]=yield Promise.all([It,ie,Ee]),kn=new S(ve),yi=new m.bl(je,_n);for(const Pe in at){const Xn=at[Pe];Xn instanceof m.a5?(R(Xn.layers,this.zoom,G),m.bm({bucket:Xn,glyphMap:ve,glyphPositions:kn.positions,imageMap:je,imagePositions:yi.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Xn.hasPattern&&(Xn instanceof m.bn||Xn instanceof m.bo||Xn instanceof m.bp)&&(R(Xn.layers,this.zoom,G),Xn.addFeatures(et,this.tileID.canonical,yi.patternPositions))}return this.status="done",{buckets:Object.values(at).filter(Pe=>!Pe.isEmpty()),featureIndex:rt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:kn.image,imageAtlas:yi,glyphMap:this.returnDependencies?ve:null,iconMap:this.returnDependencies?je:null,glyphPositions:this.returnDependencies?kn.positions:null}})}}function R(K,z,F){const G=new m.a8(z);for(const H of K)H.recalculate(G,F)}class k{constructor(z,F,G){this.actor=z,this.layerIndex=F,this.availableImages=G,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(z,F){return m._(this,void 0,void 0,function*(){const G=yield m.l(z.request,F);try{return{vectorTile:new m.bq.VectorTile(new m.br(G.data)),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(H){const it=new Uint8Array(G.data);let rt=`Unable to parse the tile at ${z.request.url}, `;throw rt+=it[0]===31&&it[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${H.messge}`,new Error(rt)}})}loadTile(z){return m._(this,void 0,void 0,function*(){const F=z.uid,G=!!(z&&z.request&&z.request.collectResourceTiming)&&new m.bs(z.request),H=new L(z);this.loading[F]=H;const it=new AbortController;H.abort=it;try{const rt=yield this.loadVectorTile(z,it);if(delete this.loading[F],!rt)return null;const at=rt.rawData,et={};rt.expires&&(et.expires=rt.expires),rt.cacheControl&&(et.cacheControl=rt.cacheControl);const ht={};if(G){const It=G.finish();It&&(ht.resourceTiming=JSON.parse(JSON.stringify(It)))}H.vectorTile=rt.vectorTile;const Lt=H.parse(rt.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[F]=H,this.fetching[F]={rawTileData:at,cacheControl:et,resourceTiming:ht};try{const It=yield Lt;return m.e({rawTileData:at.slice(0)},It,et,ht)}finally{delete this.fetching[F]}}catch(rt){throw delete this.loading[F],H.status="done",this.loaded[F]=H,rt}})}reloadTile(z){return m._(this,void 0,void 0,function*(){const F=z.uid;if(!this.loaded||!this.loaded[F])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[F];if(G.showCollisionBoxes=z.showCollisionBoxes,G.status==="parsing"){const H=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor);let it;if(this.fetching[F]){const{rawTileData:rt,cacheControl:at,resourceTiming:et}=this.fetching[F];delete this.fetching[F],it=m.e({rawTileData:rt.slice(0)},H,at,et)}else it=H;return it}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(z){return m._(this,void 0,void 0,function*(){const F=this.loading,G=z.uid;F&&F[G]&&F[G].abort&&(F[G].abort.abort(),delete F[G])})}removeTile(z){return m._(this,void 0,void 0,function*(){this.loaded&&this.loaded[z.uid]&&delete this.loaded[z.uid]})}}class U{constructor(){this.loaded={}}loadTile(z){return m._(this,void 0,void 0,function*(){const{uid:F,encoding:G,rawImageData:H,redFactor:it,greenFactor:rt,blueFactor:at,baseShift:et}=z,ht=H.width+2,Lt=H.height+2,It=m.b(H)?new m.R({width:ht,height:Lt},yield m.bt(H,-1,-1,ht,Lt)):H,Et=new m.bu(F,It,G,it,rt,at,et);return this.loaded=this.loaded||{},this.loaded[F]=Et,Et})}removeTile(z){const F=this.loaded,G=z.uid;F&&F[G]&&delete F[G]}}function ut(K,z){if(K.length!==0){pt(K[0],z);for(var F=1;F=Math.abs(at)?F-et+at:at-et+F,F=et}F+G>=0!=!!z&&K.reverse()}var vt=m.bv(function K(z,F){var G,H=z&&z.type;if(H==="FeatureCollection")for(G=0;G>31}function Xe(K,z){for(var F=K.loadGeometry(),G=K.type,H=0,it=0,rt=F.length,at=0;atK},Dn=Math.fround||(ji=new Float32Array(1),K=>(ji[0]=+K,ji[0]));var ji;const mn=3,Re=5,ln=6;class In{constructor(z){this.options=Object.assign(Object.create(an),z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(z){const{log:F,minZoom:G,maxZoom:H}=this.options;F&&console.time("total time");const it=`prepare ${z.length} points`;F&&console.time(it),this.points=z;const rt=[];for(let et=0;et=G;et--){const ht=+Date.now();at=this.trees[et]=this._createTree(this._cluster(at,et)),F&&console.log("z%d: %d clusters in %dms",et,at.numItems,+Date.now()-ht)}return F&&console.timeEnd("total time"),this}getClusters(z,F){let G=((z[0]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,z[1]));let it=z[2]===180?180:((z[2]+180)%360+360)%360-180;const rt=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)G=-180,it=180;else if(G>it){const It=this.getClusters([G,H,180,rt],F),Et=this.getClusters([-180,H,it,rt],F);return It.concat(Et)}const at=this.trees[this._limitZoom(F)],et=at.range(gn(G),Rn(rt),gn(it),Rn(H)),ht=at.data,Lt=[];for(const It of et){const Et=this.stride*It;Lt.push(ht[Et+Re]>1?hn(ht,Et,this.clusterProps):this.points[ht[Et+mn]])}return Lt}getChildren(z){const F=this._getOriginId(z),G=this._getOriginZoom(z),H="No cluster with the specified id.",it=this.trees[G];if(!it)throw new Error(H);const rt=it.data;if(F*this.stride>=rt.length)throw new Error(H);const at=this.options.radius/(this.options.extent*Math.pow(2,G-1)),et=it.within(rt[F*this.stride],rt[F*this.stride+1],at),ht=[];for(const Lt of et){const It=Lt*this.stride;rt[It+4]===z&&ht.push(rt[It+Re]>1?hn(rt,It,this.clusterProps):this.points[rt[It+mn]])}if(ht.length===0)throw new Error(H);return ht}getLeaves(z,F,G){const H=[];return this._appendLeaves(H,z,F=F||10,G=G||0,0),H}getTile(z,F,G){const H=this.trees[this._limitZoom(z)],it=Math.pow(2,z),{extent:rt,radius:at}=this.options,et=at/rt,ht=(G-et)/it,Lt=(G+1+et)/it,It={features:[]};return this._addTileFeatures(H.range((F-et)/it,ht,(F+1+et)/it,Lt),H.data,F,G,it,It),F===0&&this._addTileFeatures(H.range(1-et/it,ht,1,Lt),H.data,it,G,it,It),F===it-1&&this._addTileFeatures(H.range(0,ht,et/it,Lt),H.data,-1,G,it,It),It.features.length?It:null}getClusterExpansionZoom(z){let F=this._getOriginZoom(z)-1;for(;F<=this.options.maxZoom;){const G=this.getChildren(z);if(F++,G.length!==1)break;z=G[0].properties.cluster_id}return F}_appendLeaves(z,F,G,H,it){const rt=this.getChildren(F);for(const at of rt){const et=at.properties;if(et&&et.cluster?it+et.point_count<=H?it+=et.point_count:it=this._appendLeaves(z,et.cluster_id,G,H,it):it1;let Lt,It,Et;if(ht)Lt=Ue(F,et,this.clusterProps),It=F[et],Et=F[et+1];else{const Ee=this.points[F[et+mn]];Lt=Ee.properties;const[ve,je]=Ee.geometry.coordinates;It=gn(ve),Et=Rn(je)}const ie={type:1,geometry:[[Math.round(this.options.extent*(It*it-G)),Math.round(this.options.extent*(Et*it-H))]],tags:Lt};let le;le=ht||this.options.generateId?F[et+mn]:this.points[F[et+mn]].id,le!==void 0&&(ie.id=le),rt.features.push(ie)}}_limitZoom(z){return Math.max(this.options.minZoom,Math.min(Math.floor(+z),this.options.maxZoom+1))}_cluster(z,F){const{radius:G,extent:H,reduce:it,minPoints:rt}=this.options,at=G/(H*Math.pow(2,F)),et=z.data,ht=[],Lt=this.stride;for(let It=0;ItF&&(ve+=et[_n+Re])}if(ve>Ee&&ve>=rt){let je,_n=Et*Ee,kn=ie*Ee,yi=-1;const Pe=((It/Lt|0)<<5)+(F+1)+this.points.length;for(const Xn of le){const Si=Xn*Lt;if(et[Si+2]<=F)continue;et[Si+2]=F;const dr=et[Si+Re];_n+=et[Si]*dr,kn+=et[Si+1]*dr,et[Si+4]=Pe,it&&(je||(je=this._map(et,It,!0),yi=this.clusterProps.length,this.clusterProps.push(je)),it(je,this._map(et,Si)))}et[It+4]=Pe,ht.push(_n/ve,kn/ve,1/0,Pe,-1,ve),it&&ht.push(yi)}else{for(let je=0;je1)for(const je of le){const _n=je*Lt;if(!(et[_n+2]<=F)){et[_n+2]=F;for(let kn=0;kn>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,F,G){if(z[F+Re]>1){const rt=this.clusterProps[z[F+ln]];return G?Object.assign({},rt):rt}const H=this.points[z[F+mn]].properties,it=this.options.map(H);return G&&it===H?Object.assign({},it):it}}function hn(K,z,F){return{type:"Feature",id:K[z+mn],properties:Ue(K,z,F),geometry:{type:"Point",coordinates:[(G=K[z],360*(G-.5)),gi(K[z+1])]}};var G}function Ue(K,z,F){const G=K[z+Re],H=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,it=K[z+ln],rt=it===-1?{}:Object.assign({},F[it]);return Object.assign(rt,{cluster:!0,cluster_id:K[z+mn],point_count:G,point_count_abbreviated:H})}function gn(K){return K/360+.5}function Rn(K){const z=Math.sin(K*Math.PI/180),F=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return F<0?0:F>1?1:F}function gi(K){const z=(180-360*K)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function li(K,z,F,G){for(var H,it=G,rt=F-z>>1,at=F-z,et=K[z],ht=K[z+1],Lt=K[F],It=K[F+1],Et=z+3;Etit)H=Et,it=ie;else if(ie===it){var le=Math.abs(Et-rt);leG&&(H-z>3&&li(K,z,H,G),K[H+2]=it,F-H>3&&li(K,H,F,G))}function Wn(K,z,F,G,H,it){var rt=H-F,at=it-G;if(rt!==0||at!==0){var et=((K-F)*rt+(z-G)*at)/(rt*rt+at*at);et>1?(F=H,G=it):et>0&&(F+=rt*et,G+=at*et)}return(rt=K-F)*rt+(at=z-G)*at}function ii(K,z,F,G){var H={id:K===void 0?null:K,type:z,geometry:F,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(it){var rt=it.geometry,at=it.type;if(at==="Point"||at==="MultiPoint"||at==="LineString")jt(it,rt);else if(at==="Polygon"||at==="MultiLineString")for(var et=0;et0&&(rt+=G?(H*ht-et*it)/2:Math.sqrt(Math.pow(et-H,2)+Math.pow(ht-it,2))),H=et,it=ht}var Lt=z.length-3;z[2]=1,li(z,0,Lt,F),z[Lt+2]=1,z.size=Math.abs(rt),z.start=0,z.end=z.size}function _t(K,z,F,G){for(var H=0;H1?1:F}function Jt(K,z,F,G,H,it,rt,at){if(G/=z,it>=(F/=z)&&rt=G)return null;for(var et=[],ht=0;ht=F&&le=G)){var Ee=[];if(Et==="Point"||Et==="MultiPoint")Fe(It,Ee,F,G,H);else if(Et==="LineString")Io(It,Ee,F,G,H,!1,at.lineMetrics);else if(Et==="MultiLineString")Ha(It,Ee,F,G,H,!1);else if(Et==="Polygon")Ha(It,Ee,F,G,H,!0);else if(Et==="MultiPolygon")for(var ve=0;ve=F&&rt<=G&&(z.push(K[it]),z.push(K[it+1]),z.push(K[it+2]))}}function Io(K,z,F,G,H,it,rt){for(var at,et,ht=Za(K),Lt=H===0?Gs:Du,It=K.start,Et=0;EtF&&(et=Lt(ht,ie,le,ve,je,F),rt&&(ht.start=It+at*et)):_n>G?kn=F&&(et=Lt(ht,ie,le,ve,je,F),yi=!0),kn>G&&_n<=G&&(et=Lt(ht,ie,le,ve,je,G),yi=!0),!it&&yi&&(rt&&(ht.end=It+at*et),z.push(ht),ht=Za(K)),rt&&(It+=at)}var Pe=K.length-3;ie=K[Pe],le=K[Pe+1],Ee=K[Pe+2],(_n=H===0?ie:le)>=F&&_n<=G&&Wa(ht,ie,le,Ee),Pe=ht.length-3,it&&Pe>=3&&(ht[Pe]!==ht[0]||ht[Pe+1]!==ht[1])&&Wa(ht,ht[0],ht[1],ht[2]),ht.length&&z.push(ht)}function Za(K){var z=[];return z.size=K.size,z.start=K.start,z.end=K.end,z}function Ha(K,z,F,G,H,it){for(var rt=0;rtrt.maxX&&(rt.maxX=Lt),It>rt.maxY&&(rt.maxY=It)}return rt}function tr(K,z,F,G){var H=z.geometry,it=z.type,rt=[];if(it==="Point"||it==="MultiPoint")for(var at=0;at0&&z.size<(H?rt:G))F.numPoints+=z.length/3;else{for(var at=[],et=0;etrt)&&(F.numSimplified++,at.push(z[et]),at.push(z[et+1])),F.numPoints++;H&&function(ht,Lt){for(var It=0,Et=0,ie=ht.length,le=ie-2;Et0===Lt)for(Et=0,ie=ht.length;Et24)throw new Error("maxZoom should be in the 0-24 range");if(z.promoteId&&z.generateId)throw new Error("promoteId and generateId cannot be used together.");var G=function(H,it){var rt=[];if(H.type==="FeatureCollection")for(var at=0;at1&&console.time("creation"),Et=this.tiles[It]=Dl(K,z,F,G,et),this.tileCoords.push({z,x:F,y:G}),ht)){ht>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",z,F,G,Et.numFeatures,Et.numPoints,Et.numSimplified),console.timeEnd("creation"));var ie="z"+z;this.stats[ie]=(this.stats[ie]||0)+1,this.total++}if(Et.source=K,H){if(z===et.maxZoom||z===H)continue;var le=1<1&&console.time("clipping");var Ee,ve,je,_n,kn,yi,Pe=.5*et.buffer/et.extent,Xn=.5-Pe,Si=.5+Pe,dr=1+Pe;Ee=ve=je=_n=null,kn=Jt(K,Lt,F-Pe,F+Si,0,Et.minX,Et.maxX,et),yi=Jt(K,Lt,F+Xn,F+dr,0,Et.minX,Et.maxX,et),K=null,kn&&(Ee=Jt(kn,Lt,G-Pe,G+Si,1,Et.minY,Et.maxY,et),ve=Jt(kn,Lt,G+Xn,G+dr,1,Et.minY,Et.maxY,et),kn=null),yi&&(je=Jt(yi,Lt,G-Pe,G+Si,1,Et.minY,Et.maxY,et),_n=Jt(yi,Lt,G+Xn,G+dr,1,Et.minY,Et.maxY,et),yi=null),ht>1&&console.timeEnd("clipping"),at.push(Ee||[],z+1,2*F,2*G),at.push(ve||[],z+1,2*F,2*G+1),at.push(je||[],z+1,2*F+1,2*G),at.push(_n||[],z+1,2*F+1,2*G+1)}}},De.prototype.getTile=function(K,z,F){var G=this.options,H=G.extent,it=G.debug;if(K<0||K>24)return null;var rt=1<1&&console.log("drilling down to z%d-%d-%d",K,z,F);for(var et,ht=K,Lt=z,It=F;!et&&ht>0;)ht--,Lt=Math.floor(Lt/2),It=Math.floor(It/2),et=this.tiles[Le(ht,Lt,It)];return et&&et.source?(it>1&&console.log("found parent tile z%d-%d-%d",ht,Lt,It),it>1&&console.time("drilling down"),this.splitTile(et.source,ht,Lt,It,K,z,F),it>1&&console.timeEnd("drilling down"),this.tiles[at]?Wo(this.tiles[at],H):null):null};class ma extends k{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(z,F){return m._(this,void 0,void 0,function*(){const G=z.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const H=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!H)return null;const it=new class{constructor(at){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=m.W,this.length=at.length,this._features=at}feature(at){return new class{constructor(et){this._feature=et,this.extent=m.W,this.type=et.type,this.properties=et.tags,"id"in et&&!isNaN(et.id)&&(this.id=parseInt(et.id,10))}loadGeometry(){if(this._feature.type===1){const et=[];for(const ht of this._feature.geometry)et.push([new m.P(ht[0],ht[1])]);return et}{const et=[];for(const ht of this._feature.geometry){const Lt=[];for(const It of ht)Lt.push(new m.P(It[0],It[1]));et.push(Lt)}return et}}toGeoJSON(et,ht,Lt){return bt.call(this,et,ht,Lt)}}(this._features[at])}}(H.features);let rt=fe(it);return rt.byteOffset===0&&rt.byteLength===rt.buffer.byteLength||(rt=new Uint8Array(rt)),{vectorTile:it,rawData:rt.buffer}})}loadData(z){return m._(this,void 0,void 0,function*(){var F;(F=this._pendingRequest)===null||F===void 0||F.abort();const G=!!(z&&z.request&&z.request.collectResourceTiming)&&new m.bs(z.request);this._pendingRequest=new AbortController;try{let H=yield this.loadGeoJSON(z,this._pendingRequest);if(delete this._pendingRequest,typeof H!="object")throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(vt(H,!0),z.filter){const rt=m.by(z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(rt.result==="error")throw new Error(rt.value.map(et=>`${et.key}: ${et.message}`).join(", "));H={type:"FeatureCollection",features:H.features.filter(et=>rt.value.evaluate({zoom:0},et))}}this._geoJSONIndex=z.cluster?new In(function({superclusterOptions:rt,clusterProperties:at}){if(!at||!rt)return rt;const et={},ht={},Lt={accumulated:null,zoom:0},It={properties:null},Et=Object.keys(at);for(const ie of Et){const[le,Ee]=at[ie],ve=m.by(Ee),je=m.by(typeof le=="string"?[le,["accumulated"],["get",ie]]:le);et[ie]=ve.value,ht[ie]=je.value}return rt.map=ie=>{It.properties=ie;const le={};for(const Ee of Et)le[Ee]=et[Ee].evaluate(Lt,It);return le},rt.reduce=(ie,le)=>{It.properties=le;for(const Ee of Et)Lt.accumulated=ie[Ee],ie[Ee]=ht[Ee].evaluate(Lt,It)},rt}(z)).load(H.features):function(rt,at){return new De(rt,at)}(H,z.geojsonVtOptions),this.loaded={};const it={};if(G){const rt=G.finish();rt&&(it.resourceTiming={},it.resourceTiming[z.source]=JSON.parse(JSON.stringify(rt)))}return it}catch(H){if(delete this._pendingRequest,m.bz(H))return{abandoned:!0};throw H}})}reloadTile(z){const F=this.loaded;return F&&F[z.uid]?super.reloadTile(z):this.loadTile(z)}loadGeoJSON(z,F){return m._(this,void 0,void 0,function*(){const{promoteId:G}=z;if(z.request){const H=yield m.h(z.request,F);return this._dataUpdateable=Xo(H.data,G)?Ie(H.data,G):void 0,H.data}if(typeof z.data=="string")try{const H=JSON.parse(z.data);return this._dataUpdateable=Xo(H,G)?Ie(H,G):void 0,H}catch{throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`)}if(!z.dataDiff)throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${z.source}`);return function(H,it,rt){var at,et,ht,Lt;if(it.removeAll&&H.clear(),it.remove)for(const It of it.remove)H.delete(It);if(it.add)for(const It of it.add){const Et=_i(It,rt);Et!=null&&H.set(Et,It)}if(it.update)for(const It of it.update){let Et=H.get(It.id);if(Et==null)continue;const ie=!It.removeAllProperties&&(((at=It.removeProperties)===null||at===void 0?void 0:at.length)>0||((et=It.addOrUpdateProperties)===null||et===void 0?void 0:et.length)>0);if((It.newGeometry||It.removeAllProperties||ie)&&(Et=Object.assign({},Et),H.set(It.id,Et),ie&&(Et.properties=Object.assign({},Et.properties))),It.newGeometry&&(Et.geometry=It.newGeometry),It.removeAllProperties)Et.properties={};else if(((ht=It.removeProperties)===null||ht===void 0?void 0:ht.length)>0)for(const le of It.removeProperties)Object.prototype.hasOwnProperty.call(Et.properties,le)&&delete Et.properties[le];if(((Lt=It.addOrUpdateProperties)===null||Lt===void 0?void 0:Lt.length)>0)for(const{key:le,value:Ee}of It.addOrUpdateProperties)Et.properties[le]=Ee}}(this._dataUpdateable,z.dataDiff,G),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(z){return m._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(z){return this._geoJSONIndex.getClusterExpansionZoom(z.clusterId)}getClusterChildren(z){return this._geoJSONIndex.getChildren(z.clusterId)}getClusterLeaves(z){return this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset)}}class Ei{constructor(z){this.self=z,this.actor=new m.C(z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(F,G)=>{if(this.externalWorkerSourceTypes[F])throw new Error(`Worker source with name "${F}" already registered.`);this.externalWorkerSourceTypes[F]=G},this.self.addProtocol=m.bf,this.self.removeProtocol=m.bg,this.self.registerRTLTextPlugin=F=>{if(m.bA.isParsed())throw new Error("RTL text plugin already registered.");m.bA.setMethods(F)},this.actor.registerMessageHandler("LDT",(F,G)=>this._getDEMWorkerSource(F,G.source).loadTile(G)),this.actor.registerMessageHandler("RDT",(F,G)=>m._(this,void 0,void 0,function*(){this._getDEMWorkerSource(F,G.source).removeTile(G)})),this.actor.registerMessageHandler("GCEZ",(F,G)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,G.type,G.source).getClusterExpansionZoom(G)})),this.actor.registerMessageHandler("GCC",(F,G)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,G.type,G.source).getClusterChildren(G)})),this.actor.registerMessageHandler("GCL",(F,G)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,G.type,G.source).getClusterLeaves(G)})),this.actor.registerMessageHandler("LD",(F,G)=>this._getWorkerSource(F,G.type,G.source).loadData(G)),this.actor.registerMessageHandler("LT",(F,G)=>this._getWorkerSource(F,G.type,G.source).loadTile(G)),this.actor.registerMessageHandler("RT",(F,G)=>this._getWorkerSource(F,G.type,G.source).reloadTile(G)),this.actor.registerMessageHandler("AT",(F,G)=>this._getWorkerSource(F,G.type,G.source).abortTile(G)),this.actor.registerMessageHandler("RMT",(F,G)=>this._getWorkerSource(F,G.type,G.source).removeTile(G)),this.actor.registerMessageHandler("RS",(F,G)=>m._(this,void 0,void 0,function*(){if(!this.workerSources[F]||!this.workerSources[F][G.type]||!this.workerSources[F][G.type][G.source])return;const H=this.workerSources[F][G.type][G.source];delete this.workerSources[F][G.type][G.source],H.removeSource!==void 0&&H.removeSource(G)})),this.actor.registerMessageHandler("RM",F=>m._(this,void 0,void 0,function*(){delete this.layerIndexes[F],delete this.availableImages[F],delete this.workerSources[F],delete this.demWorkerSources[F]})),this.actor.registerMessageHandler("SR",(F,G)=>m._(this,void 0,void 0,function*(){this.referrer=G})),this.actor.registerMessageHandler("SRPS",(F,G)=>this._syncRTLPluginState(F,G)),this.actor.registerMessageHandler("IS",(F,G)=>m._(this,void 0,void 0,function*(){this.self.importScripts(G)})),this.actor.registerMessageHandler("SI",(F,G)=>this._setImages(F,G)),this.actor.registerMessageHandler("UL",(F,G)=>m._(this,void 0,void 0,function*(){this._getLayerIndex(F).update(G.layers,G.removedIds)})),this.actor.registerMessageHandler("SL",(F,G)=>m._(this,void 0,void 0,function*(){this._getLayerIndex(F).replace(G)}))}_setImages(z,F){return m._(this,void 0,void 0,function*(){this.availableImages[z]=F;for(const G in this.workerSources[z]){const H=this.workerSources[z][G];for(const it in H)H[it].availableImages=F}})}_syncRTLPluginState(z,F){return m._(this,void 0,void 0,function*(){if(m.bA.isParsed())return m.bA.getState();if(F.pluginStatus!=="loading")return m.bA.setState(F),F;const G=F.pluginURL;if(this.self.importScripts(G),m.bA.isParsed()){const H={pluginStatus:"loaded",pluginURL:G};return m.bA.setState(H),H}throw m.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${G}`)})}_getAvailableImages(z){let F=this.availableImages[z];return F||(F=[]),F}_getLayerIndex(z){let F=this.layerIndexes[z];return F||(F=this.layerIndexes[z]=new c),F}_getWorkerSource(z,F,G){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][F]||(this.workerSources[z][F]={}),!this.workerSources[z][F][G]){const H={sendAsync:(it,rt)=>(it.targetMapId=z,this.actor.sendAsync(it,rt))};switch(F){case"vector":this.workerSources[z][F][G]=new k(H,this._getLayerIndex(z),this._getAvailableImages(z));break;case"geojson":this.workerSources[z][F][G]=new ma(H,this._getLayerIndex(z),this._getAvailableImages(z));break;default:this.workerSources[z][F][G]=new this.externalWorkerSourceTypes[F](H,this._getLayerIndex(z),this._getAvailableImages(z))}}return this.workerSources[z][F][G]}_getDEMWorkerSource(z,F){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][F]||(this.demWorkerSources[z][F]=new U),this.demWorkerSources[z][F]}}return m.i(self)&&(self.worker=new Ei(self)),Ei}),l("index",["exports","./shared"],function(m,c){var S="4.1.3";let L,R;const k={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((i,u)=>{const d=requestAnimationFrame(i);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),u(c.c())})}),getImageData(_,i=0){return this.getImageCanvasContext(_).getImageData(-i,-i,_.width+2*i,_.height+2*i)},getImageCanvasContext(_){const i=window.document.createElement("canvas"),u=i.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("failed to create canvas 2d context");return i.width=_.width,i.height=_.height,u.drawImage(_,0,0,_.width,_.height),u},resolveURL:_=>(L||(L=document.createElement("a")),L.href=_,L.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(R==null&&(R=matchMedia("(prefers-reduced-motion: reduce)")),R.matches)}};class U{static testProp(i){if(!U.docStyle)return i[0];for(let u=0;u{window.removeEventListener("click",U.suppressClickInternal,!0)},0)}static getScale(i){const u=i.getBoundingClientRect();return{x:u.width/i.offsetWidth||1,y:u.height/i.offsetHeight||1,boundingClientRect:u}}static getPoint(i,u,d){const f=u.boundingClientRect;return new c.P((d.clientX-f.left)/u.x-i.clientLeft,(d.clientY-f.top)/u.y-i.clientTop)}static mousePos(i,u){const d=U.getScale(i);return U.getPoint(i,d,u)}static touchPos(i,u){const d=[],f=U.getScale(i);for(let y=0;y{i=[],u=0,d=0,f={}},_.addThrottleControl=C=>{const P=d++;return f[P]=C,P},_.removeThrottleControl=C=>{delete f[C],w()},_.getImage=(C,P,D=!0)=>new Promise((N,V)=>{ut.supported&&(C.headers||(C.headers={}),C.headers.accept="image/webp,*/*"),c.e(C,{type:"image"}),i.push({abortController:P,requestParameters:C,supportImageRefresh:D,state:"queued",onError:X=>{V(X)},onSuccess:X=>{N(X)}}),w()});const y=C=>c._(this,void 0,void 0,function*(){C.state="running";const{requestParameters:P,supportImageRefresh:D,onError:N,onSuccess:V,abortController:X}=C,W=D===!1&&!c.i(self)&&!c.g(P.url)&&(!P.headers||Object.keys(P.headers).reduce((nt,ft)=>nt&&ft==="accept",!0));u++;const J=W?I(P,X):c.m(P,X);try{const nt=yield J;delete C.abortController,C.state="completed",nt.data instanceof HTMLImageElement||c.b(nt.data)?V(nt):nt.data&&V({data:yield(j=nt.data,typeof createImageBitmap=="function"?c.d(j):c.f(j)),cacheControl:nt.cacheControl,expires:nt.expires})}catch(nt){delete C.abortController,N(nt)}finally{u--,w()}var j}),w=()=>{const C=(()=>{for(const P of Object.keys(f))if(f[P]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let P=u;P0;P++){const D=i.shift();D.abortController.signal.aborted?P--:y(D)}},I=(C,P)=>new Promise((D,N)=>{const V=new Image,X=C.url,W=C.credentials;W&&W==="include"?V.crossOrigin="use-credentials":(W&&W==="same-origin"||!c.s(X))&&(V.crossOrigin="anonymous"),P.signal.addEventListener("abort",()=>{V.src="",N(c.c())}),V.fetchPriority="high",V.onload=()=>{V.onerror=V.onload=null,D({data:V})},V.onerror=()=>{V.onerror=V.onload=null,P.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."))},V.src=X})}(Gt||(Gt={})),Gt.resetRequestQueue();class se{constructor(i){this._transformRequestFn=i}transformRequest(i,u){return this._transformRequestFn&&this._transformRequestFn(i,u)||{url:i}}normalizeSpriteURL(i,u,d){const f=function(y){const w=y.match(de);if(!w)throw new Error(`Unable to parse URL "${y}"`);return{protocol:w[1],authority:w[2],path:w[3]||"/",params:w[4]?w[4].split("&"):[]}}(i);return f.path+=`${u}${d}`,function(y){const w=y.params.length?`?${y.params.join("&")}`:"";return`${y.protocol}://${y.authority}${y.path}${w}`}(f)}setTransformRequest(i){this._transformRequestFn=i}}const de=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Ve(_){var i=new c.A(3);return i[0]=_[0],i[1]=_[1],i[2]=_[2],i}var he,Me=function(_,i,u){return _[0]=i[0]-u[0],_[1]=i[1]-u[1],_[2]=i[2]-u[2],_};he=new c.A(3),c.A!=Float32Array&&(he[0]=0,he[1]=0,he[2]=0);var _e=function(_){var i=_[0],u=_[1];return i*i+u*u};function be(_){const i=[];if(typeof _=="string")i.push({id:"default",url:_});else if(_&&_.length>0){const u=[];for(const{id:d,url:f}of _){const y=`${d}${f}`;u.indexOf(y)===-1&&(u.push(y),i.push({id:d,url:f}))}}return i}(function(){var _=new c.A(2);c.A!=Float32Array&&(_[0]=0,_[1]=0)})();class Nt{constructor(i,u,d,f){this.context=i,this.format=d,this.texture=i.gl.createTexture(),this.update(u,f)}update(i,u,d){const{width:f,height:y}=i,w=!(this.size&&this.size[0]===f&&this.size[1]===y||d),{context:I}=this,{gl:C}=I;if(this.useMipmap=!!(u&&u.useMipmap),C.bindTexture(C.TEXTURE_2D,this.texture),I.pixelStoreUnpackFlipY.set(!1),I.pixelStoreUnpack.set(1),I.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA&&(!u||u.premultiply!==!1)),w)this.size=[f,y],i instanceof HTMLImageElement||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageData||c.b(i)?C.texImage2D(C.TEXTURE_2D,0,this.format,this.format,C.UNSIGNED_BYTE,i):C.texImage2D(C.TEXTURE_2D,0,this.format,f,y,0,this.format,C.UNSIGNED_BYTE,i.data);else{const{x:P,y:D}=d||{x:0,y:0};i instanceof HTMLImageElement||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageData||c.b(i)?C.texSubImage2D(C.TEXTURE_2D,0,P,D,C.RGBA,C.UNSIGNED_BYTE,i):C.texSubImage2D(C.TEXTURE_2D,0,P,D,f,y,C.RGBA,C.UNSIGNED_BYTE,i.data)}this.useMipmap&&this.isSizePowerOfTwo()&&C.generateMipmap(C.TEXTURE_2D)}bind(i,u,d){const{context:f}=this,{gl:y}=f;y.bindTexture(y.TEXTURE_2D,this.texture),d!==y.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=y.LINEAR),i!==this.filter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,i),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,d||i),this.filter=i),u!==this.wrap&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,u),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,u),this.wrap=u)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}}function sn(_){const{userImage:i}=_;return!!(i&&i.render&&i.render())&&(_.data.replace(new Uint8Array(i.data.buffer)),!0)}class ke extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(i){if(this.loaded!==i&&(this.loaded=i,i)){for(const{ids:u,promiseResolve:d}of this.requestors)d(this._getImagesForIds(u));this.requestors=[]}}getImage(i){const u=this.images[i];if(u&&!u.data&&u.spriteData){const d=u.spriteData;u.data=new c.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),u.spriteData=null}return u}addImage(i,u){if(this.images[i])throw new Error(`Image id ${i} already exist, use updateImage instead`);this._validate(i,u)&&(this.images[i]=u)}_validate(i,u){let d=!0;const f=u.data||u.spriteData;return this._validateStretch(u.stretchX,f&&f.width)||(this.fire(new c.j(new Error(`Image "${i}" has invalid "stretchX" value`))),d=!1),this._validateStretch(u.stretchY,f&&f.height)||(this.fire(new c.j(new Error(`Image "${i}" has invalid "stretchY" value`))),d=!1),this._validateContent(u.content,u)||(this.fire(new c.j(new Error(`Image "${i}" has invalid "content" value`))),d=!1),d}_validateStretch(i,u){if(!i)return!0;let d=0;for(const f of i){if(f[0]{let f=!0;if(!this.isLoaded())for(const y of i)this.images[y]||(f=!1);this.isLoaded()||f?u(this._getImagesForIds(i)):this.requestors.push({ids:i,promiseResolve:u})})}_getImagesForIds(i){const u={};for(const d of i){let f=this.getImage(d);f||(this.fire(new c.k("styleimagemissing",{id:d})),f=this.getImage(d)),f?u[d]={data:f.data.clone(),pixelRatio:f.pixelRatio,sdf:f.sdf,version:f.version,stretchX:f.stretchX,stretchY:f.stretchY,content:f.content,hasRenderCallback:!!(f.userImage&&f.userImage.render)}:c.w(`Image "${d}" 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 u}getPixelSize(){const{width:i,height:u}=this.atlasImage;return{width:i,height:u}}getPattern(i){const u=this.patterns[i],d=this.getImage(i);if(!d)return null;if(u&&u.position.version===d.version)return u.position;if(u)u.position.version=d.version;else{const f={w:d.data.width+2,h:d.data.height+2,x:0,y:0},y=new c.I(f,d);this.patterns[i]={bin:f,position:y}}return this._updatePatternAtlas(),this.patterns[i].position}bind(i){const u=i.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Nt(i,this.atlasImage,u.RGBA),this.atlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(){const i=[];for(const y in this.patterns)i.push(this.patterns[y].bin);const{w:u,h:d}=c.p(i),f=this.atlasImage;f.resize({width:u||1,height:d||1});for(const y in this.patterns){const{bin:w}=this.patterns[y],I=w.x+1,C=w.y+1,P=this.getImage(y).data,D=P.width,N=P.height;c.R.copy(P,f,{x:0,y:0},{x:I,y:C},{width:D,height:N}),c.R.copy(P,f,{x:0,y:N-1},{x:I,y:C-1},{width:D,height:1}),c.R.copy(P,f,{x:0,y:0},{x:I,y:C+N},{width:D,height:1}),c.R.copy(P,f,{x:D-1,y:0},{x:I-1,y:C},{width:1,height:N}),c.R.copy(P,f,{x:0,y:0},{x:I+D,y:C},{width:1,height:N})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(i){for(const u of i){if(this.callbackDispatchedThisFrame[u])continue;this.callbackDispatchedThisFrame[u]=!0;const d=this.getImage(u);d||c.w(`Image with ID: "${u}" was not found`),sn(d)&&this.updateImage(u,d)}}}const ye=1e20;function Xe(_,i,u,d,f,y,w,I,C){for(let P=i;P-1);C++,y[C]=I,w[C]=P,w[C+1]=ye}for(let I=0,C=0;I65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[y])return{stack:i,id:u,glyph:f};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[y]){const I=fe.loadGlyphRange(i,y,this.url,this.requestManager);d.requests[y]=I}const w=yield d.requests[y];for(const I in w)this._doesCharSupportLocalGlyph(+I)||(d.glyphs[+I]=w[+I]);return d.ranges[y]=!0,{stack:i,id:u,glyph:w[u]||null}})}_doesCharSupportLocalGlyph(i){return!!this.localIdeographFontFamily&&(c.u["CJK Unified Ideographs"](i)||c.u["Hangul Syllables"](i)||c.u.Hiragana(i)||c.u.Katakana(i))}_tinySDF(i,u,d){const f=this.localIdeographFontFamily;if(!f||!this._doesCharSupportLocalGlyph(d))return;let y=i.tinySDF;if(!y){let I="400";/bold/i.test(u)?I="900":/medium/i.test(u)?I="500":/light/i.test(u)&&(I="200"),y=i.tinySDF=new fe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:f,fontWeight:I})}const w=y.draw(String.fromCharCode(d));return{id:d,bitmap:new c.o({width:w.width||60,height:w.height||60},w.data),metrics:{width:w.glyphWidth/2||24,height:w.glyphHeight/2||24,left:w.glyphLeft/2+.5||0,top:w.glyphTop/2-27.5||-8,advance:w.glyphAdvance/2||24,isDoubleResolution:!0}}}}fe.loadGlyphRange=function(_,i,u,d){return c._(this,void 0,void 0,function*(){const f=256*i,y=f+255,w=d.transformRequest(u.replace("{fontstack}",_).replace("{range}",`${f}-${y}`),"Glyphs"),I=yield c.l(w,new AbortController);if(!I||!I.data)throw new Error(`Could not load glyph range. range: ${i}, ${f}-${y}`);const C={};for(const P of c.n(I.data))C[P.id]=P;return C})},fe.TinySDF=class{constructor({fontSize:_=24,buffer:i=3,radius:u=8,cutoff:d=.25,fontFamily:f="sans-serif",fontWeight:y="normal",fontStyle:w="normal"}={}){this.buffer=i,this.cutoff=d,this.radius=u;const I=this.size=_+4*i,C=this._createCanvas(I),P=this.ctx=C.getContext("2d",{willReadFrequently:!0});P.font=`${w} ${y} ${_}px ${f}`,P.textBaseline="alphabetic",P.textAlign="left",P.fillStyle="black",this.gridOuter=new Float64Array(I*I),this.gridInner=new Float64Array(I*I),this.f=new Float64Array(I),this.z=new Float64Array(I+1),this.v=new Uint16Array(I)}_createCanvas(_){const i=document.createElement("canvas");return i.width=i.height=_,i}draw(_){const{width:i,actualBoundingBoxAscent:u,actualBoundingBoxDescent:d,actualBoundingBoxLeft:f,actualBoundingBoxRight:y}=this.ctx.measureText(_),w=Math.ceil(u),I=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(y-f))),C=Math.min(this.size-this.buffer,w+Math.ceil(d)),P=I+2*this.buffer,D=C+2*this.buffer,N=Math.max(P*D,0),V=new Uint8ClampedArray(N),X={data:V,width:P,height:D,glyphWidth:I,glyphHeight:C,glyphTop:w,glyphLeft:0,glyphAdvance:i};if(I===0||C===0)return X;const{ctx:W,buffer:J,gridInner:j,gridOuter:nt}=this;W.clearRect(J,J,I,C),W.fillText(_,J,J+w);const ft=W.getImageData(J,J,I,C);nt.fill(ye,0,N),j.fill(0,0,N);for(let Q=0;Q0?xt*xt:0,j[gt]=xt<0?xt*xt:0}}Xe(nt,0,0,P,D,P,this.f,this.v,this.z),Xe(j,J,J,I,C,P,this.f,this.v,this.z);for(let Q=0;Q1&&(C=i[++I]);const D=Math.abs(P-C.left),N=Math.abs(P-C.right),V=Math.min(D,N);let X;const W=y/d*(f+1);if(C.isDash){const J=f-Math.abs(W);X=Math.sqrt(V*V+J*J)}else X=f-Math.sqrt(V*V+W*W);this.data[w+P]=Math.max(0,Math.min(255,X+128))}}}addRegularDash(i){for(let I=i.length-1;I>=0;--I){const C=i[I],P=i[I+1];C.zeroLength?i.splice(I,1):P&&P.isDash===C.isDash&&(P.left=C.left,i.splice(I,1))}const u=i[0],d=i[i.length-1];u.isDash===d.isDash&&(u.left=d.left-this.width,d.right=u.right+this.width);const f=this.width*this.nextRow;let y=0,w=i[y];for(let I=0;I1&&(w=i[++y]);const C=Math.abs(I-w.left),P=Math.abs(I-w.right),D=Math.min(C,P);this.data[f+I]=Math.max(0,Math.min(255,(w.isDash?D:-D)+128))}}addDash(i,u){const d=u?7:0,f=2*d+1;if(this.nextRow+f>this.height)return c.w("LineAtlas out of space"),null;let y=0;for(let I=0;I{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Re]}numActive(){return Object.keys(this.active).length}}const In=Math.floor(k.hardwareConcurrency/2);let hn,Ue;function gn(){return hn||(hn=new ln),hn}ln.workerCount=c.B(globalThis)?Math.max(Math.min(In,3),1):1;class Rn{constructor(i,u){this.workerPool=i,this.actors=[],this.currentActor=0,this.id=u;const d=this.workerPool.acquire(u);for(let f=0;f{u.remove()}),this.actors=[],i&&this.workerPool.release(this.id)}registerMessageHandler(i,u){for(const d of this.actors)d.registerMessageHandler(i,u)}}function gi(){return Ue||(Ue=new Rn(gn(),c.G),Ue.registerMessageHandler("GR",(_,i,u)=>c.m(i,u))),Ue}function li(_,i){const u=c.F();return c.H(u,u,[1,1,0]),c.J(u,u,[.5*_.width,.5*_.height,1]),c.K(u,u,_.calculatePosMatrix(i.toUnwrapped()))}function Wn(_,i,u,d,f,y){const w=function(N,V,X){if(N)for(const W of N){const J=V[W];if(J&&J.source===X&&J.type==="fill-extrusion")return!0}else for(const W in V){const J=V[W];if(J.source===X&&J.type==="fill-extrusion")return!0}return!1}(f&&f.layers,i,_.id),I=y.maxPitchScaleFactor(),C=_.tilesIn(d,I,w);C.sort(ii);const P=[];for(const N of C)P.push({wrappedTileID:N.tileID.wrapped().key,queryResults:N.tile.queryRenderedFeatures(i,u,_._state,N.queryGeometry,N.cameraQueryGeometry,N.scale,f,y,I,li(_.transform,N.tileID))});const D=function(N){const V={},X={};for(const W of N){const J=W.queryResults,j=W.wrappedTileID,nt=X[j]=X[j]||{};for(const ft in J){const Q=J[ft],st=nt[ft]=nt[ft]||{},mt=V[ft]=V[ft]||[];for(const gt of Q)st[gt.featureIndex]||(st[gt.featureIndex]=!0,mt.push(gt))}}return V}(P);for(const N in D)D[N].forEach(V=>{const X=V.feature,W=_.getFeatureState(X.layer["source-layer"],X.id);X.source=X.layer.source,X.layer["source-layer"]&&(X.sourceLayer=X.layer["source-layer"]),X.state=W});return D}function ii(_,i){const u=_.tileID,d=i.tileID;return u.overscaledZ-d.overscaledZ||u.canonical.y-d.canonical.y||u.wrap-d.wrap||u.canonical.x-d.canonical.x}function jt(_,i,u){return c._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield c.h(i.transformRequest(_.url,"Source"),u)).data:yield k.frameAsync(u),!d)return null;const f=c.L(c.e(d,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(f.vectorLayerIds=d.vector_layers.map(y=>y.id)),f})}class St{constructor(i,u){i&&(u?this.setSouthWest(i).setNorthEast(u):Array.isArray(i)&&(i.length===4?this.setSouthWest([i[0],i[1]]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1])))}setNorthEast(i){return this._ne=i instanceof c.M?new c.M(i.lng,i.lat):c.M.convert(i),this}setSouthWest(i){return this._sw=i instanceof c.M?new c.M(i.lng,i.lat):c.M.convert(i),this}extend(i){const u=this._sw,d=this._ne;let f,y;if(i instanceof c.M)f=i,y=i;else{if(!(i instanceof St))return Array.isArray(i)?i.length===4||i.every(Array.isArray)?this.extend(St.convert(i)):this.extend(c.M.convert(i)):i&&("lng"in i||"lon"in i)&&"lat"in i?this.extend(c.M.convert(i)):this;if(f=i._sw,y=i._ne,!f||!y)return this}return u||d?(u.lng=Math.min(f.lng,u.lng),u.lat=Math.min(f.lat,u.lat),d.lng=Math.max(y.lng,d.lng),d.lat=Math.max(y.lat,d.lat)):(this._sw=new c.M(f.lng,f.lat),this._ne=new c.M(y.lng,y.lat)),this}getCenter(){return new c.M((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 c.M(this.getWest(),this.getNorth())}getSouthEast(){return new c.M(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(i){const{lng:u,lat:d}=c.M.convert(i);let f=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(f=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&f}static convert(i){return i instanceof St?i:i&&new St(i)}static fromLngLat(i,u=0){const d=360*u/40075017,f=d/Math.cos(Math.PI/180*i.lat);return new St(new c.M(i.lng-f,i.lat-d),new c.M(i.lng+f,i.lat+d))}}class ui{constructor(i,u,d){this.bounds=St.convert(this.validateBounds(i)),this.minzoom=u||0,this.maxzoom=d||24}validateBounds(i){return Array.isArray(i)&&i.length===4?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}contains(i){const u=Math.pow(2,i.z),d=Math.floor(c.N(this.bounds.getWest())*u),f=Math.floor(c.O(this.bounds.getNorth())*u),y=Math.ceil(c.N(this.bounds.getEast())*u),w=Math.ceil(c.O(this.bounds.getSouth())*u);return i.x>=d&&i.x=f&&i.y{this._options.tiles=i}),this}setUrl(i){return this.setSourceProperty(()=>{this.url=i,this._options.url=i}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(i){return c._(this,void 0,void 0,function*(){const u=i.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(u,"Tile"),uid:i.uid,tileID:i.tileID,zoom:i.tileID.overscaledZ,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};d.request.collectResourceTiming=this._collectResourceTiming;let f="RT";if(i.actor&&i.state!=="expired"){if(i.state==="loading")return new Promise((y,w)=>{i.reloadPromise={resolve:y,reject:w}})}else i.actor=this.dispatcher.getActor(),f="LT";i.abortController=new AbortController;try{const y=yield i.actor.sendAsync({type:f,data:d},i.abortController);if(delete i.abortController,i.aborted)return;this._afterTileLoadWorkerResponse(i,y)}catch(y){if(delete i.abortController,i.aborted)return;if(y&&y.status!==404)throw y;this._afterTileLoadWorkerResponse(i,null)}})}_afterTileLoadWorkerResponse(i,u){if(u&&u.resourceTiming&&(i.resourceTiming=u.resourceTiming),u&&this.map._refreshExpiredTiles&&i.setExpiryData(u),i.loadVectorData(u,this.map.painter),i.reloadPromise){const d=i.reloadPromise;i.reloadPromise=null,this.loadTile(i).then(d.resolve).catch(d.reject)}}abortTile(i){return c._(this,void 0,void 0,function*(){i.abortController&&(i.abortController.abort(),delete i.abortController),i.actor&&(yield i.actor.sendAsync({type:"AT",data:{uid:i.uid,type:this.type,source:this.id}}))})}unloadTile(i){return c._(this,void 0,void 0,function*(){i.unloadVectorData(),i.actor&&(yield i.actor.sendAsync({type:"RMT",data:{uid:i.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class _t extends c.E{constructor(i,u,d,f){super(),this.id=i,this.dispatcher=d,this.setEventedParent(f),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},u),c.e(this,c.L(u,["url","scheme","tileSize"]))}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield jt(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(c.e(this,i),i.bounds&&(this.tileBounds=new ui(i.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(i){this._tileJSONRequest=null,this.fire(new c.j(i))}})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(i){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),i(),this.load()}setTiles(i){return this.setSourceProperty(()=>{this._options.tiles=i}),this}setUrl(i){return this.setSourceProperty(()=>{this.url=i,this._options.url=i}),this}serialize(){return c.e({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(i){return c._(this,void 0,void 0,function*(){const u=i.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);i.abortController=new AbortController;try{const d=yield Gt.getImage(this.map._requestManager.transformRequest(u,"Tile"),i.abortController,this.map._refreshExpiredTiles);if(delete i.abortController,i.aborted)return void(i.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&i.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const f=this.map.painter.context,y=f.gl,w=d.data;i.texture=this.map.painter.getTileTexture(w.width),i.texture?i.texture.update(w,{useMipmap:!0}):(i.texture=new Nt(f,w,y.RGBA,{useMipmap:!0}),i.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),f.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,f.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,f.extTextureFilterAnisotropicMax)),i.state="loaded"}}catch(d){if(delete i.abortController,i.aborted)i.state="unloaded";else if(d)throw i.state="errored",d}})}abortTile(i){return c._(this,void 0,void 0,function*(){i.abortController&&(i.abortController.abort(),delete i.abortController)})}unloadTile(i){return c._(this,void 0,void 0,function*(){i.texture&&this.map.painter.saveTileTexture(i.texture)})}hasTransition(){return!1}}class Zi extends _t{constructor(i,u,d,f){super(i,u,d,f),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},u),this.encoding=u.encoding||"mapbox",this.redFactor=u.redFactor,this.greenFactor=u.greenFactor,this.blueFactor=u.blueFactor,this.baseShift=u.baseShift}loadTile(i){return c._(this,void 0,void 0,function*(){const u=i.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(u,"Tile");i.neighboringTiles=this._getNeighboringTiles(i.tileID),i.abortController=new AbortController;try{const f=yield Gt.getImage(d,i.abortController,this.map._refreshExpiredTiles);if(delete i.abortController,i.aborted)return void(i.state="unloaded");if(f&&f.data){const y=f.data;this.map._refreshExpiredTiles&&f.cacheControl&&f.expires&&i.setExpiryData({cacheControl:f.cacheControl,expires:f.expires});const w=c.b(y)&&c.S()?y:yield this.readImageNow(y),I={type:this.type,uid:i.uid,source:this.id,rawImageData:w,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!i.actor||i.state==="expired"){i.actor=this.dispatcher.getActor();const C=yield i.actor.sendAsync({type:"LDT",data:I});i.dem=C,i.needsHillshadePrepare=!0,i.needsTerrainPrepare=!0,i.state="loaded"}}}catch(f){if(delete i.abortController,i.aborted)i.state="unloaded";else if(f)throw i.state="errored",f}})}readImageNow(i){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.U()){const u=i.width+2,d=i.height+2;try{return new c.R({width:u,height:d},yield c.V(i,-1,-1,u,d))}catch{}}return k.getImageData(i,1)})}_getNeighboringTiles(i){const u=i.canonical,d=Math.pow(2,u.z),f=(u.x-1+d)%d,y=u.x===0?i.wrap-1:i.wrap,w=(u.x+1+d)%d,I=u.x+1===d?i.wrap+1:i.wrap,C={};return C[new c.Q(i.overscaledZ,y,u.z,f,u.y).key]={backfilled:!1},C[new c.Q(i.overscaledZ,I,u.z,w,u.y).key]={backfilled:!1},u.y>0&&(C[new c.Q(i.overscaledZ,y,u.z,f,u.y-1).key]={backfilled:!1},C[new c.Q(i.overscaledZ,i.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},C[new c.Q(i.overscaledZ,I,u.z,w,u.y-1).key]={backfilled:!1}),u.y+10&&c.e(y,{resourceTiming:f}),this.fire(new c.k("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},y),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(i){return c._(this,void 0,void 0,function*(){const u=i.actor?"RT":"LT";i.actor=this.actor;const d={type:this.type,uid:i.uid,tileID:i.tileID,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};i.abortController=new AbortController;const f=yield this.actor.sendAsync({type:u,data:d},i.abortController);delete i.abortController,i.unloadVectorData(),i.aborted||i.loadVectorData(f,this.map.painter,u==="RT")})}abortTile(i){return c._(this,void 0,void 0,function*(){i.abortController&&(i.abortController.abort(),delete i.abortController),i.aborted=!0})}unloadTile(i){return c._(this,void 0,void 0,function*(){i.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:i.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 c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Jt=c.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Fe extends c.E{constructor(i,u,d,f){super(),this.id=i,this.dispatcher=d,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(f),this.options=u}load(i){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const u=yield Gt.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,u&&u.data&&(this.image=u.data,i&&(this.coordinates=i),this._finishLoading())}catch(u){this._request=null,this._loaded=!0,this.fire(new c.j(u))}})}loaded(){return this._loaded}updateImage(i){return i.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=i.url,this.load(i.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(i){this.coordinates=i;const u=i.map(c.Y.fromLngLat);this.tileID=function(f){let y=1/0,w=1/0,I=-1/0,C=-1/0;for(const V of f)y=Math.min(y,V.x),w=Math.min(w,V.y),I=Math.max(I,V.x),C=Math.max(C,V.y);const P=Math.max(I-y,C-w),D=Math.max(0,Math.floor(-Math.log(P)/Math.LN2)),N=Math.pow(2,D);return new c.a0(D,Math.floor((y+I)/2*N),Math.floor((w+C)/2*N))}(u),this.minzoom=this.maxzoom=this.tileID.z;const d=u.map(f=>this.tileID.getTilePoint(f)._round());return this._boundsArray=new c.Z,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,c.W,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,c.W),this._boundsArray.emplaceBack(d[2].x,d[2].y,c.W,c.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const i=this.map.painter.context,u=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,Jt.members)),this.boundsSegments||(this.boundsSegments=c.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Nt(i,this.image,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let d=!1;for(const f in this.tiles){const y=this.tiles[f];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,d=!0)}d&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(i){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={}):i.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Io extends Fe{constructor(i,u,d,f){super(i,u,d,f),this.roundZoom=!0,this.type="video",this.options=u}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const i=this.options;this.urls=[];for(const u of i.urls)this.urls.push(this.map._requestManager.transformRequest(u,"Source").url);try{const u=yield c.a2(this.urls);if(this._loaded=!0,!u)return;this.video=u,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(u){this.fire(new c.j(u))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(i){if(this.video){const u=this.video.seekable;iu.end(0)?this.fire(new c.j(new c.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.end(0)}-second mark.`))):this.video.currentTime=i}}getVideo(){return this.video}onAdd(i){this.map||(this.map=i,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const i=this.map.painter.context,u=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,Jt.members)),this.boundsSegments||(this.boundsSegments=c.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new Nt(i,this.video,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let d=!1;for(const f in this.tiles){const y=this.tiles[f];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,d=!0)}d&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Za extends Fe{constructor(i,u,d,f){super(i,u,d,f),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.coordinates.some(y=>!Array.isArray(y)||y.length!==2||y.some(w=>typeof w!="number"))||this.fire(new c.j(new c.a1(`sources.${i}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.a1(`sources.${i}`,null,'missing required property "coordinates"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new c.j(new c.a1(`sources.${i}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.a1(`sources.${i}`,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 c.j(new c.a1(`sources.${i}`,null,'missing required property "canvas"'))),this.options=u,this.animate=u.animate===void 0||u.animate}load(){return c._(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 c.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let i=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,i=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,i=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const u=this.map.painter.context,d=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,Jt.members)),this.boundsSegments||(this.boundsSegments=c.$.simpleSegment(0,0,4,2)),this.texture?(i||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Nt(u,this.canvas,d.RGBA,{premultiply:!0});let f=!1;for(const y in this.tiles){const w=this.tiles[y];w.state!=="loaded"&&(w.state="loaded",w.texture=this.texture,f=!0)}f&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const i of[this.canvas.width,this.canvas.height])if(isNaN(i)||i<=0)return!0;return!1}}const Ha={},Wa=_=>{switch(_){case"geojson":return Ct;case"image":return Fe;case"raster":return _t;case"raster-dem":return Zi;case"vector":return Nn;case"video":return Io;case"canvas":return Za}return Ha[_]},Gs="RTLPluginLoaded";class Du extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=gi()}_syncState(i){return this.status=i,this.dispatcher.broadcast("SRPS",{pluginStatus:i,pluginURL:this.url}).catch(u=>{throw this.status="error",u})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(i){return c._(this,arguments,void 0,function*(u,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=k.resolveURL(u),!this.url)throw new Error(`requested url ${u} is invalid`);if(this.status==="unavailable"){if(!d)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(Gs))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let fa=null;function Ot(){return fa||(fa=new Du),fa}class Wo{constructor(i,u){this.timeAdded=0,this.fadeEndTime=0,this.tileID=i,this.uid=c.a3(),this.uses=0,this.tileSize=u,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(i){const u=i+this.timeAdded;uy.getLayer(P)).filter(Boolean);if(C.length!==0){I.layers=C,I.stateDependentLayerIds&&(I.stateDependentLayers=I.stateDependentLayerIds.map(P=>C.filter(D=>D.id===P)[0]));for(const P of C)w[P.id]=I}}return w}(i.buckets,u.style),this.hasSymbolBuckets=!1;for(const f in this.buckets){const y=this.buckets[f];if(y instanceof c.a5){if(this.hasSymbolBuckets=!0,!d)break;y.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const f in this.buckets){const y=this.buckets[f];if(y instanceof c.a5&&y.hasRTLText){this.hasRTLText=!0,Ot().lazyLoad();break}}this.queryPadding=0;for(const f in this.buckets){const y=this.buckets[f];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(f).queryRadius(y))}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage)}else this.collisionBoxArray=new c.a4}unloadVectorData(){for(const i in this.buckets)this.buckets[i].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(i){return this.buckets[i.id]}upload(i){for(const d in this.buckets){const f=this.buckets[d];f.uploadPending()&&f.upload(i)}const u=i.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Nt(i,this.imageAtlas.image,u.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Nt(i,this.glyphAtlasImage,u.ALPHA),this.glyphAtlasImage=null)}prepare(i){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture)}queryRenderedFeatures(i,u,d,f,y,w,I,C,P,D){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:f,cameraQueryGeometry:y,scale:w,tileSize:this.tileSize,pixelPosMatrix:D,transform:C,params:I,queryPadding:this.queryPadding*P},i,u,d):{}}querySourceFeatures(i,u){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const f=d.loadVTLayers(),y=u&&u.sourceLayer?u.sourceLayer:"",w=f._geojsonTileLayer||f[y];if(!w)return;const I=c.a6(u&&u.filter),{z:C,x:P,y:D}=this.tileID.canonical,N={z:C,x:P,y:D};for(let V=0;Vd)f=!1;else if(u)if(this.expirationTime{this.remove(i,y)},d)),this.data[f].push(y),this.order.push(f),this.order.length>this.max){const w=this._getAndRemoveByKey(this.order[0]);w&&this.onRemove(w)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){const u=this.data[i].shift();return u.timeout&&clearTimeout(u.timeout),this.data[i].length===0&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),u.value}getByKey(i){const u=this.data[i];return u?u[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,u){if(!this.has(i))return this;const d=i.wrapped().key,f=u===void 0?0:this.data[d].indexOf(u),y=this.data[d][f];return this.data[d].splice(f,1),y.timeout&&clearTimeout(y.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(y.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){const u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}filter(i){const u=[];for(const d in this.data)for(const f of this.data[d])i(f.value)||u.push(f);for(const d of u)this.remove(d.value.tileID,d)}}class Dl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,u,d){const f=String(u);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][f]=this.stateChanges[i][f]||{},c.e(this.stateChanges[i][f],d),this.deletedStates[i]===null){this.deletedStates[i]={};for(const y in this.state[i])y!==f&&(this.deletedStates[i][y]=null)}else if(this.deletedStates[i]&&this.deletedStates[i][f]===null){this.deletedStates[i][f]={};for(const y in this.state[i][f])d[y]||(this.deletedStates[i][f][y]=null)}else for(const y in d)this.deletedStates[i]&&this.deletedStates[i][f]&&this.deletedStates[i][f][y]===null&&delete this.deletedStates[i][f][y]}removeFeatureState(i,u,d){if(this.deletedStates[i]===null)return;const f=String(u);if(this.deletedStates[i]=this.deletedStates[i]||{},d&&u!==void 0)this.deletedStates[i][f]!==null&&(this.deletedStates[i][f]=this.deletedStates[i][f]||{},this.deletedStates[i][f][d]=null);else if(u!==void 0)if(this.stateChanges[i]&&this.stateChanges[i][f])for(d in this.deletedStates[i][f]={},this.stateChanges[i][f])this.deletedStates[i][f][d]=null;else this.deletedStates[i][f]=null;else this.deletedStates[i]=null}getState(i,u){const d=String(u),f=c.e({},(this.state[i]||{})[d],(this.stateChanges[i]||{})[d]);if(this.deletedStates[i]===null)return{};if(this.deletedStates[i]){const y=this.deletedStates[i][u];if(y===null)return{};for(const w in y)delete f[w]}return f}initializeTileState(i,u){i.setFeatureState(this.state,u)}coalesceChanges(i,u){const d={};for(const f in this.stateChanges){this.state[f]=this.state[f]||{};const y={};for(const w in this.stateChanges[f])this.state[f][w]||(this.state[f][w]={}),c.e(this.state[f][w],this.stateChanges[f][w]),y[w]=this.state[f][w];d[f]=y}for(const f in this.deletedStates){this.state[f]=this.state[f]||{};const y={};if(this.deletedStates[f]===null)for(const w in this.state[f])y[w]={},this.state[f][w]={};else for(const w in this.deletedStates[f]){if(this.deletedStates[f][w]===null)this.state[f][w]={};else for(const I of Object.keys(this.deletedStates[f][w]))delete this.state[f][w][I];y[w]=this.state[f][w]}d[f]=d[f]||{},c.e(d[f],y)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const f in i)i[f].setFeatureState(d,u)}}class tr extends c.E{constructor(i,u,d){super(),this.id=i,this.dispatcher=d,this.on("data",f=>this._dataHandler(f)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((f,y,w,I)=>{const C=new(Wa(y.type))(f,y,w,I);if(C.id!==f)throw new Error(`Expected Source id to be ${f} instead of ${C.id}`);return C})(i,u,d,this),this._tiles={},this._cache=new qr(0,f=>this._unloadTile(f)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Dl,this._didEmitContent=!1,this._updated=!1}onAdd(i){this.map=i,this._maxTileCacheSize=i?i._maxTileCacheSize:null,this._maxTileCacheZoomLevels=i?i._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(i)}onRemove(i){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(i)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const i in this._tiles){const u=this._tiles[i];if(u.state!=="loaded"&&u.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(i,u,d){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(i),this._tileLoaded(i,u,d)}catch(f){i.state="errored",f.status!==404?this._source.fire(new c.j(f,{tile:i})):this.update(this.transform,this.terrain)}})}_unloadTile(i){this._source.unloadTile&&this._source.unloadTile(i)}_abortTile(i){this._source.abortTile&&this._source.abortTile(i),this._source.fire(new c.k("dataabort",{tile:i,coord:i.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(i){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const u in this._tiles){const d=this._tiles[u];d.upload(i),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(i=>i.tileID).sort(Zt).map(i=>i.key)}getRenderableIds(i){const u=[];for(const d in this._tiles)this._isIdRenderable(d,i)&&u.push(this._tiles[d]);return i?u.sort((d,f)=>{const y=d.tileID,w=f.tileID,I=new c.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle),C=new c.P(w.canonical.x,w.canonical.y)._rotate(this.transform.angle);return y.overscaledZ-w.overscaledZ||C.y-I.y||C.x-I.x}).map(d=>d.tileID.key):u.map(d=>d.tileID).sort(Zt).map(d=>d.key)}hasRenderableParent(i){const u=this.findLoadedParent(i,0);return!!u&&this._isIdRenderable(u.tileID.key)}_isIdRenderable(i,u){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(u||!this._tiles[i].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)this._tiles[i].state!=="errored"&&this._reloadTile(i,"reloading")}}_reloadTile(i,u){return c._(this,void 0,void 0,function*(){const d=this._tiles[i];d&&(d.state!=="loading"&&(d.state=u),yield this._loadTile(d,i,u))})}_tileLoaded(i,u,d){i.timeAdded=k.now(),d==="expired"&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(u,i),this.getSource().type==="raster-dem"&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),i.aborted||this._source.fire(new c.k("data",{dataType:"source",tile:i,coord:i.tileID}))}_backfillDEM(i){const u=this.getRenderableIds();for(let f=0;f1||(Math.abs(w)>1&&(Math.abs(w+C)===1?w+=C:Math.abs(w-C)===1&&(w-=C)),y.dem&&f.dem&&(f.dem.backfillBorder(y.dem,w,I),f.neighboringTiles&&f.neighboringTiles[P]&&(f.neighboringTiles[P].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,u,d,f){for(const y in this._tiles){let w=this._tiles[y];if(f[y]||!w.hasData()||w.tileID.overscaledZ<=u||w.tileID.overscaledZ>d)continue;let I=w.tileID;for(;w&&w.tileID.overscaledZ>u+1;){const P=w.tileID.scaledTo(w.tileID.overscaledZ-1);w=this._tiles[P.key],w&&w.hasData()&&(I=P)}let C=I;for(;C.overscaledZ>u;)if(C=C.scaledTo(C.overscaledZ-1),i[C.key]){f[I.key]=I;break}}}findLoadedParent(i,u){if(i.key in this._loadedParentTiles){const d=this._loadedParentTiles[i.key];return d&&d.tileID.overscaledZ>=u?d:null}for(let d=i.overscaledZ-1;d>=u;d--){const f=i.scaledTo(d),y=this._getLoadedTile(f);if(y)return y}}_getLoadedTile(i){const u=this._tiles[i.key];return u&&u.hasData()?u:this._cache.getByKey(i.wrapped().key)}updateCacheSize(i){const u=Math.ceil(i.width/this._source.tileSize)+1,d=Math.ceil(i.height/this._source.tileSize)+1,f=Math.floor(u*d*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,f):f;this._cache.setMaxSize(y)}handleWrapJump(i){const u=Math.round((i-(this._prevLng===void 0?i:this._prevLng))/360);if(this._prevLng=i,u){const d={};for(const f in this._tiles){const y=this._tiles[f];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+u),d[y.tileID.key]=y}this._tiles=d;for(const f in this._timers)clearTimeout(this._timers[f]),delete this._timers[f];for(const f in this._tiles)this._setTileReloadTimer(f,this._tiles[f])}}update(i,u){if(!this._sourceLoaded||this._paused)return;let d;this.transform=i,this.terrain=u,this.updateCacheSize(i),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(D=>new c.Q(D.canonical.z,D.wrap,D.canonical.z,D.canonical.x,D.canonical.y)):(d=i.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:u}),this._source.hasTile&&(d=d.filter(D=>this._source.hasTile(D)))):d=[];const f=i.coveringZoomLevel(this._source),y=Math.max(f-tr.maxOverzooming,this._source.minzoom),w=Math.max(f+tr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const D={};for(const N of d)if(N.canonical.z>this._source.minzoom){const V=N.scaledTo(N.canonical.z-1);D[V.key]=V;const X=N.scaledTo(Math.max(this._source.minzoom,Math.min(N.canonical.z,5)));D[X.key]=X}d=d.concat(Object.values(D))}const I=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,I&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const C=this._updateRetainedTiles(d,f);if(De(this._source.type)){const D={},N={},V=Object.keys(C),X=k.now();for(const W of V){const J=C[W],j=this._tiles[W];if(!j||j.fadeEndTime!==0&&j.fadeEndTime<=X)continue;const nt=this.findLoadedParent(J,y);nt&&(this._addTile(nt.tileID),D[nt.tileID.key]=nt.tileID),N[W]=J}this._retainLoadedChildren(N,f,w,C);for(const W in D)C[W]||(this._coveredTiles[W]=!0,C[W]=D[W]);if(u){const W={},J={};for(const j of d)this._tiles[j.key].hasData()?W[j.key]=j:J[j.key]=j;for(const j in J){const nt=J[j].children(this._source.maxzoom);this._tiles[nt[0].key]&&this._tiles[nt[1].key]&&this._tiles[nt[2].key]&&this._tiles[nt[3].key]&&(W[nt[0].key]=C[nt[0].key]=nt[0],W[nt[1].key]=C[nt[1].key]=nt[1],W[nt[2].key]=C[nt[2].key]=nt[2],W[nt[3].key]=C[nt[3].key]=nt[3],delete J[j])}for(const j in J){const nt=this.findLoadedParent(J[j],this._source.minzoom);if(nt){W[nt.tileID.key]=C[nt.tileID.key]=nt.tileID;for(const ft in W)W[ft].isChildOf(nt.tileID)&&delete W[ft]}}for(const j in this._tiles)W[j]||(this._coveredTiles[j]=!0)}}for(const D in C)this._tiles[D].clearFadeHold();const P=c.ab(this._tiles,C);for(const D of P){const N=this._tiles[D];N.hasSymbolBuckets&&!N.holdingForFade()?N.setHoldDuration(this.map._fadeDuration):N.hasSymbolBuckets&&!N.symbolFadeFinished()||this._removeTile(D)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(i)}_updateRetainedTiles(i,u){const d={},f={},y=Math.max(u-tr.maxOverzooming,this._source.minzoom),w=Math.max(u+tr.maxUnderzooming,this._source.minzoom),I={};for(const C of i){const P=this._addTile(C);d[C.key]=C,P.hasData()||uthis._source.maxzoom){const N=C.children(this._source.maxzoom)[0],V=this.getTile(N);if(V&&V.hasData()){d[N.key]=N;continue}}else{const N=C.children(this._source.maxzoom);if(d[N[0].key]&&d[N[1].key]&&d[N[2].key]&&d[N[3].key])continue}let D=P.wasRequested();for(let N=C.overscaledZ-1;N>=y;--N){const V=C.scaledTo(N);if(f[V.key])break;if(f[V.key]=!0,P=this.getTile(V),!P&&D&&(P=this._addTile(V)),P){const X=P.hasData();if((D||X)&&(d[V.key]=V),D=P.wasRequested(),X)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const i in this._tiles){const u=[];let d,f=this._tiles[i].tileID;for(;f.overscaledZ>0;){if(f.key in this._loadedParentTiles){d=this._loadedParentTiles[f.key];break}u.push(f.key);const y=f.scaledTo(f.overscaledZ-1);if(d=this._getLoadedTile(y),d)break;f=y}for(const y of u)this._loadedParentTiles[y]=d}}_addTile(i){let u=this._tiles[i.key];if(u)return u;u=this._cache.getAndRemove(i),u&&(this._setTileReloadTimer(i.key,u),u.tileID=i,this._state.initializeTileState(u,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,u)));const d=u;return u||(u=new Wo(i,this._source.tileSize*i.overscaleFactor()),this._loadTile(u,i.key,u.state)),u.uses++,this._tiles[i.key]=u,d||this._source.fire(new c.k("dataloading",{tile:u,coord:u.tileID,dataType:"source"})),u}_setTileReloadTimer(i,u){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);const d=u.getExpiryTimeout();d&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},d))}_removeTile(i){const u=this._tiles[i];u&&(u.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),u.uses>0||(u.hasData()&&u.state!=="reloading"?this._cache.add(u.tileID,u,u.getExpiryTimeout()):(u.aborted=!0,this._abortTile(u),this._unloadTile(u))))}_dataHandler(i){const u=i.sourceDataType;i.dataType==="source"&&u==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&i.dataType==="source"&&u==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const i in this._tiles)this._removeTile(i);this._cache.reset()}tilesIn(i,u,d){const f=[],y=this.transform;if(!y)return f;const w=d?y.getCameraQueryGeometry(i):i,I=i.map(W=>y.pointCoordinate(W,this.terrain)),C=w.map(W=>y.pointCoordinate(W,this.terrain)),P=this.getIds();let D=1/0,N=1/0,V=-1/0,X=-1/0;for(const W of C)D=Math.min(D,W.x),N=Math.min(N,W.y),V=Math.max(V,W.x),X=Math.max(X,W.y);for(let W=0;W=0&&Q[1].y+ft>=0){const st=I.map(gt=>j.getTilePoint(gt)),mt=C.map(gt=>j.getTilePoint(gt));f.push({tile:J,tileID:j,queryGeometry:st,cameraQueryGeometry:mt,scale:nt})}}return f}getVisibleCoordinates(i){const u=this.getRenderableIds(i).map(d=>this._tiles[d].tileID);for(const d of u)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return u}hasTransition(){if(this._source.hasTransition())return!0;if(De(this._source.type)){const i=k.now();for(const u in this._tiles)if(this._tiles[u].fadeEndTime>=i)return!0}return!1}setFeatureState(i,u,d){this._state.updateState(i=i||"_geojsonTileLayer",u,d)}removeFeatureState(i,u,d){this._state.removeFeatureState(i=i||"_geojsonTileLayer",u,d)}getFeatureState(i,u){return this._state.getState(i=i||"_geojsonTileLayer",u)}setDependencies(i,u,d){const f=this._tiles[i];f&&f.setDependencies(u,d)}reloadTilesForDependencies(i,u){for(const d in this._tiles)this._tiles[d].hasDependency(i,u)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(i,u))}}function Zt(_,i){const u=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*i.wrap)-+(i.wrap<0);return _.overscaledZ-i.overscaledZ||d-u||i.canonical.y-_.canonical.y||i.canonical.x-_.canonical.x}function De(_){return _==="raster"||_==="image"||_==="video"}tr.maxOverzooming=10,tr.maxUnderzooming=3;class Le{constructor(i,u){this.reset(i,u)}reset(i,u){this.points=i||[],this._distances=[0];for(let d=1;d0?(f-w)/I:0;return this.points[y].mult(1-C).add(this.points[u].mult(C))}}function _i(_,i){let u=!0;return _==="always"||_!=="never"&&i!=="never"||(u=!1),u}class Xo{constructor(i,u,d){const f=this.boxCells=[],y=this.circleCells=[];this.xCellCount=Math.ceil(i/d),this.yCellCount=Math.ceil(u/d);for(let w=0;wthis.width||f<0||u>this.height)return[];const C=[];if(i<=0&&u<=0&&this.width<=d&&this.height<=f){if(y)return[{key:null,x1:i,y1:u,x2:d,y2:f}];for(let P=0;P0}hitTestCircle(i,u,d,f,y){const w=i-d,I=i+d,C=u-d,P=u+d;if(I<0||w>this.width||P<0||C>this.height)return!1;const D=[];return this._forEachCell(w,C,I,P,this._queryCellCircle,D,{hitTest:!0,overlapMode:f,circle:{x:i,y:u,radius:d},seenUids:{box:{},circle:{}}},y),D.length>0}_queryCell(i,u,d,f,y,w,I,C){const{seenUids:P,hitTest:D,overlapMode:N}=I,V=this.boxCells[y];if(V!==null){const W=this.bboxes;for(const J of V)if(!P.box[J]){P.box[J]=!0;const j=4*J,nt=this.boxKeys[J];if(i<=W[j+2]&&u<=W[j+3]&&d>=W[j+0]&&f>=W[j+1]&&(!C||C(nt))&&(!D||!_i(N,nt.overlapMode))&&(w.push({key:nt,x1:W[j],y1:W[j+1],x2:W[j+2],y2:W[j+3]}),D))return!0}}const X=this.circleCells[y];if(X!==null){const W=this.circles;for(const J of X)if(!P.circle[J]){P.circle[J]=!0;const j=3*J,nt=this.circleKeys[J];if(this._circleAndRectCollide(W[j],W[j+1],W[j+2],i,u,d,f)&&(!C||C(nt))&&(!D||!_i(N,nt.overlapMode))){const ft=W[j],Q=W[j+1],st=W[j+2];if(w.push({key:nt,x1:ft-st,y1:Q-st,x2:ft+st,y2:Q+st}),D)return!0}}}return!1}_queryCellCircle(i,u,d,f,y,w,I,C){const{circle:P,seenUids:D,overlapMode:N}=I,V=this.boxCells[y];if(V!==null){const W=this.bboxes;for(const J of V)if(!D.box[J]){D.box[J]=!0;const j=4*J,nt=this.boxKeys[J];if(this._circleAndRectCollide(P.x,P.y,P.radius,W[j+0],W[j+1],W[j+2],W[j+3])&&(!C||C(nt))&&!_i(N,nt.overlapMode))return w.push(!0),!0}}const X=this.circleCells[y];if(X!==null){const W=this.circles;for(const J of X)if(!D.circle[J]){D.circle[J]=!0;const j=3*J,nt=this.circleKeys[J];if(this._circlesCollide(W[j],W[j+1],W[j+2],P.x,P.y,P.radius)&&(!C||C(nt))&&!_i(N,nt.overlapMode))return w.push(!0),!0}}}_forEachCell(i,u,d,f,y,w,I,C){const P=this._convertToXCellCoord(i),D=this._convertToYCellCoord(u),N=this._convertToXCellCoord(d),V=this._convertToYCellCoord(f);for(let X=P;X<=N;X++)for(let W=D;W<=V;W++)if(y.call(this,i,u,d,f,this.xCellCount*W+X,w,I,C))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,u,d,f,y,w){const I=f-i,C=y-u,P=d+w;return P*P>I*I+C*C}_circleAndRectCollide(i,u,d,f,y,w,I){const C=(w-f)/2,P=Math.abs(i-(f+C));if(P>C+d)return!1;const D=(I-y)/2,N=Math.abs(u-(y+D));if(N>D+d)return!1;if(P<=C||N<=D)return!0;const V=P-C,X=N-D;return V*V+X*X<=d*d}}function Ie(_,i,u,d,f){const y=c.F();return i?(c.J(y,y,[1/f,1/f,1]),u||c.ad(y,y,d.angle)):c.K(y,d.labelPlaneMatrix,_),y}function ma(_,i,u,d,f){if(i){const y=c.ae(_);return c.J(y,y,[f,f,1]),u||c.ad(y,y,-d.angle),y}return d.glCoordMatrix}function Ei(_,i,u){let d;u?(d=[_.x,_.y,u(_.x,_.y),1],c.af(d,d,i)):(d=[_.x,_.y,0,1],ie(d,d,i));const f=d[3];return{point:new c.P(d[0]/f,d[1]/f),signedDistanceFromCamera:f}}function K(_,i){return .5+_/i*.5}function z(_,i){const u=_[0]/_[3],d=_[1]/_[3];return u>=-i[0]&&u<=i[0]&&d>=-i[1]&&d<=i[1]}function F(_,i,u,d,f,y,w,I,C,P){const D=d?_.textSizeData:_.iconSizeData,N=c.ag(D,u.transform.zoom),V=[256/u.width*2+1,256/u.height*2+1],X=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;X.clear();const W=_.lineVertexArray,J=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,j=u.transform.width/u.transform.height;let nt=!1;for(let ft=0;ftMath.abs(u.x-i.x)*d?{useVertical:!0}:(_===c.ah.vertical?i.yu.x)?{needsFlipping:!0}:null}function it(_,i,u,d,f,y,w,I,C,P,D,N,V,X,W,J){const j=i/24,nt=_.lineOffsetX*j,ft=_.lineOffsetY*j;let Q;if(_.numGlyphs>1){const st=_.glyphStartIndex+_.numGlyphs,mt=_.lineStartIndex,gt=_.lineStartIndex+_.lineLength,xt=G(j,I,nt,ft,u,D,N,_,C,y,V,W,J);if(!xt)return{notEnoughRoom:!0};const At=Ei(xt.first.point,w,J).point,Pt=Ei(xt.last.point,w,J).point;if(d&&!u){const zt=H(_.writingMode,At,Pt,X);if(zt)return zt}Q=[xt.first];for(let zt=_.glyphStartIndex+1;zt0?At.point:rt(N,xt,mt,1,f,J),zt=H(_.writingMode,mt,Pt,X);if(zt)return zt}const st=Lt(j*I.getoffsetX(_.glyphStartIndex),nt,ft,u,D,N,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,C,y,V,W,J);if(!st)return{notEnoughRoom:!0};Q=[st]}for(const st of Q)c.aj(P,st.point,st.angle);return{}}function rt(_,i,u,d,f,y){const w=Ei(_.add(_.sub(i)._unit()),f,y).point,I=u.sub(w);return u.add(I._mult(d/I.mag()))}function at(_,i){const{projectionCache:u,lineVertexArray:d,labelPlaneMatrix:f,tileAnchorPoint:y,distanceFromAnchor:w,getElevation:I,previousVertex:C,direction:P,absOffsetX:D}=i;if(u.projections[_])return u.projections[_];const N=new c.P(d.getx(_),d.gety(_)),V=Ei(N,f,I);if(V.signedDistanceFromCamera>0)return u.projections[_]=V.point,V.point;const X=_-P;return rt(w===0?y:new c.P(d.getx(X),d.gety(X)),N,C,D-w+1,f,I)}function et(_,i,u){return _._unit()._perp()._mult(i*u)}function ht(_,i,u,d,f,y,w,I){const{projectionCache:C,direction:P}=I;if(C.offsets[_])return C.offsets[_];const D=u.add(i);if(_+P=f)return C.offsets[_]=D,D;const N=at(_+P,I),V=et(N.sub(u),w,P),X=u.add(V),W=N.add(V);return C.offsets[_]=c.ak(y,D,X,W)||D,C.offsets[_]}function Lt(_,i,u,d,f,y,w,I,C,P,D,N,V,X){const W=d?_-i:_+i;let J=W>0?1:-1,j=0;d&&(J*=-1,j=Math.PI),J<0&&(j+=Math.PI);let nt,ft,Q=J>0?I+w:I+w+1,st=f,mt=f,gt=0,xt=0;const At=Math.abs(W),Pt=[];let zt;for(;gt+xt<=At;){if(Q+=J,Q=C)return null;gt+=xt,mt=st,ft=nt;const Vt={projectionCache:N,lineVertexArray:P,labelPlaneMatrix:D,tileAnchorPoint:y,distanceFromAnchor:gt,getElevation:X,previousVertex:mt,direction:J,absOffsetX:At};if(st=at(Q,Vt),u===0)Pt.push(mt),zt=st.sub(mt);else{let ce;const Ce=st.sub(mt);ce=Ce.mag()===0?et(at(Q+J,Vt).sub(st),u,J):et(Ce,u,J),ft||(ft=mt.add(ce)),nt=ht(Q,ce,st,I,C,ft,u,Vt),Pt.push(ft),zt=nt.sub(ft)}xt=zt.mag()}const Bt=zt._mult((At-gt)/xt)._add(ft||mt),Se=j+Math.atan2(st.y-mt.y,st.x-mt.x);return Pt.push(Bt),{point:Bt,angle:V?Se:0,path:Pt}}const It=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Et(_,i){for(let u=0;u<_;u++){const d=i.length;i.resize(d+4),i.float32.set(It,3*d)}}function ie(_,i,u){const d=i[0],f=i[1];return _[0]=u[0]*d+u[4]*f+u[12],_[1]=u[1]*d+u[5]*f+u[13],_[3]=u[3]*d+u[7]*f+u[15],_}const le=100;class Ee{constructor(i,u=new Xo(i.width+200,i.height+200,25),d=new Xo(i.width+200,i.height+200,25)){this.transform=i,this.grid=u,this.ignoredGrid=d,this.pitchfactor=Math.cos(i._pitch)*i.cameraToCenterDistance,this.screenRightBoundary=i.width+le,this.screenBottomBoundary=i.height+le,this.gridRightBoundary=i.width+200,this.gridBottomBoundary=i.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(i,u,d,f,y,w){const I=this.projectAndGetPerspectiveRatio(f,i.anchorPointX,i.anchorPointY,w),C=d*I.perspectiveRatio,P=i.x1*C+I.point.x,D=i.y1*C+I.point.y,N=i.x2*C+I.point.x,V=i.y2*C+I.point.y;return!this.isInsideGrid(P,D,N,V)||u!=="always"&&this.grid.hitTest(P,D,N,V,u,y)||I.perspectiveRatio=1;Ae--)Ce.push(Vt.path[Ae]);for(let Ae=1;AeEi(Ne,C,W));Ce=Ae.some(Ne=>Ne.signedDistanceFromCamera<=0)?[]:Ae.map(Ne=>Ne.point)}let ge=[];if(Ce.length>0){const Ae=Ce[0].clone(),Ne=Ce[0].clone();for(let Jn=1;Jn=zt.x&&Ne.x<=Bt.x&&Ae.y>=zt.y&&Ne.y<=Bt.y?[Ce]:Ne.xBt.x||Ne.yBt.y?[]:c.al([Ce],zt.x,zt.y,Bt.x,Bt.y)}for(const Ae of ge){Se.reset(Ae,.25*Pt);let Ne=0;Ne=Se.length<=.5*Pt?1:Math.ceil(Se.paddedLength/He)+1;for(let Jn=0;Jn=this.screenRightBoundary||fthis.screenBottomBoundary}isInsideGrid(i,u,d,f){return d>=0&&i=0&&ud.collisionGroupID===u}}return this.collisionGroups[i]}}function Si(_,i,u,d,f){const{horizontalAlign:y,verticalAlign:w}=c.at(_);return new c.P(-(y-.5)*i+d[0]*f,-(w-.5)*u+d[1]*f)}function dr(_,i,u,d,f,y){const{x1:w,x2:I,y1:C,y2:P,anchorPointX:D,anchorPointY:N}=_,V=new c.P(i,u);return d&&V._rotate(f?y:-y),{x1:w+V.x,y1:C+V.y,x2:I+V.x,y2:P+V.y,anchorPointX:D,anchorPointY:N}}class Tr{constructor(i,u,d,f,y){this.transform=i.clone(),this.terrain=u,this.collisionIndex=new Ee(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Xn(f),this.collisionCircleArrays={},this.prevPlacement=y,y&&(y.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(i,u,d,f){const y=d.getBucket(u),w=d.latestFeatureIndex;if(!y||!w||u.id!==y.layerIds[0])return;const I=d.collisionBoxArray,C=y.layers[0].layout,P=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),D=d.tileSize/c.W,N=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),V=C.get("text-pitch-alignment")==="map",X=C.get("text-rotation-alignment")==="map",W=ve(d,1,this.transform.zoom),J=Ie(N,V,X,this.transform,W);let j=null;if(V){const ft=ma(N,V,X,this.transform,W);j=c.K([],this.transform.labelPlaneMatrix,ft)}this.retainedQueryData[y.bucketInstanceId]=new Pe(y.bucketInstanceId,w,y.sourceLayerIndex,y.index,d.tileID);const nt={bucket:y,layout:C,posMatrix:N,textLabelPlaneMatrix:J,labelToScreenMatrix:j,scale:P,textPixelRatio:D,holdingForFade:d.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:c.ag(y.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(y.sourceID)};if(f)for(const ft of y.sortKeyRanges){const{sortKey:Q,symbolInstanceStart:st,symbolInstanceEnd:mt}=ft;i.push({sortKey:Q,symbolInstanceStart:st,symbolInstanceEnd:mt,parameters:nt})}else i.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:nt})}attemptAnchorPlacement(i,u,d,f,y,w,I,C,P,D,N,V,X,W,J,j){const nt=c.ap[i.textAnchor],ft=[i.textOffset0,i.textOffset1],Q=Si(nt,d,f,ft,y),st=this.collisionIndex.placeCollisionBox(dr(u,Q.x,Q.y,w,I,this.transform.angle),N,C,P,D.predicate,j);if((!J||this.collisionIndex.placeCollisionBox(dr(J,Q.x,Q.y,w,I,this.transform.angle),N,C,P,D.predicate,j).box.length!==0)&&st.box.length>0){let mt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[V.crossTileID]&&this.prevPlacement.placements[V.crossTileID]&&this.prevPlacement.placements[V.crossTileID].text&&(mt=this.prevPlacement.variableOffsets[V.crossTileID].anchor),V.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[V.crossTileID]={textOffset:ft,width:d,height:f,anchor:nt,textBoxScale:y,prevAnchor:mt},this.markUsedJustification(X,nt,V,W),X.allowVerticalPlacement&&(this.markUsedOrientation(X,W,V),this.placedOrientations[V.crossTileID]=W),{shift:Q,placedGlyphBoxes:st}}}placeLayerBucketPart(i,u,d){const{bucket:f,layout:y,posMatrix:w,textLabelPlaneMatrix:I,labelToScreenMatrix:C,textPixelRatio:P,holdingForFade:D,collisionBoxArray:N,partiallyEvaluatedTextSize:V,collisionGroup:X}=i.parameters,W=y.get("text-optional"),J=y.get("icon-optional"),j=c.aq(y,"text-overlap","text-allow-overlap"),nt=j==="always",ft=c.aq(y,"icon-overlap","icon-allow-overlap"),Q=ft==="always",st=y.get("text-rotation-alignment")==="map",mt=y.get("text-pitch-alignment")==="map",gt=y.get("icon-text-fit")!=="none",xt=y.get("symbol-z-order")==="viewport-y",At=nt&&(Q||!f.hasIconData()||J),Pt=Q&&(nt||!f.hasTextData()||W);!f.collisionArrays&&N&&f.deserializeCollisionBoxes(N);const zt=this.retainedQueryData[f.bucketInstanceId].tileID,Bt=this.terrain?(Vt,ce)=>this.terrain.getElevation(zt,Vt,ce):null,Se=(Vt,ce)=>{var Ce,He;if(u[Vt.crossTileID])return;if(D)return void(this.placements[Vt.crossTileID]=new kn(!1,!1,!1));let ge=!1,Ae=!1,Ne=!0,Jn=null,fn={box:null,offscreen:null},Hr={box:null,offscreen:null},Ci=null,qn=null,Ti=null,Wr=0,ts=0,Ks=0;ce.textFeatureIndex?Wr=ce.textFeatureIndex:Vt.useRuntimeCollisionCircles&&(Wr=Vt.featureIndex),ce.verticalTextFeatureIndex&&(ts=ce.verticalTextFeatureIndex);const eu=ce.textBox;if(eu){const xi=bi=>{let jn=c.ah.horizontal;if(f.allowVerticalPlacement&&!bi&&this.prevPlacement){const co=this.prevPlacement.placedOrientations[Vt.crossTileID];co&&(this.placedOrientations[Vt.crossTileID]=co,jn=co,this.markUsedOrientation(f,jn,Vt))}return jn},Gn=(bi,jn)=>{if(f.allowVerticalPlacement&&Vt.numVerticalGlyphVertices>0&&ce.verticalTextBox){for(const co of f.writingModes)if(co===c.ah.vertical?(fn=jn(),Hr=fn):fn=bi(),fn&&fn.box&&fn.box.length)break}else fn=bi()},On=Vt.textAnchorOffsetStartIndex,uo=Vt.textAnchorOffsetEndIndex;if(uo===On){const bi=(jn,co)=>{const wi=this.collisionIndex.placeCollisionBox(jn,j,P,w,X.predicate,Bt);return wi&&wi.box&&wi.box.length&&(this.markUsedOrientation(f,co,Vt),this.placedOrientations[Vt.crossTileID]=co),wi};Gn(()=>bi(eu,c.ah.horizontal),()=>{const jn=ce.verticalTextBox;return f.allowVerticalPlacement&&Vt.numVerticalGlyphVertices>0&&jn?bi(jn,c.ah.vertical):{box:null,offscreen:null}}),xi(fn&&fn.box&&fn.box.length)}else{let bi=c.ap[(He=(Ce=this.prevPlacement)===null||Ce===void 0?void 0:Ce.variableOffsets[Vt.crossTileID])===null||He===void 0?void 0:He.anchor];const jn=(wi,ri,jh)=>{const zd=wi.x2-wi.x1,Ea=wi.y2-wi.y1,Sa=Vt.textBoxScale,yc=gt&&ft==="never"?ri:null;let Qs={box:[],offscreen:!1},Zh=j==="never"?1:2,Od="never";bi&&Zh++;for(let Hh=0;Hhjn(eu,ce.iconBox,c.ah.horizontal),()=>{const wi=ce.verticalTextBox;return f.allowVerticalPlacement&&!(fn&&fn.box&&fn.box.length)&&Vt.numVerticalGlyphVertices>0&&wi?jn(wi,ce.verticalIconBox,c.ah.vertical):{box:null,offscreen:null}}),fn&&(ge=fn.box,Ne=fn.offscreen);const co=xi(fn&&fn.box);if(!ge&&this.prevPlacement){const wi=this.prevPlacement.variableOffsets[Vt.crossTileID];wi&&(this.variableOffsets[Vt.crossTileID]=wi,this.markUsedJustification(f,wi.anchor,Vt,co))}}}if(Ci=fn,ge=Ci&&Ci.box&&Ci.box.length>0,Ne=Ci&&Ci.offscreen,Vt.useRuntimeCollisionCircles){const xi=f.text.placedSymbolArray.get(Vt.centerJustifiedTextSymbolIndex),Gn=c.ai(f.textSizeData,V,xi),On=y.get("text-padding");qn=this.collisionIndex.placeCollisionCircles(j,xi,f.lineVertexArray,f.glyphOffsetArray,Gn,w,I,C,d,mt,X.predicate,Vt.collisionCircleDiameter,On,Bt),qn.circles.length&&qn.collisionDetected&&!d&&c.w("Collisions detected, but collision boxes are not shown"),ge=nt||qn.circles.length>0&&!qn.collisionDetected,Ne=Ne&&qn.offscreen}if(ce.iconFeatureIndex&&(Ks=ce.iconFeatureIndex),ce.iconBox){const xi=Gn=>{const On=gt&&Jn?dr(Gn,Jn.x,Jn.y,st,mt,this.transform.angle):Gn;return this.collisionIndex.placeCollisionBox(On,ft,P,w,X.predicate,Bt)};Hr&&Hr.box&&Hr.box.length&&ce.verticalIconBox?(Ti=xi(ce.verticalIconBox),Ae=Ti.box.length>0):(Ti=xi(ce.iconBox),Ae=Ti.box.length>0),Ne=Ne&&Ti.offscreen}const Js=W||Vt.numHorizontalGlyphVertices===0&&Vt.numVerticalGlyphVertices===0,es=J||Vt.numIconVertices===0;if(Js||es?es?Js||(Ae=Ae&&ge):ge=Ae&&ge:Ae=ge=Ae&&ge,ge&&Ci&&Ci.box&&this.collisionIndex.insertCollisionBox(Ci.box,j,y.get("text-ignore-placement"),f.bucketInstanceId,Hr&&Hr.box&&ts?ts:Wr,X.ID),Ae&&Ti&&this.collisionIndex.insertCollisionBox(Ti.box,ft,y.get("icon-ignore-placement"),f.bucketInstanceId,Ks,X.ID),qn&&(ge&&this.collisionIndex.insertCollisionCircles(qn.circles,j,y.get("text-ignore-placement"),f.bucketInstanceId,Wr,X.ID),d)){const xi=f.bucketInstanceId;let Gn=this.collisionCircleArrays[xi];Gn===void 0&&(Gn=this.collisionCircleArrays[xi]=new yi);for(let On=0;On=0;--ce){const Ce=Vt[ce];Se(f.symbolInstances.get(Ce),f.collisionArrays[Ce])}}else for(let Vt=i.symbolInstanceStart;Vt=0&&(i.text.placedSymbolArray.get(I).crossTileID=y>=0&&I!==y?0:d.crossTileID)}markUsedOrientation(i,u,d){const f=u===c.ah.horizontal||u===c.ah.horizontalOnly?u:0,y=u===c.ah.vertical?u:0,w=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const I of w)i.text.placedSymbolArray.get(I).placedOrientation=f;d.verticalPlacedTextSymbolIndex&&(i.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=y)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;const u=this.prevPlacement;let d=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;const f=u?u.symbolFadeChange(i):1,y=u?u.opacities:{},w=u?u.variableOffsets:{},I=u?u.placedOrientations:{};for(const C in this.placements){const P=this.placements[C],D=y[C];D?(this.opacities[C]=new _n(D,f,P.text,P.icon),d=d||P.text!==D.text.placed||P.icon!==D.icon.placed):(this.opacities[C]=new _n(null,f,P.text,P.icon,P.skipFade),d=d||P.text||P.icon)}for(const C in y){const P=y[C];if(!this.opacities[C]){const D=new _n(P,f,!1,!1);D.isHidden()||(this.opacities[C]=D,d=d||P.text.placed||P.icon.placed)}}for(const C in w)this.variableOffsets[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.variableOffsets[C]=w[C]);for(const C in I)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=I[C]);if(u&&u.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=i:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=u?u.lastPlacementChangeTime:i)}updateLayerOpacities(i,u){const d={};for(const f of u){const y=f.getBucket(i);y&&f.latestFeatureIndex&&i.id===y.layerIds[0]&&this.updateBucketOpacities(y,d,f.collisionBoxArray)}}updateBucketOpacities(i,u,d){i.hasTextData()&&(i.text.opacityVertexArray.clear(),i.text.hasVisibleVertices=!1),i.hasIconData()&&(i.icon.opacityVertexArray.clear(),i.icon.hasVisibleVertices=!1),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexArray.clear(),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexArray.clear();const f=i.layers[0],y=f.layout,w=new _n(null,0,!1,!1,!0),I=y.get("text-allow-overlap"),C=y.get("icon-allow-overlap"),P=f._unevaluatedLayout.hasValue("text-variable-anchor")||f._unevaluatedLayout.hasValue("text-variable-anchor-offset"),D=y.get("text-rotation-alignment")==="map",N=y.get("text-pitch-alignment")==="map",V=y.get("icon-text-fit")!=="none",X=new _n(null,0,I&&(C||!i.hasIconData()||y.get("icon-optional")),C&&(I||!i.hasTextData()||y.get("text-optional")),!0);!i.collisionArrays&&d&&(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData())&&i.deserializeCollisionBoxes(d);const W=(J,j,nt)=>{for(let ft=0;ft0,gt=this.placedOrientations[j.crossTileID],xt=gt===c.ah.vertical,At=gt===c.ah.horizontal||gt===c.ah.horizontalOnly;if(nt>0||ft>0){const Pt=Lr(st.text);W(i.text,nt,xt?Rl:Pt),W(i.text,ft,At?Rl:Pt);const zt=st.text.isHidden();[j.rightJustifiedTextSymbolIndex,j.centerJustifiedTextSymbolIndex,j.leftJustifiedTextSymbolIndex].forEach(Vt=>{Vt>=0&&(i.text.placedSymbolArray.get(Vt).hidden=zt||xt?1:0)}),j.verticalPlacedTextSymbolIndex>=0&&(i.text.placedSymbolArray.get(j.verticalPlacedTextSymbolIndex).hidden=zt||At?1:0);const Bt=this.variableOffsets[j.crossTileID];Bt&&this.markUsedJustification(i,Bt.anchor,j,gt);const Se=this.placedOrientations[j.crossTileID];Se&&(this.markUsedJustification(i,"left",j,Se),this.markUsedOrientation(i,Se,j))}if(mt){const Pt=Lr(st.icon),zt=!(V&&j.verticalPlacedIconSymbolIndex&&xt);j.placedIconSymbolIndex>=0&&(W(i.icon,j.numIconVertices,zt?Pt:Rl),i.icon.placedSymbolArray.get(j.placedIconSymbolIndex).hidden=st.icon.isHidden()),j.verticalPlacedIconSymbolIndex>=0&&(W(i.icon,j.numVerticalIconVertices,zt?Rl:Pt),i.icon.placedSymbolArray.get(j.verticalPlacedIconSymbolIndex).hidden=st.icon.isHidden())}if(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData()){const Pt=i.collisionArrays[J];if(Pt){let zt=new c.P(0,0);if(Pt.textBox||Pt.verticalTextBox){let Se=!0;if(P){const Vt=this.variableOffsets[Q];Vt?(zt=Si(Vt.anchor,Vt.width,Vt.height,Vt.textOffset,Vt.textBoxScale),D&&zt._rotate(N?this.transform.angle:-this.transform.angle)):Se=!1}Pt.textBox&&Oi(i.textCollisionBox.collisionVertexArray,st.text.placed,!Se||xt,zt.x,zt.y),Pt.verticalTextBox&&Oi(i.textCollisionBox.collisionVertexArray,st.text.placed,!Se||At,zt.x,zt.y)}const Bt=!!(!At&&Pt.verticalIconBox);Pt.iconBox&&Oi(i.iconCollisionBox.collisionVertexArray,st.icon.placed,Bt,V?zt.x:0,V?zt.y:0),Pt.verticalIconBox&&Oi(i.iconCollisionBox.collisionVertexArray,st.icon.placed,!Bt,V?zt.x:0,V?zt.y:0)}}}if(i.sortFeatures(this.transform.angle),this.retainedQueryData[i.bucketInstanceId]&&(this.retainedQueryData[i.bucketInstanceId].featureSortOrder=i.featureSortOrder),i.hasTextData()&&i.text.opacityVertexBuffer&&i.text.opacityVertexBuffer.updateData(i.text.opacityVertexArray),i.hasIconData()&&i.icon.opacityVertexBuffer&&i.icon.opacityVertexBuffer.updateData(i.icon.opacityVertexArray),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexBuffer&&i.iconCollisionBox.collisionVertexBuffer.updateData(i.iconCollisionBox.collisionVertexArray),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexBuffer&&i.textCollisionBox.collisionVertexBuffer.updateData(i.textCollisionBox.collisionVertexArray),i.text.opacityVertexArray.length!==i.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${i.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${i.text.layoutVertexArray.length}) / 4`);if(i.icon.opacityVertexArray.length!==i.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${i.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${i.icon.layoutVertexArray.length}) / 4`);if(i.bucketInstanceId in this.collisionCircleArrays){const J=this.collisionCircleArrays[i.bucketInstanceId];i.placementInvProjMatrix=J.invProjMatrix,i.placementViewportMatrix=J.viewportMatrix,i.collisionCircleArray=J.circles,delete this.collisionCircleArrays[i.bucketInstanceId]}}symbolFadeChange(i){return this.fadeDuration===0?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return this.stale||i-this.lastPlacementChangeTimei}setStale(){this.stale=!0}}function Oi(_,i,u,d,f){_.emplaceBack(i?1:0,u?1:0,d||0,f||0),_.emplaceBack(i?1:0,u?1:0,d||0,f||0),_.emplaceBack(i?1:0,u?1:0,d||0,f||0),_.emplaceBack(i?1:0,u?1:0,d||0,f||0)}const Yo=Math.pow(2,25),$p=Math.pow(2,24),kf=Math.pow(2,17),pn=Math.pow(2,16),ph=Math.pow(2,9),dh=Math.pow(2,8),Gr=Math.pow(2,1);function Lr(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const i=_.placed?1:0,u=Math.floor(127*_.opacity);return u*Yo+i*$p+u*kf+i*pn+u*ph+i*dh+u*Gr+i}const Rl=0;class ao{constructor(i){this._sortAcrossTiles=i.layout.get("symbol-z-order")!=="viewport-y"&&!i.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(i,u,d,f,y){const w=this._bucketParts;for(;this._currentTileIndexI.sortKey-C.sortKey));this._currentPartIndex!this._forceFullPlacement&&k.now()-f>2;for(;this._currentPlacementIndex>=0;){const w=u[i[this._currentPlacementIndex]],I=this.placement.collisionIndex.transform.zoom;if(w.type==="symbol"&&(!w.minzoom||w.minzoom<=I)&&(!w.maxzoom||w.maxzoom>I)){if(this._inProgressLayer||(this._inProgressLayer=new ao(w)),this._inProgressLayer.continuePlacement(d[w.source],this.placement,this._showCollisionBoxes,w,y))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(i){return this.placement.commit(i),this.placement}}const Xa=512/c.W/2;class Ru{constructor(i,u,d){this.tileID=i,this.bucketInstanceId=d,this._symbolsByKey={};const f=new Map;for(let y=0;y({x:Math.floor(C.anchorX*Xa),y:Math.floor(C.anchorY*Xa)})),crossTileIDs:w.map(C=>C.crossTileID)};if(I.positions.length>128){const C=new c.au(I.positions.length,16,Uint16Array);for(const{x:P,y:D}of I.positions)C.add(P,D);C.finish(),delete I.positions,I.index=C}this._symbolsByKey[y]=I}}getScaledCoordinates(i,u){const{x:d,y:f,z:y}=this.tileID.canonical,{x:w,y:I,z:C}=u.canonical,P=Xa/Math.pow(2,C-y),D=(I*c.W+i.anchorY)*P,N=f*c.W*Xa;return{x:Math.floor((w*c.W+i.anchorX)*P-d*c.W*Xa),y:Math.floor(D-N)}}findMatches(i,u,d){const f=this.tileID.canonical.zi)}}class vi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Nl{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(i){const u=Math.round((i-this.lng)/360);if(u!==0)for(const d in this.indexes){const f=this.indexes[d],y={};for(const w in f){const I=f[w];I.tileID=I.tileID.unwrapTo(I.tileID.wrap+u),y[I.tileID.key]=I}this.indexes[d]=y}this.lng=i}addBucket(i,u,d){if(this.indexes[i.overscaledZ]&&this.indexes[i.overscaledZ][i.key]){if(this.indexes[i.overscaledZ][i.key].bucketInstanceId===u.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(i.overscaledZ,this.indexes[i.overscaledZ][i.key])}for(let y=0;yi.overscaledZ)for(const I in w){const C=w[I];C.tileID.isChildOf(i)&&C.findMatches(u.symbolInstances,i,f)}else{const I=w[i.scaledTo(Number(y)).key];I&&I.findMatches(u.symbolInstances,i,f)}}for(let y=0;y{u[d]=!0});for(const d in this.layerIndexes)u[d]||delete this.layerIndexes[d]}}const Un=(_,i)=>c.t(_,i&&i.filter(u=>u.identifier!=="source.canvas")),Nu=c.av();class jr extends c.E{constructor(i,u={}){super(),this._rtlPluginLoaded=()=>{for(const d in this.sourceCaches){const f=this.sourceCaches[d].getSource().type;f!=="vector"&&f!=="geojson"||this.sourceCaches[d].reload()}},this.map=i,this.dispatcher=new Rn(gn(),i._getMapId()),this.dispatcher.registerMessageHandler("GG",(d,f)=>this.getGlyphs(d,f)),this.dispatcher.registerMessageHandler("GI",(d,f)=>this.getImages(d,f)),this.imageManager=new ke,this.imageManager.setEventedParent(this),this.glyphManager=new fe(i._requestManager,u.localIdeographFontFamily),this.lineAtlas=new mn(256,512),this.crossTileSymbolIndex=new js,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.ax()),Ot().on(Gs,this._rtlPluginLoaded),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const f=this.sourceCaches[d.sourceId];if(!f)return;const y=f.getSource();if(y&&y.vectorLayerIds)for(const w in this._layers){const I=this._layers[w];I.source===y.id&&this._validateLayer(I)}})}loadURL(i,u={},d){this.fire(new c.k("dataloading",{dataType:"style"})),u.validate=typeof u.validate!="boolean"||u.validate;const f=this.map._requestManager.transformRequest(i,"Style");this._loadStyleRequest=new AbortController,c.h(f,this._loadStyleRequest).then(y=>{this._loadStyleRequest=null,this._load(y.data,u,d)}).catch(y=>{this._loadStyleRequest=null,y&&this.fire(new c.j(y))})}loadJSON(i,u={},d){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,k.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,u.validate=u.validate!==!1,this._load(i,u,d)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(Nu,{validate:!1})}_load(i,u,d){var f;const y=u.transformStyle?u.transformStyle(d,i):i;if(!u.validate||!Un(this,c.x(y))){this._loaded=!0,this.stylesheet=y;for(const w in y.sources)this.addSource(w,y.sources[w],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new ji(this.stylesheet.light),this.map.setTerrain((f=this.stylesheet.terrain)!==null&&f!==void 0?f:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const i=c.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",i),this._order=i.map(u=>u.id),this._layers={},this._serializedLayers=null;for(const u of i){const d=c.az(u);d.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=d}}_loadSprite(i,u=!1,d=void 0){let f;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(y,w,I,C){return c._(this,void 0,void 0,function*(){const P=be(y),D=I>1?"@2x":"",N={},V={};for(const{id:X,url:W}of P){const J=w.transformRequest(w.normalizeSpriteURL(W,D,".json"),"SpriteJSON");N[X]=c.h(J,C);const j=w.transformRequest(w.normalizeSpriteURL(W,D,".png"),"SpriteImage");V[X]=Gt.getImage(j,C)}return yield Promise.all([...Object.values(N),...Object.values(V)]),function(X,W){return c._(this,void 0,void 0,function*(){const J={};for(const j in X){J[j]={};const nt=k.getImageCanvasContext((yield W[j]).data),ft=(yield X[j]).data;for(const Q in ft){const{width:st,height:mt,x:gt,y:xt,sdf:At,pixelRatio:Pt,stretchX:zt,stretchY:Bt,content:Se}=ft[Q];J[j][Q]={data:null,pixelRatio:Pt,sdf:At,stretchX:zt,stretchY:Bt,content:Se,spriteData:{width:st,height:mt,x:gt,y:xt,context:nt}}}}return J})}(N,V)})}(i,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(y=>{if(this._spriteRequest=null,y)for(const w in y){this._spritesImagesIds[w]=[];const I=this._spritesImagesIds[w]?this._spritesImagesIds[w].filter(C=>!(C in y)):[];for(const C of I)this.imageManager.removeImage(C),this._changedImages[C]=!0;for(const C in y[w]){const P=w==="default"?C:`${w}:${C}`;this._spritesImagesIds[w].push(P),P in this.imageManager.images?this.imageManager.updateImage(P,y[w][C],!1):this.imageManager.addImage(P,y[w][C]),u&&(this._changedImages[P]=!0)}}}).catch(y=>{this._spriteRequest=null,f=y,this.fire(new c.j(f))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),u&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),d&&d(f)})}_unloadSprite(){for(const i of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(i),this._changedImages[i]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(i){const u=this.sourceCaches[i.source];if(!u)return;const d=i.sourceLayer;if(!d)return;const f=u.getSource();(f.type==="geojson"||f.vectorLayerIds&&f.vectorLayerIds.indexOf(d)===-1)&&this.fire(new c.j(new Error(`Source layer "${d}" does not exist on source "${f.id}" as specified by style layer "${i.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const i in this.sourceCaches)if(!this.sourceCaches[i].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(i){const u=this._serializedAllLayers();if(!i||i.length===0)return Object.values(u);const d=[];for(const f of i)u[f]&&d.push(u[f]);return d}_serializedAllLayers(){let i=this._serializedLayers;if(i)return i;i=this._serializedLayers={};const u=Object.keys(this._layers);for(const d of u){const f=this._layers[d];f.type!=="custom"&&(i[d]=f.serialize())}return i}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const i in this.sourceCaches)if(this.sourceCaches[i].hasTransition())return!0;for(const i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(i){if(!this._loaded)return;const u=this._changed;if(u){const f=Object.keys(this._updatedLayers),y=Object.keys(this._removedLayers);(f.length||y.length)&&this._updateWorkerLayers(f,y);for(const w in this._updatedSources){const I=this._updatedSources[w];if(I==="reload")this._reloadSource(w);else{if(I!=="clear")throw new Error(`Invalid action ${I}`);this._clearSource(w)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const w in this._updatedPaintProps)this._layers[w].updateTransitions(i);this.light.updateTransitions(i),this._resetUpdates()}const d={};for(const f in this.sourceCaches){const y=this.sourceCaches[f];d[f]=y.used,y.used=!1}for(const f of this._order){const y=this._layers[f];y.recalculate(i,this._availableImages),!y.isHidden(i.zoom)&&y.source&&(this.sourceCaches[y.source].used=!0)}for(const f in d){const y=this.sourceCaches[f];!!d[f]!=!!y.used&&y.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:f}))}this.light.recalculate(i),this.z=i.zoom,u&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const i=Object.keys(this._changedImages);if(i.length){for(const u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["icons","patterns"],i);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const i in this.sourceCaches)this.sourceCaches[i].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(i,u){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(i),removedIds:u})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(i,u={}){var d;this._checkLoaded();const f=this.serialize();if(i=u.transformStyle?u.transformStyle(f,i):i,((d=u.validate)===null||d===void 0||d)&&Un(this,c.x(i)))return!1;(i=c.aA(i)).layers=c.ay(i.layers);const y=c.aB(f,i),w=this._getOperationsToPerform(y);if(w.unimplemented.length>0)throw new Error(`Unimplemented: ${w.unimplemented.join(", ")}.`);if(w.operations.length===0)return!1;for(const I of w.operations)I();return this.stylesheet=i,this._serializedLayers=null,!0}_getOperationsToPerform(i){const u=[],d=[];for(const f of i)switch(f.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":u.push(()=>this.addLayer.apply(this,f.args));break;case"removeLayer":u.push(()=>this.removeLayer.apply(this,f.args));break;case"setPaintProperty":u.push(()=>this.setPaintProperty.apply(this,f.args));break;case"setLayoutProperty":u.push(()=>this.setLayoutProperty.apply(this,f.args));break;case"setFilter":u.push(()=>this.setFilter.apply(this,f.args));break;case"addSource":u.push(()=>this.addSource.apply(this,f.args));break;case"removeSource":u.push(()=>this.removeSource.apply(this,f.args));break;case"setLayerZoomRange":u.push(()=>this.setLayerZoomRange.apply(this,f.args));break;case"setLight":u.push(()=>this.setLight.apply(this,f.args));break;case"setGeoJSONSourceData":u.push(()=>this.setGeoJSONSourceData.apply(this,f.args));break;case"setGlyphs":u.push(()=>this.setGlyphs.apply(this,f.args));break;case"setSprite":u.push(()=>this.setSprite.apply(this,f.args));break;case"setTerrain":u.push(()=>this.map.setTerrain.apply(this,f.args));break;case"setTransition":u.push(()=>{});break;default:d.push(f.command)}return{operations:u,unimplemented:d}}addImage(i,u){if(this.getImage(i))return this.fire(new c.j(new Error(`An image named "${i}" already exists.`)));this.imageManager.addImage(i,u),this._afterImageUpdated(i)}updateImage(i,u){this.imageManager.updateImage(i,u)}getImage(i){return this.imageManager.getImage(i)}removeImage(i){if(!this.getImage(i))return this.fire(new c.j(new Error(`An image named "${i}" does not exist.`)));this.imageManager.removeImage(i),this._afterImageUpdated(i)}_afterImageUpdated(i){this._availableImages=this.imageManager.listImages(),this._changedImages[i]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(i,u,d={}){if(this._checkLoaded(),this.sourceCaches[i]!==void 0)throw new Error(`Source "${i}" already exists.`);if(!u.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(u).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(u.type)>=0&&this._validate(c.x.source,`sources.${i}`,u,null,d))return;this.map&&this.map._collectResourceTiming&&(u.collectResourceTiming=!0);const f=this.sourceCaches[i]=new tr(i,u,this.dispatcher);f.style=this,f.setEventedParent(this,()=>({isSourceLoaded:f.loaded(),source:f.serialize(),sourceId:i})),f.onAdd(this.map),this._changed=!0}removeSource(i){if(this._checkLoaded(),this.sourceCaches[i]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===i)return this.fire(new c.j(new Error(`Source "${i}" cannot be removed while layer "${d}" is using it.`)));const u=this.sourceCaches[i];delete this.sourceCaches[i],delete this._updatedSources[i],u.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:i})),u.setEventedParent(null),u.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(i,u){if(this._checkLoaded(),this.sourceCaches[i]===void 0)throw new Error(`There is no source with this ID=${i}`);const d=this.sourceCaches[i].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(u),this._changed=!0}getSource(i){return this.sourceCaches[i]&&this.sourceCaches[i].getSource()}addLayer(i,u,d={}){this._checkLoaded();const f=i.id;if(this.getLayer(f))return void this.fire(new c.j(new Error(`Layer "${f}" already exists on this map.`)));let y;if(i.type==="custom"){if(Un(this,c.aC(i)))return;y=c.az(i)}else{if("source"in i&&typeof i.source=="object"&&(this.addSource(f,i.source),i=c.aA(i),i=c.e(i,{source:f})),this._validate(c.x.layer,`layers.${f}`,i,{arrayIndex:-1},d))return;y=c.az(i),this._validateLayer(y),y.setEventedParent(this,{layer:{id:f}})}const w=u?this._order.indexOf(u):this._order.length;if(u&&w===-1)this.fire(new c.j(new Error(`Cannot add layer "${f}" before non-existing layer "${u}".`)));else{if(this._order.splice(w,0,f),this._layerOrderChanged=!0,this._layers[f]=y,this._removedLayers[f]&&y.source&&y.type!=="custom"){const I=this._removedLayers[f];delete this._removedLayers[f],I.type!==y.type?this._updatedSources[y.source]="clear":(this._updatedSources[y.source]="reload",this.sourceCaches[y.source].pause())}this._updateLayer(y),y.onAdd&&y.onAdd(this.map)}}moveLayer(i,u){if(this._checkLoaded(),this._changed=!0,!this._layers[i])return void this.fire(new c.j(new Error(`The layer '${i}' does not exist in the map's style and cannot be moved.`)));if(i===u)return;const d=this._order.indexOf(i);this._order.splice(d,1);const f=u?this._order.indexOf(u):this._order.length;u&&f===-1?this.fire(new c.j(new Error(`Cannot move layer "${i}" before non-existing layer "${u}".`))):(this._order.splice(f,0,i),this._layerOrderChanged=!0)}removeLayer(i){this._checkLoaded();const u=this._layers[i];if(!u)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${i}".`)));u.setEventedParent(null);const d=this._order.indexOf(i);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[i]=u,delete this._layers[i],this._serializedLayers&&delete this._serializedLayers[i],delete this._updatedLayers[i],delete this._updatedPaintProps[i],u.onRemove&&u.onRemove(this.map)}getLayer(i){return this._layers[i]}getLayersOrder(){return[...this._order]}hasLayer(i){return i in this._layers}setLayerZoomRange(i,u,d){this._checkLoaded();const f=this.getLayer(i);f?f.minzoom===u&&f.maxzoom===d||(u!=null&&(f.minzoom=u),d!=null&&(f.maxzoom=d),this._updateLayer(f)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${i}".`)))}setFilter(i,u,d={}){this._checkLoaded();const f=this.getLayer(i);if(f){if(!c.aD(f.filter,u))return u==null?(f.filter=void 0,void this._updateLayer(f)):void(this._validate(c.x.filter,`layers.${f.id}.filter`,u,null,d)||(f.filter=c.aA(u),this._updateLayer(f)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${i}".`)))}getFilter(i){return c.aA(this.getLayer(i).filter)}setLayoutProperty(i,u,d,f={}){this._checkLoaded();const y=this.getLayer(i);y?c.aD(y.getLayoutProperty(u),d)||(y.setLayoutProperty(u,d,f),this._updateLayer(y)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${i}".`)))}getLayoutProperty(i,u){const d=this.getLayer(i);if(d)return d.getLayoutProperty(u);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${i}".`)))}setPaintProperty(i,u,d,f={}){this._checkLoaded();const y=this.getLayer(i);y?c.aD(y.getPaintProperty(u),d)||(y.setPaintProperty(u,d,f)&&this._updateLayer(y),this._changed=!0,this._updatedPaintProps[i]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${i}".`)))}getPaintProperty(i,u){return this.getLayer(i).getPaintProperty(u)}setFeatureState(i,u){this._checkLoaded();const d=i.source,f=i.sourceLayer,y=this.sourceCaches[d];if(y===void 0)return void this.fire(new c.j(new Error(`The source '${d}' does not exist in the map's style.`)));const w=y.getSource().type;w==="geojson"&&f?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):w!=="vector"||f?(i.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),y.setFeatureState(f,i.id,u)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(i,u){this._checkLoaded();const d=i.source,f=this.sourceCaches[d];if(f===void 0)return void this.fire(new c.j(new Error(`The source '${d}' does not exist in the map's style.`)));const y=f.getSource().type,w=y==="vector"?i.sourceLayer:void 0;y!=="vector"||w?u&&typeof i.id!="string"&&typeof i.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):f.removeFeatureState(w,i.id,u):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(i){this._checkLoaded();const u=i.source,d=i.sourceLayer,f=this.sourceCaches[u];if(f!==void 0)return f.getSource().type!=="vector"||d?(i.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),f.getFeatureState(d,i.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${u}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const i=c.aE(this.sourceCaches,y=>y.serialize()),u=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,f=this.stylesheet;return c.aF({version:f.version,name:f.name,metadata:f.metadata,light:f.light,center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch,sprite:f.sprite,glyphs:f.glyphs,transition:f.transition,sources:i,layers:u,terrain:d},y=>y!==void 0)}_updateLayer(i){this._updatedLayers[i.id]=!0,i.source&&!this._updatedSources[i.source]&&this.sourceCaches[i.source].getSource().type!=="raster"&&(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(i){const u=w=>this._layers[w].type==="fill-extrusion",d={},f=[];for(let w=this._order.length-1;w>=0;w--){const I=this._order[w];if(u(I)){d[I]=w;for(const C of i){const P=C[I];if(P)for(const D of P)f.push(D)}}}f.sort((w,I)=>I.intersectionZ-w.intersectionZ);const y=[];for(let w=this._order.length-1;w>=0;w--){const I=this._order[w];if(u(I))for(let C=f.length-1;C>=0;C--){const P=f[C].feature;if(d[P.layer.id]{const At=nt.featureSortOrder;if(At){const Pt=At.indexOf(gt.featureIndex);return At.indexOf(xt.featureIndex)-Pt}return xt.featureIndex-gt.featureIndex});for(const gt of mt)st.push(gt)}}for(const nt in W)W[nt].forEach(ft=>{const Q=ft.feature,st=P[I[nt].source].getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=st});return W}(this._layers,w,this.sourceCaches,i,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(y)}querySourceFeatures(i,u){u&&u.filter&&this._validate(c.x.filter,"querySourceFeatures.filter",u.filter,null,u);const d=this.sourceCaches[i];return d?function(f,y){const w=f.getRenderableIds().map(P=>f.getTileByID(P)),I=[],C={};for(let P=0;PV.getTileByID(X)).sort((X,W)=>W.tileID.overscaledZ-X.tileID.overscaledZ||(X.tileID.isLessThan(W.tileID)?-1:1))}const N=this.crossTileSymbolIndex.addLayer(D,C[D.source],i.center.lng);w=w||N}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((y=y||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(k.now(),i.zoom))&&(this.pauseablePlacement=new lo(i,this.map.terrain,this._order,y,u,d,f,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,C),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(k.now()),I=!0),w&&this.pauseablePlacement.placement.setStale()),I||w)for(const P of this._order){const D=this._layers[P];D.type==="symbol"&&this.placement.updateLayerOpacities(D,C[D.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(k.now())}_releaseSymbolFadeTiles(){for(const i in this.sourceCaches)this.sourceCaches[i].releaseSymbolFadeTiles()}getImages(i,u){return c._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(u.icons);this._updateTilesForChangedImages();const f=this.sourceCaches[u.source];return f&&f.setDependencies(u.tileID.key,u.type,u.icons),d})}getGlyphs(i,u){return c._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(u.stacks),f=this.sourceCaches[u.source];return f&&f.setDependencies(u.tileID.key,u.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(i,u={}){this._checkLoaded(),i&&this._validate(c.x.glyphs,"glyphs",i,null,u)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=i,this.glyphManager.entries={},this.glyphManager.setURL(i))}addSprite(i,u,d={},f){this._checkLoaded();const y=[{id:i,url:u}],w=[...be(this.stylesheet.sprite),...y];this._validate(c.x.sprite,"sprite",w,null,d)||(this.stylesheet.sprite=w,this._loadSprite(y,!0,f))}removeSprite(i){this._checkLoaded();const u=be(this.stylesheet.sprite);if(u.find(d=>d.id===i)){if(this._spritesImagesIds[i])for(const d of this._spritesImagesIds[i])this.imageManager.removeImage(d),this._changedImages[d]=!0;u.splice(u.findIndex(d=>d.id===i),1),this.stylesheet.sprite=u.length>0?u:void 0,delete this._spritesImagesIds[i],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${i}" doesn't exists on this map.`)))}getSprite(){return be(this.stylesheet.sprite)}setSprite(i,u={},d){this._checkLoaded(),i&&this._validate(c.x.sprite,"sprite",i,null,u)||(this.stylesheet.sprite=i,i?this._loadSprite(i,!0,d):(this._unloadSprite(),d&&d(null)))}}var ku=c.X([{name:"a_pos",type:"Int16",components:2}]),Ko="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const kl={prelude:dn(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -527,7 +527,7 @@ void main() { #pragma mapbox: initialize lowp float halo_blur vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:dn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Xo),terrainDepth:dn("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Xo),terrainCoords:dn("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Xo)};function dn(_,i){const u=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=i.match(/attribute ([\w]+) ([\w]+)/g),f=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=i.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),w=y?y.concat(f):f,I={};return{fragmentSource:_=_.replace(u,(C,P,D,N,V)=>(I[V]=!0,P==="define"?` +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:dn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Ko),terrainDepth:dn("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Ko),terrainCoords:dn("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Ko)};function dn(_,i){const u=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=i.match(/attribute ([\w]+) ([\w]+)/g),f=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=i.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),w=y?y.concat(f):f,I={};return{fragmentSource:_=_.replace(u,(C,P,D,N,V)=>(I[V]=!0,P==="define"?` #ifndef HAS_UNIFORM_u_${V} varying ${D} ${N} ${V}; #else @@ -576,19 +576,20 @@ uniform ${D} ${N} u_${V}; #else ${D} ${N} ${V} = u_${V}; #endif -`}),staticAttributes:d,staticUniforms:w}}class zu{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(i,u,d,f,y,w,I,C,P){this.context=i;let D=this.boundPaintVertexBuffers.length!==f.length;for(let N=0;!D&&N({u_depth:new c.aG(yt,wt.u_depth),u_terrain:new c.aG(yt,wt.u_terrain),u_terrain_dim:new c.aH(yt,wt.u_terrain_dim),u_terrain_matrix:new c.aI(yt,wt.u_terrain_matrix),u_terrain_unpack:new c.aJ(yt,wt.u_terrain_unpack),u_terrain_exaggeration:new c.aH(yt,wt.u_terrain_exaggeration)}))(i,gt),this.binderUniforms=d?d.getUniforms(i,gt):[]}draw(i,u,d,f,y,w,I,C,P,D,N,V,X,W,J,j,nt,mt){const Q=i.gl;if(this.failedToCreate)return;if(i.program.set(this.program),i.setDepthMode(d),i.setStencilMode(f),i.setColorMode(y),i.setCullFace(w),C){i.activeTexture.set(Q.TEXTURE2),Q.bindTexture(Q.TEXTURE_2D,C.depthTexture),i.activeTexture.set(Q.TEXTURE3),Q.bindTexture(Q.TEXTURE_2D,C.texture);for(const gt in this.terrainUniforms)this.terrainUniforms[gt].set(C[gt])}for(const gt in this.fixedUniforms)this.fixedUniforms[gt].set(I[gt]);J&&J.setUniforms(i,this.binderUniforms,X,{zoom:W});let st=0;switch(u){case Q.LINES:st=2;break;case Q.TRIANGLES:st=3;break;case Q.LINE_STRIP:st=1}for(const gt of V.get()){const yt=gt.vaos||(gt.vaos={});(yt[P]||(yt[P]=new zu)).bind(i,this,D,J?J.getPaintVertexBuffers():[],N,gt.vertexOffset,j,nt,mt),Q.drawElements(u,gt.primitiveLength*st,Q.UNSIGNED_SHORT,gt.primitiveOffset*st*2)}}}function Ou(_,i,u){const d=1/_e(u,1,i.transform.tileZoom),f=Math.pow(2,u.tileID.overscaledZ),y=u.tileSize*Math.pow(2,i.transform.tileZoom)/f,w=y*(u.tileID.canonical.x+u.tileID.wrap*f),I=y*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[w>>16,I>>16],u_pixel_coord_lower:[65535&w,65535&I]}}const zl=(_,i,u,d)=>{const f=i.style.light,y=f.properties.get("position"),w=[y.x,y.y,y.z],I=function(){var P=new c.A(9);return c.A!=Float32Array&&(P[1]=0,P[2]=0,P[3]=0,P[5]=0,P[6]=0,P[7]=0),P[0]=1,P[4]=1,P[8]=1,P}();f.properties.get("anchor")==="viewport"&&function(P,D){var N=Math.sin(D),V=Math.cos(D);P[0]=V,P[1]=N,P[2]=0,P[3]=-N,P[4]=V,P[5]=0,P[6]=0,P[7]=0,P[8]=1}(I,-i.transform.angle),function(P,D,N){var V=D[0],X=D[1],W=D[2];P[0]=V*N[0]+X*N[3]+W*N[6],P[1]=V*N[1]+X*N[4]+W*N[7],P[2]=V*N[2]+X*N[5]+W*N[8]}(w,w,I);const C=f.properties.get("color");return{u_matrix:_,u_lightpos:w,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[C.r,C.g,C.b],u_vertical_gradient:+u,u_opacity:d}},zf=(_,i,u,d,f,y,w)=>c.e(zl(_,i,u,d),Ou(y,i,w),{u_height_factor:-Math.pow(2,f.overscaledZ)/w.tileSize/8}),td=_=>({u_matrix:_}),Fu=(_,i,u,d)=>c.e(td(_),Ou(u,i,d)),Of=(_,i)=>({u_matrix:_,u_world:i}),ed=(_,i,u,d,f)=>c.e(Fu(_,i,u,d),{u_world:f}),Ff=(_,i,u,d)=>{const f=_.transform;let y,w;if(d.paint.get("circle-pitch-alignment")==="map"){const I=_e(u,1,f.zoom);y=!0,w=[I,I]}else y=!1,w=f.pixelsToGLUnits;return{u_camera_to_center_distance:f.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(i.posMatrix,u,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:w}},nd=(_,i,u)=>{const d=_e(u,1,i.zoom),f=Math.pow(2,i.zoom-u.tileID.overscaledZ),y=u.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:i.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[i.pixelsToGLUnits[0]/(d*f),i.pixelsToGLUnits[1]/(d*f)],u_overscale_factor:y}},id=(_,i,u=1)=>({u_matrix:_,u_color:i,u_overlay:0,u_overlay_scale:u}),Bu=_=>({u_matrix:_}),rd=(_,i,u,d)=>({u_matrix:_,u_extrude_scale:_e(i,1,u),u_intensity:d});function od(_,i){const u=Math.pow(2,i.canonical.z),d=i.canonical.y;return[new c.Y(0,d/u).toLngLat().lat,new c.Y(0,(d+1)/u).toLngLat().lat]}const Vu=(_,i,u,d)=>{const f=_.transform;return{u_matrix:Ol(_,i,u,d),u_ratio:1/_e(i,1,f.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1]]}},sd=(_,i,u,d,f)=>c.e(Vu(_,i,u,f),{u_image:0,u_image_height:d}),ma=(_,i,u,d,f)=>{const y=_.transform,w=jr(i,y);return{u_matrix:Ol(_,i,u,f),u_texsize:i.imageAtlasTexture.size,u_ratio:1/_e(i,1,y.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[w,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Uu=(_,i,u,d,f,y)=>{const w=_.lineAtlas,I=jr(i,_.transform),C=u.layout.get("line-cap")==="round",P=w.getDash(d.from,C),D=w.getDash(d.to,C),N=P.width*f.fromScale,V=D.width*f.toScale;return c.e(Vu(_,i,u,y),{u_patternscale_a:[I/N,-P.height/2],u_patternscale_b:[I/V,-D.height/2],u_sdfgamma:w.width/(256*Math.min(N,V)*_.pixelRatio)/2,u_image:0,u_tex_y_a:P.y,u_tex_y_b:D.y,u_mix:f.t})};function jr(_,i){return 1/_e(_,1,i.tileZoom)}function Ol(_,i,u,d){return _.translatePosMatrix(d?d.posMatrix:i.tileID.posMatrix,i,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const qu=(_,i,u,d,f)=>{return{u_matrix:_,u_tl_parent:i,u_scale_parent:u,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*f.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:f.paint.get("raster-brightness-min"),u_brightness_high:f.paint.get("raster-brightness-max"),u_saturation_factor:(w=f.paint.get("raster-saturation"),w>0?1-1/(1.001-w):-w),u_contrast_factor:(y=f.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:Fl(f.paint.get("raster-hue-rotate"))};var y,w};function Fl(_){_*=Math.PI/180;const i=Math.sin(_),u=Math.cos(_);return[(2*u+1)/3,(-Math.sqrt(3)*i-u+1)/3,(Math.sqrt(3)*i-u+1)/3]}const Bl=(_,i,u,d,f,y,w,I,C,P)=>{const D=f.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:D.cameraToCenterDistance,u_pitch:D.pitch/360*2*Math.PI,u_rotate_symbol:+u,u_aspect_ratio:D.width/D.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:w,u_coord_matrix:I,u_is_text:+C,u_pitch_with_map:+d,u_texsize:P,u_texture:0}},Vl=(_,i,u,d,f,y,w,I,C,P,D)=>{const N=f.transform;return c.e(Bl(_,i,u,d,f,y,w,I,C,P),{u_gamma_scale:d?Math.cos(N._pitch)*N.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:+D})},Ul=(_,i,u,d,f,y,w,I,C,P)=>c.e(Vl(_,i,u,d,f,y,w,I,!0,C,!0),{u_texsize_icon:P,u_texture_icon:1}),Bf=(_,i,u)=>({u_matrix:_,u_opacity:i,u_color:u}),Vf=(_,i,u,d,f,y)=>c.e(function(w,I,C,P){const D=C.imageManager.getPattern(w.from.toString()),N=C.imageManager.getPattern(w.to.toString()),{width:V,height:X}=C.imageManager.getPixelSize(),W=Math.pow(2,P.tileID.overscaledZ),J=P.tileSize*Math.pow(2,C.transform.tileZoom)/W,j=J*(P.tileID.canonical.x+P.tileID.wrap*W),nt=J*P.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:D.tl,u_pattern_br_a:D.br,u_pattern_tl_b:N.tl,u_pattern_br_b:N.br,u_texsize:[V,X],u_mix:I.t,u_pattern_size_a:D.displaySize,u_pattern_size_b:N.displaySize,u_scale_a:I.fromScale,u_scale_b:I.toScale,u_tile_units_to_pixels:1/_e(P,1,C.transform.tileZoom),u_pixel_coord_upper:[j>>16,nt>>16],u_pixel_coord_lower:[65535&j,65535&nt]}}(d,y,u,f),{u_matrix:_,u_opacity:i}),ad={fillExtrusion:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_lightpos:new c.aK(_,i.u_lightpos),u_lightintensity:new c.aH(_,i.u_lightintensity),u_lightcolor:new c.aK(_,i.u_lightcolor),u_vertical_gradient:new c.aH(_,i.u_vertical_gradient),u_opacity:new c.aH(_,i.u_opacity)}),fillExtrusionPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_lightpos:new c.aK(_,i.u_lightpos),u_lightintensity:new c.aH(_,i.u_lightintensity),u_lightcolor:new c.aK(_,i.u_lightcolor),u_vertical_gradient:new c.aH(_,i.u_vertical_gradient),u_height_factor:new c.aH(_,i.u_height_factor),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade),u_opacity:new c.aH(_,i.u_opacity)}),fill:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix)}),fillPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),fillOutline:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world)}),fillOutlinePattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),circle:(_,i)=>({u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_scale_with_map:new c.aG(_,i.u_scale_with_map),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_extrude_scale:new c.aL(_,i.u_extrude_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_matrix:new c.aI(_,i.u_matrix)}),collisionBox:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pixels_to_tile_units:new c.aH(_,i.u_pixels_to_tile_units),u_extrude_scale:new c.aL(_,i.u_extrude_scale),u_overscale_factor:new c.aH(_,i.u_overscale_factor)}),collisionCircle:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_inv_matrix:new c.aI(_,i.u_inv_matrix),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_viewport_size:new c.aL(_,i.u_viewport_size)}),debug:(_,i)=>({u_color:new c.aM(_,i.u_color),u_matrix:new c.aI(_,i.u_matrix),u_overlay:new c.aG(_,i.u_overlay),u_overlay_scale:new c.aH(_,i.u_overlay_scale)}),clippingMask:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix)}),heatmap:(_,i)=>({u_extrude_scale:new c.aH(_,i.u_extrude_scale),u_intensity:new c.aH(_,i.u_intensity),u_matrix:new c.aI(_,i.u_matrix)}),heatmapTexture:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world),u_image:new c.aG(_,i.u_image),u_color_ramp:new c.aG(_,i.u_color_ramp),u_opacity:new c.aH(_,i.u_opacity)}),hillshade:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_latrange:new c.aL(_,i.u_latrange),u_light:new c.aL(_,i.u_light),u_shadow:new c.aM(_,i.u_shadow),u_highlight:new c.aM(_,i.u_highlight),u_accent:new c.aM(_,i.u_accent)}),hillshadePrepare:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_dimension:new c.aL(_,i.u_dimension),u_zoom:new c.aH(_,i.u_zoom),u_unpack:new c.aJ(_,i.u_unpack)}),line:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels)}),lineGradient:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_image:new c.aG(_,i.u_image),u_image_height:new c.aH(_,i.u_image_height)}),linePattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texsize:new c.aL(_,i.u_texsize),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_image:new c.aG(_,i.u_image),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),lineSDF:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_patternscale_a:new c.aL(_,i.u_patternscale_a),u_patternscale_b:new c.aL(_,i.u_patternscale_b),u_sdfgamma:new c.aH(_,i.u_sdfgamma),u_image:new c.aG(_,i.u_image),u_tex_y_a:new c.aH(_,i.u_tex_y_a),u_tex_y_b:new c.aH(_,i.u_tex_y_b),u_mix:new c.aH(_,i.u_mix)}),raster:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_tl_parent:new c.aL(_,i.u_tl_parent),u_scale_parent:new c.aH(_,i.u_scale_parent),u_buffer_scale:new c.aH(_,i.u_buffer_scale),u_fade_t:new c.aH(_,i.u_fade_t),u_opacity:new c.aH(_,i.u_opacity),u_image0:new c.aG(_,i.u_image0),u_image1:new c.aG(_,i.u_image1),u_brightness_low:new c.aH(_,i.u_brightness_low),u_brightness_high:new c.aH(_,i.u_brightness_high),u_saturation_factor:new c.aH(_,i.u_saturation_factor),u_contrast_factor:new c.aH(_,i.u_contrast_factor),u_spin_weights:new c.aK(_,i.u_spin_weights)}),symbolIcon:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texture:new c.aG(_,i.u_texture)}),symbolSDF:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texture:new c.aG(_,i.u_texture),u_gamma_scale:new c.aH(_,i.u_gamma_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_is_halo:new c.aG(_,i.u_is_halo)}),symbolTextAndIcon:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texsize_icon:new c.aL(_,i.u_texsize_icon),u_texture:new c.aG(_,i.u_texture),u_texture_icon:new c.aG(_,i.u_texture_icon),u_gamma_scale:new c.aH(_,i.u_gamma_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_is_halo:new c.aG(_,i.u_is_halo)}),background:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_opacity:new c.aH(_,i.u_opacity),u_color:new c.aM(_,i.u_color)}),backgroundPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_opacity:new c.aH(_,i.u_opacity),u_image:new c.aG(_,i.u_image),u_pattern_tl_a:new c.aL(_,i.u_pattern_tl_a),u_pattern_br_a:new c.aL(_,i.u_pattern_br_a),u_pattern_tl_b:new c.aL(_,i.u_pattern_tl_b),u_pattern_br_b:new c.aL(_,i.u_pattern_br_b),u_texsize:new c.aL(_,i.u_texsize),u_mix:new c.aH(_,i.u_mix),u_pattern_size_a:new c.aL(_,i.u_pattern_size_a),u_pattern_size_b:new c.aL(_,i.u_pattern_size_b),u_scale_a:new c.aH(_,i.u_scale_a),u_scale_b:new c.aH(_,i.u_scale_b),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aH(_,i.u_tile_units_to_pixels)}),terrain:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texture:new c.aG(_,i.u_texture),u_ele_delta:new c.aH(_,i.u_ele_delta)}),terrainDepth:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ele_delta:new c.aH(_,i.u_ele_delta)}),terrainCoords:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texture:new c.aG(_,i.u_texture),u_terrain_coords_id:new c.aH(_,i.u_terrain_coords_id),u_ele_delta:new c.aH(_,i.u_ele_delta)})};class Uf{constructor(i,u,d){this.context=i;const f=i.gl;this.buffer=f.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const u=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ga={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Gu{constructor(i,u,d,f){this.length=u.length,this.attributes=d,this.itemSize=u.bytesPerElement,this.dynamicDraw=f,this.context=i;const y=i.gl;this.buffer=y.createBuffer(),i.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){if(i.length!==this.length)throw new Error(`Length of new data is ${i.length}, which doesn't match current length of ${this.length}`);const u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,u){for(let d=0;d0){const zt=c.F(),Bt=wt;c.aP(zt,yt.placementInvProjMatrix,_.transform.glCoordMatrix),c.aP(zt,zt,yt.placementViewportMatrix),D.push({circleArray:Pt,circleOffset:V,transform:Bt,invTransform:zt,coord:st}),N+=Pt.length/4,V=N}At&&P.draw(I,C.LINES,Ge.disabled,An.disabled,_.colorModeForRenderPass(),In.disabled,nd(wt,_.transform,gt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(st),u.id,At.layoutVertexBuffer,At.indexBuffer,At.segments,null,_.transform.zoom,null,null,At.collisionVertexBuffer)}if(!w||!D.length)return;const X=_.useProgram("collisionCircle"),W=new c.aQ;W.resize(4*N),W._trim();let J=0;for(const Q of D)for(let st=0;st=0&&(W[j.associatedIconIndex]={shiftedAnchor:Ie,angle:Vt})}else Ct(j.numGlyphs,V)}if(P){X.clear();const J=_.icon.placedSymbolArray;for(let j=0;j_.style.map.terrain.getElevation(At,uo,vi):null,jn=u.layout.get("text-rotation-alignment")==="map";F(zt,At.posMatrix,_,f,Hr,Qo,j,P,jn,yi)}const Ks=_.translatePosMatrix(At.posMatrix,Pt,y,w),$o=nt||f&&yt||eu?Eh:Hr,_i=_.translatePosMatrix(Qo,Pt,y,w,!0),Gn=Vt&&u.paint.get(f?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let zn;zn=Vt?zt.iconsInText?Ul(le.kind,fe,mt,j,_,Ks,$o,_i,De,Si):Vl(le.kind,fe,mt,j,_,Ks,$o,_i,f,De,!0):Bl(le.kind,fe,mt,j,_,Ks,$o,_i,f,De);const lo={program:je,buffers:Bt,uniformValues:zn,atlasTexture:Kn,atlasTextureIcon:qn,atlasInterpolation:fn,atlasInterpolationIcon:Zr,isSDF:Vt,hasHalo:Gn};if(Q&&zt.canOverlap){st=!0;const yi=Bt.segments.get();for(const jn of yi)wt.push({segments:new c.$([jn]),sortKey:jn.sortKey,state:lo,terrainData:Le})}else wt.push({segments:Bt.segments,sortKey:0,state:lo,terrainData:Le})}st&&wt.sort((At,Pt)=>At.sortKey-Pt.sortKey);for(const At of wt){const Pt=At.state;if(V.activeTexture.set(X.TEXTURE0),Pt.atlasTexture.bind(Pt.atlasInterpolation,X.CLAMP_TO_EDGE),Pt.atlasTextureIcon&&(V.activeTexture.set(X.TEXTURE1),Pt.atlasTextureIcon&&Pt.atlasTextureIcon.bind(Pt.atlasInterpolationIcon,X.CLAMP_TO_EDGE)),Pt.isSDF){const zt=Pt.uniformValues;Pt.hasHalo&&(zt.u_is_halo=1,gd(Pt.buffers,At.segments,u,_,Pt.program,gt,D,N,zt,At.terrainData)),zt.u_is_halo=0}gd(Pt.buffers,At.segments,u,_,Pt.program,gt,D,N,Pt.uniformValues,At.terrainData)}}function gd(_,i,u,d,f,y,w,I,C,P){const D=d.context;f.draw(D,D.gl.TRIANGLES,y,w,I,In.disabled,C,P,u.id,_.layoutVertexBuffer,_.indexBuffer,i,u.paint,d.transform.zoom,_.programConfigurations.get(u.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function tc(_,i,u,d,f){if(!u||!d||!d.imageAtlas)return;const y=d.imageAtlas.patternPositions;let w=y[u.to.toString()],I=y[u.from.toString()];if(!w&&I&&(w=I),!I&&w&&(I=w),!w||!I){const C=f.getPaintProperty(i);w=y[C],I=y[C]}w&&I&&_.setConstantPatternPositions(w,I)}function _d(_,i,u,d,f,y,w){const I=_.context.gl,C="fill-pattern",P=u.paint.get(C),D=P&&P.constantOr(1),N=u.getCrossfadeParameters();let V,X,W,J,j;w?(X=D&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",V=I.LINES):(X=D?"fillPattern":"fill",V=I.TRIANGLES);const nt=P.constantOr(null);for(const mt of d){const Q=i.getTile(mt);if(D&&!Q.patternsLoaded())continue;const st=Q.getBucket(u);if(!st)continue;const gt=st.programConfigurations.get(u.id),yt=_.useProgram(X,gt),wt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(mt);D&&(_.context.activeTexture.set(I.TEXTURE0),Q.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),gt.updatePaintBuffers(N)),tc(gt,C,nt,Q,u);const At=wt?mt:null,Pt=_.translatePosMatrix(At?At.posMatrix:mt.posMatrix,Q,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(w){J=st.indexBuffer2,j=st.segments2;const zt=[I.drawingBufferWidth,I.drawingBufferHeight];W=X==="fillOutlinePattern"&&D?ed(Pt,_,N,Q,zt):Of(Pt,zt)}else J=st.indexBuffer,j=st.segments,W=D?Fu(Pt,_,N,Q):td(Pt);yt.draw(_.context,V,f,_.stencilModeForClipping(mt),y,In.disabled,W,wt,u.id,st.layoutVertexBuffer,J,j,u.paint,_.transform.zoom,gt)}}function ec(_,i,u,d,f,y,w){const I=_.context,C=I.gl,P="fill-extrusion-pattern",D=u.paint.get(P),N=D.constantOr(1),V=u.getCrossfadeParameters(),X=u.paint.get("fill-extrusion-opacity"),W=D.constantOr(null);for(const J of d){const j=i.getTile(J),nt=j.getBucket(u);if(!nt)continue;const mt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(J),Q=nt.programConfigurations.get(u.id),st=_.useProgram(N?"fillExtrusionPattern":"fillExtrusion",Q);N&&(_.context.activeTexture.set(C.TEXTURE0),j.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Q.updatePaintBuffers(V)),tc(Q,P,W,j,u);const gt=_.translatePosMatrix(J.posMatrix,j,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),yt=u.paint.get("fill-extrusion-vertical-gradient"),wt=N?zf(gt,_,yt,X,J,V,j):zl(gt,_,yt,X);st.draw(I,I.gl.TRIANGLES,f,y,w,In.backCCW,wt,mt,u.id,nt.layoutVertexBuffer,nt.indexBuffer,nt.segments,u.paint,_.transform.zoom,Q,_.style.map.terrain&&nt.centroidVertexBuffer)}}function nc(_,i,u,d,f,y,w){const I=_.context,C=I.gl,P=u.fbo;if(!P)return;const D=_.useProgram("hillshade"),N=_.style.map.terrain&&_.style.map.terrain.getTerrainData(i);I.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,P.colorAttachment.get()),D.draw(I,C.TRIANGLES,f,y,w,In.disabled,((V,X,W,J)=>{const j=W.paint.get("hillshade-shadow-color"),nt=W.paint.get("hillshade-highlight-color"),mt=W.paint.get("hillshade-accent-color");let Q=W.paint.get("hillshade-illumination-direction")*(Math.PI/180);W.paint.get("hillshade-illumination-anchor")==="viewport"&&(Q-=V.transform.angle);const st=!V.options.moving;return{u_matrix:J?J.posMatrix:V.transform.calculatePosMatrix(X.tileID.toUnwrapped(),st),u_image:0,u_latrange:od(0,X.tileID),u_light:[W.paint.get("hillshade-exaggeration"),Q],u_shadow:j,u_highlight:nt,u_accent:mt}})(_,u,d,N?i:null),N,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function Sh(_,i,u,d,f,y){const w=_.context,I=w.gl,C=i.dem;if(C&&C.data){const P=C.dim,D=C.stride,N=C.getPixels();if(w.activeTexture.set(I.TEXTURE1),w.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||_.getTileTexture(D),i.demTexture){const X=i.demTexture;X.update(N,{premultiply:!1}),X.bind(I.NEAREST,I.CLAMP_TO_EDGE)}else i.demTexture=new Nt(w,N,I.RGBA,{premultiply:!1}),i.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);w.activeTexture.set(I.TEXTURE0);let V=i.fbo;if(!V){const X=new Nt(w,{width:P,height:P,data:null},I.RGBA);X.bind(I.LINEAR,I.CLAMP_TO_EDGE),V=i.fbo=w.createFramebuffer(P,P,!0,!1),V.colorAttachment.set(X.texture)}w.bindFramebuffer.set(V.framebuffer),w.viewport.set([0,0,P,P]),_.useProgram("hillshadePrepare").draw(w,I.TRIANGLES,d,f,y,In.disabled,((X,W)=>{const J=W.stride,j=c.F();return c.aN(j,0,c.W,-c.W,0,0,1),c.H(j,j,[0,-c.W,0]),{u_matrix:j,u_image:1,u_dimension:[J,J],u_zoom:X.overscaledZ,u_unpack:W.getUnpackVector()}})(i.tileID,C),null,u.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function yd(_,i,u,d,f,y){const w=d.paint.get("raster-fade-duration");if(!y&&w>0){const I=k.now(),C=(I-_.timeAdded)/w,P=i?(I-i.timeAdded)/w:-1,D=u.getSource(),N=f.coveringZoomLevel({tileSize:D.tileSize,roundZoom:D.roundZoom}),V=!i||Math.abs(i.tileID.overscaledZ-N)>Math.abs(_.tileID.overscaledZ-N),X=V&&_.refreshedUponExpiration?1:c.ac(V?C:1-P,0,1);return _.refreshedUponExpiration&&C>=1&&(_.refreshedUponExpiration=!1),i?{opacity:1,mix:1-X}:{opacity:X,mix:0}}return{opacity:1,mix:0}}const vd=new c.aO(1,0,0,1),ic=new c.aO(0,1,0,1),Ch=new c.aO(0,0,1,1),Kf=new c.aO(1,0,1,1),xd=new c.aO(0,1,1,1);function Xn(_,i,u,d){fr(_,0,i+u/2,_.transform.width,u,d)}function Zs(_,i,u,d){fr(_,i-u/2,0,u,_.transform.height,d)}function fr(_,i,u,d,f,y){const w=_.context,I=w.gl;I.enable(I.SCISSOR_TEST),I.scissor(i*_.pixelRatio,u*_.pixelRatio,d*_.pixelRatio,f*_.pixelRatio),w.clear({color:y}),I.disable(I.SCISSOR_TEST)}function Th(_,i,u){const d=_.context,f=d.gl,y=u.posMatrix,w=_.useProgram("debug"),I=Ge.disabled,C=An.disabled,P=_.colorModeForRenderPass(),D="$debug",N=_.style.map.terrain&&_.style.map.terrain.getTerrainData(u);d.activeTexture.set(f.TEXTURE0);const V=i.getTileByID(u.key).latestRawTileData,X=Math.floor((V&&V.byteLength||0)/1024),W=i.getTile(u).tileSize,J=512/Math.min(W,512)*(u.overscaledZ/_.transform.zoom)*.5;let j=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(j+=` => ${u.overscaledZ}`),function(nt,mt){nt.initDebugOverlayCanvas();const Q=nt.debugOverlayCanvas,st=nt.context.gl,gt=nt.debugOverlayCanvas.getContext("2d");gt.clearRect(0,0,Q.width,Q.height),gt.shadowColor="white",gt.shadowBlur=2,gt.lineWidth=1.5,gt.strokeStyle="white",gt.textBaseline="top",gt.font="bold 36px Open Sans, sans-serif",gt.fillText(mt,5,5),gt.strokeText(mt,5,5),nt.debugOverlayTexture.update(Q),nt.debugOverlayTexture.bind(st.LINEAR,st.CLAMP_TO_EDGE)}(_,`${j} ${X}kB`),w.draw(d,f.TRIANGLES,I,C,li.alphaBlended,In.disabled,id(y,c.aO.transparent,J),null,D,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),w.draw(d,f.LINE_STRIP,I,C,P,In.disabled,id(y,c.aO.red),N,D,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function rc(_,i,u){const d=_.context,f=d.gl,y=_.colorModeForRenderPass(),w=new Ge(f.LEQUAL,Ge.ReadWrite,_.depthRangeFor3D),I=_.useProgram("terrain"),C=i.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const P of u){const D=_.renderToTexture.getTexture(P),N=i.getTerrainData(P.tileID);d.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,D.texture);const V={u_matrix:_.transform.calculatePosMatrix(P.tileID.toUnwrapped()),u_texture:0,u_ele_delta:i.getMeshFrameDelta(_.transform.zoom)};I.draw(d,f.TRIANGLES,w,An.disabled,y,In.backCCW,V,N,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}class bd{constructor(i,u){this.context=new Yf(i),this.transform=u,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Qi.maxUnderzooming+Qi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Gs}resize(i,u,d){if(this.width=Math.floor(i*d),this.height=Math.floor(u*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const f of this.style._order)this.style._layers[f].resize()}setup(){const i=this.context,u=new c.aV;u.emplaceBack(0,0),u.emplaceBack(c.W,0),u.emplaceBack(0,c.W),u.emplaceBack(c.W,c.W),this.tileExtentBuffer=i.createVertexBuffer(u,ku.members),this.tileExtentSegments=c.$.simpleSegment(0,0,4,2);const d=new c.aV;d.emplaceBack(0,0),d.emplaceBack(c.W,0),d.emplaceBack(0,c.W),d.emplaceBack(c.W,c.W),this.debugBuffer=i.createVertexBuffer(d,ku.members),this.debugSegments=c.$.simpleSegment(0,0,4,5);const f=new c.Z;f.emplaceBack(0,0,0,0),f.emplaceBack(c.W,0,c.W,0),f.emplaceBack(0,c.W,0,c.W),f.emplaceBack(c.W,c.W,c.W,c.W),this.rasterBoundsBuffer=i.createVertexBuffer(f,Oe.members),this.rasterBoundsSegments=c.$.simpleSegment(0,0,4,2);const y=new c.aV;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(y,ku.members),this.viewportSegments=c.$.simpleSegment(0,0,4,2);const w=new c.aW;w.emplaceBack(0),w.emplaceBack(1),w.emplaceBack(3),w.emplaceBack(2),w.emplaceBack(0),this.tileBorderIndexBuffer=i.createIndexBuffer(w);const I=new c.aX;I.emplaceBack(0,1,2),I.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(I);const C=this.context.gl;this.stencilClearMode=new An({func:C.ALWAYS,mask:0},0,255,C.ZERO,C.ZERO,C.ZERO)}clearStencil(){const i=this.context,u=i.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=c.F();c.aN(d,0,this.width,this.height,0,0,1),c.J(d,d,[u.drawingBufferWidth,u.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(i,u.TRIANGLES,Ge.disabled,this.stencilClearMode,li.disabled,In.disabled,Bu(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(i,u){if(this.currentStencilSource===i.source||!i.isTileClipped()||!u||!u.length)return;this.currentStencilSource=i.source;const d=this.context,f=d.gl;this.nextStencilID+u.length>256&&this.clearStencil(),d.setColorMode(li.disabled),d.setDepthMode(Ge.disabled);const y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const w of u){const I=this._tileClippingMaskIDs[w.key]=this.nextStencilID++,C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(w);y.draw(d,f.TRIANGLES,Ge.disabled,new An({func:f.ALWAYS,mask:0},I,255,f.KEEP,f.KEEP,f.REPLACE),li.disabled,In.disabled,Bu(w.posMatrix),C,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const i=this.nextStencilID++,u=this.context.gl;return new An({func:u.NOTEQUAL,mask:255},i,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(i){const u=this.context.gl;return new An({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(i){const u=this.context.gl,d=i.sort((w,I)=>I.overscaledZ-w.overscaledZ),f=d[d.length-1].overscaledZ,y=d[0].overscaledZ-f+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();const w={};for(let I=0;I=0;this.currentLayer--){const C=this.style._layers[d[this.currentLayer]],P=f[C.source],D=y[C.source];this._renderTileClippingMasks(C,D),this.renderLayer(this,P,C,D)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerj.source&&!j.isHidden(D)?[P.sourceCaches[j.source]]:[]),X=V.filter(j=>j.getSource().type==="vector"),W=V.filter(j=>j.getSource().type!=="vector"),J=j=>{(!N||N.getSource().maxzoomJ(j)),N||W.forEach(j=>J(j)),N}(this.style,this.transform.zoom);C&&function(P,D,N){for(let V=0;V0),f&&(c.a_(u,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(y,w){const I=y.context,C=I.gl,P=li.unblended,D=new Ge(C.LEQUAL,Ge.ReadWrite,[0,1]),N=w.getTerrainMesh(),V=w.sourceCache.getRenderableTiles(),X=y.useProgram("terrainDepth");I.bindFramebuffer.set(w.getFramebuffer("depth").framebuffer),I.viewport.set([0,0,y.width/devicePixelRatio,y.height/devicePixelRatio]),I.clear({color:c.aO.transparent,depth:1});for(const W of V){const J=w.getTerrainData(W.tileID),j={u_matrix:y.transform.calculatePosMatrix(W.tileID.toUnwrapped()),u_ele_delta:w.getMeshFrameDelta(y.transform.zoom)};X.draw(I,C.TRIANGLES,D,An.disabled,P,In.backCCW,j,J,"terrain",N.vertexBuffer,N.indexBuffer,N.segments)}I.bindFramebuffer.set(null),I.viewport.set([0,0,y.width,y.height])}(this,this.style.map.terrain),function(y,w){const I=y.context,C=I.gl,P=li.unblended,D=new Ge(C.LEQUAL,Ge.ReadWrite,[0,1]),N=w.getTerrainMesh(),V=w.getCoordsTexture(),X=w.sourceCache.getRenderableTiles(),W=y.useProgram("terrainCoords");I.bindFramebuffer.set(w.getFramebuffer("coords").framebuffer),I.viewport.set([0,0,y.width/devicePixelRatio,y.height/devicePixelRatio]),I.clear({color:c.aO.transparent,depth:1}),w.coordsIndex=[];for(const J of X){const j=w.getTerrainData(J.tileID);I.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,V.texture);const nt={u_matrix:y.transform.calculatePosMatrix(J.tileID.toUnwrapped()),u_terrain_coords_id:(255-w.coordsIndex.length)/255,u_texture:0,u_ele_delta:w.getMeshFrameDelta(y.transform.zoom)};W.draw(I,C.TRIANGLES,D,An.disabled,P,In.backCCW,nt,j,"terrain",N.vertexBuffer,N.indexBuffer,N.segments),w.coordsIndex.push(J.tileID.key)}I.bindFramebuffer.set(null),I.viewport.set([0,0,y.width,y.height])}(this,this.style.map.terrain))}renderLayer(i,u,d,f){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(f||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(y,w,I,C,P){if(y.renderPass!=="translucent")return;const D=An.disabled,N=y.colorModeForRenderPass();(I._unevaluatedLayout.hasValue("text-variable-anchor")||I._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(V,X,W,J,j,nt,mt){const Q=X.transform,st=j==="map",gt=nt==="map";for(const yt of V){const wt=J.getTile(yt),At=wt.getBucket(W);if(!At||!At.text||!At.text.segments.get().length)continue;const Pt=c.ag(At.textSizeData,Q.zoom),zt=_e(wt,1,X.transform.zoom),Bt=be(yt.posMatrix,gt,st,X.transform,zt),Ie=W.layout.get("icon-text-fit")!=="none"&&At.hasIconData();if(Pt){const Vt=Math.pow(2,Q.zoom-wt.tileID.overscaledZ);Ju(At,st,gt,mt,Q,Bt,yt.posMatrix,Vt,Pt,Ie,X.style.map.terrain?(le,Ee)=>X.style.map.terrain.getElevation(yt,le,Ee):null)}}}(C,y,I,w,I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),P),I.paint.get("icon-opacity").constantOr(1)!==0&&$u(y,w,I,C,!1,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),I.layout.get("icon-rotation-alignment"),I.layout.get("icon-pitch-alignment"),I.layout.get("icon-keep-upright"),D,N),I.paint.get("text-opacity").constantOr(1)!==0&&$u(y,w,I,C,!0,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.layout.get("text-keep-upright"),D,N),w.map.showCollisionBoxes&&(Ku(y,w,I,C,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),!0),Ku(y,w,I,C,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),!1))})(i,u,d,f,this.style.placement.variableOffsets);break;case"circle":(function(y,w,I,C){if(y.renderPass!=="translucent")return;const P=I.paint.get("circle-opacity"),D=I.paint.get("circle-stroke-width"),N=I.paint.get("circle-stroke-opacity"),V=!I.layout.get("circle-sort-key").isConstant();if(P.constantOr(1)===0&&(D.constantOr(1)===0||N.constantOr(1)===0))return;const X=y.context,W=X.gl,J=y.depthModeForSublayer(0,Ge.ReadOnly),j=An.disabled,nt=y.colorModeForRenderPass(),mt=[];for(let Q=0;QQ.sortKey-st.sortKey);for(const Q of mt){const{programConfiguration:st,program:gt,layoutVertexBuffer:yt,indexBuffer:wt,uniformValues:At,terrainData:Pt}=Q.state;gt.draw(X,W.TRIANGLES,J,j,nt,In.disabled,At,Pt,I.id,yt,wt,Q.segments,I.paint,y.transform.zoom,st)}})(i,u,d,f);break;case"heatmap":(function(y,w,I,C){if(I.paint.get("heatmap-opacity")!==0)if(y.renderPass==="offscreen"){const P=y.context,D=P.gl,N=An.disabled,V=new li([D.ONE,D.ONE],c.aO.transparent,[!0,!0,!0,!0]);(function(X,W,J){const j=X.gl;X.activeTexture.set(j.TEXTURE1),X.viewport.set([0,0,W.width/4,W.height/4]);let nt=J.heatmapFbo;if(nt)j.bindTexture(j.TEXTURE_2D,nt.colorAttachment.get()),X.bindFramebuffer.set(nt.framebuffer);else{const mt=j.createTexture();j.bindTexture(j.TEXTURE_2D,mt),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.LINEAR),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.LINEAR),nt=J.heatmapFbo=X.createFramebuffer(W.width/4,W.height/4,!1,!1),function(Q,st,gt,yt){var wt,At;const Pt=Q.gl,zt=(wt=Q.HALF_FLOAT)!==null&&wt!==void 0?wt:Pt.UNSIGNED_BYTE,Bt=(At=Q.RGBA16F)!==null&&At!==void 0?At:Pt.RGBA;Pt.texImage2D(Pt.TEXTURE_2D,0,Bt,st.width/4,st.height/4,0,Pt.RGBA,zt,null),yt.colorAttachment.set(gt)}(X,W,mt,nt)}})(P,y,I),P.clear({color:c.aO.transparent});for(let X=0;X{const Q=c.F();c.aN(Q,0,J.width,J.height,0,0,1);const st=J.context.gl;return{u_matrix:Q,u_world:[st.drawingBufferWidth,st.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:j.paint.get("heatmap-opacity")}})(P,D),null,D.id,P.viewportBuffer,P.quadTriangleIndexBuffer,P.viewportSegments,D.paint,P.transform.zoom)}(y,I))})(i,u,d,f);break;case"line":(function(y,w,I,C){if(y.renderPass!=="translucent")return;const P=I.paint.get("line-opacity"),D=I.paint.get("line-width");if(P.constantOr(1)===0||D.constantOr(1)===0)return;const N=y.depthModeForSublayer(0,Ge.ReadOnly),V=y.colorModeForRenderPass(),X=I.paint.get("line-dasharray"),W=I.paint.get("line-pattern"),J=W.constantOr(1),j=I.paint.get("line-gradient"),nt=I.getCrossfadeParameters(),mt=J?"linePattern":X?"lineSDF":j?"lineGradient":"line",Q=y.context,st=Q.gl;let gt=!0;for(const yt of C){const wt=w.getTile(yt);if(J&&!wt.patternsLoaded())continue;const At=wt.getBucket(I);if(!At)continue;const Pt=At.programConfigurations.get(I.id),zt=y.context.program.get(),Bt=y.useProgram(mt,Pt),Ie=gt||Bt.program!==zt,Vt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(yt),le=W.constantOr(null);if(le&&wt.imageAtlas){const fe=wt.imageAtlas,Le=fe.patternPositions[le.to.toString()],De=fe.patternPositions[le.from.toString()];Le&&De&&Pt.setConstantPatternPositions(Le,De)}const Ee=Vt?yt:null,je=J?ma(y,wt,I,nt,Ee):X?Uu(y,wt,I,X,nt,Ee):j?sd(y,wt,I,At.lineClipsArray.length,Ee):Vu(y,wt,I,Ee);if(J)Q.activeTexture.set(st.TEXTURE0),wt.imageAtlasTexture.bind(st.LINEAR,st.CLAMP_TO_EDGE),Pt.updatePaintBuffers(nt);else if(X&&(Ie||y.lineAtlas.dirty))Q.activeTexture.set(st.TEXTURE0),y.lineAtlas.bind(Q);else if(j){const fe=At.gradients[I.id];let Le=fe.texture;if(I.gradientVersion!==fe.version){let De=256;if(I.stepInterpolant){const Kn=w.getSource().maxzoom,fn=yt.canonical.z===Kn?Math.ceil(1<0?u.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const u=this.imageManager.getPattern(i.from.toString()),d=this.imageManager.getPattern(i.to.toString());return!u||!d}useProgram(i,u){this.cache=this.cache||{};const d=i+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new js(this.context,kl[i],u,ad[i],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}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 i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Nt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:i,drawingBufferHeight:u}=this.context.gl;return this.width!==i||this.height!==u}}class Hs{constructor(i,u){this.points=i,this.planes=u}static fromInvProjectionMatrix(i,u,d){const f=Math.pow(2,d),y=[[-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 C=1/(I=c.af([],I,i))[3]/u*f;return c.a$(I,I,[C,C,1/I[3],C])}),w=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(I=>{const C=function(V,X){var W=X[0],J=X[1],j=X[2],nt=W*W+J*J+j*j;return nt>0&&(nt=1/Math.sqrt(nt)),V[0]=X[0]*nt,V[1]=X[1]*nt,V[2]=X[2]*nt,V}([],function(V,X,W){var J=X[0],j=X[1],nt=X[2],mt=W[0],Q=W[1],st=W[2];return V[0]=j*st-nt*Q,V[1]=nt*mt-J*st,V[2]=J*Q-j*mt,V}([],Pe([],y[I[0]],y[I[1]]),Pe([],y[I[2]],y[I[1]]))),P=-((D=C)[0]*(N=y[I[1]])[0]+D[1]*N[1]+D[2]*N[2]);var D,N;return C.concat(P)});return new Hs(y,w)}}class Ws{constructor(i,u){this.min=i,this.max=u,this.center=function(d,f,y){return d[0]=.5*f[0],d[1]=.5*f[1],d[2]=.5*f[2],d}([],function(d,f,y){return d[0]=f[0]+y[0],d[1]=f[1]+y[1],d[2]=f[2]+y[2],d}([],this.min,this.max))}quadrant(i){const u=[i%2==0,i<2],d=Be(this.min),f=Be(this.max);for(let y=0;y=0&&w++;if(w===0)return 0;w!==u.length&&(d=!1)}if(d)return 2;for(let f=0;f<3;f++){let y=Number.MAX_VALUE,w=-Number.MAX_VALUE;for(let I=0;Ithis.max[f]-this.min[f])return 0}return 1}}class $a{constructor(i=0,u=0,d=0,f=0){if(isNaN(i)||i<0||isNaN(u)||u<0||isNaN(d)||d<0||isNaN(f)||f<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=u,this.left=d,this.right=f}interpolate(i,u,d){return u.top!=null&&i.top!=null&&(this.top=c.z.number(i.top,u.top,d)),u.bottom!=null&&i.bottom!=null&&(this.bottom=c.z.number(i.bottom,u.bottom,d)),u.left!=null&&i.left!=null&&(this.left=c.z.number(i.left,u.left,d)),u.right!=null&&i.right!=null&&(this.right=c.z.number(i.right,u.right,d)),this}getCenter(i,u){const d=c.ac((this.left+i-this.right)/2,0,i),f=c.ac((this.top+u-this.bottom)/2,0,u);return new c.P(d,f)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new $a(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Lh=85.051129;class oc{constructor(i,u,d,f,y){this.tileSize=512,this._renderWorldCopies=y===void 0||!!y,this._minZoom=i||0,this._maxZoom=u||22,this._minPitch=d??0,this._maxPitch=f??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new $a,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const i=new oc(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.apply(this),i}apply(i){this.tileSize=i.tileSize,this.latRange=i.latRange,this.width=i.width,this.height=i.height,this._center=i._center,this._elevation=i._elevation,this.minElevationForCurrentTile=i.minElevationForCurrentTile,this.zoom=i.zoom,this.angle=i.angle,this._fov=i._fov,this._pitch=i._pitch,this._unmodified=i._unmodified,this._edgeInsets=i._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(i){const u=-c.b1(i,-180,180)*Math.PI/180;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=function(){var d=new c.A(4);return c.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,f,y){var w=f[0],I=f[1],C=f[2],P=f[3],D=Math.sin(y),N=Math.cos(y);d[0]=w*N+C*D,d[1]=I*N+P*D,d[2]=w*-D+C*N,d[3]=I*-D+P*N}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){const u=c.ac(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(i){const u=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.tileZoom=Math.max(0,Math.floor(u)),this.scale=this.zoomScale(u),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(i){i!==this._elevation&&(this._elevation=i,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,u,d){this._unmodified=!1,this._edgeInsets.interpolate(i,u,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){const u=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(i){const u=[new c.b2(0,i)];if(this._renderWorldCopies){const d=this.pointCoordinate(new c.P(0,0)),f=this.pointCoordinate(new c.P(this.width,0)),y=this.pointCoordinate(new c.P(this.width,this.height)),w=this.pointCoordinate(new c.P(0,this.height)),I=Math.floor(Math.min(d.x,f.x,y.x,w.x)),C=Math.floor(Math.max(d.x,f.x,y.x,w.x)),P=1;for(let D=I-P;D<=C+P;D++)D!==0&&u.push(new c.b2(D,i))}return u}coveringTiles(i){var u,d;let f=this.coveringZoomLevel(i);const y=f;if(i.minzoom!==void 0&&fi.maxzoom&&(f=i.maxzoom);const w=this.pointCoordinate(this.getCameraPoint()),I=c.Y.fromLngLat(this.center),C=Math.pow(2,f),P=[C*w.x,C*w.y,0],D=[C*I.x,C*I.y,0],N=Hs.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,f);let V=i.minzoom||0;!i.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(V=f);const X=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,W=Q=>({aabb:new Ws([Q*C,0,0],[(Q+1)*C,C,0]),zoom:0,x:0,y:0,wrap:Q,fullyVisible:!1}),J=[],j=[],nt=f,mt=i.reparseOverscaled?y:f;if(this._renderWorldCopies)for(let Q=1;Q<=3;Q++)J.push(W(-Q)),J.push(W(Q));for(J.push(W(0));J.length>0;){const Q=J.pop(),st=Q.x,gt=Q.y;let yt=Q.fullyVisible;if(!yt){const Bt=Q.aabb.intersects(N);if(Bt===0)continue;yt=Bt===2}const wt=i.terrain?P:D,At=Q.aabb.distanceX(wt),Pt=Q.aabb.distanceY(wt),zt=Math.max(Math.abs(At),Math.abs(Pt));if(Q.zoom===nt||zt>X+(1<=V){const Bt=nt-Q.zoom,Ie=P[0]-.5-(st<>1),le=Q.zoom+1;let Ee=Q.aabb.quadrant(Bt);if(i.terrain){const je=new c.Q(le,Q.wrap,le,Ie,Vt),fe=i.terrain.getMinMaxElevation(je),Le=(u=fe.minElevation)!==null&&u!==void 0?u:this.elevation,De=(d=fe.maxElevation)!==null&&d!==void 0?d:this.elevation;Ee=new Ws([Ee.min[0],Ee.min[1],Le],[Ee.max[0],Ee.max[1],De])}J.push({aabb:Ee,zoom:le,x:Ie,y:Vt,wrap:Q.wrap,fullyVisible:yt})}}return j.sort((Q,st)=>Q.distanceSq-st.distanceSq).map(Q=>Q.tileID)}resize(i,u){this.width=i,this.height=u,this.pixelsToGLUnits=[2/i,-2/u],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){const u=c.ac(i.lat,-85.051129,Lh);return new c.P(c.N(i.lng)*this.worldSize,c.O(u)*this.worldSize)}unproject(i){return new c.Y(i.x/this.worldSize,i.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(i){const u=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,f=this.pointLocation(this.centerPoint,i),y=i.getElevationForLngLatZoom(f,this.tileZoom);if(!(this.elevation-y))return;const w=d+u-y,I=Math.cos(this._pitch)*this.cameraToCenterDistance/w/c.b3(1,f.lat),C=this.scaleZoom(I/this.tileSize);this._elevation=y,this._center=f,this.zoom=C}setLocationAtPoint(i,u){const d=this.pointCoordinate(u),f=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(i),w=new c.Y(y.x-(d.x-f.x),y.y-(d.y-f.y));this.center=this.coordinateLocation(w),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(i,u){return u?this.coordinatePoint(this.locationCoordinate(i),u.getElevationForLngLatZoom(i,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(i))}pointLocation(i,u){return this.coordinateLocation(this.pointCoordinate(i,u))}locationCoordinate(i){return c.Y.fromLngLat(i)}coordinateLocation(i){return i&&i.toLngLat()}pointCoordinate(i,u){if(u){const V=u.pointCoordinate(i);if(V!=null)return V}const d=[i.x,i.y,0,1],f=[i.x,i.y,1,1];c.af(d,d,this.pixelMatrixInverse),c.af(f,f,this.pixelMatrixInverse);const y=d[3],w=f[3],I=d[1]/y,C=f[1]/w,P=d[2]/y,D=f[2]/w,N=P===D?0:(0-P)/(D-P);return new c.Y(c.z.number(d[0]/y,f[0]/w,N)/this.worldSize,c.z.number(I,C,N)/this.worldSize)}coordinatePoint(i,u=0,d=this.pixelMatrix){const f=[i.x*this.worldSize,i.y*this.worldSize,u,1];return c.af(f,f,d),new c.P(f[0]/f[3],f[1]/f[3])}getBounds(){const i=Math.max(0,this.height/2-this.getHorizon());return new _t().extend(this.pointLocation(new c.P(0,i))).extend(this.pointLocation(new c.P(this.width,i))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new _t([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(i){i?(this.lngRange=[i.getWest(),i.getEast()],this.latRange=[i.getSouth(),i.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Lh])}calculatePosMatrix(i,u=!1){const d=i.key,f=u?this._alignedPosMatrixCache:this._posMatrixCache;if(f[d])return f[d];const y=i.canonical,w=this.worldSize/this.zoomScale(y.z),I=y.x+Math.pow(2,y.z)*i.wrap,C=c.an(new Float64Array(16));return c.H(C,C,[I*w,y.y*w,0]),c.J(C,C,[w/c.W,w/c.W,1]),c.K(C,u?this.alignedProjMatrix:this.projMatrix,C),f[d]=new Float32Array(C),f[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(i,u){u=c.ac(+u,this.minZoom,this.maxZoom);const d={center:new c.M(i.lng,i.lat),zoom:u};let f=this.lngRange;if(!this._renderWorldCopies&&f===null){const Q=179.9999999999;f=[-Q,Q]}const y=this.tileSize*this.zoomScale(d.zoom);let w=0,I=y,C=0,P=y,D=0,N=0;const{x:V,y:X}=this.size;if(this.latRange){const Q=this.latRange;w=c.O(Q[1])*y,I=c.O(Q[0])*y,I-wI&&(nt=I-Q)}if(f){const Q=(C+P)/2;let st=W;this._renderWorldCopies&&(st=c.b1(W,Q-y/2,Q+y/2));const gt=V/2;st-gtP&&(j=P-gt)}if(j!==void 0||nt!==void 0){const Q=new c.P(j??W,nt??J);d.center=this.unproject.call({worldSize:y},Q).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const i=this._unmodified,{center:u,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=u,this.zoom=d,this._unmodified=i,this._constraining=!1}_calcMatrices(){if(!this.height)return;const i=this.centerOffset,u=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b3(1,this.center.lat)*this.worldSize;let f=c.an(new Float64Array(16));c.J(f,f,[this.width/2,-this.height/2,1]),c.H(f,f,[1,-1,0]),this.labelPlaneMatrix=f,f=c.an(new Float64Array(16)),c.J(f,f,[1,-1,1]),c.H(f,f,[-1,-1,0]),c.J(f,f,[2/this.width,2/this.height,1]),this.glCoordMatrix=f;const y=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),w=Math.min(this.elevation,this.minElevationForCurrentTile),I=y-w*this._pixelPerMeter/Math.cos(this._pitch),C=w<0?I:y,P=Math.PI/2+this._pitch,D=this._fov*(.5+i.y/this.height),N=Math.sin(D)*C/Math.sin(c.ac(Math.PI-P-D,.01,Math.PI-.01)),V=this.getHorizon(),X=2*Math.atan(V/this.cameraToCenterDistance)*(.5+i.y/(2*V)),W=Math.sin(X)*C/Math.sin(c.ac(Math.PI-P-X,.01,Math.PI-.01)),J=Math.min(N,W),j=1.01*(Math.cos(Math.PI/2-this._pitch)*J+C),nt=this.height/50;f=new Float64Array(16),c.b4(f,this._fov,this.width/this.height,nt,j),f[8]=2*-i.x/this.width,f[9]=2*i.y/this.height,c.J(f,f,[1,-1,1]),c.H(f,f,[0,0,-this.cameraToCenterDistance]),c.b5(f,f,this._pitch),c.ad(f,f,this.angle),c.H(f,f,[-u,-d,0]),this.mercatorMatrix=c.J([],f,[this.worldSize,this.worldSize,this.worldSize]),c.J(f,f,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.K(new Float64Array(16),this.labelPlaneMatrix,f),c.H(f,f,[0,0,-this.elevation]),this.projMatrix=f,this.invProjMatrix=c.ar([],f),this.pixelMatrix3D=c.K(new Float64Array(16),this.labelPlaneMatrix,f);const mt=this.width%2/2,Q=this.height%2/2,st=Math.cos(this.angle),gt=Math.sin(this.angle),yt=u-Math.round(u)+st*mt+gt*Q,wt=d-Math.round(d)+st*Q+gt*mt,At=new Float64Array(f);if(c.H(At,At,[yt>.5?yt-1:yt,wt>.5?wt-1:wt,0]),this.alignedProjMatrix=At,f=c.ar(new Float64Array(16),this.pixelMatrix),!f)throw new Error("failed to invert matrix");this.pixelMatrixInverse=f,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const i=this.pointCoordinate(new c.P(0,0)),u=[i.x*this.worldSize,i.y*this.worldSize,0,1];return c.af(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,i))}getCameraQueryGeometry(i){const u=this.getCameraPoint();if(i.length===1)return[i[0],u];{let d=u.x,f=u.y,y=u.x,w=u.y;for(const I of i)d=Math.min(d,I.x),f=Math.min(f,I.y),y=Math.max(y,I.x),w=Math.max(w,I.y);return[new c.P(d,f),new c.P(y,f),new c.P(y,w),new c.P(d,w),new c.P(d,f)]}}lngLatToCameraDepth(i,u){const d=this.locationCoordinate(i),f=[d.x*this.worldSize,d.y*this.worldSize,u,1];return c.af(f,f,this.projMatrix),f[2]/f[3]}}function Ph(_,i){let u,d=!1,f=null,y=null;const w=()=>{f=null,d&&(_.apply(y,u),f=setTimeout(w,i),d=!1)};return(...I)=>(d=!0,y=this,u=I,f||w(),f)}class Ah{constructor(i){this._getCurrentHash=()=>{const u=window.location.hash.replace("#","");if(this._hashName){let d;return u.split("&").map(f=>f.split("=")).forEach(f=>{f[0]===this._hashName&&(d=f)}),(d&&d[1]||"").split("/")}return u.split("/")},this._onHashChange=()=>{const u=this._getCurrentHash();if(u.length>=3&&!u.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(u[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+u[2],+u[1]],zoom:+u[0],bearing:d,pitch:+(u[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const u=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,u)}catch{}},this._updateHash=Ph(this._updateHashUnthrottled,300),this._hashName=i&&encodeURIComponent(i)}addTo(i){return this._map=i,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(i){const u=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,f=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,f),w=Math.round(u.lng*y)/y,I=Math.round(u.lat*y)/y,C=this._map.getBearing(),P=this._map.getPitch();let D="";if(D+=i?`/${w}/${I}/${d}`:`${d}/${I}/${w}`,(C||P)&&(D+="/"+Math.round(10*C)/10),P&&(D+=`/${Math.round(P)}`),this._hashName){const N=this._hashName;let V=!1;const X=window.location.hash.slice(1).split("&").map(W=>{const J=W.split("=")[0];return J===N?(V=!0,`${J}=${D}`):W}).filter(W=>W);return V||X.push(`${N}=${D}`),`#${X.join("&")}`}return`#${D}`}}const Gl={linearity:.3,easing:c.b6(0,0,.3,1)},va=c.e({deceleration:2500,maxSpeed:1400},Gl),wd=c.e({deceleration:20,maxSpeed:1400},Gl),Id=c.e({deceleration:1e3,maxSpeed:360},Gl),Ed=c.e({deceleration:1e3,maxSpeed:90},Gl);class Sd{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:k.now(),settings:i})}_drainInertiaBuffer(){const i=this._inertiaBuffer,u=k.now();for(;i.length>0&&u-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const u={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:y}of this._inertiaBuffer)u.zoom+=y.zoomDelta||0,u.bearing+=y.bearingDelta||0,u.pitch+=y.pitchDelta||0,y.panDelta&&u.pan._add(y.panDelta),y.around&&(u.around=y.around),y.pinchAround&&(u.pinchAround=y.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,f={};if(u.pan.mag()){const y=Zl(u.pan.mag(),d,c.e({},va,i||{}));f.offset=u.pan.mult(y.amount/u.pan.mag()),f.center=this._map.transform.center,jl(f,y)}if(u.zoom){const y=Zl(u.zoom,d,wd);f.zoom=this._map.transform.zoom+y.amount,jl(f,y)}if(u.bearing){const y=Zl(u.bearing,d,Id);f.bearing=this._map.transform.bearing+c.ac(y.amount,-179,179),jl(f,y)}if(u.pitch){const y=Zl(u.pitch,d,Ed);f.pitch=this._map.transform.pitch+y.amount,jl(f,y)}if(f.zoom||f.bearing){const y=u.pinchAround===void 0?u.around:u.pinchAround;f.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),c.e(f,{noMoveStart:!0})}}function jl(_,i){(!_.duration||_.durationu.unproject(C)),I=y.reduce((C,P,D,N)=>C.add(P.div(N.length)),new c.P(0,0));super(i,{points:y,point:I,lngLats:w,lngLat:u.unproject(I),originalEvent:d}),this._defaultPrevented=!1}}class Mh extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,u,d){super(i,{originalEvent:d}),this._defaultPrevented=!1}}class wo{constructor(i,u){this._map=i,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new Mh(i.type,this._map,i))}mousedown(i,u){return this._mousedownPos=u,this._firePreventable(new Lr(i.type,this._map,i))}mouseup(i){this._map.fire(new Lr(i.type,this._map,i))}click(i,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new Lr(i.type,this._map,i))}dblclick(i){return this._firePreventable(new Lr(i.type,this._map,i))}mouseover(i){this._map.fire(new Lr(i.type,this._map,i))}mouseout(i){this._map.fire(new Lr(i.type,this._map,i))}touchstart(i){return this._firePreventable(new Yo(i.type,this._map,i))}touchmove(i){this._map.fire(new Yo(i.type,this._map,i))}touchend(i){this._map.fire(new Yo(i.type,this._map,i))}touchcancel(i){this._map.fire(new Yo(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ko{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(i){this._map.fire(new Lr(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Lr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._ignoreContextMenu||this._map.fire(new Lr(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class tl{constructor(i){this._map=i}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(i){return this.transform.pointLocation(c.P.convert(i),this._map.terrain)}}class Io{constructor(i,u){this._map=i,this._tr=new tl(i),this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=u.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,u){this.isEnabled()&&i.shiftKey&&i.button===0&&(U.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(i,u){if(!this._active)return;const d=u;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)y.fitScreenCoordinates(d,f,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",i)}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(U.remove(this._box),this._box=null),U.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,u){return this._map.fire(new c.k(i,{originalEvent:u}))}}function xa(_,i){if(_.length!==i.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${i.length}`);const u={};for(let d=0;d<_.length;d++)u[_[d].identifier]=i[d];return u}class Jf{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(i,u,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=i.timeStamp),d.length===this.numTouches&&(this.centroid=function(f){const y=new c.P(0,0);for(const w of f)y._add(w);return y.div(f.length)}(u),this.touches=xa(d,u)))}touchmove(i,u,d){if(this.aborted||!this.centroid)return;const f=xa(d,u);for(const y in this.touches){const w=f[y];(!w||w.dist(this.touches[y])>30)&&(this.aborted=!0)}}touchend(i,u,d){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const f=!this.aborted&&this.centroid;if(this.reset(),f)return f}}}class Dh{constructor(i){this.singleTap=new Jf(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,u,d){this.singleTap.touchstart(i,u,d)}touchmove(i,u,d){this.singleTap.touchmove(i,u,d)}touchend(i,u,d){const f=this.singleTap.touchend(i,u,d);if(f){const y=i.timeStamp-this.lastTime<500,w=!this.lastTap||this.lastTap.dist(f)<30;if(y&&w||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=f,this.count===this.numTaps)return this.reset(),f}}}class Qf{constructor(i){this._tr=new tl(i),this._zoomIn=new Dh({numTouches:1,numTaps:2}),this._zoomOut=new Dh({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,u,d){this._zoomIn.touchstart(i,u,d),this._zoomOut.touchstart(i,u,d)}touchmove(i,u,d){this._zoomIn.touchmove(i,u,d),this._zoomOut.touchmove(i,u,d)}touchend(i,u,d){const f=this._zoomIn.touchend(i,u,d),y=this._zoomOut.touchend(i,u,d),w=this._tr;return f?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:w.zoom+1,around:w.unproject(f)},{originalEvent:i})}):y?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:w.zoom-1,around:w.unproject(y)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class el{constructor(i){this._enabled=!!i.enable,this._moveStateManager=i.moveStateManager,this._clickTolerance=i.clickTolerance||1,this._moveFunction=i.move,this._activateOnStart=!!i.activateOnStart,i.assignEvents(this),this.reset()}reset(i){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(i)}_move(...i){const u=this._moveFunction(...i);if(u.bearingDelta||u.pitchDelta||u.around||u.panDelta)return this._active=!0,u}dragStart(i,u){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(i)&&(this._moveStateManager.startMove(i),this._lastPoint=u.length?u[0]:u,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(i,u){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(i.preventDefault(),!this._moveStateManager.isValidMoveEvent(i))return void this.reset(i);const f=u.length?u[0]:u;return!this._moved&&f.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(i){i.preventDefault()}},nl=({enable:_,clickTolerance:i,bearingDegreesPerPixelMoved:u=.8})=>{const d=new Jo({checkCorrectEvent:f=>U.mouseButton(f)===0&&f.ctrlKey||U.mouseButton(f)===2});return new el({clickTolerance:i,move:(f,y)=>({bearingDelta:(y.x-f.x)*u}),moveStateManager:d,enable:_,assignEvents:sc})},il=({enable:_,clickTolerance:i,pitchDegreesPerPixelMoved:u=-.5})=>{const d=new Jo({checkCorrectEvent:f=>U.mouseButton(f)===0&&f.ctrlKey||U.mouseButton(f)===2});return new el({clickTolerance:i,move:(f,y)=>({pitchDelta:(y.y-f.y)*u}),moveStateManager:d,enable:_,assignEvents:sc})};class Cd{constructor(i,u){this._clickTolerance=i.clickTolerance||1,this._map=u,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(i,u,d){return this._calculateTransform(i,u,d)}touchmove(i,u,d){if(this._active&&!(d.length0&&(this._active=!0);const f=xa(d,u),y=new c.P(0,0),w=new c.P(0,0);let I=0;for(const P in f){const D=f[P],N=this._touches[P];N&&(y._add(D),w._add(D.sub(N)),I++,f[P]=D)}if(this._touches=f,IMath.abs(_.x)}class Pd extends Ht{constructor(i){super(),this._currentTouchCount=0,this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(i,u,d){super.touchstart(i,u,d),this._currentTouchCount=d.length}_start(i){this._lastPoints=i,lc(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,u,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const f=i[0].sub(this._lastPoints[0]),y=i[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(f,y,d.timeStamp),this._valid?(this._lastPoints=i,this._active=!0,{pitchDelta:(f.y+y.y)/2*-.5}):void 0}gestureBeginsVertically(i,u,d){if(this._valid!==void 0)return this._valid;const f=i.mag()>=2,y=u.mag()>=2;if(!f&&!y)return;if(!f||!y)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const w=i.y>0==u.y>0;return lc(i)&&lc(u)&&w}}const $f={panStep:100,bearingStep:15,pitchStep:10};class Xs{constructor(i){this._tr=new tl(i);const u=$f;this._panStep=u.panStep,this._bearingStep=u.bearingStep,this._pitchStep=u.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let u=0,d=0,f=0,y=0,w=0;switch(i.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-1;break;case 37:i.shiftKey?d=-1:(i.preventDefault(),y=-1);break;case 39:i.shiftKey?d=1:(i.preventDefault(),y=1);break;case 38:i.shiftKey?f=1:(i.preventDefault(),w=-1);break;case 40:i.shiftKey?f=-1:(i.preventDefault(),w=1);break;default:return}return this._rotationDisabled&&(d=0,f=0),{cameraAnimation:I=>{const C=this._tr;I.easeTo({duration:300,easeId:"keyboardHandler",easing:kn,zoom:u?Math.round(C.zoom)+u*(i.shiftKey?2:1):C.zoom,bearing:C.bearing+d*this._bearingStep,pitch:C.pitch+f*this._pitchStep,offset:[-y*this._panStep,-w*this._panStep],center:C.center},{originalEvent:i})}}}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 kn(_){return _*(2-_)}const Wl=4.000244140625;class uc{constructor(i,u){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=i,this._tr=new tl(i),this._triggerRenderFrame=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&i.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(i){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!i[this._map.cooperativeGestures._bypassKey])return;let u=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY;const d=k.now(),f=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,u!==0&&u%Wl==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":f>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(f*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),i.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=i,this._delta-=u,this._active||this._start(i)),i.preventDefault()}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const u=U.mousePos(this._map.getCanvas(),i),d=this._tr;this._around=u.y>d.transform.height/2-d.transform.getHorizon()?c.M.convert(this._aroundCenter?d.center:d.unproject(u)):c.M.convert(d.center),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const i=this._tr.transform;if(this._delta!==0){const I=this._type==="wheel"&&Math.abs(this._delta)>Wl?this._wheelZoomRate:this._defaultZoomRate;let C=2/(1+Math.exp(-Math.abs(this._delta*I)));this._delta<0&&C!==0&&(C=1/C);const P=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(P*C))),this._type==="wheel"&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:i.zoom,d=this._startZoom,f=this._easing;let y,w=!1;if(this._type==="wheel"&&d&&f){const I=Math.min((k.now()-this._lastWheelEventTime)/200,1),C=f(I);y=c.z.number(d,u,C),I<1?this._frameId||(this._frameId=!0):w=!0}else y=u,w=!0;return this._active=!0,w&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!w,zoomDelta:y-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let u=c.b7;if(this._prevEase){const d=this._prevEase,f=(k.now()-d.start)/d.duration,y=d.easing(f+.01)-d.easing(f),w=.27/Math.sqrt(y*y+1e-4)*.01,I=Math.sqrt(.0729-w*w);u=c.b6(w,I,.25,1)}return this._prevEase={start:k.now(),duration:i,easing:u},u}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Nh{constructor(i,u){this._clickZoom=i,this._tapZoom=u}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 Ad{constructor(i){this._tr=new tl(i),this.reset()}reset(){this._active=!1}dblclick(i,u){return i.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(i.shiftKey?-1:1),around:this._tr.unproject(u)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Md{constructor(){this._tap=new Dh({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(i,u,d){if(!this._swipePoint)if(this._tapTime){const f=u[0],y=i.timeStamp-this._tapTime<500,w=this._tapPoint.dist(f)<30;y&&w?d.length>0&&(this._swipePoint=f,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(i,u,d)}touchmove(i,u,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const f=u[0],y=f.y-this._swipePoint.y;return this._swipePoint=f,i.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(i,u,d)}touchend(i,u,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const f=this._tap.touchend(i,u,d);f&&(this._tapTime=i.timeStamp,this._tapPoint=f)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Dd{constructor(i,u,d){this._el=i,this._mousePan=u,this._touchPan=d}enable(i){this._inertiaOptions=i||{},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 Eo{constructor(i,u,d){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=u,this._mousePitch=d}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 Xl{constructor(i,u,d,f){this._el=i,this._touchZoom=u,this._touchRotate=d,this._tapDragZoom=f,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),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 te{constructor(i,u){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=i,this._options=u,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const i=this._map.getCanvasContainer();i.classList.add("maplibregl-cooperative-gestures"),this._container=U.create("div","maplibregl-cooperative-gesture-screen",i);let u=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(u=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),f=document.createElement("div");f.className="maplibregl-desktop-message",f.textContent=u,this._container.appendChild(f);const y=document.createElement("div");y.className="maplibregl-mobile-message",y.textContent=d,this._container.appendChild(y),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(U.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(i){this._onCooperativeGesture(i.touches.length===1)}wheel(i){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!i[this._bypassKey])}_onCooperativeGesture(i){this._enabled&&i&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const ae=_=>_.zoom||_.drag||_.pitch||_.rotate;class cc extends c.k{}function Yl(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class kh{constructor(i,u){this.handleWindowEvent=f=>{this.handleEvent(f,`${f.type}Window`)},this.handleEvent=(f,y)=>{if(f.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const w=f.type==="renderFrame"?void 0:f,I={needsRenderFrame:!1},C={},P={},D=f.touches,N=D?this._getMapTouches(D):void 0,V=N?U.touchPos(this._map.getCanvas(),N):U.mousePos(this._map.getCanvas(),f);for(const{handlerName:J,handler:j,allowed:nt}of this._handlers){if(!j.isEnabled())continue;let mt;this._blockedByActive(P,nt,J)?j.reset():j[y||f.type]&&(mt=j[y||f.type](f,V,N),this.mergeHandlerResult(I,C,mt,J,w),mt&&mt.needsRenderFrame&&this._triggerRenderFrame()),(mt||j.isActive())&&(P[J]=j)}const X={};for(const J in this._previousActiveHandlers)P[J]||(X[J]=w);this._previousActiveHandlers=P,(Object.keys(X).length||Yl(I))&&(this._changes.push([I,C,X]),this._triggerRenderFrame()),(Object.keys(P).length||Yl(I))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:W}=I;W&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],W(this._map))},this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Sd(i),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[f,y,w]of this._listeners)U.addEventListener(f,y,f===document?this.handleWindowEvent:this.handleEvent,w)}destroy(){for(const[i,u,d]of this._listeners)U.removeEventListener(i,u,i===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(i){const u=this._map,d=u.getCanvasContainer();this._add("mapEvent",new wo(u,i));const f=u.boxZoom=new Io(u,i);this._add("boxZoom",f),i.interactive&&i.boxZoom&&f.enable();const y=u.cooperativeGestures=new te(u,i.cooperativeGestures);this._add("cooperativeGestures",y),i.cooperativeGestures&&y.enable();const w=new Qf(u),I=new Ad(u);u.doubleClickZoom=new Nh(I,w),this._add("tapZoom",w),this._add("clickZoom",I),i.interactive&&i.doubleClickZoom&&u.doubleClickZoom.enable();const C=new Md;this._add("tapDragZoom",C);const P=u.touchPitch=new Pd(u);this._add("touchPitch",P),i.interactive&&i.touchPitch&&u.touchPitch.enable(i.touchPitch);const D=nl(i),N=il(i);u.dragRotate=new Eo(i,D,N),this._add("mouseRotate",D,["mousePitch"]),this._add("mousePitch",N,["mouseRotate"]),i.interactive&&i.dragRotate&&u.dragRotate.enable();const V=(({enable:mt,clickTolerance:Q})=>{const st=new Jo({checkCorrectEvent:gt=>U.mouseButton(gt)===0&&!gt.ctrlKey});return new el({clickTolerance:Q,move:(gt,yt)=>({around:yt,panDelta:yt.sub(gt)}),activateOnStart:!0,moveStateManager:st,enable:mt,assignEvents:sc})})(i),X=new Cd(i,u);u.dragPan=new Dd(d,V,X),this._add("mousePan",V),this._add("touchPan",X,["touchZoom","touchRotate"]),i.interactive&&i.dragPan&&u.dragPan.enable(i.dragPan);const W=new Rh,J=new Ld;u.touchZoomRotate=new Xl(d,J,W,C),this._add("touchRotate",W,["touchPan","touchZoom"]),this._add("touchZoom",J,["touchPan","touchRotate"]),i.interactive&&i.touchZoomRotate&&u.touchZoomRotate.enable(i.touchZoomRotate);const j=u.scrollZoom=new uc(u,()=>this._triggerRenderFrame());this._add("scrollZoom",j,["mousePan"]),i.interactive&&i.scrollZoom&&u.scrollZoom.enable(i.scrollZoom);const nt=u.keyboard=new Xs(u);this._add("keyboard",nt),i.interactive&&i.keyboard&&u.keyboard.enable(),this._add("blockableMapEvent",new Ko(u))}_add(i,u,d){this._handlers.push({handlerName:i,handler:u,allowed:d}),this._handlersById[i]=u}stop(i){if(!this._updatingCamera){for(const{handler:u}of this._handlers)u.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ae(this._eventsInProgress)||this.isZooming()}_blockedByActive(i,u,d){for(const f in i)if(f!==d&&(!u||u.indexOf(f)<0))return!0;return!1}_getMapTouches(i){const u=[];for(const d of i)this._el.contains(d.target)&&u.push(d);return u}mergeHandlerResult(i,u,d,f,y){if(!d)return;c.e(i,d);const w={handlerName:f,originalEvent:d.originalEvent||y};d.zoomDelta!==void 0&&(u.zoom=w),d.panDelta!==void 0&&(u.drag=w),d.pitchDelta!==void 0&&(u.pitch=w),d.bearingDelta!==void 0&&(u.rotate=w)}_applyChanges(){const i={},u={},d={};for(const[f,y,w]of this._changes)f.panDelta&&(i.panDelta=(i.panDelta||new c.P(0,0))._add(f.panDelta)),f.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+f.zoomDelta),f.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+f.bearingDelta),f.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+f.pitchDelta),f.around!==void 0&&(i.around=f.around),f.pinchAround!==void 0&&(i.pinchAround=f.pinchAround),f.noInertia&&(i.noInertia=f.noInertia),c.e(u,y),c.e(d,w);this._updateMapTransform(i,u,d),this._changes=[]}_updateMapTransform(i,u,d){const f=this._map,y=f._getTransformForUpdate(),w=f.terrain;if(!(Yl(i)||w&&this._terrainMovement))return this._fireEvents(u,d,!0);let{panDelta:I,zoomDelta:C,bearingDelta:P,pitchDelta:D,around:N,pinchAround:V}=i;V!==void 0&&(N=V),f._stop(!0),N=N||f.transform.centerPoint;const X=y.pointLocation(I?N.sub(I):N);P&&(y.bearing+=P),D&&(y.pitch+=D),C&&(y.zoom+=C),w?this._terrainMovement||!u.drag&&!u.zoom?u.drag&&this._terrainMovement?y.center=y.pointLocation(y.centerPoint.sub(I)):y.setLocationAtPoint(X,N):(this._terrainMovement=!0,this._map._elevationFreeze=!0,y.setLocationAtPoint(X,N),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,y.recalculateZoom(f.terrain)})):y.setLocationAtPoint(X,N),f._applyUpdatedTransform(y),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(u,d,!0)}_fireEvents(i,u,d){const f=ae(this._eventsInProgress),y=ae(i),w={};for(const D in i){const{originalEvent:N}=i[D];this._eventsInProgress[D]||(w[`${D}start`]=N),this._eventsInProgress[D]=i[D]}!f&&y&&this._fireEvent("movestart",y.originalEvent);for(const D in w)this._fireEvent(D,w[D]);y&&this._fireEvent("move",y.originalEvent);for(const D in i){const{originalEvent:N}=i[D];this._fireEvent(D,N)}const I={};let C;for(const D in this._eventsInProgress){const{handlerName:N,originalEvent:V}=this._eventsInProgress[D];this._handlersById[N].isActive()||(delete this._eventsInProgress[D],C=u[N]||V,I[`${D}end`]=C)}for(const D in I)this._fireEvent(D,I[D]);const P=ae(this._eventsInProgress);if(d&&(f||y)&&!P){this._updatingCamera=!0;const D=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),N=V=>V!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new cc("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Pr extends c.E{constructor(i,u){super(),this._renderFrameCallback=()=>{const d=Math.min((k.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=u.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.M(this.transform.center.lng,this.transform.center.lat)}setCenter(i,u){return this.jumpTo({center:i},u)}panBy(i,u,d){return i=c.P.convert(i).mult(-1),this.panTo(this.transform.center,c.e({offset:i},u),d)}panTo(i,u,d){return this.easeTo(c.e({center:i},u),d)}getZoom(){return this.transform.zoom}setZoom(i,u){return this.jumpTo({zoom:i},u),this}zoomTo(i,u,d){return this.easeTo(c.e({zoom:i},u),d)}zoomIn(i,u){return this.zoomTo(this.getZoom()+1,i,u),this}zoomOut(i,u){return this.zoomTo(this.getZoom()-1,i,u),this}getBearing(){return this.transform.bearing}setBearing(i,u){return this.jumpTo({bearing:i},u),this}getPadding(){return this.transform.padding}setPadding(i,u){return this.jumpTo({padding:i},u),this}rotateTo(i,u,d){return this.easeTo(c.e({bearing:i},u),d)}resetNorth(i,u){return this.rotateTo(0,c.e({duration:1e3},i),u),this}resetNorthPitch(i,u){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},i),u),this}snapToNorth(i,u){return Math.abs(this.getBearing()){if(this._zooming&&(f.zoom=c.z.number(y,j,wt)),this._rotating&&(f.bearing=c.z.number(w,P,wt)),this._pitching&&(f.pitch=c.z.number(I,D,wt)),this._padding&&(f.interpolatePadding(C,N,wt),X=f.centerPoint.add(V)),this.terrain&&!i.freezeElevation&&this._updateElevation(wt),st)f.setLocationAtPoint(st,gt);else{const At=f.zoomScale(f.zoom-y),Pt=j>y?Math.min(2,Q):Math.max(.5,Q),zt=Math.pow(Pt,1-wt),Bt=f.unproject(nt.add(mt.mult(wt*zt)).mult(At));f.setLocationAtPoint(f.renderWorldCopies?Bt.wrap():Bt,X)}this._applyUpdatedTransform(f),this._fireMoveEvents(u)},wt=>{this.terrain&&this._finalizeElevation(),this._afterEase(u,wt)},i),this}_prepareEase(i,u,d={}){this._moving=!0,u||d.moving||this.fire(new c.k("movestart",i)),this._zooming&&!d.zooming&&this.fire(new c.k("zoomstart",i)),this._rotating&&!d.rotating&&this.fire(new c.k("rotatestart",i)),this._pitching&&!d.pitching&&this.fire(new c.k("pitchstart",i))}_prepareElevation(i){this._elevationCenter=i,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(i){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const u=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(i<1&&u!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=i*(d-(u-(d*i+this._elevationStart))/(1-i)),this._elevationTarget=u}this.transform.elevation=c.z.number(this._elevationStart,this._elevationTarget,i)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(i){if(!this.transformCameraUpdate)return;const u=i.clone(),{center:d,zoom:f,pitch:y,bearing:w,elevation:I}=this.transformCameraUpdate(u);d&&(u.center=d),f!==void 0&&(u.zoom=f),y!==void 0&&(u.pitch=y),w!==void 0&&(u.bearing=w),I!==void 0&&(u.elevation=I),this.transform.apply(u)}_fireMoveEvents(i){this.fire(new c.k("move",i)),this._zooming&&this.fire(new c.k("zoom",i)),this._rotating&&this.fire(new c.k("rotate",i)),this._pitching&&this.fire(new c.k("pitch",i))}_afterEase(i,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId;const d=this._zooming,f=this._rotating,y=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new c.k("zoomend",i)),f&&this.fire(new c.k("rotateend",i)),y&&this.fire(new c.k("pitchend",i)),this.fire(new c.k("moveend",i))}flyTo(i,u){var d;if(!i.essential&&k.prefersReducedMotion){const je=c.L(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(je,u)}this.stop(),i=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b7},i);const f=this._getTransformForUpdate(),y=this.getZoom(),w=this.getBearing(),I=this.getPitch(),C=this.getPadding(),P="bearing"in i?this._normalizeBearing(i.bearing,w):w,D="pitch"in i?+i.pitch:I,N="padding"in i?i.padding:f.padding,V=c.P.convert(i.offset);let X=f.centerPoint.add(V);const W=f.pointLocation(X),{center:J,zoom:j}=f.getConstrained(c.M.convert(i.center||W),(d=i.zoom)!==null&&d!==void 0?d:y);this._normalizeCenter(J);const nt=f.zoomScale(j-y),mt=f.project(W),Q=f.project(J).sub(mt);let st=i.curve;const gt=Math.max(f.width,f.height),yt=gt/nt,wt=Q.mag();if("minZoom"in i){const je=c.ac(Math.min(i.minZoom,y,j),f.minZoom,f.maxZoom),fe=gt/f.zoomScale(je-y);st=Math.sqrt(fe/wt*2)}const At=st*st;function Pt(je){const fe=(yt*yt-gt*gt+(je?-1:1)*At*At*wt*wt)/(2*(je?yt:gt)*At*wt);return Math.log(Math.sqrt(fe*fe+1)-fe)}function zt(je){return(Math.exp(je)-Math.exp(-je))/2}function Bt(je){return(Math.exp(je)+Math.exp(-je))/2}const Ie=Pt(!1);let Vt=function(je){return Bt(Ie)/Bt(Ie+st*je)},le=function(je){return gt*((Bt(Ie)*(zt(fe=Ie+st*je)/Bt(fe))-zt(Ie))/At)/wt;var fe},Ee=(Pt(!0)-Ie)/st;if(Math.abs(wt)<1e-6||!isFinite(Ee)){if(Math.abs(gt-yt)<1e-6)return this.easeTo(i,u);const je=yti.maxDuration&&(i.duration=0),this._zooming=!0,this._rotating=w!==P,this._pitching=D!==I,this._padding=!f.isPaddingEqual(N),this._prepareEase(u,!1),this.terrain&&this._prepareElevation(J),this._ease(je=>{const fe=je*Ee,Le=1/Vt(fe);f.zoom=je===1?j:y+f.scaleZoom(Le),this._rotating&&(f.bearing=c.z.number(w,P,je)),this._pitching&&(f.pitch=c.z.number(I,D,je)),this._padding&&(f.interpolatePadding(C,N,je),X=f.centerPoint.add(V)),this.terrain&&!i.freezeElevation&&this._updateElevation(je);const De=je===1?J:f.unproject(mt.add(Q.mult(le(fe))).mult(Le));f.setLocationAtPoint(f.renderWorldCopies?De.wrap():De,X),this._applyUpdatedTransform(f),this._fireMoveEvents(u)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(u)},i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,u){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,u)}if(!i){const d=this.handlers;d&&d.stop(!1)}return this}_ease(i,u,d){d.animate===!1||d.duration===0?(i(1),u()):(this._easeStart=k.now(),this._easeOptions=d,this._onEaseFrame=i,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(i,u){i=c.b1(i,-180,180);const d=Math.abs(i-u);return Math.abs(i-360-u)180?-360:d<-180?360:0}queryTerrainElevation(i){return this.terrain?this.terrain.getElevationForLngLatZoom(c.M.convert(i),this.transform.tileZoom)-this.transform.elevation:null}}const zh={compact:!0,customAttribution:'MapLibre'};class So{constructor(i=zh){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=u=>{!u||u.sourceDataType!=="metadata"&&u.sourceDataType!=="visibility"&&u.dataType!=="style"&&u.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?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=i}getDefaultPosition(){return"bottom-right"}onAdd(i){return this._map=i,this._compact=this.options.compact,this._container=U.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=U.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=U.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(){U.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(i,u){const d=this._map._getUIString(`AttributionControl.${u}`);i.title=d,i.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let i=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=i.concat(this.options.customAttribution.map(f=>typeof f!="string"?"":f)):typeof this.options.customAttribution=="string"&&i.push(this.options.customAttribution)),this._map.style.stylesheet){const f=this._map.style.stylesheet;this.styleOwner=f.owner,this.styleId=f.id}const u=this._map.style.sourceCaches;for(const f in u){const y=u[f];if(y.used||y.usedForTerrain){const w=y.getSource();w.attribution&&i.indexOf(w.attribution)<0&&i.push(w.attribution)}}i=i.filter(f=>String(f).trim()),i.sort((f,y)=>f.length-y.length),i=i.filter((f,y)=>{for(let w=y+1;w=0)return!1;return!0});const d=i.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,i.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Rd{constructor(i={}){this._updateCompact=()=>{const u=this._container.children;if(u.length){const d=u[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=i}getDefaultPosition(){return"bottom-left"}onAdd(i){this._map=i,this._compact=this.options&&this.options.compact,this._container=U.create("div","maplibregl-ctrl");const u=U.create("a","maplibregl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){U.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Kl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const u=++this._id;return this._queue.push({callback:i,id:u,cancelled:!1}),u}remove(i){const u=this._currentlyRunning,d=u?this._queue.concat(u):this._queue;for(const f of d)if(f.id===i)return void(f.cancelled=!0)}run(i=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const u=this._currentlyRunning=this._queue;this._queue=[];for(const d of u)if(!d.cancelled&&(d.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Yn=c.X([{name:"a_pos3d",type:"Int16",components:3}]);class ui extends c.E{constructor(i){super(),this.sourceCache=i,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,i.usedForTerrain=!0,i.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(i,u){this.sourceCache.update(i,u),this._renderableTilesKeys=[];const d={};for(const f of i.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))d[f.key]=!0,this._renderableTilesKeys.push(f.key),this._tiles[f.key]||(f.posMatrix=new Float64Array(16),c.aN(f.posMatrix,0,c.W,0,c.W,0,1),this._tiles[f.key]=new Zo(f,this.tileSize));for(const f in this._tiles)d[f]||delete this._tiles[f]}freeRtt(i){for(const u in this._tiles){const d=this._tiles[u];(!i||d.tileID.equals(i)||d.tileID.isChildOf(i)||i.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(i=>this.getTileByID(i))}getTileByID(i){return this._tiles[i]}getTerrainCoords(i){const u={};for(const d of this._renderableTilesKeys){const f=this._tiles[d].tileID;if(f.canonical.equals(i.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16),c.aN(y.posMatrix,0,c.W,0,c.W,0,1),u[d]=y}else if(f.canonical.isChildOf(i.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16);const w=f.canonical.z-i.canonical.z,I=f.canonical.x-(f.canonical.x>>w<>w<>w;c.aN(y.posMatrix,0,P,0,P,0,1),c.H(y.posMatrix,y.posMatrix,[-I*P,-C*P,0]),u[d]=y}else if(i.canonical.isChildOf(f.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16);const w=i.canonical.z-f.canonical.z,I=i.canonical.x-(i.canonical.x>>w<>w<>w;c.aN(y.posMatrix,0,c.W,0,c.W,0,1),c.H(y.posMatrix,y.posMatrix,[I*P,C*P,0]),c.J(y.posMatrix,y.posMatrix,[1/2**w,1/2**w,0]),u[d]=y}}return u}getSourceTile(i,u){const d=this.sourceCache._source;let f=i.overscaledZ-this.deltaZoom;if(f>d.maxzoom&&(f=d.maxzoom),f=d.minzoom&&(!y||!y.dem);)y=this.sourceCache.getTileByID(i.scaledTo(f--).key);return y}tilesAfterTime(i=Date.now()){return Object.values(this._tiles).filter(u=>u.timeAdded>=i)}}class Nd{constructor(i,u,d){this.painter=i,this.sourceCache=new ui(u),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(i,u,d,f=c.W){var y;if(!(u>=0&&u=0&&di.canonical.z&&(i.canonical.z>=f?y=i.canonical.z-f:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const w=i.canonical.x-(i.canonical.x>>y<>y<>8<<4|y>>8,u[w+3]=0;const d=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),f=new Nt(i,d,i.gl.RGBA,{premultiply:!1});return f.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._coordsTexture=f,f}pointCoordinate(i){this.painter.maybeDrawDepthAndCoords(!0);const u=new Uint8Array(4),d=this.painter.context,f=d.gl,y=Math.round(i.x*this.painter.pixelRatio/devicePixelRatio),w=Math.round(i.y*this.painter.pixelRatio/devicePixelRatio),I=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),f.readPixels(y,I-w-1,1,1,f.RGBA,f.UNSIGNED_BYTE,u),d.bindFramebuffer.set(null);const C=u[0]+(u[2]>>4<<8),P=u[1]+((15&u[2])<<8),D=this.coordsIndex[255-u[3]],N=D&&this.sourceCache.getTileByID(D);if(!N)return null;const V=this._coordsTextureSize,X=(1<i.id!==u),this._recentlyUsed.push(i.id)}stampObject(i){i.stamp=++this._stamp}getOrCreateFreeObject(){for(const u of this._recentlyUsed)if(!this._objects[u].inUse)return this._objects[u];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const i=this._createObject(this._objects.length);return this._objects.push(i),i}freeObject(i){i.inUse=!1}freeAllObjects(){for(const i of this._objects)this.freeObject(i)}isFull(){return!(this._objects.length!i.inUse)===!1}}const vs={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Oh{constructor(i,u){this.painter=i,this.terrain=u,this.pool=new Jl(i.context,30,u.sourceCache.tileSize*u.qualityFactor)}destruct(){this.pool.destruct()}getTexture(i){return this.pool.getObjectForId(i.rtt[this._stacks.length-1].id).texture}prepareForRender(i,u){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=i._order.filter(d=>!i._layers[d].isHidden(u)),this._coordsDescendingInv={};for(const d in i.sourceCaches){this._coordsDescendingInv[d]={};const f=i.sourceCaches[d].getVisibleCoordinates();for(const y of f){const w=this.terrain.sourceCache.getTerrainCoords(y);for(const I in w)this._coordsDescendingInv[d][I]||(this._coordsDescendingInv[d][I]=[]),this._coordsDescendingInv[d][I].push(w[I])}}this._coordsDescendingInvStr={};for(const d of i._order){const f=i._layers[d],y=f.source;if(vs[f.type]&&!this._coordsDescendingInvStr[y]){this._coordsDescendingInvStr[y]={};for(const w in this._coordsDescendingInv[y])this._coordsDescendingInvStr[y][w]=this._coordsDescendingInv[y][w].map(I=>I.key).sort().join()}}for(const d of this._renderableTiles)for(const f in this._coordsDescendingInvStr){const y=this._coordsDescendingInvStr[f][d.tileID.key];y&&y!==d.rttCoords[f]&&(d.rtt=[])}}renderLayer(i){if(i.isHidden(this.painter.transform.zoom))return!1;const u=i.type,d=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===i.id;if(vs[u]&&(this._prevType&&vs[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(i.id),!f))return!0;if(vs[this._prevType]||vs[u]&&f){this._prevType=u;const y=this._stacks.length-1,w=this._stacks[y]||[];for(const I of this._renderableTiles){if(this.pool.isFull()&&(rc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(I),I.rtt[y]){const P=this.pool.getObjectForId(I.rtt[y].id);if(P.stamp===I.rtt[y].stamp){this.pool.useObject(P);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),I.rtt[y]={id:C.id,stamp:C.stamp},d.context.bindFramebuffer.set(C.fbo.framebuffer),d.context.clear({color:c.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let P=0;P{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},Vh={showCompass:!0,showZoom:!0,visualizePitch:!1};class Uh{constructor(i,u,d=!1){this.mousedown=w=>{this.startMouse(c.e({},w,{ctrlKey:!0,preventDefault:()=>w.preventDefault()}),U.mousePos(this.element,w)),U.addEventListener(window,"mousemove",this.mousemove),U.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=w=>{this.moveMouse(w,U.mousePos(this.element,w))},this.mouseup=w=>{this.mouseRotate.dragEnd(w),this.mousePitch&&this.mousePitch.dragEnd(w),this.offTemp()},this.touchstart=w=>{w.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.startTouch(w,this._startPos),U.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.addEventListener(window,"touchend",this.touchend))},this.touchmove=w=>{w.targetTouches.length!==1?this.reset():(this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.moveTouch(w,this._lastPos))},this.touchend=w=>{w.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const f=i.dragRotate._mouseRotate.getClickTolerance(),y=i.dragRotate._mousePitch.getClickTolerance();this.element=u,this.mouseRotate=nl({clickTolerance:f,enable:!0}),this.touchRotate=(({enable:w,clickTolerance:I,bearingDegreesPerPixelMoved:C=.8})=>{const P=new Kt;return new el({clickTolerance:I,move:(D,N)=>({bearingDelta:(N.x-D.x)*C}),moveStateManager:P,enable:w,assignEvents:hc})})({clickTolerance:f,enable:!0}),this.map=i,d&&(this.mousePitch=il({clickTolerance:y,enable:!0}),this.touchPitch=(({enable:w,clickTolerance:I,pitchDegreesPerPixelMoved:C=-.5})=>{const P=new Kt;return new el({clickTolerance:I,move:(D,N)=>({pitchDelta:(N.y-D.y)*C}),moveStateManager:P,enable:w,assignEvents:hc})})({clickTolerance:y,enable:!0})),U.addEventListener(u,"mousedown",this.mousedown),U.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),U.addEventListener(u,"touchcancel",this.reset)}startMouse(i,u){this.mouseRotate.dragStart(i,u),this.mousePitch&&this.mousePitch.dragStart(i,u),U.disableDrag()}startTouch(i,u){this.touchRotate.dragStart(i,u),this.touchPitch&&this.touchPitch.dragStart(i,u),U.disableDrag()}moveMouse(i,u){const d=this.map,{bearingDelta:f}=this.mouseRotate.dragMove(i,u)||{};if(f&&d.setBearing(d.getBearing()+f),this.mousePitch){const{pitchDelta:y}=this.mousePitch.dragMove(i,u)||{};y&&d.setPitch(d.getPitch()+y)}}moveTouch(i,u){const d=this.map,{bearingDelta:f}=this.touchRotate.dragMove(i,u)||{};if(f&&d.setBearing(d.getBearing()+f),this.touchPitch){const{pitchDelta:y}=this.touchPitch.dragMove(i,u)||{};y&&d.setPitch(d.getPitch()+y)}}off(){const i=this.element;U.removeEventListener(i,"mousedown",this.mousedown),U.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend),U.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){U.enableDrag(),U.removeEventListener(window,"mousemove",this.mousemove),U.removeEventListener(window,"mouseup",this.mouseup),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend)}}let xs;function pc(_,i,u){const d=new c.M(_.lng,_.lat);if(_=new c.M(_.lng,_.lat),i){const f=new c.M(_.lng-360,_.lat),y=new c.M(_.lng+360,_.lat),w=u.locationPoint(_).distSqr(i);u.locationPoint(f).distSqr(i)180;){const f=u.locationPoint(_);if(f.x>=0&&f.y>=0&&f.x<=u.width&&f.y<=u.height)break;_.lng>u.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&u.locationPoint(_).y>u.height/2-u.getHorizon()?_:d}const $l={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 dc(_,i,u){const d=_.classList;for(const f in $l)d.remove(`maplibregl-${u}-anchor-${f}`);d.add(`maplibregl-${u}-anchor-${i}`)}class tu extends c.E{constructor(i){if(super(),this._onKeyPress=u=>{const d=u.code,f=u.charCode||u.keyCode;d!=="Space"&&d!=="Enter"&&f!==32&&f!==13||this.togglePopup()},this._onMapClick=u=>{const d=u.originalEvent.target,f=this._element;this._popup&&(d===f||f.contains(d))&&this.togglePopup()},this._update=u=>{var d;if(!this._map)return;const f=this._map.loaded()&&!this._map.isMoving();((u==null?void 0:u.type)==="terrain"||(u==null?void 0:u.type)==="render"&&!f)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?pc(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let y="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?y=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(y=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let w="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?w="rotateX(0deg)":this._pitchAlignment==="map"&&(w=`rotateX(${this._map.getPitch()}deg)`),u&&u.type!=="moveend"||(this._pos=this._pos.round()),U.setTransform(this._element,`${$l[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${w} ${y}`),k.frameAsync(new AbortController).then(()=>{this._updateOpacity(u&&u.type==="moveend")}).catch(()=>{})},this._onMove=u=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=u.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=u.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=u=>{this._element.contains(u.originalEvent.target)&&(u.preventDefault(),this._positionDelta=u.point.sub(this._pos).add(this._offset),this._pointerdownPos=u.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment!=="auto"?i.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(i==null?void 0:i.opacity,i==null?void 0:i.opacityWhenCovered),i&&i.element)this._element=i.element,this._offset=c.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=U.create("div"),this._element.setAttribute("aria-label","Map marker");const u=U.createNS("http://www.w3.org/2000/svg","svg"),d=41,f=27;u.setAttributeNS(null,"display","block"),u.setAttributeNS(null,"height",`${d}px`),u.setAttributeNS(null,"width",`${f}px`),u.setAttributeNS(null,"viewBox",`0 0 ${f} ${d}`);const y=U.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"stroke","none"),y.setAttributeNS(null,"stroke-width","1"),y.setAttributeNS(null,"fill","none"),y.setAttributeNS(null,"fill-rule","evenodd");const w=U.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill-rule","nonzero");const I=U.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"transform","translate(3.0, 29.0)"),I.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 nt of C){const mt=U.createNS("http://www.w3.org/2000/svg","ellipse");mt.setAttributeNS(null,"opacity","0.04"),mt.setAttributeNS(null,"cx","10.5"),mt.setAttributeNS(null,"cy","5.80029008"),mt.setAttributeNS(null,"rx",nt.rx),mt.setAttributeNS(null,"ry",nt.ry),I.appendChild(mt)}const P=U.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"fill",this._color);const D=U.createNS("http://www.w3.org/2000/svg","path");D.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"),P.appendChild(D);const N=U.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"opacity","0.25"),N.setAttributeNS(null,"fill","#000000");const V=U.createNS("http://www.w3.org/2000/svg","path");V.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"),N.appendChild(V);const X=U.createNS("http://www.w3.org/2000/svg","g");X.setAttributeNS(null,"transform","translate(6.0, 7.0)"),X.setAttributeNS(null,"fill","#FFFFFF");const W=U.createNS("http://www.w3.org/2000/svg","g");W.setAttributeNS(null,"transform","translate(8.0, 8.0)");const J=U.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#000000"),J.setAttributeNS(null,"opacity","0.25"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962");const j=U.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#FFFFFF"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962"),W.appendChild(J),W.appendChild(j),w.appendChild(I),w.appendChild(P),w.appendChild(N),w.appendChild(X),w.appendChild(W),u.appendChild(w),u.setAttributeNS(null,"height",d*this._scale+"px"),u.setAttributeNS(null,"width",f*this._scale+"px"),this._element.appendChild(u),this._offset=c.P.convert(i&&i.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",u=>{u.preventDefault()}),this._element.addEventListener("mousedown",u=>{u.preventDefault()}),dc(this._element,this._anchor,"marker"),i&&i.className)for(const u of i.className.split(" "))this._element.classList.add(u);this._popup=null}addTo(i){return this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._update),i.on("moveend",this._update),i.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),U.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=c.M.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){const f=Math.abs(13.5)/Math.SQRT2;i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[f,-1*(38.1-13.5+f)],"bottom-right":[-f,-1*(38.1-13.5+f)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const i=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:i?(i.isOpen()?i.remove():(i.setLngLat(this._lngLat),i.addTo(this._map)),this):this}_updateOpacity(i=!1){var u,d;if(!(!((u=this._map)===null||u===void 0)&&u.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(i)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,y=f.terrain.depthAtPoint(this._pos),w=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,w)-y<.006)return void(this._element.style.opacity=this._opacity);const I=-this._offset.y/f.transform._pixelPerMeter,C=Math.sin(f.getPitch()*Math.PI/180)*I,P=f.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),D=f.transform.lngLatToCameraDepth(this._lngLat,w+C)-P>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&D&&this._popup.remove(),this._element.style.opacity=D?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(i){return this._offset=c.P.convert(i),this._update(),this}addClassName(i){this._element.classList.add(i)}removeClassName(i){this._element.classList.remove(i)}toggleClassName(i){return this._element.classList.toggle(i)}setDraggable(i){return this._draggable=!!i,this._map&&(i?(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(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&i!=="auto"?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(i,u){return i===void 0&&u===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),i!==void 0&&(this._opacity=i),u!==void 0&&(this._opacityWhenCovered=u),this._map&&this._updateOpacity(!0),this}}const fc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ol=0,ba=!1;const mc={maxWidth:100,unit:"metric"};function gc(_,i,u){const d=u&&u.maxWidth||100,f=_._container.clientHeight/2,y=_.unproject([0,f]),w=_.unproject([d,f]),I=y.distanceTo(w);if(u&&u.unit==="imperial"){const C=3.2808*I;C>5280?wa(i,d,C/5280,_._getUIString("ScaleControl.Miles")):wa(i,d,C,_._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?wa(i,d,I/1852,_._getUIString("ScaleControl.NauticalMiles")):I>=1e3?wa(i,d,I/1e3,_._getUIString("ScaleControl.Kilometers")):wa(i,d,I,_._getUIString("ScaleControl.Meters"))}function wa(_,i,u,d){const f=function(y){const w=Math.pow(10,`${Math.floor(y)}`.length-1);let I=y/w;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(C){const P=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*P)/P}(I),w*I}(u);_.style.width=i*(f/u)+"px",_.innerHTML=`${f} ${d}`}const qh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Gh=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function _c(_){if(_){if(typeof _=="number"){const i=Math.round(Math.abs(_)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,_),"top-left":new c.P(i,i),"top-right":new c.P(-i,i),bottom:new c.P(0,-_),"bottom-left":new c.P(i,-i),"bottom-right":new c.P(-i,-i),left:new c.P(_,0),right:new c.P(-_,0)}}if(_ instanceof c.P||Array.isArray(_)){const i=c.P.convert(_);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:c.P.convert(_.center||[0,0]),top:c.P.convert(_.top||[0,0]),"top-left":c.P.convert(_["top-left"]||[0,0]),"top-right":c.P.convert(_["top-right"]||[0,0]),bottom:c.P.convert(_.bottom||[0,0]),"bottom-left":c.P.convert(_["bottom-left"]||[0,0]),"bottom-right":c.P.convert(_["bottom-right"]||[0,0]),left:c.P.convert(_.left||[0,0]),right:c.P.convert(_.right||[0,0])}}return _c(new c.P(0,0))}const kd=S;m.AJAXError=c.be,m.Evented=c.E,m.LngLat=c.M,m.MercatorCoordinate=c.Y,m.Point=c.P,m.addProtocol=c.bf,m.config=c.a,m.removeProtocol=c.bg,m.AttributionControl=So,m.BoxZoomHandler=Io,m.CanvasSource=ja,m.CooperativeGesturesHandler=te,m.DoubleClickZoomHandler=Nh,m.DragPanHandler=Dd,m.DragRotateHandler=Eo,m.EdgeInsets=$a,m.FullscreenControl=class extends c.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var i;let u=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((i=u==null?void 0:u.shadowRoot)===null||i===void 0)&&i.fullscreenElement;)u=u.shadowRoot.fullscreenElement;u===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:c.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(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){U.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=U.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);U.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_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 c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},m.GeoJSONSource=Us,m.GeolocateControl=class extends c.E{constructor(_){super(),this._onSuccess=i=>{if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,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&&this._watchState!=="OFF"&&this._updateMarker(i),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(i),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",i)),this._finish()}},this._updateCamera=i=>{const u=new c.M(i.coords.longitude,i.coords.latitude),d=i.coords.accuracy,f=this._map.getBearing(),y=c.e({bearing:f},this.options.fitBoundsOptions),w=_t.fromLngLat(u,d);this._map.fitBounds(w,y,{geolocateSource:!0})},this._updateMarker=i=>{if(i){const u=new c.M(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(u).addTo(this._map),this._userLocationDotMarker.setLngLat(u).addTo(this._map),this._accuracy=i.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=i=>{if(this._map){if(this.options.trackUserLocation)if(i.code===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._geolocateButton.disabled=!0;const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(i.code===3&&ba)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",i)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=i=>{if(this._map){if(this._container.addEventListener("contextmenu",u=>u.preventDefault()),this._geolocateButton=U.create("button","maplibregl-ctrl-geolocate",this._container),U.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",i===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}else{const u=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=U.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new tu({element:this._dotElement}),this._circleElement=U.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new tu({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",u=>{u.geolocateSource||this._watchState!=="ACTIVE_LOCK"||u.originalEvent&&u.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")))})}},this.options=c.e({},fc,_)}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return c._(this,arguments,void 0,function*(i=!1){if(xs!==void 0&&!i)return xs;if(window.navigator.permissions===void 0)return xs=!!window.navigator.geolocation,xs;try{xs=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{xs=!!window.navigator.geolocation}return xs})}().then(i=>this._setupUI(i)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(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(),U.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ol=0,ba=!1}_isOutOfMapMaxBounds(_){const i=this._map.getMaxBounds(),u=_.coords;return i&&(u.longitudei.getEast()||u.latitudei.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 _=this._map.getBounds(),i=_.getSouthEast(),u=_.getNorthEast(),d=i.distanceTo(u),f=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${f}px`,this._circleElement.style.height=`${f}px`}trigger(){if(!this._setup)return c.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 c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ol--,ba=!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 c.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ol++,ol>1?(_={maximumAge:6e5,timeout:0},ba=!0):(_=this.options.positionOptions,ba=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}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)}},m.Hash=Ah,m.ImageSource=wi,m.KeyboardHandler=Xs,m.LngLatBounds=_t,m.LogoControl=Rd,m.Map=class extends Pr{constructor(_){if(c.bc.mark(c.bd.create),(_=c.e({},Ql,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new oc(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=i=>{i.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:i}))},this._contextRestored=i=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:i}))},this._onMapScroll=i=>{if(i.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new Kl,this._controls=[],this._mapId=c.a3(),this._locale=c.e({},Fh,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=Gt.addThrottleControl(()=>this.isMoving()),this._requestManager=new re(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.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}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let i=!1;const u=Ph(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{i?u(d):i=!0}),this._resizeObserver.observe(this._container)}this.handlers=new kh(this,_),this._hash=_.hash&&new Ah(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,c.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new So(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Rd,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",i=>{this._update(i.dataType==="style"),this.fire(new c.k(`${i.dataType}data`,i))}),this.on("dataloading",i=>{this.fire(new c.k(`${i.dataType}dataloading`,i))}),this.on("dataabort",i=>{this.fire(new c.k("sourcedataabort",i))})}_getMapId(){return this._mapId}addControl(_,i){if(i===void 0&&(i=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const u=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[i];return i.indexOf("bottom")!==-1?d.insertBefore(u,d.firstChild):d.appendChild(u),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(_);return i>-1&&this._controls.splice(i,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,i,u,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(u,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,i,u,d)}resize(_){var i;const u=this._containerDimensions(),d=u[0],f=u[1],y=this._getClampedPixelRatio(d,f);if(this._resizeCanvas(d,f,y),this.painter.resize(d,f,y),this.painter.overLimit()){const I=this.painter.context.gl;this._maxCanvasSize=[I.drawingBufferWidth,I.drawingBufferHeight];const C=this._getClampedPixelRatio(d,f);this._resizeCanvas(d,f,C),this.painter.resize(d,f,C)}this.transform.resize(d,f),(i=this._requestedCameraState)===null||i===void 0||i.resize(d,f);const w=!this._moving;return w&&(this.stop(),this.fire(new c.k("movestart",_)).fire(new c.k("move",_))),this.fire(new c.k("resize",_)),w&&this.fire(new c.k("moveend",_)),this}_getClampedPixelRatio(_,i){const{0:u,1:d}=this._maxCanvasSize,f=this.getPixelRatio(),y=_*f,w=i*f;return Math.min(y>u?u/y:1,w>d?d/w:1)*f}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(_t.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(c.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(c.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,i,u){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:i,listener:u,delegates:{mousemove:y=>{const w=this.getLayer(i)?this.queryRenderedFeatures(y.point,{layers:[i]}):[];w.length?d||(d=!0,u.call(this,new Lr(_,this,y.originalEvent,{features:w}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:i,listener:u,delegates:{mousemove:w=>{(this.getLayer(i)?this.queryRenderedFeatures(w.point,{layers:[i]}):[]).length?d=!0:d&&(d=!1,u.call(this,new Lr(_,this,w.originalEvent)))},mouseout:w=>{d&&(d=!1,u.call(this,new Lr(_,this,w.originalEvent)))}}}}{const d=f=>{const y=this.getLayer(i)?this.queryRenderedFeatures(f.point,{layers:[i]}):[];y.length&&(f.features=y,u.call(this,f),delete f.features)};return{layer:i,listener:u,delegates:{[_]:d}}}}on(_,i,u){if(u===void 0)return super.on(_,i);const d=this._createDelegatedListener(_,i,u);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const f in d.delegates)this.on(f,d.delegates[f]);return this}once(_,i,u){if(u===void 0)return super.once(_,i);const d=this._createDelegatedListener(_,i,u);for(const f in d.delegates)this.once(f,d.delegates[f]);return this}off(_,i,u){return u===void 0?super.off(_,i):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const f=this._delegatedListeners[_];for(let y=0;ythis._updateStyle(_,i));const u=this.style&&i.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new Gr(this,i||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,i,u):this.style.loadJSON(_,i,u),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Gr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,i){if(typeof _=="string"){const u=this._requestManager.transformRequest(_,"Style");c.h(u,new AbortController).then(d=>{this._updateDiff(d.data,i)}).catch(d=>{d&&this.fire(new c.j(d))})}else typeof _=="object"&&this._updateDiff(_,i)}_updateDiff(_,i){try{this.style.setState(_,i)&&this._update(!0)}catch(u){c.w(`Unable to perform style diff: ${u.message||u.error||u}. Rebuilding the style from scratch.`),this._updateStyle(_,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(_,i){return this._lazyInitEmptyStyle(),this.style.addSource(_,i),this._update(!0)}isSourceLoaded(_){const i=this.style&&this.style.sourceCaches[_];if(i!==void 0)return i.loaded();this.fire(new c.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const i=this.style.sourceCaches[_.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&i.reload();for(const u in this.style._layers){const d=this.style._layers[u];d.type==="hillshade"&&d.source===_.source&&c.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 Nd(this.painter,i,_),this.painter.renderToTexture=new Oh(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=u=>{u.dataType==="style"?this.terrain.sourceCache.freeRtt():u.dataType==="source"&&u.tile&&(u.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(u.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:_})),this}getTerrain(){var _,i;return(i=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&i!==void 0?i:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const i in _){const u=_[i]._tiles;for(const d in u){const f=u[d];if(f.state!=="loaded"&&f.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,i,u={}){const{pixelRatio:d=1,sdf:f=!1,stretchX:y,stretchY:w,content:I}=u;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||c.b(i))){if(i.width===void 0||i.height===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:C,height:P,data:D}=i,N=i;return this.style.addImage(_,{data:new c.R({width:C,height:P},new Uint8Array(D)),pixelRatio:d,stretchX:y,stretchY:w,content:I,sdf:f,version:0,userImage:N}),N.onAdd&&N.onAdd(this,_),this}}{const{width:C,height:P,data:D}=k.getImageData(i);this.style.addImage(_,{data:new c.R({width:C,height:P},D),pixelRatio:d,stretchX:y,stretchY:w,content:I,sdf:f,version:0})}}updateImage(_,i){const u=this.style.getImage(_);if(!u)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=i instanceof HTMLImageElement||c.b(i)?k.getImageData(i):i,{width:f,height:y,data:w}=d;if(f===void 0||y===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(f!==u.data.width||y!==u.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const I=!(i instanceof HTMLImageElement||c.b(i));return u.data.replace(w,I),this.style.updateImage(_,u),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return Gt.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,i){return this._lazyInitEmptyStyle(),this.style.addLayer(_,i),this._update(!0)}moveLayer(_,i){return this.style.moveLayer(_,i),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,i,u){return this.style.setLayerZoomRange(_,i,u),this._update(!0)}setFilter(_,i,u={}){return this.style.setFilter(_,i,u),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,i,u,d={}){return this.style.setPaintProperty(_,i,u,d),this._update(!0)}getPaintProperty(_,i){return this.style.getPaintProperty(_,i)}setLayoutProperty(_,i,u,d={}){return this.style.setLayoutProperty(_,i,u,d),this._update(!0)}getLayoutProperty(_,i){return this.style.getLayoutProperty(_,i)}setGlyphs(_,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,i,u={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,i,u,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,i,u=>{u||this._update(!0)}),this}setLight(_,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,i),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,i){return this.style.setFeatureState(_,i),this._update()}removeFeatureState(_,i){return this.style.removeFeatureState(_,i),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,i=0;return this._container&&(_=this._container.clientWidth||400,i=this._container.clientHeight||300),[_,i]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const i=this._canvasContainer=U.create("div","maplibregl-canvas-container",_);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=U.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const u=this._containerDimensions(),d=this._getClampedPixelRatio(u[0],u[1]);this._resizeCanvas(u[0],u[1],d);const f=this._controlContainer=U.create("div","maplibregl-control-container",_),y=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(w=>{y[w]=U.create("div",`maplibregl-ctrl-${w} `,f)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,i,u){this._canvas.width=Math.floor(u*_),this._canvas.height=Math.floor(u*i),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${i}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let i=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{i={requestedAttributes:_},d&&(i.statusMessage=d.statusMessage,i.type=d.type)},{once:!0});const u=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!u){const d="Failed to initialize WebGL";throw i?(i.message=d,new Error(JSON.stringify(i))):new Error(d)}this.painter=new bd(u,this.transform),ct.testSupport(u)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,y=k.now();this.style.zoomHistory.update(f,y);const w=new c.a8(f,{now:y,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),I=w.crossFadingFactor();I===1&&I===this._crossFadingFactor||(u=!0,this._crossFadingFactor=I),this.style.update(w)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bc.mark(c.bd.load),this.fire(new c.k("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 c.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,c.bc.mark(c.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(const u of this._controls)u.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),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Gt.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),U.remove(this._canvasContainer),U.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.bc.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,k.frameAsync(this._frameRequest).then(_=>{c.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return Bh}getCameraTargetElevation(){return this.transform.elevation}},m.MapMouseEvent=Lr,m.MapTouchEvent=Yo,m.MapWheelEvent=Mh,m.Marker=tu,m.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const i=this._map.getZoom(),u=i===this._map.getMaxZoom(),d=i===this._map.getMinZoom();this._zoomInButton.disabled=u,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",u.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=i},this._setButtonTitle=(i,u)=>{const d=this._map._getUIString(`NavigationControl.${u}`);i.title=d,i.setAttribute("aria-label",d)},this.options=c.e({},Vh,_),this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),U.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),U.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=U.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Uh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){U.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(_,i){const u=U.create("button",_,this._container);return u.type="button",u.addEventListener("click",i),u}},m.Popup=class extends c.E{constructor(_){super(),this.remove=()=>(this._content&&U.remove(this._content),this._container&&(U.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 c.k("close"))),this),this._onMouseUp=i=>{this._update(i.point)},this._onMouseMove=i=>{this._update(i.point)},this._onDrag=i=>{this._update(i.point)},this._update=i=>{var u;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=U.create("div","maplibregl-popup",this._map.getContainer()),this._tip=U.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?pc(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.wrap(),this._trackPointer&&!i)return;const d=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map.transform.locationPoint(this._lngLat));let f=this.options.anchor;const y=_c(this.options.offset);if(!f){const I=this._container.offsetWidth,C=this._container.offsetHeight;let P;P=d.y+y.bottom.ythis._map.transform.height-C?["bottom"]:[],d.xthis._map.transform.width-I/2&&P.push("right"),f=P.length===0?"bottom":P.join("-")}let w=d.add(y[f]);this.options.subpixelPositioning||(w=w.round()),U.setTransform(this._container,`${$l[f]} translate(${w.x}px,${w.y}px)`),dc(this._container,f,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(qh),_)}addTo(_){return this._map&&this.remove(),this._map=_,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 c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=c.M.convert(_),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(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const i=document.createDocumentFragment(),u=document.createElement("body");let d;for(u.innerHTML=_;d=u.firstChild,d;)i.appendChild(d);return this.setDOMContent(i)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=U.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=U.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Gh);_&&_.focus()}},m.RasterDEMTileSource=hr,m.RasterTileSource=xt,m.ScaleControl=class{constructor(_){this._onMove=()=>{gc(this._map,this._container,this.options)},this.setUnit=i=>{this.options.unit=i,gc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},mc),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){U.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},m.ScrollZoomHandler=uc,m.Style=Gr,m.TerrainControl=class{constructor(_){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=_}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=U.create("button","maplibregl-ctrl-terrain",this._container),U.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(){U.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},m.TwoFingersTouchPitchHandler=Pd,m.TwoFingersTouchRotateHandler=Rh,m.TwoFingersTouchZoomHandler=Ld,m.TwoFingersTouchZoomRotateHandler=Xl,m.VectorTileSource=Pn,m.VideoSource=Ga,m.addSourceType=(_,i)=>c._(void 0,void 0,void 0,function*(){if(Ha(_))throw new Error(`A source type called "${_}" already exists.`);((u,d)=>{Za[u]=d})(_,i)}),m.clearPrewarmedResources=function(){const _=an;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Me),an=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()"))},m.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},m.getRTLTextPluginStatus=function(){return Ot().getRTLTextPluginStatus()},m.getVersion=function(){return kd},m.getWorkerCount=function(){return nn.workerCount},m.getWorkerUrl=function(){return c.a.WORKER_URL},m.importScriptInWorkers=function(_){return Ji().broadcast("IS",_)},m.prewarm=function(){wn().acquire(Me)},m.setMaxParallelImageRequests=function(_){c.a.MAX_PARALLEL_IMAGE_REQUESTS=_},m.setRTLTextPlugin=function(_,i){return Ot().setRTLTextPlugin(_,i)},m.setWorkerCount=function(_){nn.workerCount=_},m.setWorkerUrl=function(_){c.a.WORKER_URL=_}});var p=r;return p})})(L0);var pb=L0.exports;const Ls=hb(pb);function _y(t){let e;return r=>{if(r)for(let s in r){let l=e==null?void 0:e[s],p=r[s];l!==p&&t(s,p,l)}else if(e)for(let s in e)t(s,void 0,e[s]);e=r}}function db(t,...e){let r=[t];for(let s of e)if(s)Array.isArray(s)&&s[0]===t?r.push(...s.slice(1)):r.push(s);else continue;if(r.length!==1)return r.length===2?r[1]:r}function fb(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function _2(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}var A0=mb;function mb(t){var e,r,s;if(t){if(Array.isArray(t)){for(e=[],r=t.length,s=0;s{s=null}),ah())},i(l){r||(bn(s),r=!0)},o(l){Jn(s),r=!1},d(l){l&&on(e),s&&s.d(l)}}}function _b(t,e,r){let s,l,p,m,c,S,L,R,k,U,ct,dt,{$$slots:bt={},$$scope:It}=e,{id:Dt=T0("layer")}=e,{source:Rt=void 0}=e,{sourceLayer:Gt=void 0}=e,{beforeId:re=void 0}=e,{beforeLayerType:pe=void 0}=e,{type:Be}=e,{paint:ue=void 0}=e,{layout:Pe=void 0}=e,{filter:me=void 0}=e,{applyToClusters:ve=void 0}=e,{minzoom:Nt=void 0}=e,{maxzoom:sn=void 0}=e,{manageHoverState:Re=!1}=e,{hovered:ge=null}=e,{interactive:He=!0}=e,{hoverCursor:mn=void 0}=e,{eventsIfTopMost:ce=!1}=e;const en=hg(),{map:Rn,source:Tn,self:hn,minzoom:Me,maxzoom:nn,eventTopMost:Ln,layerInfo:an}=ub();Qr(t,Rn,at=>r(31,k=at)),Qr(t,Tn,at=>r(32,U=at)),Qr(t,hn,at=>r(0,R=at)),Qr(t,Me,at=>r(34,dt=at)),Qr(t,nn,at=>r(33,ct=at)),du(()=>{R&&k&&(an.delete(R),k==null||k.removeLayer(R))});let ln;function wn(at){var xt,hr;if(!He||!R||!k||ce&&Ln(at)!==R)return;let _t=at.features??[],ze=(hr=(xt=_t[0])==null?void 0:xt.properties)==null?void 0:hr.cluster_id,Pn={event:at,map:k,clusterId:ze,layer:R,source:c,features:_t};en(at.type,Pn)}function Vn(at){var xt,hr;if(!He||!R||!k||ce&&Ln(at)!==R)return;mn&&(k.getCanvas().style.cursor=mn);let _t=at.features??[];r(6,ge=_t[0]??null);let ze=(hr=(xt=_t[0])==null?void 0:xt.properties)==null?void 0:hr.cluster_id;en("mouseenter",{event:at,map:k,clusterId:ze,layer:R,source:c,features:_t})}function Ji(at){var xt,hr,Us;if(!He||!k)return;if(ce&&Ln(at)!==R){r(6,ge=null),Re&&ln!==void 0&&(k==null||k.setFeatureState({source:c,sourceLayer:Gt,id:ln},{hover:!1}),ln=void 0);return}k.getCanvas().style.cursor=mn;let _t=at.features??[],ze=(hr=(xt=_t[0])==null?void 0:xt.properties)==null?void 0:hr.cluster_id,Pn=(Us=_t[0])==null?void 0:Us.id;Pn!==ln&&(Re&&(ln!==void 0&&(k==null||k.setFeatureState({source:c,id:ln,sourceLayer:Gt},{hover:!1})),k==null||k.setFeatureState({source:c,id:Pn,sourceLayer:Gt},{hover:!0})),ln=Pn,r(6,ge=_t[0]??null)),en("mousemove",{event:at,map:k,clusterId:ze,layer:R,source:c,features:_t})}function ni(at){if(!(!He||!R||!k)){if(mn&&(k.getCanvas().style.cursor=""),r(6,ge=null),Re&&ln!==void 0){const _t={source:c,id:ln,sourceLayer:Gt};k==null||k.setFeatureState(_t,{hover:!1}),ln=void 0}en("mouseleave",{map:k,layer:R,source:c})}}let ai=!0;function bi(at){k&&(k.off("click",at,wn),k.off("dblclick",at,wn),k.off("contextmenu",at,wn),k.off("mouseenter",at,Vn),k.off("mousemove",at,Ji),k.off("mouseleave",at,ni))}return du(()=>{k&&R&&bi(R)}),t.$$set=at=>{"id"in at&&r(7,Dt=at.id),"source"in at&&r(8,Rt=at.source),"sourceLayer"in at&&r(9,Gt=at.sourceLayer),"beforeId"in at&&r(10,re=at.beforeId),"beforeLayerType"in at&&r(11,pe=at.beforeLayerType),"type"in at&&r(12,Be=at.type),"paint"in at&&r(13,ue=at.paint),"layout"in at&&r(14,Pe=at.layout),"filter"in at&&r(15,me=at.filter),"applyToClusters"in at&&r(16,ve=at.applyToClusters),"minzoom"in at&&r(17,Nt=at.minzoom),"maxzoom"in at&&r(18,sn=at.maxzoom),"manageHoverState"in at&&r(19,Re=at.manageHoverState),"hovered"in at&&r(6,ge=at.hovered),"interactive"in at&&r(20,He=at.interactive),"hoverCursor"in at&&r(21,mn=at.hoverCursor),"eventsIfTopMost"in at&&r(22,ce=at.eventsIfTopMost),"$$scope"in at&&r(35,It=at.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&r(30,s=fb(ve)),t.$$.dirty[0]&1073774592&&r(24,l=db("all",s,me)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&r(26,p=Nt??dt),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&r(25,m=sn??ct),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&r(29,c=Rt||U),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&k&&R!==Dt&&c){R&&(bi(R),an.delete(R));let at=re;if(!re&&pe){let _t=k.getStyle().layers,ze=typeof pe=="function"?pe:xt=>xt.type===pe,Pn=_t==null?void 0:_t.find(ze);Pn&&(at=Pn.id)}wp(hn,R=Dt,R),k.addLayer(A0({id:R,type:Be,source:c,"source-layer":Gt,filter:l,paint:ue,layout:Pe,minzoom:p,maxzoom:m}),at),r(23,ai=!0),k.on("click",R,wn),k.on("dblclick",R,wn),k.on("contextmenu",R,wn),k.on("mouseenter",R,Vn),k.on("mousemove",R,Ji),k.on("mouseleave",R,ni)}t.$$.dirty[0]&1048577&&R&&an.set(R,{interactive:He}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(28,S=R?_y((at,_t)=>k==null?void 0:k.setPaintProperty(R,at,_t)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(27,L=R?_y((at,_t)=>k==null?void 0:k.setLayoutProperty(R,at,_t)):void 0),t.$$.dirty[0]&268443648&&(S==null||S(ue)),t.$$.dirty[0]&134234112&&(L==null||L(Pe)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&R&&(k==null||k.setLayerZoomRange(R,p,m)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&R&&(ai?r(23,ai=!1):k==null||k.setFilter(R,l))},[R,Rn,Tn,hn,Me,nn,ge,Dt,Rt,Gt,re,pe,Be,ue,Pe,me,ve,Nt,sn,Re,He,mn,ce,ai,l,m,p,L,S,c,s,k,U,ct,dt,It,bt]}class yb extends vo{constructor(e){super(),yo(this,e,_b,gb,Vr,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function vb(t,e,r){let s;const{map:l}=Zp();Qr(t,l,S=>r(4,s=S));let{position:p="top-left"}=e,{container:m=void 0}=e,c=null;return du(()=>{s!=null&&s.loaded()&&c&&s.removeControl(c)}),t.$$set=S=>{"position"in S&&r(1,p=S.position),"container"in S&&r(2,m=S.container)},t.$$.update=()=>{if(t.$$.dirty&30&&s&&!c){let S;typeof m=="string"?S=document.querySelector(m)??void 0:S=m,r(3,c=new Ls.FullscreenControl({container:S})),s.addControl(c,p)}},[l,p,m,c,s]}class xb extends vo{constructor(e){super(),yo(this,e,vb,null,Vr,{position:1,container:2})}}function bb(t,e,r){let s;const{map:l}=Zp();Qr(t,l,U=>r(8,s=U));let{position:p="top-left"}=e,{positionOptions:m=void 0}=e,{fitBoundsOptions:c=void 0}=e,{trackUserLocation:S=!1}=e,{showAccuracyCircle:L=!0}=e,{showUserLocation:R=!0}=e,{control:k=null}=e;return du(()=>{s!=null&&s.loaded()&&k&&s.removeControl(k)}),t.$$set=U=>{"position"in U&&r(2,p=U.position),"positionOptions"in U&&r(3,m=U.positionOptions),"fitBoundsOptions"in U&&r(4,c=U.fitBoundsOptions),"trackUserLocation"in U&&r(5,S=U.trackUserLocation),"showAccuracyCircle"in U&&r(6,L=U.showAccuracyCircle),"showUserLocation"in U&&r(7,R=U.showUserLocation),"control"in U&&r(1,k=U.control)},t.$$.update=()=>{t.$$.dirty&510&&s&&!k&&(r(1,k=new Ls.GeolocateControl({positionOptions:m,fitBoundsOptions:c,trackUserLocation:S,showAccuracyCircle:L,showUserLocation:R})),s.addControl(k,p))},[l,k,p,m,c,S,L,R,s]}class wb extends vo{constructor(e){super(),yo(this,e,bb,null,Vr,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function Ib(t){let e;const r=t[15].default,s=uu(r,t,t[23],null);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p&8388608)&&hu(s,r,l,l[23],e?cu(r,l[23],p,null):pu(l[23]),null)},i(l){e||(bn(s,l),e=!0)},o(l){Jn(s,l),e=!1},d(l){s&&s.d(l)}}}function Eb(t){let e,r,s;function l(m){t[16](m)}let p={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[Ib]},$$scope:{ctx:t}};return t[0]!==void 0&&(p.hovered=t[0]),e=new yb({props:p}),Uc.push(()=>h1(e,"hovered",l)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){zc(e.$$.fragment)},m(m,c){su(e,m,c),s=!0},p(m,[c]){const S={};c&2&&(S.id=m[1]),c&4&&(S.source=m[2]),c&8&&(S.sourceLayer=m[3]),c&16&&(S.beforeId=m[4]),c&32&&(S.beforeLayerType=m[5]),c&64&&(S.paint=m[6]),c&128&&(S.layout=m[7]),c&256&&(S.filter=m[8]),c&512&&(S.minzoom=m[9]),c&1024&&(S.maxzoom=m[10]),c&2048&&(S.hoverCursor=m[11]),c&4096&&(S.manageHoverState=m[12]),c&8192&&(S.eventsIfTopMost=m[13]),c&16384&&(S.interactive=m[14]),c&8388608&&(S.$$scope={dirty:c,ctx:m}),!r&&c&1&&(r=!0,S.hovered=m[0],l1(()=>r=!1)),e.$set(S)},i(m){s||(bn(e.$$.fragment,m),s=!0)},o(m){Jn(e.$$.fragment,m),s=!1},d(m){au(e,m)}}}function Sb(t,e,r){let{$$slots:s={},$$scope:l}=e,{id:p=T0("line")}=e,{source:m=void 0}=e,{sourceLayer:c=void 0}=e,{beforeId:S=void 0}=e,{beforeLayerType:L=void 0}=e,{paint:R}=e,{layout:k=void 0}=e,{filter:U=void 0}=e,{minzoom:ct=void 0}=e,{maxzoom:dt=void 0}=e,{hoverCursor:bt=void 0}=e,{manageHoverState:It=!1}=e,{hovered:Dt=null}=e,{eventsIfTopMost:Rt=!1}=e,{interactive:Gt=!0}=e;function re(Nt){Dt=Nt,r(0,Dt)}function pe(Nt){Ac.call(this,t,Nt)}function Be(Nt){Ac.call(this,t,Nt)}function ue(Nt){Ac.call(this,t,Nt)}function Pe(Nt){Ac.call(this,t,Nt)}function me(Nt){Ac.call(this,t,Nt)}function ve(Nt){Ac.call(this,t,Nt)}return t.$$set=Nt=>{"id"in Nt&&r(1,p=Nt.id),"source"in Nt&&r(2,m=Nt.source),"sourceLayer"in Nt&&r(3,c=Nt.sourceLayer),"beforeId"in Nt&&r(4,S=Nt.beforeId),"beforeLayerType"in Nt&&r(5,L=Nt.beforeLayerType),"paint"in Nt&&r(6,R=Nt.paint),"layout"in Nt&&r(7,k=Nt.layout),"filter"in Nt&&r(8,U=Nt.filter),"minzoom"in Nt&&r(9,ct=Nt.minzoom),"maxzoom"in Nt&&r(10,dt=Nt.maxzoom),"hoverCursor"in Nt&&r(11,bt=Nt.hoverCursor),"manageHoverState"in Nt&&r(12,It=Nt.manageHoverState),"hovered"in Nt&&r(0,Dt=Nt.hovered),"eventsIfTopMost"in Nt&&r(13,Rt=Nt.eventsIfTopMost),"interactive"in Nt&&r(14,Gt=Nt.interactive),"$$scope"in Nt&&r(23,l=Nt.$$scope)},[Dt,p,m,c,S,L,R,k,U,ct,dt,bt,It,Rt,Gt,s,re,pe,Be,ue,Pe,me,ve,l]}class y2 extends vo{constructor(e){super(),yo(this,e,Sb,Eb,Vr,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function Cb(t){let e=t.getCenter(),r=Math.round(t.getZoom()*100)/100,s=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),l=Math.pow(10,s),p=Math.round(e.lat*l)/l,m=Math.round(e.lng*l)/l,c=`${r}/${p}/${m}`,S=t.getBearing(),L=t.getPitch();return(S||L)&&(c+=`/${Math.round(S*10)/10}`),L&&(c+=`/${Math.round(L)}`),`#${c}`}function Tb(t){return t.replace("#","").split("/").map(parseFloat)}var Nc=mg;function mg(t,e){return t===e||t!==t&&e!==e?!0:typeof t!=typeof e||{}.toString.call(t)!={}.toString.call(e)||t!==Object(t)||!t?!1:Array.isArray(t)?xy(t,e):{}.toString.call(t)=="[object Set]"?xy(Array.from(t),Array.from(e)):{}.toString.call(t)=="[object Object]"?Pb(t,e):Lb(t,e)}function Lb(t,e){return t.toString()===e.toString()}function xy(t,e){var r=t.length;if(r!=e.length)return!1;for(var s=0;sr(6,s=R));let{position:p="top-left"}=e,{showCompass:m=!0}=e,{showZoom:c=!0}=e,{visualizePitch:S=!1}=e,L=null;return du(()=>{s!=null&&s.loaded()&&L&&s.removeControl(L)}),t.$$set=R=>{"position"in R&&r(1,p=R.position),"showCompass"in R&&r(2,m=R.showCompass),"showZoom"in R&&r(3,c=R.showZoom),"visualizePitch"in R&&r(4,S=R.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&s&&!L&&(r(5,L=new Ls.NavigationControl({showCompass:m,showZoom:c,visualizePitch:S})),s.addControl(L,p))},[l,p,m,c,S,L,s]}class Mb extends vo{constructor(e){super(),yo(this,e,Ab,null,Vr,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function Db(t,e,r){let s;const{map:l}=Zp();Qr(t,l,L=>r(5,s=L));let{position:p="bottom-left"}=e,{maxWidth:m=void 0}=e,{unit:c="metric"}=e,S=null;return du(()=>{s!=null&&s.loaded()&&S&&s.removeControl(S)}),t.$$set=L=>{"position"in L&&r(1,p=L.position),"maxWidth"in L&&r(2,m=L.maxWidth),"unit"in L&&r(3,c=L.unit)},t.$$.update=()=>{t.$$.dirty&62&&s&&!S&&(r(4,S=new Ls.ScaleControl({maxWidth:m,unit:c})),s.addControl(S,p))},[l,p,m,c,S,s]}class Rb extends vo{constructor(e){super(),yo(this,e,Db,null,Vr,{position:1,maxWidth:2,unit:3})}}const{window:Nb}=n1,kb=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),by=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function wy(t){let e,r,s=t[3]&&Iy(t);const l=t[40].default,p=uu(l,t,t[39],by);return{c(){s&&s.c(),e=Zi(),p&&p.c()},m(m,c){s&&s.m(m,c),un(m,e,c),p&&p.m(m,c),r=!0},p(m,c){m[3]?s?(s.p(m,c),c[0]&8&&bn(s,1)):(s=Iy(m),s.c(),bn(s,1),s.m(e.parentNode,e)):s&&(sh(),Jn(s,1,1,()=>{s=null}),ah()),p&&p.p&&(!r||c[0]&112|c[1]&256)&&hu(p,l,m,m[39],r?cu(l,m[39],c,kb):pu(m[39]),by)},i(m){r||(bn(s),bn(p,m),r=!0)},o(m){Jn(s),Jn(p,m),r=!1},d(m){m&&on(e),s&&s.d(m),p&&p.d(m)}}}function Iy(t){let e,r,s,l,p,m,c,S;return e=new Mb({props:{position:t[7]}}),s=new wb({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),p=new xb({props:{position:t[7]}}),c=new Rb({props:{position:t[7]}}),{c(){zc(e.$$.fragment),r=Zi(),zc(s.$$.fragment),l=Zi(),zc(p.$$.fragment),m=Zi(),zc(c.$$.fragment)},m(L,R){su(e,L,R),un(L,r,R),su(s,L,R),un(L,l,R),su(p,L,R),un(L,m,R),su(c,L,R),S=!0},p(L,R){const k={};R[0]&128&&(k.position=L[7]),e.$set(k);const U={};R[0]&128&&(U.position=L[7]),s.$set(U);const ct={};R[0]&128&&(ct.position=L[7]),p.$set(ct);const dt={};R[0]&128&&(dt.position=L[7]),c.$set(dt)},i(L){S||(bn(e.$$.fragment,L),bn(s.$$.fragment,L),bn(p.$$.fragment,L),bn(c.$$.fragment,L),S=!0)},o(L){Jn(e.$$.fragment,L),Jn(s.$$.fragment,L),Jn(p.$$.fragment,L),Jn(c.$$.fragment,L),S=!1},d(L){L&&(on(r),on(l),on(m)),au(e,L),au(s,L),au(p,L),au(c,L)}}}function zb(t){let e,r,s,l,p,m=t[4]&&t[0]&&wy(t);return{c(){e=rn("div"),m&&m.c(),Sn(e,"class",r=uy(t[2])+" svelte-p00lfq"),Sn(e,"data-testid","map-container"),hy(e,"expand-map",!t[2])},m(c,S){un(c,e,S),m&&m.m(e,null),t[41](e),s=!0,l||(p=[yp(Nb,"hashchange",t[11]),e1(t[10].call(null,e))],l=!0)},p(c,S){c[4]&&c[0]?m?(m.p(c,S),S[0]&17&&bn(m,1)):(m=wy(c),m.c(),bn(m,1),m.m(e,null)):m&&(sh(),Jn(m,1,1,()=>{m=null}),ah()),(!s||S[0]&4&&r!==(r=uy(c[2])+" svelte-p00lfq"))&&Sn(e,"class",r),(!s||S[0]&4)&&hy(e,"expand-map",!c[2])},i(c){s||(bn(m),s=!0)},o(c){Jn(m),s=!1},d(c){c&&on(e),m&&m.d(),t[41](null),l=!1,Cu(p)}}}function Ob(t,e,r){let s,l,p,m,{$$slots:c={},$$scope:S}=e,{map:L=null}=e,{mapContainer:R=void 0}=e,{class:k=void 0}=e,{style:U}=e,{diffStyleUpdates:ct=!1}=e,{center:dt=void 0}=e,{zoom:bt=void 0}=e,{pitch:It=0}=e,{bearing:Dt=0}=e,{bounds:Rt=void 0}=e,{hash:Gt=!1}=e,{updateHash:re=at=>{window.history.replaceState(window.history.state,"",at)}}=e,{loaded:pe=!1}=e,{minZoom:Be=0}=e,{maxZoom:ue=22}=e,{antialias:Pe=void 0}=e,{zoomOnDoubleClick:me=!0}=e,{locale:ve=void 0}=e,{interactive:Nt=!0}=e,{attributionControl:sn=!0}=e,{cooperativeGestures:Re=!1}=e,{preserveDrawingBuffer:ge=!1}=e,{maxBounds:He=void 0}=e,{images:mn=[]}=e,{standardControls:ce=!1}=e,{filterLayers:en=void 0}=e,{transformRequest:Rn=void 0}=e;const Tn=hg(),{map:hn,loadedImages:Me}=lb();Qr(t,hn,at=>r(4,p=at)),Qr(t,Me,at=>r(5,m=at));let nn=new Set;async function Ln(at,_t=!1){if(p&&!(!p.loaded()&&!_t))if("url"in at){nn.add(at.id);try{let ze=await p.loadImage(at.url);p==null||p.addImage(at.id,ze.data,at.options),m.add(at.id),Me.set(m)}catch(ze){Tn("error",ze)}finally{nn.delete(at.id)}}else p.addImage(at.id,at.data,at.options),m.add(at.id),Me.set(m)}let an,ln,wn,Vn;function Ji(at){return ai(),wp(hn,p=new Ls.Map(A0({container:at,style:U,locale:ve,center:dt,zoom:bt,pitch:It,bearing:Dt,minZoom:Be,maxZoom:ue,antialias:Pe,interactive:Nt,preserveDrawingBuffer:ge,maxBounds:He,bounds:Rt,attributionControl:sn,transformRequest:Rn,cooperativeGestures:Re})),p),p.on("load",_t=>{_t.target.getContainer().setAttribute("data-testid","map"),_t.target.getCanvas().setAttribute("data-testid","map-canvas"),r(0,pe=!0),Tn("load",p)}),p.on("error",_t=>Tn("error",{..._t,map:p})),p.on("movestart",_t=>Tn("movestart",{..._t,map:p})),p.on("moveend",_t=>{if(r(12,dt=_t.target.getCenter()),r(13,bt=_t.target.getZoom()),r(14,It=_t.target.getPitch()),r(15,Dt=_t.target.getBearing()),r(16,Rt=_t.target.getBounds()),Tn("moveend",{..._t,map:p}),Gt){let ze=new URL(window.location.href.replace(/(#.+)?$/,Cb(p)));re(ze)}}),p.on("click",_t=>Tn("click",{..._t,map:p})),p.on("dblclick",_t=>Tn("dblclick",{..._t,map:p})),p.on("contextmenu",_t=>Tn("contextmenu",{..._t,map:p})),p.on("zoomstart",_t=>Tn("zoomstart",{..._t,map:p})),p.on("zoom",_t=>{Tn("zoom",{..._t,map:p})}),p.on("zoomend",_t=>{Tn("zoomend",{..._t,map:p})}),p.on("style.load",()=>{if(p){const _t=p.getStyle();if(r(36,an=_t.layers.map(ze=>ze.id)),r(37,ln=Object.keys(_t.sources)),Vn)for(const[ze,Pn]of Object.entries(Vn))p.addSource(ze,Pn);if(wn)for(const ze of wn)p.addLayer(ze);for(const ze of mn)Ln(ze,!0)}}),p.on("styledata",_t=>{if(p&&en){const ze=p.getStyle().layers;if(ze)for(let Pn of ze)en(Pn)||p.setLayoutProperty(Pn.id,"visibility","none")}Tn("styledata",{..._t,map:p})}),{destroy(){r(0,pe=!1),p==null||p.remove(),wp(hn,p=null,p)}}}let ni=U;function ai(){if(Gt){let at=Tb(window.location.hash);at.length>=3&&(r(13,bt=at[0]),r(12,dt=[at[2],at[1]])),at.length==5&&(r(15,Dt=at[3]),r(14,It=at[4]))}}function bi(at){Uc[at?"unshift":"push"](()=>{R=at,r(1,R)})}return t.$$set=at=>{"map"in at&&r(17,L=at.map),"mapContainer"in at&&r(1,R=at.mapContainer),"class"in at&&r(2,k=at.class),"style"in at&&r(18,U=at.style),"diffStyleUpdates"in at&&r(19,ct=at.diffStyleUpdates),"center"in at&&r(12,dt=at.center),"zoom"in at&&r(13,bt=at.zoom),"pitch"in at&&r(14,It=at.pitch),"bearing"in at&&r(15,Dt=at.bearing),"bounds"in at&&r(16,Rt=at.bounds),"hash"in at&&r(20,Gt=at.hash),"updateHash"in at&&r(21,re=at.updateHash),"loaded"in at&&r(0,pe=at.loaded),"minZoom"in at&&r(22,Be=at.minZoom),"maxZoom"in at&&r(23,ue=at.maxZoom),"antialias"in at&&r(24,Pe=at.antialias),"zoomOnDoubleClick"in at&&r(25,me=at.zoomOnDoubleClick),"locale"in at&&r(26,ve=at.locale),"interactive"in at&&r(27,Nt=at.interactive),"attributionControl"in at&&r(28,sn=at.attributionControl),"cooperativeGestures"in at&&r(29,Re=at.cooperativeGestures),"preserveDrawingBuffer"in at&&r(30,ge=at.preserveDrawingBuffer),"maxBounds"in at&&r(31,He=at.maxBounds),"images"in at&&r(32,mn=at.images),"standardControls"in at&&r(3,ce=at.standardControls),"filterLayers"in at&&r(33,en=at.filterLayers),"transformRequest"in at&&r(34,Rn=at.transformRequest),"$$scope"in at&&r(39,S=at.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&r(7,s=typeof ce=="boolean"?void 0:ce),t.$$.dirty[0]&16&&r(17,L=p),t.$$.dirty[0]&786448|t.$$.dirty[1]&224&&p&&!Nc(U,ni)){const at=p.getStyle();if(an&&(wn=at.layers.filter(_t=>!an.includes(_t.id))),ln){const _t=Object.keys(at.sources).filter(ze=>!ln.includes(ze));Vn={};for(const ze of _t)Vn[ze]=at.sources[ze]}r(38,ni=U),p.setStyle(U,{diff:ct}),wp(Me,m=new Set,m),r(35,nn=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&18&&pe&&p!=null&&p.loaded())for(let at of mn)!m.has(at.id)&&!nn.has(at.id)&&!p.hasImage(at.id)&&Ln(at);if(t.$$.dirty[0]&32|t.$$.dirty[1]&2&&r(6,l=mn.every(at=>m.has(at.id))),t.$$.dirty[0]&61456&&p){let at={};dt!=null&&!Nc(dt,p==null?void 0:p.getCenter())&&(at.center=dt),bt!=null&&!Nc(bt,p==null?void 0:p.getZoom())&&(at.zoom=bt),Dt!=null&&!Nc(Dt,p==null?void 0:p.getBearing())&&(at.bearing=Dt),It!=null&&!Nc(It,p==null?void 0:p.getPitch())&&(at.pitch=It),Object.keys(at).length&&p.easeTo(at)}t.$$.dirty[0]&65552&&Rt&&!Nc(Rt,p==null?void 0:p.getBounds())&&(p==null||p.fitBounds(Rt)),t.$$.dirty[0]&33554448&&(me?p==null||p.doubleClickZoom.enable():p==null||p.doubleClickZoom.disable())},[pe,R,k,ce,p,m,l,s,hn,Me,Ji,ai,dt,bt,It,Dt,Rt,L,U,ct,Gt,re,Be,ue,Pe,me,ve,Nt,sn,Re,ge,He,mn,en,Rn,nn,an,ln,ni,S,c,bi]}class v2 extends vo{constructor(e){super(),yo(this,e,Ob,zb,Vr,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,antialias:24,zoomOnDoubleClick:25,locale:26,interactive:27,attributionControl:28,cooperativeGestures:29,preserveDrawingBuffer:30,maxBounds:31,images:32,standardControls:3,filterLayers:33,transformRequest:34},null,[-1,-1])}}let mp={origins:"blue",destinations:"purple",lts1:"#009e73",lts2:"#56b4e9",lts3:"#e69f00",lts4:"#d55e00",lts_not_allowed:"red"},x2=["match",["get","lts"],0,mp.lts_not_allowed,1,mp.lts1,2,mp.lts2,3,mp.lts3,4,mp.lts4,"red"],b2=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],w2={lts1:"LTS 1 - suitable for children",lts2:"LTS 2 - low stress",lts3:"LTS 3 - medium stress",lts4:"LTS 4 - high stress",lts_not_allowed:"Cyclists not allowed"},I2=[0,3,5,8,10,20,100],E2=["#267300","#70A800","#FFAA00","#E60000","#A80000","#730000"];const Ey="/od2net/assets/logo-fbff26ba.png";function Fb(t){let e,r,s,l,p,m,c,S,L,R,k,U,ct,dt,bt,It,Dt,Rt,Gt,re,pe,Be,ue,Pe,me,ve,Nt,sn,Re;return{c(){e=rn("div"),r=rn("img"),l=Zi(),p=rn("select"),m=rn("option"),m.textContent="Pre-built route networks",c=rn("option"),c.textContent="Interactively generate route networks",S=rn("option"),S.textContent="Explore edge costs",L=Zi(),R=rn("dialog"),k=rn("div"),U=rn("h1"),U.textContent="About od2net",ct=Zi(),dt=rn("button"),dt.textContent="Close",bt=Zi(),It=rn("img"),Rt=Zi(),Gt=rn("p"),Gt.innerHTML=`od2net is an open-source project +`}),staticAttributes:d,staticUniforms:w}}class zu{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(i,u,d,f,y,w,I,C,P){this.context=i;let D=this.boundPaintVertexBuffers.length!==f.length;for(let N=0;!D&&N({u_depth:new c.aG(gt,xt.u_depth),u_terrain:new c.aG(gt,xt.u_terrain),u_terrain_dim:new c.aH(gt,xt.u_terrain_dim),u_terrain_matrix:new c.aI(gt,xt.u_terrain_matrix),u_terrain_unpack:new c.aJ(gt,xt.u_terrain_unpack),u_terrain_exaggeration:new c.aH(gt,xt.u_terrain_exaggeration)}))(i,mt),this.binderUniforms=d?d.getUniforms(i,mt):[]}draw(i,u,d,f,y,w,I,C,P,D,N,V,X,W,J,j,nt,ft){const Q=i.gl;if(this.failedToCreate)return;if(i.program.set(this.program),i.setDepthMode(d),i.setStencilMode(f),i.setColorMode(y),i.setCullFace(w),C){i.activeTexture.set(Q.TEXTURE2),Q.bindTexture(Q.TEXTURE_2D,C.depthTexture),i.activeTexture.set(Q.TEXTURE3),Q.bindTexture(Q.TEXTURE_2D,C.texture);for(const mt in this.terrainUniforms)this.terrainUniforms[mt].set(C[mt])}for(const mt in this.fixedUniforms)this.fixedUniforms[mt].set(I[mt]);J&&J.setUniforms(i,this.binderUniforms,X,{zoom:W});let st=0;switch(u){case Q.LINES:st=2;break;case Q.TRIANGLES:st=3;break;case Q.LINE_STRIP:st=1}for(const mt of V.get()){const gt=mt.vaos||(mt.vaos={});(gt[P]||(gt[P]=new zu)).bind(i,this,D,J?J.getPaintVertexBuffers():[],N,mt.vertexOffset,j,nt,ft),Q.drawElements(u,mt.primitiveLength*st,Q.UNSIGNED_SHORT,mt.primitiveOffset*st*2)}}}function Ou(_,i,u){const d=1/ve(u,1,i.transform.tileZoom),f=Math.pow(2,u.tileID.overscaledZ),y=u.tileSize*Math.pow(2,i.transform.tileZoom)/f,w=y*(u.tileID.canonical.x+u.tileID.wrap*f),I=y*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[w>>16,I>>16],u_pixel_coord_lower:[65535&w,65535&I]}}const zl=(_,i,u,d)=>{const f=i.style.light,y=f.properties.get("position"),w=[y.x,y.y,y.z],I=function(){var P=new c.A(9);return c.A!=Float32Array&&(P[1]=0,P[2]=0,P[3]=0,P[5]=0,P[6]=0,P[7]=0),P[0]=1,P[4]=1,P[8]=1,P}();f.properties.get("anchor")==="viewport"&&function(P,D){var N=Math.sin(D),V=Math.cos(D);P[0]=V,P[1]=N,P[2]=0,P[3]=-N,P[4]=V,P[5]=0,P[6]=0,P[7]=0,P[8]=1}(I,-i.transform.angle),function(P,D,N){var V=D[0],X=D[1],W=D[2];P[0]=V*N[0]+X*N[3]+W*N[6],P[1]=V*N[1]+X*N[4]+W*N[7],P[2]=V*N[2]+X*N[5]+W*N[8]}(w,w,I);const C=f.properties.get("color");return{u_matrix:_,u_lightpos:w,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[C.r,C.g,C.b],u_vertical_gradient:+u,u_opacity:d}},zf=(_,i,u,d,f,y,w)=>c.e(zl(_,i,u,d),Ou(y,i,w),{u_height_factor:-Math.pow(2,f.overscaledZ)/w.tileSize/8}),td=_=>({u_matrix:_}),Fu=(_,i,u,d)=>c.e(td(_),Ou(u,i,d)),Of=(_,i)=>({u_matrix:_,u_world:i}),ed=(_,i,u,d,f)=>c.e(Fu(_,i,u,d),{u_world:f}),Ff=(_,i,u,d)=>{const f=_.transform;let y,w;if(d.paint.get("circle-pitch-alignment")==="map"){const I=ve(u,1,f.zoom);y=!0,w=[I,I]}else y=!1,w=f.pixelsToGLUnits;return{u_camera_to_center_distance:f.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(i.posMatrix,u,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:w}},nd=(_,i,u)=>{const d=ve(u,1,i.zoom),f=Math.pow(2,i.zoom-u.tileID.overscaledZ),y=u.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:i.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[i.pixelsToGLUnits[0]/(d*f),i.pixelsToGLUnits[1]/(d*f)],u_overscale_factor:y}},id=(_,i,u=1)=>({u_matrix:_,u_color:i,u_overlay:0,u_overlay_scale:u}),Bu=_=>({u_matrix:_}),rd=(_,i,u,d)=>({u_matrix:_,u_extrude_scale:ve(i,1,u),u_intensity:d});function od(_,i){const u=Math.pow(2,i.canonical.z),d=i.canonical.y;return[new c.Y(0,d/u).toLngLat().lat,new c.Y(0,(d+1)/u).toLngLat().lat]}const Vu=(_,i,u,d)=>{const f=_.transform;return{u_matrix:Ol(_,i,u,d),u_ratio:1/ve(i,1,f.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1]]}},sd=(_,i,u,d,f)=>c.e(Vu(_,i,u,f),{u_image:0,u_image_height:d}),ga=(_,i,u,d,f)=>{const y=_.transform,w=Zr(i,y);return{u_matrix:Ol(_,i,u,f),u_texsize:i.imageAtlasTexture.size,u_ratio:1/ve(i,1,y.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[w,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Uu=(_,i,u,d,f,y)=>{const w=_.lineAtlas,I=Zr(i,_.transform),C=u.layout.get("line-cap")==="round",P=w.getDash(d.from,C),D=w.getDash(d.to,C),N=P.width*f.fromScale,V=D.width*f.toScale;return c.e(Vu(_,i,u,y),{u_patternscale_a:[I/N,-P.height/2],u_patternscale_b:[I/V,-D.height/2],u_sdfgamma:w.width/(256*Math.min(N,V)*_.pixelRatio)/2,u_image:0,u_tex_y_a:P.y,u_tex_y_b:D.y,u_mix:f.t})};function Zr(_,i){return 1/ve(_,1,i.tileZoom)}function Ol(_,i,u,d){return _.translatePosMatrix(d?d.posMatrix:i.tileID.posMatrix,i,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const qu=(_,i,u,d,f)=>{return{u_matrix:_,u_tl_parent:i,u_scale_parent:u,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*f.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:f.paint.get("raster-brightness-min"),u_brightness_high:f.paint.get("raster-brightness-max"),u_saturation_factor:(w=f.paint.get("raster-saturation"),w>0?1-1/(1.001-w):-w),u_contrast_factor:(y=f.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:Fl(f.paint.get("raster-hue-rotate"))};var y,w};function Fl(_){_*=Math.PI/180;const i=Math.sin(_),u=Math.cos(_);return[(2*u+1)/3,(-Math.sqrt(3)*i-u+1)/3,(Math.sqrt(3)*i-u+1)/3]}const Bl=(_,i,u,d,f,y,w,I,C,P)=>{const D=f.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:D.cameraToCenterDistance,u_pitch:D.pitch/360*2*Math.PI,u_rotate_symbol:+u,u_aspect_ratio:D.width/D.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:w,u_coord_matrix:I,u_is_text:+C,u_pitch_with_map:+d,u_texsize:P,u_texture:0}},Vl=(_,i,u,d,f,y,w,I,C,P,D)=>{const N=f.transform;return c.e(Bl(_,i,u,d,f,y,w,I,C,P),{u_gamma_scale:d?Math.cos(N._pitch)*N.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:+D})},Ul=(_,i,u,d,f,y,w,I,C,P)=>c.e(Vl(_,i,u,d,f,y,w,I,!0,C,!0),{u_texsize_icon:P,u_texture_icon:1}),Bf=(_,i,u)=>({u_matrix:_,u_opacity:i,u_color:u}),Vf=(_,i,u,d,f,y)=>c.e(function(w,I,C,P){const D=C.imageManager.getPattern(w.from.toString()),N=C.imageManager.getPattern(w.to.toString()),{width:V,height:X}=C.imageManager.getPixelSize(),W=Math.pow(2,P.tileID.overscaledZ),J=P.tileSize*Math.pow(2,C.transform.tileZoom)/W,j=J*(P.tileID.canonical.x+P.tileID.wrap*W),nt=J*P.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:D.tl,u_pattern_br_a:D.br,u_pattern_tl_b:N.tl,u_pattern_br_b:N.br,u_texsize:[V,X],u_mix:I.t,u_pattern_size_a:D.displaySize,u_pattern_size_b:N.displaySize,u_scale_a:I.fromScale,u_scale_b:I.toScale,u_tile_units_to_pixels:1/ve(P,1,C.transform.tileZoom),u_pixel_coord_upper:[j>>16,nt>>16],u_pixel_coord_lower:[65535&j,65535&nt]}}(d,y,u,f),{u_matrix:_,u_opacity:i}),ad={fillExtrusion:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_lightpos:new c.aK(_,i.u_lightpos),u_lightintensity:new c.aH(_,i.u_lightintensity),u_lightcolor:new c.aK(_,i.u_lightcolor),u_vertical_gradient:new c.aH(_,i.u_vertical_gradient),u_opacity:new c.aH(_,i.u_opacity)}),fillExtrusionPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_lightpos:new c.aK(_,i.u_lightpos),u_lightintensity:new c.aH(_,i.u_lightintensity),u_lightcolor:new c.aK(_,i.u_lightcolor),u_vertical_gradient:new c.aH(_,i.u_vertical_gradient),u_height_factor:new c.aH(_,i.u_height_factor),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade),u_opacity:new c.aH(_,i.u_opacity)}),fill:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix)}),fillPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),fillOutline:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world)}),fillOutlinePattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world),u_image:new c.aG(_,i.u_image),u_texsize:new c.aL(_,i.u_texsize),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),circle:(_,i)=>({u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_scale_with_map:new c.aG(_,i.u_scale_with_map),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_extrude_scale:new c.aL(_,i.u_extrude_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_matrix:new c.aI(_,i.u_matrix)}),collisionBox:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pixels_to_tile_units:new c.aH(_,i.u_pixels_to_tile_units),u_extrude_scale:new c.aL(_,i.u_extrude_scale),u_overscale_factor:new c.aH(_,i.u_overscale_factor)}),collisionCircle:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_inv_matrix:new c.aI(_,i.u_inv_matrix),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_viewport_size:new c.aL(_,i.u_viewport_size)}),debug:(_,i)=>({u_color:new c.aM(_,i.u_color),u_matrix:new c.aI(_,i.u_matrix),u_overlay:new c.aG(_,i.u_overlay),u_overlay_scale:new c.aH(_,i.u_overlay_scale)}),clippingMask:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix)}),heatmap:(_,i)=>({u_extrude_scale:new c.aH(_,i.u_extrude_scale),u_intensity:new c.aH(_,i.u_intensity),u_matrix:new c.aI(_,i.u_matrix)}),heatmapTexture:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_world:new c.aL(_,i.u_world),u_image:new c.aG(_,i.u_image),u_color_ramp:new c.aG(_,i.u_color_ramp),u_opacity:new c.aH(_,i.u_opacity)}),hillshade:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_latrange:new c.aL(_,i.u_latrange),u_light:new c.aL(_,i.u_light),u_shadow:new c.aM(_,i.u_shadow),u_highlight:new c.aM(_,i.u_highlight),u_accent:new c.aM(_,i.u_accent)}),hillshadePrepare:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_image:new c.aG(_,i.u_image),u_dimension:new c.aL(_,i.u_dimension),u_zoom:new c.aH(_,i.u_zoom),u_unpack:new c.aJ(_,i.u_unpack)}),line:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels)}),lineGradient:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_image:new c.aG(_,i.u_image),u_image_height:new c.aH(_,i.u_image_height)}),linePattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texsize:new c.aL(_,i.u_texsize),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_image:new c.aG(_,i.u_image),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_scale:new c.aK(_,i.u_scale),u_fade:new c.aH(_,i.u_fade)}),lineSDF:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ratio:new c.aH(_,i.u_ratio),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_units_to_pixels:new c.aL(_,i.u_units_to_pixels),u_patternscale_a:new c.aL(_,i.u_patternscale_a),u_patternscale_b:new c.aL(_,i.u_patternscale_b),u_sdfgamma:new c.aH(_,i.u_sdfgamma),u_image:new c.aG(_,i.u_image),u_tex_y_a:new c.aH(_,i.u_tex_y_a),u_tex_y_b:new c.aH(_,i.u_tex_y_b),u_mix:new c.aH(_,i.u_mix)}),raster:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_tl_parent:new c.aL(_,i.u_tl_parent),u_scale_parent:new c.aH(_,i.u_scale_parent),u_buffer_scale:new c.aH(_,i.u_buffer_scale),u_fade_t:new c.aH(_,i.u_fade_t),u_opacity:new c.aH(_,i.u_opacity),u_image0:new c.aG(_,i.u_image0),u_image1:new c.aG(_,i.u_image1),u_brightness_low:new c.aH(_,i.u_brightness_low),u_brightness_high:new c.aH(_,i.u_brightness_high),u_saturation_factor:new c.aH(_,i.u_saturation_factor),u_contrast_factor:new c.aH(_,i.u_contrast_factor),u_spin_weights:new c.aK(_,i.u_spin_weights)}),symbolIcon:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texture:new c.aG(_,i.u_texture)}),symbolSDF:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texture:new c.aG(_,i.u_texture),u_gamma_scale:new c.aH(_,i.u_gamma_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_is_halo:new c.aG(_,i.u_is_halo)}),symbolTextAndIcon:(_,i)=>({u_is_size_zoom_constant:new c.aG(_,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aG(_,i.u_is_size_feature_constant),u_size_t:new c.aH(_,i.u_size_t),u_size:new c.aH(_,i.u_size),u_camera_to_center_distance:new c.aH(_,i.u_camera_to_center_distance),u_pitch:new c.aH(_,i.u_pitch),u_rotate_symbol:new c.aG(_,i.u_rotate_symbol),u_aspect_ratio:new c.aH(_,i.u_aspect_ratio),u_fade_change:new c.aH(_,i.u_fade_change),u_matrix:new c.aI(_,i.u_matrix),u_label_plane_matrix:new c.aI(_,i.u_label_plane_matrix),u_coord_matrix:new c.aI(_,i.u_coord_matrix),u_is_text:new c.aG(_,i.u_is_text),u_pitch_with_map:new c.aG(_,i.u_pitch_with_map),u_texsize:new c.aL(_,i.u_texsize),u_texsize_icon:new c.aL(_,i.u_texsize_icon),u_texture:new c.aG(_,i.u_texture),u_texture_icon:new c.aG(_,i.u_texture_icon),u_gamma_scale:new c.aH(_,i.u_gamma_scale),u_device_pixel_ratio:new c.aH(_,i.u_device_pixel_ratio),u_is_halo:new c.aG(_,i.u_is_halo)}),background:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_opacity:new c.aH(_,i.u_opacity),u_color:new c.aM(_,i.u_color)}),backgroundPattern:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_opacity:new c.aH(_,i.u_opacity),u_image:new c.aG(_,i.u_image),u_pattern_tl_a:new c.aL(_,i.u_pattern_tl_a),u_pattern_br_a:new c.aL(_,i.u_pattern_br_a),u_pattern_tl_b:new c.aL(_,i.u_pattern_tl_b),u_pattern_br_b:new c.aL(_,i.u_pattern_br_b),u_texsize:new c.aL(_,i.u_texsize),u_mix:new c.aH(_,i.u_mix),u_pattern_size_a:new c.aL(_,i.u_pattern_size_a),u_pattern_size_b:new c.aL(_,i.u_pattern_size_b),u_scale_a:new c.aH(_,i.u_scale_a),u_scale_b:new c.aH(_,i.u_scale_b),u_pixel_coord_upper:new c.aL(_,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aL(_,i.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aH(_,i.u_tile_units_to_pixels)}),terrain:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texture:new c.aG(_,i.u_texture),u_ele_delta:new c.aH(_,i.u_ele_delta)}),terrainDepth:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_ele_delta:new c.aH(_,i.u_ele_delta)}),terrainCoords:(_,i)=>({u_matrix:new c.aI(_,i.u_matrix),u_texture:new c.aG(_,i.u_texture),u_terrain_coords_id:new c.aH(_,i.u_terrain_coords_id),u_ele_delta:new c.aH(_,i.u_ele_delta)})};class Uf{constructor(i,u,d){this.context=i;const f=i.gl;this.buffer=f.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const u=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const _a={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Gu{constructor(i,u,d,f){this.length=u.length,this.attributes=d,this.itemSize=u.bytesPerElement,this.dynamicDraw=f,this.context=i;const y=i.gl;this.buffer=y.createBuffer(),i.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){if(i.length!==this.length)throw new Error(`Length of new data is ${i.length}, which doesn't match current length of ${this.length}`);const u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,u){for(let d=0;d0){const zt=c.F(),Bt=xt;c.aP(zt,gt.placementInvProjMatrix,_.transform.glCoordMatrix),c.aP(zt,zt,gt.placementViewportMatrix),D.push({circleArray:Pt,circleOffset:V,transform:Bt,invTransform:zt,coord:st}),N+=Pt.length/4,V=N}At&&P.draw(I,C.LINES,Ze.disabled,Pn.disabled,_.colorModeForRenderPass(),En.disabled,nd(xt,_.transform,mt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(st),u.id,At.layoutVertexBuffer,At.indexBuffer,At.segments,null,_.transform.zoom,null,null,At.collisionVertexBuffer)}if(!w||!D.length)return;const X=_.useProgram("collisionCircle"),W=new c.aQ;W.resize(4*N),W._trim();let J=0;for(const Q of D)for(let st=0;st=0&&(W[j.associatedIconIndex]={shiftedAnchor:Se,angle:Vt})}else Et(j.numGlyphs,V)}if(P){X.clear();const J=_.icon.placedSymbolArray;for(let j=0;j_.style.map.terrain.getElevation(At,co,wi):null,jn=u.layout.get("text-rotation-alignment")==="map";F(zt,At.posMatrix,_,f,Wr,ts,j,P,jn,bi)}const Js=_.translatePosMatrix(At.posMatrix,Pt,y,w),es=nt||f&>||eu?Eh:Wr,xi=_.translatePosMatrix(ts,Pt,y,w,!0),Gn=Vt&&u.paint.get(f?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let On;On=Vt?zt.iconsInText?Ul(ce.kind,ge,ft,j,_,Js,es,xi,Ne,Ci):Vl(ce.kind,ge,ft,j,_,Js,es,xi,f,Ne,!0):Bl(ce.kind,ge,ft,j,_,Js,es,xi,f,Ne);const uo={program:He,buffers:Bt,uniformValues:On,atlasTexture:Jn,atlasTextureIcon:qn,atlasInterpolation:fn,atlasInterpolationIcon:Hr,isSDF:Vt,hasHalo:Gn};if(Q&&zt.canOverlap){st=!0;const bi=Bt.segments.get();for(const jn of bi)xt.push({segments:new c.$([jn]),sortKey:jn.sortKey,state:uo,terrainData:Ae})}else xt.push({segments:Bt.segments,sortKey:0,state:uo,terrainData:Ae})}st&&xt.sort((At,Pt)=>At.sortKey-Pt.sortKey);for(const At of xt){const Pt=At.state;if(V.activeTexture.set(X.TEXTURE0),Pt.atlasTexture.bind(Pt.atlasInterpolation,X.CLAMP_TO_EDGE),Pt.atlasTextureIcon&&(V.activeTexture.set(X.TEXTURE1),Pt.atlasTextureIcon&&Pt.atlasTextureIcon.bind(Pt.atlasInterpolationIcon,X.CLAMP_TO_EDGE)),Pt.isSDF){const zt=Pt.uniformValues;Pt.hasHalo&&(zt.u_is_halo=1,gd(Pt.buffers,At.segments,u,_,Pt.program,mt,D,N,zt,At.terrainData)),zt.u_is_halo=0}gd(Pt.buffers,At.segments,u,_,Pt.program,mt,D,N,Pt.uniformValues,At.terrainData)}}function gd(_,i,u,d,f,y,w,I,C,P){const D=d.context;f.draw(D,D.gl.TRIANGLES,y,w,I,En.disabled,C,P,u.id,_.layoutVertexBuffer,_.indexBuffer,i,u.paint,d.transform.zoom,_.programConfigurations.get(u.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function tc(_,i,u,d,f){if(!u||!d||!d.imageAtlas)return;const y=d.imageAtlas.patternPositions;let w=y[u.to.toString()],I=y[u.from.toString()];if(!w&&I&&(w=I),!I&&w&&(I=w),!w||!I){const C=f.getPaintProperty(i);w=y[C],I=y[C]}w&&I&&_.setConstantPatternPositions(w,I)}function _d(_,i,u,d,f,y,w){const I=_.context.gl,C="fill-pattern",P=u.paint.get(C),D=P&&P.constantOr(1),N=u.getCrossfadeParameters();let V,X,W,J,j;w?(X=D&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",V=I.LINES):(X=D?"fillPattern":"fill",V=I.TRIANGLES);const nt=P.constantOr(null);for(const ft of d){const Q=i.getTile(ft);if(D&&!Q.patternsLoaded())continue;const st=Q.getBucket(u);if(!st)continue;const mt=st.programConfigurations.get(u.id),gt=_.useProgram(X,mt),xt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ft);D&&(_.context.activeTexture.set(I.TEXTURE0),Q.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),mt.updatePaintBuffers(N)),tc(mt,C,nt,Q,u);const At=xt?ft:null,Pt=_.translatePosMatrix(At?At.posMatrix:ft.posMatrix,Q,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(w){J=st.indexBuffer2,j=st.segments2;const zt=[I.drawingBufferWidth,I.drawingBufferHeight];W=X==="fillOutlinePattern"&&D?ed(Pt,_,N,Q,zt):Of(Pt,zt)}else J=st.indexBuffer,j=st.segments,W=D?Fu(Pt,_,N,Q):td(Pt);gt.draw(_.context,V,f,_.stencilModeForClipping(ft),y,En.disabled,W,xt,u.id,st.layoutVertexBuffer,J,j,u.paint,_.transform.zoom,mt)}}function ec(_,i,u,d,f,y,w){const I=_.context,C=I.gl,P="fill-extrusion-pattern",D=u.paint.get(P),N=D.constantOr(1),V=u.getCrossfadeParameters(),X=u.paint.get("fill-extrusion-opacity"),W=D.constantOr(null);for(const J of d){const j=i.getTile(J),nt=j.getBucket(u);if(!nt)continue;const ft=_.style.map.terrain&&_.style.map.terrain.getTerrainData(J),Q=nt.programConfigurations.get(u.id),st=_.useProgram(N?"fillExtrusionPattern":"fillExtrusion",Q);N&&(_.context.activeTexture.set(C.TEXTURE0),j.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Q.updatePaintBuffers(V)),tc(Q,P,W,j,u);const mt=_.translatePosMatrix(J.posMatrix,j,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),gt=u.paint.get("fill-extrusion-vertical-gradient"),xt=N?zf(mt,_,gt,X,J,V,j):zl(mt,_,gt,X);st.draw(I,I.gl.TRIANGLES,f,y,w,En.backCCW,xt,ft,u.id,nt.layoutVertexBuffer,nt.indexBuffer,nt.segments,u.paint,_.transform.zoom,Q,_.style.map.terrain&&nt.centroidVertexBuffer)}}function nc(_,i,u,d,f,y,w){const I=_.context,C=I.gl,P=u.fbo;if(!P)return;const D=_.useProgram("hillshade"),N=_.style.map.terrain&&_.style.map.terrain.getTerrainData(i);I.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,P.colorAttachment.get()),D.draw(I,C.TRIANGLES,f,y,w,En.disabled,((V,X,W,J)=>{const j=W.paint.get("hillshade-shadow-color"),nt=W.paint.get("hillshade-highlight-color"),ft=W.paint.get("hillshade-accent-color");let Q=W.paint.get("hillshade-illumination-direction")*(Math.PI/180);W.paint.get("hillshade-illumination-anchor")==="viewport"&&(Q-=V.transform.angle);const st=!V.options.moving;return{u_matrix:J?J.posMatrix:V.transform.calculatePosMatrix(X.tileID.toUnwrapped(),st),u_image:0,u_latrange:od(0,X.tileID),u_light:[W.paint.get("hillshade-exaggeration"),Q],u_shadow:j,u_highlight:nt,u_accent:ft}})(_,u,d,N?i:null),N,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function Sh(_,i,u,d,f,y){const w=_.context,I=w.gl,C=i.dem;if(C&&C.data){const P=C.dim,D=C.stride,N=C.getPixels();if(w.activeTexture.set(I.TEXTURE1),w.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||_.getTileTexture(D),i.demTexture){const X=i.demTexture;X.update(N,{premultiply:!1}),X.bind(I.NEAREST,I.CLAMP_TO_EDGE)}else i.demTexture=new Nt(w,N,I.RGBA,{premultiply:!1}),i.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);w.activeTexture.set(I.TEXTURE0);let V=i.fbo;if(!V){const X=new Nt(w,{width:P,height:P,data:null},I.RGBA);X.bind(I.LINEAR,I.CLAMP_TO_EDGE),V=i.fbo=w.createFramebuffer(P,P,!0,!1),V.colorAttachment.set(X.texture)}w.bindFramebuffer.set(V.framebuffer),w.viewport.set([0,0,P,P]),_.useProgram("hillshadePrepare").draw(w,I.TRIANGLES,d,f,y,En.disabled,((X,W)=>{const J=W.stride,j=c.F();return c.aN(j,0,c.W,-c.W,0,0,1),c.H(j,j,[0,-c.W,0]),{u_matrix:j,u_image:1,u_dimension:[J,J],u_zoom:X.overscaledZ,u_unpack:W.getUnpackVector()}})(i.tileID,C),null,u.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function yd(_,i,u,d,f,y){const w=d.paint.get("raster-fade-duration");if(!y&&w>0){const I=k.now(),C=(I-_.timeAdded)/w,P=i?(I-i.timeAdded)/w:-1,D=u.getSource(),N=f.coveringZoomLevel({tileSize:D.tileSize,roundZoom:D.roundZoom}),V=!i||Math.abs(i.tileID.overscaledZ-N)>Math.abs(_.tileID.overscaledZ-N),X=V&&_.refreshedUponExpiration?1:c.ac(V?C:1-P,0,1);return _.refreshedUponExpiration&&C>=1&&(_.refreshedUponExpiration=!1),i?{opacity:1,mix:1-X}:{opacity:X,mix:0}}return{opacity:1,mix:0}}const vd=new c.aO(1,0,0,1),ic=new c.aO(0,1,0,1),Ch=new c.aO(0,0,1,1),Kf=new c.aO(1,0,1,1),xd=new c.aO(0,1,1,1);function Yn(_,i,u,d){mr(_,0,i+u/2,_.transform.width,u,d)}function Hs(_,i,u,d){mr(_,i-u/2,0,u,_.transform.height,d)}function mr(_,i,u,d,f,y){const w=_.context,I=w.gl;I.enable(I.SCISSOR_TEST),I.scissor(i*_.pixelRatio,u*_.pixelRatio,d*_.pixelRatio,f*_.pixelRatio),w.clear({color:y}),I.disable(I.SCISSOR_TEST)}function Th(_,i,u){const d=_.context,f=d.gl,y=u.posMatrix,w=_.useProgram("debug"),I=Ze.disabled,C=Pn.disabled,P=_.colorModeForRenderPass(),D="$debug",N=_.style.map.terrain&&_.style.map.terrain.getTerrainData(u);d.activeTexture.set(f.TEXTURE0);const V=i.getTileByID(u.key).latestRawTileData,X=Math.floor((V&&V.byteLength||0)/1024),W=i.getTile(u).tileSize,J=512/Math.min(W,512)*(u.overscaledZ/_.transform.zoom)*.5;let j=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(j+=` => ${u.overscaledZ}`),function(nt,ft){nt.initDebugOverlayCanvas();const Q=nt.debugOverlayCanvas,st=nt.context.gl,mt=nt.debugOverlayCanvas.getContext("2d");mt.clearRect(0,0,Q.width,Q.height),mt.shadowColor="white",mt.shadowBlur=2,mt.lineWidth=1.5,mt.strokeStyle="white",mt.textBaseline="top",mt.font="bold 36px Open Sans, sans-serif",mt.fillText(ft,5,5),mt.strokeText(ft,5,5),nt.debugOverlayTexture.update(Q),nt.debugOverlayTexture.bind(st.LINEAR,st.CLAMP_TO_EDGE)}(_,`${j} ${X}kB`),w.draw(d,f.TRIANGLES,I,C,ci.alphaBlended,En.disabled,id(y,c.aO.transparent,J),null,D,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),w.draw(d,f.LINE_STRIP,I,C,P,En.disabled,id(y,c.aO.red),N,D,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function rc(_,i,u){const d=_.context,f=d.gl,y=_.colorModeForRenderPass(),w=new Ze(f.LEQUAL,Ze.ReadWrite,_.depthRangeFor3D),I=_.useProgram("terrain"),C=i.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const P of u){const D=_.renderToTexture.getTexture(P),N=i.getTerrainData(P.tileID);d.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,D.texture);const V={u_matrix:_.transform.calculatePosMatrix(P.tileID.toUnwrapped()),u_texture:0,u_ele_delta:i.getMeshFrameDelta(_.transform.zoom)};I.draw(d,f.TRIANGLES,w,Pn.disabled,y,En.backCCW,V,N,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}class bd{constructor(i,u){this.context=new Yf(i),this.transform=u,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=tr.maxUnderzooming+tr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new js}resize(i,u,d){if(this.width=Math.floor(i*d),this.height=Math.floor(u*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const f of this.style._order)this.style._layers[f].resize()}setup(){const i=this.context,u=new c.aV;u.emplaceBack(0,0),u.emplaceBack(c.W,0),u.emplaceBack(0,c.W),u.emplaceBack(c.W,c.W),this.tileExtentBuffer=i.createVertexBuffer(u,ku.members),this.tileExtentSegments=c.$.simpleSegment(0,0,4,2);const d=new c.aV;d.emplaceBack(0,0),d.emplaceBack(c.W,0),d.emplaceBack(0,c.W),d.emplaceBack(c.W,c.W),this.debugBuffer=i.createVertexBuffer(d,ku.members),this.debugSegments=c.$.simpleSegment(0,0,4,5);const f=new c.Z;f.emplaceBack(0,0,0,0),f.emplaceBack(c.W,0,c.W,0),f.emplaceBack(0,c.W,0,c.W),f.emplaceBack(c.W,c.W,c.W,c.W),this.rasterBoundsBuffer=i.createVertexBuffer(f,Jt.members),this.rasterBoundsSegments=c.$.simpleSegment(0,0,4,2);const y=new c.aV;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(y,ku.members),this.viewportSegments=c.$.simpleSegment(0,0,4,2);const w=new c.aW;w.emplaceBack(0),w.emplaceBack(1),w.emplaceBack(3),w.emplaceBack(2),w.emplaceBack(0),this.tileBorderIndexBuffer=i.createIndexBuffer(w);const I=new c.aX;I.emplaceBack(0,1,2),I.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(I);const C=this.context.gl;this.stencilClearMode=new Pn({func:C.ALWAYS,mask:0},0,255,C.ZERO,C.ZERO,C.ZERO)}clearStencil(){const i=this.context,u=i.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=c.F();c.aN(d,0,this.width,this.height,0,0,1),c.J(d,d,[u.drawingBufferWidth,u.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(i,u.TRIANGLES,Ze.disabled,this.stencilClearMode,ci.disabled,En.disabled,Bu(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(i,u){if(this.currentStencilSource===i.source||!i.isTileClipped()||!u||!u.length)return;this.currentStencilSource=i.source;const d=this.context,f=d.gl;this.nextStencilID+u.length>256&&this.clearStencil(),d.setColorMode(ci.disabled),d.setDepthMode(Ze.disabled);const y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const w of u){const I=this._tileClippingMaskIDs[w.key]=this.nextStencilID++,C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(w);y.draw(d,f.TRIANGLES,Ze.disabled,new Pn({func:f.ALWAYS,mask:0},I,255,f.KEEP,f.KEEP,f.REPLACE),ci.disabled,En.disabled,Bu(w.posMatrix),C,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const i=this.nextStencilID++,u=this.context.gl;return new Pn({func:u.NOTEQUAL,mask:255},i,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(i){const u=this.context.gl;return new Pn({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(i){const u=this.context.gl,d=i.sort((w,I)=>I.overscaledZ-w.overscaledZ),f=d[d.length-1].overscaledZ,y=d[0].overscaledZ-f+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();const w={};for(let I=0;I=0;this.currentLayer--){const C=this.style._layers[d[this.currentLayer]],P=f[C.source],D=y[C.source];this._renderTileClippingMasks(C,D),this.renderLayer(this,P,C,D)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerj.source&&!j.isHidden(D)?[P.sourceCaches[j.source]]:[]),X=V.filter(j=>j.getSource().type==="vector"),W=V.filter(j=>j.getSource().type!=="vector"),J=j=>{(!N||N.getSource().maxzoomJ(j)),N||W.forEach(j=>J(j)),N}(this.style,this.transform.zoom);C&&function(P,D,N){for(let V=0;V0),f&&(c.a_(u,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(y,w){const I=y.context,C=I.gl,P=ci.unblended,D=new Ze(C.LEQUAL,Ze.ReadWrite,[0,1]),N=w.getTerrainMesh(),V=w.sourceCache.getRenderableTiles(),X=y.useProgram("terrainDepth");I.bindFramebuffer.set(w.getFramebuffer("depth").framebuffer),I.viewport.set([0,0,y.width/devicePixelRatio,y.height/devicePixelRatio]),I.clear({color:c.aO.transparent,depth:1});for(const W of V){const J=w.getTerrainData(W.tileID),j={u_matrix:y.transform.calculatePosMatrix(W.tileID.toUnwrapped()),u_ele_delta:w.getMeshFrameDelta(y.transform.zoom)};X.draw(I,C.TRIANGLES,D,Pn.disabled,P,En.backCCW,j,J,"terrain",N.vertexBuffer,N.indexBuffer,N.segments)}I.bindFramebuffer.set(null),I.viewport.set([0,0,y.width,y.height])}(this,this.style.map.terrain),function(y,w){const I=y.context,C=I.gl,P=ci.unblended,D=new Ze(C.LEQUAL,Ze.ReadWrite,[0,1]),N=w.getTerrainMesh(),V=w.getCoordsTexture(),X=w.sourceCache.getRenderableTiles(),W=y.useProgram("terrainCoords");I.bindFramebuffer.set(w.getFramebuffer("coords").framebuffer),I.viewport.set([0,0,y.width/devicePixelRatio,y.height/devicePixelRatio]),I.clear({color:c.aO.transparent,depth:1}),w.coordsIndex=[];for(const J of X){const j=w.getTerrainData(J.tileID);I.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,V.texture);const nt={u_matrix:y.transform.calculatePosMatrix(J.tileID.toUnwrapped()),u_terrain_coords_id:(255-w.coordsIndex.length)/255,u_texture:0,u_ele_delta:w.getMeshFrameDelta(y.transform.zoom)};W.draw(I,C.TRIANGLES,D,Pn.disabled,P,En.backCCW,nt,j,"terrain",N.vertexBuffer,N.indexBuffer,N.segments),w.coordsIndex.push(J.tileID.key)}I.bindFramebuffer.set(null),I.viewport.set([0,0,y.width,y.height])}(this,this.style.map.terrain))}renderLayer(i,u,d,f){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(f||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(y,w,I,C,P){if(y.renderPass!=="translucent")return;const D=Pn.disabled,N=y.colorModeForRenderPass();(I._unevaluatedLayout.hasValue("text-variable-anchor")||I._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(V,X,W,J,j,nt,ft){const Q=X.transform,st=j==="map",mt=nt==="map";for(const gt of V){const xt=J.getTile(gt),At=xt.getBucket(W);if(!At||!At.text||!At.text.segments.get().length)continue;const Pt=c.ag(At.textSizeData,Q.zoom),zt=ve(xt,1,X.transform.zoom),Bt=Ie(gt.posMatrix,mt,st,X.transform,zt),Se=W.layout.get("icon-text-fit")!=="none"&&At.hasIconData();if(Pt){const Vt=Math.pow(2,Q.zoom-xt.tileID.overscaledZ);Ju(At,st,mt,ft,Q,Bt,gt.posMatrix,Vt,Pt,Se,X.style.map.terrain?(ce,Ce)=>X.style.map.terrain.getElevation(gt,ce,Ce):null)}}}(C,y,I,w,I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),P),I.paint.get("icon-opacity").constantOr(1)!==0&&$u(y,w,I,C,!1,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),I.layout.get("icon-rotation-alignment"),I.layout.get("icon-pitch-alignment"),I.layout.get("icon-keep-upright"),D,N),I.paint.get("text-opacity").constantOr(1)!==0&&$u(y,w,I,C,!0,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.layout.get("text-keep-upright"),D,N),w.map.showCollisionBoxes&&(Ku(y,w,I,C,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),!0),Ku(y,w,I,C,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),!1))})(i,u,d,f,this.style.placement.variableOffsets);break;case"circle":(function(y,w,I,C){if(y.renderPass!=="translucent")return;const P=I.paint.get("circle-opacity"),D=I.paint.get("circle-stroke-width"),N=I.paint.get("circle-stroke-opacity"),V=!I.layout.get("circle-sort-key").isConstant();if(P.constantOr(1)===0&&(D.constantOr(1)===0||N.constantOr(1)===0))return;const X=y.context,W=X.gl,J=y.depthModeForSublayer(0,Ze.ReadOnly),j=Pn.disabled,nt=y.colorModeForRenderPass(),ft=[];for(let Q=0;QQ.sortKey-st.sortKey);for(const Q of ft){const{programConfiguration:st,program:mt,layoutVertexBuffer:gt,indexBuffer:xt,uniformValues:At,terrainData:Pt}=Q.state;mt.draw(X,W.TRIANGLES,J,j,nt,En.disabled,At,Pt,I.id,gt,xt,Q.segments,I.paint,y.transform.zoom,st)}})(i,u,d,f);break;case"heatmap":(function(y,w,I,C){if(I.paint.get("heatmap-opacity")!==0)if(y.renderPass==="offscreen"){const P=y.context,D=P.gl,N=Pn.disabled,V=new ci([D.ONE,D.ONE],c.aO.transparent,[!0,!0,!0,!0]);(function(X,W,J){const j=X.gl;X.activeTexture.set(j.TEXTURE1),X.viewport.set([0,0,W.width/4,W.height/4]);let nt=J.heatmapFbo;if(nt)j.bindTexture(j.TEXTURE_2D,nt.colorAttachment.get()),X.bindFramebuffer.set(nt.framebuffer);else{const ft=j.createTexture();j.bindTexture(j.TEXTURE_2D,ft),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.LINEAR),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.LINEAR),nt=J.heatmapFbo=X.createFramebuffer(W.width/4,W.height/4,!1,!1),function(Q,st,mt,gt){var xt,At;const Pt=Q.gl,zt=(xt=Q.HALF_FLOAT)!==null&&xt!==void 0?xt:Pt.UNSIGNED_BYTE,Bt=(At=Q.RGBA16F)!==null&&At!==void 0?At:Pt.RGBA;Pt.texImage2D(Pt.TEXTURE_2D,0,Bt,st.width/4,st.height/4,0,Pt.RGBA,zt,null),gt.colorAttachment.set(mt)}(X,W,ft,nt)}})(P,y,I),P.clear({color:c.aO.transparent});for(let X=0;X{const Q=c.F();c.aN(Q,0,J.width,J.height,0,0,1);const st=J.context.gl;return{u_matrix:Q,u_world:[st.drawingBufferWidth,st.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:j.paint.get("heatmap-opacity")}})(P,D),null,D.id,P.viewportBuffer,P.quadTriangleIndexBuffer,P.viewportSegments,D.paint,P.transform.zoom)}(y,I))})(i,u,d,f);break;case"line":(function(y,w,I,C){if(y.renderPass!=="translucent")return;const P=I.paint.get("line-opacity"),D=I.paint.get("line-width");if(P.constantOr(1)===0||D.constantOr(1)===0)return;const N=y.depthModeForSublayer(0,Ze.ReadOnly),V=y.colorModeForRenderPass(),X=I.paint.get("line-dasharray"),W=I.paint.get("line-pattern"),J=W.constantOr(1),j=I.paint.get("line-gradient"),nt=I.getCrossfadeParameters(),ft=J?"linePattern":X?"lineSDF":j?"lineGradient":"line",Q=y.context,st=Q.gl;let mt=!0;for(const gt of C){const xt=w.getTile(gt);if(J&&!xt.patternsLoaded())continue;const At=xt.getBucket(I);if(!At)continue;const Pt=At.programConfigurations.get(I.id),zt=y.context.program.get(),Bt=y.useProgram(ft,Pt),Se=mt||Bt.program!==zt,Vt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(gt),ce=W.constantOr(null);if(ce&&xt.imageAtlas){const ge=xt.imageAtlas,Ae=ge.patternPositions[ce.to.toString()],Ne=ge.patternPositions[ce.from.toString()];Ae&&Ne&&Pt.setConstantPatternPositions(Ae,Ne)}const Ce=Vt?gt:null,He=J?ga(y,xt,I,nt,Ce):X?Uu(y,xt,I,X,nt,Ce):j?sd(y,xt,I,At.lineClipsArray.length,Ce):Vu(y,xt,I,Ce);if(J)Q.activeTexture.set(st.TEXTURE0),xt.imageAtlasTexture.bind(st.LINEAR,st.CLAMP_TO_EDGE),Pt.updatePaintBuffers(nt);else if(X&&(Se||y.lineAtlas.dirty))Q.activeTexture.set(st.TEXTURE0),y.lineAtlas.bind(Q);else if(j){const ge=At.gradients[I.id];let Ae=ge.texture;if(I.gradientVersion!==ge.version){let Ne=256;if(I.stepInterpolant){const Jn=w.getSource().maxzoom,fn=gt.canonical.z===Jn?Math.ceil(1<0?u.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const u=this.imageManager.getPattern(i.from.toString()),d=this.imageManager.getPattern(i.to.toString());return!u||!d}useProgram(i,u){this.cache=this.cache||{};const d=i+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Zs(this.context,kl[i],u,ad[i],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}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 i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Nt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:i,drawingBufferHeight:u}=this.context.gl;return this.width!==i||this.height!==u}}class Ws{constructor(i,u){this.points=i,this.planes=u}static fromInvProjectionMatrix(i,u,d){const f=Math.pow(2,d),y=[[-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 C=1/(I=c.af([],I,i))[3]/u*f;return c.a$(I,I,[C,C,1/I[3],C])}),w=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(I=>{const C=function(V,X){var W=X[0],J=X[1],j=X[2],nt=W*W+J*J+j*j;return nt>0&&(nt=1/Math.sqrt(nt)),V[0]=X[0]*nt,V[1]=X[1]*nt,V[2]=X[2]*nt,V}([],function(V,X,W){var J=X[0],j=X[1],nt=X[2],ft=W[0],Q=W[1],st=W[2];return V[0]=j*st-nt*Q,V[1]=nt*ft-J*st,V[2]=J*Q-j*ft,V}([],Me([],y[I[0]],y[I[1]]),Me([],y[I[2]],y[I[1]]))),P=-((D=C)[0]*(N=y[I[1]])[0]+D[1]*N[1]+D[2]*N[2]);var D,N;return C.concat(P)});return new Ws(y,w)}}class Xs{constructor(i,u){this.min=i,this.max=u,this.center=function(d,f,y){return d[0]=.5*f[0],d[1]=.5*f[1],d[2]=.5*f[2],d}([],function(d,f,y){return d[0]=f[0]+y[0],d[1]=f[1]+y[1],d[2]=f[2]+y[2],d}([],this.min,this.max))}quadrant(i){const u=[i%2==0,i<2],d=Ve(this.min),f=Ve(this.max);for(let y=0;y=0&&w++;if(w===0)return 0;w!==u.length&&(d=!1)}if(d)return 2;for(let f=0;f<3;f++){let y=Number.MAX_VALUE,w=-Number.MAX_VALUE;for(let I=0;Ithis.max[f]-this.min[f])return 0}return 1}}class tl{constructor(i=0,u=0,d=0,f=0){if(isNaN(i)||i<0||isNaN(u)||u<0||isNaN(d)||d<0||isNaN(f)||f<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=u,this.left=d,this.right=f}interpolate(i,u,d){return u.top!=null&&i.top!=null&&(this.top=c.z.number(i.top,u.top,d)),u.bottom!=null&&i.bottom!=null&&(this.bottom=c.z.number(i.bottom,u.bottom,d)),u.left!=null&&i.left!=null&&(this.left=c.z.number(i.left,u.left,d)),u.right!=null&&i.right!=null&&(this.right=c.z.number(i.right,u.right,d)),this}getCenter(i,u){const d=c.ac((this.left+i-this.right)/2,0,i),f=c.ac((this.top+u-this.bottom)/2,0,u);return new c.P(d,f)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new tl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Lh=85.051129;class oc{constructor(i,u,d,f,y){this.tileSize=512,this._renderWorldCopies=y===void 0||!!y,this._minZoom=i||0,this._maxZoom=u||22,this._minPitch=d??0,this._maxPitch=f??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new tl,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const i=new oc(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.apply(this),i}apply(i){this.tileSize=i.tileSize,this.latRange=i.latRange,this.width=i.width,this.height=i.height,this._center=i._center,this._elevation=i._elevation,this.minElevationForCurrentTile=i.minElevationForCurrentTile,this.zoom=i.zoom,this.angle=i.angle,this._fov=i._fov,this._pitch=i._pitch,this._unmodified=i._unmodified,this._edgeInsets=i._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(i){const u=-c.b1(i,-180,180)*Math.PI/180;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=function(){var d=new c.A(4);return c.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,f,y){var w=f[0],I=f[1],C=f[2],P=f[3],D=Math.sin(y),N=Math.cos(y);d[0]=w*N+C*D,d[1]=I*N+P*D,d[2]=w*-D+C*N,d[3]=I*-D+P*N}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){const u=c.ac(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(i){const u=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.tileZoom=Math.max(0,Math.floor(u)),this.scale=this.zoomScale(u),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(i){i!==this._elevation&&(this._elevation=i,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,u,d){this._unmodified=!1,this._edgeInsets.interpolate(i,u,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){const u=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(i){const u=[new c.b2(0,i)];if(this._renderWorldCopies){const d=this.pointCoordinate(new c.P(0,0)),f=this.pointCoordinate(new c.P(this.width,0)),y=this.pointCoordinate(new c.P(this.width,this.height)),w=this.pointCoordinate(new c.P(0,this.height)),I=Math.floor(Math.min(d.x,f.x,y.x,w.x)),C=Math.floor(Math.max(d.x,f.x,y.x,w.x)),P=1;for(let D=I-P;D<=C+P;D++)D!==0&&u.push(new c.b2(D,i))}return u}coveringTiles(i){var u,d;let f=this.coveringZoomLevel(i);const y=f;if(i.minzoom!==void 0&&fi.maxzoom&&(f=i.maxzoom);const w=this.pointCoordinate(this.getCameraPoint()),I=c.Y.fromLngLat(this.center),C=Math.pow(2,f),P=[C*w.x,C*w.y,0],D=[C*I.x,C*I.y,0],N=Ws.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,f);let V=i.minzoom||0;!i.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(V=f);const X=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,W=Q=>({aabb:new Xs([Q*C,0,0],[(Q+1)*C,C,0]),zoom:0,x:0,y:0,wrap:Q,fullyVisible:!1}),J=[],j=[],nt=f,ft=i.reparseOverscaled?y:f;if(this._renderWorldCopies)for(let Q=1;Q<=3;Q++)J.push(W(-Q)),J.push(W(Q));for(J.push(W(0));J.length>0;){const Q=J.pop(),st=Q.x,mt=Q.y;let gt=Q.fullyVisible;if(!gt){const Bt=Q.aabb.intersects(N);if(Bt===0)continue;gt=Bt===2}const xt=i.terrain?P:D,At=Q.aabb.distanceX(xt),Pt=Q.aabb.distanceY(xt),zt=Math.max(Math.abs(At),Math.abs(Pt));if(Q.zoom===nt||zt>X+(1<=V){const Bt=nt-Q.zoom,Se=P[0]-.5-(st<>1),ce=Q.zoom+1;let Ce=Q.aabb.quadrant(Bt);if(i.terrain){const He=new c.Q(ce,Q.wrap,ce,Se,Vt),ge=i.terrain.getMinMaxElevation(He),Ae=(u=ge.minElevation)!==null&&u!==void 0?u:this.elevation,Ne=(d=ge.maxElevation)!==null&&d!==void 0?d:this.elevation;Ce=new Xs([Ce.min[0],Ce.min[1],Ae],[Ce.max[0],Ce.max[1],Ne])}J.push({aabb:Ce,zoom:ce,x:Se,y:Vt,wrap:Q.wrap,fullyVisible:gt})}}return j.sort((Q,st)=>Q.distanceSq-st.distanceSq).map(Q=>Q.tileID)}resize(i,u){this.width=i,this.height=u,this.pixelsToGLUnits=[2/i,-2/u],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){const u=c.ac(i.lat,-85.051129,Lh);return new c.P(c.N(i.lng)*this.worldSize,c.O(u)*this.worldSize)}unproject(i){return new c.Y(i.x/this.worldSize,i.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(i){const u=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,f=this.pointLocation(this.centerPoint,i),y=i.getElevationForLngLatZoom(f,this.tileZoom);if(!(this.elevation-y))return;const w=d+u-y,I=Math.cos(this._pitch)*this.cameraToCenterDistance/w/c.b3(1,f.lat),C=this.scaleZoom(I/this.tileSize);this._elevation=y,this._center=f,this.zoom=C}setLocationAtPoint(i,u){const d=this.pointCoordinate(u),f=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(i),w=new c.Y(y.x-(d.x-f.x),y.y-(d.y-f.y));this.center=this.coordinateLocation(w),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(i,u){return u?this.coordinatePoint(this.locationCoordinate(i),u.getElevationForLngLatZoom(i,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(i))}pointLocation(i,u){return this.coordinateLocation(this.pointCoordinate(i,u))}locationCoordinate(i){return c.Y.fromLngLat(i)}coordinateLocation(i){return i&&i.toLngLat()}pointCoordinate(i,u){if(u){const V=u.pointCoordinate(i);if(V!=null)return V}const d=[i.x,i.y,0,1],f=[i.x,i.y,1,1];c.af(d,d,this.pixelMatrixInverse),c.af(f,f,this.pixelMatrixInverse);const y=d[3],w=f[3],I=d[1]/y,C=f[1]/w,P=d[2]/y,D=f[2]/w,N=P===D?0:(0-P)/(D-P);return new c.Y(c.z.number(d[0]/y,f[0]/w,N)/this.worldSize,c.z.number(I,C,N)/this.worldSize)}coordinatePoint(i,u=0,d=this.pixelMatrix){const f=[i.x*this.worldSize,i.y*this.worldSize,u,1];return c.af(f,f,d),new c.P(f[0]/f[3],f[1]/f[3])}getBounds(){const i=Math.max(0,this.height/2-this.getHorizon());return new St().extend(this.pointLocation(new c.P(0,i))).extend(this.pointLocation(new c.P(this.width,i))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new St([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(i){i?(this.lngRange=[i.getWest(),i.getEast()],this.latRange=[i.getSouth(),i.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Lh])}calculatePosMatrix(i,u=!1){const d=i.key,f=u?this._alignedPosMatrixCache:this._posMatrixCache;if(f[d])return f[d];const y=i.canonical,w=this.worldSize/this.zoomScale(y.z),I=y.x+Math.pow(2,y.z)*i.wrap,C=c.an(new Float64Array(16));return c.H(C,C,[I*w,y.y*w,0]),c.J(C,C,[w/c.W,w/c.W,1]),c.K(C,u?this.alignedProjMatrix:this.projMatrix,C),f[d]=new Float32Array(C),f[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(i,u){u=c.ac(+u,this.minZoom,this.maxZoom);const d={center:new c.M(i.lng,i.lat),zoom:u};let f=this.lngRange;if(!this._renderWorldCopies&&f===null){const Q=179.9999999999;f=[-Q,Q]}const y=this.tileSize*this.zoomScale(d.zoom);let w=0,I=y,C=0,P=y,D=0,N=0;const{x:V,y:X}=this.size;if(this.latRange){const Q=this.latRange;w=c.O(Q[1])*y,I=c.O(Q[0])*y,I-wI&&(nt=I-Q)}if(f){const Q=(C+P)/2;let st=W;this._renderWorldCopies&&(st=c.b1(W,Q-y/2,Q+y/2));const mt=V/2;st-mtP&&(j=P-mt)}if(j!==void 0||nt!==void 0){const Q=new c.P(j??W,nt??J);d.center=this.unproject.call({worldSize:y},Q).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const i=this._unmodified,{center:u,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=u,this.zoom=d,this._unmodified=i,this._constraining=!1}_calcMatrices(){if(!this.height)return;const i=this.centerOffset,u=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b3(1,this.center.lat)*this.worldSize;let f=c.an(new Float64Array(16));c.J(f,f,[this.width/2,-this.height/2,1]),c.H(f,f,[1,-1,0]),this.labelPlaneMatrix=f,f=c.an(new Float64Array(16)),c.J(f,f,[1,-1,1]),c.H(f,f,[-1,-1,0]),c.J(f,f,[2/this.width,2/this.height,1]),this.glCoordMatrix=f;const y=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),w=Math.min(this.elevation,this.minElevationForCurrentTile),I=y-w*this._pixelPerMeter/Math.cos(this._pitch),C=w<0?I:y,P=Math.PI/2+this._pitch,D=this._fov*(.5+i.y/this.height),N=Math.sin(D)*C/Math.sin(c.ac(Math.PI-P-D,.01,Math.PI-.01)),V=this.getHorizon(),X=2*Math.atan(V/this.cameraToCenterDistance)*(.5+i.y/(2*V)),W=Math.sin(X)*C/Math.sin(c.ac(Math.PI-P-X,.01,Math.PI-.01)),J=Math.min(N,W),j=1.01*(Math.cos(Math.PI/2-this._pitch)*J+C),nt=this.height/50;f=new Float64Array(16),c.b4(f,this._fov,this.width/this.height,nt,j),f[8]=2*-i.x/this.width,f[9]=2*i.y/this.height,c.J(f,f,[1,-1,1]),c.H(f,f,[0,0,-this.cameraToCenterDistance]),c.b5(f,f,this._pitch),c.ad(f,f,this.angle),c.H(f,f,[-u,-d,0]),this.mercatorMatrix=c.J([],f,[this.worldSize,this.worldSize,this.worldSize]),c.J(f,f,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.K(new Float64Array(16),this.labelPlaneMatrix,f),c.H(f,f,[0,0,-this.elevation]),this.projMatrix=f,this.invProjMatrix=c.ar([],f),this.pixelMatrix3D=c.K(new Float64Array(16),this.labelPlaneMatrix,f);const ft=this.width%2/2,Q=this.height%2/2,st=Math.cos(this.angle),mt=Math.sin(this.angle),gt=u-Math.round(u)+st*ft+mt*Q,xt=d-Math.round(d)+st*Q+mt*ft,At=new Float64Array(f);if(c.H(At,At,[gt>.5?gt-1:gt,xt>.5?xt-1:xt,0]),this.alignedProjMatrix=At,f=c.ar(new Float64Array(16),this.pixelMatrix),!f)throw new Error("failed to invert matrix");this.pixelMatrixInverse=f,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const i=this.pointCoordinate(new c.P(0,0)),u=[i.x*this.worldSize,i.y*this.worldSize,0,1];return c.af(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,i))}getCameraQueryGeometry(i){const u=this.getCameraPoint();if(i.length===1)return[i[0],u];{let d=u.x,f=u.y,y=u.x,w=u.y;for(const I of i)d=Math.min(d,I.x),f=Math.min(f,I.y),y=Math.max(y,I.x),w=Math.max(w,I.y);return[new c.P(d,f),new c.P(y,f),new c.P(y,w),new c.P(d,w),new c.P(d,f)]}}lngLatToCameraDepth(i,u){const d=this.locationCoordinate(i),f=[d.x*this.worldSize,d.y*this.worldSize,u,1];return c.af(f,f,this.projMatrix),f[2]/f[3]}}function Ph(_,i){let u,d=!1,f=null,y=null;const w=()=>{f=null,d&&(_.apply(y,u),f=setTimeout(w,i),d=!1)};return(...I)=>(d=!0,y=this,u=I,f||w(),f)}class Ah{constructor(i){this._getCurrentHash=()=>{const u=window.location.hash.replace("#","");if(this._hashName){let d;return u.split("&").map(f=>f.split("=")).forEach(f=>{f[0]===this._hashName&&(d=f)}),(d&&d[1]||"").split("/")}return u.split("/")},this._onHashChange=()=>{const u=this._getCurrentHash();if(u.length>=3&&!u.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(u[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+u[2],+u[1]],zoom:+u[0],bearing:d,pitch:+(u[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const u=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,u)}catch{}},this._updateHash=Ph(this._updateHashUnthrottled,300),this._hashName=i&&encodeURIComponent(i)}addTo(i){return this._map=i,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(i){const u=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,f=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,f),w=Math.round(u.lng*y)/y,I=Math.round(u.lat*y)/y,C=this._map.getBearing(),P=this._map.getPitch();let D="";if(D+=i?`/${w}/${I}/${d}`:`${d}/${I}/${w}`,(C||P)&&(D+="/"+Math.round(10*C)/10),P&&(D+=`/${Math.round(P)}`),this._hashName){const N=this._hashName;let V=!1;const X=window.location.hash.slice(1).split("&").map(W=>{const J=W.split("=")[0];return J===N?(V=!0,`${J}=${D}`):W}).filter(W=>W);return V||X.push(`${N}=${D}`),`#${X.join("&")}`}return`#${D}`}}const Gl={linearity:.3,easing:c.b6(0,0,.3,1)},xa=c.e({deceleration:2500,maxSpeed:1400},Gl),wd=c.e({deceleration:20,maxSpeed:1400},Gl),Id=c.e({deceleration:1e3,maxSpeed:360},Gl),Ed=c.e({deceleration:1e3,maxSpeed:90},Gl);class Sd{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:k.now(),settings:i})}_drainInertiaBuffer(){const i=this._inertiaBuffer,u=k.now();for(;i.length>0&&u-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const u={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:y}of this._inertiaBuffer)u.zoom+=y.zoomDelta||0,u.bearing+=y.bearingDelta||0,u.pitch+=y.pitchDelta||0,y.panDelta&&u.pan._add(y.panDelta),y.around&&(u.around=y.around),y.pinchAround&&(u.pinchAround=y.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,f={};if(u.pan.mag()){const y=Zl(u.pan.mag(),d,c.e({},xa,i||{}));f.offset=u.pan.mult(y.amount/u.pan.mag()),f.center=this._map.transform.center,jl(f,y)}if(u.zoom){const y=Zl(u.zoom,d,wd);f.zoom=this._map.transform.zoom+y.amount,jl(f,y)}if(u.bearing){const y=Zl(u.bearing,d,Id);f.bearing=this._map.transform.bearing+c.ac(y.amount,-179,179),jl(f,y)}if(u.pitch){const y=Zl(u.pitch,d,Ed);f.pitch=this._map.transform.pitch+y.amount,jl(f,y)}if(f.zoom||f.bearing){const y=u.pinchAround===void 0?u.around:u.pinchAround;f.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),c.e(f,{noMoveStart:!0})}}function jl(_,i){(!_.duration||_.durationu.unproject(C)),I=y.reduce((C,P,D,N)=>C.add(P.div(N.length)),new c.P(0,0));super(i,{points:y,point:I,lngLats:w,lngLat:u.unproject(I),originalEvent:d}),this._defaultPrevented=!1}}class Mh extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,u,d){super(i,{originalEvent:d}),this._defaultPrevented=!1}}class Eo{constructor(i,u){this._map=i,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new Mh(i.type,this._map,i))}mousedown(i,u){return this._mousedownPos=u,this._firePreventable(new Pr(i.type,this._map,i))}mouseup(i){this._map.fire(new Pr(i.type,this._map,i))}click(i,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new Pr(i.type,this._map,i))}dblclick(i){return this._firePreventable(new Pr(i.type,this._map,i))}mouseover(i){this._map.fire(new Pr(i.type,this._map,i))}mouseout(i){this._map.fire(new Pr(i.type,this._map,i))}touchstart(i){return this._firePreventable(new Jo(i.type,this._map,i))}touchmove(i){this._map.fire(new Jo(i.type,this._map,i))}touchend(i){this._map.fire(new Jo(i.type,this._map,i))}touchcancel(i){this._map.fire(new Jo(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qo{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(i){this._map.fire(new Pr(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._ignoreContextMenu||this._map.fire(new Pr(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class el{constructor(i){this._map=i}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(i){return this.transform.pointLocation(c.P.convert(i),this._map.terrain)}}class So{constructor(i,u){this._map=i,this._tr=new el(i),this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=u.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,u){this.isEnabled()&&i.shiftKey&&i.button===0&&(U.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(i,u){if(!this._active)return;const d=u;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)y.fitScreenCoordinates(d,f,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",i)}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(U.remove(this._box),this._box=null),U.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,u){return this._map.fire(new c.k(i,{originalEvent:u}))}}function ba(_,i){if(_.length!==i.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${i.length}`);const u={};for(let d=0;d<_.length;d++)u[_[d].identifier]=i[d];return u}class Jf{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(i,u,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=i.timeStamp),d.length===this.numTouches&&(this.centroid=function(f){const y=new c.P(0,0);for(const w of f)y._add(w);return y.div(f.length)}(u),this.touches=ba(d,u)))}touchmove(i,u,d){if(this.aborted||!this.centroid)return;const f=ba(d,u);for(const y in this.touches){const w=f[y];(!w||w.dist(this.touches[y])>30)&&(this.aborted=!0)}}touchend(i,u,d){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const f=!this.aborted&&this.centroid;if(this.reset(),f)return f}}}class Dh{constructor(i){this.singleTap=new Jf(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,u,d){this.singleTap.touchstart(i,u,d)}touchmove(i,u,d){this.singleTap.touchmove(i,u,d)}touchend(i,u,d){const f=this.singleTap.touchend(i,u,d);if(f){const y=i.timeStamp-this.lastTime<500,w=!this.lastTap||this.lastTap.dist(f)<30;if(y&&w||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=f,this.count===this.numTaps)return this.reset(),f}}}class Qf{constructor(i){this._tr=new el(i),this._zoomIn=new Dh({numTouches:1,numTaps:2}),this._zoomOut=new Dh({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,u,d){this._zoomIn.touchstart(i,u,d),this._zoomOut.touchstart(i,u,d)}touchmove(i,u,d){this._zoomIn.touchmove(i,u,d),this._zoomOut.touchmove(i,u,d)}touchend(i,u,d){const f=this._zoomIn.touchend(i,u,d),y=this._zoomOut.touchend(i,u,d),w=this._tr;return f?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:w.zoom+1,around:w.unproject(f)},{originalEvent:i})}):y?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:w.zoom-1,around:w.unproject(y)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nl{constructor(i){this._enabled=!!i.enable,this._moveStateManager=i.moveStateManager,this._clickTolerance=i.clickTolerance||1,this._moveFunction=i.move,this._activateOnStart=!!i.activateOnStart,i.assignEvents(this),this.reset()}reset(i){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(i)}_move(...i){const u=this._moveFunction(...i);if(u.bearingDelta||u.pitchDelta||u.around||u.panDelta)return this._active=!0,u}dragStart(i,u){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(i)&&(this._moveStateManager.startMove(i),this._lastPoint=u.length?u[0]:u,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(i,u){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(i.preventDefault(),!this._moveStateManager.isValidMoveEvent(i))return void this.reset(i);const f=u.length?u[0]:u;return!this._moved&&f.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(i){i.preventDefault()}},il=({enable:_,clickTolerance:i,bearingDegreesPerPixelMoved:u=.8})=>{const d=new $o({checkCorrectEvent:f=>U.mouseButton(f)===0&&f.ctrlKey||U.mouseButton(f)===2});return new nl({clickTolerance:i,move:(f,y)=>({bearingDelta:(y.x-f.x)*u}),moveStateManager:d,enable:_,assignEvents:sc})},rl=({enable:_,clickTolerance:i,pitchDegreesPerPixelMoved:u=-.5})=>{const d=new $o({checkCorrectEvent:f=>U.mouseButton(f)===0&&f.ctrlKey||U.mouseButton(f)===2});return new nl({clickTolerance:i,move:(f,y)=>({pitchDelta:(y.y-f.y)*u}),moveStateManager:d,enable:_,assignEvents:sc})};class Cd{constructor(i,u){this._clickTolerance=i.clickTolerance||1,this._map=u,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(i,u,d){return this._calculateTransform(i,u,d)}touchmove(i,u,d){if(this._active&&!(d.length0&&(this._active=!0);const f=ba(d,u),y=new c.P(0,0),w=new c.P(0,0);let I=0;for(const P in f){const D=f[P],N=this._touches[P];N&&(y._add(D),w._add(D.sub(N)),I++,f[P]=D)}if(this._touches=f,IMath.abs(_.x)}class Pd extends Wt{constructor(i){super(),this._currentTouchCount=0,this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(i,u,d){super.touchstart(i,u,d),this._currentTouchCount=d.length}_start(i){this._lastPoints=i,lc(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,u,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const f=i[0].sub(this._lastPoints[0]),y=i[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(f,y,d.timeStamp),this._valid?(this._lastPoints=i,this._active=!0,{pitchDelta:(f.y+y.y)/2*-.5}):void 0}gestureBeginsVertically(i,u,d){if(this._valid!==void 0)return this._valid;const f=i.mag()>=2,y=u.mag()>=2;if(!f&&!y)return;if(!f||!y)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const w=i.y>0==u.y>0;return lc(i)&&lc(u)&&w}}const $f={panStep:100,bearingStep:15,pitchStep:10};class Ys{constructor(i){this._tr=new el(i);const u=$f;this._panStep=u.panStep,this._bearingStep=u.bearingStep,this._pitchStep=u.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let u=0,d=0,f=0,y=0,w=0;switch(i.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-1;break;case 37:i.shiftKey?d=-1:(i.preventDefault(),y=-1);break;case 39:i.shiftKey?d=1:(i.preventDefault(),y=1);break;case 38:i.shiftKey?f=1:(i.preventDefault(),w=-1);break;case 40:i.shiftKey?f=-1:(i.preventDefault(),w=1);break;default:return}return this._rotationDisabled&&(d=0,f=0),{cameraAnimation:I=>{const C=this._tr;I.easeTo({duration:300,easeId:"keyboardHandler",easing:zn,zoom:u?Math.round(C.zoom)+u*(i.shiftKey?2:1):C.zoom,bearing:C.bearing+d*this._bearingStep,pitch:C.pitch+f*this._pitchStep,offset:[-y*this._panStep,-w*this._panStep],center:C.center},{originalEvent:i})}}}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 zn(_){return _*(2-_)}const Wl=4.000244140625;class uc{constructor(i,u){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=i,this._tr=new el(i),this._triggerRenderFrame=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&i.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(i){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!i[this._map.cooperativeGestures._bypassKey])return;let u=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY;const d=k.now(),f=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,u!==0&&u%Wl==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":f>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(f*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),i.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=i,this._delta-=u,this._active||this._start(i)),i.preventDefault()}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const u=U.mousePos(this._map.getCanvas(),i),d=this._tr;this._around=u.y>d.transform.height/2-d.transform.getHorizon()?c.M.convert(this._aroundCenter?d.center:d.unproject(u)):c.M.convert(d.center),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const i=this._tr.transform;if(this._delta!==0){const I=this._type==="wheel"&&Math.abs(this._delta)>Wl?this._wheelZoomRate:this._defaultZoomRate;let C=2/(1+Math.exp(-Math.abs(this._delta*I)));this._delta<0&&C!==0&&(C=1/C);const P=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(P*C))),this._type==="wheel"&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:i.zoom,d=this._startZoom,f=this._easing;let y,w=!1;if(this._type==="wheel"&&d&&f){const I=Math.min((k.now()-this._lastWheelEventTime)/200,1),C=f(I);y=c.z.number(d,u,C),I<1?this._frameId||(this._frameId=!0):w=!0}else y=u,w=!0;return this._active=!0,w&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!w,zoomDelta:y-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let u=c.b7;if(this._prevEase){const d=this._prevEase,f=(k.now()-d.start)/d.duration,y=d.easing(f+.01)-d.easing(f),w=.27/Math.sqrt(y*y+1e-4)*.01,I=Math.sqrt(.0729-w*w);u=c.b6(w,I,.25,1)}return this._prevEase={start:k.now(),duration:i,easing:u},u}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Nh{constructor(i,u){this._clickZoom=i,this._tapZoom=u}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 Ad{constructor(i){this._tr=new el(i),this.reset()}reset(){this._active=!1}dblclick(i,u){return i.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(i.shiftKey?-1:1),around:this._tr.unproject(u)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Md{constructor(){this._tap=new Dh({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(i,u,d){if(!this._swipePoint)if(this._tapTime){const f=u[0],y=i.timeStamp-this._tapTime<500,w=this._tapPoint.dist(f)<30;y&&w?d.length>0&&(this._swipePoint=f,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(i,u,d)}touchmove(i,u,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const f=u[0],y=f.y-this._swipePoint.y;return this._swipePoint=f,i.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(i,u,d)}touchend(i,u,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const f=this._tap.touchend(i,u,d);f&&(this._tapTime=i.timeStamp,this._tapPoint=f)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Dd{constructor(i,u,d){this._el=i,this._mousePan=u,this._touchPan=d}enable(i){this._inertiaOptions=i||{},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 Co{constructor(i,u,d){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=u,this._mousePitch=d}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 Xl{constructor(i,u,d,f){this._el=i,this._touchZoom=u,this._touchRotate=d,this._tapDragZoom=f,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),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 ne{constructor(i,u){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=i,this._options=u,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const i=this._map.getCanvasContainer();i.classList.add("maplibregl-cooperative-gestures"),this._container=U.create("div","maplibregl-cooperative-gesture-screen",i);let u=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(u=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),f=document.createElement("div");f.className="maplibregl-desktop-message",f.textContent=u,this._container.appendChild(f);const y=document.createElement("div");y.className="maplibregl-mobile-message",y.textContent=d,this._container.appendChild(y),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(U.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(i){this._onCooperativeGesture(i.touches.length===1)}wheel(i){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!i[this._bypassKey])}_onCooperativeGesture(i){this._enabled&&i&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const ue=_=>_.zoom||_.drag||_.pitch||_.rotate;class cc extends c.k{}function Yl(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class kh{constructor(i,u){this.handleWindowEvent=f=>{this.handleEvent(f,`${f.type}Window`)},this.handleEvent=(f,y)=>{if(f.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const w=f.type==="renderFrame"?void 0:f,I={needsRenderFrame:!1},C={},P={},D=f.touches,N=D?this._getMapTouches(D):void 0,V=N?U.touchPos(this._map.getCanvas(),N):U.mousePos(this._map.getCanvas(),f);for(const{handlerName:J,handler:j,allowed:nt}of this._handlers){if(!j.isEnabled())continue;let ft;this._blockedByActive(P,nt,J)?j.reset():j[y||f.type]&&(ft=j[y||f.type](f,V,N),this.mergeHandlerResult(I,C,ft,J,w),ft&&ft.needsRenderFrame&&this._triggerRenderFrame()),(ft||j.isActive())&&(P[J]=j)}const X={};for(const J in this._previousActiveHandlers)P[J]||(X[J]=w);this._previousActiveHandlers=P,(Object.keys(X).length||Yl(I))&&(this._changes.push([I,C,X]),this._triggerRenderFrame()),(Object.keys(P).length||Yl(I))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:W}=I;W&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],W(this._map))},this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Sd(i),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[f,y,w]of this._listeners)U.addEventListener(f,y,f===document?this.handleWindowEvent:this.handleEvent,w)}destroy(){for(const[i,u,d]of this._listeners)U.removeEventListener(i,u,i===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(i){const u=this._map,d=u.getCanvasContainer();this._add("mapEvent",new Eo(u,i));const f=u.boxZoom=new So(u,i);this._add("boxZoom",f),i.interactive&&i.boxZoom&&f.enable();const y=u.cooperativeGestures=new ne(u,i.cooperativeGestures);this._add("cooperativeGestures",y),i.cooperativeGestures&&y.enable();const w=new Qf(u),I=new Ad(u);u.doubleClickZoom=new Nh(I,w),this._add("tapZoom",w),this._add("clickZoom",I),i.interactive&&i.doubleClickZoom&&u.doubleClickZoom.enable();const C=new Md;this._add("tapDragZoom",C);const P=u.touchPitch=new Pd(u);this._add("touchPitch",P),i.interactive&&i.touchPitch&&u.touchPitch.enable(i.touchPitch);const D=il(i),N=rl(i);u.dragRotate=new Co(i,D,N),this._add("mouseRotate",D,["mousePitch"]),this._add("mousePitch",N,["mouseRotate"]),i.interactive&&i.dragRotate&&u.dragRotate.enable();const V=(({enable:ft,clickTolerance:Q})=>{const st=new $o({checkCorrectEvent:mt=>U.mouseButton(mt)===0&&!mt.ctrlKey});return new nl({clickTolerance:Q,move:(mt,gt)=>({around:gt,panDelta:gt.sub(mt)}),activateOnStart:!0,moveStateManager:st,enable:ft,assignEvents:sc})})(i),X=new Cd(i,u);u.dragPan=new Dd(d,V,X),this._add("mousePan",V),this._add("touchPan",X,["touchZoom","touchRotate"]),i.interactive&&i.dragPan&&u.dragPan.enable(i.dragPan);const W=new Rh,J=new Ld;u.touchZoomRotate=new Xl(d,J,W,C),this._add("touchRotate",W,["touchPan","touchZoom"]),this._add("touchZoom",J,["touchPan","touchRotate"]),i.interactive&&i.touchZoomRotate&&u.touchZoomRotate.enable(i.touchZoomRotate);const j=u.scrollZoom=new uc(u,()=>this._triggerRenderFrame());this._add("scrollZoom",j,["mousePan"]),i.interactive&&i.scrollZoom&&u.scrollZoom.enable(i.scrollZoom);const nt=u.keyboard=new Ys(u);this._add("keyboard",nt),i.interactive&&i.keyboard&&u.keyboard.enable(),this._add("blockableMapEvent",new Qo(u))}_add(i,u,d){this._handlers.push({handlerName:i,handler:u,allowed:d}),this._handlersById[i]=u}stop(i){if(!this._updatingCamera){for(const{handler:u}of this._handlers)u.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ue(this._eventsInProgress)||this.isZooming()}_blockedByActive(i,u,d){for(const f in i)if(f!==d&&(!u||u.indexOf(f)<0))return!0;return!1}_getMapTouches(i){const u=[];for(const d of i)this._el.contains(d.target)&&u.push(d);return u}mergeHandlerResult(i,u,d,f,y){if(!d)return;c.e(i,d);const w={handlerName:f,originalEvent:d.originalEvent||y};d.zoomDelta!==void 0&&(u.zoom=w),d.panDelta!==void 0&&(u.drag=w),d.pitchDelta!==void 0&&(u.pitch=w),d.bearingDelta!==void 0&&(u.rotate=w)}_applyChanges(){const i={},u={},d={};for(const[f,y,w]of this._changes)f.panDelta&&(i.panDelta=(i.panDelta||new c.P(0,0))._add(f.panDelta)),f.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+f.zoomDelta),f.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+f.bearingDelta),f.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+f.pitchDelta),f.around!==void 0&&(i.around=f.around),f.pinchAround!==void 0&&(i.pinchAround=f.pinchAround),f.noInertia&&(i.noInertia=f.noInertia),c.e(u,y),c.e(d,w);this._updateMapTransform(i,u,d),this._changes=[]}_updateMapTransform(i,u,d){const f=this._map,y=f._getTransformForUpdate(),w=f.terrain;if(!(Yl(i)||w&&this._terrainMovement))return this._fireEvents(u,d,!0);let{panDelta:I,zoomDelta:C,bearingDelta:P,pitchDelta:D,around:N,pinchAround:V}=i;V!==void 0&&(N=V),f._stop(!0),N=N||f.transform.centerPoint;const X=y.pointLocation(I?N.sub(I):N);P&&(y.bearing+=P),D&&(y.pitch+=D),C&&(y.zoom+=C),w?this._terrainMovement||!u.drag&&!u.zoom?u.drag&&this._terrainMovement?y.center=y.pointLocation(y.centerPoint.sub(I)):y.setLocationAtPoint(X,N):(this._terrainMovement=!0,this._map._elevationFreeze=!0,y.setLocationAtPoint(X,N),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,y.recalculateZoom(f.terrain)})):y.setLocationAtPoint(X,N),f._applyUpdatedTransform(y),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(u,d,!0)}_fireEvents(i,u,d){const f=ue(this._eventsInProgress),y=ue(i),w={};for(const D in i){const{originalEvent:N}=i[D];this._eventsInProgress[D]||(w[`${D}start`]=N),this._eventsInProgress[D]=i[D]}!f&&y&&this._fireEvent("movestart",y.originalEvent);for(const D in w)this._fireEvent(D,w[D]);y&&this._fireEvent("move",y.originalEvent);for(const D in i){const{originalEvent:N}=i[D];this._fireEvent(D,N)}const I={};let C;for(const D in this._eventsInProgress){const{handlerName:N,originalEvent:V}=this._eventsInProgress[D];this._handlersById[N].isActive()||(delete this._eventsInProgress[D],C=u[N]||V,I[`${D}end`]=C)}for(const D in I)this._fireEvent(D,I[D]);const P=ue(this._eventsInProgress);if(d&&(f||y)&&!P){this._updatingCamera=!0;const D=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),N=V=>V!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new cc("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Ar extends c.E{constructor(i,u){super(),this._renderFrameCallback=()=>{const d=Math.min((k.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=u.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.M(this.transform.center.lng,this.transform.center.lat)}setCenter(i,u){return this.jumpTo({center:i},u)}panBy(i,u,d){return i=c.P.convert(i).mult(-1),this.panTo(this.transform.center,c.e({offset:i},u),d)}panTo(i,u,d){return this.easeTo(c.e({center:i},u),d)}getZoom(){return this.transform.zoom}setZoom(i,u){return this.jumpTo({zoom:i},u),this}zoomTo(i,u,d){return this.easeTo(c.e({zoom:i},u),d)}zoomIn(i,u){return this.zoomTo(this.getZoom()+1,i,u),this}zoomOut(i,u){return this.zoomTo(this.getZoom()-1,i,u),this}getBearing(){return this.transform.bearing}setBearing(i,u){return this.jumpTo({bearing:i},u),this}getPadding(){return this.transform.padding}setPadding(i,u){return this.jumpTo({padding:i},u),this}rotateTo(i,u,d){return this.easeTo(c.e({bearing:i},u),d)}resetNorth(i,u){return this.rotateTo(0,c.e({duration:1e3},i),u),this}resetNorthPitch(i,u){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},i),u),this}snapToNorth(i,u){return Math.abs(this.getBearing()){if(this._zooming&&(f.zoom=c.z.number(y,j,xt)),this._rotating&&(f.bearing=c.z.number(w,P,xt)),this._pitching&&(f.pitch=c.z.number(I,D,xt)),this._padding&&(f.interpolatePadding(C,N,xt),X=f.centerPoint.add(V)),this.terrain&&!i.freezeElevation&&this._updateElevation(xt),st)f.setLocationAtPoint(st,mt);else{const At=f.zoomScale(f.zoom-y),Pt=j>y?Math.min(2,Q):Math.max(.5,Q),zt=Math.pow(Pt,1-xt),Bt=f.unproject(nt.add(ft.mult(xt*zt)).mult(At));f.setLocationAtPoint(f.renderWorldCopies?Bt.wrap():Bt,X)}this._applyUpdatedTransform(f),this._fireMoveEvents(u)},xt=>{this.terrain&&this._finalizeElevation(),this._afterEase(u,xt)},i),this}_prepareEase(i,u,d={}){this._moving=!0,u||d.moving||this.fire(new c.k("movestart",i)),this._zooming&&!d.zooming&&this.fire(new c.k("zoomstart",i)),this._rotating&&!d.rotating&&this.fire(new c.k("rotatestart",i)),this._pitching&&!d.pitching&&this.fire(new c.k("pitchstart",i))}_prepareElevation(i){this._elevationCenter=i,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(i){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const u=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(i<1&&u!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=i*(d-(u-(d*i+this._elevationStart))/(1-i)),this._elevationTarget=u}this.transform.elevation=c.z.number(this._elevationStart,this._elevationTarget,i)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(i){if(!this.transformCameraUpdate)return;const u=i.clone(),{center:d,zoom:f,pitch:y,bearing:w,elevation:I}=this.transformCameraUpdate(u);d&&(u.center=d),f!==void 0&&(u.zoom=f),y!==void 0&&(u.pitch=y),w!==void 0&&(u.bearing=w),I!==void 0&&(u.elevation=I),this.transform.apply(u)}_fireMoveEvents(i){this.fire(new c.k("move",i)),this._zooming&&this.fire(new c.k("zoom",i)),this._rotating&&this.fire(new c.k("rotate",i)),this._pitching&&this.fire(new c.k("pitch",i))}_afterEase(i,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId;const d=this._zooming,f=this._rotating,y=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new c.k("zoomend",i)),f&&this.fire(new c.k("rotateend",i)),y&&this.fire(new c.k("pitchend",i)),this.fire(new c.k("moveend",i))}flyTo(i,u){var d;if(!i.essential&&k.prefersReducedMotion){const He=c.L(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(He,u)}this.stop(),i=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b7},i);const f=this._getTransformForUpdate(),y=this.getZoom(),w=this.getBearing(),I=this.getPitch(),C=this.getPadding(),P="bearing"in i?this._normalizeBearing(i.bearing,w):w,D="pitch"in i?+i.pitch:I,N="padding"in i?i.padding:f.padding,V=c.P.convert(i.offset);let X=f.centerPoint.add(V);const W=f.pointLocation(X),{center:J,zoom:j}=f.getConstrained(c.M.convert(i.center||W),(d=i.zoom)!==null&&d!==void 0?d:y);this._normalizeCenter(J);const nt=f.zoomScale(j-y),ft=f.project(W),Q=f.project(J).sub(ft);let st=i.curve;const mt=Math.max(f.width,f.height),gt=mt/nt,xt=Q.mag();if("minZoom"in i){const He=c.ac(Math.min(i.minZoom,y,j),f.minZoom,f.maxZoom),ge=mt/f.zoomScale(He-y);st=Math.sqrt(ge/xt*2)}const At=st*st;function Pt(He){const ge=(gt*gt-mt*mt+(He?-1:1)*At*At*xt*xt)/(2*(He?gt:mt)*At*xt);return Math.log(Math.sqrt(ge*ge+1)-ge)}function zt(He){return(Math.exp(He)-Math.exp(-He))/2}function Bt(He){return(Math.exp(He)+Math.exp(-He))/2}const Se=Pt(!1);let Vt=function(He){return Bt(Se)/Bt(Se+st*He)},ce=function(He){return mt*((Bt(Se)*(zt(ge=Se+st*He)/Bt(ge))-zt(Se))/At)/xt;var ge},Ce=(Pt(!0)-Se)/st;if(Math.abs(xt)<1e-6||!isFinite(Ce)){if(Math.abs(mt-gt)<1e-6)return this.easeTo(i,u);const He=gti.maxDuration&&(i.duration=0),this._zooming=!0,this._rotating=w!==P,this._pitching=D!==I,this._padding=!f.isPaddingEqual(N),this._prepareEase(u,!1),this.terrain&&this._prepareElevation(J),this._ease(He=>{const ge=He*Ce,Ae=1/Vt(ge);f.zoom=He===1?j:y+f.scaleZoom(Ae),this._rotating&&(f.bearing=c.z.number(w,P,He)),this._pitching&&(f.pitch=c.z.number(I,D,He)),this._padding&&(f.interpolatePadding(C,N,He),X=f.centerPoint.add(V)),this.terrain&&!i.freezeElevation&&this._updateElevation(He);const Ne=He===1?J:f.unproject(ft.add(Q.mult(ce(ge))).mult(Ae));f.setLocationAtPoint(f.renderWorldCopies?Ne.wrap():Ne,X),this._applyUpdatedTransform(f),this._fireMoveEvents(u)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(u)},i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,u){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,u)}if(!i){const d=this.handlers;d&&d.stop(!1)}return this}_ease(i,u,d){d.animate===!1||d.duration===0?(i(1),u()):(this._easeStart=k.now(),this._easeOptions=d,this._onEaseFrame=i,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(i,u){i=c.b1(i,-180,180);const d=Math.abs(i-u);return Math.abs(i-360-u)180?-360:d<-180?360:0}queryTerrainElevation(i){return this.terrain?this.terrain.getElevationForLngLatZoom(c.M.convert(i),this.transform.tileZoom)-this.transform.elevation:null}}const zh={compact:!0,customAttribution:'MapLibre'};class To{constructor(i=zh){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=u=>{!u||u.sourceDataType!=="metadata"&&u.sourceDataType!=="visibility"&&u.dataType!=="style"&&u.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?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=i}getDefaultPosition(){return"bottom-right"}onAdd(i){return this._map=i,this._compact=this.options.compact,this._container=U.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=U.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=U.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(){U.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(i,u){const d=this._map._getUIString(`AttributionControl.${u}`);i.title=d,i.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let i=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=i.concat(this.options.customAttribution.map(f=>typeof f!="string"?"":f)):typeof this.options.customAttribution=="string"&&i.push(this.options.customAttribution)),this._map.style.stylesheet){const f=this._map.style.stylesheet;this.styleOwner=f.owner,this.styleId=f.id}const u=this._map.style.sourceCaches;for(const f in u){const y=u[f];if(y.used||y.usedForTerrain){const w=y.getSource();w.attribution&&i.indexOf(w.attribution)<0&&i.push(w.attribution)}}i=i.filter(f=>String(f).trim()),i.sort((f,y)=>f.length-y.length),i=i.filter((f,y)=>{for(let w=y+1;w=0)return!1;return!0});const d=i.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,i.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Rd{constructor(i={}){this._updateCompact=()=>{const u=this._container.children;if(u.length){const d=u[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=i}getDefaultPosition(){return"bottom-left"}onAdd(i){this._map=i,this._compact=this.options&&this.options.compact,this._container=U.create("div","maplibregl-ctrl");const u=U.create("a","maplibregl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){U.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Kl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const u=++this._id;return this._queue.push({callback:i,id:u,cancelled:!1}),u}remove(i){const u=this._currentlyRunning,d=u?this._queue.concat(u):this._queue;for(const f of d)if(f.id===i)return void(f.cancelled=!0)}run(i=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const u=this._currentlyRunning=this._queue;this._queue=[];for(const d of u)if(!d.cancelled&&(d.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Kn=c.X([{name:"a_pos3d",type:"Int16",components:3}]);class hi extends c.E{constructor(i){super(),this.sourceCache=i,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,i.usedForTerrain=!0,i.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(i,u){this.sourceCache.update(i,u),this._renderableTilesKeys=[];const d={};for(const f of i.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))d[f.key]=!0,this._renderableTilesKeys.push(f.key),this._tiles[f.key]||(f.posMatrix=new Float64Array(16),c.aN(f.posMatrix,0,c.W,0,c.W,0,1),this._tiles[f.key]=new Wo(f,this.tileSize));for(const f in this._tiles)d[f]||delete this._tiles[f]}freeRtt(i){for(const u in this._tiles){const d=this._tiles[u];(!i||d.tileID.equals(i)||d.tileID.isChildOf(i)||i.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(i=>this.getTileByID(i))}getTileByID(i){return this._tiles[i]}getTerrainCoords(i){const u={};for(const d of this._renderableTilesKeys){const f=this._tiles[d].tileID;if(f.canonical.equals(i.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16),c.aN(y.posMatrix,0,c.W,0,c.W,0,1),u[d]=y}else if(f.canonical.isChildOf(i.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16);const w=f.canonical.z-i.canonical.z,I=f.canonical.x-(f.canonical.x>>w<>w<>w;c.aN(y.posMatrix,0,P,0,P,0,1),c.H(y.posMatrix,y.posMatrix,[-I*P,-C*P,0]),u[d]=y}else if(i.canonical.isChildOf(f.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16);const w=i.canonical.z-f.canonical.z,I=i.canonical.x-(i.canonical.x>>w<>w<>w;c.aN(y.posMatrix,0,c.W,0,c.W,0,1),c.H(y.posMatrix,y.posMatrix,[I*P,C*P,0]),c.J(y.posMatrix,y.posMatrix,[1/2**w,1/2**w,0]),u[d]=y}}return u}getSourceTile(i,u){const d=this.sourceCache._source;let f=i.overscaledZ-this.deltaZoom;if(f>d.maxzoom&&(f=d.maxzoom),f=d.minzoom&&(!y||!y.dem);)y=this.sourceCache.getTileByID(i.scaledTo(f--).key);return y}tilesAfterTime(i=Date.now()){return Object.values(this._tiles).filter(u=>u.timeAdded>=i)}}class Nd{constructor(i,u,d){this.painter=i,this.sourceCache=new hi(u),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(i,u,d,f=c.W){var y;if(!(u>=0&&u=0&&di.canonical.z&&(i.canonical.z>=f?y=i.canonical.z-f:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const w=i.canonical.x-(i.canonical.x>>y<>y<>8<<4|y>>8,u[w+3]=0;const d=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),f=new Nt(i,d,i.gl.RGBA,{premultiply:!1});return f.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._coordsTexture=f,f}pointCoordinate(i){this.painter.maybeDrawDepthAndCoords(!0);const u=new Uint8Array(4),d=this.painter.context,f=d.gl,y=Math.round(i.x*this.painter.pixelRatio/devicePixelRatio),w=Math.round(i.y*this.painter.pixelRatio/devicePixelRatio),I=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),f.readPixels(y,I-w-1,1,1,f.RGBA,f.UNSIGNED_BYTE,u),d.bindFramebuffer.set(null);const C=u[0]+(u[2]>>4<<8),P=u[1]+((15&u[2])<<8),D=this.coordsIndex[255-u[3]],N=D&&this.sourceCache.getTileByID(D);if(!N)return null;const V=this._coordsTextureSize,X=(1<i.id!==u),this._recentlyUsed.push(i.id)}stampObject(i){i.stamp=++this._stamp}getOrCreateFreeObject(){for(const u of this._recentlyUsed)if(!this._objects[u].inUse)return this._objects[u];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const i=this._createObject(this._objects.length);return this._objects.push(i),i}freeObject(i){i.inUse=!1}freeAllObjects(){for(const i of this._objects)this.freeObject(i)}isFull(){return!(this._objects.length!i.inUse)===!1}}const bs={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Oh{constructor(i,u){this.painter=i,this.terrain=u,this.pool=new Jl(i.context,30,u.sourceCache.tileSize*u.qualityFactor)}destruct(){this.pool.destruct()}getTexture(i){return this.pool.getObjectForId(i.rtt[this._stacks.length-1].id).texture}prepareForRender(i,u){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=i._order.filter(d=>!i._layers[d].isHidden(u)),this._coordsDescendingInv={};for(const d in i.sourceCaches){this._coordsDescendingInv[d]={};const f=i.sourceCaches[d].getVisibleCoordinates();for(const y of f){const w=this.terrain.sourceCache.getTerrainCoords(y);for(const I in w)this._coordsDescendingInv[d][I]||(this._coordsDescendingInv[d][I]=[]),this._coordsDescendingInv[d][I].push(w[I])}}this._coordsDescendingInvStr={};for(const d of i._order){const f=i._layers[d],y=f.source;if(bs[f.type]&&!this._coordsDescendingInvStr[y]){this._coordsDescendingInvStr[y]={};for(const w in this._coordsDescendingInv[y])this._coordsDescendingInvStr[y][w]=this._coordsDescendingInv[y][w].map(I=>I.key).sort().join()}}for(const d of this._renderableTiles)for(const f in this._coordsDescendingInvStr){const y=this._coordsDescendingInvStr[f][d.tileID.key];y&&y!==d.rttCoords[f]&&(d.rtt=[])}}renderLayer(i){if(i.isHidden(this.painter.transform.zoom))return!1;const u=i.type,d=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===i.id;if(bs[u]&&(this._prevType&&bs[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(i.id),!f))return!0;if(bs[this._prevType]||bs[u]&&f){this._prevType=u;const y=this._stacks.length-1,w=this._stacks[y]||[];for(const I of this._renderableTiles){if(this.pool.isFull()&&(rc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(I),I.rtt[y]){const P=this.pool.getObjectForId(I.rtt[y].id);if(P.stamp===I.rtt[y].stamp){this.pool.useObject(P);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),I.rtt[y]={id:C.id,stamp:C.stamp},d.context.bindFramebuffer.set(C.fbo.framebuffer),d.context.clear({color:c.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let P=0;P{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},Vh={showCompass:!0,showZoom:!0,visualizePitch:!1};class Uh{constructor(i,u,d=!1){this.mousedown=w=>{this.startMouse(c.e({},w,{ctrlKey:!0,preventDefault:()=>w.preventDefault()}),U.mousePos(this.element,w)),U.addEventListener(window,"mousemove",this.mousemove),U.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=w=>{this.moveMouse(w,U.mousePos(this.element,w))},this.mouseup=w=>{this.mouseRotate.dragEnd(w),this.mousePitch&&this.mousePitch.dragEnd(w),this.offTemp()},this.touchstart=w=>{w.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.startTouch(w,this._startPos),U.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.addEventListener(window,"touchend",this.touchend))},this.touchmove=w=>{w.targetTouches.length!==1?this.reset():(this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.moveTouch(w,this._lastPos))},this.touchend=w=>{w.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const f=i.dragRotate._mouseRotate.getClickTolerance(),y=i.dragRotate._mousePitch.getClickTolerance();this.element=u,this.mouseRotate=il({clickTolerance:f,enable:!0}),this.touchRotate=(({enable:w,clickTolerance:I,bearingDegreesPerPixelMoved:C=.8})=>{const P=new Qt;return new nl({clickTolerance:I,move:(D,N)=>({bearingDelta:(N.x-D.x)*C}),moveStateManager:P,enable:w,assignEvents:hc})})({clickTolerance:f,enable:!0}),this.map=i,d&&(this.mousePitch=rl({clickTolerance:y,enable:!0}),this.touchPitch=(({enable:w,clickTolerance:I,pitchDegreesPerPixelMoved:C=-.5})=>{const P=new Qt;return new nl({clickTolerance:I,move:(D,N)=>({pitchDelta:(N.y-D.y)*C}),moveStateManager:P,enable:w,assignEvents:hc})})({clickTolerance:y,enable:!0})),U.addEventListener(u,"mousedown",this.mousedown),U.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),U.addEventListener(u,"touchcancel",this.reset)}startMouse(i,u){this.mouseRotate.dragStart(i,u),this.mousePitch&&this.mousePitch.dragStart(i,u),U.disableDrag()}startTouch(i,u){this.touchRotate.dragStart(i,u),this.touchPitch&&this.touchPitch.dragStart(i,u),U.disableDrag()}moveMouse(i,u){const d=this.map,{bearingDelta:f}=this.mouseRotate.dragMove(i,u)||{};if(f&&d.setBearing(d.getBearing()+f),this.mousePitch){const{pitchDelta:y}=this.mousePitch.dragMove(i,u)||{};y&&d.setPitch(d.getPitch()+y)}}moveTouch(i,u){const d=this.map,{bearingDelta:f}=this.touchRotate.dragMove(i,u)||{};if(f&&d.setBearing(d.getBearing()+f),this.touchPitch){const{pitchDelta:y}=this.touchPitch.dragMove(i,u)||{};y&&d.setPitch(d.getPitch()+y)}}off(){const i=this.element;U.removeEventListener(i,"mousedown",this.mousedown),U.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend),U.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){U.enableDrag(),U.removeEventListener(window,"mousemove",this.mousemove),U.removeEventListener(window,"mouseup",this.mouseup),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend)}}let ws;function pc(_,i,u){const d=new c.M(_.lng,_.lat);if(_=new c.M(_.lng,_.lat),i){const f=new c.M(_.lng-360,_.lat),y=new c.M(_.lng+360,_.lat),w=u.locationPoint(_).distSqr(i);u.locationPoint(f).distSqr(i)180;){const f=u.locationPoint(_);if(f.x>=0&&f.y>=0&&f.x<=u.width&&f.y<=u.height)break;_.lng>u.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&u.locationPoint(_).y>u.height/2-u.getHorizon()?_:d}const $l={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 dc(_,i,u){const d=_.classList;for(const f in $l)d.remove(`maplibregl-${u}-anchor-${f}`);d.add(`maplibregl-${u}-anchor-${i}`)}class tu extends c.E{constructor(i){if(super(),this._onKeyPress=u=>{const d=u.code,f=u.charCode||u.keyCode;d!=="Space"&&d!=="Enter"&&f!==32&&f!==13||this.togglePopup()},this._onMapClick=u=>{const d=u.originalEvent.target,f=this._element;this._popup&&(d===f||f.contains(d))&&this.togglePopup()},this._update=u=>{var d;if(!this._map)return;const f=this._map.loaded()&&!this._map.isMoving();((u==null?void 0:u.type)==="terrain"||(u==null?void 0:u.type)==="render"&&!f)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?pc(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let y="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?y=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(y=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let w="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?w="rotateX(0deg)":this._pitchAlignment==="map"&&(w=`rotateX(${this._map.getPitch()}deg)`),u&&u.type!=="moveend"||(this._pos=this._pos.round()),U.setTransform(this._element,`${$l[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${w} ${y}`),k.frameAsync(new AbortController).then(()=>{this._updateOpacity(u&&u.type==="moveend")}).catch(()=>{})},this._onMove=u=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=u.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=u.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=u=>{this._element.contains(u.originalEvent.target)&&(u.preventDefault(),this._positionDelta=u.point.sub(this._pos).add(this._offset),this._pointerdownPos=u.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment!=="auto"?i.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(i==null?void 0:i.opacity,i==null?void 0:i.opacityWhenCovered),i&&i.element)this._element=i.element,this._offset=c.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=U.create("div"),this._element.setAttribute("aria-label","Map marker");const u=U.createNS("http://www.w3.org/2000/svg","svg"),d=41,f=27;u.setAttributeNS(null,"display","block"),u.setAttributeNS(null,"height",`${d}px`),u.setAttributeNS(null,"width",`${f}px`),u.setAttributeNS(null,"viewBox",`0 0 ${f} ${d}`);const y=U.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"stroke","none"),y.setAttributeNS(null,"stroke-width","1"),y.setAttributeNS(null,"fill","none"),y.setAttributeNS(null,"fill-rule","evenodd");const w=U.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill-rule","nonzero");const I=U.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"transform","translate(3.0, 29.0)"),I.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 nt of C){const ft=U.createNS("http://www.w3.org/2000/svg","ellipse");ft.setAttributeNS(null,"opacity","0.04"),ft.setAttributeNS(null,"cx","10.5"),ft.setAttributeNS(null,"cy","5.80029008"),ft.setAttributeNS(null,"rx",nt.rx),ft.setAttributeNS(null,"ry",nt.ry),I.appendChild(ft)}const P=U.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"fill",this._color);const D=U.createNS("http://www.w3.org/2000/svg","path");D.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"),P.appendChild(D);const N=U.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"opacity","0.25"),N.setAttributeNS(null,"fill","#000000");const V=U.createNS("http://www.w3.org/2000/svg","path");V.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"),N.appendChild(V);const X=U.createNS("http://www.w3.org/2000/svg","g");X.setAttributeNS(null,"transform","translate(6.0, 7.0)"),X.setAttributeNS(null,"fill","#FFFFFF");const W=U.createNS("http://www.w3.org/2000/svg","g");W.setAttributeNS(null,"transform","translate(8.0, 8.0)");const J=U.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#000000"),J.setAttributeNS(null,"opacity","0.25"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962");const j=U.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#FFFFFF"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962"),W.appendChild(J),W.appendChild(j),w.appendChild(I),w.appendChild(P),w.appendChild(N),w.appendChild(X),w.appendChild(W),u.appendChild(w),u.setAttributeNS(null,"height",d*this._scale+"px"),u.setAttributeNS(null,"width",f*this._scale+"px"),this._element.appendChild(u),this._offset=c.P.convert(i&&i.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",u=>{u.preventDefault()}),this._element.addEventListener("mousedown",u=>{u.preventDefault()}),dc(this._element,this._anchor,"marker"),i&&i.className)for(const u of i.className.split(" "))this._element.classList.add(u);this._popup=null}addTo(i){return this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._update),i.on("moveend",this._update),i.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),U.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=c.M.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){const f=Math.abs(13.5)/Math.SQRT2;i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[f,-1*(38.1-13.5+f)],"bottom-right":[-f,-1*(38.1-13.5+f)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const i=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:i?(i.isOpen()?i.remove():(i.setLngLat(this._lngLat),i.addTo(this._map)),this):this}_updateOpacity(i=!1){var u,d;if(!(!((u=this._map)===null||u===void 0)&&u.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(i)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,y=f.terrain.depthAtPoint(this._pos),w=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,w)-y<.006)return void(this._element.style.opacity=this._opacity);const I=-this._offset.y/f.transform._pixelPerMeter,C=Math.sin(f.getPitch()*Math.PI/180)*I,P=f.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),D=f.transform.lngLatToCameraDepth(this._lngLat,w+C)-P>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&D&&this._popup.remove(),this._element.style.opacity=D?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(i){return this._offset=c.P.convert(i),this._update(),this}addClassName(i){this._element.classList.add(i)}removeClassName(i){this._element.classList.remove(i)}toggleClassName(i){return this._element.classList.toggle(i)}setDraggable(i){return this._draggable=!!i,this._map&&(i?(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(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&i!=="auto"?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(i,u){return i===void 0&&u===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),i!==void 0&&(this._opacity=i),u!==void 0&&(this._opacityWhenCovered=u),this._map&&this._updateOpacity(!0),this}}const fc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let sl=0,wa=!1;const mc={maxWidth:100,unit:"metric"};function gc(_,i,u){const d=u&&u.maxWidth||100,f=_._container.clientHeight/2,y=_.unproject([0,f]),w=_.unproject([d,f]),I=y.distanceTo(w);if(u&&u.unit==="imperial"){const C=3.2808*I;C>5280?Ia(i,d,C/5280,_._getUIString("ScaleControl.Miles")):Ia(i,d,C,_._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?Ia(i,d,I/1852,_._getUIString("ScaleControl.NauticalMiles")):I>=1e3?Ia(i,d,I/1e3,_._getUIString("ScaleControl.Kilometers")):Ia(i,d,I,_._getUIString("ScaleControl.Meters"))}function Ia(_,i,u,d){const f=function(y){const w=Math.pow(10,`${Math.floor(y)}`.length-1);let I=y/w;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(C){const P=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*P)/P}(I),w*I}(u);_.style.width=i*(f/u)+"px",_.innerHTML=`${f} ${d}`}const qh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Gh=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function _c(_){if(_){if(typeof _=="number"){const i=Math.round(Math.abs(_)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,_),"top-left":new c.P(i,i),"top-right":new c.P(-i,i),bottom:new c.P(0,-_),"bottom-left":new c.P(i,-i),"bottom-right":new c.P(-i,-i),left:new c.P(_,0),right:new c.P(-_,0)}}if(_ instanceof c.P||Array.isArray(_)){const i=c.P.convert(_);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:c.P.convert(_.center||[0,0]),top:c.P.convert(_.top||[0,0]),"top-left":c.P.convert(_["top-left"]||[0,0]),"top-right":c.P.convert(_["top-right"]||[0,0]),bottom:c.P.convert(_.bottom||[0,0]),"bottom-left":c.P.convert(_["bottom-left"]||[0,0]),"bottom-right":c.P.convert(_["bottom-right"]||[0,0]),left:c.P.convert(_.left||[0,0]),right:c.P.convert(_.right||[0,0])}}return _c(new c.P(0,0))}const kd=S;m.AJAXError=c.be,m.Evented=c.E,m.LngLat=c.M,m.MercatorCoordinate=c.Y,m.Point=c.P,m.addProtocol=c.bf,m.config=c.a,m.removeProtocol=c.bg,m.AttributionControl=To,m.BoxZoomHandler=So,m.CanvasSource=Za,m.CooperativeGesturesHandler=ne,m.DoubleClickZoomHandler=Nh,m.DragPanHandler=Dd,m.DragRotateHandler=Co,m.EdgeInsets=tl,m.FullscreenControl=class extends c.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var i;let u=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((i=u==null?void 0:u.shadowRoot)===null||i===void 0)&&i.fullscreenElement;)u=u.shadowRoot.fullscreenElement;u===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:c.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(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){U.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=U.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);U.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_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 c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},m.GeoJSONSource=Ct,m.GeolocateControl=class extends c.E{constructor(_){super(),this._onSuccess=i=>{if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,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&&this._watchState!=="OFF"&&this._updateMarker(i),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(i),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",i)),this._finish()}},this._updateCamera=i=>{const u=new c.M(i.coords.longitude,i.coords.latitude),d=i.coords.accuracy,f=this._map.getBearing(),y=c.e({bearing:f},this.options.fitBoundsOptions),w=St.fromLngLat(u,d);this._map.fitBounds(w,y,{geolocateSource:!0})},this._updateMarker=i=>{if(i){const u=new c.M(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(u).addTo(this._map),this._userLocationDotMarker.setLngLat(u).addTo(this._map),this._accuracy=i.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=i=>{if(this._map){if(this.options.trackUserLocation)if(i.code===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._geolocateButton.disabled=!0;const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(i.code===3&&wa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",i)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=i=>{if(this._map){if(this._container.addEventListener("contextmenu",u=>u.preventDefault()),this._geolocateButton=U.create("button","maplibregl-ctrl-geolocate",this._container),U.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",i===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}else{const u=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=U.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new tu({element:this._dotElement}),this._circleElement=U.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new tu({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",u=>{u.geolocateSource||this._watchState!=="ACTIVE_LOCK"||u.originalEvent&&u.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")))})}},this.options=c.e({},fc,_)}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return c._(this,arguments,void 0,function*(i=!1){if(ws!==void 0&&!i)return ws;if(window.navigator.permissions===void 0)return ws=!!window.navigator.geolocation,ws;try{ws=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ws=!!window.navigator.geolocation}return ws})}().then(i=>this._setupUI(i)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(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(),U.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,sl=0,wa=!1}_isOutOfMapMaxBounds(_){const i=this._map.getMaxBounds(),u=_.coords;return i&&(u.longitudei.getEast()||u.latitudei.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 _=this._map.getBounds(),i=_.getSouthEast(),u=_.getNorthEast(),d=i.distanceTo(u),f=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${f}px`,this._circleElement.style.height=`${f}px`}trigger(){if(!this._setup)return c.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 c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":sl--,wa=!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 c.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),sl++,sl>1?(_={maximumAge:6e5,timeout:0},wa=!0):(_=this.options.positionOptions,wa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}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)}},m.Hash=Ah,m.ImageSource=Fe,m.KeyboardHandler=Ys,m.LngLatBounds=St,m.LogoControl=Rd,m.Map=class extends Ar{constructor(_){if(c.bc.mark(c.bd.create),(_=c.e({},Ql,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new oc(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=i=>{i.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:i}))},this._contextRestored=i=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:i}))},this._onMapScroll=i=>{if(i.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new Kl,this._controls=[],this._mapId=c.a3(),this._locale=c.e({},Fh,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=Gt.addThrottleControl(()=>this.isMoving()),this._requestManager=new se(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.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}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let i=!1;const u=Ph(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{i?u(d):i=!0}),this._resizeObserver.observe(this._container)}this.handlers=new kh(this,_),this._hash=_.hash&&new Ah(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,c.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new To(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Rd,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",i=>{this._update(i.dataType==="style"),this.fire(new c.k(`${i.dataType}data`,i))}),this.on("dataloading",i=>{this.fire(new c.k(`${i.dataType}dataloading`,i))}),this.on("dataabort",i=>{this.fire(new c.k("sourcedataabort",i))})}_getMapId(){return this._mapId}addControl(_,i){if(i===void 0&&(i=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const u=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[i];return i.indexOf("bottom")!==-1?d.insertBefore(u,d.firstChild):d.appendChild(u),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(_);return i>-1&&this._controls.splice(i,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,i,u,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(u,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,i,u,d)}resize(_){var i;const u=this._containerDimensions(),d=u[0],f=u[1],y=this._getClampedPixelRatio(d,f);if(this._resizeCanvas(d,f,y),this.painter.resize(d,f,y),this.painter.overLimit()){const I=this.painter.context.gl;this._maxCanvasSize=[I.drawingBufferWidth,I.drawingBufferHeight];const C=this._getClampedPixelRatio(d,f);this._resizeCanvas(d,f,C),this.painter.resize(d,f,C)}this.transform.resize(d,f),(i=this._requestedCameraState)===null||i===void 0||i.resize(d,f);const w=!this._moving;return w&&(this.stop(),this.fire(new c.k("movestart",_)).fire(new c.k("move",_))),this.fire(new c.k("resize",_)),w&&this.fire(new c.k("moveend",_)),this}_getClampedPixelRatio(_,i){const{0:u,1:d}=this._maxCanvasSize,f=this.getPixelRatio(),y=_*f,w=i*f;return Math.min(y>u?u/y:1,w>d?d/w:1)*f}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(St.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(c.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(c.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,i,u){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:i,listener:u,delegates:{mousemove:y=>{const w=this.getLayer(i)?this.queryRenderedFeatures(y.point,{layers:[i]}):[];w.length?d||(d=!0,u.call(this,new Pr(_,this,y.originalEvent,{features:w}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:i,listener:u,delegates:{mousemove:w=>{(this.getLayer(i)?this.queryRenderedFeatures(w.point,{layers:[i]}):[]).length?d=!0:d&&(d=!1,u.call(this,new Pr(_,this,w.originalEvent)))},mouseout:w=>{d&&(d=!1,u.call(this,new Pr(_,this,w.originalEvent)))}}}}{const d=f=>{const y=this.getLayer(i)?this.queryRenderedFeatures(f.point,{layers:[i]}):[];y.length&&(f.features=y,u.call(this,f),delete f.features)};return{layer:i,listener:u,delegates:{[_]:d}}}}on(_,i,u){if(u===void 0)return super.on(_,i);const d=this._createDelegatedListener(_,i,u);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const f in d.delegates)this.on(f,d.delegates[f]);return this}once(_,i,u){if(u===void 0)return super.once(_,i);const d=this._createDelegatedListener(_,i,u);for(const f in d.delegates)this.once(f,d.delegates[f]);return this}off(_,i,u){return u===void 0?super.off(_,i):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const f=this._delegatedListeners[_];for(let y=0;ythis._updateStyle(_,i));const u=this.style&&i.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new jr(this,i||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,i,u):this.style.loadJSON(_,i,u),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new jr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,i){if(typeof _=="string"){const u=this._requestManager.transformRequest(_,"Style");c.h(u,new AbortController).then(d=>{this._updateDiff(d.data,i)}).catch(d=>{d&&this.fire(new c.j(d))})}else typeof _=="object"&&this._updateDiff(_,i)}_updateDiff(_,i){try{this.style.setState(_,i)&&this._update(!0)}catch(u){c.w(`Unable to perform style diff: ${u.message||u.error||u}. Rebuilding the style from scratch.`),this._updateStyle(_,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(_,i){return this._lazyInitEmptyStyle(),this.style.addSource(_,i),this._update(!0)}isSourceLoaded(_){const i=this.style&&this.style.sourceCaches[_];if(i!==void 0)return i.loaded();this.fire(new c.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const i=this.style.sourceCaches[_.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&i.reload();for(const u in this.style._layers){const d=this.style._layers[u];d.type==="hillshade"&&d.source===_.source&&c.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 Nd(this.painter,i,_),this.painter.renderToTexture=new Oh(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=u=>{u.dataType==="style"?this.terrain.sourceCache.freeRtt():u.dataType==="source"&&u.tile&&(u.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(u.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:_})),this}getTerrain(){var _,i;return(i=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&i!==void 0?i:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const i in _){const u=_[i]._tiles;for(const d in u){const f=u[d];if(f.state!=="loaded"&&f.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,i,u={}){const{pixelRatio:d=1,sdf:f=!1,stretchX:y,stretchY:w,content:I}=u;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||c.b(i))){if(i.width===void 0||i.height===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:C,height:P,data:D}=i,N=i;return this.style.addImage(_,{data:new c.R({width:C,height:P},new Uint8Array(D)),pixelRatio:d,stretchX:y,stretchY:w,content:I,sdf:f,version:0,userImage:N}),N.onAdd&&N.onAdd(this,_),this}}{const{width:C,height:P,data:D}=k.getImageData(i);this.style.addImage(_,{data:new c.R({width:C,height:P},D),pixelRatio:d,stretchX:y,stretchY:w,content:I,sdf:f,version:0})}}updateImage(_,i){const u=this.style.getImage(_);if(!u)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=i instanceof HTMLImageElement||c.b(i)?k.getImageData(i):i,{width:f,height:y,data:w}=d;if(f===void 0||y===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(f!==u.data.width||y!==u.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const I=!(i instanceof HTMLImageElement||c.b(i));return u.data.replace(w,I),this.style.updateImage(_,u),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return Gt.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,i){return this._lazyInitEmptyStyle(),this.style.addLayer(_,i),this._update(!0)}moveLayer(_,i){return this.style.moveLayer(_,i),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,i,u){return this.style.setLayerZoomRange(_,i,u),this._update(!0)}setFilter(_,i,u={}){return this.style.setFilter(_,i,u),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,i,u,d={}){return this.style.setPaintProperty(_,i,u,d),this._update(!0)}getPaintProperty(_,i){return this.style.getPaintProperty(_,i)}setLayoutProperty(_,i,u,d={}){return this.style.setLayoutProperty(_,i,u,d),this._update(!0)}getLayoutProperty(_,i){return this.style.getLayoutProperty(_,i)}setGlyphs(_,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,i,u={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,i,u,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,i,u=>{u||this._update(!0)}),this}setLight(_,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,i),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,i){return this.style.setFeatureState(_,i),this._update()}removeFeatureState(_,i){return this.style.removeFeatureState(_,i),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,i=0;return this._container&&(_=this._container.clientWidth||400,i=this._container.clientHeight||300),[_,i]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const i=this._canvasContainer=U.create("div","maplibregl-canvas-container",_);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=U.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const u=this._containerDimensions(),d=this._getClampedPixelRatio(u[0],u[1]);this._resizeCanvas(u[0],u[1],d);const f=this._controlContainer=U.create("div","maplibregl-control-container",_),y=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(w=>{y[w]=U.create("div",`maplibregl-ctrl-${w} `,f)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,i,u){this._canvas.width=Math.floor(u*_),this._canvas.height=Math.floor(u*i),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${i}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let i=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{i={requestedAttributes:_},d&&(i.statusMessage=d.statusMessage,i.type=d.type)},{once:!0});const u=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!u){const d="Failed to initialize WebGL";throw i?(i.message=d,new Error(JSON.stringify(i))):new Error(d)}this.painter=new bd(u,this.transform),ut.testSupport(u)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,y=k.now();this.style.zoomHistory.update(f,y);const w=new c.a8(f,{now:y,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),I=w.crossFadingFactor();I===1&&I===this._crossFadingFactor||(u=!0,this._crossFadingFactor=I),this.style.update(w)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bc.mark(c.bd.load),this.fire(new c.k("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 c.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,c.bc.mark(c.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(const u of this._controls)u.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),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Gt.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),U.remove(this._canvasContainer),U.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.bc.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,k.frameAsync(this._frameRequest).then(_=>{c.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return Bh}getCameraTargetElevation(){return this.transform.elevation}},m.MapMouseEvent=Pr,m.MapTouchEvent=Jo,m.MapWheelEvent=Mh,m.Marker=tu,m.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const i=this._map.getZoom(),u=i===this._map.getMaxZoom(),d=i===this._map.getMinZoom();this._zoomInButton.disabled=u,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",u.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=i},this._setButtonTitle=(i,u)=>{const d=this._map._getUIString(`NavigationControl.${u}`);i.title=d,i.setAttribute("aria-label",d)},this.options=c.e({},Vh,_),this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),U.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),U.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=U.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Uh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){U.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(_,i){const u=U.create("button",_,this._container);return u.type="button",u.addEventListener("click",i),u}},m.Popup=class extends c.E{constructor(_){super(),this.remove=()=>(this._content&&U.remove(this._content),this._container&&(U.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 c.k("close"))),this),this._onMouseUp=i=>{this._update(i.point)},this._onMouseMove=i=>{this._update(i.point)},this._onDrag=i=>{this._update(i.point)},this._update=i=>{var u;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=U.create("div","maplibregl-popup",this._map.getContainer()),this._tip=U.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?pc(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.wrap(),this._trackPointer&&!i)return;const d=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map.transform.locationPoint(this._lngLat));let f=this.options.anchor;const y=_c(this.options.offset);if(!f){const I=this._container.offsetWidth,C=this._container.offsetHeight;let P;P=d.y+y.bottom.ythis._map.transform.height-C?["bottom"]:[],d.xthis._map.transform.width-I/2&&P.push("right"),f=P.length===0?"bottom":P.join("-")}let w=d.add(y[f]);this.options.subpixelPositioning||(w=w.round()),U.setTransform(this._container,`${$l[f]} translate(${w.x}px,${w.y}px)`),dc(this._container,f,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(qh),_)}addTo(_){return this._map&&this.remove(),this._map=_,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 c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=c.M.convert(_),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(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const i=document.createDocumentFragment(),u=document.createElement("body");let d;for(u.innerHTML=_;d=u.firstChild,d;)i.appendChild(d);return this.setDOMContent(i)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=U.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=U.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Gh);_&&_.focus()}},m.RasterDEMTileSource=Zi,m.RasterTileSource=_t,m.ScaleControl=class{constructor(_){this._onMove=()=>{gc(this._map,this._container,this.options)},this.setUnit=i=>{this.options.unit=i,gc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},mc),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){U.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},m.ScrollZoomHandler=uc,m.Style=jr,m.TerrainControl=class{constructor(_){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=_}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=U.create("button","maplibregl-ctrl-terrain",this._container),U.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(){U.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},m.TwoFingersTouchPitchHandler=Pd,m.TwoFingersTouchRotateHandler=Rh,m.TwoFingersTouchZoomHandler=Ld,m.TwoFingersTouchZoomRotateHandler=Xl,m.VectorTileSource=Nn,m.VideoSource=Io,m.addSourceType=(_,i)=>c._(void 0,void 0,void 0,function*(){if(Wa(_))throw new Error(`A source type called "${_}" already exists.`);((u,d)=>{Ha[u]=d})(_,i)}),m.clearPrewarmedResources=function(){const _=hn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Re),hn=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()"))},m.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},m.getRTLTextPluginStatus=function(){return Ot().getRTLTextPluginStatus()},m.getVersion=function(){return kd},m.getWorkerCount=function(){return ln.workerCount},m.getWorkerUrl=function(){return c.a.WORKER_URL},m.importScriptInWorkers=function(_){return gi().broadcast("IS",_)},m.prewarm=function(){gn().acquire(Re)},m.setMaxParallelImageRequests=function(_){c.a.MAX_PARALLEL_IMAGE_REQUESTS=_},m.setRTLTextPlugin=function(_,i){return Ot().setRTLTextPlugin(_,i)},m.setWorkerCount=function(_){ln.workerCount=_},m.setWorkerUrl=function(_){c.a.WORKER_URL=_}});var p=r;return p})})(L0);var db=L0.exports;const As=pb(db);function _y(t){let e;return r=>{if(r)for(let s in r){let l=e==null?void 0:e[s],p=r[s];l!==p&&t(s,p,l)}else if(e)for(let s in e)t(s,void 0,e[s]);e=r}}function fb(t,...e){let r=[t];for(let s of e)if(s)Array.isArray(s)&&s[0]===t?r.push(...s.slice(1)):r.push(s);else continue;if(r.length!==1)return r.length===2?r[1]:r}function mb(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function v2(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}var A0=gb;function gb(t){var e,r,s;if(t){if(Array.isArray(t)){for(e=[],r=t.length,s=0;s{s=null}),ah())},i(l){r||(wn(s),r=!0)},o(l){Qn(s),r=!1},d(l){l&&on(e),s&&s.d(l)}}}function yb(t,e,r){let s,l,p,m,c,S,L,R,k,U,ut,pt,{$$slots:vt={},$$scope:bt}=e,{id:Dt=T0("layer")}=e,{source:Rt=void 0}=e,{sourceLayer:Gt=void 0}=e,{beforeId:se=void 0}=e,{beforeLayerType:de=void 0}=e,{type:Ve}=e,{paint:he=void 0}=e,{layout:Me=void 0}=e,{filter:_e=void 0}=e,{applyToClusters:be=void 0}=e,{minzoom:Nt=void 0}=e,{maxzoom:sn=void 0}=e,{manageHoverState:ke=!1}=e,{hovered:ye=null}=e,{interactive:Xe=!0}=e,{hoverCursor:Cn=void 0}=e,{eventsIfTopMost:fe=!1}=e;const an=hg(),{map:Dn,source:ji,self:mn,minzoom:Re,maxzoom:ln,eventTopMost:In,layerInfo:hn}=ub();$r(t,Dn,jt=>r(31,k=jt)),$r(t,ji,jt=>r(32,U=jt)),$r(t,mn,jt=>r(0,R=jt)),$r(t,Re,jt=>r(34,pt=jt)),$r(t,ln,jt=>r(33,ut=jt)),du(()=>{R&&k&&(hn.delete(R),k==null||k.removeLayer(R))});let Ue;function gn(jt){var _t,Zi;if(!Xe||!R||!k||fe&&In(jt)!==R)return;let St=jt.features??[],ui=(Zi=(_t=St[0])==null?void 0:_t.properties)==null?void 0:Zi.cluster_id,Nn={event:jt,map:k,clusterId:ui,layer:R,source:c,features:St};an(jt.type,Nn)}function Rn(jt){var _t,Zi;if(!Xe||!R||!k||fe&&In(jt)!==R)return;Cn&&(k.getCanvas().style.cursor=Cn);let St=jt.features??[];r(6,ye=St[0]??null);let ui=(Zi=(_t=St[0])==null?void 0:_t.properties)==null?void 0:Zi.cluster_id;an("mouseenter",{event:jt,map:k,clusterId:ui,layer:R,source:c,features:St})}function gi(jt){var _t,Zi,Ct;if(!Xe||!k)return;if(fe&&In(jt)!==R){r(6,ye=null),ke&&Ue!==void 0&&(k==null||k.setFeatureState({source:c,sourceLayer:Gt,id:Ue},{hover:!1}),Ue=void 0);return}k.getCanvas().style.cursor=Cn;let St=jt.features??[],ui=(Zi=(_t=St[0])==null?void 0:_t.properties)==null?void 0:Zi.cluster_id,Nn=(Ct=St[0])==null?void 0:Ct.id;Nn!==Ue&&(ke&&(Ue!==void 0&&(k==null||k.setFeatureState({source:c,id:Ue,sourceLayer:Gt},{hover:!1})),k==null||k.setFeatureState({source:c,id:Nn,sourceLayer:Gt},{hover:!0})),Ue=Nn,r(6,ye=St[0]??null)),an("mousemove",{event:jt,map:k,clusterId:ui,layer:R,source:c,features:St})}function li(jt){if(!(!Xe||!R||!k)){if(Cn&&(k.getCanvas().style.cursor=""),r(6,ye=null),ke&&Ue!==void 0){const St={source:c,id:Ue,sourceLayer:Gt};k==null||k.setFeatureState(St,{hover:!1}),Ue=void 0}an("mouseleave",{map:k,layer:R,source:c})}}let Wn=!0;function ii(jt){k&&(k.off("click",jt,gn),k.off("dblclick",jt,gn),k.off("contextmenu",jt,gn),k.off("mouseenter",jt,Rn),k.off("mousemove",jt,gi),k.off("mouseleave",jt,li))}return du(()=>{k&&R&&ii(R)}),t.$$set=jt=>{"id"in jt&&r(7,Dt=jt.id),"source"in jt&&r(8,Rt=jt.source),"sourceLayer"in jt&&r(9,Gt=jt.sourceLayer),"beforeId"in jt&&r(10,se=jt.beforeId),"beforeLayerType"in jt&&r(11,de=jt.beforeLayerType),"type"in jt&&r(12,Ve=jt.type),"paint"in jt&&r(13,he=jt.paint),"layout"in jt&&r(14,Me=jt.layout),"filter"in jt&&r(15,_e=jt.filter),"applyToClusters"in jt&&r(16,be=jt.applyToClusters),"minzoom"in jt&&r(17,Nt=jt.minzoom),"maxzoom"in jt&&r(18,sn=jt.maxzoom),"manageHoverState"in jt&&r(19,ke=jt.manageHoverState),"hovered"in jt&&r(6,ye=jt.hovered),"interactive"in jt&&r(20,Xe=jt.interactive),"hoverCursor"in jt&&r(21,Cn=jt.hoverCursor),"eventsIfTopMost"in jt&&r(22,fe=jt.eventsIfTopMost),"$$scope"in jt&&r(35,bt=jt.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&r(30,s=mb(be)),t.$$.dirty[0]&1073774592&&r(24,l=fb("all",s,_e)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&r(26,p=Nt??pt),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&r(25,m=sn??ut),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&r(29,c=Rt||U),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&k&&R!==Dt&&c){R&&(ii(R),hn.delete(R));let jt=se;if(!se&&de){let St=k.getStyle().layers,ui=typeof de=="function"?de:_t=>_t.type===de,Nn=St==null?void 0:St.find(ui);Nn&&(jt=Nn.id)}wp(mn,R=Dt,R),k.addLayer(A0({id:R,type:Ve,source:c,"source-layer":Gt,filter:l,paint:he,layout:Me,minzoom:p,maxzoom:m}),jt),r(23,Wn=!0),k.on("click",R,gn),k.on("dblclick",R,gn),k.on("contextmenu",R,gn),k.on("mouseenter",R,Rn),k.on("mousemove",R,gi),k.on("mouseleave",R,li)}t.$$.dirty[0]&1048577&&R&&hn.set(R,{interactive:Xe}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(28,S=R?_y((jt,St)=>k==null?void 0:k.setPaintProperty(R,jt,St)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(27,L=R?_y((jt,St)=>k==null?void 0:k.setLayoutProperty(R,jt,St)):void 0),t.$$.dirty[0]&268443648&&(S==null||S(he)),t.$$.dirty[0]&134234112&&(L==null||L(Me)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&R&&(k==null||k.setLayerZoomRange(R,p,m)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&R&&(Wn?r(23,Wn=!1):k==null||k.setFilter(R,l))},[R,Dn,ji,mn,Re,ln,ye,Dt,Rt,Gt,se,de,Ve,he,Me,_e,be,Nt,sn,ke,Xe,Cn,fe,Wn,l,m,p,L,S,c,s,k,U,ut,pt,bt,vt]}class vb extends xo{constructor(e){super(),vo(this,e,yb,_b,Ur,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function xb(t,e,r){let s;const{map:l}=Zp();$r(t,l,S=>r(4,s=S));let{position:p="top-left"}=e,{container:m=void 0}=e,c=null;return du(()=>{s!=null&&s.loaded()&&c&&s.removeControl(c)}),t.$$set=S=>{"position"in S&&r(1,p=S.position),"container"in S&&r(2,m=S.container)},t.$$.update=()=>{if(t.$$.dirty&30&&s&&!c){let S;typeof m=="string"?S=document.querySelector(m)??void 0:S=m,r(3,c=new As.FullscreenControl({container:S})),s.addControl(c,p)}},[l,p,m,c,s]}class bb extends xo{constructor(e){super(),vo(this,e,xb,null,Ur,{position:1,container:2})}}function wb(t,e,r){let s;const{map:l}=Zp();$r(t,l,U=>r(8,s=U));let{position:p="top-left"}=e,{positionOptions:m=void 0}=e,{fitBoundsOptions:c=void 0}=e,{trackUserLocation:S=!1}=e,{showAccuracyCircle:L=!0}=e,{showUserLocation:R=!0}=e,{control:k=null}=e;return du(()=>{s!=null&&s.loaded()&&k&&s.removeControl(k)}),t.$$set=U=>{"position"in U&&r(2,p=U.position),"positionOptions"in U&&r(3,m=U.positionOptions),"fitBoundsOptions"in U&&r(4,c=U.fitBoundsOptions),"trackUserLocation"in U&&r(5,S=U.trackUserLocation),"showAccuracyCircle"in U&&r(6,L=U.showAccuracyCircle),"showUserLocation"in U&&r(7,R=U.showUserLocation),"control"in U&&r(1,k=U.control)},t.$$.update=()=>{t.$$.dirty&510&&s&&!k&&(r(1,k=new As.GeolocateControl({positionOptions:m,fitBoundsOptions:c,trackUserLocation:S,showAccuracyCircle:L,showUserLocation:R})),s.addControl(k,p))},[l,k,p,m,c,S,L,R,s]}class Ib extends xo{constructor(e){super(),vo(this,e,wb,null,Ur,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function Eb(t){let e;const r=t[15].default,s=uu(r,t,t[23],null);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p&8388608)&&hu(s,r,l,l[23],e?cu(r,l[23],p,null):pu(l[23]),null)},i(l){e||(wn(s,l),e=!0)},o(l){Qn(s,l),e=!1},d(l){s&&s.d(l)}}}function Sb(t){let e,r,s;function l(m){t[16](m)}let p={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[Eb]},$$scope:{ctx:t}};return t[0]!==void 0&&(p.hovered=t[0]),e=new vb({props:p}),Uc.push(()=>h1(e,"hovered",l)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){zc(e.$$.fragment)},m(m,c){su(e,m,c),s=!0},p(m,[c]){const S={};c&2&&(S.id=m[1]),c&4&&(S.source=m[2]),c&8&&(S.sourceLayer=m[3]),c&16&&(S.beforeId=m[4]),c&32&&(S.beforeLayerType=m[5]),c&64&&(S.paint=m[6]),c&128&&(S.layout=m[7]),c&256&&(S.filter=m[8]),c&512&&(S.minzoom=m[9]),c&1024&&(S.maxzoom=m[10]),c&2048&&(S.hoverCursor=m[11]),c&4096&&(S.manageHoverState=m[12]),c&8192&&(S.eventsIfTopMost=m[13]),c&16384&&(S.interactive=m[14]),c&8388608&&(S.$$scope={dirty:c,ctx:m}),!r&&c&1&&(r=!0,S.hovered=m[0],l1(()=>r=!1)),e.$set(S)},i(m){s||(wn(e.$$.fragment,m),s=!0)},o(m){Qn(e.$$.fragment,m),s=!1},d(m){au(e,m)}}}function Cb(t,e,r){let{$$slots:s={},$$scope:l}=e,{id:p=T0("line")}=e,{source:m=void 0}=e,{sourceLayer:c=void 0}=e,{beforeId:S=void 0}=e,{beforeLayerType:L=void 0}=e,{paint:R}=e,{layout:k=void 0}=e,{filter:U=void 0}=e,{minzoom:ut=void 0}=e,{maxzoom:pt=void 0}=e,{hoverCursor:vt=void 0}=e,{manageHoverState:bt=!1}=e,{hovered:Dt=null}=e,{eventsIfTopMost:Rt=!1}=e,{interactive:Gt=!0}=e;function se(Nt){Dt=Nt,r(0,Dt)}function de(Nt){Ac.call(this,t,Nt)}function Ve(Nt){Ac.call(this,t,Nt)}function he(Nt){Ac.call(this,t,Nt)}function Me(Nt){Ac.call(this,t,Nt)}function _e(Nt){Ac.call(this,t,Nt)}function be(Nt){Ac.call(this,t,Nt)}return t.$$set=Nt=>{"id"in Nt&&r(1,p=Nt.id),"source"in Nt&&r(2,m=Nt.source),"sourceLayer"in Nt&&r(3,c=Nt.sourceLayer),"beforeId"in Nt&&r(4,S=Nt.beforeId),"beforeLayerType"in Nt&&r(5,L=Nt.beforeLayerType),"paint"in Nt&&r(6,R=Nt.paint),"layout"in Nt&&r(7,k=Nt.layout),"filter"in Nt&&r(8,U=Nt.filter),"minzoom"in Nt&&r(9,ut=Nt.minzoom),"maxzoom"in Nt&&r(10,pt=Nt.maxzoom),"hoverCursor"in Nt&&r(11,vt=Nt.hoverCursor),"manageHoverState"in Nt&&r(12,bt=Nt.manageHoverState),"hovered"in Nt&&r(0,Dt=Nt.hovered),"eventsIfTopMost"in Nt&&r(13,Rt=Nt.eventsIfTopMost),"interactive"in Nt&&r(14,Gt=Nt.interactive),"$$scope"in Nt&&r(23,l=Nt.$$scope)},[Dt,p,m,c,S,L,R,k,U,ut,pt,vt,bt,Rt,Gt,s,se,de,Ve,he,Me,_e,be,l]}class x2 extends xo{constructor(e){super(),vo(this,e,Cb,Sb,Ur,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function Tb(t){let e=t.getCenter(),r=Math.round(t.getZoom()*100)/100,s=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),l=Math.pow(10,s),p=Math.round(e.lat*l)/l,m=Math.round(e.lng*l)/l,c=`${r}/${p}/${m}`,S=t.getBearing(),L=t.getPitch();return(S||L)&&(c+=`/${Math.round(S*10)/10}`),L&&(c+=`/${Math.round(L)}`),`#${c}`}function Lb(t){return t.replace("#","").split("/").map(parseFloat)}var Nc=mg;function mg(t,e){return t===e||t!==t&&e!==e?!0:typeof t!=typeof e||{}.toString.call(t)!={}.toString.call(e)||t!==Object(t)||!t?!1:Array.isArray(t)?xy(t,e):{}.toString.call(t)=="[object Set]"?xy(Array.from(t),Array.from(e)):{}.toString.call(t)=="[object Object]"?Ab(t,e):Pb(t,e)}function Pb(t,e){return t.toString()===e.toString()}function xy(t,e){var r=t.length;if(r!=e.length)return!1;for(var s=0;sr(6,s=R));let{position:p="top-left"}=e,{showCompass:m=!0}=e,{showZoom:c=!0}=e,{visualizePitch:S=!1}=e,L=null;return du(()=>{s!=null&&s.loaded()&&L&&s.removeControl(L)}),t.$$set=R=>{"position"in R&&r(1,p=R.position),"showCompass"in R&&r(2,m=R.showCompass),"showZoom"in R&&r(3,c=R.showZoom),"visualizePitch"in R&&r(4,S=R.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&s&&!L&&(r(5,L=new As.NavigationControl({showCompass:m,showZoom:c,visualizePitch:S})),s.addControl(L,p))},[l,p,m,c,S,L,s]}class Db extends xo{constructor(e){super(),vo(this,e,Mb,null,Ur,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function Rb(t,e,r){let s;const{map:l}=Zp();$r(t,l,L=>r(5,s=L));let{position:p="bottom-left"}=e,{maxWidth:m=void 0}=e,{unit:c="metric"}=e,S=null;return du(()=>{s!=null&&s.loaded()&&S&&s.removeControl(S)}),t.$$set=L=>{"position"in L&&r(1,p=L.position),"maxWidth"in L&&r(2,m=L.maxWidth),"unit"in L&&r(3,c=L.unit)},t.$$.update=()=>{t.$$.dirty&62&&s&&!S&&(r(4,S=new As.ScaleControl({maxWidth:m,unit:c})),s.addControl(S,p))},[l,p,m,c,S,s]}class Nb extends xo{constructor(e){super(),vo(this,e,Rb,null,Ur,{position:1,maxWidth:2,unit:3})}}const{window:kb}=n1,zb=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),by=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function wy(t){let e,r,s=t[3]&&Iy(t);const l=t[46].default,p=uu(l,t,t[45],by);return{c(){s&&s.c(),e=Xi(),p&&p.c()},m(m,c){s&&s.m(m,c),un(m,e,c),p&&p.m(m,c),r=!0},p(m,c){m[3]?s?(s.p(m,c),c[0]&8&&wn(s,1)):(s=Iy(m),s.c(),wn(s,1),s.m(e.parentNode,e)):s&&(sh(),Qn(s,1,1,()=>{s=null}),ah()),p&&p.p&&(!r||c[0]&112|c[1]&16384)&&hu(p,l,m,m[45],r?cu(l,m[45],c,zb):pu(m[45]),by)},i(m){r||(wn(s),wn(p,m),r=!0)},o(m){Qn(s),Qn(p,m),r=!1},d(m){m&&on(e),s&&s.d(m),p&&p.d(m)}}}function Iy(t){let e,r,s,l,p,m,c,S;return e=new Db({props:{position:t[7]}}),s=new Ib({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),p=new bb({props:{position:t[7]}}),c=new Nb({props:{position:t[7]}}),{c(){zc(e.$$.fragment),r=Xi(),zc(s.$$.fragment),l=Xi(),zc(p.$$.fragment),m=Xi(),zc(c.$$.fragment)},m(L,R){su(e,L,R),un(L,r,R),su(s,L,R),un(L,l,R),su(p,L,R),un(L,m,R),su(c,L,R),S=!0},p(L,R){const k={};R[0]&128&&(k.position=L[7]),e.$set(k);const U={};R[0]&128&&(U.position=L[7]),s.$set(U);const ut={};R[0]&128&&(ut.position=L[7]),p.$set(ut);const pt={};R[0]&128&&(pt.position=L[7]),c.$set(pt)},i(L){S||(wn(e.$$.fragment,L),wn(s.$$.fragment,L),wn(p.$$.fragment,L),wn(c.$$.fragment,L),S=!0)},o(L){Qn(e.$$.fragment,L),Qn(s.$$.fragment,L),Qn(p.$$.fragment,L),Qn(c.$$.fragment,L),S=!1},d(L){L&&(on(r),on(l),on(m)),au(e,L),au(s,L),au(p,L),au(c,L)}}}function Ob(t){let e,r,s,l,p,m=t[4]&&t[0]&&wy(t);return{c(){e=rn("div"),m&&m.c(),Tn(e,"class",r=uy(t[2])+" svelte-p00lfq"),Tn(e,"data-testid","map-container"),hy(e,"expand-map",!t[2])},m(c,S){un(c,e,S),m&&m.m(e,null),t[47](e),s=!0,l||(p=[yp(kb,"hashchange",t[11]),e1(t[10].call(null,e))],l=!0)},p(c,S){c[4]&&c[0]?m?(m.p(c,S),S[0]&17&&wn(m,1)):(m=wy(c),m.c(),wn(m,1),m.m(e,null)):m&&(sh(),Qn(m,1,1,()=>{m=null}),ah()),(!s||S[0]&4&&r!==(r=uy(c[2])+" svelte-p00lfq"))&&Tn(e,"class",r),(!s||S[0]&4)&&hy(e,"expand-map",!c[2])},i(c){s||(wn(m),s=!0)},o(c){Qn(m),s=!1},d(c){c&&on(e),m&&m.d(),t[47](null),l=!1,Cu(p)}}}function Fb(t,e,r){let s,l,p,m,{$$slots:c={},$$scope:S}=e,{map:L=null}=e,{mapContainer:R=void 0}=e,{class:k=void 0}=e,{style:U}=e,{diffStyleUpdates:ut=!1}=e,{center:pt=void 0}=e,{zoom:vt=void 0}=e,{pitch:bt=0}=e,{bearing:Dt=0}=e,{bounds:Rt=void 0}=e,{hash:Gt=!1}=e,{updateHash:se=Ct=>{window.history.replaceState(window.history.state,"",Ct)}}=e,{loaded:de=!1}=e,{minZoom:Ve=0}=e,{maxZoom:he=22}=e,{minPitch:Me=0}=e,{maxPitch:_e=60}=e,{renderWorldCopies:be=void 0}=e,{dragPan:Nt=void 0}=e,{dragRotate:sn=void 0}=e,{pitchWithRotate:ke=void 0}=e,{antialias:ye=void 0}=e,{zoomOnDoubleClick:Xe=!0}=e,{locale:Cn=void 0}=e,{interactive:fe=!0}=e,{attributionControl:an=!0}=e,{cooperativeGestures:Dn=!1}=e,{preserveDrawingBuffer:ji=!1}=e,{maxBounds:mn=void 0}=e,{images:Re=[]}=e,{standardControls:ln=!1}=e,{filterLayers:In=void 0}=e,{transformRequest:hn=void 0}=e;const Ue=hg(),{map:gn,loadedImages:Rn}=lb();$r(t,gn,Ct=>r(4,p=Ct)),$r(t,Rn,Ct=>r(5,m=Ct));let gi=new Set;async function li(Ct,Jt=!1){if(p&&!(!p.loaded()&&!Jt))if("url"in Ct){gi.add(Ct.id);try{let Fe=await p.loadImage(Ct.url);p==null||p.addImage(Ct.id,Fe.data,Ct.options),m.add(Ct.id),Rn.set(m)}catch(Fe){Ue("error",Fe)}finally{gi.delete(Ct.id)}}else p.addImage(Ct.id,Ct.data,Ct.options),m.add(Ct.id),Rn.set(m)}let Wn,ii,jt,St;function ui(Ct){return _t(),wp(gn,p=new As.Map(A0({container:Ct,style:U,locale:Cn,center:pt,zoom:vt,pitch:bt,bearing:Dt,minZoom:Ve,maxZoom:he,minPitch:Me,maxPitch:_e,renderWorldCopies:be,dragPan:Nt,dragRotate:sn,pitchWithRotate:ke,antialias:ye,interactive:fe,preserveDrawingBuffer:ji,maxBounds:mn,bounds:Rt,attributionControl:an,transformRequest:hn,cooperativeGestures:Dn})),p),p.on("load",Jt=>{Jt.target.getContainer().setAttribute("data-testid","map"),Jt.target.getCanvas().setAttribute("data-testid","map-canvas"),r(0,de=!0),Ue("load",p)}),p.on("error",Jt=>Ue("error",{...Jt,map:p})),p.on("movestart",Jt=>Ue("movestart",{...Jt,map:p})),p.on("moveend",Jt=>{if(r(12,pt=Jt.target.getCenter()),r(13,vt=Jt.target.getZoom()),r(14,bt=Jt.target.getPitch()),r(15,Dt=Jt.target.getBearing()),r(16,Rt=Jt.target.getBounds()),Ue("moveend",{...Jt,map:p}),Gt){let Fe=new URL(window.location.href.replace(/(#.+)?$/,Tb(p)));se(Fe)}}),p.on("click",Jt=>Ue("click",{...Jt,map:p})),p.on("dblclick",Jt=>Ue("dblclick",{...Jt,map:p})),p.on("contextmenu",Jt=>Ue("contextmenu",{...Jt,map:p})),p.on("zoomstart",Jt=>Ue("zoomstart",{...Jt,map:p})),p.on("zoom",Jt=>{Ue("zoom",{...Jt,map:p})}),p.on("zoomend",Jt=>{Ue("zoomend",{...Jt,map:p})}),p.on("style.load",()=>{if(p){const Jt=p.getStyle();if(r(42,Wn=Jt.layers.map(Fe=>Fe.id)),r(43,ii=Object.keys(Jt.sources)),St)for(const[Fe,Io]of Object.entries(St))p.addSource(Fe,Io);if(jt)for(const Fe of jt)p.addLayer(Fe);for(const Fe of Re)li(Fe,!0)}}),p.on("styledata",Jt=>{if(p&&In){const Fe=p.getStyle().layers;if(Fe)for(let Io of Fe)In(Io)||p.setLayoutProperty(Io.id,"visibility","none")}Ue("styledata",{...Jt,map:p})}),{destroy(){r(0,de=!1),p==null||p.remove(),wp(gn,p=null,p)}}}let Nn=U;function _t(){if(Gt){let Ct=Lb(window.location.hash);Ct.length>=3&&(r(13,vt=Ct[0]),r(12,pt=[Ct[2],Ct[1]])),Ct.length==5&&(r(15,Dt=Ct[3]),r(14,bt=Ct[4]))}}function Zi(Ct){Uc[Ct?"unshift":"push"](()=>{R=Ct,r(1,R)})}return t.$$set=Ct=>{"map"in Ct&&r(17,L=Ct.map),"mapContainer"in Ct&&r(1,R=Ct.mapContainer),"class"in Ct&&r(2,k=Ct.class),"style"in Ct&&r(18,U=Ct.style),"diffStyleUpdates"in Ct&&r(19,ut=Ct.diffStyleUpdates),"center"in Ct&&r(12,pt=Ct.center),"zoom"in Ct&&r(13,vt=Ct.zoom),"pitch"in Ct&&r(14,bt=Ct.pitch),"bearing"in Ct&&r(15,Dt=Ct.bearing),"bounds"in Ct&&r(16,Rt=Ct.bounds),"hash"in Ct&&r(20,Gt=Ct.hash),"updateHash"in Ct&&r(21,se=Ct.updateHash),"loaded"in Ct&&r(0,de=Ct.loaded),"minZoom"in Ct&&r(22,Ve=Ct.minZoom),"maxZoom"in Ct&&r(23,he=Ct.maxZoom),"minPitch"in Ct&&r(24,Me=Ct.minPitch),"maxPitch"in Ct&&r(25,_e=Ct.maxPitch),"renderWorldCopies"in Ct&&r(26,be=Ct.renderWorldCopies),"dragPan"in Ct&&r(27,Nt=Ct.dragPan),"dragRotate"in Ct&&r(28,sn=Ct.dragRotate),"pitchWithRotate"in Ct&&r(29,ke=Ct.pitchWithRotate),"antialias"in Ct&&r(30,ye=Ct.antialias),"zoomOnDoubleClick"in Ct&&r(31,Xe=Ct.zoomOnDoubleClick),"locale"in Ct&&r(32,Cn=Ct.locale),"interactive"in Ct&&r(33,fe=Ct.interactive),"attributionControl"in Ct&&r(34,an=Ct.attributionControl),"cooperativeGestures"in Ct&&r(35,Dn=Ct.cooperativeGestures),"preserveDrawingBuffer"in Ct&&r(36,ji=Ct.preserveDrawingBuffer),"maxBounds"in Ct&&r(37,mn=Ct.maxBounds),"images"in Ct&&r(38,Re=Ct.images),"standardControls"in Ct&&r(3,ln=Ct.standardControls),"filterLayers"in Ct&&r(39,In=Ct.filterLayers),"transformRequest"in Ct&&r(40,hn=Ct.transformRequest),"$$scope"in Ct&&r(45,S=Ct.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&r(7,s=typeof ln=="boolean"?void 0:ln),t.$$.dirty[0]&16&&r(17,L=p),t.$$.dirty[0]&786448|t.$$.dirty[1]&14336&&p&&!Nc(U,Nn)){const Ct=p.getStyle();if(Wn&&(jt=Ct.layers.filter(Jt=>!Wn.includes(Jt.id))),ii){const Jt=Object.keys(Ct.sources).filter(Fe=>!ii.includes(Fe));St={};for(const Fe of Jt)St[Fe]=Ct.sources[Fe]}r(44,Nn=U),p.setStyle(U,{diff:ut}),wp(Rn,m=new Set,m),r(41,gi=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&1152&&de&&p!=null&&p.loaded())for(let Ct of Re)!m.has(Ct.id)&&!gi.has(Ct.id)&&!p.hasImage(Ct.id)&&li(Ct);if(t.$$.dirty[0]&32|t.$$.dirty[1]&128&&r(6,l=Re.every(Ct=>m.has(Ct.id))),t.$$.dirty[0]&61456&&p){let Ct={};pt!=null&&!Nc(pt,p==null?void 0:p.getCenter())&&(Ct.center=pt),vt!=null&&!Nc(vt,p==null?void 0:p.getZoom())&&(Ct.zoom=vt),Dt!=null&&!Nc(Dt,p==null?void 0:p.getBearing())&&(Ct.bearing=Dt),bt!=null&&!Nc(bt,p==null?void 0:p.getPitch())&&(Ct.pitch=bt),Object.keys(Ct).length&&p.easeTo(Ct)}t.$$.dirty[0]&65552&&Rt&&!Nc(Rt,p==null?void 0:p.getBounds())&&(p==null||p.fitBounds(Rt)),t.$$.dirty[0]&16|t.$$.dirty[1]&1&&(Xe?p==null||p.doubleClickZoom.enable():p==null||p.doubleClickZoom.disable())},[de,R,k,ln,p,m,l,s,gn,Rn,ui,_t,pt,vt,bt,Dt,Rt,L,U,ut,Gt,se,Ve,he,Me,_e,be,Nt,sn,ke,ye,Xe,Cn,fe,an,Dn,ji,mn,Re,In,hn,gi,Wn,ii,Nn,S,c,Zi]}class b2 extends xo{constructor(e){super(),vo(this,e,Fb,Ob,Ur,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,minPitch:24,maxPitch:25,renderWorldCopies:26,dragPan:27,dragRotate:28,pitchWithRotate:29,antialias:30,zoomOnDoubleClick:31,locale:32,interactive:33,attributionControl:34,cooperativeGestures:35,preserveDrawingBuffer:36,maxBounds:37,images:38,standardControls:3,filterLayers:39,transformRequest:40},null,[-1,-1])}}let mp={origins:"blue",destinations:"purple",lts1:"#009e73",lts2:"#56b4e9",lts3:"#e69f00",lts4:"#d55e00",lts_not_allowed:"red"},w2=["match",["get","lts"],0,mp.lts_not_allowed,1,mp.lts1,2,mp.lts2,3,mp.lts3,4,mp.lts4,"red"],I2=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],E2={lts1:"LTS 1 - suitable for children",lts2:"LTS 2 - low stress",lts3:"LTS 3 - medium stress",lts4:"LTS 4 - high stress",lts_not_allowed:"Cyclists not allowed"},S2=[0,3,5,8,10,20,100],C2=["#267300","#70A800","#FFAA00","#E60000","#A80000","#730000"];const Ey="/od2net/assets/logo-fbff26ba.png";function Bb(t){let e,r,s,l,p,m,c,S,L,R,k,U,ut,pt,vt,bt,Dt,Rt,Gt,se,de,Ve,he,Me,_e,be,Nt,sn,ke;return{c(){e=rn("div"),r=rn("img"),l=Xi(),p=rn("select"),m=rn("option"),m.textContent="Pre-built route networks",c=rn("option"),c.textContent="Interactively generate route networks",S=rn("option"),S.textContent="Explore edge costs",L=Xi(),R=rn("dialog"),k=rn("div"),U=rn("h1"),U.textContent="About od2net",ut=Xi(),pt=rn("button"),pt.textContent="Close",vt=Xi(),bt=rn("img"),Rt=Xi(),Gt=rn("p"),Gt.innerHTML=`od2net is an open-source project by Dustin Carlino , part of the Urban Analytics Technology Platform - . It wouldn't be possible without:`,re=Zi(),pe=rn("ul"),pe.innerHTML=`
  • BikeOttawa's Level of Traffic Stress definition
  • GeoRust
  • svelte-maplibre
  • MapLibre GL JS
  • ChartJS
  • OpenStreetMap
  • fast-paths
  • Propensity to Cycle Tool
  • PMTiles
  • Special thanks to + . It wouldn't be possible without:`,se=Xi(),de=rn("ul"),de.innerHTML=`
  • BikeOttawa's Level of Traffic Stress definition
  • GeoRust
  • svelte-maplibre
  • MapLibre GL JS
  • ChartJS
  • OpenStreetMap
  • fast-paths
  • Propensity to Cycle Tool
  • PMTiles
  • Special thanks to Hadrien Salat for the logo and Stuart Lynn for feedback and help with pmtiles, both from - the Alan Turing Institute
  • `,Be=Zi(),ue=rn("button"),ue.textContent="About",Pe=Zi(),me=rn("br"),ve=Zi(),Nt=rn("br"),ly(r.src,s=Ey)||Sn(r,"src",s),Sn(r,"width","100"),Sn(r,"alt","od2net logo by Hadrien Salat"),Sn(r,"class","svelte-1ey54bq"),m.__value="main",Vm(m,m.__value),Sn(m,"class","svelte-1ey54bq"),c.__value="interactive",Vm(c,c.__value),Sn(c,"class","svelte-1ey54bq"),S.__value="costs",Vm(S,S.__value),Sn(S,"class","svelte-1ey54bq"),Sn(p,"class","svelte-1ey54bq"),t[0]===void 0&&pf(()=>t[3].call(p)),Ro(e,"display","flex"),Ro(e,"justify-content","space-between"),Sn(e,"class","svelte-1ey54bq"),Sn(U,"class","svelte-1ey54bq"),Sn(dt,"class","svelte-1ey54bq"),Ro(k,"display","flex"),Ro(k,"justify-content","space-between"),Sn(k,"class","svelte-1ey54bq"),ly(It.src,Dt=Ey)||Sn(It,"src",Dt),Sn(It,"width","300"),Sn(It,"alt","od2net logo by Hadrien Salat"),Sn(It,"class","svelte-1ey54bq"),Sn(Gt,"class","svelte-1ey54bq"),Sn(pe,"class","svelte-1ey54bq"),Sn(R,"class","svelte-1ey54bq"),Sn(ue,"class","svelte-1ey54bq"),Sn(me,"class","svelte-1ey54bq"),Sn(Nt,"class","svelte-1ey54bq")},m(ge,He){un(ge,e,He),En(e,r),En(e,l),En(e,p),En(p,m),En(p,c),En(p,S),cy(p,t[0],!0),un(ge,L,He),un(ge,R,He),En(R,k),En(k,U),En(k,ct),En(k,dt),En(R,bt),En(R,It),En(R,Rt),En(R,Gt),En(R,re),En(R,pe),t[5](R),un(ge,Be,He),un(ge,ue,He),un(ge,Pe,He),un(ge,me,He),un(ge,ve,He),un(ge,Nt,He),sn||(Re=[yp(p,"change",t[3]),yp(p,"change",t[2]),yp(dt,"click",t[4]),yp(ue,"click",t[6])],sn=!0)},p(ge,[He]){He&1&&cy(p,ge[0])},i:wr,o:wr,d(ge){ge&&(on(e),on(L),on(R),on(Be),on(ue),on(Pe),on(me),on(ve),on(Nt)),t[5](null),sn=!1,Cu(Re)}}}function Bb(t,e,r){let{app:s}=e,l;function p(){s=="main"?window.location.href="index.html":s=="interactive"?window.location.href="interactive.html":s=="costs"&&(window.location.href="edge_cost.html")}function m(){s=o1(this),r(0,s)}const c=()=>l.close();function S(R){Uc[R?"unshift":"push"](()=>{l=R,r(1,l)})}const L=()=>l.showModal();return t.$$set=R=>{"app"in R&&r(0,s=R.app)},[s,l,p,m,c,S,L]}class S2 extends vo{constructor(e){super(),yo(this,e,Bb,Fb,Vr,{app:0})}}const Vb="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Vb);const Ub=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],qb={decimalLatitude:40.123,decimalLongitude:-74.123},Gb=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],jb=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function Zb(){const t=[];return Ub.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...qb})}),[...t,...Gb,...jb]}const Hb=Zb();Hb.map(t=>t.verbatimCoordinates);/** + the Alan Turing Institute`,Ve=Xi(),he=rn("button"),he.textContent="About",Me=Xi(),_e=rn("br"),be=Xi(),Nt=rn("br"),ly(r.src,s=Ey)||Tn(r,"src",s),Tn(r,"width","100"),Tn(r,"alt","od2net logo by Hadrien Salat"),Tn(r,"class","svelte-1ey54bq"),m.__value="main",Vm(m,m.__value),Tn(m,"class","svelte-1ey54bq"),c.__value="interactive",Vm(c,c.__value),Tn(c,"class","svelte-1ey54bq"),S.__value="costs",Vm(S,S.__value),Tn(S,"class","svelte-1ey54bq"),Tn(p,"class","svelte-1ey54bq"),t[0]===void 0&&pf(()=>t[3].call(p)),ko(e,"display","flex"),ko(e,"justify-content","space-between"),Tn(e,"class","svelte-1ey54bq"),Tn(U,"class","svelte-1ey54bq"),Tn(pt,"class","svelte-1ey54bq"),ko(k,"display","flex"),ko(k,"justify-content","space-between"),Tn(k,"class","svelte-1ey54bq"),ly(bt.src,Dt=Ey)||Tn(bt,"src",Dt),Tn(bt,"width","300"),Tn(bt,"alt","od2net logo by Hadrien Salat"),Tn(bt,"class","svelte-1ey54bq"),Tn(Gt,"class","svelte-1ey54bq"),Tn(de,"class","svelte-1ey54bq"),Tn(R,"class","svelte-1ey54bq"),Tn(he,"class","svelte-1ey54bq"),Tn(_e,"class","svelte-1ey54bq"),Tn(Nt,"class","svelte-1ey54bq")},m(ye,Xe){un(ye,e,Xe),Sn(e,r),Sn(e,l),Sn(e,p),Sn(p,m),Sn(p,c),Sn(p,S),cy(p,t[0],!0),un(ye,L,Xe),un(ye,R,Xe),Sn(R,k),Sn(k,U),Sn(k,ut),Sn(k,pt),Sn(R,vt),Sn(R,bt),Sn(R,Rt),Sn(R,Gt),Sn(R,se),Sn(R,de),t[5](R),un(ye,Ve,Xe),un(ye,he,Xe),un(ye,Me,Xe),un(ye,_e,Xe),un(ye,be,Xe),un(ye,Nt,Xe),sn||(ke=[yp(p,"change",t[3]),yp(p,"change",t[2]),yp(pt,"click",t[4]),yp(he,"click",t[6])],sn=!0)},p(ye,[Xe]){Xe&1&&cy(p,ye[0])},i:Ir,o:Ir,d(ye){ye&&(on(e),on(L),on(R),on(Ve),on(he),on(Me),on(_e),on(be),on(Nt)),t[5](null),sn=!1,Cu(ke)}}}function Vb(t,e,r){let{app:s}=e,l;function p(){s=="main"?window.location.href="index.html":s=="interactive"?window.location.href="interactive.html":s=="costs"&&(window.location.href="edge_cost.html")}function m(){s=o1(this),r(0,s)}const c=()=>l.close();function S(R){Uc[R?"unshift":"push"](()=>{l=R,r(1,l)})}const L=()=>l.showModal();return t.$$set=R=>{"app"in R&&r(0,s=R.app)},[s,l,p,m,c,S,L]}class T2 extends xo{constructor(e){super(),vo(this,e,Vb,Bb,Ur,{app:0})}}function Sy(t,e,r){const s=t.slice();return s[1]=e[r][0],s[2]=e[r][1],s}function Cy(t){let e,r,s,l=t[1]+"",p,m;return{c(){e=rn("li"),r=rn("span"),s=Xi(),p=vl(l),m=Xi(),Tn(r,"class","svelte-kzgqtg"),ko(r,"background",t[2])},m(c,S){un(c,e,S),Sn(e,r),Sn(e,s),Sn(e,p),Sn(e,m)},p(c,S){S&1&&ko(r,"background",c[2]),S&1&&l!==(l=c[1]+"")&&Tp(p,l)},d(c){c&&on(e)}}}function Ub(t){let e,r=ml(t[0]),s=[];for(let l=0;l{"rows"in l&&r(0,s=l.rows)},[s]}class L2 extends xo{constructor(e){super(),vo(this,e,qb,Ub,Ur,{rows:0})}}function Ty(t,e,r){const s=t.slice();return s[1]=e[r][0],s[2]=e[r][1],s}function Ly(t){let e,r,s=t[1]+"",l,p,m,c=t[2]+"",S,L;return{c(){e=rn("tr"),r=rn("td"),l=vl(s),p=Xi(),m=rn("td"),S=vl(c),L=Xi()},m(R,k){un(R,e,k),Sn(e,r),Sn(r,l),Sn(e,p),Sn(e,m),Sn(m,S),Sn(e,L)},p(R,k){k&1&&s!==(s=R[1]+"")&&Tp(l,s),k&1&&c!==(c=R[2]+"")&&Tp(S,c)},d(R){R&&on(e)}}}function Gb(t){let e,r,s=ml(Object.entries(t[0])),l=[];for(let p=0;p{"properties"in l&&r(0,s=l.properties)},[s]}class P2 extends xo{constructor(e){super(),vo(this,e,jb,Gb,Ur,{properties:0})}}function Py(t,e,r){const s=t.slice();return s[3]=e[r],s}function Ay(t,e,r){const s=t.slice();return s[6]=e[r],s}function My(t){let e,r;return{c(){e=rn("span"),r=vl(`  + `),ko(e,"background",t[6]),ko(e,"width","100%"),ko(e,"border","1px solid black")},m(s,l){un(s,e,l),Sn(e,r)},p(s,l){l&1&&ko(e,"background",s[6])},d(s){s&&on(e)}}}function Zb(t){let e,r=t[3]+"",s;return{c(){e=rn("span"),s=vl(r)},m(l,p){un(l,e,p),Sn(e,s)},p(l,p){p&2&&r!==(r=l[3]+"")&&Tp(s,r)},d(l){l&&on(e)}}}function Hb(t){let e,r=t[3].toFixed(t[2])+"",s;return{c(){e=rn("span"),s=vl(r)},m(l,p){un(l,e,p),Sn(e,s)},p(l,p){p&6&&r!==(r=l[3].toFixed(l[2])+"")&&Tp(s,r)},d(l){l&&on(e)}}}function Dy(t){let e;function r(p,m){return p[2]>0?Hb:Zb}let s=r(t),l=s(t);return{c(){l.c(),e=If()},m(p,m){l.m(p,m),un(p,e,m)},p(p,m){s===(s=r(p))&&l?l.p(p,m):(l.d(1),l=s(p),l&&(l.c(),l.m(e.parentNode,e)))},d(p){p&&on(e),l.d(p)}}}function Wb(t){let e,r,s,l=ml(t[0]),p=[];for(let S=0;S{"colorScale"in m&&r(0,s=m.colorScale),"limits"in m&&r(1,l=m.limits),"decimalPlaces"in m&&r(2,p=m.decimalPlaces)},[s,l,p]}class A2 extends xo{constructor(e){super(),vo(this,e,Xb,Wb,Ur,{colorScale:0,limits:1,decimalPlaces:2})}}const Yb="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Yb);const Kb=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],Jb={decimalLatitude:40.123,decimalLongitude:-74.123},Qb=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],$b=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function tw(){const t=[];return Kb.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...Jb})}),[...t,...Qb,...$b]}const ew=tw();ew.map(t=>t.verbatimCoordinates);/** * splaytree v3.1.2 * Fast Splay tree for Node and browser * @@ -608,9 +609,8 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. -***************************************************************************** */function Wb(t,e){var r={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},s,l,p,m;return m={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function c(L){return function(R){return S([L,R])}}function S(L){if(s)throw new TypeError("Generator is already executing.");for(;r;)try{if(s=1,l&&(p=L[0]&2?l.return:L[0]?l.throw||((p=l.return)&&p.call(l),0):l.next)&&!(p=p.call(l,L[1])).done)return p;switch(l=0,p&&(L=[L[0]&2,p.value]),L[0]){case 0:case 1:p=L;break;case 4:return r.label++,{value:L[1],done:!1};case 5:r.label++,l=L[1],L=[0];continue;case 7:L=r.ops.pop(),r.trys.pop();continue;default:if(p=r.trys,!(p=p.length>0&&p[p.length-1])&&(L[0]===6||L[0]===2)){r=0;continue}if(L[0]===3&&(!p||L[1]>p[0]&&L[1]e?1:t0){if(e.right===null)break;if(r(t,e.right.key)>0){var c=e.right;if(e.right=c.left,c.left=e,e=c,e.right===null)break}l.right=e,l=e,e=e.right}else break}return l.right=e.left,p.left=e.right,e.left=s.right,e.right=s.left,e}function Xm(t,e,r,s){var l=new xl(t,e);if(r===null)return l.left=l.right=null,l;r=fl(t,r,s);var p=s(t,r.key);return p<0?(l.left=r.left,l.right=r,r.left=null):p>=0&&(l.right=r.right,l.left=r,r.right=null),l}function Sy(t,e,r){var s=null,l=null;if(e){e=fl(t,e,r);var p=r(e.key,t);p===0?(s=e.left,l=e.right):p<0?(l=e.right,e.right=null,s=e):(s=e.left,e.left=null,l=e)}return{left:s,right:l}}function Yb(t,e,r){return e===null?t:(t===null||(e=fl(t.key,e,r),e.left=t),e)}function ng(t,e,r,s,l){if(t){s(""+e+(r?"└── ":"├── ")+l(t)+` -`);var p=e+(r?" ":"│ ");t.left&&ng(t.left,p,!1,s,l),t.right&&ng(t.right,p,!0,s,l)}}var gg=function(){function t(e){e===void 0&&(e=Xb),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,r){return this._size++,this._root=Xm(e,r,this._root,this._comparator)},t.prototype.add=function(e,r){var s=new xl(e,r);this._root===null&&(s.left=s.right=null,this._size++,this._root=s);var l=this._comparator,p=fl(e,this._root,l),m=l(e,p.key);return m===0?this._root=p:(m<0?(s.left=p.left,s.right=p,p.left=null):m>0&&(s.right=p.right,s.left=p,p.right=null),this._size++,this._root=s),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,r,s){var l;if(r===null)return null;r=fl(e,r,s);var p=s(e,r.key);return p===0?(r.left===null?l=r.right:(l=fl(e,r.left,s),l.right=r.right),this._size--,l):r},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=fl(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var r=this._root,s=this._comparator;r;){var l=s(e,r.key);if(l===0)return r;l<0?r=r.left:r=r.right}return null},t.prototype.find=function(e){return this._root&&(this._root=fl(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var r=this._root,s=this._comparator;r;){var l=s(e,r.key);if(l===0)return!0;l<0?r=r.left:r=r.right}return!1},t.prototype.forEach=function(e,r){for(var s=this._root,l=[],p=!1;!p;)s!==null?(l.push(s),s=s.left):l.length!==0?(s=l.pop(),e.call(r,s),s=s.right):p=!0;return this},t.prototype.range=function(e,r,s,l){for(var p=[],m=this._comparator,c=this._root,S;p.length!==0||c;)if(c)p.push(c),c=c.left;else{if(c=p.pop(),S=m(c.key,r),S>0)break;if(m(c.key,e)>=0&&s.call(l,c))return this;c=c.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(r){var s=r.key;return e.push(s)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(r){var s=r.data;return e.push(s)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var r=this._root,s=!1,l=0,p=[];!s;)if(r)p.push(r),r=r.left;else if(p.length>0){if(r=p.pop(),l===e)return r;l++,r=r.right}else s=!0;return null},t.prototype.next=function(e){var r=this._root,s=null;if(e.right){for(s=e.right;s.left;)s=s.left;return s}for(var l=this._comparator;r;){var p=l(e.key,r.key);if(p===0)break;p<0?(s=r,r=r.left):r=r.right}return s},t.prototype.prev=function(e){var r=this._root,s=null;if(e.left!==null){for(s=e.left;s.right;)s=s.right;return s}for(var l=this._comparator;r;){var p=l(e.key,r.key);if(p===0)break;p<0?r=r.left:(s=r,r=r.right)}return s},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return Jb(this._root)},t.prototype.load=function(e,r,s){r===void 0&&(r=[]),s===void 0&&(s=!1);var l=e.length,p=this._comparator;if(s&&og(e,r,0,l-1,p),this._root===null)this._root=ig(e,r,0,l),this._size=l;else{var m=Qb(this.toList(),Kb(e,r),p);l=this._size+l,this._root=rg({head:m},0,l)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(s){return String(s.key)});var r=[];return ng(this._root,"",!0,function(s){return r.push(s)},e),r.join("")},t.prototype.update=function(e,r,s){var l=this._comparator,p=Sy(e,this._root,l),m=p.left,c=p.right;l(e,r)<0?c=Xm(r,s,c,l):m=Xm(r,s,m,l),this._root=Yb(m,c,l)},t.prototype.split=function(e){return Sy(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,r,s;return Wb(this,function(l){switch(l.label){case 0:e=this._root,r=[],s=!1,l.label=1;case 1:return s?[3,6]:e===null?[3,2]:(r.push(e),e=e.left,[3,5]);case 2:return r.length===0?[3,4]:(e=r.pop(),[4,e]);case 3:return l.sent(),e=e.right,[3,5];case 4:s=!0,l.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function ig(t,e,r,s){var l=s-r;if(l>0){var p=r+Math.floor(l/2),m=t[p],c=e[p],S=new xl(m,c);return S.left=ig(t,e,r,p),S.right=ig(t,e,p+1,s),S}return null}function Kb(t,e){for(var r=new xl(null,null),s=r,l=0;l0?(e=p=p.next=r.pop(),e=e.right):s=!0;return p.next=null,l.next}function rg(t,e,r){var s=r-e;if(s>0){var l=e+Math.floor(s/2),p=rg(t,e,l),m=t.head;return m.left=p,t.head=t.head.next,m.right=rg(t,l+1,r),m}return null}function Qb(t,e,r){for(var s=new xl(null,null),l=s,p=t,m=e;p!==null&&m!==null;)r(p.key,m.key)<0?(l.next=p,p=p.next):(l.next=m,m=m.next),l=l.next;return p!==null?l.next=p:m!==null&&(l.next=m),s.next}function og(t,e,r,s,l){if(!(r>=s)){for(var p=t[r+s>>1],m=r-1,c=s+1;;){do m++;while(l(t[m],p)<0);do c--;while(l(t[c],p)>0);if(m>=c)break;var S=t[m];t[m]=t[c],t[c]=S,S=e[m],e[m]=e[c],e[c]=S}og(t,e,r,c,l),og(t,e,c+1,s,l)}}function gs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Cy(t,e){for(var r=0;rr.x?1:e.yr.y?1:0}}]);function t(e,r){gs(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return to(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var r=e.point.events,s=0,l=r.length;s=0&&k>=0?LU?-1:0:S<0&&k<0?LU?1:0:kS?1:0}}}]),t}(),rw=0,gf=function(){to(t,null,[{key:"compare",value:function(e,r){var s=e.leftSE.point.x,l=r.leftSE.point.x,p=e.rightSE.point.x,m=r.rightSE.point.x;if(mc&&S>L)return-1;var k=e.comparePoint(r.leftSE.point);if(k<0)return 1;if(k>0)return-1;var U=r.comparePoint(e.rightSE.point);return U!==0?U:-1}if(s>l){if(cS&&c>R)return 1;var ct=r.comparePoint(e.leftSE.point);if(ct!==0)return ct;var dt=e.comparePoint(r.rightSE.point);return dt<0?1:dt>0?-1:1}if(cS)return 1;if(pm){var It=e.comparePoint(r.rightSE.point);if(It<0)return 1;if(It>0)return-1}if(p!==m){var Dt=L-c,Rt=p-s,Gt=R-S,re=m-l;if(Dt>Rt&&Gtre)return-1}return p>m?1:pR?1:e.idr.id?1:0}}]);function t(e,r,s,l){gs(this,t),this.id=++rw,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=s,this.windings=l}return to(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:er?e:r}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var r=this.leftSE.point,s=this.rightSE.point,l=this.vector();if(r.x===s.x)return e.x===r.x?0:e.x0&&c.swapEvents(),na.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),s&&(l.checkForConsuming(),p.checkForConsuming()),r}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var r=0,s=this.windings.length;r0){var p=r;r=s,s=p}if(r.prev===s){var m=r;r=s,s=m}for(var c=0,S=s.rings.length;c0)l=r,p=e,m=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var S=new na(l,!0),L=new na(p,!1);return new t(S,L,[s],[m])}}]),t}(),My=function(){function t(e,r,s){if(gs(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=s,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var l=Pp.round(e[0][0],e[0][1]);this.bbox={ll:{x:l.x,y:l.y},ur:{x:l.x,y:l.y}};for(var p=l,m=1,c=e.length;mthis.bbox.ur.x&&(this.bbox.ur.x=S.x),S.y>this.bbox.ur.y&&(this.bbox.ur.y=S.y),p=S)}(l.x!==p.x||l.y!==p.y)&&this.segments.push(gf.fromRing(p,l,this))}return to(t,[{key:"getSweepEvents",value:function(){for(var e=[],r=0,s=this.segments.length;rthis.bbox.ur.x&&(this.bbox.ur.x=p.bbox.ur.x),p.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=p.bbox.ur.y),this.interiorRings.push(p)}this.multiPoly=r}return to(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),r=0,s=this.interiorRings.length;rthis.bbox.ur.x&&(this.bbox.ur.x=p.bbox.ur.x),p.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=p.bbox.ur.y),this.polys.push(p)}this.isSubject=r}return to(t,[{key:"getSweepEvents",value:function(){for(var e=[],r=0,s=this.polys.length;r0&&(e=l)}for(var p=e.segment.prevInResult(),m=p?p.prevInResult():null;;){if(!p)return null;if(!m)return p.ringOut;if(m.ringOut!==p.ringOut)return m.ringOut.enclosingRing()!==p.ringOut?p.ringOut:p.ringOut.enclosingRing();p=m.prevInResult(),m=p?p.prevInResult():null}}}]),t}(),Ry=function(){function t(e){gs(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return to(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var r=0,s=this.interiorRings.length;r1&&arguments[1]!==void 0?arguments[1]:gf.compare;gs(this,t),this.queue=e,this.tree=new gg(r),this.segments=[]}return to(t,[{key:"process",value:function(e){var r=e.segment,s=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(r),s;var l=e.isLeft?this.tree.insert(r):this.tree.find(r);if(!l)throw new Error("Unable to find segment #".concat(r.id," ")+"[".concat(r.leftSE.point.x,", ").concat(r.leftSE.point.y,"] -> ")+"[".concat(r.rightSE.point.x,", ").concat(r.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var p=l,m=l,c=void 0,S=void 0;c===void 0;)p=this.tree.prev(p),p===null?c=null:p.key.consumedBy===void 0&&(c=p.key);for(;S===void 0;)m=this.tree.next(m),m===null?S=null:m.key.consumedBy===void 0&&(S=m.key);if(e.isLeft){var L=null;if(c){var R=c.getIntersection(r);if(R!==null&&(r.isAnEndpoint(R)||(L=R),!c.isAnEndpoint(R)))for(var k=this._splitSafely(c,R),U=0,ct=k.length;U0?(this.tree.remove(r),s.push(e)):(this.segments.push(r),r.prev=c)}else{if(c&&S){var Pe=c.getIntersection(S);if(Pe!==null){if(!c.isAnEndpoint(Pe))for(var me=this._splitSafely(c,Pe),ve=0,Nt=me.length;veNy)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var re=new lw(dt),pe=dt.size,Be=dt.pop();Be;){var ue=Be.key;if(dt.size===pe){var Pe=ue.segment;throw new Error("Unable to pop() ".concat(ue.isLeft?"left":"right"," SweepEvent ")+"[".concat(ue.point.x,", ").concat(ue.point.y,"] from segment #").concat(Pe.id," ")+"[".concat(Pe.leftSE.point.x,", ").concat(Pe.leftSE.point.y,"] -> ")+"[".concat(Pe.rightSE.point.x,", ").concat(Pe.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(dt.size>Ny)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(re.segments.length>uw)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var me=re.process(ue),ve=0,Nt=me.length;ver[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]e.x?1:this.ye.y?1:0};ht.prototype.clone=function(){};ht.prototype.copy=function(){return new ht(this)};ht.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};ht.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,s=this.z-t.z;return Math.sqrt(e*e+r*r+s*s)};ht.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)};ht.prototype.hashCode=function(){var t=17;return t=37*t+ht.hashCode(this.x),t=37*t+ht.hashCode(this.y),t};ht.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};ht.prototype.interfaces_=function(){return[xo,Ef,bo]};ht.prototype.getClass=function(){return ht};ht.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=ye.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};Tu.DimensionalComparator.get=function(){return Ma};Tu.serialVersionUID.get=function(){return 6683108902428367e3};Tu.NULL_ORDINATE.get=function(){return ye.NaN};Tu.X.get=function(){return 0};Tu.Y.get=function(){return 1};Tu.Z.get=function(){return 2};Object.defineProperties(ht,Tu);var Ma=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new Dn("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};Ma.prototype.compare=function(t,e){var r=t,s=e,l=Ma.compare(r.x,s.x);if(l!==0)return l;var p=Ma.compare(r.y,s.y);if(p!==0)return p;if(this._dimensionsToTest<=2)return 0;var m=Ma.compare(r.z,s.z);return m};Ma.prototype.interfaces_=function(){return[qc]};Ma.prototype.getClass=function(){return Ma};Ma.compare=function(t,e){return te?1:ye.isNaN(t)?ye.isNaN(e)?0:-1:ye.isNaN(e)?1:0};var Gc=function(){};Gc.prototype.create=function(){};Gc.prototype.interfaces_=function(){return[]};Gc.prototype.getClass=function(){return Gc};var ft=function(){},Hp={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};ft.prototype.interfaces_=function(){return[]};ft.prototype.getClass=function(){return ft};ft.toLocationSymbol=function(t){switch(t){case ft.EXTERIOR:return"e";case ft.BOUNDARY:return"b";case ft.INTERIOR:return"i";case ft.NONE:return"-"}throw new Dn("Unknown location value: "+t)};Hp.INTERIOR.get=function(){return 0};Hp.BOUNDARY.get=function(){return 1};Hp.EXTERIOR.get=function(){return 2};Hp.NONE.get=function(){return-1};Object.defineProperties(ft,Hp);var de=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},eo=function(){},N0={LOG_10:{configurable:!0}};eo.prototype.interfaces_=function(){return[]};eo.prototype.getClass=function(){return eo};eo.log10=function(t){var e=Math.log(t);return ye.isInfinite(e)||ye.isNaN(e)?e:e/eo.LOG_10};eo.min=function(t,e,r,s){var l=t;return er?r:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var s=arguments[0],l=arguments[1],p=arguments[2];return sp?p:s}};eo.wrap=function(t,e){return t<0?e- -t%e:t%e};eo.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],r=arguments[2],s=t;return e>s&&(s=e),r>s&&(s=r),s}else if(arguments.length===4){var l=arguments[0],p=arguments[1],m=arguments[2],c=arguments[3],S=l;return p>S&&(S=p),m>S&&(S=m),c>S&&(S=c),S}};eo.average=function(t,e){return(t+e)/2};N0.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(eo,N0);var _s=function(t){this.str=t};_s.prototype.append=function(t){this.str+=t};_s.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};_s.prototype.toString=function(t){return this.str};var ss=function(t){this.value=t};ss.prototype.intValue=function(){return this.value};ss.prototype.compareTo=function(t){return this.valuet?1:0};ss.isNaN=function(t){return Number.isNaN(t)};var Ap=function(){};Ap.isWhitespace=function(t){return t<=32&&t>=0||t===127};Ap.toUpperCase=function(t){return t.toUpperCase()};var vt=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else if(typeof arguments[0]=="string"){var s=arguments[0];t.call(this,t.parse(s))}}else if(arguments.length===2){var l=arguments[0],p=arguments[1];this.init(l,p)}},Go={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};vt.prototype.le=function(t){return(this._hi9?(R=!0,k="9"):k="0"+L,m.append(k),r=r.subtract(vt.valueOf(L)).multiply(vt.TEN),R&&r.selfAdd(vt.TEN);var U=!0,ct=vt.magnitude(r._hi);if(ct<0&&Math.abs(ct)>=c-S&&(U=!1),!U)break}return e[0]=s,m.toString()};vt.prototype.sqr=function(){return this.multiply(this)};vt.prototype.doubleValue=function(){return this._hi+this._lo};vt.prototype.subtract=function(){if(arguments[0]instanceof vt){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};vt.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};vt.prototype.isZero=function(){return this._hi===0&&this._lo===0};vt.prototype.selfSubtract=function(){if(arguments[0]instanceof vt){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}};vt.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};vt.prototype.min=function(t){return this.le(t)?this:t};vt.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof vt){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1],l=null,p=null,m=null,c=null,S=null,L=null,R=null,k=null;return S=this._hi/r,L=vt.SPLIT*S,l=L-S,k=vt.SPLIT*r,l=L-l,p=S-l,m=k-r,R=S*r,m=k-m,c=r-m,k=l*m-R+l*c+p*m+p*c,L=(this._hi-R-k+this._lo-S*s)/r,k=S+L,this._hi=k,this._lo=S-k+L,this}};vt.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};vt.prototype.divide=function(){if(arguments[0]instanceof vt){var t=arguments[0],e=null,r=null,s=null,l=null,p=null,m=null,c=null,S=null;p=this._hi/t._hi,m=vt.SPLIT*p,e=m-p,S=vt.SPLIT*t._hi,e=m-e,r=p-e,s=S-t._hi,c=p*t._hi,s=S-s,l=t._hi-s,S=e*s-c+e*l+r*s+r*l,m=(this._hi-c-S+this._lo-p*t._lo)/t._hi,S=p+m;var L=S,R=p-S+m;return new vt(L,R)}else if(typeof arguments[0]=="number"){var k=arguments[0];return ye.isNaN(k)?vt.createNaN():vt.copy(this).selfDivide(k,0)}};vt.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};vt.prototype.pow=function(t){if(t===0)return vt.valueOf(1);var e=new vt(this),r=vt.valueOf(1),s=Math.abs(t);if(s>1)for(;s>0;)s%2===1&&r.selfMultiply(e),s/=2,s>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r};vt.prototype.ceil=function(){if(this.isNaN())return vt.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new vt(t,e)};vt.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};vt.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};vt.prototype.setValue=function(){if(arguments[0]instanceof vt){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};vt.prototype.max=function(t){return this.ge(t)?this:t};vt.prototype.sqrt=function(){if(this.isZero())return vt.valueOf(0);if(this.isNegative())return vt.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=vt.valueOf(e),s=this.subtract(r.sqr()),l=s._hi*(t*.5);return r.add(l)};vt.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof vt){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],r=null,s=null,l=null,p=null,m=null,c=null;return l=this._hi+e,m=l-this._hi,p=l-m,p=e-m+(this._hi-p),c=p+this._lo,r=l+c,s=c+(l-r),this._hi=r+s,this._lo=s+(r-this._hi),this}}else if(arguments.length===2){var S=arguments[0],L=arguments[1],R=null,k=null,U=null,ct=null,dt=null,bt=null,It=null,Dt=null;dt=this._hi+S,U=this._lo+L,It=dt-this._hi,Dt=U-this._lo,bt=dt-It,ct=U-Dt,bt=S-It+(this._hi-bt),ct=L-Dt+(this._lo-ct),It=bt+U,R=dt+It,k=It+(dt-R),It=ct+k;var Rt=R+It,Gt=It+(R-Rt);return this._hi=Rt,this._lo=Gt,this}};vt.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof vt){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1],l=null,p=null,m=null,c=null,S=null,L=null;S=vt.SPLIT*this._hi,l=S-this._hi,L=vt.SPLIT*r,l=S-l,p=this._hi-l,m=L-r,S=this._hi*r,m=L-m,c=r-m,L=l*m-S+l*c+p*m+p*c+(this._hi*s+this._lo*r);var R=S+L;l=S-R;var k=L+l;return this._hi=R,this._lo=k,this}};vt.prototype.selfSqr=function(){return this.selfMultiply(this)};vt.prototype.floor=function(){if(this.isNaN())return vt.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new vt(t,e)};vt.prototype.negate=function(){return this.isNaN()?this:new vt(-this._hi,-this._lo)};vt.prototype.clone=function(){};vt.prototype.multiply=function(){if(arguments[0]instanceof vt){var t=arguments[0];return t.isNaN()?vt.createNaN():vt.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return ye.isNaN(e)?vt.createNaN():vt.copy(this).selfMultiply(e,0)}};vt.prototype.isNaN=function(){return ye.isNaN(this._hi)};vt.prototype.intValue=function(){return Math.trunc(this._hi)};vt.prototype.toString=function(){var t=vt.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};vt.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),s=e[0]+1,l=r;if(r.charAt(0)===".")l="0"+r;else if(s<0)l="0."+vt.stringOfChar("0",-s)+r;else if(r.indexOf(".")===-1){var p=s-r.length,m=vt.stringOfChar("0",p);l=r+m+".0"}return this.isNegative()?"-"+l:l};vt.prototype.reciprocal=function(){var t=null,e=null,r=null,s=null,l=null,p=null,m=null,c=null;l=1/this._hi,p=vt.SPLIT*l,t=p-l,c=vt.SPLIT*this._hi,t=p-t,e=l-t,r=c-this._hi,m=l*this._hi,r=c-r,s=this._hi-r,c=t*r-m+t*s+e*r+e*s,p=(1-m-c-l*this._lo)/this._hi;var S=l+p,L=l-S+p;return new vt(S,L)};vt.prototype.toSciNotation=function(){if(this.isZero())return vt.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),s=vt.SCI_NOT_EXPONENT_CHAR+e[0];if(r.charAt(0)==="0")throw new Error("Found leading zero: "+r);var l="";r.length>1&&(l=r.substring(1));var p=r.charAt(0)+"."+l;return this.isNegative()?"-"+p+s:p+s};vt.prototype.abs=function(){return this.isNaN()?vt.NaN:this.isNegative()?this.negate():new vt(this)};vt.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};vt.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};vt.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};vt.prototype.trunc=function(){return this.isNaN()?vt.NaN:this.isPositive()?this.floor():this.ceil()};vt.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};vt.prototype.interfaces_=function(){return[bo,xo,Ef]};vt.prototype.getClass=function(){return vt};vt.sqr=function(t){return vt.valueOf(t).selfMultiply(t)};vt.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return vt.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new vt(e)}};vt.sqrt=function(t){return vt.valueOf(t).sqrt()};vt.parse=function(t){for(var e=0,r=t.length;Ap.isWhitespace(t.charAt(e));)e++;var s=!1;if(e=r);){var L=t.charAt(e);if(e++,Ap.isDigit(L)){var R=L-"0";p.selfMultiply(vt.TEN),p.selfAdd(R),m++;continue}if(L==="."){c=m;continue}if(L==="e"||L==="E"){var k=t.substring(e);try{S=ss.parseInt(k)}catch(It){throw It instanceof Error?new Error("Invalid exponent "+k+" in string "+t):It}finally{}break}throw new Error("Unexpected character '"+L+"' at position "+e+" in string "+t)}var U=p,ct=m-c-S;if(ct===0)U=p;else if(ct>0){var dt=vt.TEN.pow(ct);U=p.divide(dt)}else if(ct<0){var bt=vt.TEN.pow(-ct);U=p.multiply(bt)}return s?U.negate():U};vt.createNaN=function(){return new vt(ye.NaN,ye.NaN)};vt.copy=function(t){return new vt(t)};vt.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),s=Math.trunc(Math.floor(r)),l=Math.pow(10,s);return l*10<=e&&(s+=1),s};vt.stringOfChar=function(t,e){for(var r=new _s,s=0;s0){if(p<=0)return xr.signum(m);s=l+p}else if(l<0){if(p>=0)return xr.signum(m);s=-l-p}else return xr.signum(m);var c=xr.DP_SAFE_EPSILON*s;return m>=c||-m>=c?xr.signum(m):2};xr.signum=function(t){return t>0?1:t<0?-1:0};k0.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(xr,k0);var Ze=function(){},Wp={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Wp.X.get=function(){return 0};Wp.Y.get=function(){return 1};Wp.Z.get=function(){return 2};Wp.M.get=function(){return 3};Ze.prototype.setOrdinate=function(t,e,r){};Ze.prototype.size=function(){};Ze.prototype.getOrdinate=function(t,e){};Ze.prototype.getCoordinate=function(){};Ze.prototype.getCoordinateCopy=function(t){};Ze.prototype.getDimension=function(){};Ze.prototype.getX=function(t){};Ze.prototype.clone=function(){};Ze.prototype.expandEnvelope=function(t){};Ze.prototype.copy=function(){};Ze.prototype.getY=function(t){};Ze.prototype.toCoordinateArray=function(){};Ze.prototype.interfaces_=function(){return[Ef]};Ze.prototype.getClass=function(){return Ze};Object.defineProperties(Ze,Wp);var z0=function(){},lh=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(z0),Bi=function(){};Bi.arraycopy=function(t,e,r,s,l){for(var p=0,m=e;mt._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,s=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];return this.isNull()?!1:r>=this._minx&&r<=this._maxx&&s>=this._miny&&s<=this._maxy}};ne.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof ne){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||rthis._maxy||sthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=s,this._maxy=s):(rthis._maxx&&(this._maxx=r),sthis._maxy&&(this._maxy=s))}};ne.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0};ne.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};ne.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};ne.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};ne.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};ne.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};ne.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};ne.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof ne){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof ht){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];return this.covers(r,s)}};ne.prototype.centre=function(){return this.isNull()?null:new ht((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};ne.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof ht){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof ne){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.init(r.x,s.x,r.y,s.y)}else if(arguments.length===4){var l=arguments[0],p=arguments[1],m=arguments[2],c=arguments[3];lt._maxx&&(e=this._minx-t._maxx);var r=0;return this._maxyt._maxy&&(r=this._miny-t._maxy),e===0?r:r===0?e:Math.sqrt(e*e+r*r)};ne.prototype.hashCode=function(){var t=17;return t=37*t+ht.hashCode(this._minx),t=37*t+ht.hashCode(this._maxx),t=37*t+ht.hashCode(this._miny),t=37*t+ht.hashCode(this._maxy),t};ne.prototype.interfaces_=function(){return[xo,bo]};ne.prototype.getClass=function(){return ne};ne.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.xe.x?t.x:e.x)&&r.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var s=arguments[0],l=arguments[1],p=arguments[2],m=arguments[3],c=Math.min(p.x,m.x),S=Math.max(p.x,m.x),L=Math.min(s.x,l.x),R=Math.max(s.x,l.x);return!(L>S||RS)||Rr?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};Fn.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};Fn.prototype.setPrecisionModel=function(t){this._precisionModel=t};Fn.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],r=0;rl?p=s:p=l;else{var m=Math.abs(t.x-e.x),c=Math.abs(t.y-e.y);s>l?p=m:p=c,p===0&&!t.equals(e)&&(p=Math.max(m,c))}return Se.isTrue(!(p===0&&!t.equals(e)),"Bad distance calculation"),p};Fn.nonRobustComputeEdgeDistance=function(t,e,r){var s=t.x-e.x,l=t.y-e.y,p=Math.sqrt(s*s+l*l);return Se.isTrue(!(p===0&&!t.equals(e)),"Invalid distance calculation"),p};Lu.DONT_INTERSECT.get=function(){return 0};Lu.DO_INTERSECT.get=function(){return 1};Lu.COLLINEAR.get=function(){return 2};Lu.NO_INTERSECTION.get=function(){return 0};Lu.POINT_INTERSECTION.get=function(){return 1};Lu.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(Fn,Lu);var Al=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(r){var s=new ne(this._inputLines[0][0],this._inputLines[0][1]),l=new ne(this._inputLines[1][0],this._inputLines[1][1]);return s.contains(r)&&l.contains(r)},e.prototype.computeIntersection=function(){if(arguments.length===3){var r=arguments[0],s=arguments[1],l=arguments[2];if(this._isProper=!1,ne.intersects(s,l,r)&&Yt.orientationIndex(s,l,r)===0&&Yt.orientationIndex(l,s,r)===0)return this._isProper=!0,(r.equals(s)||r.equals(l))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(r,s,l,p,m){m.x=this.smallestInAbsValue(r.x,s.x,l.x,p.x),m.y=this.smallestInAbsValue(r.y,s.y,l.y,p.y),r.x-=m.x,r.y-=m.y,s.x-=m.x,s.y-=m.y,l.x-=m.x,l.y-=m.y,p.x-=m.x,p.y-=m.y},e.prototype.safeHCoordinateIntersection=function(r,s,l,p){var m=null;try{m=No.intersection(r,s,l,p)}catch(c){if(c instanceof lh)m=e.nearestEndpoint(r,s,l,p);else throw c}finally{}return m},e.prototype.intersection=function(r,s,l,p){var m=this.intersectionWithNormalization(r,s,l,p);return this.isInSegmentEnvelopes(m)||(m=new ht(e.nearestEndpoint(r,s,l,p))),this._precisionModel!==null&&this._precisionModel.makePrecise(m),m},e.prototype.smallestInAbsValue=function(r,s,l,p){var m=r,c=Math.abs(m);return Math.abs(s)1e-4&&Bi.out.println("Distance = "+m.distance(c))},e.prototype.intersectionWithNormalization=function(r,s,l,p){var m=new ht(r),c=new ht(s),S=new ht(l),L=new ht(p),R=new ht;this.normalizeToEnvCentre(m,c,S,L,R);var k=this.safeHCoordinateIntersection(m,c,S,L);return k.x+=R.x,k.y+=R.y,k},e.prototype.computeCollinearIntersection=function(r,s,l,p){var m=ne.intersects(r,s,l),c=ne.intersects(r,s,p),S=ne.intersects(l,p,r),L=ne.intersects(l,p,s);return m&&c?(this._intPt[0]=l,this._intPt[1]=p,t.COLLINEAR_INTERSECTION):S&&L?(this._intPt[0]=r,this._intPt[1]=s,t.COLLINEAR_INTERSECTION):m&&S?(this._intPt[0]=l,this._intPt[1]=r,l.equals(r)&&!c&&!L?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):m&&L?(this._intPt[0]=l,this._intPt[1]=s,l.equals(s)&&!c&&!S?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&S?(this._intPt[0]=p,this._intPt[1]=r,p.equals(r)&&!m&&!L?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&L?(this._intPt[0]=p,this._intPt[1]=s,p.equals(s)&&!m&&!S?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(r,s,l,p,m){var c=r.xs.x?r.x:s.x,R=r.y>s.y?r.y:s.y,k=l.xp.x?l.x:p.x,dt=l.y>p.y?l.y:p.y,bt=c>k?c:k,It=LU?S:U,Rt=R0&&c>0||m<0&&c<0)return t.NO_INTERSECTION;var S=Yt.orientationIndex(l,p,r),L=Yt.orientationIndex(l,p,s);if(S>0&&L>0||S<0&&L<0)return t.NO_INTERSECTION;var R=m===0&&c===0&&S===0&&L===0;return R?this.computeCollinearIntersection(r,s,l,p):(m===0||c===0||S===0||L===0?(this._isProper=!1,r.equals2D(l)||r.equals2D(p)?this._intPt[0]=r:s.equals2D(l)||s.equals2D(p)?this._intPt[0]=s:m===0?this._intPt[0]=new ht(l):c===0?this._intPt[0]=new ht(p):S===0?this._intPt[0]=new ht(r):L===0&&(this._intPt[0]=new ht(s))):(this._isProper=!0,this._intPt[0]=this.intersection(r,s,l,p)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(r,s,l,p){var m=r,c=Yt.distancePointLine(r,l,p),S=Yt.distancePointLine(s,l,p);return S0?r>0?-l:l:r>0?l:-l;if(e===0||r===0)return s>0?t>0?l:-l:t>0?-l:l;if(e>0?s>0?e<=s||(l=-l,p=t,t=r,r=p,p=e,e=s,s=p):e<=-s?(l=-l,r=-r,s=-s):(p=t,t=-r,r=p,p=e,e=-s,s=p):s>0?-e<=s?(l=-l,t=-t,e=-e):(p=-t,t=r,r=p,p=-e,e=s,s=p):e>=s?(t=-t,e=-e,r=-r,s=-s):(l=-l,p=-t,t=-r,r=p,p=-e,e=-s,s=p),t>0)if(r>0){if(!(t<=r))return l}else return l;else{if(r>0)return-l;if(t>=r)l=-l,t=-t,r=-r;else return-l}for(;;){if(m=Math.floor(r/t),r=r-m*t,s=s-m*e,s<0)return-l;if(s>e)return l;if(t>r+r){if(es+s)return-l;r=t-r,s=e-s,l=-l}if(s===0)return r===0?0:-l;if(r===0||(m=Math.floor(t/r),t=t-m*r,e=e-m*s,e<0))return l;if(e>s)return-l;if(r>t+t){if(se+e)return l;t=r-t,e=s-e,l=-l}if(e===0)return t===0?0:l;if(t===0)return-l}};var rs=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};rs.prototype.countSegment=function(t,e){if(t.xs&&(r=e.x,s=t.x),this._p.x>=r&&this._p.x<=s&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var l=t.x-this._p.x,p=t.y-this._p.y,m=e.x-this._p.x,c=e.y-this._p.y,S=mu.signOfDet2x2(l,p,m,c);if(S===0)return this._isPointOnSegment=!0,null;c0&&this._crossingCount++}};rs.prototype.isPointInPolygon=function(){return this.getLocation()!==ft.EXTERIOR};rs.prototype.getLocation=function(){return this._isPointOnSegment?ft.BOUNDARY:this._crossingCount%2===1?ft.INTERIOR:ft.EXTERIOR};rs.prototype.isOnSegment=function(){return this._isPointOnSegment};rs.prototype.interfaces_=function(){return[]};rs.prototype.getClass=function(){return rs};rs.locatePointInRing=function(){if(arguments[0]instanceof ht&&de(arguments[1],Ze)){for(var t=arguments[0],e=arguments[1],r=new rs(t),s=new ht,l=new ht,p=1;p1||S<0||S>1)&&(l=!0)}}return l?eo.min(Yt.distancePointLine(t,r,s),Yt.distancePointLine(e,r,s),Yt.distancePointLine(r,t,e),Yt.distancePointLine(s,t,e)):0};Yt.isPointInRing=function(t,e){return Yt.locatePointInRing(t,e)!==ft.EXTERIOR};Yt.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,s=new ht;t.getCoordinate(0,s);for(var l=s.x,p=s.y,m=1;mr.y&&(r=p,s=l)}var m=s;do m=m-1,m<0&&(m=e);while(t[m].equals2D(r)&&m!==s);var c=s;do c=(c+1)%e;while(t[c].equals2D(r)&&c!==s);var S=t[m],L=t[c];if(S.equals2D(r)||L.equals2D(r)||S.equals2D(L))return!1;var R=Yt.computeOrientation(S,r,L),k=!1;return R===0?k=S.x>L.x:k=R>0,k};Yt.locatePointInRing=function(t,e){return rs.locatePointInRing(t,e)};Yt.distancePointLinePerpendicular=function(t,e,r){var s=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),l=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/s;return Math.abs(l)*Math.sqrt(s)};Yt.computeOrientation=function(t,e,r){return Yt.orientationIndex(t,e,r)};Yt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new Dn("Line array must contain at least one vertex");for(var r=t.distance(e[0]),s=0;s=1)return p.distance(c);var R=((m.y-p.y)*(c.x-m.x)-(m.x-p.x)*(c.y-m.y))/S;return Math.abs(R)*Math.sqrt(S)}};Yt.isOnLine=function(t,e){for(var r=new Al,s=1;s0};Zc.prototype.interfaces_=function(){return[mo]};Zc.prototype.getClass=function(){return Zc};var Hc=function(){};Hc.prototype.isInBoundary=function(t){return t>1};Hc.prototype.interfaces_=function(){return[mo]};Hc.prototype.getClass=function(){return Hc};var Wc=function(){};Wc.prototype.isInBoundary=function(t){return t===1};Wc.prototype.interfaces_=function(){return[mo]};Wc.prototype.getClass=function(){return Wc};var hi=function(){};hi.prototype.add=function(){};hi.prototype.addAll=function(){};hi.prototype.isEmpty=function(){};hi.prototype.iterator=function(){};hi.prototype.size=function(){};hi.prototype.toArray=function(){};hi.prototype.remove=function(){};function yg(t){this.message=t||""}yg.prototype=new Error;yg.prototype.name="IndexOutOfBoundsException";var uh=function(){};uh.prototype.hasNext=function(){};uh.prototype.next=function(){};uh.prototype.remove=function(){};var ko=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(hi);function ch(t){this.message=t||""}ch.prototype=new Error;ch.prototype.name="NoSuchElementException";var qt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof hi&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,hi]},e.prototype.add=function(r){return arguments.length===1?this.array_.push(r):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(r){for(var s=this,l=r.iterator();l.hasNext();)s.add(l.next());return!0},e.prototype.set=function(r,s){var l=this.array_[r];return this.array_[r]=s,l},e.prototype.iterator=function(){return new hw(this)},e.prototype.get=function(r){if(r<0||r>=this.size())throw new yg;return this.array_[r]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var r=this,s=[],l=0,p=this.array_.length;l=1){var L=this.get(this.size()-1);if(L.equals2D(c))return null}t.prototype.add.call(this,c)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var R=arguments[0],k=arguments[1];return this.add(R,k),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var U=arguments[0],ct=arguments[1],dt=arguments[2];if(dt)for(var bt=0;bt=0;It--)s.add(U[It],ct);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof ht){var Dt=arguments[0],Rt=arguments[1],Gt=arguments[2];if(!Gt){var re=this.size();if(re>0){if(Dt>0){var pe=this.get(Dt-1);if(pe.equals2D(Rt))return null}if(Dtve&&(Nt=-1);for(var sn=me;sn!==ve;sn+=Nt)s.add(ue[sn],Pe);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new ht(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(qt),ke=function(){},Cf={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Cf.ForwardComparator.get=function(){return Mp};Cf.BidirectionalComparator.get=function(){return Xc};Cf.coordArrayType.get=function(){return new Array(0).fill(null)};ke.prototype.interfaces_=function(){return[]};ke.prototype.getClass=function(){return ke};ke.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};ke.ptNotInList=function(t,e){for(var r=0;r=t?e:[]};ke.indexOf=function(t,e){for(var r=0;r0)&&(e=t[r]);return e};ke.extract=function(t,e,r){e=eo.clamp(e,0,t.length),r=eo.clamp(r,-1,t.length);var s=r-e+1;r<0&&(s=0),e>=t.length&&(s=0),rs.length)return 1;if(r.length===0)return 0;var l=ke.compare(r,s),p=ke.isEqualReversed(r,s);return p?0:l};Xc.prototype.OLDcompare=function(t,e){var r=t,s=e;if(r.lengths.length)return 1;if(r.length===0)return 0;for(var l=ke.increasingDirection(r),p=ke.increasingDirection(s),m=l>0?0:r.length-1,c=p>0?0:r.length-1,S=0;S0)e=e.right;else return e.value}return null};Xi.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:ia,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r=this.root_,s,l;do if(s=r,l=t.compareTo(r.key),l<0)r=r.left;else if(l>0)r=r.right;else{var p=r.value;return r.value=e,p}while(r!==null);var m={key:t,left:null,right:null,value:e,parent:s,color:ia,getValue:function(){return this.value},getKey:function(){return this.key}};return l<0?s.left=m:s.right=m,this.fixAfterInsertion(m),this.size_++,null};Xi.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=dl;t!=null&&t!==this.root_&&t.parent.color===dl;)if(yn(t)===Ym(yn(yn(t)))){var r=Oy(yn(yn(t)));zy(r)===dl?(ta(yn(t),ia),ta(r,ia),ta(yn(yn(t)),dl),t=yn(yn(t))):(t===Oy(yn(t))&&(t=yn(t),e.rotateLeft(t)),ta(yn(t),ia),ta(yn(yn(t)),dl),e.rotateRight(yn(yn(t))))}else{var s=Ym(yn(yn(t)));zy(s)===dl?(ta(yn(t),ia),ta(s,ia),ta(yn(yn(t)),dl),t=yn(yn(t))):(t===Ym(yn(t))&&(t=yn(t),e.rotateRight(t)),ta(yn(t),ia),ta(yn(yn(t)),dl),e.rotateLeft(yn(yn(t))))}this.root_.color=ia};Xi.prototype.values=function(){var t=new qt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=Xi.successor(e))!==null;)t.add(e.value);return t};Xi.prototype.entrySet=function(){var t=new vg,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=Xi.successor(e))!==null;)t.add(e);return t};Xi.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};Xi.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};Xi.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};Xi.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var r=t.parent,s=t;r!==null&&s===r.right;)s=r,r=r.parent;return r}};Xi.prototype.size=function(){return this.size_};var Dp=function(){};Dp.prototype.interfaces_=function(){return[]};Dp.prototype.getClass=function(){return Dp};function F0(){}F0.prototype=new Tf;function as(){this.array_=[],arguments[0]instanceof hi&&this.addAll(arguments[0])}as.prototype=new F0;as.prototype.contains=function(t){for(var e=this,r=0,s=this.array_.length;r=0;){var m=l.substring(0,p);s.add(m),l=l.substring(p+r),p=l.indexOf(e)}l.length>0&&s.add(l);for(var c=new Array(s.size()).fill(null),S=0;S0)for(var p=l;p0&&s.append(" ");for(var p=0;p0&&s.append(","),s.append(po.toString(t.getOrdinate(l,p)))}return s.append(")"),s.toString()}};ti.ensureValidRing=function(t,e){var r=e.size();if(r===0)return e;if(r<=3)return ti.createClosedRing(t,e,4);var s=e.getOrdinate(0,Ze.X)===e.getOrdinate(r-1,Ze.X)&&e.getOrdinate(0,Ze.Y)===e.getOrdinate(r-1,Ze.Y);return s?e:ti.createClosedRing(t,e,r+1)};ti.createClosedRing=function(t,e,r){var s=t.create(r,e.getDimension()),l=e.size();ti.copy(e,0,s,0,l);for(var p=l;p0&&ti.reverse(s._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Xe.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return Yt.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var s=this._points.copy();ti.reverse(s);var l=this.getFactory().createLineString(s);return l},e.prototype.compareToSameClass=function(){var s=this;if(arguments.length===1){for(var l=arguments[0],p=l,m=0,c=0;m= 2)");this._points=s},e.prototype.isCoordinate=function(s){for(var l=this,p=0;p=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(Zn),Ps=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return he.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.isEquivalentClass(s)?t.prototype.equalsExact.call(this,s,l):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var s=this,l=this._geometries.length,p=new Array(l).fill(null),m=0;m0?e.createPoint(r[0]):e.createPoint():t};kp.prototype.interfaces_=function(){return[go.GeometryEditorOperation]};kp.prototype.getClass=function(){return kp};var zp=function(){};zp.prototype.edit=function(t,e){return t instanceof Ds?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Zn?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof zr?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};zp.prototype.interfaces_=function(){return[go.GeometryEditorOperation]};zp.prototype.getClass=function(){return zp};var Qn=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var r=0;r0){var e=new _s(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var r=1;r3&&(s=3),s<2?new Qn(r):new Qn(r,s)}};Rs.prototype.interfaces_=function(){return[Gc,bo]};Rs.prototype.getClass=function(){return Rs};Rs.instance=function(){return Rs.instanceObject};bg.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};bg.instanceObject.get=function(){return new Rs};Object.defineProperties(Rs,bg);var V0=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(r){return this.map_.get(r)||null},e.prototype.put=function(r,s){return this.map_.set(r,s),s},e.prototype.values=function(){for(var r=new qt,s=this.map_.values(),l=s.next();!l.done;)r.add(l.value),l=s.next();return r},e.prototype.entrySet=function(){var r=new vg;return this.map_.entries().forEach(function(s){return r.add(s)}),r},e.prototype.size=function(){return this.map_.size()},e}(Au),Qe=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof us){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var s=arguments[0];this._modelType=s._modelType,this._scale=s._scale}}},wg={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Qe.prototype.equals=function(t){if(!(t instanceof Qe))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};Qe.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),s=e.getMaximumSignificantDigits();return new ss(r).compareTo(new ss(s))};Qe.prototype.getScale=function(){return this._scale};Qe.prototype.isFloating=function(){return this._modelType===Qe.FLOATING||this._modelType===Qe.FLOATING_SINGLE};Qe.prototype.getType=function(){return this._modelType};Qe.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Qe.FLOATING?t="Floating":this._modelType===Qe.FLOATING_SINGLE?t="Floating-Single":this._modelType===Qe.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};Qe.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(ye.isNaN(t))return t;if(this._modelType===Qe.FLOATING_SINGLE){var e=t;return e}return this._modelType===Qe.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof ht){var r=arguments[0];if(this._modelType===Qe.FLOATING)return null;r.x=this.makePrecise(r.x),r.y=this.makePrecise(r.y)}};Qe.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Qe.FLOATING?t=16:this._modelType===Qe.FLOATING_SINGLE?t=6:this._modelType===Qe.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};Qe.prototype.setScale=function(t){this._scale=Math.abs(t)};Qe.prototype.interfaces_=function(){return[bo,xo]};Qe.prototype.getClass=function(){return Qe};Qe.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};wg.serialVersionUID.get=function(){return 7777263578777804e3};wg.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Qe,wg);var us=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Ig={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};us.prototype.readResolve=function(){return us.nameToTypeMap.get(this._name)};us.prototype.toString=function(){return this._name};us.prototype.interfaces_=function(){return[bo]};us.prototype.getClass=function(){return us};Ig.serialVersionUID.get=function(){return-552860263173159e4};Ig.nameToTypeMap.get=function(){return new V0};Object.defineProperties(us,Ig);Qe.Type=us;Qe.FIXED=new us("FIXED");Qe.FLOATING=new us("FLOATING");Qe.FLOATING_SINGLE=new us("FLOATING SINGLE");var Fe=function t(){this._precisionModel=new Qe,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?de(arguments[0],Gc)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Qe&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},U0={serialVersionUID:{configurable:!0}};Fe.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new ht(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new ht(t.getMinX(),t.getMinY()),new ht(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new ht(t.getMinX(),t.getMinY()),new ht(t.getMinX(),t.getMaxY()),new ht(t.getMaxX(),t.getMaxY()),new ht(t.getMaxX(),t.getMinY()),new ht(t.getMinX(),t.getMinY())]),null)};Fe.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Zn(this.getCoordinateSequenceFactory().create(t),this);if(de(t,Ze))return new Zn(t,this)}else return new Zn(this.getCoordinateSequenceFactory().create([]),this)};Fe.prototype.createMultiLineString=function(){if(arguments.length===0)return new bl(null,this);if(arguments.length===1){var t=arguments[0];return new bl(t,this)}};Fe.prototype.buildGeometry=function(t){for(var e=null,r=!1,s=!1,l=t.iterator();l.hasNext();){var p=l.next(),m=p.getClass();e===null&&(e=m),m!==e&&(r=!0),p.isGeometryCollectionOrDerived()&&(s=!0)}if(e===null)return this.createGeometryCollection();if(r||s)return this.createGeometryCollection(Fe.toGeometryArray(t));var c=t.iterator().next(),S=t.size()>1;if(S){if(c instanceof di)return this.createMultiPolygon(Fe.toPolygonArray(t));if(c instanceof Zn)return this.createMultiLineString(Fe.toLineStringArray(t));if(c instanceof zr)return this.createMultiPoint(Fe.toPointArray(t));Se.shouldNeverReachHere("Unhandled class: "+c.getClass().getName())}return c};Fe.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};Fe.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof ht){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(de(arguments[0],Ze)){var e=arguments[0];return new zr(e,this)}}};Fe.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};Fe.prototype.createPolygon=function(){if(arguments.length===0)return new di(null,null,this);if(arguments.length===1){if(de(arguments[0],Ze)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Ds){var r=arguments[0];return this.createPolygon(r,null)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return new di(s,l,this)}};Fe.prototype.getSRID=function(){return this._SRID};Fe.prototype.createGeometryCollection=function(){if(arguments.length===0)return new ar(null,this);if(arguments.length===1){var t=arguments[0];return new ar(t,this)}};Fe.prototype.createGeometry=function(t){var e=new go(this);return e.edit(t,{edit:function(){if(arguments.length===2){var r=arguments[0];return this._coordinateSequenceFactory.create(r)}}})};Fe.prototype.getPrecisionModel=function(){return this._precisionModel};Fe.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(de(arguments[0],Ze)){var e=arguments[0];return new Ds(e,this)}}};Fe.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Ps(null,this);if(arguments.length===1){var t=arguments[0];return new Ps(t,this)}};Fe.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Yc(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Yc(e,this)}else if(arguments[0]instanceof Array){var r=arguments[0];return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)}else if(de(arguments[0],Ze)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var l=new Array(s.size()).fill(null),p=0;p=this.size())throw new Error;return this.array_[t]};ys.prototype.push=function(t){return this.array_.push(t),t};ys.prototype.pop=function(t){if(this.array_.length===0)throw new Mf;return this.array_.pop()};ys.prototype.peek=function(){if(this.array_.length===0)throw new Mf;return this.array_[this.array_.length-1]};ys.prototype.empty=function(){return this.array_.length===0};ys.prototype.isEmpty=function(){return this.empty()};ys.prototype.search=function(t){return this.array_.indexOf(t)};ys.prototype.size=function(){return this.array_.length};ys.prototype.toArray=function(){for(var t=this,e=[],r=0,s=this.array_.length;r0&&this._minIndexthis._minCoord.y&&r.y>this._minCoord.y&&s===Yt.CLOCKWISE)&&(l=!0),l&&(this._minIndex=this._minIndex-1)};cs.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge(),s=r.getCoordinates();if(e<0||e+1>=s.length||s[e].y===s[e+1].y)return-1;var l=kt.LEFT;return s[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=s,e._minCoord=r[s])};cs.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};cs.prototype.findEdge=function(t){for(var e=this,r=t.iterator();r.hasNext();){var s=r.next();s.isForward()&&e.checkForRightmostCoordinate(s)}Se.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var l=this.getRightmostSide(this._minDe,this._minIndex);l===kt.LEFT&&(this._orientedDe=this._minDe.getSym())};cs.prototype.interfaces_=function(){return[]};cs.prototype.getClass=function(){return cs};var la=function(t){function e(r,s){t.call(this,e.msgWithCoord(r,s)),this.pt=s?new ht(s):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(r,s){return s?r:r+" [ "+s+" ]"},e}(sa),Df=function(){this.array_=[]};Df.prototype.addLast=function(t){this.array_.push(t)};Df.prototype.removeFirst=function(){return this.array_.shift()};Df.prototype.isEmpty=function(){return this.array_.length===0};var lr=function(){this._finder=null,this._dirEdgeList=new qt,this._nodes=new qt,this._rightMostCoord=null,this._env=null,this._finder=new cs};lr.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};lr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};lr.prototype.computeNodeDepth=function(t){for(var e=this,r=null,s=t.getEdges().iterator();s.hasNext();){var l=s.next();if(l.isVisited()||l.getSym().isVisited()){r=l;break}}if(r===null)throw new la("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(r);for(var p=t.getEdges().iterator();p.hasNext();){var m=p.next();m.setVisited(!0),e.copySymDepths(m)}};lr.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(kt.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};lr.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};lr.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(kt.RIGHT)>=1&&e.getDepth(kt.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};lr.prototype.computeDepths=function(t){var e=this,r=new vg,s=new Df,l=t.getNode();for(s.addLast(l),r.add(l),t.setVisited(!0);!s.isEmpty();){var p=s.removeFirst();r.add(p),e.computeNodeDepth(p);for(var m=p.getEdges().iterator();m.hasNext();){var c=m.next(),S=c.getSym();if(!S.isVisited()){var L=S.getNode();r.contains(L)||(s.addLast(L),r.add(L))}}}};lr.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};lr.prototype.getEnvelope=function(){if(this._env===null){for(var t=new ne,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next(),s=r.getEdge().getCoordinates(),l=0;lthis.location.length){var r=new Array(3).fill(null);r[kt.ON]=this.location[kt.ON],r[kt.LEFT]=ft.NONE,r[kt.RIGHT]=ft.NONE,this.location=r}for(var s=0;s1&&t.append(ft.toLocationSymbol(this.location[kt.LEFT])),t.append(ft.toLocationSymbol(this.location[kt.ON])),this.location.length>1&&t.append(ft.toLocationSymbol(this.location[kt.RIGHT])),t.toString()};vn.prototype.setLocations=function(t,e,r){this.location[kt.ON]=t,this.location[kt.LEFT]=e,this.location[kt.RIGHT]=r};vn.prototype.get=function(t){return t1};vn.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=s),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};si.prototype.addPoints=function(t,e,r){var s=this,l=t.getCoordinates();if(e){var p=1;r&&(p=0);for(var m=p;m=0;S--)s._pts.add(l[S])}};si.prototype.isHole=function(){return this._isHole};si.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};si.prototype.containsPoint=function(t){var e=this.getLinearRing(),r=e.getEnvelopeInternal();if(!r.contains(t)||!Yt.isPointInRing(t,e.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();){var l=s.next();if(l.containsPoint(t))return!1}return!0};si.prototype.addHole=function(t){this._holes.add(t)};si.prototype.isShell=function(){return this._shell===null};si.prototype.getLabel=function(){return this._label};si.prototype.getEdges=function(){return this._edges};si.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};si.prototype.getShell=function(){return this._shell};si.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],r=arguments[1],s=e.getLocation(r,kt.RIGHT);if(s===ft.NONE)return null;if(this._label.getLocation(r)===ft.NONE)return this._label.setLocation(r,s),null}};si.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};si.prototype.toPolygon=function(t){for(var e=this,r=new Array(this._holes.size()).fill(null),s=0;s=2,"found partial label"),this.computeIM(t)};no.prototype.isInResult=function(){return this._isInResult};no.prototype.isVisited=function(){return this._isVisited};no.prototype.interfaces_=function(){return[]};no.prototype.getClass=function(){return no};var Rf=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var r=arguments[0],s=arguments[1];this._coord=r,this._edges=s,this._label=new tn(0,ft.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var r=this.getEdges().getEdges().iterator();r.hasNext();){var s=r.next();if(s.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(r){r.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(r){},e.prototype.computeMergedLocation=function(r,s){var l=ft.NONE;if(l=this._label.getLocation(s),!r.isNull(s)){var p=r.getLocation(s);l!==ft.BOUNDARY&&(l=p)}return l},e.prototype.setLabel=function(){if(arguments.length===2){var r=arguments[0],s=arguments[1];this._label===null?this._label=new tn(r,s):this._label.setLocation(r,s)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var r=this;if(arguments[0]instanceof e){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof tn)for(var l=arguments[0],p=0;p<2;p++){var m=r.computeMergedLocation(l,p),c=r._label.getLocation(p);c===ft.NONE&&r._label.setLocation(p,m)}},e.prototype.add=function(r){this._edges.insert(r),r.setNode(this)},e.prototype.setLabelBoundary=function(r){if(this._label===null)return null;var s=ft.NONE;this._label!==null&&(s=this._label.getLocation(r));var l=null;switch(s){case ft.BOUNDARY:l=ft.INTERIOR;break;case ft.INTERIOR:l=ft.BOUNDARY;break;default:l=ft.BOUNDARY;break}this._label.setLocation(r,l)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(no),hs=function(){this.nodeMap=new Xi,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};hs.prototype.find=function(t){return this.nodeMap.get(t)};hs.prototype.addNode=function(){if(arguments[0]instanceof ht){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof Rf){var r=arguments[0],s=this.nodeMap.get(r.getCoordinate());return s===null?(this.nodeMap.put(r.getCoordinate(),r),r):(s.mergeLabel(r),s)}};hs.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next();r.print(t)}};hs.prototype.iterator=function(){return this.nodeMap.values().iterator()};hs.prototype.values=function(){return this.nodeMap.values()};hs.prototype.getBoundaryNodes=function(t){for(var e=new qt,r=this.iterator();r.hasNext();){var s=r.next();s.getLabel().getLocation(t)===ft.BOUNDARY&&e.add(s)}return e};hs.prototype.add=function(t){var e=t.getCoordinate(),r=this.addNode(e);r.add(t)};hs.prototype.interfaces_=function(){return[]};hs.prototype.getClass=function(){return hs};var cn=function(){},Kp={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};cn.prototype.interfaces_=function(){return[]};cn.prototype.getClass=function(){return cn};cn.isNorthern=function(t){return t===cn.NE||t===cn.NW};cn.isOpposite=function(t,e){if(t===e)return!1;var r=(t-e+4)%4;return r===2};cn.commonHalfPlane=function(t,e){if(t===e)return t;var r=(t-e+4)%4;if(r===2)return-1;var s=te?t:e;return s===0&&l===3?3:s};cn.isInHalfPlane=function(t,e){return e===cn.SE?t===cn.SE||t===cn.SW:t===e||t===e+1};cn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new Dn("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?cn.NE:cn.SE:e>=0?cn.NW:cn.SW}else if(arguments[0]instanceof ht&&arguments[1]instanceof ht){var r=arguments[0],s=arguments[1];if(s.x===r.x&&s.y===r.y)throw new Dn("Cannot compute the quadrant for two identical points "+r);return s.x>=r.x?s.y>=r.y?cn.NE:cn.SE:s.y>=r.y?cn.NW:cn.SW}};Kp.NE.get=function(){return 0};Kp.NW.get=function(){return 1};Kp.SW.get=function(){return 2};Kp.SE.get=function(){return 3};Object.defineProperties(cn,Kp);var Yi=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],r=arguments[1],s=arguments[2],l=null;this._edge=e,this.init(r,s),this._label=l}else if(arguments.length===4){var p=arguments[0],m=arguments[1],c=arguments[2],S=arguments[3];this._edge=p,this.init(m,c),this._label=S}};Yi.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){m.linkDirectedEdgesForMinimalEdgeRings();var c=m.buildMinimalRings(),S=s.findShell(c);S!==null?(s.placePolygonHoles(S,c),e.add(S)):r.addAll(c)}else l.add(m)}return l};Or.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var r=e.next();if(r.containsPoint(t))return!0}return!1};Or.prototype.buildMaximalEdgeRings=function(t){for(var e=this,r=new qt,s=t.iterator();s.hasNext();){var l=s.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var p=new bw(l,e._geometryFactory);r.add(p),p.setInResult()}}return r};Or.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var s=r.next();s.isHole()&&s.setShell(t)}};Or.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};Or.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),s=r.getEnvelopeInternal(),l=r.getCoordinateN(0),p=null,m=null,c=e.iterator();c.hasNext();){var S=c.next(),L=S.getLinearRing(),R=L.getEnvelopeInternal();p!==null&&(m=p.getLinearRing().getEnvelopeInternal());var k=!1;R.contains(s)&&Yt.isPointInRing(l,L.getCoordinates())&&(k=!0),k&&(p===null||m.contains(R))&&(p=S)}return p};Or.prototype.findShell=function(t){for(var e=0,r=null,s=t.iterator();s.hasNext();){var l=s.next();l.isHole()||(r=l,e++)}return Se.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r};Or.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],r=arguments[1];Bn.linkResultDirectedEdges(r);var s=this.buildMaximalEdgeRings(e),l=new qt,p=this.buildMinimalEdgeRings(s,this._shellList,l);this.sortShellsAndHoles(p,this._shellList,l),this.placeFreeHoles(this._shellList,l)}};Or.prototype.interfaces_=function(){return[]};Or.prototype.getClass=function(){return Or};var Jc=function(){};Jc.prototype.getBounds=function(){};Jc.prototype.interfaces_=function(){return[]};Jc.prototype.getClass=function(){return Jc};var Fo=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Fo.prototype.getItem=function(){return this._item};Fo.prototype.getBounds=function(){return this._bounds};Fo.prototype.interfaces_=function(){return[Jc,bo]};Fo.prototype.getClass=function(){return Fo};var ua=function(){this._size=null,this._items=null,this._size=0,this._items=new qt,this._items.add(null)};ua.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t};ua.prototype.size=function(){return this._size};ua.prototype.reorder=function(t){for(var e=this,r=null,s=this._items.get(t);t*2<=this._size&&(r=t*2,r!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(s)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,s)};ua.prototype.clear=function(){this._size=0,this._items.clear()};ua.prototype.isEmpty=function(){return this._size===0};ua.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var r=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(r/2)))<0;r/=2)e._items.set(r,e._items.get(Math.trunc(r/2)));this._items.set(r,t)};ua.prototype.interfaces_=function(){return[]};ua.prototype.getClass=function(){return ua};var ka=function(){};ka.prototype.visitItem=function(t){};ka.prototype.interfaces_=function(){return[]};ka.prototype.getClass=function(){return ka};var gu=function(){};gu.prototype.insert=function(t,e){};gu.prototype.remove=function(t,e){};gu.prototype.query=function(){};gu.prototype.interfaces_=function(){return[]};gu.prototype.getClass=function(){return gu};var pi=function(){if(this._childBoundables=new qt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},q0={serialVersionUID:{configurable:!0}};pi.prototype.getLevel=function(){return this._level};pi.prototype.size=function(){return this._childBoundables.size()};pi.prototype.getChildBoundables=function(){return this._childBoundables};pi.prototype.addChildBoundable=function(t){Se.isTrue(this._bounds===null),this._childBoundables.add(t)};pi.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};pi.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};pi.prototype.interfaces_=function(){return[Jc,bo]};pi.prototype.getClass=function(){return pi};q0.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(pi,q0);var Bo=function(){};Bo.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Bo.min=function(t){return Bo.sort(t),t.get(0)};Bo.sort=function(t,e){var r=t.toArray();e?_l.sort(r,e):_l.sort(r);for(var s=t.iterator(),l=0,p=r.length;lri.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(s)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Dn("neither boundable is composite")};ri.prototype.isLeaves=function(){return!(ri.isComposite(this._boundable1)||ri.isComposite(this._boundable2))};ri.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};ri.prototype.expand=function(t,e,r,s){for(var l=this,p=t.getChildBoundables(),m=p.iterator();m.hasNext();){var c=m.next(),S=new ri(c,e,l._itemDistance);S.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},Nf={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Ri.prototype.getNodeCapacity=function(){return this._nodeCapacity};Ri.prototype.lastNode=function(t){return t.get(t.size()-1)};Ri.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],r=0,s=e.getChildBoundables().iterator();s.hasNext();){var l=s.next();l instanceof pi?r+=t.size(l):l instanceof Fo&&(r+=1)}return r}};Ri.prototype.removeItem=function(t,e){for(var r=null,s=t.getChildBoundables().iterator();s.hasNext();){var l=s.next();l instanceof Fo&&l.getItem()===e&&(r=l)}return r!==null?(t.getChildBoundables().remove(r),!0):!1};Ri.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new qt:e}else if(arguments.length===1){for(var r=arguments[0],s=new qt,l=r.getChildBoundables().iterator();l.hasNext();){var p=l.next();if(p instanceof pi){var m=t.itemsTree(p);m!==null&&s.add(m)}else p instanceof Fo?s.add(p.getItem()):Se.shouldNeverReachHere()}return s.size()<=0?null:s}};Ri.prototype.insert=function(t,e){Se.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Fo(t,e))};Ri.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],r=new qt;return this.boundablesAtLevel(e,this._root,r),r}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];if(Se.isTrue(s>-2),l.getLevel()===s)return p.add(l),null;for(var m=l.getChildBoundables().iterator();m.hasNext();){var c=m.next();c instanceof pi?t.boundablesAtLevel(s,c,p):(Se.isTrue(c instanceof Fo),s===-1&&p.add(c))}return null}};Ri.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var r=new qt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}else if(arguments.length===2){var s=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,l)}else if(arguments.length===3){if(de(arguments[2],ka)&&arguments[0]instanceof Object&&arguments[1]instanceof pi)for(var p=arguments[0],m=arguments[1],c=arguments[2],S=m.getChildBoundables(),L=0;Lr&&(r=p)}}return r+1}};Ri.prototype.createParentBoundables=function(t,e){var r=this;Se.isTrue(!t.isEmpty());var s=new qt;s.add(this.createNode(e));var l=new qt(t);Bo.sort(l,this.getComparator());for(var p=l.iterator();p.hasNext();){var m=p.next();r.lastNode(s).getChildBoundables().size()===r.getNodeCapacity()&&s.add(r.createNode(e)),r.lastNode(s).addChildBoundable(m)}return s};Ri.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};Ri.prototype.interfaces_=function(){return[bo]};Ri.prototype.getClass=function(){return Ri};Ri.compareDoubles=function(t,e){return t>e?1:t0);for(var m=new qt,c=0;c0;){var dt=ct.poll(),bt=dt.getDistance();if(bt>=k)break;dt.isLeaves()?(k=bt,U=dt):dt.expandToQueue(ct,k)}return[U.getBoundable(0).getItem(),U.getBoundable(1).getItem()]}}else if(arguments.length===3){var It=arguments[0],Dt=arguments[1],Rt=arguments[2],Gt=new Fo(It,Dt),re=new ri(this.getRoot(),Gt,Rt);return this.nearestNeighbour(re)[0]}},e.prototype.interfaces_=function(){return[gu,bo]},e.prototype.getClass=function(){return e},e.centreX=function(s){return e.avg(s.getMinX(),s.getMaxX())},e.avg=function(s,l){return(s+l)/2},e.centreY=function(s){return e.avg(s.getMinY(),s.getMaxY())},r.STRtreeNode.get=function(){return Fy},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[qc]},compare:function(s,l){return t.compareDoubles(e.centreX(s.getBounds()),e.centreX(l.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[qc]},compare:function(s,l){return t.compareDoubles(e.centreY(s.getBounds()),e.centreY(l.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(s,l){return s.intersects(l)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(Ri),Fy=function(t){function e(){var r=arguments[0];t.call(this,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var r=null,s=this.getChildBoundables().iterator();s.hasNext();){var l=s.next();r===null?r=new ne(l.getBounds()):r.expandToInclude(l.getBounds())}return r},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(pi),vr=function(){};vr.prototype.interfaces_=function(){return[]};vr.prototype.getClass=function(){return vr};vr.relativeSign=function(t,e){return te?1:0};vr.compare=function(t,e,r){if(e.equals2D(r))return 0;var s=vr.relativeSign(e.x,r.x),l=vr.relativeSign(e.y,r.y);switch(t){case 0:return vr.compareValue(s,l);case 1:return vr.compareValue(l,s);case 2:return vr.compareValue(l,-s);case 3:return vr.compareValue(-s,l);case 4:return vr.compareValue(-s,-l);case 5:return vr.compareValue(-l,-s);case 6:return vr.compareValue(-l,s);case 7:return vr.compareValue(s,-l)}return Se.shouldNeverReachHere("invalid octant value"),0};vr.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var za=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],s=arguments[3];this._segString=t,this.coord=new ht(e),this.segmentIndex=r,this._segmentOctant=s,this._isInterior=!e.equals2D(t.getCoordinate(r))};za.prototype.getCoordinate=function(){return this.coord};za.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};za.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:vr.compare(this._segmentOctant,this.coord,e.coord)};za.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};za.prototype.isInterior=function(){return this._isInterior};za.prototype.interfaces_=function(){return[xo]};za.prototype.getClass=function(){return za};var ur=function(){this._nodeMap=new Xi,this._edge=null;var t=arguments[0];this._edge=t};ur.prototype.getSplitCoordinates=function(){var t=this,e=new Xp;this.addEndpoints();for(var r=this.iterator(),s=r.next();r.hasNext();){var l=r.next();t.addEdgeCoordinates(s,l,e),s=l}return e.toCoordinateArray()};ur.prototype.addCollapsedNodes=function(){var t=this,e=new qt;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var r=e.iterator();r.hasNext();){var s=r.next().intValue();t.add(t._edge.getCoordinate(s),s)}};ur.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var r=e.next();r.print(t)}};ur.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,r=0;r=0?e>=0?r>=s?0:1:r>=s?7:6:e>=0?r>=s?3:2:r>=s?4:5}else if(arguments[0]instanceof ht&&arguments[1]instanceof ht){var l=arguments[0],p=arguments[1],m=p.x-l.x,c=p.y-l.y;if(m===0&&c===0)throw new Dn("Cannot compute the octant for two identical points "+l);return _u.octant(m,c)}};var Ns=function(){};Ns.prototype.getCoordinates=function(){};Ns.prototype.size=function(){};Ns.prototype.getCoordinate=function(t){};Ns.prototype.isClosed=function(){};Ns.prototype.setData=function(t){};Ns.prototype.getData=function(){};Ns.prototype.interfaces_=function(){return[]};Ns.prototype.getClass=function(){return Ns};var Op=function(){};Op.prototype.addIntersection=function(t,e){};Op.prototype.interfaces_=function(){return[Ns]};Op.prototype.getClass=function(){return Op};var ei=function(){this._nodeList=new ur(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};ei.prototype.getCoordinates=function(){return this._pts};ei.prototype.size=function(){return this._pts.length};ei.prototype.getCoordinate=function(t){return this._pts[t]};ei.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ei.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};ei.prototype.setData=function(t){this._data=t};ei.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:_u.octant(t,e)};ei.prototype.getData=function(){return this._data};ei.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var r=arguments[0],s=arguments[1],l=arguments[3],p=new ht(r.getIntersection(l));this.addIntersection(p,s)}};ei.prototype.toString=function(){return zo.toLineString(new Qn(this._pts))};ei.prototype.getNodeList=function(){return this._nodeList};ei.prototype.addIntersectionNode=function(t,e){var r=e,s=r+1;if(s=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}else if(arguments[0]instanceof ht){var s=arguments[0];return Yt.orientationIndex(this.p0,this.p1,s)}};ie.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};ie.prototype.isVertical=function(){return this.p0.x===this.p1.x};ie.prototype.equals=function(t){if(!(t instanceof ie))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};ie.prototype.intersection=function(t){var e=new Al;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};ie.prototype.project=function(){if(arguments[0]instanceof ht){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new ht(t);var e=this.projectionFactor(t),r=new ht;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}else if(arguments[0]instanceof ie){var s=arguments[0],l=this.projectionFactor(s.p0),p=this.projectionFactor(s.p1);if(l>=1&&p>=1||l<=0&&p<=0)return null;var m=this.project(s.p0);l<0&&(m=this.p0),l>1&&(m=this.p1);var c=this.project(s.p1);return p<0&&(c=this.p0),p>1&&(c=this.p1),new ie(m,c)}};ie.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};ie.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};ie.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};ie.prototype.distancePerpendicular=function(t){return Yt.distancePointLinePerpendicular(t,this.p0,this.p1)};ie.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};ie.prototype.midPoint=function(){return ie.midPoint(this.p0,this.p1)};ie.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,s=e*e+r*r;if(s<=0)return ye.NaN;var l=((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/s;return l};ie.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var r=new Array(2).fill(null),s=ye.MAX_VALUE,l=null,p=this.closestPoint(t.p0);s=p.distance(t.p0),r[0]=p,r[1]=t.p0;var m=this.closestPoint(t.p1);l=m.distance(t.p1),l0&&e<1)return this.project(t);var r=this.p0.distance(t),s=this.p1.distance(t);return r1||ye.isNaN(e))&&(e=1),e};ie.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};ie.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};ie.prototype.distance=function(){if(arguments[0]instanceof ie){var t=arguments[0];return Yt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof ht){var e=arguments[0];return Yt.distancePointLine(e,this.p0,this.p1)}};ie.prototype.pointAlong=function(t){var e=new ht;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e};ie.prototype.hashCode=function(){var t=ye.doubleToLongBits(this.p0.x);t^=ye.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),r=ye.doubleToLongBits(this.p1.x);r^=ye.doubleToLongBits(this.p1.y)*31;var s=Math.trunc(r)^Math.trunc(r>>32);return e^s};ie.prototype.interfaces_=function(){return[xo,bo]};ie.prototype.getClass=function(){return ie};ie.midPoint=function(t,e){return new ht((t.x+e.x)/2,(t.y+e.y)/2)};j0.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(ie,j0);var Fp=function(){this.tempEnv1=new ne,this.tempEnv2=new ne,this._overlapSeg1=new ie,this._overlapSeg2=new ie};Fp.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],r=arguments[2],s=arguments[3];t.getLineSegment(e,this._overlapSeg1),r.getLineSegment(s,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Fp.prototype.interfaces_=function(){return[]};Fp.prototype.getClass=function(){return Fp};var Fr=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],r=arguments[2],s=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=s};Fr.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Fr.prototype.computeSelect=function(t,e,r,s){var l=this._pts[e],p=this._pts[r];if(s.tempEnv1.init(l,p),r-e===1)return s.select(this,e),null;if(!t.intersects(s.tempEnv1))return null;var m=Math.trunc((e+r)/2);e=t.length-1)return t.length-1;for(var s=cn.quadrant(t[r],t[r+1]),l=e+1;lm.getId()&&(m.computeOverlaps(L,l),s._nOverlaps++),s._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return By},Object.defineProperties(e,r),e}(Bp),By=function(t){function e(){t.call(this),this._si=null;var r=arguments[0];this._si=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var r=arguments[0],s=arguments[1],l=arguments[2],p=arguments[3],m=r.getContext(),c=l.getContext();this._si.processIntersections(m,s,c,p)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Fp),Ye=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(s)}else if(arguments.length===4){var l=arguments[0],p=arguments[1],m=arguments[2],c=arguments[3];this.setQuadrantSegments(l),this.setEndCapStyle(p),this.setJoinStyle(m),this.setMitreLimit(c)}}},pa={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Ye.prototype.getEndCapStyle=function(){return this._endCapStyle};Ye.prototype.isSingleSided=function(){return this._isSingleSided};Ye.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Ye.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ye.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Ye.JOIN_ROUND&&(this._quadrantSegments=Ye.DEFAULT_QUADRANT_SEGMENTS)};Ye.prototype.getJoinStyle=function(){return this._joinStyle};Ye.prototype.setJoinStyle=function(t){this._joinStyle=t};Ye.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Ye.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Ye.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Ye.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Ye.prototype.getMitreLimit=function(){return this._mitreLimit};Ye.prototype.setMitreLimit=function(t){this._mitreLimit=t};Ye.prototype.setSingleSided=function(t){this._isSingleSided=t};Ye.prototype.interfaces_=function(){return[]};Ye.prototype.getClass=function(){return Ye};Ye.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};pa.CAP_ROUND.get=function(){return 1};pa.CAP_FLAT.get=function(){return 2};pa.CAP_SQUARE.get=function(){return 3};pa.JOIN_ROUND.get=function(){return 1};pa.JOIN_MITRE.get=function(){return 2};pa.JOIN_BEVEL.get=function(){return 3};pa.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};pa.DEFAULT_MITRE_LIMIT.get=function(){return 5};pa.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Ye,pa);var Hn=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Yt.COUNTERCLOCKWISE,this._inputLine=t||null},Jp={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Hn.prototype.isDeletable=function(t,e,r,s){var l=this._inputLine[t],p=this._inputLine[e],m=this._inputLine[r];return!this.isConcave(l,p,m)||!this.isShallow(l,p,m,s)?!1:this.isShallowSampled(l,p,t,r,s)};Hn.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),s=this.findNextNonDeletedIndex(r),l=!1;s=0;l--)r.addPt(t[l])};io.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),r=t.distance(e);return rMath.PI;)t-=Ue.PI_TIMES_2;for(;t<=-Math.PI;)t+=Ue.PI_TIMES_2;return t};Ue.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],r=arguments[1],s=r.x-e.x,l=r.y-e.y;return Math.atan2(l,s)}};Ue.isAcute=function(t,e,r){var s=t.x-e.x,l=t.y-e.y,p=r.x-e.x,m=r.y-e.y,c=s*p+l*m;return c>0};Ue.isObtuse=function(t,e,r){var s=t.x-e.x,l=t.y-e.y,p=r.x-e.x,m=r.y-e.y,c=s*p+l*m;return c<0};Ue.interiorAngle=function(t,e,r){var s=Ue.angle(e,t),l=Ue.angle(e,r);return Math.abs(l-s)};Ue.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Ue.PI_TIMES_2;t>=Ue.PI_TIMES_2&&(t=0)}else{for(;t>=Ue.PI_TIMES_2;)t-=Ue.PI_TIMES_2;t<0&&(t=0)}return t};Ue.angleBetween=function(t,e,r){var s=Ue.angle(e,t),l=Ue.angle(e,r);return Ue.diff(s,l)};Ue.diff=function(t,e){var r=null;return tMath.PI&&(r=2*Math.PI-r),r};Ue.toRadians=function(t){return t*Math.PI/180};Ue.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?Ue.COUNTERCLOCKWISE:r<0?Ue.CLOCKWISE:Ue.NONE};Ue.angleBetweenOriented=function(t,e,r){var s=Ue.angle(e,t),l=Ue.angle(e,r),p=l-s;return p<=-Math.PI?p+Ue.PI_TIMES_2:p>Math.PI?p-Ue.PI_TIMES_2:p};Mu.PI_TIMES_2.get=function(){return 2*Math.PI};Mu.PI_OVER_2.get=function(){return Math.PI/2};Mu.PI_OVER_4.get=function(){return Math.PI/4};Mu.COUNTERCLOCKWISE.get=function(){return Yt.COUNTERCLOCKWISE};Mu.CLOCKWISE.get=function(){return Yt.CLOCKWISE};Mu.NONE.get=function(){return Yt.COLLINEAR};Object.defineProperties(Ue,Mu);var Cn=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new ie,this._seg1=new ie,this._offset0=new ie,this._offset1=new ie,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],s=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new Al,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===Ye.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(s)},Qp={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Cn.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=Yt.computeOrientation(this._s0,this._s1,this._s2),s=r===Yt.CLOCKWISE&&this._side===kt.LEFT||r===Yt.COUNTERCLOCKWISE&&this._side===kt.RIGHT;r===0?this.addCollinear(e):s?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)};Cn.prototype.addLineEndCap=function(t,e){var r=new ie(t,e),s=new ie;this.computeOffsetSegment(r,kt.LEFT,this._distance,s);var l=new ie;this.computeOffsetSegment(r,kt.RIGHT,this._distance,l);var p=e.x-t.x,m=e.y-t.y,c=Math.atan2(m,p);switch(this._bufParams.getEndCapStyle()){case Ye.CAP_ROUND:this._segList.addPt(s.p1),this.addFilletArc(e,c+Math.PI/2,c-Math.PI/2,Yt.CLOCKWISE,this._distance),this._segList.addPt(l.p1);break;case Ye.CAP_FLAT:this._segList.addPt(s.p1),this._segList.addPt(l.p1);break;case Ye.CAP_SQUARE:var S=new ht;S.x=Math.abs(this._distance)*Math.cos(c),S.y=Math.abs(this._distance)*Math.sin(c);var L=new ht(s.p1.x+S.x,s.p1.y+S.y),R=new ht(l.p1.x+S.x,l.p1.y+S.y);this._segList.addPt(L),this._segList.addPt(R);break}};Cn.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};Cn.prototype.addMitreJoin=function(t,e,r,s){var l=!0,p=null;try{p=No.intersection(e.p0,e.p1,r.p0,r.p1);var m=s<=0?1:p.distance(t)/Math.abs(s);m>this._bufParams.getMitreLimit()&&(l=!1)}catch(c){if(c instanceof lh)p=new ht(0,0),l=!1;else throw c}finally{}l?this._segList.addPt(p):this.addLimitedMitreJoin(e,r,s,this._bufParams.getMitreLimit())};Cn.prototype.addFilletCorner=function(t,e,r,s,l){var p=e.x-t.x,m=e.y-t.y,c=Math.atan2(m,p),S=r.x-t.x,L=r.y-t.y,R=Math.atan2(L,S);s===Yt.CLOCKWISE?c<=R&&(c+=2*Math.PI):c>=R&&(c-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,c,R,s,l),this._segList.addPt(r)};Cn.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var r=new ht((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var s=new ht((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};Cn.prototype.createCircle=function(t){var e=new ht(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};Cn.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};Cn.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new io,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Cn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};Cn.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===Ye.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ye.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,Yt.CLOCKWISE,this._distance))};Cn.prototype.closeRing=function(){this._segList.closeRing()};Cn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};Cn.prototype.interfaces_=function(){return[]};Cn.prototype.getClass=function(){return Cn};Qp.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Qp.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Qp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Qp.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(Cn,Qp);var Ir=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Ir.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var r=e<0,s=Math.abs(e),l=this.getSegGen(s);t.length<=1?this.computePointCurve(t[0],l):this.computeOffsetCurve(t,r,l);var p=l.getCoordinates();return r&&ke.reverse(p),p};Ir.prototype.computeSingleSidedBufferCurve=function(t,e,r){var s=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var l=Hn.simplify(t,-s),p=l.length-1;r.initSideSegments(l[p],l[p-1],kt.LEFT),r.addFirstSegment();for(var m=p-2;m>=0;m--)r.addNextSegment(l[m],!0)}else{r.addSegments(t,!1);var c=Hn.simplify(t,s),S=c.length-1;r.initSideSegments(c[0],c[1],kt.LEFT),r.addFirstSegment();for(var L=2;L<=S;L++)r.addNextSegment(c[L],!0)}r.addLastSegment(),r.closeRing()};Ir.prototype.computeRingBufferCurve=function(t,e,r){var s=this.simplifyTolerance(this._distance);e===kt.RIGHT&&(s=-s);var l=Hn.simplify(t,s),p=l.length-1;r.initSideSegments(l[p-1],l[0],e);for(var m=1;m<=p;m++){var c=m!==1;r.addNextSegment(l[m],c)}r.closeRing()};Ir.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),s=Hn.simplify(t,r),l=s.length-1;e.initSideSegments(s[0],s[1],kt.LEFT);for(var p=2;p<=l;p++)e.addNextSegment(s[p],!0);e.addLastSegment(),e.addLineEndCap(s[l-1],s[l]);var m=Hn.simplify(t,-r),c=m.length-1;e.initSideSegments(m[c],m[c-1],kt.LEFT);for(var S=c-2;S>=0;S--)e.addNextSegment(m[S],!0);e.addLastSegment(),e.addLineEndCap(m[1],m[0]),e.closeRing()};Ir.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Ye.CAP_ROUND:e.createCircle(t);break;case Ye.CAP_SQUARE:e.createSquare(t);break}};Ir.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var r=Math.abs(e),s=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],s);else if(this._bufParams.isSingleSided()){var l=e<0;this.computeSingleSidedBufferCurve(t,l,s)}else this.computeLineBufferCurve(t,s);var p=s.getCoordinates();return p};Ir.prototype.getBufferParameters=function(){return this._bufParams};Ir.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};Ir.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(r===0)return Ir.copyCoordinates(t);var s=this.getSegGen(r);return this.computeRingBufferCurve(t,e,s),s.getCoordinates()};Ir.prototype.computeOffsetCurve=function(t,e,r){var s=this.simplifyTolerance(this._distance);if(e){var l=Hn.simplify(t,-s),p=l.length-1;r.initSideSegments(l[p],l[p-1],kt.LEFT),r.addFirstSegment();for(var m=p-2;m>=0;m--)r.addNextSegment(l[m],!0)}else{var c=Hn.simplify(t,s),S=c.length-1;r.initSideSegments(c[0],c[1],kt.LEFT),r.addFirstSegment();for(var L=2;L<=S;L++)r.addNextSegment(c[L],!0)}r.addLastSegment()};Ir.prototype.getSegGen=function(t){return new Cn(this._precisionModel,this._bufParams,t)};Ir.prototype.interfaces_=function(){return[]};Ir.prototype.getClass=function(){return Ir};Ir.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;rp.getMaxY()||t.findStabbedSegments(e,l.getDirectedEdges(),r)}return r}else if(arguments.length===3){if(de(arguments[2],ko)&&arguments[0]instanceof ht&&arguments[1]instanceof lg)for(var m=arguments[0],c=arguments[1],S=arguments[2],L=c.getEdge().getCoordinates(),R=0;Rt._seg.p1.y&&t._seg.reverse();var k=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(kt._seg.p1.y)&&Yt.computeOrientation(t._seg.p0,t._seg.p1,m)!==Yt.RIGHT){var U=c.getDepth(kt.LEFT);t._seg.p0.equals(L[R])||(U=c.getDepth(kt.RIGHT));var ct=new Il(t._seg,U);S.add(ct)}}else if(de(arguments[2],ko)&&arguments[0]instanceof ht&&de(arguments[1],ko))for(var dt=arguments[0],bt=arguments[1],It=arguments[2],Dt=bt.iterator();Dt.hasNext();){var Rt=Dt.next();Rt.isForward()&&t.findStabbedSegments(dt,Rt,It)}}};yu.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var r=Bo.min(e);return r._leftDepth};yu.prototype.interfaces_=function(){return[]};yu.prototype.getClass=function(){return yu};H0.DepthSegment.get=function(){return Il};Object.defineProperties(yu,H0);var Il=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new ie(t),this._leftDepth=e};Il.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(e._upwardSeg);return r!==0||(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg),r!==0)?r:this._upwardSeg.compareTo(e._upwardSeg)};Il.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return r!==0?r:t.p1.compareTo(e.p1)};Il.prototype.toString=function(){return this._upwardSeg.toString()};Il.prototype.interfaces_=function(){return[xo]};Il.prototype.getClass=function(){return Il};var Ke=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};Ke.prototype.area=function(){return Ke.area(this.p0,this.p1,this.p2)};Ke.prototype.signedArea=function(){return Ke.signedArea(this.p0,this.p1,this.p2)};Ke.prototype.interpolateZ=function(t){if(t===null)throw new Dn("Supplied point is null.");return Ke.interpolateZ(t,this.p0,this.p1,this.p2)};Ke.prototype.longestSideLength=function(){return Ke.longestSideLength(this.p0,this.p1,this.p2)};Ke.prototype.isAcute=function(){return Ke.isAcute(this.p0,this.p1,this.p2)};Ke.prototype.circumcentre=function(){return Ke.circumcentre(this.p0,this.p1,this.p2)};Ke.prototype.area3D=function(){return Ke.area3D(this.p0,this.p1,this.p2)};Ke.prototype.centroid=function(){return Ke.centroid(this.p0,this.p1,this.p2)};Ke.prototype.inCentre=function(){return Ke.inCentre(this.p0,this.p1,this.p2)};Ke.prototype.interfaces_=function(){return[]};Ke.prototype.getClass=function(){return Ke};Ke.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)};Ke.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2};Ke.det=function(t,e,r,s){return t*s-e*r};Ke.interpolateZ=function(t,e,r,s){var l=e.x,p=e.y,m=r.x-l,c=s.x-l,S=r.y-p,L=s.y-p,R=m*L-c*S,k=t.x-l,U=t.y-p,ct=(L*k-c*U)/R,dt=(-S*k+m*U)/R,bt=e.z+ct*(r.z-e.z)+dt*(s.z-e.z);return bt};Ke.longestSideLength=function(t,e,r){var s=t.distance(e),l=e.distance(r),p=r.distance(t),m=s;return l>m&&(m=l),p>m&&(m=p),m};Ke.isAcute=function(t,e,r){return!(!Ue.isAcute(t,e,r)||!Ue.isAcute(e,r,t)||!Ue.isAcute(r,t,e))};Ke.circumcentre=function(t,e,r){var s=r.x,l=r.y,p=t.x-s,m=t.y-l,c=e.x-s,S=e.y-l,L=2*Ke.det(p,m,c,S),R=Ke.det(m,p*p+m*m,S,c*c+S*S),k=Ke.det(p,p*p+m*m,c,c*c+S*S),U=s-R/L,ct=l+k/L;return new ht(U,ct)};Ke.perpendicularBisector=function(t,e){var r=e.x-t.x,s=e.y-t.y,l=new No(t.x+r/2,t.y+s/2,1),p=new No(t.x-s+r/2,t.y+r+s/2,1);return new No(l,p)};Ke.angleBisector=function(t,e,r){var s=e.distance(t),l=e.distance(r),p=s/(s+l),m=r.x-t.x,c=r.y-t.y,S=new ht(t.x+p*m,t.y+p*c);return S};Ke.area3D=function(t,e,r){var s=e.x-t.x,l=e.y-t.y,p=e.z-t.z,m=r.x-t.x,c=r.y-t.y,S=r.z-t.z,L=l*S-p*c,R=p*m-s*S,k=s*c-l*m,U=L*L+R*R+k*k,ct=Math.sqrt(U)/2;return ct};Ke.centroid=function(t,e,r){var s=(t.x+e.x+r.x)/3,l=(t.y+e.y+r.y)/3;return new ht(s,l)};Ke.inCentre=function(t,e,r){var s=e.distance(r),l=t.distance(r),p=t.distance(e),m=s+l+p,c=(s*t.x+l*e.x+p*r.x)/m,S=(s*t.y+l*e.y+p*r.y)/m;return new ht(c,S)};var _o=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new qt;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};_o.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,ft.EXTERIOR,ft.INTERIOR)};_o.prototype.addPolygon=function(t){var e=this,r=this._distance,s=kt.LEFT;this._distance<0&&(r=-this._distance,s=kt.RIGHT);var l=t.getExteriorRing(),p=ke.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&p.length<3)return null;this.addPolygonRing(p,r,s,ft.EXTERIOR,ft.INTERIOR);for(var m=0;m0&&e.isErodedCompletely(c,-e._distance)||e.addPolygonRing(S,r,kt.opposite(s),ft.INTERIOR,ft.EXTERIOR)}};_o.prototype.isTriangleErodedCompletely=function(t,e){var r=new Ke(t[0],t[1],t[2]),s=r.inCentre(),l=Yt.distancePointLine(s,r.p0,r.p1);return l=Ds.MINIMUM_VALID_SIZE&&Yt.isCCW(t)&&(p=l,m=s,r=kt.opposite(r));var c=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(c,p,m)};_o.prototype.add=function(t){if(t.isEmpty())return null;t instanceof di?this.addPolygon(t):t instanceof Zn?this.addLineString(t):t instanceof zr?this.addPoint(t):t instanceof Yc?this.addCollection(t):t instanceof bl?this.addCollection(t):t instanceof Ps?this.addCollection(t):t instanceof ar&&this.addCollection(t)};_o.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(r.length===4)return this.isTriangleErodedCompletely(r,e);var s=t.getEnvelopeInternal(),l=Math.min(s.getHeight(),s.getWidth());return e<0&&2*Math.abs(e)>l};_o.prototype.addCollection=function(t){for(var e=this,r=0;r=this._max)throw new ch;var t=this._parent.getGeometryN(this._index++);return t instanceof ar?(this._subcollectionIterator=new As(t),this._subcollectionIterator.next()):t};As.prototype.remove=function(){throw new Error(this.getClass().getName())};As.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};As.prototype.interfaces_=function(){return[uh]};As.prototype.getClass=function(){return As};As.isAtomic=function(t){return!(t instanceof ar)};var $r=function(){this._geom=null;var t=arguments[0];this._geom=t};$r.prototype.locate=function(t){return $r.locate(t,this._geom)};$r.prototype.interfaces_=function(){return[$c]};$r.prototype.getClass=function(){return $r};$r.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?Yt.isPointInRing(t,e.getCoordinates()):!1};$r.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!$r.isPointInRing(t,r))return!1;for(var s=0;s0&&p[p.length-1])&&(L[0]===6||L[0]===2)){r=0;continue}if(L[0]===3&&(!p||L[1]>p[0]&&L[1]e?1:t0){if(e.right===null)break;if(r(t,e.right.key)>0){var c=e.right;if(e.right=c.left,c.left=e,e=c,e.right===null)break}l.right=e,l=e,e=e.right}else break}return l.right=e.left,p.left=e.right,e.left=s.right,e.right=s.left,e}function Xm(t,e,r,s){var l=new xl(t,e);if(r===null)return l.left=l.right=null,l;r=fl(t,r,s);var p=s(t,r.key);return p<0?(l.left=r.left,l.right=r,r.left=null):p>=0&&(l.right=r.right,l.left=r,r.right=null),l}function Ry(t,e,r){var s=null,l=null;if(e){e=fl(t,e,r);var p=r(e.key,t);p===0?(s=e.left,l=e.right):p<0?(l=e.right,e.right=null,s=e):(s=e.left,e.left=null,l=e)}return{left:s,right:l}}function rw(t,e,r){return e===null?t:(t===null||(e=fl(t.key,e,r),e.left=t),e)}function ng(t,e,r,s,l){if(t){s(""+e+(r?"└── ":"├── ")+l(t)+` +`);var p=e+(r?" ":"│ ");t.left&&ng(t.left,p,!1,s,l),t.right&&ng(t.right,p,!0,s,l)}}var gg=function(){function t(e){e===void 0&&(e=iw),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,r){return this._size++,this._root=Xm(e,r,this._root,this._comparator)},t.prototype.add=function(e,r){var s=new xl(e,r);this._root===null&&(s.left=s.right=null,this._size++,this._root=s);var l=this._comparator,p=fl(e,this._root,l),m=l(e,p.key);return m===0?this._root=p:(m<0?(s.left=p.left,s.right=p,p.left=null):m>0&&(s.right=p.right,s.left=p,p.right=null),this._size++,this._root=s),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,r,s){var l;if(r===null)return null;r=fl(e,r,s);var p=s(e,r.key);return p===0?(r.left===null?l=r.right:(l=fl(e,r.left,s),l.right=r.right),this._size--,l):r},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=fl(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var r=this._root,s=this._comparator;r;){var l=s(e,r.key);if(l===0)return r;l<0?r=r.left:r=r.right}return null},t.prototype.find=function(e){return this._root&&(this._root=fl(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var r=this._root,s=this._comparator;r;){var l=s(e,r.key);if(l===0)return!0;l<0?r=r.left:r=r.right}return!1},t.prototype.forEach=function(e,r){for(var s=this._root,l=[],p=!1;!p;)s!==null?(l.push(s),s=s.left):l.length!==0?(s=l.pop(),e.call(r,s),s=s.right):p=!0;return this},t.prototype.range=function(e,r,s,l){for(var p=[],m=this._comparator,c=this._root,S;p.length!==0||c;)if(c)p.push(c),c=c.left;else{if(c=p.pop(),S=m(c.key,r),S>0)break;if(m(c.key,e)>=0&&s.call(l,c))return this;c=c.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(r){var s=r.key;return e.push(s)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(r){var s=r.data;return e.push(s)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var r=this._root,s=!1,l=0,p=[];!s;)if(r)p.push(r),r=r.left;else if(p.length>0){if(r=p.pop(),l===e)return r;l++,r=r.right}else s=!0;return null},t.prototype.next=function(e){var r=this._root,s=null;if(e.right){for(s=e.right;s.left;)s=s.left;return s}for(var l=this._comparator;r;){var p=l(e.key,r.key);if(p===0)break;p<0?(s=r,r=r.left):r=r.right}return s},t.prototype.prev=function(e){var r=this._root,s=null;if(e.left!==null){for(s=e.left;s.right;)s=s.right;return s}for(var l=this._comparator;r;){var p=l(e.key,r.key);if(p===0)break;p<0?r=r.left:(s=r,r=r.right)}return s},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return sw(this._root)},t.prototype.load=function(e,r,s){r===void 0&&(r=[]),s===void 0&&(s=!1);var l=e.length,p=this._comparator;if(s&&og(e,r,0,l-1,p),this._root===null)this._root=ig(e,r,0,l),this._size=l;else{var m=aw(this.toList(),ow(e,r),p);l=this._size+l,this._root=rg({head:m},0,l)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(s){return String(s.key)});var r=[];return ng(this._root,"",!0,function(s){return r.push(s)},e),r.join("")},t.prototype.update=function(e,r,s){var l=this._comparator,p=Ry(e,this._root,l),m=p.left,c=p.right;l(e,r)<0?c=Xm(r,s,c,l):m=Xm(r,s,m,l),this._root=rw(m,c,l)},t.prototype.split=function(e){return Ry(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,r,s;return nw(this,function(l){switch(l.label){case 0:e=this._root,r=[],s=!1,l.label=1;case 1:return s?[3,6]:e===null?[3,2]:(r.push(e),e=e.left,[3,5]);case 2:return r.length===0?[3,4]:(e=r.pop(),[4,e]);case 3:return l.sent(),e=e.right,[3,5];case 4:s=!0,l.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function ig(t,e,r,s){var l=s-r;if(l>0){var p=r+Math.floor(l/2),m=t[p],c=e[p],S=new xl(m,c);return S.left=ig(t,e,r,p),S.right=ig(t,e,p+1,s),S}return null}function ow(t,e){for(var r=new xl(null,null),s=r,l=0;l0?(e=p=p.next=r.pop(),e=e.right):s=!0;return p.next=null,l.next}function rg(t,e,r){var s=r-e;if(s>0){var l=e+Math.floor(s/2),p=rg(t,e,l),m=t.head;return m.left=p,t.head=t.head.next,m.right=rg(t,l+1,r),m}return null}function aw(t,e,r){for(var s=new xl(null,null),l=s,p=t,m=e;p!==null&&m!==null;)r(p.key,m.key)<0?(l.next=p,p=p.next):(l.next=m,m=m.next),l=l.next;return p!==null?l.next=p:m!==null&&(l.next=m),s.next}function og(t,e,r,s,l){if(!(r>=s)){for(var p=t[r+s>>1],m=r-1,c=s+1;;){do m++;while(l(t[m],p)<0);do c--;while(l(t[c],p)>0);if(m>=c)break;var S=t[m];t[m]=t[c],t[c]=S,S=e[m],e[m]=e[c],e[c]=S}og(t,e,r,c,l),og(t,e,c+1,s,l)}}function ys(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ny(t,e){for(var r=0;rr.x?1:e.yr.y?1:0}}]);function t(e,r){ys(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return eo(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var r=e.point.events,s=0,l=r.length;s=0&&k>=0?LU?-1:0:S<0&&k<0?LU?1:0:kS?1:0}}}]),t}(),dw=0,gf=function(){eo(t,null,[{key:"compare",value:function(e,r){var s=e.leftSE.point.x,l=r.leftSE.point.x,p=e.rightSE.point.x,m=r.rightSE.point.x;if(mc&&S>L)return-1;var k=e.comparePoint(r.leftSE.point);if(k<0)return 1;if(k>0)return-1;var U=r.comparePoint(e.rightSE.point);return U!==0?U:-1}if(s>l){if(cS&&c>R)return 1;var ut=r.comparePoint(e.leftSE.point);if(ut!==0)return ut;var pt=e.comparePoint(r.rightSE.point);return pt<0?1:pt>0?-1:1}if(cS)return 1;if(pm){var bt=e.comparePoint(r.rightSE.point);if(bt<0)return 1;if(bt>0)return-1}if(p!==m){var Dt=L-c,Rt=p-s,Gt=R-S,se=m-l;if(Dt>Rt&&Gtse)return-1}return p>m?1:pR?1:e.idr.id?1:0}}]);function t(e,r,s,l){ys(this,t),this.id=++dw,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=s,this.windings=l}return eo(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:er?e:r}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var r=this.leftSE.point,s=this.rightSE.point,l=this.vector();if(r.x===s.x)return e.x===r.x?0:e.x0&&c.swapEvents(),ia.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),s&&(l.checkForConsuming(),p.checkForConsuming()),r}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var r=0,s=this.windings.length;r0){var p=r;r=s,s=p}if(r.prev===s){var m=r;r=s,s=m}for(var c=0,S=s.rings.length;c0)l=r,p=e,m=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var S=new ia(l,!0),L=new ia(p,!1);return new t(S,L,[s],[m])}}]),t}(),By=function(){function t(e,r,s){if(ys(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=s,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var l=Pp.round(e[0][0],e[0][1]);this.bbox={ll:{x:l.x,y:l.y},ur:{x:l.x,y:l.y}};for(var p=l,m=1,c=e.length;mthis.bbox.ur.x&&(this.bbox.ur.x=S.x),S.y>this.bbox.ur.y&&(this.bbox.ur.y=S.y),p=S)}(l.x!==p.x||l.y!==p.y)&&this.segments.push(gf.fromRing(p,l,this))}return eo(t,[{key:"getSweepEvents",value:function(){for(var e=[],r=0,s=this.segments.length;rthis.bbox.ur.x&&(this.bbox.ur.x=p.bbox.ur.x),p.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=p.bbox.ur.y),this.interiorRings.push(p)}this.multiPoly=r}return eo(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),r=0,s=this.interiorRings.length;rthis.bbox.ur.x&&(this.bbox.ur.x=p.bbox.ur.x),p.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=p.bbox.ur.y),this.polys.push(p)}this.isSubject=r}return eo(t,[{key:"getSweepEvents",value:function(){for(var e=[],r=0,s=this.polys.length;r0&&(e=l)}for(var p=e.segment.prevInResult(),m=p?p.prevInResult():null;;){if(!p)return null;if(!m)return p.ringOut;if(m.ringOut!==p.ringOut)return m.ringOut.enclosingRing()!==p.ringOut?p.ringOut:p.ringOut.enclosingRing();p=m.prevInResult(),m=p?p.prevInResult():null}}}]),t}(),Uy=function(){function t(e){ys(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return eo(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var r=0,s=this.interiorRings.length;r1&&arguments[1]!==void 0?arguments[1]:gf.compare;ys(this,t),this.queue=e,this.tree=new gg(r),this.segments=[]}return eo(t,[{key:"process",value:function(e){var r=e.segment,s=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(r),s;var l=e.isLeft?this.tree.insert(r):this.tree.find(r);if(!l)throw new Error("Unable to find segment #".concat(r.id," ")+"[".concat(r.leftSE.point.x,", ").concat(r.leftSE.point.y,"] -> ")+"[".concat(r.rightSE.point.x,", ").concat(r.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var p=l,m=l,c=void 0,S=void 0;c===void 0;)p=this.tree.prev(p),p===null?c=null:p.key.consumedBy===void 0&&(c=p.key);for(;S===void 0;)m=this.tree.next(m),m===null?S=null:m.key.consumedBy===void 0&&(S=m.key);if(e.isLeft){var L=null;if(c){var R=c.getIntersection(r);if(R!==null&&(r.isAnEndpoint(R)||(L=R),!c.isAnEndpoint(R)))for(var k=this._splitSafely(c,R),U=0,ut=k.length;U0?(this.tree.remove(r),s.push(e)):(this.segments.push(r),r.prev=c)}else{if(c&&S){var Me=c.getIntersection(S);if(Me!==null){if(!c.isAnEndpoint(Me))for(var _e=this._splitSafely(c,Me),be=0,Nt=_e.length;beqy)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var se=new _w(pt),de=pt.size,Ve=pt.pop();Ve;){var he=Ve.key;if(pt.size===de){var Me=he.segment;throw new Error("Unable to pop() ".concat(he.isLeft?"left":"right"," SweepEvent ")+"[".concat(he.point.x,", ").concat(he.point.y,"] from segment #").concat(Me.id," ")+"[".concat(Me.leftSE.point.x,", ").concat(Me.leftSE.point.y,"] -> ")+"[".concat(Me.rightSE.point.x,", ").concat(Me.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(pt.size>qy)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(se.segments.length>yw)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var _e=se.process(he),be=0,Nt=_e.length;ber[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]e.x?1:this.ye.y?1:0};ct.prototype.clone=function(){};ct.prototype.copy=function(){return new ct(this)};ct.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};ct.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,s=this.z-t.z;return Math.sqrt(e*e+r*r+s*s)};ct.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)};ct.prototype.hashCode=function(){var t=17;return t=37*t+ct.hashCode(this.x),t=37*t+ct.hashCode(this.y),t};ct.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};ct.prototype.interfaces_=function(){return[bo,Ef,wo]};ct.prototype.getClass=function(){return ct};ct.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=xe.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};Tu.DimensionalComparator.get=function(){return Ra};Tu.serialVersionUID.get=function(){return 6683108902428367e3};Tu.NULL_ORDINATE.get=function(){return xe.NaN};Tu.X.get=function(){return 0};Tu.Y.get=function(){return 1};Tu.Z.get=function(){return 2};Object.defineProperties(ct,Tu);var Ra=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new Mn("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};Ra.prototype.compare=function(t,e){var r=t,s=e,l=Ra.compare(r.x,s.x);if(l!==0)return l;var p=Ra.compare(r.y,s.y);if(p!==0)return p;if(this._dimensionsToTest<=2)return 0;var m=Ra.compare(r.z,s.z);return m};Ra.prototype.interfaces_=function(){return[qc]};Ra.prototype.getClass=function(){return Ra};Ra.compare=function(t,e){return te?1:xe.isNaN(t)?xe.isNaN(e)?0:-1:xe.isNaN(e)?1:0};var Gc=function(){};Gc.prototype.create=function(){};Gc.prototype.interfaces_=function(){return[]};Gc.prototype.getClass=function(){return Gc};var dt=function(){},Hp={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};dt.prototype.interfaces_=function(){return[]};dt.prototype.getClass=function(){return dt};dt.toLocationSymbol=function(t){switch(t){case dt.EXTERIOR:return"e";case dt.BOUNDARY:return"b";case dt.INTERIOR:return"i";case dt.NONE:return"-"}throw new Mn("Unknown location value: "+t)};Hp.INTERIOR.get=function(){return 0};Hp.BOUNDARY.get=function(){return 1};Hp.EXTERIOR.get=function(){return 2};Hp.NONE.get=function(){return-1};Object.defineProperties(dt,Hp);var me=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},no=function(){},N0={LOG_10:{configurable:!0}};no.prototype.interfaces_=function(){return[]};no.prototype.getClass=function(){return no};no.log10=function(t){var e=Math.log(t);return xe.isInfinite(e)||xe.isNaN(e)?e:e/no.LOG_10};no.min=function(t,e,r,s){var l=t;return er?r:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var s=arguments[0],l=arguments[1],p=arguments[2];return sp?p:s}};no.wrap=function(t,e){return t<0?e- -t%e:t%e};no.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],r=arguments[2],s=t;return e>s&&(s=e),r>s&&(s=r),s}else if(arguments.length===4){var l=arguments[0],p=arguments[1],m=arguments[2],c=arguments[3],S=l;return p>S&&(S=p),m>S&&(S=m),c>S&&(S=c),S}};no.average=function(t,e){return(t+e)/2};N0.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(no,N0);var vs=function(t){this.str=t};vs.prototype.append=function(t){this.str+=t};vs.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};vs.prototype.toString=function(t){return this.str};var ls=function(t){this.value=t};ls.prototype.intValue=function(){return this.value};ls.prototype.compareTo=function(t){return this.valuet?1:0};ls.isNaN=function(t){return Number.isNaN(t)};var Ap=function(){};Ap.isWhitespace=function(t){return t<=32&&t>=0||t===127};Ap.toUpperCase=function(t){return t.toUpperCase()};var yt=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else if(typeof arguments[0]=="string"){var s=arguments[0];t.call(this,t.parse(s))}}else if(arguments.length===2){var l=arguments[0],p=arguments[1];this.init(l,p)}},Zo={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};yt.prototype.le=function(t){return(this._hi9?(R=!0,k="9"):k="0"+L,m.append(k),r=r.subtract(yt.valueOf(L)).multiply(yt.TEN),R&&r.selfAdd(yt.TEN);var U=!0,ut=yt.magnitude(r._hi);if(ut<0&&Math.abs(ut)>=c-S&&(U=!1),!U)break}return e[0]=s,m.toString()};yt.prototype.sqr=function(){return this.multiply(this)};yt.prototype.doubleValue=function(){return this._hi+this._lo};yt.prototype.subtract=function(){if(arguments[0]instanceof yt){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};yt.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};yt.prototype.isZero=function(){return this._hi===0&&this._lo===0};yt.prototype.selfSubtract=function(){if(arguments[0]instanceof yt){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}};yt.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};yt.prototype.min=function(t){return this.le(t)?this:t};yt.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof yt){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1],l=null,p=null,m=null,c=null,S=null,L=null,R=null,k=null;return S=this._hi/r,L=yt.SPLIT*S,l=L-S,k=yt.SPLIT*r,l=L-l,p=S-l,m=k-r,R=S*r,m=k-m,c=r-m,k=l*m-R+l*c+p*m+p*c,L=(this._hi-R-k+this._lo-S*s)/r,k=S+L,this._hi=k,this._lo=S-k+L,this}};yt.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};yt.prototype.divide=function(){if(arguments[0]instanceof yt){var t=arguments[0],e=null,r=null,s=null,l=null,p=null,m=null,c=null,S=null;p=this._hi/t._hi,m=yt.SPLIT*p,e=m-p,S=yt.SPLIT*t._hi,e=m-e,r=p-e,s=S-t._hi,c=p*t._hi,s=S-s,l=t._hi-s,S=e*s-c+e*l+r*s+r*l,m=(this._hi-c-S+this._lo-p*t._lo)/t._hi,S=p+m;var L=S,R=p-S+m;return new yt(L,R)}else if(typeof arguments[0]=="number"){var k=arguments[0];return xe.isNaN(k)?yt.createNaN():yt.copy(this).selfDivide(k,0)}};yt.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};yt.prototype.pow=function(t){if(t===0)return yt.valueOf(1);var e=new yt(this),r=yt.valueOf(1),s=Math.abs(t);if(s>1)for(;s>0;)s%2===1&&r.selfMultiply(e),s/=2,s>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r};yt.prototype.ceil=function(){if(this.isNaN())return yt.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new yt(t,e)};yt.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};yt.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};yt.prototype.setValue=function(){if(arguments[0]instanceof yt){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};yt.prototype.max=function(t){return this.ge(t)?this:t};yt.prototype.sqrt=function(){if(this.isZero())return yt.valueOf(0);if(this.isNegative())return yt.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=yt.valueOf(e),s=this.subtract(r.sqr()),l=s._hi*(t*.5);return r.add(l)};yt.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof yt){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],r=null,s=null,l=null,p=null,m=null,c=null;return l=this._hi+e,m=l-this._hi,p=l-m,p=e-m+(this._hi-p),c=p+this._lo,r=l+c,s=c+(l-r),this._hi=r+s,this._lo=s+(r-this._hi),this}}else if(arguments.length===2){var S=arguments[0],L=arguments[1],R=null,k=null,U=null,ut=null,pt=null,vt=null,bt=null,Dt=null;pt=this._hi+S,U=this._lo+L,bt=pt-this._hi,Dt=U-this._lo,vt=pt-bt,ut=U-Dt,vt=S-bt+(this._hi-vt),ut=L-Dt+(this._lo-ut),bt=vt+U,R=pt+bt,k=bt+(pt-R),bt=ut+k;var Rt=R+bt,Gt=bt+(R-Rt);return this._hi=Rt,this._lo=Gt,this}};yt.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof yt){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1],l=null,p=null,m=null,c=null,S=null,L=null;S=yt.SPLIT*this._hi,l=S-this._hi,L=yt.SPLIT*r,l=S-l,p=this._hi-l,m=L-r,S=this._hi*r,m=L-m,c=r-m,L=l*m-S+l*c+p*m+p*c+(this._hi*s+this._lo*r);var R=S+L;l=S-R;var k=L+l;return this._hi=R,this._lo=k,this}};yt.prototype.selfSqr=function(){return this.selfMultiply(this)};yt.prototype.floor=function(){if(this.isNaN())return yt.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new yt(t,e)};yt.prototype.negate=function(){return this.isNaN()?this:new yt(-this._hi,-this._lo)};yt.prototype.clone=function(){};yt.prototype.multiply=function(){if(arguments[0]instanceof yt){var t=arguments[0];return t.isNaN()?yt.createNaN():yt.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return xe.isNaN(e)?yt.createNaN():yt.copy(this).selfMultiply(e,0)}};yt.prototype.isNaN=function(){return xe.isNaN(this._hi)};yt.prototype.intValue=function(){return Math.trunc(this._hi)};yt.prototype.toString=function(){var t=yt.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};yt.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),s=e[0]+1,l=r;if(r.charAt(0)===".")l="0"+r;else if(s<0)l="0."+yt.stringOfChar("0",-s)+r;else if(r.indexOf(".")===-1){var p=s-r.length,m=yt.stringOfChar("0",p);l=r+m+".0"}return this.isNegative()?"-"+l:l};yt.prototype.reciprocal=function(){var t=null,e=null,r=null,s=null,l=null,p=null,m=null,c=null;l=1/this._hi,p=yt.SPLIT*l,t=p-l,c=yt.SPLIT*this._hi,t=p-t,e=l-t,r=c-this._hi,m=l*this._hi,r=c-r,s=this._hi-r,c=t*r-m+t*s+e*r+e*s,p=(1-m-c-l*this._lo)/this._hi;var S=l+p,L=l-S+p;return new yt(S,L)};yt.prototype.toSciNotation=function(){if(this.isZero())return yt.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),s=yt.SCI_NOT_EXPONENT_CHAR+e[0];if(r.charAt(0)==="0")throw new Error("Found leading zero: "+r);var l="";r.length>1&&(l=r.substring(1));var p=r.charAt(0)+"."+l;return this.isNegative()?"-"+p+s:p+s};yt.prototype.abs=function(){return this.isNaN()?yt.NaN:this.isNegative()?this.negate():new yt(this)};yt.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};yt.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};yt.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};yt.prototype.trunc=function(){return this.isNaN()?yt.NaN:this.isPositive()?this.floor():this.ceil()};yt.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};yt.prototype.interfaces_=function(){return[wo,bo,Ef]};yt.prototype.getClass=function(){return yt};yt.sqr=function(t){return yt.valueOf(t).selfMultiply(t)};yt.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return yt.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new yt(e)}};yt.sqrt=function(t){return yt.valueOf(t).sqrt()};yt.parse=function(t){for(var e=0,r=t.length;Ap.isWhitespace(t.charAt(e));)e++;var s=!1;if(e=r);){var L=t.charAt(e);if(e++,Ap.isDigit(L)){var R=L-"0";p.selfMultiply(yt.TEN),p.selfAdd(R),m++;continue}if(L==="."){c=m;continue}if(L==="e"||L==="E"){var k=t.substring(e);try{S=ls.parseInt(k)}catch(bt){throw bt instanceof Error?new Error("Invalid exponent "+k+" in string "+t):bt}finally{}break}throw new Error("Unexpected character '"+L+"' at position "+e+" in string "+t)}var U=p,ut=m-c-S;if(ut===0)U=p;else if(ut>0){var pt=yt.TEN.pow(ut);U=p.divide(pt)}else if(ut<0){var vt=yt.TEN.pow(-ut);U=p.multiply(vt)}return s?U.negate():U};yt.createNaN=function(){return new yt(xe.NaN,xe.NaN)};yt.copy=function(t){return new yt(t)};yt.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),s=Math.trunc(Math.floor(r)),l=Math.pow(10,s);return l*10<=e&&(s+=1),s};yt.stringOfChar=function(t,e){for(var r=new vs,s=0;s0){if(p<=0)return br.signum(m);s=l+p}else if(l<0){if(p>=0)return br.signum(m);s=-l-p}else return br.signum(m);var c=br.DP_SAFE_EPSILON*s;return m>=c||-m>=c?br.signum(m):2};br.signum=function(t){return t>0?1:t<0?-1:0};k0.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(br,k0);var We=function(){},Wp={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Wp.X.get=function(){return 0};Wp.Y.get=function(){return 1};Wp.Z.get=function(){return 2};Wp.M.get=function(){return 3};We.prototype.setOrdinate=function(t,e,r){};We.prototype.size=function(){};We.prototype.getOrdinate=function(t,e){};We.prototype.getCoordinate=function(){};We.prototype.getCoordinateCopy=function(t){};We.prototype.getDimension=function(){};We.prototype.getX=function(t){};We.prototype.clone=function(){};We.prototype.expandEnvelope=function(t){};We.prototype.copy=function(){};We.prototype.getY=function(t){};We.prototype.toCoordinateArray=function(){};We.prototype.interfaces_=function(){return[Ef]};We.prototype.getClass=function(){return We};Object.defineProperties(We,Wp);var z0=function(){},lh=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(z0),Vi=function(){};Vi.arraycopy=function(t,e,r,s,l){for(var p=0,m=e;mt._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,s=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];return this.isNull()?!1:r>=this._minx&&r<=this._maxx&&s>=this._miny&&s<=this._maxy}};re.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof re){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||rthis._maxy||sthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=s,this._maxy=s):(rthis._maxx&&(this._maxx=r),sthis._maxy&&(this._maxy=s))}};re.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0};re.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};re.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};re.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};re.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};re.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};re.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};re.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof re){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof ct){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];return this.covers(r,s)}};re.prototype.centre=function(){return this.isNull()?null:new ct((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};re.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof ct){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof re){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.init(r.x,s.x,r.y,s.y)}else if(arguments.length===4){var l=arguments[0],p=arguments[1],m=arguments[2],c=arguments[3];lt._maxx&&(e=this._minx-t._maxx);var r=0;return this._maxyt._maxy&&(r=this._miny-t._maxy),e===0?r:r===0?e:Math.sqrt(e*e+r*r)};re.prototype.hashCode=function(){var t=17;return t=37*t+ct.hashCode(this._minx),t=37*t+ct.hashCode(this._maxx),t=37*t+ct.hashCode(this._miny),t=37*t+ct.hashCode(this._maxy),t};re.prototype.interfaces_=function(){return[bo,wo]};re.prototype.getClass=function(){return re};re.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.xe.x?t.x:e.x)&&r.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var s=arguments[0],l=arguments[1],p=arguments[2],m=arguments[3],c=Math.min(p.x,m.x),S=Math.max(p.x,m.x),L=Math.min(s.x,l.x),R=Math.max(s.x,l.x);return!(L>S||RS)||Rr?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};Bn.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};Bn.prototype.setPrecisionModel=function(t){this._precisionModel=t};Bn.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],r=0;rl?p=s:p=l;else{var m=Math.abs(t.x-e.x),c=Math.abs(t.y-e.y);s>l?p=m:p=c,p===0&&!t.equals(e)&&(p=Math.max(m,c))}return Te.isTrue(!(p===0&&!t.equals(e)),"Bad distance calculation"),p};Bn.nonRobustComputeEdgeDistance=function(t,e,r){var s=t.x-e.x,l=t.y-e.y,p=Math.sqrt(s*s+l*l);return Te.isTrue(!(p===0&&!t.equals(e)),"Invalid distance calculation"),p};Lu.DONT_INTERSECT.get=function(){return 0};Lu.DO_INTERSECT.get=function(){return 1};Lu.COLLINEAR.get=function(){return 2};Lu.NO_INTERSECTION.get=function(){return 0};Lu.POINT_INTERSECTION.get=function(){return 1};Lu.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(Bn,Lu);var Al=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(r){var s=new re(this._inputLines[0][0],this._inputLines[0][1]),l=new re(this._inputLines[1][0],this._inputLines[1][1]);return s.contains(r)&&l.contains(r)},e.prototype.computeIntersection=function(){if(arguments.length===3){var r=arguments[0],s=arguments[1],l=arguments[2];if(this._isProper=!1,re.intersects(s,l,r)&&Kt.orientationIndex(s,l,r)===0&&Kt.orientationIndex(l,s,r)===0)return this._isProper=!0,(r.equals(s)||r.equals(l))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(r,s,l,p,m){m.x=this.smallestInAbsValue(r.x,s.x,l.x,p.x),m.y=this.smallestInAbsValue(r.y,s.y,l.y,p.y),r.x-=m.x,r.y-=m.y,s.x-=m.x,s.y-=m.y,l.x-=m.x,l.y-=m.y,p.x-=m.x,p.y-=m.y},e.prototype.safeHCoordinateIntersection=function(r,s,l,p){var m=null;try{m=zo.intersection(r,s,l,p)}catch(c){if(c instanceof lh)m=e.nearestEndpoint(r,s,l,p);else throw c}finally{}return m},e.prototype.intersection=function(r,s,l,p){var m=this.intersectionWithNormalization(r,s,l,p);return this.isInSegmentEnvelopes(m)||(m=new ct(e.nearestEndpoint(r,s,l,p))),this._precisionModel!==null&&this._precisionModel.makePrecise(m),m},e.prototype.smallestInAbsValue=function(r,s,l,p){var m=r,c=Math.abs(m);return Math.abs(s)1e-4&&Vi.out.println("Distance = "+m.distance(c))},e.prototype.intersectionWithNormalization=function(r,s,l,p){var m=new ct(r),c=new ct(s),S=new ct(l),L=new ct(p),R=new ct;this.normalizeToEnvCentre(m,c,S,L,R);var k=this.safeHCoordinateIntersection(m,c,S,L);return k.x+=R.x,k.y+=R.y,k},e.prototype.computeCollinearIntersection=function(r,s,l,p){var m=re.intersects(r,s,l),c=re.intersects(r,s,p),S=re.intersects(l,p,r),L=re.intersects(l,p,s);return m&&c?(this._intPt[0]=l,this._intPt[1]=p,t.COLLINEAR_INTERSECTION):S&&L?(this._intPt[0]=r,this._intPt[1]=s,t.COLLINEAR_INTERSECTION):m&&S?(this._intPt[0]=l,this._intPt[1]=r,l.equals(r)&&!c&&!L?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):m&&L?(this._intPt[0]=l,this._intPt[1]=s,l.equals(s)&&!c&&!S?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&S?(this._intPt[0]=p,this._intPt[1]=r,p.equals(r)&&!m&&!L?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&L?(this._intPt[0]=p,this._intPt[1]=s,p.equals(s)&&!m&&!S?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(r,s,l,p,m){var c=r.xs.x?r.x:s.x,R=r.y>s.y?r.y:s.y,k=l.xp.x?l.x:p.x,pt=l.y>p.y?l.y:p.y,vt=c>k?c:k,bt=LU?S:U,Rt=R0&&c>0||m<0&&c<0)return t.NO_INTERSECTION;var S=Kt.orientationIndex(l,p,r),L=Kt.orientationIndex(l,p,s);if(S>0&&L>0||S<0&&L<0)return t.NO_INTERSECTION;var R=m===0&&c===0&&S===0&&L===0;return R?this.computeCollinearIntersection(r,s,l,p):(m===0||c===0||S===0||L===0?(this._isProper=!1,r.equals2D(l)||r.equals2D(p)?this._intPt[0]=r:s.equals2D(l)||s.equals2D(p)?this._intPt[0]=s:m===0?this._intPt[0]=new ct(l):c===0?this._intPt[0]=new ct(p):S===0?this._intPt[0]=new ct(r):L===0&&(this._intPt[0]=new ct(s))):(this._isProper=!0,this._intPt[0]=this.intersection(r,s,l,p)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(r,s,l,p){var m=r,c=Kt.distancePointLine(r,l,p),S=Kt.distancePointLine(s,l,p);return S0?r>0?-l:l:r>0?l:-l;if(e===0||r===0)return s>0?t>0?l:-l:t>0?-l:l;if(e>0?s>0?e<=s||(l=-l,p=t,t=r,r=p,p=e,e=s,s=p):e<=-s?(l=-l,r=-r,s=-s):(p=t,t=-r,r=p,p=e,e=-s,s=p):s>0?-e<=s?(l=-l,t=-t,e=-e):(p=-t,t=r,r=p,p=-e,e=s,s=p):e>=s?(t=-t,e=-e,r=-r,s=-s):(l=-l,p=-t,t=-r,r=p,p=-e,e=-s,s=p),t>0)if(r>0){if(!(t<=r))return l}else return l;else{if(r>0)return-l;if(t>=r)l=-l,t=-t,r=-r;else return-l}for(;;){if(m=Math.floor(r/t),r=r-m*t,s=s-m*e,s<0)return-l;if(s>e)return l;if(t>r+r){if(es+s)return-l;r=t-r,s=e-s,l=-l}if(s===0)return r===0?0:-l;if(r===0||(m=Math.floor(t/r),t=t-m*r,e=e-m*s,e<0))return l;if(e>s)return-l;if(r>t+t){if(se+e)return l;t=r-t,e=s-e,l=-l}if(e===0)return t===0?0:l;if(t===0)return-l}};var ss=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};ss.prototype.countSegment=function(t,e){if(t.xs&&(r=e.x,s=t.x),this._p.x>=r&&this._p.x<=s&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var l=t.x-this._p.x,p=t.y-this._p.y,m=e.x-this._p.x,c=e.y-this._p.y,S=mu.signOfDet2x2(l,p,m,c);if(S===0)return this._isPointOnSegment=!0,null;c0&&this._crossingCount++}};ss.prototype.isPointInPolygon=function(){return this.getLocation()!==dt.EXTERIOR};ss.prototype.getLocation=function(){return this._isPointOnSegment?dt.BOUNDARY:this._crossingCount%2===1?dt.INTERIOR:dt.EXTERIOR};ss.prototype.isOnSegment=function(){return this._isPointOnSegment};ss.prototype.interfaces_=function(){return[]};ss.prototype.getClass=function(){return ss};ss.locatePointInRing=function(){if(arguments[0]instanceof ct&&me(arguments[1],We)){for(var t=arguments[0],e=arguments[1],r=new ss(t),s=new ct,l=new ct,p=1;p1||S<0||S>1)&&(l=!0)}}return l?no.min(Kt.distancePointLine(t,r,s),Kt.distancePointLine(e,r,s),Kt.distancePointLine(r,t,e),Kt.distancePointLine(s,t,e)):0};Kt.isPointInRing=function(t,e){return Kt.locatePointInRing(t,e)!==dt.EXTERIOR};Kt.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,s=new ct;t.getCoordinate(0,s);for(var l=s.x,p=s.y,m=1;mr.y&&(r=p,s=l)}var m=s;do m=m-1,m<0&&(m=e);while(t[m].equals2D(r)&&m!==s);var c=s;do c=(c+1)%e;while(t[c].equals2D(r)&&c!==s);var S=t[m],L=t[c];if(S.equals2D(r)||L.equals2D(r)||S.equals2D(L))return!1;var R=Kt.computeOrientation(S,r,L),k=!1;return R===0?k=S.x>L.x:k=R>0,k};Kt.locatePointInRing=function(t,e){return ss.locatePointInRing(t,e)};Kt.distancePointLinePerpendicular=function(t,e,r){var s=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),l=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/s;return Math.abs(l)*Math.sqrt(s)};Kt.computeOrientation=function(t,e,r){return Kt.orientationIndex(t,e,r)};Kt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new Mn("Line array must contain at least one vertex");for(var r=t.distance(e[0]),s=0;s=1)return p.distance(c);var R=((m.y-p.y)*(c.x-m.x)-(m.x-p.x)*(c.y-m.y))/S;return Math.abs(R)*Math.sqrt(S)}};Kt.isOnLine=function(t,e){for(var r=new Al,s=1;s0};Zc.prototype.interfaces_=function(){return[go]};Zc.prototype.getClass=function(){return Zc};var Hc=function(){};Hc.prototype.isInBoundary=function(t){return t>1};Hc.prototype.interfaces_=function(){return[go]};Hc.prototype.getClass=function(){return Hc};var Wc=function(){};Wc.prototype.isInBoundary=function(t){return t===1};Wc.prototype.interfaces_=function(){return[go]};Wc.prototype.getClass=function(){return Wc};var di=function(){};di.prototype.add=function(){};di.prototype.addAll=function(){};di.prototype.isEmpty=function(){};di.prototype.iterator=function(){};di.prototype.size=function(){};di.prototype.toArray=function(){};di.prototype.remove=function(){};function yg(t){this.message=t||""}yg.prototype=new Error;yg.prototype.name="IndexOutOfBoundsException";var uh=function(){};uh.prototype.hasNext=function(){};uh.prototype.next=function(){};uh.prototype.remove=function(){};var Oo=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(di);function ch(t){this.message=t||""}ch.prototype=new Error;ch.prototype.name="NoSuchElementException";var qt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof di&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,di]},e.prototype.add=function(r){return arguments.length===1?this.array_.push(r):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(r){for(var s=this,l=r.iterator();l.hasNext();)s.add(l.next());return!0},e.prototype.set=function(r,s){var l=this.array_[r];return this.array_[r]=s,l},e.prototype.iterator=function(){return new xw(this)},e.prototype.get=function(r){if(r<0||r>=this.size())throw new yg;return this.array_[r]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var r=this,s=[],l=0,p=this.array_.length;l=1){var L=this.get(this.size()-1);if(L.equals2D(c))return null}t.prototype.add.call(this,c)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var R=arguments[0],k=arguments[1];return this.add(R,k),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var U=arguments[0],ut=arguments[1],pt=arguments[2];if(pt)for(var vt=0;vt=0;bt--)s.add(U[bt],ut);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof ct){var Dt=arguments[0],Rt=arguments[1],Gt=arguments[2];if(!Gt){var se=this.size();if(se>0){if(Dt>0){var de=this.get(Dt-1);if(de.equals2D(Rt))return null}if(Dtbe&&(Nt=-1);for(var sn=_e;sn!==be;sn+=Nt)s.add(he[sn],Me);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new ct(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(qt),Oe=function(){},Cf={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Cf.ForwardComparator.get=function(){return Mp};Cf.BidirectionalComparator.get=function(){return Xc};Cf.coordArrayType.get=function(){return new Array(0).fill(null)};Oe.prototype.interfaces_=function(){return[]};Oe.prototype.getClass=function(){return Oe};Oe.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};Oe.ptNotInList=function(t,e){for(var r=0;r=t?e:[]};Oe.indexOf=function(t,e){for(var r=0;r0)&&(e=t[r]);return e};Oe.extract=function(t,e,r){e=no.clamp(e,0,t.length),r=no.clamp(r,-1,t.length);var s=r-e+1;r<0&&(s=0),e>=t.length&&(s=0),rs.length)return 1;if(r.length===0)return 0;var l=Oe.compare(r,s),p=Oe.isEqualReversed(r,s);return p?0:l};Xc.prototype.OLDcompare=function(t,e){var r=t,s=e;if(r.lengths.length)return 1;if(r.length===0)return 0;for(var l=Oe.increasingDirection(r),p=Oe.increasingDirection(s),m=l>0?0:r.length-1,c=p>0?0:r.length-1,S=0;S0)e=e.right;else return e.value}return null};Ji.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:ra,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r=this.root_,s,l;do if(s=r,l=t.compareTo(r.key),l<0)r=r.left;else if(l>0)r=r.right;else{var p=r.value;return r.value=e,p}while(r!==null);var m={key:t,left:null,right:null,value:e,parent:s,color:ra,getValue:function(){return this.value},getKey:function(){return this.key}};return l<0?s.left=m:s.right=m,this.fixAfterInsertion(m),this.size_++,null};Ji.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=dl;t!=null&&t!==this.root_&&t.parent.color===dl;)if(vn(t)===Ym(vn(vn(t)))){var r=Zy(vn(vn(t)));jy(r)===dl?(ea(vn(t),ra),ea(r,ra),ea(vn(vn(t)),dl),t=vn(vn(t))):(t===Zy(vn(t))&&(t=vn(t),e.rotateLeft(t)),ea(vn(t),ra),ea(vn(vn(t)),dl),e.rotateRight(vn(vn(t))))}else{var s=Ym(vn(vn(t)));jy(s)===dl?(ea(vn(t),ra),ea(s,ra),ea(vn(vn(t)),dl),t=vn(vn(t))):(t===Ym(vn(t))&&(t=vn(t),e.rotateRight(t)),ea(vn(t),ra),ea(vn(vn(t)),dl),e.rotateLeft(vn(vn(t))))}this.root_.color=ra};Ji.prototype.values=function(){var t=new qt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=Ji.successor(e))!==null;)t.add(e.value);return t};Ji.prototype.entrySet=function(){var t=new vg,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=Ji.successor(e))!==null;)t.add(e);return t};Ji.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};Ji.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};Ji.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};Ji.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var r=t.parent,s=t;r!==null&&s===r.right;)s=r,r=r.parent;return r}};Ji.prototype.size=function(){return this.size_};var Dp=function(){};Dp.prototype.interfaces_=function(){return[]};Dp.prototype.getClass=function(){return Dp};function F0(){}F0.prototype=new Tf;function us(){this.array_=[],arguments[0]instanceof di&&this.addAll(arguments[0])}us.prototype=new F0;us.prototype.contains=function(t){for(var e=this,r=0,s=this.array_.length;r=0;){var m=l.substring(0,p);s.add(m),l=l.substring(p+r),p=l.indexOf(e)}l.length>0&&s.add(l);for(var c=new Array(s.size()).fill(null),S=0;S0)for(var p=l;p0&&s.append(" ");for(var p=0;p0&&s.append(","),s.append(fo.toString(t.getOrdinate(l,p)))}return s.append(")"),s.toString()}};ei.ensureValidRing=function(t,e){var r=e.size();if(r===0)return e;if(r<=3)return ei.createClosedRing(t,e,4);var s=e.getOrdinate(0,We.X)===e.getOrdinate(r-1,We.X)&&e.getOrdinate(0,We.Y)===e.getOrdinate(r-1,We.Y);return s?e:ei.createClosedRing(t,e,r+1)};ei.createClosedRing=function(t,e,r){var s=t.create(r,e.getDimension()),l=e.size();ei.copy(e,0,s,0,l);for(var p=l;p0&&ei.reverse(s._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Ke.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return Kt.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var s=this._points.copy();ei.reverse(s);var l=this.getFactory().createLineString(s);return l},e.prototype.compareToSameClass=function(){var s=this;if(arguments.length===1){for(var l=arguments[0],p=l,m=0,c=0;m= 2)");this._points=s},e.prototype.isCoordinate=function(s){for(var l=this,p=0;p=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(Zn),Ms=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return pe.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return this.isEquivalentClass(s)?t.prototype.equalsExact.call(this,s,l):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var s=this,l=this._geometries.length,p=new Array(l).fill(null),m=0;m0?e.createPoint(r[0]):e.createPoint():t};kp.prototype.interfaces_=function(){return[_o.GeometryEditorOperation]};kp.prototype.getClass=function(){return kp};var zp=function(){};zp.prototype.edit=function(t,e){return t instanceof Ns?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Zn?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Or?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};zp.prototype.interfaces_=function(){return[_o.GeometryEditorOperation]};zp.prototype.getClass=function(){return zp};var $n=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var r=0;r0){var e=new vs(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var r=1;r3&&(s=3),s<2?new $n(r):new $n(r,s)}};ks.prototype.interfaces_=function(){return[Gc,wo]};ks.prototype.getClass=function(){return ks};ks.instance=function(){return ks.instanceObject};bg.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};bg.instanceObject.get=function(){return new ks};Object.defineProperties(ks,bg);var V0=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(r){return this.map_.get(r)||null},e.prototype.put=function(r,s){return this.map_.set(r,s),s},e.prototype.values=function(){for(var r=new qt,s=this.map_.values(),l=s.next();!l.done;)r.add(l.value),l=s.next();return r},e.prototype.entrySet=function(){var r=new vg;return this.map_.entries().forEach(function(s){return r.add(s)}),r},e.prototype.size=function(){return this.map_.size()},e}(Au),tn=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof hs){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var s=arguments[0];this._modelType=s._modelType,this._scale=s._scale}}},wg={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};tn.prototype.equals=function(t){if(!(t instanceof tn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};tn.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),s=e.getMaximumSignificantDigits();return new ls(r).compareTo(new ls(s))};tn.prototype.getScale=function(){return this._scale};tn.prototype.isFloating=function(){return this._modelType===tn.FLOATING||this._modelType===tn.FLOATING_SINGLE};tn.prototype.getType=function(){return this._modelType};tn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===tn.FLOATING?t="Floating":this._modelType===tn.FLOATING_SINGLE?t="Floating-Single":this._modelType===tn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};tn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(xe.isNaN(t))return t;if(this._modelType===tn.FLOATING_SINGLE){var e=t;return e}return this._modelType===tn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof ct){var r=arguments[0];if(this._modelType===tn.FLOATING)return null;r.x=this.makePrecise(r.x),r.y=this.makePrecise(r.y)}};tn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===tn.FLOATING?t=16:this._modelType===tn.FLOATING_SINGLE?t=6:this._modelType===tn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};tn.prototype.setScale=function(t){this._scale=Math.abs(t)};tn.prototype.interfaces_=function(){return[wo,bo]};tn.prototype.getClass=function(){return tn};tn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};wg.serialVersionUID.get=function(){return 7777263578777804e3};wg.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(tn,wg);var hs=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Ig={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};hs.prototype.readResolve=function(){return hs.nameToTypeMap.get(this._name)};hs.prototype.toString=function(){return this._name};hs.prototype.interfaces_=function(){return[wo]};hs.prototype.getClass=function(){return hs};Ig.serialVersionUID.get=function(){return-552860263173159e4};Ig.nameToTypeMap.get=function(){return new V0};Object.defineProperties(hs,Ig);tn.Type=hs;tn.FIXED=new hs("FIXED");tn.FLOATING=new hs("FLOATING");tn.FLOATING_SINGLE=new hs("FLOATING SINGLE");var Be=function t(){this._precisionModel=new tn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?me(arguments[0],Gc)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof tn&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},U0={serialVersionUID:{configurable:!0}};Be.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new ct(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new ct(t.getMinX(),t.getMinY()),new ct(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new ct(t.getMinX(),t.getMinY()),new ct(t.getMinX(),t.getMaxY()),new ct(t.getMaxX(),t.getMaxY()),new ct(t.getMaxX(),t.getMinY()),new ct(t.getMinX(),t.getMinY())]),null)};Be.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Zn(this.getCoordinateSequenceFactory().create(t),this);if(me(t,We))return new Zn(t,this)}else return new Zn(this.getCoordinateSequenceFactory().create([]),this)};Be.prototype.createMultiLineString=function(){if(arguments.length===0)return new bl(null,this);if(arguments.length===1){var t=arguments[0];return new bl(t,this)}};Be.prototype.buildGeometry=function(t){for(var e=null,r=!1,s=!1,l=t.iterator();l.hasNext();){var p=l.next(),m=p.getClass();e===null&&(e=m),m!==e&&(r=!0),p.isGeometryCollectionOrDerived()&&(s=!0)}if(e===null)return this.createGeometryCollection();if(r||s)return this.createGeometryCollection(Be.toGeometryArray(t));var c=t.iterator().next(),S=t.size()>1;if(S){if(c instanceof mi)return this.createMultiPolygon(Be.toPolygonArray(t));if(c instanceof Zn)return this.createMultiLineString(Be.toLineStringArray(t));if(c instanceof Or)return this.createMultiPoint(Be.toPointArray(t));Te.shouldNeverReachHere("Unhandled class: "+c.getClass().getName())}return c};Be.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};Be.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof ct){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(me(arguments[0],We)){var e=arguments[0];return new Or(e,this)}}};Be.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};Be.prototype.createPolygon=function(){if(arguments.length===0)return new mi(null,null,this);if(arguments.length===1){if(me(arguments[0],We)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Ns){var r=arguments[0];return this.createPolygon(r,null)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return new mi(s,l,this)}};Be.prototype.getSRID=function(){return this._SRID};Be.prototype.createGeometryCollection=function(){if(arguments.length===0)return new ur(null,this);if(arguments.length===1){var t=arguments[0];return new ur(t,this)}};Be.prototype.createGeometry=function(t){var e=new _o(this);return e.edit(t,{edit:function(){if(arguments.length===2){var r=arguments[0];return this._coordinateSequenceFactory.create(r)}}})};Be.prototype.getPrecisionModel=function(){return this._precisionModel};Be.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(me(arguments[0],We)){var e=arguments[0];return new Ns(e,this)}}};Be.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Ms(null,this);if(arguments.length===1){var t=arguments[0];return new Ms(t,this)}};Be.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Yc(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Yc(e,this)}else if(arguments[0]instanceof Array){var r=arguments[0];return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)}else if(me(arguments[0],We)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var l=new Array(s.size()).fill(null),p=0;p=this.size())throw new Error;return this.array_[t]};xs.prototype.push=function(t){return this.array_.push(t),t};xs.prototype.pop=function(t){if(this.array_.length===0)throw new Mf;return this.array_.pop()};xs.prototype.peek=function(){if(this.array_.length===0)throw new Mf;return this.array_[this.array_.length-1]};xs.prototype.empty=function(){return this.array_.length===0};xs.prototype.isEmpty=function(){return this.empty()};xs.prototype.search=function(t){return this.array_.indexOf(t)};xs.prototype.size=function(){return this.array_.length};xs.prototype.toArray=function(){for(var t=this,e=[],r=0,s=this.array_.length;r0&&this._minIndexthis._minCoord.y&&r.y>this._minCoord.y&&s===Kt.CLOCKWISE)&&(l=!0),l&&(this._minIndex=this._minIndex-1)};ps.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge(),s=r.getCoordinates();if(e<0||e+1>=s.length||s[e].y===s[e+1].y)return-1;var l=kt.LEFT;return s[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=s,e._minCoord=r[s])};ps.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};ps.prototype.findEdge=function(t){for(var e=this,r=t.iterator();r.hasNext();){var s=r.next();s.isForward()&&e.checkForRightmostCoordinate(s)}Te.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var l=this.getRightmostSide(this._minDe,this._minIndex);l===kt.LEFT&&(this._orientedDe=this._minDe.getSym())};ps.prototype.interfaces_=function(){return[]};ps.prototype.getClass=function(){return ps};var ua=function(t){function e(r,s){t.call(this,e.msgWithCoord(r,s)),this.pt=s?new ct(s):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(r,s){return s?r:r+" [ "+s+" ]"},e}(aa),Df=function(){this.array_=[]};Df.prototype.addLast=function(t){this.array_.push(t)};Df.prototype.removeFirst=function(){return this.array_.shift()};Df.prototype.isEmpty=function(){return this.array_.length===0};var cr=function(){this._finder=null,this._dirEdgeList=new qt,this._nodes=new qt,this._rightMostCoord=null,this._env=null,this._finder=new ps};cr.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};cr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};cr.prototype.computeNodeDepth=function(t){for(var e=this,r=null,s=t.getEdges().iterator();s.hasNext();){var l=s.next();if(l.isVisited()||l.getSym().isVisited()){r=l;break}}if(r===null)throw new ua("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(r);for(var p=t.getEdges().iterator();p.hasNext();){var m=p.next();m.setVisited(!0),e.copySymDepths(m)}};cr.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(kt.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};cr.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};cr.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(kt.RIGHT)>=1&&e.getDepth(kt.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};cr.prototype.computeDepths=function(t){var e=this,r=new vg,s=new Df,l=t.getNode();for(s.addLast(l),r.add(l),t.setVisited(!0);!s.isEmpty();){var p=s.removeFirst();r.add(p),e.computeNodeDepth(p);for(var m=p.getEdges().iterator();m.hasNext();){var c=m.next(),S=c.getSym();if(!S.isVisited()){var L=S.getNode();r.contains(L)||(s.addLast(L),r.add(L))}}}};cr.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};cr.prototype.getEnvelope=function(){if(this._env===null){for(var t=new re,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next(),s=r.getEdge().getCoordinates(),l=0;lthis.location.length){var r=new Array(3).fill(null);r[kt.ON]=this.location[kt.ON],r[kt.LEFT]=dt.NONE,r[kt.RIGHT]=dt.NONE,this.location=r}for(var s=0;s1&&t.append(dt.toLocationSymbol(this.location[kt.LEFT])),t.append(dt.toLocationSymbol(this.location[kt.ON])),this.location.length>1&&t.append(dt.toLocationSymbol(this.location[kt.RIGHT])),t.toString()};xn.prototype.setLocations=function(t,e,r){this.location[kt.ON]=t,this.location[kt.LEFT]=e,this.location[kt.RIGHT]=r};xn.prototype.get=function(t){return t1};xn.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=s),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};ai.prototype.addPoints=function(t,e,r){var s=this,l=t.getCoordinates();if(e){var p=1;r&&(p=0);for(var m=p;m=0;S--)s._pts.add(l[S])}};ai.prototype.isHole=function(){return this._isHole};ai.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};ai.prototype.containsPoint=function(t){var e=this.getLinearRing(),r=e.getEnvelopeInternal();if(!r.contains(t)||!Kt.isPointInRing(t,e.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();){var l=s.next();if(l.containsPoint(t))return!1}return!0};ai.prototype.addHole=function(t){this._holes.add(t)};ai.prototype.isShell=function(){return this._shell===null};ai.prototype.getLabel=function(){return this._label};ai.prototype.getEdges=function(){return this._edges};ai.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};ai.prototype.getShell=function(){return this._shell};ai.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],r=arguments[1],s=e.getLocation(r,kt.RIGHT);if(s===dt.NONE)return null;if(this._label.getLocation(r)===dt.NONE)return this._label.setLocation(r,s),null}};ai.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};ai.prototype.toPolygon=function(t){for(var e=this,r=new Array(this._holes.size()).fill(null),s=0;s=2,"found partial label"),this.computeIM(t)};io.prototype.isInResult=function(){return this._isInResult};io.prototype.isVisited=function(){return this._isVisited};io.prototype.interfaces_=function(){return[]};io.prototype.getClass=function(){return io};var Rf=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var r=arguments[0],s=arguments[1];this._coord=r,this._edges=s,this._label=new nn(0,dt.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var r=this.getEdges().getEdges().iterator();r.hasNext();){var s=r.next();if(s.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(r){r.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(r){},e.prototype.computeMergedLocation=function(r,s){var l=dt.NONE;if(l=this._label.getLocation(s),!r.isNull(s)){var p=r.getLocation(s);l!==dt.BOUNDARY&&(l=p)}return l},e.prototype.setLabel=function(){if(arguments.length===2){var r=arguments[0],s=arguments[1];this._label===null?this._label=new nn(r,s):this._label.setLocation(r,s)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var r=this;if(arguments[0]instanceof e){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof nn)for(var l=arguments[0],p=0;p<2;p++){var m=r.computeMergedLocation(l,p),c=r._label.getLocation(p);c===dt.NONE&&r._label.setLocation(p,m)}},e.prototype.add=function(r){this._edges.insert(r),r.setNode(this)},e.prototype.setLabelBoundary=function(r){if(this._label===null)return null;var s=dt.NONE;this._label!==null&&(s=this._label.getLocation(r));var l=null;switch(s){case dt.BOUNDARY:l=dt.INTERIOR;break;case dt.INTERIOR:l=dt.BOUNDARY;break;default:l=dt.BOUNDARY;break}this._label.setLocation(r,l)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(io),ds=function(){this.nodeMap=new Ji,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};ds.prototype.find=function(t){return this.nodeMap.get(t)};ds.prototype.addNode=function(){if(arguments[0]instanceof ct){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof Rf){var r=arguments[0],s=this.nodeMap.get(r.getCoordinate());return s===null?(this.nodeMap.put(r.getCoordinate(),r),r):(s.mergeLabel(r),s)}};ds.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next();r.print(t)}};ds.prototype.iterator=function(){return this.nodeMap.values().iterator()};ds.prototype.values=function(){return this.nodeMap.values()};ds.prototype.getBoundaryNodes=function(t){for(var e=new qt,r=this.iterator();r.hasNext();){var s=r.next();s.getLabel().getLocation(t)===dt.BOUNDARY&&e.add(s)}return e};ds.prototype.add=function(t){var e=t.getCoordinate(),r=this.addNode(e);r.add(t)};ds.prototype.interfaces_=function(){return[]};ds.prototype.getClass=function(){return ds};var cn=function(){},Kp={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};cn.prototype.interfaces_=function(){return[]};cn.prototype.getClass=function(){return cn};cn.isNorthern=function(t){return t===cn.NE||t===cn.NW};cn.isOpposite=function(t,e){if(t===e)return!1;var r=(t-e+4)%4;return r===2};cn.commonHalfPlane=function(t,e){if(t===e)return t;var r=(t-e+4)%4;if(r===2)return-1;var s=te?t:e;return s===0&&l===3?3:s};cn.isInHalfPlane=function(t,e){return e===cn.SE?t===cn.SE||t===cn.SW:t===e||t===e+1};cn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new Mn("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?cn.NE:cn.SE:e>=0?cn.NW:cn.SW}else if(arguments[0]instanceof ct&&arguments[1]instanceof ct){var r=arguments[0],s=arguments[1];if(s.x===r.x&&s.y===r.y)throw new Mn("Cannot compute the quadrant for two identical points "+r);return s.x>=r.x?s.y>=r.y?cn.NE:cn.SE:s.y>=r.y?cn.NW:cn.SW}};Kp.NE.get=function(){return 0};Kp.NW.get=function(){return 1};Kp.SW.get=function(){return 2};Kp.SE.get=function(){return 3};Object.defineProperties(cn,Kp);var Qi=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],r=arguments[1],s=arguments[2],l=null;this._edge=e,this.init(r,s),this._label=l}else if(arguments.length===4){var p=arguments[0],m=arguments[1],c=arguments[2],S=arguments[3];this._edge=p,this.init(m,c),this._label=S}};Qi.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){m.linkDirectedEdgesForMinimalEdgeRings();var c=m.buildMinimalRings(),S=s.findShell(c);S!==null?(s.placePolygonHoles(S,c),e.add(S)):r.addAll(c)}else l.add(m)}return l};Fr.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var r=e.next();if(r.containsPoint(t))return!0}return!1};Fr.prototype.buildMaximalEdgeRings=function(t){for(var e=this,r=new qt,s=t.iterator();s.hasNext();){var l=s.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var p=new Aw(l,e._geometryFactory);r.add(p),p.setInResult()}}return r};Fr.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var s=r.next();s.isHole()&&s.setShell(t)}};Fr.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};Fr.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),s=r.getEnvelopeInternal(),l=r.getCoordinateN(0),p=null,m=null,c=e.iterator();c.hasNext();){var S=c.next(),L=S.getLinearRing(),R=L.getEnvelopeInternal();p!==null&&(m=p.getLinearRing().getEnvelopeInternal());var k=!1;R.contains(s)&&Kt.isPointInRing(l,L.getCoordinates())&&(k=!0),k&&(p===null||m.contains(R))&&(p=S)}return p};Fr.prototype.findShell=function(t){for(var e=0,r=null,s=t.iterator();s.hasNext();){var l=s.next();l.isHole()||(r=l,e++)}return Te.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r};Fr.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],r=arguments[1];Vn.linkResultDirectedEdges(r);var s=this.buildMaximalEdgeRings(e),l=new qt,p=this.buildMinimalEdgeRings(s,this._shellList,l);this.sortShellsAndHoles(p,this._shellList,l),this.placeFreeHoles(this._shellList,l)}};Fr.prototype.interfaces_=function(){return[]};Fr.prototype.getClass=function(){return Fr};var Jc=function(){};Jc.prototype.getBounds=function(){};Jc.prototype.interfaces_=function(){return[]};Jc.prototype.getClass=function(){return Jc};var Vo=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Vo.prototype.getItem=function(){return this._item};Vo.prototype.getBounds=function(){return this._bounds};Vo.prototype.interfaces_=function(){return[Jc,wo]};Vo.prototype.getClass=function(){return Vo};var ca=function(){this._size=null,this._items=null,this._size=0,this._items=new qt,this._items.add(null)};ca.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t};ca.prototype.size=function(){return this._size};ca.prototype.reorder=function(t){for(var e=this,r=null,s=this._items.get(t);t*2<=this._size&&(r=t*2,r!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(s)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,s)};ca.prototype.clear=function(){this._size=0,this._items.clear()};ca.prototype.isEmpty=function(){return this._size===0};ca.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var r=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(r/2)))<0;r/=2)e._items.set(r,e._items.get(Math.trunc(r/2)));this._items.set(r,t)};ca.prototype.interfaces_=function(){return[]};ca.prototype.getClass=function(){return ca};var Oa=function(){};Oa.prototype.visitItem=function(t){};Oa.prototype.interfaces_=function(){return[]};Oa.prototype.getClass=function(){return Oa};var gu=function(){};gu.prototype.insert=function(t,e){};gu.prototype.remove=function(t,e){};gu.prototype.query=function(){};gu.prototype.interfaces_=function(){return[]};gu.prototype.getClass=function(){return gu};var fi=function(){if(this._childBoundables=new qt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},q0={serialVersionUID:{configurable:!0}};fi.prototype.getLevel=function(){return this._level};fi.prototype.size=function(){return this._childBoundables.size()};fi.prototype.getChildBoundables=function(){return this._childBoundables};fi.prototype.addChildBoundable=function(t){Te.isTrue(this._bounds===null),this._childBoundables.add(t)};fi.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};fi.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};fi.prototype.interfaces_=function(){return[Jc,wo]};fi.prototype.getClass=function(){return fi};q0.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(fi,q0);var Uo=function(){};Uo.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Uo.min=function(t){return Uo.sort(t),t.get(0)};Uo.sort=function(t,e){var r=t.toArray();e?_l.sort(r,e):_l.sort(r);for(var s=t.iterator(),l=0,p=r.length;loi.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(s)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Mn("neither boundable is composite")};oi.prototype.isLeaves=function(){return!(oi.isComposite(this._boundable1)||oi.isComposite(this._boundable2))};oi.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};oi.prototype.expand=function(t,e,r,s){for(var l=this,p=t.getChildBoundables(),m=p.iterator();m.hasNext();){var c=m.next(),S=new oi(c,e,l._itemDistance);S.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},Nf={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Ni.prototype.getNodeCapacity=function(){return this._nodeCapacity};Ni.prototype.lastNode=function(t){return t.get(t.size()-1)};Ni.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],r=0,s=e.getChildBoundables().iterator();s.hasNext();){var l=s.next();l instanceof fi?r+=t.size(l):l instanceof Vo&&(r+=1)}return r}};Ni.prototype.removeItem=function(t,e){for(var r=null,s=t.getChildBoundables().iterator();s.hasNext();){var l=s.next();l instanceof Vo&&l.getItem()===e&&(r=l)}return r!==null?(t.getChildBoundables().remove(r),!0):!1};Ni.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new qt:e}else if(arguments.length===1){for(var r=arguments[0],s=new qt,l=r.getChildBoundables().iterator();l.hasNext();){var p=l.next();if(p instanceof fi){var m=t.itemsTree(p);m!==null&&s.add(m)}else p instanceof Vo?s.add(p.getItem()):Te.shouldNeverReachHere()}return s.size()<=0?null:s}};Ni.prototype.insert=function(t,e){Te.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Vo(t,e))};Ni.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],r=new qt;return this.boundablesAtLevel(e,this._root,r),r}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];if(Te.isTrue(s>-2),l.getLevel()===s)return p.add(l),null;for(var m=l.getChildBoundables().iterator();m.hasNext();){var c=m.next();c instanceof fi?t.boundablesAtLevel(s,c,p):(Te.isTrue(c instanceof Vo),s===-1&&p.add(c))}return null}};Ni.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var r=new qt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}else if(arguments.length===2){var s=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,l)}else if(arguments.length===3){if(me(arguments[2],Oa)&&arguments[0]instanceof Object&&arguments[1]instanceof fi)for(var p=arguments[0],m=arguments[1],c=arguments[2],S=m.getChildBoundables(),L=0;Lr&&(r=p)}}return r+1}};Ni.prototype.createParentBoundables=function(t,e){var r=this;Te.isTrue(!t.isEmpty());var s=new qt;s.add(this.createNode(e));var l=new qt(t);Uo.sort(l,this.getComparator());for(var p=l.iterator();p.hasNext();){var m=p.next();r.lastNode(s).getChildBoundables().size()===r.getNodeCapacity()&&s.add(r.createNode(e)),r.lastNode(s).addChildBoundable(m)}return s};Ni.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};Ni.prototype.interfaces_=function(){return[wo]};Ni.prototype.getClass=function(){return Ni};Ni.compareDoubles=function(t,e){return t>e?1:t0);for(var m=new qt,c=0;c0;){var pt=ut.poll(),vt=pt.getDistance();if(vt>=k)break;pt.isLeaves()?(k=vt,U=pt):pt.expandToQueue(ut,k)}return[U.getBoundable(0).getItem(),U.getBoundable(1).getItem()]}}else if(arguments.length===3){var bt=arguments[0],Dt=arguments[1],Rt=arguments[2],Gt=new Vo(bt,Dt),se=new oi(this.getRoot(),Gt,Rt);return this.nearestNeighbour(se)[0]}},e.prototype.interfaces_=function(){return[gu,wo]},e.prototype.getClass=function(){return e},e.centreX=function(s){return e.avg(s.getMinX(),s.getMaxX())},e.avg=function(s,l){return(s+l)/2},e.centreY=function(s){return e.avg(s.getMinY(),s.getMaxY())},r.STRtreeNode.get=function(){return Hy},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[qc]},compare:function(s,l){return t.compareDoubles(e.centreX(s.getBounds()),e.centreX(l.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[qc]},compare:function(s,l){return t.compareDoubles(e.centreY(s.getBounds()),e.centreY(l.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(s,l){return s.intersects(l)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(Ni),Hy=function(t){function e(){var r=arguments[0];t.call(this,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var r=null,s=this.getChildBoundables().iterator();s.hasNext();){var l=s.next();r===null?r=new re(l.getBounds()):r.expandToInclude(l.getBounds())}return r},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fi),xr=function(){};xr.prototype.interfaces_=function(){return[]};xr.prototype.getClass=function(){return xr};xr.relativeSign=function(t,e){return te?1:0};xr.compare=function(t,e,r){if(e.equals2D(r))return 0;var s=xr.relativeSign(e.x,r.x),l=xr.relativeSign(e.y,r.y);switch(t){case 0:return xr.compareValue(s,l);case 1:return xr.compareValue(l,s);case 2:return xr.compareValue(l,-s);case 3:return xr.compareValue(-s,l);case 4:return xr.compareValue(-s,-l);case 5:return xr.compareValue(-l,-s);case 6:return xr.compareValue(-l,s);case 7:return xr.compareValue(s,-l)}return Te.shouldNeverReachHere("invalid octant value"),0};xr.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Fa=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],s=arguments[3];this._segString=t,this.coord=new ct(e),this.segmentIndex=r,this._segmentOctant=s,this._isInterior=!e.equals2D(t.getCoordinate(r))};Fa.prototype.getCoordinate=function(){return this.coord};Fa.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};Fa.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:xr.compare(this._segmentOctant,this.coord,e.coord)};Fa.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};Fa.prototype.isInterior=function(){return this._isInterior};Fa.prototype.interfaces_=function(){return[bo]};Fa.prototype.getClass=function(){return Fa};var hr=function(){this._nodeMap=new Ji,this._edge=null;var t=arguments[0];this._edge=t};hr.prototype.getSplitCoordinates=function(){var t=this,e=new Xp;this.addEndpoints();for(var r=this.iterator(),s=r.next();r.hasNext();){var l=r.next();t.addEdgeCoordinates(s,l,e),s=l}return e.toCoordinateArray()};hr.prototype.addCollapsedNodes=function(){var t=this,e=new qt;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var r=e.iterator();r.hasNext();){var s=r.next().intValue();t.add(t._edge.getCoordinate(s),s)}};hr.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var r=e.next();r.print(t)}};hr.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,r=0;r=0?e>=0?r>=s?0:1:r>=s?7:6:e>=0?r>=s?3:2:r>=s?4:5}else if(arguments[0]instanceof ct&&arguments[1]instanceof ct){var l=arguments[0],p=arguments[1],m=p.x-l.x,c=p.y-l.y;if(m===0&&c===0)throw new Mn("Cannot compute the octant for two identical points "+l);return _u.octant(m,c)}};var zs=function(){};zs.prototype.getCoordinates=function(){};zs.prototype.size=function(){};zs.prototype.getCoordinate=function(t){};zs.prototype.isClosed=function(){};zs.prototype.setData=function(t){};zs.prototype.getData=function(){};zs.prototype.interfaces_=function(){return[]};zs.prototype.getClass=function(){return zs};var Op=function(){};Op.prototype.addIntersection=function(t,e){};Op.prototype.interfaces_=function(){return[zs]};Op.prototype.getClass=function(){return Op};var ni=function(){this._nodeList=new hr(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};ni.prototype.getCoordinates=function(){return this._pts};ni.prototype.size=function(){return this._pts.length};ni.prototype.getCoordinate=function(t){return this._pts[t]};ni.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ni.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};ni.prototype.setData=function(t){this._data=t};ni.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:_u.octant(t,e)};ni.prototype.getData=function(){return this._data};ni.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var r=arguments[0],s=arguments[1],l=arguments[3],p=new ct(r.getIntersection(l));this.addIntersection(p,s)}};ni.prototype.toString=function(){return Fo.toLineString(new $n(this._pts))};ni.prototype.getNodeList=function(){return this._nodeList};ni.prototype.addIntersectionNode=function(t,e){var r=e,s=r+1;if(s=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}else if(arguments[0]instanceof ct){var s=arguments[0];return Kt.orientationIndex(this.p0,this.p1,s)}};oe.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};oe.prototype.isVertical=function(){return this.p0.x===this.p1.x};oe.prototype.equals=function(t){if(!(t instanceof oe))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};oe.prototype.intersection=function(t){var e=new Al;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};oe.prototype.project=function(){if(arguments[0]instanceof ct){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new ct(t);var e=this.projectionFactor(t),r=new ct;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}else if(arguments[0]instanceof oe){var s=arguments[0],l=this.projectionFactor(s.p0),p=this.projectionFactor(s.p1);if(l>=1&&p>=1||l<=0&&p<=0)return null;var m=this.project(s.p0);l<0&&(m=this.p0),l>1&&(m=this.p1);var c=this.project(s.p1);return p<0&&(c=this.p0),p>1&&(c=this.p1),new oe(m,c)}};oe.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};oe.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};oe.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};oe.prototype.distancePerpendicular=function(t){return Kt.distancePointLinePerpendicular(t,this.p0,this.p1)};oe.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};oe.prototype.midPoint=function(){return oe.midPoint(this.p0,this.p1)};oe.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,s=e*e+r*r;if(s<=0)return xe.NaN;var l=((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/s;return l};oe.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var r=new Array(2).fill(null),s=xe.MAX_VALUE,l=null,p=this.closestPoint(t.p0);s=p.distance(t.p0),r[0]=p,r[1]=t.p0;var m=this.closestPoint(t.p1);l=m.distance(t.p1),l0&&e<1)return this.project(t);var r=this.p0.distance(t),s=this.p1.distance(t);return r1||xe.isNaN(e))&&(e=1),e};oe.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};oe.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};oe.prototype.distance=function(){if(arguments[0]instanceof oe){var t=arguments[0];return Kt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof ct){var e=arguments[0];return Kt.distancePointLine(e,this.p0,this.p1)}};oe.prototype.pointAlong=function(t){var e=new ct;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e};oe.prototype.hashCode=function(){var t=xe.doubleToLongBits(this.p0.x);t^=xe.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),r=xe.doubleToLongBits(this.p1.x);r^=xe.doubleToLongBits(this.p1.y)*31;var s=Math.trunc(r)^Math.trunc(r>>32);return e^s};oe.prototype.interfaces_=function(){return[bo,wo]};oe.prototype.getClass=function(){return oe};oe.midPoint=function(t,e){return new ct((t.x+e.x)/2,(t.y+e.y)/2)};j0.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(oe,j0);var Fp=function(){this.tempEnv1=new re,this.tempEnv2=new re,this._overlapSeg1=new oe,this._overlapSeg2=new oe};Fp.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],r=arguments[2],s=arguments[3];t.getLineSegment(e,this._overlapSeg1),r.getLineSegment(s,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Fp.prototype.interfaces_=function(){return[]};Fp.prototype.getClass=function(){return Fp};var Br=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],r=arguments[2],s=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=s};Br.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Br.prototype.computeSelect=function(t,e,r,s){var l=this._pts[e],p=this._pts[r];if(s.tempEnv1.init(l,p),r-e===1)return s.select(this,e),null;if(!t.intersects(s.tempEnv1))return null;var m=Math.trunc((e+r)/2);e=t.length-1)return t.length-1;for(var s=cn.quadrant(t[r],t[r+1]),l=e+1;lm.getId()&&(m.computeOverlaps(L,l),s._nOverlaps++),s._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return Wy},Object.defineProperties(e,r),e}(Bp),Wy=function(t){function e(){t.call(this),this._si=null;var r=arguments[0];this._si=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var r=arguments[0],s=arguments[1],l=arguments[2],p=arguments[3],m=r.getContext(),c=l.getContext();this._si.processIntersections(m,s,c,p)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Fp),Je=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(s)}else if(arguments.length===4){var l=arguments[0],p=arguments[1],m=arguments[2],c=arguments[3];this.setQuadrantSegments(l),this.setEndCapStyle(p),this.setJoinStyle(m),this.setMitreLimit(c)}}},da={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Je.prototype.getEndCapStyle=function(){return this._endCapStyle};Je.prototype.isSingleSided=function(){return this._isSingleSided};Je.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Je.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Je.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Je.JOIN_ROUND&&(this._quadrantSegments=Je.DEFAULT_QUADRANT_SEGMENTS)};Je.prototype.getJoinStyle=function(){return this._joinStyle};Je.prototype.setJoinStyle=function(t){this._joinStyle=t};Je.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Je.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Je.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Je.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Je.prototype.getMitreLimit=function(){return this._mitreLimit};Je.prototype.setMitreLimit=function(t){this._mitreLimit=t};Je.prototype.setSingleSided=function(t){this._isSingleSided=t};Je.prototype.interfaces_=function(){return[]};Je.prototype.getClass=function(){return Je};Je.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};da.CAP_ROUND.get=function(){return 1};da.CAP_FLAT.get=function(){return 2};da.CAP_SQUARE.get=function(){return 3};da.JOIN_ROUND.get=function(){return 1};da.JOIN_MITRE.get=function(){return 2};da.JOIN_BEVEL.get=function(){return 3};da.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};da.DEFAULT_MITRE_LIMIT.get=function(){return 5};da.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Je,da);var Hn=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Kt.COUNTERCLOCKWISE,this._inputLine=t||null},Jp={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Hn.prototype.isDeletable=function(t,e,r,s){var l=this._inputLine[t],p=this._inputLine[e],m=this._inputLine[r];return!this.isConcave(l,p,m)||!this.isShallow(l,p,m,s)?!1:this.isShallowSampled(l,p,t,r,s)};Hn.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),s=this.findNextNonDeletedIndex(r),l=!1;s=0;l--)r.addPt(t[l])};ro.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),r=t.distance(e);return rMath.PI;)t-=Ge.PI_TIMES_2;for(;t<=-Math.PI;)t+=Ge.PI_TIMES_2;return t};Ge.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],r=arguments[1],s=r.x-e.x,l=r.y-e.y;return Math.atan2(l,s)}};Ge.isAcute=function(t,e,r){var s=t.x-e.x,l=t.y-e.y,p=r.x-e.x,m=r.y-e.y,c=s*p+l*m;return c>0};Ge.isObtuse=function(t,e,r){var s=t.x-e.x,l=t.y-e.y,p=r.x-e.x,m=r.y-e.y,c=s*p+l*m;return c<0};Ge.interiorAngle=function(t,e,r){var s=Ge.angle(e,t),l=Ge.angle(e,r);return Math.abs(l-s)};Ge.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Ge.PI_TIMES_2;t>=Ge.PI_TIMES_2&&(t=0)}else{for(;t>=Ge.PI_TIMES_2;)t-=Ge.PI_TIMES_2;t<0&&(t=0)}return t};Ge.angleBetween=function(t,e,r){var s=Ge.angle(e,t),l=Ge.angle(e,r);return Ge.diff(s,l)};Ge.diff=function(t,e){var r=null;return tMath.PI&&(r=2*Math.PI-r),r};Ge.toRadians=function(t){return t*Math.PI/180};Ge.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?Ge.COUNTERCLOCKWISE:r<0?Ge.CLOCKWISE:Ge.NONE};Ge.angleBetweenOriented=function(t,e,r){var s=Ge.angle(e,t),l=Ge.angle(e,r),p=l-s;return p<=-Math.PI?p+Ge.PI_TIMES_2:p>Math.PI?p-Ge.PI_TIMES_2:p};Mu.PI_TIMES_2.get=function(){return 2*Math.PI};Mu.PI_OVER_2.get=function(){return Math.PI/2};Mu.PI_OVER_4.get=function(){return Math.PI/4};Mu.COUNTERCLOCKWISE.get=function(){return Kt.COUNTERCLOCKWISE};Mu.CLOCKWISE.get=function(){return Kt.CLOCKWISE};Mu.NONE.get=function(){return Kt.COLLINEAR};Object.defineProperties(Ge,Mu);var Ln=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new oe,this._seg1=new oe,this._offset0=new oe,this._offset1=new oe,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],s=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new Al,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===Je.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(s)},Qp={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Ln.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=Kt.computeOrientation(this._s0,this._s1,this._s2),s=r===Kt.CLOCKWISE&&this._side===kt.LEFT||r===Kt.COUNTERCLOCKWISE&&this._side===kt.RIGHT;r===0?this.addCollinear(e):s?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)};Ln.prototype.addLineEndCap=function(t,e){var r=new oe(t,e),s=new oe;this.computeOffsetSegment(r,kt.LEFT,this._distance,s);var l=new oe;this.computeOffsetSegment(r,kt.RIGHT,this._distance,l);var p=e.x-t.x,m=e.y-t.y,c=Math.atan2(m,p);switch(this._bufParams.getEndCapStyle()){case Je.CAP_ROUND:this._segList.addPt(s.p1),this.addFilletArc(e,c+Math.PI/2,c-Math.PI/2,Kt.CLOCKWISE,this._distance),this._segList.addPt(l.p1);break;case Je.CAP_FLAT:this._segList.addPt(s.p1),this._segList.addPt(l.p1);break;case Je.CAP_SQUARE:var S=new ct;S.x=Math.abs(this._distance)*Math.cos(c),S.y=Math.abs(this._distance)*Math.sin(c);var L=new ct(s.p1.x+S.x,s.p1.y+S.y),R=new ct(l.p1.x+S.x,l.p1.y+S.y);this._segList.addPt(L),this._segList.addPt(R);break}};Ln.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};Ln.prototype.addMitreJoin=function(t,e,r,s){var l=!0,p=null;try{p=zo.intersection(e.p0,e.p1,r.p0,r.p1);var m=s<=0?1:p.distance(t)/Math.abs(s);m>this._bufParams.getMitreLimit()&&(l=!1)}catch(c){if(c instanceof lh)p=new ct(0,0),l=!1;else throw c}finally{}l?this._segList.addPt(p):this.addLimitedMitreJoin(e,r,s,this._bufParams.getMitreLimit())};Ln.prototype.addFilletCorner=function(t,e,r,s,l){var p=e.x-t.x,m=e.y-t.y,c=Math.atan2(m,p),S=r.x-t.x,L=r.y-t.y,R=Math.atan2(L,S);s===Kt.CLOCKWISE?c<=R&&(c+=2*Math.PI):c>=R&&(c-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,c,R,s,l),this._segList.addPt(r)};Ln.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var r=new ct((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var s=new ct((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};Ln.prototype.createCircle=function(t){var e=new ct(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};Ln.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};Ln.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new ro,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Ln.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};Ln.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===Je.JOIN_BEVEL||this._bufParams.getJoinStyle()===Je.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,Kt.CLOCKWISE,this._distance))};Ln.prototype.closeRing=function(){this._segList.closeRing()};Ln.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};Ln.prototype.interfaces_=function(){return[]};Ln.prototype.getClass=function(){return Ln};Qp.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Qp.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Qp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Qp.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(Ln,Qp);var Er=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Er.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var r=e<0,s=Math.abs(e),l=this.getSegGen(s);t.length<=1?this.computePointCurve(t[0],l):this.computeOffsetCurve(t,r,l);var p=l.getCoordinates();return r&&Oe.reverse(p),p};Er.prototype.computeSingleSidedBufferCurve=function(t,e,r){var s=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var l=Hn.simplify(t,-s),p=l.length-1;r.initSideSegments(l[p],l[p-1],kt.LEFT),r.addFirstSegment();for(var m=p-2;m>=0;m--)r.addNextSegment(l[m],!0)}else{r.addSegments(t,!1);var c=Hn.simplify(t,s),S=c.length-1;r.initSideSegments(c[0],c[1],kt.LEFT),r.addFirstSegment();for(var L=2;L<=S;L++)r.addNextSegment(c[L],!0)}r.addLastSegment(),r.closeRing()};Er.prototype.computeRingBufferCurve=function(t,e,r){var s=this.simplifyTolerance(this._distance);e===kt.RIGHT&&(s=-s);var l=Hn.simplify(t,s),p=l.length-1;r.initSideSegments(l[p-1],l[0],e);for(var m=1;m<=p;m++){var c=m!==1;r.addNextSegment(l[m],c)}r.closeRing()};Er.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),s=Hn.simplify(t,r),l=s.length-1;e.initSideSegments(s[0],s[1],kt.LEFT);for(var p=2;p<=l;p++)e.addNextSegment(s[p],!0);e.addLastSegment(),e.addLineEndCap(s[l-1],s[l]);var m=Hn.simplify(t,-r),c=m.length-1;e.initSideSegments(m[c],m[c-1],kt.LEFT);for(var S=c-2;S>=0;S--)e.addNextSegment(m[S],!0);e.addLastSegment(),e.addLineEndCap(m[1],m[0]),e.closeRing()};Er.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Je.CAP_ROUND:e.createCircle(t);break;case Je.CAP_SQUARE:e.createSquare(t);break}};Er.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var r=Math.abs(e),s=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],s);else if(this._bufParams.isSingleSided()){var l=e<0;this.computeSingleSidedBufferCurve(t,l,s)}else this.computeLineBufferCurve(t,s);var p=s.getCoordinates();return p};Er.prototype.getBufferParameters=function(){return this._bufParams};Er.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};Er.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(r===0)return Er.copyCoordinates(t);var s=this.getSegGen(r);return this.computeRingBufferCurve(t,e,s),s.getCoordinates()};Er.prototype.computeOffsetCurve=function(t,e,r){var s=this.simplifyTolerance(this._distance);if(e){var l=Hn.simplify(t,-s),p=l.length-1;r.initSideSegments(l[p],l[p-1],kt.LEFT),r.addFirstSegment();for(var m=p-2;m>=0;m--)r.addNextSegment(l[m],!0)}else{var c=Hn.simplify(t,s),S=c.length-1;r.initSideSegments(c[0],c[1],kt.LEFT),r.addFirstSegment();for(var L=2;L<=S;L++)r.addNextSegment(c[L],!0)}r.addLastSegment()};Er.prototype.getSegGen=function(t){return new Ln(this._precisionModel,this._bufParams,t)};Er.prototype.interfaces_=function(){return[]};Er.prototype.getClass=function(){return Er};Er.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;rp.getMaxY()||t.findStabbedSegments(e,l.getDirectedEdges(),r)}return r}else if(arguments.length===3){if(me(arguments[2],Oo)&&arguments[0]instanceof ct&&arguments[1]instanceof lg)for(var m=arguments[0],c=arguments[1],S=arguments[2],L=c.getEdge().getCoordinates(),R=0;Rt._seg.p1.y&&t._seg.reverse();var k=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(kt._seg.p1.y)&&Kt.computeOrientation(t._seg.p0,t._seg.p1,m)!==Kt.RIGHT){var U=c.getDepth(kt.LEFT);t._seg.p0.equals(L[R])||(U=c.getDepth(kt.RIGHT));var ut=new Il(t._seg,U);S.add(ut)}}else if(me(arguments[2],Oo)&&arguments[0]instanceof ct&&me(arguments[1],Oo))for(var pt=arguments[0],vt=arguments[1],bt=arguments[2],Dt=vt.iterator();Dt.hasNext();){var Rt=Dt.next();Rt.isForward()&&t.findStabbedSegments(pt,Rt,bt)}}};yu.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var r=Uo.min(e);return r._leftDepth};yu.prototype.interfaces_=function(){return[]};yu.prototype.getClass=function(){return yu};H0.DepthSegment.get=function(){return Il};Object.defineProperties(yu,H0);var Il=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new oe(t),this._leftDepth=e};Il.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(e._upwardSeg);return r!==0||(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg),r!==0)?r:this._upwardSeg.compareTo(e._upwardSeg)};Il.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return r!==0?r:t.p1.compareTo(e.p1)};Il.prototype.toString=function(){return this._upwardSeg.toString()};Il.prototype.interfaces_=function(){return[bo]};Il.prototype.getClass=function(){return Il};var Qe=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};Qe.prototype.area=function(){return Qe.area(this.p0,this.p1,this.p2)};Qe.prototype.signedArea=function(){return Qe.signedArea(this.p0,this.p1,this.p2)};Qe.prototype.interpolateZ=function(t){if(t===null)throw new Mn("Supplied point is null.");return Qe.interpolateZ(t,this.p0,this.p1,this.p2)};Qe.prototype.longestSideLength=function(){return Qe.longestSideLength(this.p0,this.p1,this.p2)};Qe.prototype.isAcute=function(){return Qe.isAcute(this.p0,this.p1,this.p2)};Qe.prototype.circumcentre=function(){return Qe.circumcentre(this.p0,this.p1,this.p2)};Qe.prototype.area3D=function(){return Qe.area3D(this.p0,this.p1,this.p2)};Qe.prototype.centroid=function(){return Qe.centroid(this.p0,this.p1,this.p2)};Qe.prototype.inCentre=function(){return Qe.inCentre(this.p0,this.p1,this.p2)};Qe.prototype.interfaces_=function(){return[]};Qe.prototype.getClass=function(){return Qe};Qe.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)};Qe.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2};Qe.det=function(t,e,r,s){return t*s-e*r};Qe.interpolateZ=function(t,e,r,s){var l=e.x,p=e.y,m=r.x-l,c=s.x-l,S=r.y-p,L=s.y-p,R=m*L-c*S,k=t.x-l,U=t.y-p,ut=(L*k-c*U)/R,pt=(-S*k+m*U)/R,vt=e.z+ut*(r.z-e.z)+pt*(s.z-e.z);return vt};Qe.longestSideLength=function(t,e,r){var s=t.distance(e),l=e.distance(r),p=r.distance(t),m=s;return l>m&&(m=l),p>m&&(m=p),m};Qe.isAcute=function(t,e,r){return!(!Ge.isAcute(t,e,r)||!Ge.isAcute(e,r,t)||!Ge.isAcute(r,t,e))};Qe.circumcentre=function(t,e,r){var s=r.x,l=r.y,p=t.x-s,m=t.y-l,c=e.x-s,S=e.y-l,L=2*Qe.det(p,m,c,S),R=Qe.det(m,p*p+m*m,S,c*c+S*S),k=Qe.det(p,p*p+m*m,c,c*c+S*S),U=s-R/L,ut=l+k/L;return new ct(U,ut)};Qe.perpendicularBisector=function(t,e){var r=e.x-t.x,s=e.y-t.y,l=new zo(t.x+r/2,t.y+s/2,1),p=new zo(t.x-s+r/2,t.y+r+s/2,1);return new zo(l,p)};Qe.angleBisector=function(t,e,r){var s=e.distance(t),l=e.distance(r),p=s/(s+l),m=r.x-t.x,c=r.y-t.y,S=new ct(t.x+p*m,t.y+p*c);return S};Qe.area3D=function(t,e,r){var s=e.x-t.x,l=e.y-t.y,p=e.z-t.z,m=r.x-t.x,c=r.y-t.y,S=r.z-t.z,L=l*S-p*c,R=p*m-s*S,k=s*c-l*m,U=L*L+R*R+k*k,ut=Math.sqrt(U)/2;return ut};Qe.centroid=function(t,e,r){var s=(t.x+e.x+r.x)/3,l=(t.y+e.y+r.y)/3;return new ct(s,l)};Qe.inCentre=function(t,e,r){var s=e.distance(r),l=t.distance(r),p=t.distance(e),m=s+l+p,c=(s*t.x+l*e.x+p*r.x)/m,S=(s*t.y+l*e.y+p*r.y)/m;return new ct(c,S)};var yo=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new qt;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};yo.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,dt.EXTERIOR,dt.INTERIOR)};yo.prototype.addPolygon=function(t){var e=this,r=this._distance,s=kt.LEFT;this._distance<0&&(r=-this._distance,s=kt.RIGHT);var l=t.getExteriorRing(),p=Oe.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&p.length<3)return null;this.addPolygonRing(p,r,s,dt.EXTERIOR,dt.INTERIOR);for(var m=0;m0&&e.isErodedCompletely(c,-e._distance)||e.addPolygonRing(S,r,kt.opposite(s),dt.INTERIOR,dt.EXTERIOR)}};yo.prototype.isTriangleErodedCompletely=function(t,e){var r=new Qe(t[0],t[1],t[2]),s=r.inCentre(),l=Kt.distancePointLine(s,r.p0,r.p1);return l=Ns.MINIMUM_VALID_SIZE&&Kt.isCCW(t)&&(p=l,m=s,r=kt.opposite(r));var c=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(c,p,m)};yo.prototype.add=function(t){if(t.isEmpty())return null;t instanceof mi?this.addPolygon(t):t instanceof Zn?this.addLineString(t):t instanceof Or?this.addPoint(t):t instanceof Yc?this.addCollection(t):t instanceof bl?this.addCollection(t):t instanceof Ms?this.addCollection(t):t instanceof ur&&this.addCollection(t)};yo.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(r.length===4)return this.isTriangleErodedCompletely(r,e);var s=t.getEnvelopeInternal(),l=Math.min(s.getHeight(),s.getWidth());return e<0&&2*Math.abs(e)>l};yo.prototype.addCollection=function(t){for(var e=this,r=0;r=this._max)throw new ch;var t=this._parent.getGeometryN(this._index++);return t instanceof ur?(this._subcollectionIterator=new Ds(t),this._subcollectionIterator.next()):t};Ds.prototype.remove=function(){throw new Error(this.getClass().getName())};Ds.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};Ds.prototype.interfaces_=function(){return[uh]};Ds.prototype.getClass=function(){return Ds};Ds.isAtomic=function(t){return!(t instanceof ur)};var to=function(){this._geom=null;var t=arguments[0];this._geom=t};to.prototype.locate=function(t){return to.locate(t,this._geom)};to.prototype.interfaces_=function(){return[$c]};to.prototype.getClass=function(){return to};to.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?Kt.isPointInRing(t,e.getCoordinates()):!1};to.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!to.isPointInRing(t,r))return!1;for(var s=0;s=0;p--){var m=r._edgeList.get(p),c=m.getSym();l===null&&(l=c),s!==null&&c.setNext(s),s=m}l.setNext(s)},e.prototype.computeDepths=function(){var r=this;if(arguments.length===1){var s=arguments[0],l=this.findIndex(s),p=s.getDepth(kt.LEFT),m=s.getDepth(kt.RIGHT),c=this.computeDepths(l+1,this._edgeList.size(),p),S=this.computeDepths(0,l,c);if(S!==m)throw new la("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var L=arguments[0],R=arguments[1],k=arguments[2],U=k,ct=L;ct=0;c--){var S=s._resultAreaEdgeList.get(c),L=S.getSym();switch(l===null&&S.getEdgeRing()===r&&(l=S),m){case s._SCANNING_FOR_INCOMING:if(L.getEdgeRing()!==r)continue;p=L,m=s._LINKING_TO_OUTGOING;break;case s._LINKING_TO_OUTGOING:if(S.getEdgeRing()!==r)continue;p.setNextMin(S),m=s._SCANNING_FOR_INCOMING;break}}m===this._LINKING_TO_OUTGOING&&(Se.isTrue(l!==null,"found null for first outgoing dirEdge"),Se.isTrue(l.getEdgeRing()===r,"unable to link last incoming dirEdge"),p.setNextMin(l))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var r=0,s=this.iterator();s.hasNext();){var l=s.next();l.isInResult()&&r++}return r}else if(arguments.length===1){for(var p=arguments[0],m=0,c=this.iterator();c.hasNext();){var S=c.next();S.getEdgeRing()===p&&m++}return m}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var r=ft.NONE,s=this.iterator();s.hasNext();){var l=s.next(),p=l.getSym();if(!l.isLineEdge()){if(l.isInResult()){r=ft.INTERIOR;break}if(p.isInResult()){r=ft.EXTERIOR;break}}}if(r===ft.NONE)return null;for(var m=r,c=this.iterator();c.hasNext();){var S=c.next(),L=S.getSym();S.isLineEdge()?S.getEdge().setCovered(m===ft.INTERIOR):(S.isInResult()&&(m=ft.EXTERIOR),L.isInResult()&&(m=ft.INTERIOR))}},e.prototype.computeLabelling=function(r){var s=this;t.prototype.computeLabelling.call(this,r),this._label=new tn(ft.NONE);for(var l=this.iterator();l.hasNext();)for(var p=l.next(),m=p.getEdge(),c=m.getLabel(),S=0;S<2;S++){var L=c.getLocation(S);(L===ft.INTERIOR||L===ft.BOUNDARY)&&s._label.setLocation(S,ft.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ki),W0=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(r){return new Rf(r,new Iw)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Kc),Oa=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Oa.prototype.compareTo=function(t){var e=t,r=Oa.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return r};Oa.prototype.interfaces_=function(){return[xo]};Oa.prototype.getClass=function(){return Oa};Oa.orientation=function(t){return ke.increasingDirection(t)===1};Oa.compareOriented=function(t,e,r,s){for(var l=e?1:-1,p=s?1:-1,m=e?t.length:-1,c=s?r.length:-1,S=e?0:t.length-1,L=s?0:r.length-1;;){var R=t[S].compareTo(r[L]);if(R!==0)return R;S+=l,L+=p;var k=S===m,U=L===c;if(k&&!U)return-1;if(!k&&U)return 1;if(k&&U)return 0}};var Vo=function(){this._edges=new qt,this._ocaMap=new Xi};Vo.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var r=0;r0&&t.print(","),t.print("(");for(var l=s.getCoordinates(),p=0;p0&&t.print(","),t.print(l[p].x+" "+l[p].y);t.println(")")}t.print(") ")};Vo.prototype.addAll=function(t){for(var e=this,r=t.iterator();r.hasNext();)e.add(r.next())};Vo.prototype.findEdgeIndex=function(t){for(var e=this,r=0;r0||!e.coord.equals2D(l);p||s--;var m=new Array(s).fill(null),c=0;m[c++]=new ht(t.coord);for(var S=t.segmentIndex+1;S<=e.segmentIndex;S++)m[c++]=r.edge.pts[S];return p&&(m[c]=e.coord),new vf(m,new tn(this.edge._label))};ks.prototype.add=function(t,e,r){var s=new ps(t,e,r),l=this._nodeMap.get(s);return l!==null?l:(this._nodeMap.put(s,s),s)};ks.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next();if(r.coord.equals(t))return!0}return!1};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};var Sl=function(){};Sl.prototype.getChainStartIndices=function(t){var e=this,r=0,s=new qt;s.add(new ss(r));do{var l=e.findChainEnd(t,r);s.add(new ss(l)),r=l}while(rr?e:r};ca.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return er&&(l=1),t._depth[e][s]=l}}};Fi.prototype.getDelta=function(t){return this._depth[t][kt.RIGHT]-this._depth[t][kt.LEFT]};Fi.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?ft.EXTERIOR:ft.INTERIOR};Fi.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Fi.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],r=0;r<2;r++)for(var s=1;s<3;s++){var l=e.getLocation(r,s);(l===ft.EXTERIOR||l===ft.INTERIOR)&&(t.isNull(r,s)?t._depth[r][s]=Fi.depthAtLocation(l):t._depth[r][s]+=Fi.depthAtLocation(l))}else if(arguments.length===3){var p=arguments[0],m=arguments[1],c=arguments[2];c===ft.INTERIOR&&this._depth[p][m]++}};Fi.prototype.interfaces_=function(){return[]};Fi.prototype.getClass=function(){return Fi};Fi.depthAtLocation=function(t){return t===ft.EXTERIOR?0:t===ft.INTERIOR?1:Fi.NULL_VALUE};X0.NULL_VALUE.get=function(){return-1};Object.defineProperties(Fi,X0);var vf=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new ks(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Fi,this._depthDelta=0,arguments.length===1){var r=arguments[0];e.call(this,r,null)}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.pts=s,this._label=l}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var r=new Array(2).fill(null);r[0]=this.pts[0],r[1]=this.pts[1];var s=new e(r,tn.toLineLabel(this._label));return s},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(r){this._isIsolated=r},e.prototype.setName=function(r){this._name=r},e.prototype.equals=function(r){var s=this;if(!(r instanceof e))return!1;var l=r;if(this.pts.length!==l.pts.length)return!1;for(var p=!0,m=!0,c=this.pts.length,S=0;S0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}},e.prototype.print=function(r){var s=this;r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var l=0;l0&&r.print(","),r.print(s.pts[l].x+" "+s.pts[l].y);r.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(r){e.updateIM(this._label,r)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(r){var s=this;r.print("edge "+this._name+": ");for(var l=this.pts.length-1;l>=0;l--)r.print(s.pts[l]+" ");r.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ca(this)),this._mce},e.prototype.getEnvelope=function(){var r=this;if(this._env===null){this._env=new ne;for(var s=0;s0&&s.append(","),s.append(r.pts[l].x+" "+r.pts[l].y);return s.append(") "+this._label+" "+this._depthDelta),s.toString()},e.prototype.isPointwiseEqual=function(r){var s=this;if(this.pts.length!==r.pts.length)return!1;for(var l=0;ls||this._maxyp;if(m)return!1;var c=this.intersectsToleranceSquare(t,e);return Se.isTrue(!(m&&c),"Found bad envelope test"),c};Er.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new ht(this._maxx,this._maxy),this._corner[1]=new ht(this._minx,this._maxy),this._corner[2]=new ht(this._minx,this._miny),this._corner[3]=new ht(this._maxx,this._miny)};Er.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};Er.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};Er.prototype.getCoordinate=function(){return this._originalPt};Er.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};Er.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=Er.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new ne(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};Er.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))};Er.prototype.intersectsToleranceSquare=function(t,e){var r=!1,s=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||r&&s||t.equals(this._pt)||e.equals(this._pt))};Er.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),s=t.getCoordinate(e+1);return this.intersects(r,s)?(t.addIntersection(this.getCoordinate(),e),!0):!1};Er.prototype.interfaces_=function(){return[]};Er.prototype.getClass=function(){return Er};K0.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(Er,K0);var Vp=function(){this.tempEnv1=new ne,this.selectedSegment=new ie};Vp.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}};Vp.prototype.interfaces_=function(){return[]};Vp.prototype.getClass=function(){return Vp};var th=function(){this._index=null;var t=arguments[0];this._index=t},J0={HotPixelSnapAction:{configurable:!0}};th.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],r=arguments[1],s=arguments[2],l=e.getSafeEnvelope(),p=new Q0(e,r,s);return this._index.query(l,{interfaces_:function(){return[ka]},visitItem:function(m){var c=m;c.select(l,p)}}),p.isNodeAdded()}};th.prototype.interfaces_=function(){return[]};th.prototype.getClass=function(){return th};J0.HotPixelSnapAction.get=function(){return Q0};Object.defineProperties(th,J0);var Q0=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var r=arguments[0],s=arguments[1],l=arguments[2];this._hotPixel=r,this._parentEdge=s,this._hotPixelVertexIndex=l}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var r=arguments[0],s=arguments[1],l=r.getContext();if(this._parentEdge!==null&&l===this._parentEdge&&s===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(l,s)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Vp),vu=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new qt};vu.prototype.processIntersections=function(t,e,r,s){var l=this;if(t===r&&e===s)return null;var p=t.getCoordinates()[e],m=t.getCoordinates()[e+1],c=r.getCoordinates()[s],S=r.getCoordinates()[s+1];if(this._li.computeIntersection(p,m,c,S),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var L=0;L=0;e--){try{t.bufferReducedPrecision(e)}catch(p){if(p instanceof la)t._saveException=p;else throw p}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var r=arguments[0],s=Hi.precisionScaleFactor(this._argGeom,this._distance,r),l=new Qe(s);this.bufferFixedPrecision(l)}};Hi.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Qe.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Hi.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Hi.prototype.bufferOriginalPrecision=function(){try{var t=new sr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof sa)this._saveException=e;else throw e}finally{}};Hi.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Hi.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Hi.prototype.interfaces_=function(){return[]};Hi.prototype.getClass=function(){return Hi};Hi.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],r=new Hi(t),s=r.getResultGeometry(e);return s}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof he&&typeof arguments[1]=="number"){var l=arguments[0],p=arguments[1],m=arguments[2],c=new Hi(l);c.setQuadrantSegments(m);var S=c.getResultGeometry(p);return S}else if(arguments[2]instanceof Ye&&arguments[0]instanceof he&&typeof arguments[1]=="number"){var L=arguments[0],R=arguments[1],k=arguments[2],U=new Hi(L,k),ct=U.getResultGeometry(R);return ct}}else if(arguments.length===4){var dt=arguments[0],bt=arguments[1],It=arguments[2],Dt=arguments[3],Rt=new Hi(dt);Rt.setQuadrantSegments(It),Rt.setEndCapStyle(Dt);var Gt=Rt.getResultGeometry(bt);return Gt}};Hi.precisionScaleFactor=function(t,e,r){var s=t.getEnvelopeInternal(),l=eo.max(Math.abs(s.getMaxX()),Math.abs(s.getMaxY()),Math.abs(s.getMinX()),Math.abs(s.getMinY())),p=e>0?e:0,m=l+2*p,c=Math.trunc(Math.log(m)/Math.log(10)+1),S=r-c,L=Math.pow(10,S);return L};hh.CAP_ROUND.get=function(){return Ye.CAP_ROUND};hh.CAP_BUTT.get=function(){return Ye.CAP_FLAT};hh.CAP_FLAT.get=function(){return Ye.CAP_FLAT};hh.CAP_SQUARE.get=function(){return Ye.CAP_SQUARE};hh.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Hi,hh);var rr=function(){this._pt=[new ht,new ht],this._distance=ye.NaN,this._isNull=!0};rr.prototype.getCoordinates=function(){return this._pt};rr.prototype.getCoordinate=function(t){return this._pt[t]};rr.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var s=e.distance(r);sthis._distance&&this.initialize(e,r,s)}};rr.prototype.interfaces_=function(){return[]};rr.prototype.getClass=function(){return rr};var Ts=function(){};Ts.prototype.interfaces_=function(){return[]};Ts.prototype.getClass=function(){return Ts};Ts.computeDistance=function(){if(arguments[2]instanceof rr&&arguments[0]instanceof Zn&&arguments[1]instanceof ht)for(var t=arguments[0],e=arguments[1],r=arguments[2],s=t.getCoordinates(),l=new ie,p=0;p0||this._isIn?ft.INTERIOR:ft.EXTERIOR)};Uo.prototype.interfaces_=function(){return[]};Uo.prototype.getClass=function(){return Uo};var or=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],r=arguments[1];t.call(this,e,t.INSIDE_AREA,r)}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];this._component=s,this._segIndex=l,this._pt=p}},$0={INSIDE_AREA:{configurable:!0}};or.prototype.isInsideArea=function(){return this._segIndex===or.INSIDE_AREA};or.prototype.getCoordinate=function(){return this._pt};or.prototype.getGeometryComponent=function(){return this._component};or.prototype.getSegmentIndex=function(){return this._segIndex};or.prototype.interfaces_=function(){return[]};or.prototype.getClass=function(){return or};$0.INSIDE_AREA.get=function(){return-1};Object.defineProperties(or,$0);var Da=function(t){this._pts=t||null};Da.prototype.filter=function(t){t instanceof zr&&this._pts.add(t)};Da.prototype.interfaces_=function(){return[ls]};Da.prototype.getClass=function(){return Da};Da.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof zr?Bo.singletonList(t):Da.getPoints(t,new qt)}else if(arguments.length===2){var e=arguments[0],r=arguments[1];return e instanceof zr?r.add(e):e instanceof ar&&e.apply(new Da(r)),r}};var bu=function(){this._locations=null;var t=arguments[0];this._locations=t};bu.prototype.filter=function(t){(t instanceof zr||t instanceof Zn||t instanceof di)&&this._locations.add(new or(t,0,t.getCoordinate()))};bu.prototype.interfaces_=function(){return[ls]};bu.prototype.getClass=function(){return bu};bu.getLocations=function(t){var e=new qt;return t.apply(new bu(e)),e};var Vi=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Uo,this._minDistanceLocation=null,this._minDistance=ye.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var r=arguments[0],s=arguments[1],l=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=s,this._terminateDistance=l}};Vi.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var r=arguments[0],s=arguments[1],l=1-r,p=oa.getPolygons(this._geom[r]);if(p.size()>0){var m=bu.getLocations(this._geom[l]);if(this.computeContainmentDistance(m,p,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[l]=s[0],this._minDistanceLocation[r]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&de(arguments[0],ko)&&de(arguments[1],ko)){for(var c=arguments[0],S=arguments[1],L=arguments[2],R=0;Rthis._minDistance)return null;for(var l=e.getCoordinates(),p=r.getCoordinate(),m=0;mthis._minDistance)return null;for(var ct=R.getCoordinates(),dt=k.getCoordinates(),bt=0;btthis._distance&&this.initialize(e,r,s)}};Wi.prototype.interfaces_=function(){return[]};Wi.prototype.getClass=function(){return Wi};var is=function(){};is.prototype.interfaces_=function(){return[]};is.prototype.getClass=function(){return is};is.computeDistance=function(){if(arguments[2]instanceof Wi&&arguments[0]instanceof Zn&&arguments[1]instanceof ht)for(var t=arguments[0],e=arguments[1],r=arguments[2],s=new ie,l=t.getCoordinates(),p=0;p1||t<=0)throw new Dn("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};fo.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};fo.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};fo.prototype.computeOrientedDistance=function(t,e,r){var s=new wu(e);if(t.apply(s),r.setMaximum(s.getMaxPointDistance()),this._densifyFrac>0){var l=new Va(e,this._densifyFrac);t.apply(l),r.setMaximum(l.getMaxPointDistance())}};fo.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};fo.prototype.interfaces_=function(){return[]};fo.prototype.getClass=function(){return fo};fo.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],r=new fo(t,e);return r.distance()}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2],m=new fo(s,l);return m.setDensifyFraction(p),m.distance()}};Cg.MaxPointDistanceFilter.get=function(){return wu};Cg.MaxDensifiedByFractionDistanceFilter.get=function(){return Va};Object.defineProperties(fo,Cg);var wu=function(){this._maxPtDist=new Wi,this._minPtDist=new Wi,this._euclideanDist=new is,this._geom=null;var t=arguments[0];this._geom=t};wu.prototype.filter=function(t){this._minPtDist.initialize(),is.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};wu.prototype.getMaxPointDistance=function(){return this._maxPtDist};wu.prototype.interfaces_=function(){return[Ms]};wu.prototype.getClass=function(){return wu};var Va=function(){this._maxPtDist=new Wi,this._minPtDist=new Wi,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Va.prototype.filter=function(t,e){var r=this;if(e===0)return null;for(var s=t.getCoordinate(e-1),l=t.getCoordinate(e),p=(l.x-s.x)/this._numSubSegs,m=(l.y-s.y)/this._numSubSegs,c=0;cr){this._isValid=!1;var l=s.getCoordinates();this._errorLocation=l[1],this._errorIndicator=t.getFactory().createLineString(l),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+zo.toLineString(l[0],l[1])+")"}};kr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=kr.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),kr.VERBOSE&&Bi.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};kr.prototype.checkNegativeValid=function(){if(!(this._input instanceof di||this._input instanceof Ps||this._input instanceof ar))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};kr.prototype.getErrorIndicator=function(){return this._errorIndicator};kr.prototype.checkMinimumDistance=function(t,e,r){var s=new Vi(t,e,r);if(this._minDistanceFound=s.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Ui.prototype.report=function(t){if(!Ui.VERBOSE)return null;Bi.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Ui.prototype.getErrorMessage=function(){return this._errorMsg};Ui.prototype.interfaces_=function(){return[]};Ui.prototype.getClass=function(){return Ui};Ui.isValidMsg=function(t,e,r){var s=new Ui(t,e,r);return s.isValid()?null:s.getErrorMessage()};Ui.isValid=function(t,e,r){var s=new Ui(t,e,r);return!!s.isValid()};Lg.VERBOSE.get=function(){return!1};Lg.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Ui,Lg);var fs=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};fs.prototype.getCoordinates=function(){return this._pts};fs.prototype.size=function(){return this._pts.length};fs.prototype.getCoordinate=function(t){return this._pts[t]};fs.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};fs.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:_u.octant(this.getCoordinate(t),this.getCoordinate(t+1))};fs.prototype.setData=function(t){this._data=t};fs.prototype.getData=function(){return this._data};fs.prototype.toString=function(){return zo.toLineString(new Qn(this._pts))};fs.prototype.interfaces_=function(){return[Ns]};fs.prototype.getClass=function(){return fs};var Ni=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new qt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Ni.prototype.getInteriorIntersection=function(){return this._interiorIntersection};Ni.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};Ni.prototype.getIntersectionSegments=function(){return this._intSegments};Ni.prototype.count=function(){return this._intersectionCount};Ni.prototype.getIntersections=function(){return this._intersections};Ni.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Ni.prototype.setKeepIntersections=function(t){this._keepIntersections=t};Ni.prototype.processIntersections=function(t,e,r,s){if(!this._findAllIntersections&&this.hasIntersection()||t===r&&e===s)return null;if(this._isCheckEndSegmentsOnly){var l=this.isEndSegment(t,e)||this.isEndSegment(r,s);if(!l)return null}var p=t.getCoordinates()[e],m=t.getCoordinates()[e+1],c=r.getCoordinates()[s],S=r.getCoordinates()[s+1];this._li.computeIntersection(p,m,c,S),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=p,this._intSegments[1]=m,this._intSegments[2]=c,this._intSegments[3]=S,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};Ni.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};Ni.prototype.hasIntersection=function(){return this._interiorIntersection!==null};Ni.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};Ni.prototype.interfaces_=function(){return[El]};Ni.prototype.getClass=function(){return Ni};Ni.createAllIntersectionsFinder=function(t){var e=new Ni(t);return e.setFindAllIntersections(!0),e};Ni.createAnyIntersectionFinder=function(t){return new Ni(t)};Ni.createIntersectionCounter=function(t){var e=new Ni(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var qo=function(){this._li=new Al,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};qo.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};qo.prototype.getIntersections=function(){return this._segInt.getIntersections()};qo.prototype.isValid=function(){return this.execute(),this._isValid};qo.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};qo.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Ni(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Eg;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};qo.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new la(this.getErrorMessage(),this._segInt.getInteriorIntersection())};qo.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+zo.toLineString(t[0],t[1])+" and "+zo.toLineString(t[2],t[3])};qo.prototype.interfaces_=function(){return[]};qo.prototype.getClass=function(){return qo};qo.computeIntersections=function(t){var e=new qo(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Tl=function t(){this._nv=null;var e=arguments[0];this._nv=new qo(t.toSegmentStrings(e))};Tl.prototype.checkValid=function(){this._nv.checkValid()};Tl.prototype.interfaces_=function(){return[]};Tl.prototype.getClass=function(){return Tl};Tl.toSegmentStrings=function(t){for(var e=new qt,r=t.iterator();r.hasNext();){var s=r.next();e.add(new fs(s.getCoordinates(),s))}return e};Tl.checkValid=function(t){var e=new Tl(t);e.checkValid()};var Iu=function(t){this._mapOp=t};Iu.prototype.map=function(t){for(var e=this,r=new qt,s=0;s0&&s<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)};Sr.prototype.interfaces_=function(){return[]};Sr.prototype.getClass=function(){return Sr};var Os=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ie,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Zn&&typeof arguments[1]=="number"){var e=arguments[0],r=arguments[1];t.call(this,e.getCoordinates(),r)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1];this._srcPts=s,this._isClosed=t.isClosed(s),this._snapTolerance=l}};Os.prototype.snapVertices=function(t,e){for(var r=this,s=this._isClosed?t.size()-1:t.size(),l=0;l=0&&t.add(m+1,new ht(p),!1)}};Os.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,s=ye.MAX_VALUE,l=-1,p=0;pe&&(e=s)}return e}else if(arguments.length===2){var l=arguments[0],p=arguments[1];return Math.min($n.computeOverlaySnapTolerance(l),$n.computeOverlaySnapTolerance(p))}};$n.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),r=Math.min(e.getHeight(),e.getWidth()),s=r*$n.SNAP_PRECISION_FACTOR;return s};$n.snapToSelf=function(t,e,r){var s=new $n(t);return s.snapToSelf(e,r)};tv.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties($n,tv);var ev=function(t){function e(r,s,l){t.call(this),this._snapTolerance=r||null,this._snapPts=s||null,this._isSelfSnap=l!==void 0?l:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(r,s){var l=new Os(r,this._snapTolerance);return l.setAllowSnappingToSourceVertices(this._isSelfSnap),l.snapTo(s)},e.prototype.transformCoordinates=function(r,s){var l=r.toCoordinateArray(),p=this.snapLine(l,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(p)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Sr),ir=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};ir.prototype.getCommon=function(){return ye.longBitsToDouble(this._commonBits)};ir.prototype.add=function(t){var e=ye.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=ir.signExpBits(this._commonBits),this._isFirst=!1,null;var r=ir.signExpBits(e);if(r!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=ir.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=ir.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};ir.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=ye.longBitsToDouble(t),r=ye.toBinaryString(t),s="0000000000000000000000000000000000000000000000000000000000000000"+r,l=s.substring(s.length-64),p=l.substring(0,1)+" "+l.substring(1,12)+"(exp) "+l.substring(12)+" [ "+e+" ]";return p}};ir.prototype.interfaces_=function(){return[]};ir.prototype.getClass=function(){return ir};ir.getBit=function(t,e){var r=1<>52};ir.zeroLowerBits=function(t,e){var r=(1<=0;s--){if(ir.getBit(t,s)!==ir.getBit(e,s))return r;r++}return 52};var Ua=function(){this._commonCoord=null,this._ccFilter=new Su},Pg={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Ua.prototype.addCommonBits=function(t){var e=new qa(this._commonCoord);t.apply(e),t.geometryChanged()};Ua.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new ht(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new qa(e);return t.apply(r),t.geometryChanged(),t};Ua.prototype.getCommonCoordinate=function(){return this._commonCoord};Ua.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};Ua.prototype.interfaces_=function(){return[]};Ua.prototype.getClass=function(){return Ua};Pg.CommonCoordinateFilter.get=function(){return Su};Pg.Translater.get=function(){return qa};Object.defineProperties(Ua,Pg);var Su=function(){this._commonBitsX=new ir,this._commonBitsY=new ir};Su.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};Su.prototype.getCommonCoordinate=function(){return new ht(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Su.prototype.interfaces_=function(){return[Ms]};Su.prototype.getClass=function(){return Su};var qa=function(){this.trans=null;var t=arguments[0];this.trans=t};qa.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,s=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,s)};qa.prototype.isDone=function(){return!1};qa.prototype.isGeometryChanged=function(){return!0};qa.prototype.interfaces_=function(){return[Oo]};qa.prototype.getClass=function(){return qa};var ki=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};ki.prototype.selfSnap=function(t){var e=new $n(t),r=e.snapTo(t,this._snapTolerance);return r};ki.prototype.removeCommonBits=function(t){this._cbr=new Ua,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e};ki.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};ki.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=xe.overlayOp(e[0],e[1],t);return this.prepareResult(r)};ki.prototype.checkValid=function(t){t.isValid()||Bi.out.println("Snapped geometry is invalid")};ki.prototype.computeSnapTolerance=function(){this._snapTolerance=$n.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};ki.prototype.snap=function(t){var e=this.removeCommonBits(t),r=$n.snap(e[0],e[1],this._snapTolerance);return r};ki.prototype.interfaces_=function(){return[]};ki.prototype.getClass=function(){return ki};ki.overlayOp=function(t,e,r){var s=new ki(t,e);return s.getResultGeometry(r)};ki.union=function(t,e){return ki.overlayOp(t,e,xe.UNION)};ki.intersection=function(t,e){return ki.overlayOp(t,e,xe.INTERSECTION)};ki.symDifference=function(t,e){return ki.overlayOp(t,e,xe.SYMDIFFERENCE)};ki.difference=function(t,e){return ki.overlayOp(t,e,xe.DIFFERENCE)};var cr=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};cr.prototype.getResultGeometry=function(t){var e=null,r=!1,s=null;try{e=xe.overlayOp(this._geom[0],this._geom[1],t);var l=!0;l&&(r=!0)}catch(p){if(p instanceof sa)s=p;else throw p}finally{}if(!r)try{e=ki.overlayOp(this._geom[0],this._geom[1],t)}catch(p){throw p instanceof sa?s:p}finally{}return e};cr.prototype.interfaces_=function(){return[]};cr.prototype.getClass=function(){return cr};cr.overlayOp=function(t,e,r){var s=new cr(t,e);return s.getResultGeometry(r)};cr.union=function(t,e){return cr.overlayOp(t,e,xe.UNION)};cr.intersection=function(t,e){return cr.overlayOp(t,e,xe.INTERSECTION)};cr.symDifference=function(t,e){return cr.overlayOp(t,e,xe.SYMDIFFERENCE)};cr.difference=function(t,e){return cr.overlayOp(t,e,xe.DIFFERENCE)};var Up=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Up.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};Up.prototype.interfaces_=function(){return[]};Up.prototype.getClass=function(){return Up};var Br=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];this._eventType=t.INSERT,this._label=s,this._xValue=l,this._obj=p}},Ag={INSERT:{configurable:!0},DELETE:{configurable:!0}};Br.prototype.isDelete=function(){return this._eventType===Br.DELETE};Br.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};Br.prototype.getObject=function(){return this._obj};Br.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};Br.prototype.getInsertEvent=function(){return this._insertEvent};Br.prototype.isInsert=function(){return this._eventType===Br.INSERT};Br.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};Br.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Br.prototype.interfaces_=function(){return[xo]};Br.prototype.getClass=function(){return Br};Ag.INSERT.get=function(){return 1};Ag.DELETE.get=function(){return 2};Object.defineProperties(Br,Ag);var xf=function(){};xf.prototype.interfaces_=function(){return[]};xf.prototype.getClass=function(){return xf};var qi=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};qi.prototype.isTrivialIntersection=function(t,e,r,s){if(t===r&&this._li.getIntersectionNum()===1){if(qi.isAdjacentSegments(e,s))return!0;if(t.isClosed()){var l=t.getNumPoints()-1;if(e===0&&s===l||s===0&&e===l)return!0}}return!1};qi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};qi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};qi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};qi.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var s=r.next(),l=s.getCoordinate();if(t.isIntersection(l))return!0}return!1};qi.prototype.hasProperIntersection=function(){return this._hasProper};qi.prototype.hasIntersection=function(){return this._hasIntersection};qi.prototype.isDone=function(){return this._isDone};qi.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};qi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};qi.prototype.addIntersections=function(t,e,r,s){if(t===r&&e===s)return null;this.numTests++;var l=t.getCoordinates()[e],p=t.getCoordinates()[e+1],m=r.getCoordinates()[s],c=r.getCoordinates()[s+1];this._li.computeIntersection(l,p,m,c),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,s)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),r.addIntersections(this._li,s,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};qi.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var Ew=function(t){function e(){t.call(this),this.events=new qt,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var r=this;Bo.sort(this.events);for(var s=0;se||this._maxp?1:0};qp.prototype.interfaces_=function(){return[qc]};qp.prototype.getClass=function(){return qp};var Sw=function(t){function e(){t.call(this),this._item=null;var r=arguments[0],s=arguments[1],l=arguments[2];this._min=r,this._max=s,this._item=l}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(r,s,l){if(!this.intersects(r,s))return null;l.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Fs),Cw=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var r=arguments[0],s=arguments[1];this._node1=r,this._node2=s,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(r,s){this._min=Math.min(r._min,s._min),this._max=Math.max(r._max,s._max)},e.prototype.query=function(r,s,l){if(!this.intersects(r,s))return null;this._node1!==null&&this._node1.query(r,s,l),this._node2!==null&&this._node2.query(r,s,l)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Fs),Bs=function(){this._leaves=new qt,this._root=null,this._level=0};Bs.prototype.buildTree=function(){var t=this;Bo.sort(this._leaves,new Fs.NodeComparator);for(var e=this._leaves,r=null,s=new qt;;){if(t.buildLevel(e,s),s.size()===1)return s.get(0);r=e,e=s,s=r}};Bs.prototype.insert=function(t,e,r){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Sw(t,e,r))};Bs.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)};Bs.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Bs.prototype.printNode=function(t){Bi.out.println(zo.toLineString(new ht(t._min,this._level),new ht(t._max,this._level)))};Bs.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Bs.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,s[0]),this.insertBoundaryPoint(this._argIndex,s[s.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var r=this.getBoundaryNodes(),s=new Array(r.size()).fill(null),l=0,p=r.iterator();p.hasNext();){var m=p.next();s[l++]=m.getCoordinate().copy()}return s},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(r,s,l){if(this.isBoundaryNode(r,s))return null;l===ft.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(r,s):this.insertPoint(r,s,l)},e.prototype.addPolygonRing=function(r,s,l){if(r.isEmpty())return null;var p=ke.removeRepeatedPoints(r.getCoordinates());if(p.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=p[0],null;var m=s,c=l;Yt.isCCW(p)&&(m=l,c=s);var S=new vf(p,new tn(this._argIndex,ft.BOUNDARY,m,c));this._lineEdgeMap.put(r,S),this.insertEdge(S),this.insertPoint(this._argIndex,p[0],ft.BOUNDARY)},e.prototype.insertPoint=function(r,s,l){var p=this._nodes.addNode(s),m=p.getLabel();m===null?p._label=new tn(r,l):m.setLocation(r,l)},e.prototype.createEdgeSetIntersector=function(){return new Ew},e.prototype.addSelfIntersectionNodes=function(r){for(var s=this,l=this._edges.iterator();l.hasNext();)for(var p=l.next(),m=p.getLabel().getLocation(r),c=p.eiList.iterator();c.hasNext();){var S=c.next();s.addSelfIntersectionNode(r,S.coord,m)}},e.prototype.add=function(){if(arguments.length===1){var r=arguments[0];if(r.isEmpty())return null;if(r instanceof Ps&&(this._useBoundaryDeterminationRule=!1),r instanceof di)this.addPolygon(r);else if(r instanceof Zn)this.addLineString(r);else if(r instanceof zr)this.addPoint(r);else if(r instanceof Yc)this.addCollection(r);else if(r instanceof bl)this.addCollection(r);else if(r instanceof Ps)this.addCollection(r);else if(r instanceof ar)this.addCollection(r);else throw new Error(r.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(r){for(var s=this,l=0;l50?(this._areaPtLocator===null&&(this._areaPtLocator=new nh(this._parentGeom)),this._areaPtLocator.locate(r)):this._ptLocator.locate(r,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var r=arguments[0];return this._lineEdgeMap.get(r)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(r,s){return r.isInBoundary(s)?ft.BOUNDARY:ft.INTERIOR},e}(Bn),rh=function(){if(this._li=new Al,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new _p(0,t)}else if(arguments.length===2){var e=arguments[0],r=arguments[1],s=mo.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new _p(0,e,s),this._arg[1]=new _p(1,r,s)}else if(arguments.length===3){var l=arguments[0],p=arguments[1],m=arguments[2];l.getPrecisionModel().compareTo(p.getPrecisionModel())>=0?this.setComputationPrecision(l.getPrecisionModel()):this.setComputationPrecision(p.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new _p(0,l,m),this._arg[1]=new _p(1,p,m)}};rh.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};rh.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};rh.prototype.interfaces_=function(){return[]};rh.prototype.getClass=function(){return rh};var yl=function(){};yl.prototype.interfaces_=function(){return[]};yl.prototype.getClass=function(){return yl};yl.map=function(){if(arguments[0]instanceof he&&de(arguments[1],yl.MapOp)){for(var t=arguments[0],e=arguments[1],r=new qt,s=0;s=t.size()?null:t.get(e)};oi.union=function(t){var e=new oi(t);return e.union()};rv.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(oi,rv);var bf=function(){};bf.prototype.interfaces_=function(){return[]};bf.prototype.getClass=function(){return bf};bf.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return xe.createEmptyResult(xe.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),cr.overlayOp(t,e,xe.UNION)};function Ml(){return new wf}function wf(){this.reset()}wf.prototype={constructor:wf,reset:function(){this.s=this.t=0},add:function(t){Vy(af,t,this.t),Vy(this,af.s,this.s),this.s?this.t+=af.t:this.s=af.t},valueOf:function(){return this.s}};var af=new wf;function Vy(t,e,r){var s=t.s=e+r,l=s-e,p=s-l;t.t=e-p+(r-l)}var ug=Math.PI,Uy=ug*2;Ml();Ml();Ml();function qy(t,e){return[t>ug?t-Uy:t<-ug?t+Uy:t,e]}qy.invert=qy;function ov(t,e){return te?1:t>=e?0:NaN}function Tw(t){return t.length===1&&(t=Lw(t)),{left:function(e,r,s,l){for(s==null&&(s=0),l==null&&(l=e.length);s>>1;t(e[p],r)<0?s=p+1:l=p}return s},right:function(e,r,s,l){for(s==null&&(s=0),l==null&&(l=e.length);s>>1;t(e[p],r)>0?l=p:s=p+1}return s}}}function Lw(t){return function(e,r){return ov(t(e),r)}}Tw(ov);Ml();Ml();Ml();Ml();Ml();function Gy(){}Gy.prototype={constructor:Gy,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function jy(t,e){return[t,e]}jy.invert=jy;const Pw=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],Aw={decimalLatitude:40.123,decimalLongitude:-74.123},Mw=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],Dw=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function Rw(){const t=[];return Pw.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...Aw})}),[...t,...Mw,...Dw]}const Nw=Rw();Nw.map(t=>t.verbatimCoordinates);function Zy(t,e,r){const s=t.slice();return s[1]=e[r][0],s[2]=e[r][1],s}function Hy(t){let e,r,s,l=t[1]+"",p,m;return{c(){e=rn("li"),r=rn("span"),s=Zi(),p=vl(l),m=Zi(),Sn(r,"class","svelte-kzgqtg"),Ro(r,"background",t[2])},m(c,S){un(c,e,S),En(e,r),En(e,s),En(e,p),En(e,m)},p(c,S){S&1&&Ro(r,"background",c[2]),S&1&&l!==(l=c[1]+"")&&Tp(p,l)},d(c){c&&on(e)}}}function kw(t){let e,r=ml(t[0]),s=[];for(let l=0;l{"rows"in l&&r(0,s=l.rows)},[s]}class C2 extends vo{constructor(e){super(),yo(this,e,zw,kw,Vr,{rows:0})}}const Ow=Symbol.for("svelte-maplibre");function Fw(){return u0(Ow)}function Bw(t){return"layerType"in t&&t.layerType==="deckgl"}const Vw=t=>({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),Wy=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function Xy(t){let e,r,s=(t[4]||t[3]instanceof Ls.Marker)&&Yy(t);return{c(){e=rn("div"),s&&s.c()},m(l,p){un(l,e,p),s&&s.m(e,null),t[32](e),r=!0},p(l,p){l[4]||l[3]instanceof Ls.Marker?s?(s.p(l,p),p[0]&24&&bn(s,1)):(s=Yy(l),s.c(),bn(s,1),s.m(e,null)):s&&(sh(),Jn(s,1,1,()=>{s=null}),ah())},i(l){r||(bn(s),r=!0)},o(l){Jn(s),r=!1},d(l){l&&on(e),s&&s.d(),t[32](null)}}}function Yy(t){let e;const r=t[30].default,s=uu(r,t,t[29],Wy);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p[0]&536870933)&&hu(s,r,l,l[29],e?cu(r,l[29],p,Vw):pu(l[29]),Wy)},i(l){e||(bn(s,l),e=!0)},o(l){Jn(s,l),e=!1},d(l){s&&s.d(l)}}}function Uw(t){let e,r,s=t[9].default&&Xy(t);return{c(){s&&s.c(),e=If()},m(l,p){s&&s.m(l,p),un(l,e,p),r=!0},p(l,p){l[9].default?s?(s.p(l,p),p[0]&512&&bn(s,1)):(s=Xy(l),s.c(),bn(s,1),s.m(e.parentNode,e)):s&&(sh(),Jn(s,1,1,()=>{s=null}),ah())},i(l){r||(bn(s),r=!0)},o(l){Jn(s),r=!1},d(l){l&&on(e),s&&s.d(l)}}}function qw(t,e,r){let s,l,p,m,c,S,{$$slots:L={},$$scope:R}=e;const k=t1(L);let{closeButton:U=void 0}=e,{closeOnClickOutside:ct=!0}=e,{closeOnClickInside:dt=!1}=e,{closeOnMove:bt=!1}=e,{openOn:It="click"}=e,{openIfTopMost:Dt=!0}=e,{focusAfterOpen:Rt=!0}=e,{anchor:Gt=void 0}=e,{offset:re=void 0}=e,{popupClass:pe=void 0}=e,{maxWidth:Be=void 0}=e,{lngLat:ue=void 0}=e,{html:Pe=void 0}=e,{open:me=!1}=e;const ve=hg(),{map:Nt,popupTarget:sn,layerEvent:Re,layer:ge,eventTopMost:He}=Fw();Qr(t,Nt,_t=>r(2,p=_t)),Qr(t,sn,_t=>r(3,c=_t)),Qr(t,Re,_t=>r(28,m=_t)),Qr(t,ge,_t=>r(35,S=_t));const mn=["click","dblclick","contextmenu"];let ce,en=!1,Rn;function Tn(){if(!ce)return;let _t=ce.getElement();!_t||_t===Rn||(Rn=_t,It==="hover"&&(Rn.style.pointerEvents="none"),Rn.addEventListener("mouseenter",()=>{r(24,en=!0)},{passive:!0}),Rn.addEventListener("mouseleave",()=>{r(24,en=!1)},{passive:!0}),Rn.addEventListener("click",()=>{dt&&r(0,me=!1)},{passive:!0}))}a1(()=>{if(p)return p.on("click",ni),p.on("contextmenu",ni),typeof c=="string"&&(p.on("click",c,Ln),p.on("dblclick",c,Ln),p.on("contextmenu",c,Ln),p.on("mousemove",c,Ji),p.on("mouseleave",c,Vn),p.on("touchstart",c,ln),p.on("touchend",c,wn)),()=>{p!=null&&p.loaded()&&(ce==null||ce.remove(),p.off("click",ni),p.off("contextmenu",ni),c instanceof Ls.Marker?c.getPopup()===ce&&c.setPopup(void 0):typeof c=="string"&&(p.off("click",c,Ln),p.off("dblclick",c,Ln),p.off("contextmenu",c,Ln),p.off("mousemove",c,Ji),p.off("mouseleave",c,Vn),p.off("touchstart",c,ln),p.off("touchend",c,wn)))}});function hn(_t){return Dt?!("marker"in _t)&&!Bw(_t)&&He(_t)!==S:!1}let Me=null,nn="normal";function Ln(_t){_t.type===It&&(hn(_t)||("layerType"in _t?_t.layerType==="deckgl"?(r(10,ue=_t.coordinate),r(4,Me=_t.object?[_t.object]:null)):(r(10,ue=_t.lngLat),r(4,Me=_t.features??[])):(r(10,ue=_t.lngLat),r(4,Me=_t.features??[])),setTimeout(()=>r(0,me=!0))))}let an=null;function ln(_t){an=_t.point}function wn(_t){if(!an||It!=="hover")return;let ze=an.dist(_t.point);an=null,ze<3&&(r(10,ue=_t.lngLat),r(4,Me=_t.features??[]),ce.isOpen()?r(25,nn="justOpened"):(r(25,nn="opening"),r(0,me=!0)))}function Vn(_t){It!=="hover"||an||nn!=="normal"||(r(0,me=!1),r(4,Me=null))}function Ji(_t){if(!(It!=="hover"||an||nn!=="normal")){if(hn(_t)){r(0,me=!1),r(4,Me=null);return}r(0,me=!0),r(4,Me=_t.features??[]),r(10,ue=_t.lngLat)}}function ni(_t){if(nn==="justOpened"){r(25,nn="normal");return}if(!ct)return;let ze=[Rn,c instanceof Ls.Marker?c==null?void 0:c.getElement():null];me&&ce.isOpen()&&!ze.some(Pn=>Pn==null?void 0:Pn.contains(_t.originalEvent.target))&&(_t.type==="contextmenu"&&It==="contextmenu"||_t.type!=="contextmenu")&&r(0,me=!1)}du(()=>{p&&(ce!=null&&ce.isOpen())&&ce.remove()});let ai;const bi=()=>r(0,me=!1);function at(_t){Uc[_t?"unshift":"push"](()=>{ai=_t,r(1,ai)})}return t.$$set=_t=>{"closeButton"in _t&&r(11,U=_t.closeButton),"closeOnClickOutside"in _t&&r(12,ct=_t.closeOnClickOutside),"closeOnClickInside"in _t&&r(13,dt=_t.closeOnClickInside),"closeOnMove"in _t&&r(14,bt=_t.closeOnMove),"openOn"in _t&&r(15,It=_t.openOn),"openIfTopMost"in _t&&r(16,Dt=_t.openIfTopMost),"focusAfterOpen"in _t&&r(17,Rt=_t.focusAfterOpen),"anchor"in _t&&r(18,Gt=_t.anchor),"offset"in _t&&r(19,re=_t.offset),"popupClass"in _t&&r(20,pe=_t.popupClass),"maxWidth"in _t&&r(21,Be=_t.maxWidth),"lngLat"in _t&&r(10,ue=_t.lngLat),"html"in _t&&r(22,Pe=_t.html),"open"in _t&&r(0,me=_t.open),"$$scope"in _t&&r(29,R=_t.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&r(27,s=U??(!ct&&!dt)),t.$$.dirty[0]&146685952&&(ce||(r(23,ce=new Ls.Popup({closeButton:s,closeOnClick:!1,closeOnMove:bt,focusAfterOpen:Rt,maxWidth:Be,className:pe,anchor:Gt,offset:re})),Rn=ce.getElement(),ce.on("open",()=>{r(0,me=!0),Tn(),ve("open",ce)}),ce.on("close",()=>{r(0,me=!1),ve("close",ce)}),ce.on("hover",()=>{ve("hover",ce)}))),t.$$.dirty[0]&8421384&&ce&&c instanceof Ls.Marker&&(It==="click"?c.setPopup(ce):c.getPopup()===ce&&c.setPopup(void 0)),t.$$.dirty[0]&268468224&&mn.includes(It)&&(m==null?void 0:m.type)===It&&(Ln(m),wp(Re,m=null,m)),t.$$.dirty[0]&268468224&&r(26,l=It==="hover"&&((m==null?void 0:m.type)==="mousemove"||(m==null?void 0:m.type)==="mouseenter")),t.$$.dirty[0]&352354304&&It==="hover"&&Re&&(l&&m&&(m.layerType==="deckgl"?(r(10,ue=m.coordinate),r(4,Me=m.object?[m.object]:null)):(r(10,ue=m.lngLat),r(4,Me=m.features??[]))),r(0,me=(l||en)??!1)),t.$$.dirty[0]&12582914&&(ai?ce.setDOMContent(ai):Pe&&ce.setHTML(Pe)),t.$$.dirty[0]&8389632&&ue&&ce.setLngLat(ue),t.$$.dirty[0]&41943045&&p){let _t=ce.isOpen();me&&!_t?(ce.addTo(p),nn==="opening"&&r(25,nn="justOpened")):!me&&_t&&ce.remove()}},[me,ai,p,c,Me,Nt,sn,Re,ge,k,ue,U,ct,dt,bt,It,Dt,Rt,Gt,re,pe,Be,Pe,ce,en,nn,l,s,m,R,L,bi,at]}class Gw extends vo{constructor(e){super(),yo(this,e,qw,Uw,Vr,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}const jw=t=>({props:t&8}),Ky=t=>({props:Ww(t[3])});function Zw(t){let e;const r=t[1].default,s=uu(r,t,t[2],Ky);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p&12)&&hu(s,r,l,l[2],e?cu(r,l[2],p,jw):pu(l[2]),Ky)},i(l){e||(bn(s,l),e=!0)},o(l){Jn(s,l),e=!1},d(l){s&&s.d(l)}}}function Hw(t){let e,r;return e=new Gw({props:{openOn:t[0],$$slots:{default:[Zw,({features:s})=>({3:s}),({features:s})=>s?8:0]},$$scope:{ctx:t}}}),{c(){zc(e.$$.fragment)},m(s,l){su(e,s,l),r=!0},p(s,[l]){const p={};l&1&&(p.openOn=s[0]),l&12&&(p.$$scope={dirty:l,ctx:s}),e.$set(p)},i(s){r||(bn(e.$$.fragment,s),r=!0)},o(s){Jn(e.$$.fragment,s),r=!1},d(s){au(e,s)}}}function Ww(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function Xw(t,e,r){let{$$slots:s={},$$scope:l}=e,{openOn:p="hover"}=e;return t.$$set=m=>{"openOn"in m&&r(0,p=m.openOn),"$$scope"in m&&r(2,l=m.$$scope)},[p,s,l]}class T2 extends vo{constructor(e){super(),yo(this,e,Xw,Hw,Vr,{openOn:0})}}function Jy(t,e,r){const s=t.slice();return s[1]=e[r][0],s[2]=e[r][1],s}function Qy(t){let e,r,s=t[1]+"",l,p,m,c=t[2]+"",S,L;return{c(){e=rn("tr"),r=rn("td"),l=vl(s),p=Zi(),m=rn("td"),S=vl(c),L=Zi()},m(R,k){un(R,e,k),En(e,r),En(r,l),En(e,p),En(e,m),En(m,S),En(e,L)},p(R,k){k&1&&s!==(s=R[1]+"")&&Tp(l,s),k&1&&c!==(c=R[2]+"")&&Tp(S,c)},d(R){R&&on(e)}}}function Yw(t){let e,r,s=ml(Object.entries(t[0])),l=[];for(let p=0;p{"properties"in l&&r(0,s=l.properties)},[s]}class L2 extends vo{constructor(e){super(),yo(this,e,Kw,Yw,Vr,{properties:0})}}function $y(t,e,r){const s=t.slice();return s[3]=e[r],s}function t0(t,e,r){const s=t.slice();return s[6]=e[r],s}function e0(t){let e,r;return{c(){e=rn("span"),r=vl(`  - `),Ro(e,"background",t[6]),Ro(e,"width","100%"),Ro(e,"border","1px solid black")},m(s,l){un(s,e,l),En(e,r)},p(s,l){l&1&&Ro(e,"background",s[6])},d(s){s&&on(e)}}}function Jw(t){let e,r=t[3]+"",s;return{c(){e=rn("span"),s=vl(r)},m(l,p){un(l,e,p),En(e,s)},p(l,p){p&2&&r!==(r=l[3]+"")&&Tp(s,r)},d(l){l&&on(e)}}}function Qw(t){let e,r=t[3].toFixed(t[2])+"",s;return{c(){e=rn("span"),s=vl(r)},m(l,p){un(l,e,p),En(e,s)},p(l,p){p&6&&r!==(r=l[3].toFixed(l[2])+"")&&Tp(s,r)},d(l){l&&on(e)}}}function n0(t){let e;function r(p,m){return p[2]>0?Qw:Jw}let s=r(t),l=s(t);return{c(){l.c(),e=If()},m(p,m){l.m(p,m),un(p,e,m)},p(p,m){s===(s=r(p))&&l?l.p(p,m):(l.d(1),l=s(p),l&&(l.c(),l.m(e.parentNode,e)))},d(p){p&&on(e),l.d(p)}}}function $w(t){let e,r,s,l=ml(t[0]),p=[];for(let S=0;S{"colorScale"in m&&r(0,s=m.colorScale),"limits"in m&&r(1,l=m.limits),"decimalPlaces"in m&&r(2,p=m.decimalPlaces)},[s,l,p]}class P2 extends vo{constructor(e){super(),yo(this,e,t2,$w,Vr,{colorScale:0,limits:1,decimalPlaces:2})}}function A2(t){let e='poly:"';for(let[s,l]of t.geometry.coordinates[0])e+=`${l} ${s} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}function M2(t,e,r){let s=["step",t];for(let l=1;l({}),i0=t=>({}),n2=t=>({}),r0=t=>({});function i2(t){let e,r,s,l;const p=t[1].left,m=uu(p,t,t[0],r0),c=t[1].main,S=uu(c,t,t[0],i0);return{c(){e=rn("div"),m&&m.c(),r=Zi(),s=rn("div"),S&&S.c(),Sn(e,"class","left svelte-6kzmjs"),Sn(s,"class","main svelte-6kzmjs")},m(L,R){un(L,e,R),m&&m.m(e,null),un(L,r,R),un(L,s,R),S&&S.m(s,null),l=!0},p(L,[R]){m&&m.p&&(!l||R&1)&&hu(m,p,L,L[0],l?cu(p,L[0],R,n2):pu(L[0]),r0),S&&S.p&&(!l||R&1)&&hu(S,c,L,L[0],l?cu(c,L[0],R,e2):pu(L[0]),i0)},i(L){l||(bn(m,L),bn(S,L),l=!0)},o(L){Jn(m,L),Jn(S,L),l=!1},d(L){L&&(on(e),on(r),on(s)),m&&m.d(L),S&&S.d(L)}}}function r2(t,e,r){let{$$slots:s={},$$scope:l}=e;return t.$$set=p=>{"$$scope"in p&&r(0,l=p.$$scope)},[l,s]}class D2 extends vo{constructor(e){super(),yo(this,e,r2,i2,Vr,{})}}export{Ac as $,l1 as A,my as B,o1 as C,If as D,wr as E,d2 as F,uu as G,S2 as H,e1 as I,a2 as J,hu as K,D2 as L,v2 as M,pu as N,cu as O,p2 as P,cg as Q,hg as R,vo as S,m2 as T,Qr as U,wp as V,u2 as W,c2 as X,yb as Y,T0 as Z,x1 as _,su as a,ra as a0,x2 as a1,_2 as a2,Qx as a3,y2 as a4,mp as a5,M2 as a6,E2 as a7,I2 as a8,T2 as a9,L2 as aa,Tp as ab,du as ac,n1 as ad,l2 as ae,C2 as af,w2 as ag,P2 as ah,b2 as ai,h2 as aj,s2 as ak,f2 as al,A0 as am,g2 as an,cb as ao,hb as ap,l0 as aq,u0 as ar,A2 as as,ml as at,hf as au,Jn as b,zc as c,au as d,rn as e,Zi as f,vl as g,Sn as h,yo as i,Vm as j,pf as k,un as l,Ls as m,En as n,a1 as o,cy as p,yp as q,sh as r,Vr as s,bn as t,ah as u,on as v,Cu as w,Uc as x,h1 as y,Ro as z}; +`)}return t.toString()};$i.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next();r.computeLabel(t)}};$i.prototype.computeLabelling=function(t){var e=this;this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var r=[!1,!1],s=this.iterator();s.hasNext();)for(var l=s.next(),p=l.getLabel(),m=0;m<2;m++)p.isLine(m)&&p.getLocation(m)===dt.BOUNDARY&&(r[m]=!0);for(var c=this.iterator();c.hasNext();)for(var S=c.next(),L=S.getLabel(),R=0;R<2;R++)if(L.isAnyNull(R)){var k=dt.NONE;if(r[R])k=dt.EXTERIOR;else{var U=S.getCoordinate();k=e.getLocation(R,U,t)}L.setAllLocationsIfNull(R,k)}};$i.prototype.getDegree=function(){return this._edgeMap.size()};$i.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null};$i.prototype.interfaces_=function(){return[]};$i.prototype.getClass=function(){return $i};var Dw=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var r=this;this.getResultAreaEdges();for(var s=null,l=null,p=this._SCANNING_FOR_INCOMING,m=0;m=0;p--){var m=r._edgeList.get(p),c=m.getSym();l===null&&(l=c),s!==null&&c.setNext(s),s=m}l.setNext(s)},e.prototype.computeDepths=function(){var r=this;if(arguments.length===1){var s=arguments[0],l=this.findIndex(s),p=s.getDepth(kt.LEFT),m=s.getDepth(kt.RIGHT),c=this.computeDepths(l+1,this._edgeList.size(),p),S=this.computeDepths(0,l,c);if(S!==m)throw new ua("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var L=arguments[0],R=arguments[1],k=arguments[2],U=k,ut=L;ut=0;c--){var S=s._resultAreaEdgeList.get(c),L=S.getSym();switch(l===null&&S.getEdgeRing()===r&&(l=S),m){case s._SCANNING_FOR_INCOMING:if(L.getEdgeRing()!==r)continue;p=L,m=s._LINKING_TO_OUTGOING;break;case s._LINKING_TO_OUTGOING:if(S.getEdgeRing()!==r)continue;p.setNextMin(S),m=s._SCANNING_FOR_INCOMING;break}}m===this._LINKING_TO_OUTGOING&&(Te.isTrue(l!==null,"found null for first outgoing dirEdge"),Te.isTrue(l.getEdgeRing()===r,"unable to link last incoming dirEdge"),p.setNextMin(l))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var r=0,s=this.iterator();s.hasNext();){var l=s.next();l.isInResult()&&r++}return r}else if(arguments.length===1){for(var p=arguments[0],m=0,c=this.iterator();c.hasNext();){var S=c.next();S.getEdgeRing()===p&&m++}return m}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var r=dt.NONE,s=this.iterator();s.hasNext();){var l=s.next(),p=l.getSym();if(!l.isLineEdge()){if(l.isInResult()){r=dt.INTERIOR;break}if(p.isInResult()){r=dt.EXTERIOR;break}}}if(r===dt.NONE)return null;for(var m=r,c=this.iterator();c.hasNext();){var S=c.next(),L=S.getSym();S.isLineEdge()?S.getEdge().setCovered(m===dt.INTERIOR):(S.isInResult()&&(m=dt.EXTERIOR),L.isInResult()&&(m=dt.INTERIOR))}},e.prototype.computeLabelling=function(r){var s=this;t.prototype.computeLabelling.call(this,r),this._label=new nn(dt.NONE);for(var l=this.iterator();l.hasNext();)for(var p=l.next(),m=p.getEdge(),c=m.getLabel(),S=0;S<2;S++){var L=c.getLocation(S);(L===dt.INTERIOR||L===dt.BOUNDARY)&&s._label.setLocation(S,dt.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}($i),W0=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(r){return new Rf(r,new Dw)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Kc),Ba=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Ba.prototype.compareTo=function(t){var e=t,r=Ba.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return r};Ba.prototype.interfaces_=function(){return[bo]};Ba.prototype.getClass=function(){return Ba};Ba.orientation=function(t){return Oe.increasingDirection(t)===1};Ba.compareOriented=function(t,e,r,s){for(var l=e?1:-1,p=s?1:-1,m=e?t.length:-1,c=s?r.length:-1,S=e?0:t.length-1,L=s?0:r.length-1;;){var R=t[S].compareTo(r[L]);if(R!==0)return R;S+=l,L+=p;var k=S===m,U=L===c;if(k&&!U)return-1;if(!k&&U)return 1;if(k&&U)return 0}};var qo=function(){this._edges=new qt,this._ocaMap=new Ji};qo.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var r=0;r0&&t.print(","),t.print("(");for(var l=s.getCoordinates(),p=0;p0&&t.print(","),t.print(l[p].x+" "+l[p].y);t.println(")")}t.print(") ")};qo.prototype.addAll=function(t){for(var e=this,r=t.iterator();r.hasNext();)e.add(r.next())};qo.prototype.findEdgeIndex=function(t){for(var e=this,r=0;r0||!e.coord.equals2D(l);p||s--;var m=new Array(s).fill(null),c=0;m[c++]=new ct(t.coord);for(var S=t.segmentIndex+1;S<=e.segmentIndex;S++)m[c++]=r.edge.pts[S];return p&&(m[c]=e.coord),new vf(m,new nn(this.edge._label))};Os.prototype.add=function(t,e,r){var s=new fs(t,e,r),l=this._nodeMap.get(s);return l!==null?l:(this._nodeMap.put(s,s),s)};Os.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next();if(r.coord.equals(t))return!0}return!1};Os.prototype.interfaces_=function(){return[]};Os.prototype.getClass=function(){return Os};var Sl=function(){};Sl.prototype.getChainStartIndices=function(t){var e=this,r=0,s=new qt;s.add(new ls(r));do{var l=e.findChainEnd(t,r);s.add(new ls(l)),r=l}while(rr?e:r};ha.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return er&&(l=1),t._depth[e][s]=l}}};Bi.prototype.getDelta=function(t){return this._depth[t][kt.RIGHT]-this._depth[t][kt.LEFT]};Bi.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?dt.EXTERIOR:dt.INTERIOR};Bi.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Bi.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],r=0;r<2;r++)for(var s=1;s<3;s++){var l=e.getLocation(r,s);(l===dt.EXTERIOR||l===dt.INTERIOR)&&(t.isNull(r,s)?t._depth[r][s]=Bi.depthAtLocation(l):t._depth[r][s]+=Bi.depthAtLocation(l))}else if(arguments.length===3){var p=arguments[0],m=arguments[1],c=arguments[2];c===dt.INTERIOR&&this._depth[p][m]++}};Bi.prototype.interfaces_=function(){return[]};Bi.prototype.getClass=function(){return Bi};Bi.depthAtLocation=function(t){return t===dt.EXTERIOR?0:t===dt.INTERIOR?1:Bi.NULL_VALUE};X0.NULL_VALUE.get=function(){return-1};Object.defineProperties(Bi,X0);var vf=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Os(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Bi,this._depthDelta=0,arguments.length===1){var r=arguments[0];e.call(this,r,null)}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.pts=s,this._label=l}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var r=new Array(2).fill(null);r[0]=this.pts[0],r[1]=this.pts[1];var s=new e(r,nn.toLineLabel(this._label));return s},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(r){this._isIsolated=r},e.prototype.setName=function(r){this._name=r},e.prototype.equals=function(r){var s=this;if(!(r instanceof e))return!1;var l=r;if(this.pts.length!==l.pts.length)return!1;for(var p=!0,m=!0,c=this.pts.length,S=0;S0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}},e.prototype.print=function(r){var s=this;r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var l=0;l0&&r.print(","),r.print(s.pts[l].x+" "+s.pts[l].y);r.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(r){e.updateIM(this._label,r)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(r){var s=this;r.print("edge "+this._name+": ");for(var l=this.pts.length-1;l>=0;l--)r.print(s.pts[l]+" ");r.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ha(this)),this._mce},e.prototype.getEnvelope=function(){var r=this;if(this._env===null){this._env=new re;for(var s=0;s0&&s.append(","),s.append(r.pts[l].x+" "+r.pts[l].y);return s.append(") "+this._label+" "+this._depthDelta),s.toString()},e.prototype.isPointwiseEqual=function(r){var s=this;if(this.pts.length!==r.pts.length)return!1;for(var l=0;ls||this._maxyp;if(m)return!1;var c=this.intersectsToleranceSquare(t,e);return Te.isTrue(!(m&&c),"Found bad envelope test"),c};Sr.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new ct(this._maxx,this._maxy),this._corner[1]=new ct(this._minx,this._maxy),this._corner[2]=new ct(this._minx,this._miny),this._corner[3]=new ct(this._maxx,this._miny)};Sr.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};Sr.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};Sr.prototype.getCoordinate=function(){return this._originalPt};Sr.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};Sr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=Sr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new re(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};Sr.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))};Sr.prototype.intersectsToleranceSquare=function(t,e){var r=!1,s=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||r&&s||t.equals(this._pt)||e.equals(this._pt))};Sr.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),s=t.getCoordinate(e+1);return this.intersects(r,s)?(t.addIntersection(this.getCoordinate(),e),!0):!1};Sr.prototype.interfaces_=function(){return[]};Sr.prototype.getClass=function(){return Sr};K0.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(Sr,K0);var Vp=function(){this.tempEnv1=new re,this.selectedSegment=new oe};Vp.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}};Vp.prototype.interfaces_=function(){return[]};Vp.prototype.getClass=function(){return Vp};var th=function(){this._index=null;var t=arguments[0];this._index=t},J0={HotPixelSnapAction:{configurable:!0}};th.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],r=arguments[1],s=arguments[2],l=e.getSafeEnvelope(),p=new Q0(e,r,s);return this._index.query(l,{interfaces_:function(){return[Oa]},visitItem:function(m){var c=m;c.select(l,p)}}),p.isNodeAdded()}};th.prototype.interfaces_=function(){return[]};th.prototype.getClass=function(){return th};J0.HotPixelSnapAction.get=function(){return Q0};Object.defineProperties(th,J0);var Q0=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var r=arguments[0],s=arguments[1],l=arguments[2];this._hotPixel=r,this._parentEdge=s,this._hotPixelVertexIndex=l}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var r=arguments[0],s=arguments[1],l=r.getContext();if(this._parentEdge!==null&&l===this._parentEdge&&s===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(l,s)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Vp),vu=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new qt};vu.prototype.processIntersections=function(t,e,r,s){var l=this;if(t===r&&e===s)return null;var p=t.getCoordinates()[e],m=t.getCoordinates()[e+1],c=r.getCoordinates()[s],S=r.getCoordinates()[s+1];if(this._li.computeIntersection(p,m,c,S),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var L=0;L=0;e--){try{t.bufferReducedPrecision(e)}catch(p){if(p instanceof ua)t._saveException=p;else throw p}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var r=arguments[0],s=Yi.precisionScaleFactor(this._argGeom,this._distance,r),l=new tn(s);this.bufferFixedPrecision(l)}};Yi.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===tn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Yi.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Yi.prototype.bufferOriginalPrecision=function(){try{var t=new lr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof aa)this._saveException=e;else throw e}finally{}};Yi.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Yi.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Yi.prototype.interfaces_=function(){return[]};Yi.prototype.getClass=function(){return Yi};Yi.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],r=new Yi(t),s=r.getResultGeometry(e);return s}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof pe&&typeof arguments[1]=="number"){var l=arguments[0],p=arguments[1],m=arguments[2],c=new Yi(l);c.setQuadrantSegments(m);var S=c.getResultGeometry(p);return S}else if(arguments[2]instanceof Je&&arguments[0]instanceof pe&&typeof arguments[1]=="number"){var L=arguments[0],R=arguments[1],k=arguments[2],U=new Yi(L,k),ut=U.getResultGeometry(R);return ut}}else if(arguments.length===4){var pt=arguments[0],vt=arguments[1],bt=arguments[2],Dt=arguments[3],Rt=new Yi(pt);Rt.setQuadrantSegments(bt),Rt.setEndCapStyle(Dt);var Gt=Rt.getResultGeometry(vt);return Gt}};Yi.precisionScaleFactor=function(t,e,r){var s=t.getEnvelopeInternal(),l=no.max(Math.abs(s.getMaxX()),Math.abs(s.getMaxY()),Math.abs(s.getMinX()),Math.abs(s.getMinY())),p=e>0?e:0,m=l+2*p,c=Math.trunc(Math.log(m)/Math.log(10)+1),S=r-c,L=Math.pow(10,S);return L};hh.CAP_ROUND.get=function(){return Je.CAP_ROUND};hh.CAP_BUTT.get=function(){return Je.CAP_FLAT};hh.CAP_FLAT.get=function(){return Je.CAP_FLAT};hh.CAP_SQUARE.get=function(){return Je.CAP_SQUARE};hh.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Yi,hh);var sr=function(){this._pt=[new ct,new ct],this._distance=xe.NaN,this._isNull=!0};sr.prototype.getCoordinates=function(){return this._pt};sr.prototype.getCoordinate=function(t){return this._pt[t]};sr.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var s=e.distance(r);sthis._distance&&this.initialize(e,r,s)}};sr.prototype.interfaces_=function(){return[]};sr.prototype.getClass=function(){return sr};var Ps=function(){};Ps.prototype.interfaces_=function(){return[]};Ps.prototype.getClass=function(){return Ps};Ps.computeDistance=function(){if(arguments[2]instanceof sr&&arguments[0]instanceof Zn&&arguments[1]instanceof ct)for(var t=arguments[0],e=arguments[1],r=arguments[2],s=t.getCoordinates(),l=new oe,p=0;p0||this._isIn?dt.INTERIOR:dt.EXTERIOR)};Go.prototype.interfaces_=function(){return[]};Go.prototype.getClass=function(){return Go};var ar=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],r=arguments[1];t.call(this,e,t.INSIDE_AREA,r)}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];this._component=s,this._segIndex=l,this._pt=p}},$0={INSIDE_AREA:{configurable:!0}};ar.prototype.isInsideArea=function(){return this._segIndex===ar.INSIDE_AREA};ar.prototype.getCoordinate=function(){return this._pt};ar.prototype.getGeometryComponent=function(){return this._component};ar.prototype.getSegmentIndex=function(){return this._segIndex};ar.prototype.interfaces_=function(){return[]};ar.prototype.getClass=function(){return ar};$0.INSIDE_AREA.get=function(){return-1};Object.defineProperties(ar,$0);var Na=function(t){this._pts=t||null};Na.prototype.filter=function(t){t instanceof Or&&this._pts.add(t)};Na.prototype.interfaces_=function(){return[cs]};Na.prototype.getClass=function(){return Na};Na.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Or?Uo.singletonList(t):Na.getPoints(t,new qt)}else if(arguments.length===2){var e=arguments[0],r=arguments[1];return e instanceof Or?r.add(e):e instanceof ur&&e.apply(new Na(r)),r}};var bu=function(){this._locations=null;var t=arguments[0];this._locations=t};bu.prototype.filter=function(t){(t instanceof Or||t instanceof Zn||t instanceof mi)&&this._locations.add(new ar(t,0,t.getCoordinate()))};bu.prototype.interfaces_=function(){return[cs]};bu.prototype.getClass=function(){return bu};bu.getLocations=function(t){var e=new qt;return t.apply(new bu(e)),e};var Ui=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Go,this._minDistanceLocation=null,this._minDistance=xe.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var r=arguments[0],s=arguments[1],l=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=s,this._terminateDistance=l}};Ui.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var r=arguments[0],s=arguments[1],l=1-r,p=sa.getPolygons(this._geom[r]);if(p.size()>0){var m=bu.getLocations(this._geom[l]);if(this.computeContainmentDistance(m,p,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[l]=s[0],this._minDistanceLocation[r]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&me(arguments[0],Oo)&&me(arguments[1],Oo)){for(var c=arguments[0],S=arguments[1],L=arguments[2],R=0;Rthis._minDistance)return null;for(var l=e.getCoordinates(),p=r.getCoordinate(),m=0;mthis._minDistance)return null;for(var ut=R.getCoordinates(),pt=k.getCoordinates(),vt=0;vtthis._distance&&this.initialize(e,r,s)}};Ki.prototype.interfaces_=function(){return[]};Ki.prototype.getClass=function(){return Ki};var os=function(){};os.prototype.interfaces_=function(){return[]};os.prototype.getClass=function(){return os};os.computeDistance=function(){if(arguments[2]instanceof Ki&&arguments[0]instanceof Zn&&arguments[1]instanceof ct)for(var t=arguments[0],e=arguments[1],r=arguments[2],s=new oe,l=t.getCoordinates(),p=0;p1||t<=0)throw new Mn("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};mo.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};mo.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};mo.prototype.computeOrientedDistance=function(t,e,r){var s=new wu(e);if(t.apply(s),r.setMaximum(s.getMaxPointDistance()),this._densifyFrac>0){var l=new qa(e,this._densifyFrac);t.apply(l),r.setMaximum(l.getMaxPointDistance())}};mo.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};mo.prototype.interfaces_=function(){return[]};mo.prototype.getClass=function(){return mo};mo.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],r=new mo(t,e);return r.distance()}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2],m=new mo(s,l);return m.setDensifyFraction(p),m.distance()}};Cg.MaxPointDistanceFilter.get=function(){return wu};Cg.MaxDensifiedByFractionDistanceFilter.get=function(){return qa};Object.defineProperties(mo,Cg);var wu=function(){this._maxPtDist=new Ki,this._minPtDist=new Ki,this._euclideanDist=new os,this._geom=null;var t=arguments[0];this._geom=t};wu.prototype.filter=function(t){this._minPtDist.initialize(),os.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};wu.prototype.getMaxPointDistance=function(){return this._maxPtDist};wu.prototype.interfaces_=function(){return[Rs]};wu.prototype.getClass=function(){return wu};var qa=function(){this._maxPtDist=new Ki,this._minPtDist=new Ki,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};qa.prototype.filter=function(t,e){var r=this;if(e===0)return null;for(var s=t.getCoordinate(e-1),l=t.getCoordinate(e),p=(l.x-s.x)/this._numSubSegs,m=(l.y-s.y)/this._numSubSegs,c=0;cr){this._isValid=!1;var l=s.getCoordinates();this._errorLocation=l[1],this._errorIndicator=t.getFactory().createLineString(l),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Fo.toLineString(l[0],l[1])+")"}};zr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=zr.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),zr.VERBOSE&&Vi.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};zr.prototype.checkNegativeValid=function(){if(!(this._input instanceof mi||this._input instanceof Ms||this._input instanceof ur))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};zr.prototype.getErrorIndicator=function(){return this._errorIndicator};zr.prototype.checkMinimumDistance=function(t,e,r){var s=new Ui(t,e,r);if(this._minDistanceFound=s.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};qi.prototype.report=function(t){if(!qi.VERBOSE)return null;Vi.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};qi.prototype.getErrorMessage=function(){return this._errorMsg};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};qi.isValidMsg=function(t,e,r){var s=new qi(t,e,r);return s.isValid()?null:s.getErrorMessage()};qi.isValid=function(t,e,r){var s=new qi(t,e,r);return!!s.isValid()};Lg.VERBOSE.get=function(){return!1};Lg.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(qi,Lg);var gs=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};gs.prototype.getCoordinates=function(){return this._pts};gs.prototype.size=function(){return this._pts.length};gs.prototype.getCoordinate=function(t){return this._pts[t]};gs.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};gs.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:_u.octant(this.getCoordinate(t),this.getCoordinate(t+1))};gs.prototype.setData=function(t){this._data=t};gs.prototype.getData=function(){return this._data};gs.prototype.toString=function(){return Fo.toLineString(new $n(this._pts))};gs.prototype.interfaces_=function(){return[zs]};gs.prototype.getClass=function(){return gs};var ki=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new qt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};ki.prototype.getInteriorIntersection=function(){return this._interiorIntersection};ki.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};ki.prototype.getIntersectionSegments=function(){return this._intSegments};ki.prototype.count=function(){return this._intersectionCount};ki.prototype.getIntersections=function(){return this._intersections};ki.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};ki.prototype.setKeepIntersections=function(t){this._keepIntersections=t};ki.prototype.processIntersections=function(t,e,r,s){if(!this._findAllIntersections&&this.hasIntersection()||t===r&&e===s)return null;if(this._isCheckEndSegmentsOnly){var l=this.isEndSegment(t,e)||this.isEndSegment(r,s);if(!l)return null}var p=t.getCoordinates()[e],m=t.getCoordinates()[e+1],c=r.getCoordinates()[s],S=r.getCoordinates()[s+1];this._li.computeIntersection(p,m,c,S),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=p,this._intSegments[1]=m,this._intSegments[2]=c,this._intSegments[3]=S,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};ki.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};ki.prototype.hasIntersection=function(){return this._interiorIntersection!==null};ki.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};ki.prototype.interfaces_=function(){return[El]};ki.prototype.getClass=function(){return ki};ki.createAllIntersectionsFinder=function(t){var e=new ki(t);return e.setFindAllIntersections(!0),e};ki.createAnyIntersectionFinder=function(t){return new ki(t)};ki.createIntersectionCounter=function(t){var e=new ki(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var jo=function(){this._li=new Al,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};jo.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};jo.prototype.getIntersections=function(){return this._segInt.getIntersections()};jo.prototype.isValid=function(){return this.execute(),this._isValid};jo.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};jo.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new ki(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Eg;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};jo.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ua(this.getErrorMessage(),this._segInt.getInteriorIntersection())};jo.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Fo.toLineString(t[0],t[1])+" and "+Fo.toLineString(t[2],t[3])};jo.prototype.interfaces_=function(){return[]};jo.prototype.getClass=function(){return jo};jo.computeIntersections=function(t){var e=new jo(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Tl=function t(){this._nv=null;var e=arguments[0];this._nv=new jo(t.toSegmentStrings(e))};Tl.prototype.checkValid=function(){this._nv.checkValid()};Tl.prototype.interfaces_=function(){return[]};Tl.prototype.getClass=function(){return Tl};Tl.toSegmentStrings=function(t){for(var e=new qt,r=t.iterator();r.hasNext();){var s=r.next();e.add(new gs(s.getCoordinates(),s))}return e};Tl.checkValid=function(t){var e=new Tl(t);e.checkValid()};var Iu=function(t){this._mapOp=t};Iu.prototype.map=function(t){for(var e=this,r=new qt,s=0;s0&&s<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)};Cr.prototype.interfaces_=function(){return[]};Cr.prototype.getClass=function(){return Cr};var Bs=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new oe,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Zn&&typeof arguments[1]=="number"){var e=arguments[0],r=arguments[1];t.call(this,e.getCoordinates(),r)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1];this._srcPts=s,this._isClosed=t.isClosed(s),this._snapTolerance=l}};Bs.prototype.snapVertices=function(t,e){for(var r=this,s=this._isClosed?t.size()-1:t.size(),l=0;l=0&&t.add(m+1,new ct(p),!1)}};Bs.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,s=xe.MAX_VALUE,l=-1,p=0;pe&&(e=s)}return e}else if(arguments.length===2){var l=arguments[0],p=arguments[1];return Math.min(ti.computeOverlaySnapTolerance(l),ti.computeOverlaySnapTolerance(p))}};ti.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),r=Math.min(e.getHeight(),e.getWidth()),s=r*ti.SNAP_PRECISION_FACTOR;return s};ti.snapToSelf=function(t,e,r){var s=new ti(t);return s.snapToSelf(e,r)};tv.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(ti,tv);var ev=function(t){function e(r,s,l){t.call(this),this._snapTolerance=r||null,this._snapPts=s||null,this._isSelfSnap=l!==void 0?l:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(r,s){var l=new Bs(r,this._snapTolerance);return l.setAllowSnappingToSourceVertices(this._isSelfSnap),l.snapTo(s)},e.prototype.transformCoordinates=function(r,s){var l=r.toCoordinateArray(),p=this.snapLine(l,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(p)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Cr),or=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};or.prototype.getCommon=function(){return xe.longBitsToDouble(this._commonBits)};or.prototype.add=function(t){var e=xe.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=or.signExpBits(this._commonBits),this._isFirst=!1,null;var r=or.signExpBits(e);if(r!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=or.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=or.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};or.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=xe.longBitsToDouble(t),r=xe.toBinaryString(t),s="0000000000000000000000000000000000000000000000000000000000000000"+r,l=s.substring(s.length-64),p=l.substring(0,1)+" "+l.substring(1,12)+"(exp) "+l.substring(12)+" [ "+e+" ]";return p}};or.prototype.interfaces_=function(){return[]};or.prototype.getClass=function(){return or};or.getBit=function(t,e){var r=1<>52};or.zeroLowerBits=function(t,e){var r=(1<=0;s--){if(or.getBit(t,s)!==or.getBit(e,s))return r;r++}return 52};var Ga=function(){this._commonCoord=null,this._ccFilter=new Su},Pg={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Ga.prototype.addCommonBits=function(t){var e=new ja(this._commonCoord);t.apply(e),t.geometryChanged()};Ga.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new ct(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new ja(e);return t.apply(r),t.geometryChanged(),t};Ga.prototype.getCommonCoordinate=function(){return this._commonCoord};Ga.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};Ga.prototype.interfaces_=function(){return[]};Ga.prototype.getClass=function(){return Ga};Pg.CommonCoordinateFilter.get=function(){return Su};Pg.Translater.get=function(){return ja};Object.defineProperties(Ga,Pg);var Su=function(){this._commonBitsX=new or,this._commonBitsY=new or};Su.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};Su.prototype.getCommonCoordinate=function(){return new ct(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Su.prototype.interfaces_=function(){return[Rs]};Su.prototype.getClass=function(){return Su};var ja=function(){this.trans=null;var t=arguments[0];this.trans=t};ja.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,s=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,s)};ja.prototype.isDone=function(){return!1};ja.prototype.isGeometryChanged=function(){return!0};ja.prototype.interfaces_=function(){return[Bo]};ja.prototype.getClass=function(){return ja};var zi=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};zi.prototype.selfSnap=function(t){var e=new ti(t),r=e.snapTo(t,this._snapTolerance);return r};zi.prototype.removeCommonBits=function(t){this._cbr=new Ga,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e};zi.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};zi.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=we.overlayOp(e[0],e[1],t);return this.prepareResult(r)};zi.prototype.checkValid=function(t){t.isValid()||Vi.out.println("Snapped geometry is invalid")};zi.prototype.computeSnapTolerance=function(){this._snapTolerance=ti.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};zi.prototype.snap=function(t){var e=this.removeCommonBits(t),r=ti.snap(e[0],e[1],this._snapTolerance);return r};zi.prototype.interfaces_=function(){return[]};zi.prototype.getClass=function(){return zi};zi.overlayOp=function(t,e,r){var s=new zi(t,e);return s.getResultGeometry(r)};zi.union=function(t,e){return zi.overlayOp(t,e,we.UNION)};zi.intersection=function(t,e){return zi.overlayOp(t,e,we.INTERSECTION)};zi.symDifference=function(t,e){return zi.overlayOp(t,e,we.SYMDIFFERENCE)};zi.difference=function(t,e){return zi.overlayOp(t,e,we.DIFFERENCE)};var pr=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};pr.prototype.getResultGeometry=function(t){var e=null,r=!1,s=null;try{e=we.overlayOp(this._geom[0],this._geom[1],t);var l=!0;l&&(r=!0)}catch(p){if(p instanceof aa)s=p;else throw p}finally{}if(!r)try{e=zi.overlayOp(this._geom[0],this._geom[1],t)}catch(p){throw p instanceof aa?s:p}finally{}return e};pr.prototype.interfaces_=function(){return[]};pr.prototype.getClass=function(){return pr};pr.overlayOp=function(t,e,r){var s=new pr(t,e);return s.getResultGeometry(r)};pr.union=function(t,e){return pr.overlayOp(t,e,we.UNION)};pr.intersection=function(t,e){return pr.overlayOp(t,e,we.INTERSECTION)};pr.symDifference=function(t,e){return pr.overlayOp(t,e,we.SYMDIFFERENCE)};pr.difference=function(t,e){return pr.overlayOp(t,e,we.DIFFERENCE)};var Up=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Up.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};Up.prototype.interfaces_=function(){return[]};Up.prototype.getClass=function(){return Up};var Vr=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(arguments.length===3){var s=arguments[0],l=arguments[1],p=arguments[2];this._eventType=t.INSERT,this._label=s,this._xValue=l,this._obj=p}},Ag={INSERT:{configurable:!0},DELETE:{configurable:!0}};Vr.prototype.isDelete=function(){return this._eventType===Vr.DELETE};Vr.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};Vr.prototype.getObject=function(){return this._obj};Vr.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};Vr.prototype.getInsertEvent=function(){return this._insertEvent};Vr.prototype.isInsert=function(){return this._eventType===Vr.INSERT};Vr.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};Vr.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Vr.prototype.interfaces_=function(){return[bo]};Vr.prototype.getClass=function(){return Vr};Ag.INSERT.get=function(){return 1};Ag.DELETE.get=function(){return 2};Object.defineProperties(Vr,Ag);var xf=function(){};xf.prototype.interfaces_=function(){return[]};xf.prototype.getClass=function(){return xf};var Gi=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};Gi.prototype.isTrivialIntersection=function(t,e,r,s){if(t===r&&this._li.getIntersectionNum()===1){if(Gi.isAdjacentSegments(e,s))return!0;if(t.isClosed()){var l=t.getNumPoints()-1;if(e===0&&s===l||s===0&&e===l)return!0}}return!1};Gi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Gi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Gi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Gi.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var s=r.next(),l=s.getCoordinate();if(t.isIntersection(l))return!0}return!1};Gi.prototype.hasProperIntersection=function(){return this._hasProper};Gi.prototype.hasIntersection=function(){return this._hasIntersection};Gi.prototype.isDone=function(){return this._isDone};Gi.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};Gi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};Gi.prototype.addIntersections=function(t,e,r,s){if(t===r&&e===s)return null;this.numTests++;var l=t.getCoordinates()[e],p=t.getCoordinates()[e+1],m=r.getCoordinates()[s],c=r.getCoordinates()[s+1];this._li.computeIntersection(l,p,m,c),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,s)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),r.addIntersections(this._li,s,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};Gi.prototype.interfaces_=function(){return[]};Gi.prototype.getClass=function(){return Gi};Gi.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var Rw=function(t){function e(){t.call(this),this.events=new qt,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var r=this;Uo.sort(this.events);for(var s=0;se||this._maxp?1:0};qp.prototype.interfaces_=function(){return[qc]};qp.prototype.getClass=function(){return qp};var Nw=function(t){function e(){t.call(this),this._item=null;var r=arguments[0],s=arguments[1],l=arguments[2];this._min=r,this._max=s,this._item=l}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(r,s,l){if(!this.intersects(r,s))return null;l.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Vs),kw=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var r=arguments[0],s=arguments[1];this._node1=r,this._node2=s,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(r,s){this._min=Math.min(r._min,s._min),this._max=Math.max(r._max,s._max)},e.prototype.query=function(r,s,l){if(!this.intersects(r,s))return null;this._node1!==null&&this._node1.query(r,s,l),this._node2!==null&&this._node2.query(r,s,l)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Vs),Us=function(){this._leaves=new qt,this._root=null,this._level=0};Us.prototype.buildTree=function(){var t=this;Uo.sort(this._leaves,new Vs.NodeComparator);for(var e=this._leaves,r=null,s=new qt;;){if(t.buildLevel(e,s),s.size()===1)return s.get(0);r=e,e=s,s=r}};Us.prototype.insert=function(t,e,r){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Nw(t,e,r))};Us.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)};Us.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Us.prototype.printNode=function(t){Vi.out.println(Fo.toLineString(new ct(t._min,this._level),new ct(t._max,this._level)))};Us.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Us.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,s[0]),this.insertBoundaryPoint(this._argIndex,s[s.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var r=this.getBoundaryNodes(),s=new Array(r.size()).fill(null),l=0,p=r.iterator();p.hasNext();){var m=p.next();s[l++]=m.getCoordinate().copy()}return s},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(r,s,l){if(this.isBoundaryNode(r,s))return null;l===dt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(r,s):this.insertPoint(r,s,l)},e.prototype.addPolygonRing=function(r,s,l){if(r.isEmpty())return null;var p=Oe.removeRepeatedPoints(r.getCoordinates());if(p.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=p[0],null;var m=s,c=l;Kt.isCCW(p)&&(m=l,c=s);var S=new vf(p,new nn(this._argIndex,dt.BOUNDARY,m,c));this._lineEdgeMap.put(r,S),this.insertEdge(S),this.insertPoint(this._argIndex,p[0],dt.BOUNDARY)},e.prototype.insertPoint=function(r,s,l){var p=this._nodes.addNode(s),m=p.getLabel();m===null?p._label=new nn(r,l):m.setLocation(r,l)},e.prototype.createEdgeSetIntersector=function(){return new Rw},e.prototype.addSelfIntersectionNodes=function(r){for(var s=this,l=this._edges.iterator();l.hasNext();)for(var p=l.next(),m=p.getLabel().getLocation(r),c=p.eiList.iterator();c.hasNext();){var S=c.next();s.addSelfIntersectionNode(r,S.coord,m)}},e.prototype.add=function(){if(arguments.length===1){var r=arguments[0];if(r.isEmpty())return null;if(r instanceof Ms&&(this._useBoundaryDeterminationRule=!1),r instanceof mi)this.addPolygon(r);else if(r instanceof Zn)this.addLineString(r);else if(r instanceof Or)this.addPoint(r);else if(r instanceof Yc)this.addCollection(r);else if(r instanceof bl)this.addCollection(r);else if(r instanceof Ms)this.addCollection(r);else if(r instanceof ur)this.addCollection(r);else throw new Error(r.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(r){for(var s=this,l=0;l50?(this._areaPtLocator===null&&(this._areaPtLocator=new nh(this._parentGeom)),this._areaPtLocator.locate(r)):this._ptLocator.locate(r,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var r=arguments[0];return this._lineEdgeMap.get(r)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(r,s){return r.isInBoundary(s)?dt.BOUNDARY:dt.INTERIOR},e}(Vn),rh=function(){if(this._li=new Al,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new _p(0,t)}else if(arguments.length===2){var e=arguments[0],r=arguments[1],s=go.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new _p(0,e,s),this._arg[1]=new _p(1,r,s)}else if(arguments.length===3){var l=arguments[0],p=arguments[1],m=arguments[2];l.getPrecisionModel().compareTo(p.getPrecisionModel())>=0?this.setComputationPrecision(l.getPrecisionModel()):this.setComputationPrecision(p.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new _p(0,l,m),this._arg[1]=new _p(1,p,m)}};rh.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};rh.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};rh.prototype.interfaces_=function(){return[]};rh.prototype.getClass=function(){return rh};var yl=function(){};yl.prototype.interfaces_=function(){return[]};yl.prototype.getClass=function(){return yl};yl.map=function(){if(arguments[0]instanceof pe&&me(arguments[1],yl.MapOp)){for(var t=arguments[0],e=arguments[1],r=new qt,s=0;s=t.size()?null:t.get(e)};si.union=function(t){var e=new si(t);return e.union()};rv.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(si,rv);var bf=function(){};bf.prototype.interfaces_=function(){return[]};bf.prototype.getClass=function(){return bf};bf.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return we.createEmptyResult(we.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),pr.overlayOp(t,e,we.UNION)};function Ml(){return new wf}function wf(){this.reset()}wf.prototype={constructor:wf,reset:function(){this.s=this.t=0},add:function(t){Xy(af,t,this.t),Xy(this,af.s,this.s),this.s?this.t+=af.t:this.s=af.t},valueOf:function(){return this.s}};var af=new wf;function Xy(t,e,r){var s=t.s=e+r,l=s-e,p=s-l;t.t=e-p+(r-l)}var ug=Math.PI,Yy=ug*2;Ml();Ml();Ml();function Ky(t,e){return[t>ug?t-Yy:t<-ug?t+Yy:t,e]}Ky.invert=Ky;function ov(t,e){return te?1:t>=e?0:NaN}function zw(t){return t.length===1&&(t=Ow(t)),{left:function(e,r,s,l){for(s==null&&(s=0),l==null&&(l=e.length);s>>1;t(e[p],r)<0?s=p+1:l=p}return s},right:function(e,r,s,l){for(s==null&&(s=0),l==null&&(l=e.length);s>>1;t(e[p],r)>0?l=p:s=p+1}return s}}}function Ow(t){return function(e,r){return ov(t(e),r)}}zw(ov);Ml();Ml();Ml();Ml();Ml();function Jy(){}Jy.prototype={constructor:Jy,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Qy(t,e){return[t,e]}Qy.invert=Qy;const Fw=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],Bw={decimalLatitude:40.123,decimalLongitude:-74.123},Vw=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],Uw=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function qw(){const t=[];return Fw.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...Bw})}),[...t,...Vw,...Uw]}const Gw=qw();Gw.map(t=>t.verbatimCoordinates);const jw=Symbol.for("svelte-maplibre");function Zw(){return u0(jw)}function Hw(t){return"layerType"in t&&t.layerType==="deckgl"}const Ww=t=>({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),$y=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function t0(t){let e,r,s=(t[4]||t[3]instanceof As.Marker)&&e0(t);return{c(){e=rn("div"),s&&s.c()},m(l,p){un(l,e,p),s&&s.m(e,null),t[32](e),r=!0},p(l,p){l[4]||l[3]instanceof As.Marker?s?(s.p(l,p),p[0]&24&&wn(s,1)):(s=e0(l),s.c(),wn(s,1),s.m(e,null)):s&&(sh(),Qn(s,1,1,()=>{s=null}),ah())},i(l){r||(wn(s),r=!0)},o(l){Qn(s),r=!1},d(l){l&&on(e),s&&s.d(),t[32](null)}}}function e0(t){let e;const r=t[30].default,s=uu(r,t,t[29],$y);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p[0]&536870933)&&hu(s,r,l,l[29],e?cu(r,l[29],p,Ww):pu(l[29]),$y)},i(l){e||(wn(s,l),e=!0)},o(l){Qn(s,l),e=!1},d(l){s&&s.d(l)}}}function Xw(t){let e,r,s=t[9].default&&t0(t);return{c(){s&&s.c(),e=If()},m(l,p){s&&s.m(l,p),un(l,e,p),r=!0},p(l,p){l[9].default?s?(s.p(l,p),p[0]&512&&wn(s,1)):(s=t0(l),s.c(),wn(s,1),s.m(e.parentNode,e)):s&&(sh(),Qn(s,1,1,()=>{s=null}),ah())},i(l){r||(wn(s),r=!0)},o(l){Qn(s),r=!1},d(l){l&&on(e),s&&s.d(l)}}}function Yw(t,e,r){let s,l,p,m,c,S,{$$slots:L={},$$scope:R}=e;const k=t1(L);let{closeButton:U=void 0}=e,{closeOnClickOutside:ut=!0}=e,{closeOnClickInside:pt=!1}=e,{closeOnMove:vt=!1}=e,{openOn:bt="click"}=e,{openIfTopMost:Dt=!0}=e,{focusAfterOpen:Rt=!0}=e,{anchor:Gt=void 0}=e,{offset:se=void 0}=e,{popupClass:de=void 0}=e,{maxWidth:Ve=void 0}=e,{lngLat:he=void 0}=e,{html:Me=void 0}=e,{open:_e=!1}=e;const be=hg(),{map:Nt,popupTarget:sn,layerEvent:ke,layer:ye,eventTopMost:Xe}=Zw();$r(t,Nt,St=>r(2,p=St)),$r(t,sn,St=>r(3,c=St)),$r(t,ke,St=>r(28,m=St)),$r(t,ye,St=>r(35,S=St));const Cn=["click","dblclick","contextmenu"];let fe,an=!1,Dn;function ji(){if(!fe)return;let St=fe.getElement();!St||St===Dn||(Dn=St,bt==="hover"&&(Dn.style.pointerEvents="none"),Dn.addEventListener("mouseenter",()=>{r(24,an=!0)},{passive:!0}),Dn.addEventListener("mouseleave",()=>{r(24,an=!1)},{passive:!0}),Dn.addEventListener("click",()=>{pt&&r(0,_e=!1)},{passive:!0}))}a1(()=>{if(p)return p.on("click",li),p.on("contextmenu",li),typeof c=="string"&&(p.on("click",c,In),p.on("dblclick",c,In),p.on("contextmenu",c,In),p.on("mousemove",c,gi),p.on("mouseleave",c,Rn),p.on("touchstart",c,Ue),p.on("touchend",c,gn)),()=>{p!=null&&p.loaded()&&(fe==null||fe.remove(),p.off("click",li),p.off("contextmenu",li),c instanceof As.Marker?c.getPopup()===fe&&c.setPopup(void 0):typeof c=="string"&&(p.off("click",c,In),p.off("dblclick",c,In),p.off("contextmenu",c,In),p.off("mousemove",c,gi),p.off("mouseleave",c,Rn),p.off("touchstart",c,Ue),p.off("touchend",c,gn)))}});function mn(St){return Dt?!("marker"in St)&&!Hw(St)&&Xe(St)!==S:!1}let Re=null,ln="normal";function In(St){St.type===bt&&(mn(St)||("layerType"in St?St.layerType==="deckgl"?(r(10,he=St.coordinate),r(4,Re=St.object?[St.object]:null)):(r(10,he=St.lngLat),r(4,Re=St.features??[])):(r(10,he=St.lngLat),r(4,Re=St.features??[])),setTimeout(()=>r(0,_e=!0))))}let hn=null;function Ue(St){hn=St.point}function gn(St){if(!hn||bt!=="hover")return;let ui=hn.dist(St.point);hn=null,ui<3&&(r(10,he=St.lngLat),r(4,Re=St.features??[]),fe.isOpen()?r(25,ln="justOpened"):(r(25,ln="opening"),r(0,_e=!0)))}function Rn(St){bt!=="hover"||hn||ln!=="normal"||(r(0,_e=!1),r(4,Re=null))}function gi(St){if(!(bt!=="hover"||hn||ln!=="normal")){if(mn(St)){r(0,_e=!1),r(4,Re=null);return}r(0,_e=!0),r(4,Re=St.features??[]),r(10,he=St.lngLat)}}function li(St){if(ln==="justOpened"){r(25,ln="normal");return}if(!ut)return;let ui=[Dn,c instanceof As.Marker?c==null?void 0:c.getElement():null];_e&&fe.isOpen()&&!ui.some(Nn=>Nn==null?void 0:Nn.contains(St.originalEvent.target))&&(St.type==="contextmenu"&&bt==="contextmenu"||St.type!=="contextmenu")&&r(0,_e=!1)}du(()=>{p&&(fe!=null&&fe.isOpen())&&fe.remove()});let Wn;const ii=()=>r(0,_e=!1);function jt(St){Uc[St?"unshift":"push"](()=>{Wn=St,r(1,Wn)})}return t.$$set=St=>{"closeButton"in St&&r(11,U=St.closeButton),"closeOnClickOutside"in St&&r(12,ut=St.closeOnClickOutside),"closeOnClickInside"in St&&r(13,pt=St.closeOnClickInside),"closeOnMove"in St&&r(14,vt=St.closeOnMove),"openOn"in St&&r(15,bt=St.openOn),"openIfTopMost"in St&&r(16,Dt=St.openIfTopMost),"focusAfterOpen"in St&&r(17,Rt=St.focusAfterOpen),"anchor"in St&&r(18,Gt=St.anchor),"offset"in St&&r(19,se=St.offset),"popupClass"in St&&r(20,de=St.popupClass),"maxWidth"in St&&r(21,Ve=St.maxWidth),"lngLat"in St&&r(10,he=St.lngLat),"html"in St&&r(22,Me=St.html),"open"in St&&r(0,_e=St.open),"$$scope"in St&&r(29,R=St.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&r(27,s=U??(!ut&&!pt)),t.$$.dirty[0]&146685952&&(fe||(r(23,fe=new As.Popup({closeButton:s,closeOnClick:!1,closeOnMove:vt,focusAfterOpen:Rt,maxWidth:Ve,className:de,anchor:Gt,offset:se})),Dn=fe.getElement(),fe.on("open",()=>{r(0,_e=!0),ji(),be("open",fe)}),fe.on("close",()=>{r(0,_e=!1),be("close",fe)}),fe.on("hover",()=>{be("hover",fe)}))),t.$$.dirty[0]&8421384&&fe&&c instanceof As.Marker&&(bt==="click"?c.setPopup(fe):c.getPopup()===fe&&c.setPopup(void 0)),t.$$.dirty[0]&268468224&&Cn.includes(bt)&&(m==null?void 0:m.type)===bt&&(In(m),wp(ke,m=null,m)),t.$$.dirty[0]&268468224&&r(26,l=bt==="hover"&&((m==null?void 0:m.type)==="mousemove"||(m==null?void 0:m.type)==="mouseenter")),t.$$.dirty[0]&352354304&&bt==="hover"&&ke&&(l&&m&&(m.layerType==="deckgl"?(r(10,he=m.coordinate),r(4,Re=m.object?[m.object]:null)):(r(10,he=m.lngLat),r(4,Re=m.features??[]))),r(0,_e=(l||an)??!1)),t.$$.dirty[0]&12582914&&(Wn?fe.setDOMContent(Wn):Me&&fe.setHTML(Me)),t.$$.dirty[0]&8389632&&he&&fe.setLngLat(he),t.$$.dirty[0]&41943045&&p){let St=fe.isOpen();_e&&!St?(fe.addTo(p),ln==="opening"&&r(25,ln="justOpened")):!_e&&St&&fe.remove()}},[_e,Wn,p,c,Re,Nt,sn,ke,ye,k,he,U,ut,pt,vt,bt,Dt,Rt,Gt,se,de,Ve,Me,fe,an,ln,l,s,m,R,L,ii,jt]}class Kw extends xo{constructor(e){super(),vo(this,e,Yw,Xw,Ur,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}const Jw=t=>({props:t&8}),n0=t=>({props:t2(t[3])});function Qw(t){let e;const r=t[1].default,s=uu(r,t,t[2],n0);return{c(){s&&s.c()},m(l,p){s&&s.m(l,p),e=!0},p(l,p){s&&s.p&&(!e||p&12)&&hu(s,r,l,l[2],e?cu(r,l[2],p,Jw):pu(l[2]),n0)},i(l){e||(wn(s,l),e=!0)},o(l){Qn(s,l),e=!1},d(l){s&&s.d(l)}}}function $w(t){let e,r;return e=new Kw({props:{openOn:t[0],$$slots:{default:[Qw,({features:s})=>({3:s}),({features:s})=>s?8:0]},$$scope:{ctx:t}}}),{c(){zc(e.$$.fragment)},m(s,l){su(e,s,l),r=!0},p(s,[l]){const p={};l&1&&(p.openOn=s[0]),l&12&&(p.$$scope={dirty:l,ctx:s}),e.$set(p)},i(s){r||(wn(e.$$.fragment,s),r=!0)},o(s){Qn(e.$$.fragment,s),r=!1},d(s){au(e,s)}}}function t2(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function e2(t,e,r){let{$$slots:s={},$$scope:l}=e,{openOn:p="hover"}=e;return t.$$set=m=>{"openOn"in m&&r(0,p=m.openOn),"$$scope"in m&&r(2,l=m.$$scope)},[p,s,l]}class M2 extends xo{constructor(e){super(),vo(this,e,e2,$w,Ur,{openOn:0})}}function D2(t,e,r){let s=["step",t];for(let l=1;l({}),i0=t=>({}),i2=t=>({}),r0=t=>({});function r2(t){let e,r,s,l;const p=t[1].left,m=uu(p,t,t[0],r0),c=t[1].main,S=uu(c,t,t[0],i0);return{c(){e=rn("div"),m&&m.c(),r=Xi(),s=rn("div"),S&&S.c(),Tn(e,"class","left svelte-6kzmjs"),Tn(s,"class","main svelte-6kzmjs")},m(L,R){un(L,e,R),m&&m.m(e,null),un(L,r,R),un(L,s,R),S&&S.m(s,null),l=!0},p(L,[R]){m&&m.p&&(!l||R&1)&&hu(m,p,L,L[0],l?cu(p,L[0],R,i2):pu(L[0]),r0),S&&S.p&&(!l||R&1)&&hu(S,c,L,L[0],l?cu(c,L[0],R,n2):pu(L[0]),i0)},i(L){l||(wn(m,L),wn(S,L),l=!0)},o(L){Qn(m,L),Qn(S,L),l=!1},d(L){L&&(on(e),on(r),on(s)),m&&m.d(L),S&&S.d(L)}}}function o2(t,e,r){let{$$slots:s={},$$scope:l}=e;return t.$$set=p=>{"$$scope"in p&&r(0,l=p.$$scope)},[l,s]}class R2 extends xo{constructor(e){super(),vo(this,e,o2,r2,Ur,{})}}export{T0 as $,l1 as A,my as B,o1 as C,If as D,Ir as E,m2 as F,uu as G,T2 as H,e1 as I,u2 as J,l2 as K,R2 as L,b2 as M,hu as N,pu as O,f2 as P,cu as Q,cg as R,xo as S,hg as T,_2 as U,$r as V,wp as W,h2 as X,p2 as Y,vb as Z,x1 as _,su as a,Ac as a0,oa as a1,w2 as a2,v2 as a3,Qx as a4,x2 as a5,mp as a6,D2 as a7,C2 as a8,S2 as a9,M2 as aa,P2 as ab,Tp as ac,du as ad,n1 as ae,c2 as af,L2 as ag,E2 as ah,A2 as ai,I2 as aj,d2 as ak,a2 as al,g2 as am,A0 as an,y2 as ao,hb as ap,pb as aq,l0 as ar,u0 as as,ml as at,hf as au,Qn as b,zc as c,au as d,rn as e,Xi as f,vl as g,Tn as h,vo as i,Vm as j,pf as k,un as l,As as m,Sn as n,a1 as o,cy as p,yp as q,sh as r,Ur as s,wn as t,ah as u,on as v,Cu as w,Uc as x,h1 as y,ko as z}; diff --git a/assets/SidebarControls-547244ee.js b/assets/SidebarControls-547244ee.js deleted file mode 100644 index 3668352..0000000 --- a/assets/SidebarControls-547244ee.js +++ /dev/null @@ -1,9 +0,0 @@ -import{S as me,i as de,s as be,Y as ct,x as We,y as Ee,c as P,a as V,A as Fe,t as z,b as M,d as W,Z as _t,G as mt,K as dt,N as bt,O as gt,$ as F,a0 as Le,a1 as ot,a2 as it,a3 as ye,a4 as Lt,a5 as R,f as S,l as p,v as y,U as $,a6 as Ct,a7 as ht,a8 as vt,D as pt,r as yt,u as wt,a9 as Ge,aa as St,g as I,ab as _e,e as h,h as j,n as d,q as H,E as De,w as Ke,ac as Tt,ad as zt,ae as It,j as x,z as st,W as re,af as Mt,ag as A,ah as Ot}from"./Layout-4cd70fb2.js";function we(e,t){const l={},n={},o={$$scope:1};let a=e.length;for(;a--;){const s=e[a],i=t[a];if(i){for(const r in s)r in i||(n[r]=1);for(const r in i)o[r]||(l[r]=i[r],o[r]=1);e[a]=i}else for(const r in s)o[r]=1}for(const s in n)s in l||(l[s]=void 0);return l}function ke(e){return typeof e=="object"&&e!==null?e:{}}function Rt(e){let t;const l=e[16].default,n=mt(l,e,e[24],null);return{c(){n&&n.c()},m(o,a){n&&n.m(o,a),t=!0},p(o,a){n&&n.p&&(!t||a&16777216)&&dt(n,l,o,o[24],t?gt(l,o[24],a,null):bt(o[24]),null)},i(o){t||(z(n,o),t=!0)},o(o){M(n,o),t=!1},d(o){n&&n.d(o)}}}function Ht(e){let t,l,n;function o(s){e[17](s)}let a={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[Rt]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new ct({props:a}),We.push(()=>Ee(t,"hovered",o)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){P(t.$$.fragment)},m(s,i){V(t,s,i),n=!0},p(s,[i]){const r={};i&2&&(r.id=s[1]),i&4&&(r.source=s[2]),i&8&&(r.sourceLayer=s[3]),i&16&&(r.beforeId=s[4]),i&32&&(r.beforeLayerType=s[5]),i&64&&(r.paint=s[6]),i&128&&(r.layout=s[7]),i&256&&(r.filter=s[8]),i&512&&(r.applyToClusters=s[9]),i&1024&&(r.minzoom=s[10]),i&2048&&(r.maxzoom=s[11]),i&4096&&(r.hoverCursor=s[12]),i&8192&&(r.manageHoverState=s[13]),i&16384&&(r.eventsIfTopMost=s[14]),i&32768&&(r.interactive=s[15]),i&16777216&&(r.$$scope={dirty:i,ctx:s}),!l&&i&1&&(l=!0,r.hovered=s[0],Fe(()=>l=!1)),t.$set(r)},i(s){n||(z(t.$$.fragment,s),n=!0)},o(s){M(t.$$.fragment,s),n=!1},d(s){W(t,s)}}}function Nt(e,t,l){let{$$slots:n={},$$scope:o}=t,{id:a=_t("circle")}=t,{source:s=void 0}=t,{sourceLayer:i=void 0}=t,{beforeId:r=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:v}=t,{layout:C=void 0}=t,{filter:L=void 0}=t,{applyToClusters:b=void 0}=t,{minzoom:k=void 0}=t,{maxzoom:T=void 0}=t,{hoverCursor:O=void 0}=t,{manageHoverState:f=!1}=t,{hovered:m=null}=t,{eventsIfTopMost:N=!1}=t,{interactive:q=!0}=t;function D(u){m=u,l(0,m)}function w(u){F.call(this,e,u)}function ne(u){F.call(this,e,u)}function K(u){F.call(this,e,u)}function le(u){F.call(this,e,u)}function Z(u){F.call(this,e,u)}function ee(u){F.call(this,e,u)}return e.$$set=u=>{"id"in u&&l(1,a=u.id),"source"in u&&l(2,s=u.source),"sourceLayer"in u&&l(3,i=u.sourceLayer),"beforeId"in u&&l(4,r=u.beforeId),"beforeLayerType"in u&&l(5,c=u.beforeLayerType),"paint"in u&&l(6,v=u.paint),"layout"in u&&l(7,C=u.layout),"filter"in u&&l(8,L=u.filter),"applyToClusters"in u&&l(9,b=u.applyToClusters),"minzoom"in u&&l(10,k=u.minzoom),"maxzoom"in u&&l(11,T=u.maxzoom),"hoverCursor"in u&&l(12,O=u.hoverCursor),"manageHoverState"in u&&l(13,f=u.manageHoverState),"hovered"in u&&l(0,m=u.hovered),"eventsIfTopMost"in u&&l(14,N=u.eventsIfTopMost),"interactive"in u&&l(15,q=u.interactive),"$$scope"in u&&l(24,o=u.$$scope)},[m,a,s,i,r,c,v,C,L,b,k,T,O,f,N,q,n,D,w,ne,K,le,Z,ee,o]}class at extends me{constructor(t){super(),de(this,t,Nt,Ht,be,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function qt(e){let t;const l=e[16].default,n=mt(l,e,e[24],null);return{c(){n&&n.c()},m(o,a){n&&n.m(o,a),t=!0},p(o,a){n&&n.p&&(!t||a&16777216)&&dt(n,l,o,o[24],t?gt(l,o[24],a,null):bt(o[24]),null)},i(o){t||(z(n,o),t=!0)},o(o){M(n,o),t=!1},d(o){n&&n.d(o)}}}function Dt(e){let t,l,n;function o(s){e[17](s)}let a={id:e[1],type:"symbol",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[qt]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new ct({props:a}),We.push(()=>Ee(t,"hovered",o)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){P(t.$$.fragment)},m(s,i){V(t,s,i),n=!0},p(s,[i]){const r={};i&2&&(r.id=s[1]),i&4&&(r.source=s[2]),i&8&&(r.sourceLayer=s[3]),i&16&&(r.beforeId=s[4]),i&32&&(r.beforeLayerType=s[5]),i&64&&(r.paint=s[6]),i&128&&(r.layout=s[7]),i&256&&(r.filter=s[8]),i&512&&(r.applyToClusters=s[9]),i&1024&&(r.minzoom=s[10]),i&2048&&(r.maxzoom=s[11]),i&4096&&(r.hoverCursor=s[12]),i&8192&&(r.manageHoverState=s[13]),i&16384&&(r.eventsIfTopMost=s[14]),i&32768&&(r.interactive=s[15]),i&16777216&&(r.$$scope={dirty:i,ctx:s}),!l&&i&1&&(l=!0,r.hovered=s[0],Fe(()=>l=!1)),t.$set(r)},i(s){n||(z(t.$$.fragment,s),n=!0)},o(s){M(t.$$.fragment,s),n=!1},d(s){W(t,s)}}}function Bt(e,t,l){let{$$slots:n={},$$scope:o}=t,{id:a=_t("symbol")}=t,{source:s=void 0}=t,{sourceLayer:i=void 0}=t,{beforeId:r=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:v=void 0}=t,{layout:C=void 0}=t,{filter:L=void 0}=t,{applyToClusters:b=void 0}=t,{minzoom:k=void 0}=t,{maxzoom:T=void 0}=t,{hoverCursor:O=void 0}=t,{manageHoverState:f=!1}=t,{hovered:m=null}=t,{eventsIfTopMost:N=!1}=t,{interactive:q=!0}=t;function D(u){m=u,l(0,m)}function w(u){F.call(this,e,u)}function ne(u){F.call(this,e,u)}function K(u){F.call(this,e,u)}function le(u){F.call(this,e,u)}function Z(u){F.call(this,e,u)}function ee(u){F.call(this,e,u)}return e.$$set=u=>{"id"in u&&l(1,a=u.id),"source"in u&&l(2,s=u.source),"sourceLayer"in u&&l(3,i=u.sourceLayer),"beforeId"in u&&l(4,r=u.beforeId),"beforeLayerType"in u&&l(5,c=u.beforeLayerType),"paint"in u&&l(6,v=u.paint),"layout"in u&&l(7,C=u.layout),"filter"in u&&l(8,L=u.filter),"applyToClusters"in u&&l(9,b=u.applyToClusters),"minzoom"in u&&l(10,k=u.minzoom),"maxzoom"in u&&l(11,T=u.maxzoom),"hoverCursor"in u&&l(12,O=u.hoverCursor),"manageHoverState"in u&&l(13,f=u.manageHoverState),"hovered"in u&&l(0,m=u.hovered),"eventsIfTopMost"in u&&l(14,N=u.eventsIfTopMost),"interactive"in u&&l(15,q=u.interactive),"$$scope"in u&&l(24,o=u.$$scope)},[m,a,s,i,r,c,v,C,L,b,k,T,O,f,N,q,n,D,w,ne,K,le,Z,ee,o]}class jt extends me{constructor(t){super(),de(this,t,Bt,Dt,be,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}let Be=Le(!0),je=Le(!1),Pe=Le(!1),Ve=Le(!1);function rt(e){let t,l;return t=new Ge({props:{$$slots:{default:[Pt,({props:n})=>({10:n}),({props:n})=>n?1024:0]},$$scope:{ctx:e}}}),{c(){P(t.$$.fragment)},m(n,o){V(t,n,o),l=!0},p(n,o){const a={};o&3072&&(a.$$scope={dirty:o,ctx:n}),t.$set(a)},i(n){l||(z(t.$$.fragment,n),l=!0)},o(n){M(t.$$.fragment,n),l=!1},d(n){W(t,n)}}}function Pt(e){let t,l;return t=new St({props:{properties:e[10]}}),{c(){P(t.$$.fragment)},m(n,o){V(t,n,o),l=!0},p(n,o){const a={};o&1024&&(a.properties=n[10]),t.$set(a)},i(n){l||(z(t.$$.fragment,n),l=!0)},o(n){M(t.$$.fragment,n),l=!1},d(n){W(t,n)}}}function Vt(e){let t,l,n=e[2]&&rt(e);return{c(){n&&n.c(),t=pt()},m(o,a){n&&n.m(o,a),p(o,t,a),l=!0},p(o,a){o[2]?n?(n.p(o,a),a&4&&z(n,1)):(n=rt(o),n.c(),z(n,1),n.m(t.parentNode,t)):n&&(yt(),M(n,1,1,()=>{n=null}),wt())},i(o){l||(z(n),l=!0)},o(o){M(n),l=!1},d(o){o&&y(t),n&&n.d(o)}}}function Wt(e){let t=e[10].origin_count+"",l,n;return{c(){l=I(t),n=I(" routes start here")},m(o,a){p(o,l,a),p(o,n,a)},p(o,a){a&1024&&t!==(t=o[10].origin_count+"")&&_e(l,t)},d(o){o&&(y(l),y(n))}}}function Et(e){let t,l;return t=new Ge({props:{$$slots:{default:[Wt,({props:n})=>({10:n}),({props:n})=>n?1024:0]},$$scope:{ctx:e}}}),{c(){P(t.$$.fragment)},m(n,o){V(t,n,o),l=!0},p(n,o){const a={};o&3072&&(a.$$scope={dirty:o,ctx:n}),t.$set(a)},i(n){l||(z(t.$$.fragment,n),l=!0)},o(n){M(t.$$.fragment,n),l=!1},d(n){W(t,n)}}}function Ft(e){let t=e[10].destination_count+"",l,n;return{c(){l=I(t),n=I(" routes end here")},m(o,a){p(o,l,a),p(o,n,a)},p(o,a){a&1024&&t!==(t=o[10].destination_count+"")&&_e(l,t)},d(o){o&&(y(l),y(n))}}}function Gt(e){let t,l;return t=new Ge({props:{$$slots:{default:[Ft,({props:n})=>({10:n}),({props:n})=>n?1024:0]},$$scope:{ctx:e}}}),{c(){P(t.$$.fragment)},m(n,o){V(t,n,o),l=!0},p(n,o){const a={};o&3072&&(a.$$scope={dirty:o,ctx:n}),t.$set(a)},i(n){l||(z(t.$$.fragment,n),l=!0)},o(n){M(t.$$.fragment,n),l=!1},d(n){W(t,n)}}}function Kt(e){let t,l,n,o,a,s,i,r;const c=[{id:"input-layer"},e[0],{filter:["==",["geometry-type"],"LineString"]},{manageHoverState:!0},{hoverCursor:e[2]?"pointer":void 0},{paint:{"line-width":e[3],"line-color":e[4]?e[9]:ot,"line-opacity":it(1,.5)}},{layout:{visibility:e[5]?"visible":"none"}},{beforeId:"Road labels"}];let v={$$slots:{default:[Vt]},$$scope:{ctx:e}};for(let f=0;f",["abs",["get","slope"]],3]]},{minzoom:12},{layout:{"icon-image":"chevron","icon-size":1,"symbol-placement":"line","symbol-spacing":50,"icon-allow-overlap":!0,"icon-rotate":["case",["<",["get","slope"],0],180,0],visibility:e[4]?"visible":"none"}}];let L={};for(let f=0;fl(4,a=b)),$(e,Be,b=>l(5,s=b)),$(e,je,b=>l(6,i=b)),$(e,Pe,b=>l(7,r=b));let{sourceOverride:c={}}=t,{controls:v}=t;function C(b){if(!n)return;let k=b.detail.features[0].properties.way;window.open(`http://openstreetmap.org/way/${k}`,"_blank")}let L=Ct(["abs",["get","slope"]],vt,ht);return e.$$set=b=>{"sourceOverride"in b&&l(0,c=b.sourceOverride),"controls"in b&&l(1,v=b.controls)},e.$$.update=()=>{e.$$.dirty&2&&l(2,n=!v.streetviewOn),e.$$.dirty&2&&l(3,o=At(v.maxCount))},[c,v,n,o,a,s,i,r,C,L]}class nn extends me{constructor(t){super(),de(this,t,Jt,Kt,be,{sourceOverride:0,controls:1})}}const{window:Ut}=zt;function ut(e){let t,l,n,o,a,s,i,r,c,v,C;return c=It(e[6][0]),{c(){t=h("div"),l=h("label"),n=h("input"),o=I(` - Google StreetView`),a=S(),s=h("label"),i=h("input"),r=I(` - Bing Streetside`),j(n,"type","radio"),n.__value="google",x(n,n.__value),j(i,"type","radio"),i.__value="bing",x(i,i.__value),c.p(n,i)},m(L,b){p(L,t,b),d(t,l),d(l,n),n.checked=n.__value===e[1],d(l,o),d(t,a),d(t,s),d(s,i),i.checked=i.__value===e[1],d(s,r),v||(C=[H(n,"change",e[5]),H(i,"change",e[7])],v=!0)},p(L,b){b&2&&(n.checked=n.__value===L[1]),b&2&&(i.checked=i.__value===L[1])},d(L){L&&y(t),c.r(),v=!1,Ke(C)}}}function Yt(e){let t,l,n,o,a,s,i,r=e[0]&&ut(e);return{c(){t=h("label"),l=h("input"),n=I(` - StreetView`),o=S(),r&&r.c(),a=pt(),j(l,"type","checkbox")},m(c,v){p(c,t,v),d(t,l),l.checked=e[0],d(t,n),p(c,o,v),r&&r.m(c,v),p(c,a,v),s||(i=[H(Ut,"keydown",e[2]),H(l,"change",e[4])],s=!0)},p(c,[v]){v&1&&(l.checked=c[0]),c[0]?r?r.p(c,v):(r=ut(c),r.c(),r.m(a.parentNode,a)):r&&(r.d(1),r=null)},i:De,o:De,d(c){c&&(y(t),y(o),y(a)),r&&r.d(c),s=!1,Ke(i)}}}function Zt(e,t,l){let{map:n}=t,{enabled:o=!1}=t,a="google";function s(){n.on("click",r),n.getCanvas().style.cursor="zoom-in"}function i(){n.off("click",r),n.getCanvas().style.cursor="auto"}Tt(i);function r(k){let T=k.lngLat.lng,O=k.lngLat.lat;a=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${O},${T}&cbp=11,0,0,0,0`,"_blank"):a=="bing"&&window.open(`https://www.bing.com/maps?cp=${O}~${T}&style=x`,"_blank")}function c(k){o&&k.key=="Escape"&&l(0,o=!1)}const v=[[]];function C(){o=this.checked,l(0,o)}function L(){a=this.__value,l(1,a)}function b(){a=this.__value,l(1,a)}return e.$$set=k=>{"map"in k&&l(3,n=k.map),"enabled"in k&&l(0,o=k.enabled)},e.$$.update=()=>{e.$$.dirty&1&&(o?s():i())},[o,a,c,n,C,L,v,b]}class Qt extends me{constructor(t){super(),de(this,t,Zt,Yt,be,{map:3,enabled:0})}}function ft(e){let t,l,n,o,a,s;return{c(){t=h("div"),l=h("label"),n=h("input"),o=I(` - Visualize slope`),j(n,"type","checkbox")},m(i,r){p(i,t,r),d(t,l),d(l,n),n.checked=e[6],d(l,o),a||(s=H(n,"change",e[17]),a=!0)},p(i,r){r&64&&(n.checked=i[6])},d(i){i&&y(t),a=!1,s()}}}function Xt(e){let t,l,n,o,a,s;return n=new Mt({props:{rows:[[`${A.lts1}: ${J(e[1].total_meters_lts1)}`,R.lts1],[`${A.lts2}: ${J(e[1].total_meters_lts2)}`,R.lts2],[`${A.lts3}: ${J(e[1].total_meters_lts3)}`,R.lts3],[`${A.lts4}: ${J(e[1].total_meters_lts4)}`,R.lts4],[`${A.lts_not_allowed}: ${J(e[1].total_meters_not_allowed)}`,R.lts_not_allowed]]}}),{c(){t=h("hr"),l=S(),P(n.$$.fragment),o=S(),a=h("p"),a.innerHTML='Note: LTS model from BikeOttawa'},m(i,r){p(i,t,r),p(i,l,r),V(n,i,r),p(i,o,r),p(i,a,r),s=!0},p(i,r){const c={};r&2&&(c.rows=[[`${A.lts1}: ${J(i[1].total_meters_lts1)}`,R.lts1],[`${A.lts2}: ${J(i[1].total_meters_lts2)}`,R.lts2],[`${A.lts3}: ${J(i[1].total_meters_lts3)}`,R.lts3],[`${A.lts4}: ${J(i[1].total_meters_lts4)}`,R.lts4],[`${A.lts_not_allowed}: ${J(i[1].total_meters_not_allowed)}`,R.lts_not_allowed]]),n.$set(c)},i(i){s||(z(n.$$.fragment,i),s=!0)},o(i){M(n.$$.fragment,i),s=!1},d(i){i&&(y(t),y(l),y(o),y(a)),W(n,i)}}}function xt(e){let t,l;return t=new Ot({props:{colorScale:ht,limits:vt}}),{c(){P(t.$$.fragment)},m(n,o){V(t,n,o),l=!0},p:De,i(n){l||(z(t.$$.fragment,n),l=!0)},o(n){M(t.$$.fragment,n),l=!1},d(n){W(t,n)}}}function $t(e){let t,l=e[1].config.requests.description+"",n,o,a,s,i,r,c,v,C,L,b,k,T,O,f,m,N,q,D,w,ne,K,le,Z=e[1].num_origins.toLocaleString()+"",ee,u,Ce,ge,oe,Ae,Je,Ue,U,Se,he,ue,ie,Ye,se,Ze,ve=e[1].num_destinations.toLocaleString()+"",Te,Qe,ze,pe,ae,Xe,xe,$e,Y,Ie,fe,E,G,ce,Me,Oe,Q,Re,te,He,et,B=e[1].config.elevation_geotiff&&ft(e);const tt=[xt,Xt],X=[];function nt(_,g){return _[6]?0:1}E=nt(e),G=X[E]=tt[E](e);function kt(_){e[18](_)}let lt={map:e[2]};return e[0].streetviewOn!==void 0&&(lt.enabled=e[0].streetviewOn),Q=new Qt({props:lt}),We.push(()=>Ee(Q,"enabled",kt)),{c(){t=h("p"),n=I(l),o=S(),a=h("div"),s=h("button"),s.textContent="See all output details",i=S(),r=h("div"),c=h("label"),v=h("input"),C=I(` - Route network`),L=S(),b=h("div"),k=h("label"),T=I(`Max for line width styling: - `),O=h("br"),f=S(),m=h("input"),N=S(),q=h("div"),D=h("label"),w=h("input"),ne=S(),K=h("span"),le=I("Origins ("),ee=I(Z),u=I(")"),Ce=S(),ge=h("div"),oe=h("label"),Ae=I(`Change origin point size: - `),Je=h("br"),Ue=S(),U=h("input"),Se=S(),he=h("div"),ue=h("label"),ie=h("input"),Ye=S(),se=h("span"),Ze=I("Destinations ("),Te=I(ve),Qe=I(")"),ze=S(),pe=h("div"),ae=h("label"),Xe=I(`Change destination point size: - `),xe=h("br"),$e=S(),Y=h("input"),Ie=S(),B&&B.c(),fe=S(),G.c(),ce=S(),Me=h("hr"),Oe=S(),P(Q.$$.fragment),j(v,"type","checkbox"),j(m,"type","number"),j(m,"min",1),j(w,"type","checkbox"),st(K,"color",R.origins),j(U,"type","number"),j(U,"min",1),j(ie,"type","checkbox"),st(se,"color",R.destinations),j(Y,"type","number"),j(Y,"min",1)},m(_,g){p(_,t,g),d(t,n),p(_,o,g),p(_,a,g),d(a,s),p(_,i,g),p(_,r,g),d(r,c),d(c,v),v.checked=e[3],d(c,C),p(_,L,g),p(_,b,g),d(b,k),d(k,T),d(k,O),d(k,f),d(k,m),x(m,e[0].maxCount),p(_,N,g),p(_,q,g),d(q,D),d(D,w),w.checked=e[4],d(D,ne),d(D,K),d(K,le),d(K,ee),d(K,u),p(_,Ce,g),p(_,ge,g),d(ge,oe),d(oe,Ae),d(oe,Je),d(oe,Ue),d(oe,U),x(U,e[0].originRadius),p(_,Se,g),p(_,he,g),d(he,ue),d(ue,ie),ie.checked=e[5],d(ue,Ye),d(ue,se),d(se,Ze),d(se,Te),d(se,Qe),p(_,ze,g),p(_,pe,g),d(pe,ae),d(ae,Xe),d(ae,xe),d(ae,$e),d(ae,Y),x(Y,e[0].destinationRadius),p(_,Ie,g),B&&B.m(_,g),p(_,fe,g),X[E].m(_,g),p(_,ce,g),p(_,Me,g),p(_,Oe,g),V(Q,_,g),te=!0,He||(et=[H(s,"click",e[7]),H(v,"change",e[8]),H(m,"input",e[9]),H(m,"change",e[10]),H(w,"change",e[11]),H(U,"input",e[12]),H(U,"change",e[13]),H(ie,"change",e[14]),H(Y,"input",e[15]),H(Y,"change",e[16])],He=!0)},p(_,[g]){(!te||g&2)&&l!==(l=_[1].config.requests.description+"")&&_e(n,l),g&8&&(v.checked=_[3]),g&1&&re(m.value)!==_[0].maxCount&&x(m,_[0].maxCount),g&16&&(w.checked=_[4]),(!te||g&2)&&Z!==(Z=_[1].num_origins.toLocaleString()+"")&&_e(ee,Z),g&1&&re(U.value)!==_[0].originRadius&&x(U,_[0].originRadius),g&32&&(ie.checked=_[5]),(!te||g&2)&&ve!==(ve=_[1].num_destinations.toLocaleString()+"")&&_e(Te,ve),g&1&&re(Y.value)!==_[0].destinationRadius&&x(Y,_[0].destinationRadius),_[1].config.elevation_geotiff?B?B.p(_,g):(B=ft(_),B.c(),B.m(fe.parentNode,fe)):B&&(B.d(1),B=null);let Ne=E;E=nt(_),E===Ne?X[E].p(_,g):(yt(),M(X[Ne],1,1,()=>{X[Ne]=null}),wt(),G=X[E],G?G.p(_,g):(G=X[E]=tt[E](_),G.c()),z(G,1),G.m(ce.parentNode,ce));const qe={};g&4&&(qe.map=_[2]),!Re&&g&1&&(Re=!0,qe.enabled=_[0].streetviewOn,Fe(()=>Re=!1)),Q.$set(qe)},i(_){te||(z(G),z(Q.$$.fragment,_),te=!0)},o(_){M(G),M(Q.$$.fragment,_),te=!1},d(_){_&&(y(t),y(o),y(a),y(i),y(r),y(L),y(b),y(N),y(q),y(Ce),y(ge),y(Se),y(he),y(ze),y(pe),y(Ie),y(fe),y(ce),y(Me),y(Oe)),B&&B.d(_),X[E].d(_),W(Q,_),He=!1,Ke(et)}}}function J(e){return`${(e/1e3).toFixed(1)} km total for all trips (before uptake)`}function en(e,t,l){let n,o,a,s;$(e,Be,w=>l(3,n=w)),$(e,je,w=>l(4,o=w)),$(e,Pe,w=>l(5,a=w)),$(e,Ve,w=>l(6,s=w));let{outputMetadata:i}=t,{map:r}=t,{controls:c}=t;const v=()=>window.alert(JSON.stringify(i,null," "));function C(){n=this.checked,Be.set(n)}function L(){c.maxCount=re(this.value),l(0,c)}const b=()=>l(0,c);function k(){o=this.checked,je.set(o)}function T(){c.originRadius=re(this.value),l(0,c)}const O=()=>l(0,c);function f(){a=this.checked,Pe.set(a)}function m(){c.destinationRadius=re(this.value),l(0,c)}const N=()=>l(0,c);function q(){s=this.checked,Ve.set(s)}function D(w){e.$$.not_equal(c.streetviewOn,w)&&(c.streetviewOn=w,l(0,c))}return e.$$set=w=>{"outputMetadata"in w&&l(1,i=w.outputMetadata),"map"in w&&l(2,r=w.map),"controls"in w&&l(0,c=w.controls)},[c,i,r,n,o,a,s,v,C,L,b,k,T,O,f,m,N,q,D]}class ln extends me{constructor(t){super(),de(this,t,en,$t,be,{outputMetadata:1,map:2,controls:0})}}export{nn as L,ln as S}; diff --git a/assets/SidebarControls-b43115a7.js b/assets/SidebarControls-b43115a7.js new file mode 100644 index 0000000..b4056cd --- /dev/null +++ b/assets/SidebarControls-b43115a7.js @@ -0,0 +1,9 @@ +import{S as me,i as de,s as be,Z as ct,x as Ee,y as Fe,c as j,a as P,A as Ge,t as z,b as M,d as E,$ as _t,G as mt,N as dt,O as bt,Q as gt,a0 as G,a1 as Le,a2 as ot,a3 as it,a4 as ye,a5 as Lt,a6 as R,f as S,l as p,v as y,V as $,a7 as Ct,a8 as ht,a9 as vt,D as pt,r as yt,u as wt,aa as We,ab as St,g as I,ac as _e,e as h,h as V,n as d,q as H,E as De,w as Ae,ad as Tt,ae as zt,af as It,j as x,z as st,X as re,ag as Mt,ah as J,ai as Ot}from"./Layout-6a808470.js";function we(e,t){const l={},n={},o={$$scope:1};let a=e.length;for(;a--;){const s=e[a],i=t[a];if(i){for(const r in s)r in i||(n[r]=1);for(const r in i)o[r]||(l[r]=i[r],o[r]=1);e[a]=i}else for(const r in s)o[r]=1}for(const s in n)s in l||(l[s]=void 0);return l}function ke(e){return typeof e=="object"&&e!==null?e:{}}function Rt(e){let t;const l=e[16].default,n=mt(l,e,e[24],null);return{c(){n&&n.c()},m(o,a){n&&n.m(o,a),t=!0},p(o,a){n&&n.p&&(!t||a&16777216)&&dt(n,l,o,o[24],t?gt(l,o[24],a,null):bt(o[24]),null)},i(o){t||(z(n,o),t=!0)},o(o){M(n,o),t=!1},d(o){n&&n.d(o)}}}function Ht(e){let t,l,n;function o(s){e[17](s)}let a={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[Rt]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new ct({props:a}),Ee.push(()=>Fe(t,"hovered",o)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){j(t.$$.fragment)},m(s,i){P(t,s,i),n=!0},p(s,[i]){const r={};i&2&&(r.id=s[1]),i&4&&(r.source=s[2]),i&8&&(r.sourceLayer=s[3]),i&16&&(r.beforeId=s[4]),i&32&&(r.beforeLayerType=s[5]),i&64&&(r.paint=s[6]),i&128&&(r.layout=s[7]),i&256&&(r.filter=s[8]),i&512&&(r.applyToClusters=s[9]),i&1024&&(r.minzoom=s[10]),i&2048&&(r.maxzoom=s[11]),i&4096&&(r.hoverCursor=s[12]),i&8192&&(r.manageHoverState=s[13]),i&16384&&(r.eventsIfTopMost=s[14]),i&32768&&(r.interactive=s[15]),i&16777216&&(r.$$scope={dirty:i,ctx:s}),!l&&i&1&&(l=!0,r.hovered=s[0],Ge(()=>l=!1)),t.$set(r)},i(s){n||(z(t.$$.fragment,s),n=!0)},o(s){M(t.$$.fragment,s),n=!1},d(s){E(t,s)}}}function Nt(e,t,l){let{$$slots:n={},$$scope:o}=t,{id:a=_t("circle")}=t,{source:s=void 0}=t,{sourceLayer:i=void 0}=t,{beforeId:r=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:v}=t,{layout:C=void 0}=t,{filter:L=void 0}=t,{applyToClusters:b=void 0}=t,{minzoom:k=void 0}=t,{maxzoom:T=void 0}=t,{hoverCursor:O=void 0}=t,{manageHoverState:f=!1}=t,{hovered:m=null}=t,{eventsIfTopMost:N=!1}=t,{interactive:q=!0}=t;function D(u){m=u,l(0,m)}function w(u){G.call(this,e,u)}function ne(u){G.call(this,e,u)}function A(u){G.call(this,e,u)}function le(u){G.call(this,e,u)}function Z(u){G.call(this,e,u)}function ee(u){G.call(this,e,u)}return e.$$set=u=>{"id"in u&&l(1,a=u.id),"source"in u&&l(2,s=u.source),"sourceLayer"in u&&l(3,i=u.sourceLayer),"beforeId"in u&&l(4,r=u.beforeId),"beforeLayerType"in u&&l(5,c=u.beforeLayerType),"paint"in u&&l(6,v=u.paint),"layout"in u&&l(7,C=u.layout),"filter"in u&&l(8,L=u.filter),"applyToClusters"in u&&l(9,b=u.applyToClusters),"minzoom"in u&&l(10,k=u.minzoom),"maxzoom"in u&&l(11,T=u.maxzoom),"hoverCursor"in u&&l(12,O=u.hoverCursor),"manageHoverState"in u&&l(13,f=u.manageHoverState),"hovered"in u&&l(0,m=u.hovered),"eventsIfTopMost"in u&&l(14,N=u.eventsIfTopMost),"interactive"in u&&l(15,q=u.interactive),"$$scope"in u&&l(24,o=u.$$scope)},[m,a,s,i,r,c,v,C,L,b,k,T,O,f,N,q,n,D,w,ne,A,le,Z,ee,o]}class at extends me{constructor(t){super(),de(this,t,Nt,Ht,be,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function qt(e){let t;const l=e[16].default,n=mt(l,e,e[24],null);return{c(){n&&n.c()},m(o,a){n&&n.m(o,a),t=!0},p(o,a){n&&n.p&&(!t||a&16777216)&&dt(n,l,o,o[24],t?gt(l,o[24],a,null):bt(o[24]),null)},i(o){t||(z(n,o),t=!0)},o(o){M(n,o),t=!1},d(o){n&&n.d(o)}}}function Dt(e){let t,l,n;function o(s){e[17](s)}let a={id:e[1],type:"symbol",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[qt]},$$scope:{ctx:e}};return e[0]!==void 0&&(a.hovered=e[0]),t=new ct({props:a}),Ee.push(()=>Fe(t,"hovered",o)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){j(t.$$.fragment)},m(s,i){P(t,s,i),n=!0},p(s,[i]){const r={};i&2&&(r.id=s[1]),i&4&&(r.source=s[2]),i&8&&(r.sourceLayer=s[3]),i&16&&(r.beforeId=s[4]),i&32&&(r.beforeLayerType=s[5]),i&64&&(r.paint=s[6]),i&128&&(r.layout=s[7]),i&256&&(r.filter=s[8]),i&512&&(r.applyToClusters=s[9]),i&1024&&(r.minzoom=s[10]),i&2048&&(r.maxzoom=s[11]),i&4096&&(r.hoverCursor=s[12]),i&8192&&(r.manageHoverState=s[13]),i&16384&&(r.eventsIfTopMost=s[14]),i&32768&&(r.interactive=s[15]),i&16777216&&(r.$$scope={dirty:i,ctx:s}),!l&&i&1&&(l=!0,r.hovered=s[0],Ge(()=>l=!1)),t.$set(r)},i(s){n||(z(t.$$.fragment,s),n=!0)},o(s){M(t.$$.fragment,s),n=!1},d(s){E(t,s)}}}function Bt(e,t,l){let{$$slots:n={},$$scope:o}=t,{id:a=_t("symbol")}=t,{source:s=void 0}=t,{sourceLayer:i=void 0}=t,{beforeId:r=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:v=void 0}=t,{layout:C=void 0}=t,{filter:L=void 0}=t,{applyToClusters:b=void 0}=t,{minzoom:k=void 0}=t,{maxzoom:T=void 0}=t,{hoverCursor:O=void 0}=t,{manageHoverState:f=!1}=t,{hovered:m=null}=t,{eventsIfTopMost:N=!1}=t,{interactive:q=!0}=t;function D(u){m=u,l(0,m)}function w(u){G.call(this,e,u)}function ne(u){G.call(this,e,u)}function A(u){G.call(this,e,u)}function le(u){G.call(this,e,u)}function Z(u){G.call(this,e,u)}function ee(u){G.call(this,e,u)}return e.$$set=u=>{"id"in u&&l(1,a=u.id),"source"in u&&l(2,s=u.source),"sourceLayer"in u&&l(3,i=u.sourceLayer),"beforeId"in u&&l(4,r=u.beforeId),"beforeLayerType"in u&&l(5,c=u.beforeLayerType),"paint"in u&&l(6,v=u.paint),"layout"in u&&l(7,C=u.layout),"filter"in u&&l(8,L=u.filter),"applyToClusters"in u&&l(9,b=u.applyToClusters),"minzoom"in u&&l(10,k=u.minzoom),"maxzoom"in u&&l(11,T=u.maxzoom),"hoverCursor"in u&&l(12,O=u.hoverCursor),"manageHoverState"in u&&l(13,f=u.manageHoverState),"hovered"in u&&l(0,m=u.hovered),"eventsIfTopMost"in u&&l(14,N=u.eventsIfTopMost),"interactive"in u&&l(15,q=u.interactive),"$$scope"in u&&l(24,o=u.$$scope)},[m,a,s,i,r,c,v,C,L,b,k,T,O,f,N,q,n,D,w,ne,A,le,Z,ee,o]}class Vt extends me{constructor(t){super(),de(this,t,Bt,Dt,be,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}let Be=Le(!0),Ve=Le(!1),je=Le(!1),Pe=Le(!1);function rt(e){let t,l;return t=new We({props:{$$slots:{default:[jt,({props:n})=>({10:n}),({props:n})=>n?1024:0]},$$scope:{ctx:e}}}),{c(){j(t.$$.fragment)},m(n,o){P(t,n,o),l=!0},p(n,o){const a={};o&3072&&(a.$$scope={dirty:o,ctx:n}),t.$set(a)},i(n){l||(z(t.$$.fragment,n),l=!0)},o(n){M(t.$$.fragment,n),l=!1},d(n){E(t,n)}}}function jt(e){let t,l;return t=new St({props:{properties:e[10]}}),{c(){j(t.$$.fragment)},m(n,o){P(t,n,o),l=!0},p(n,o){const a={};o&1024&&(a.properties=n[10]),t.$set(a)},i(n){l||(z(t.$$.fragment,n),l=!0)},o(n){M(t.$$.fragment,n),l=!1},d(n){E(t,n)}}}function Pt(e){let t,l,n=e[2]&&rt(e);return{c(){n&&n.c(),t=pt()},m(o,a){n&&n.m(o,a),p(o,t,a),l=!0},p(o,a){o[2]?n?(n.p(o,a),a&4&&z(n,1)):(n=rt(o),n.c(),z(n,1),n.m(t.parentNode,t)):n&&(yt(),M(n,1,1,()=>{n=null}),wt())},i(o){l||(z(n),l=!0)},o(o){M(n),l=!1},d(o){o&&y(t),n&&n.d(o)}}}function Et(e){let t=e[10].origin_count+"",l,n;return{c(){l=I(t),n=I(" routes start here")},m(o,a){p(o,l,a),p(o,n,a)},p(o,a){a&1024&&t!==(t=o[10].origin_count+"")&&_e(l,t)},d(o){o&&(y(l),y(n))}}}function Ft(e){let t,l;return t=new We({props:{$$slots:{default:[Et,({props:n})=>({10:n}),({props:n})=>n?1024:0]},$$scope:{ctx:e}}}),{c(){j(t.$$.fragment)},m(n,o){P(t,n,o),l=!0},p(n,o){const a={};o&3072&&(a.$$scope={dirty:o,ctx:n}),t.$set(a)},i(n){l||(z(t.$$.fragment,n),l=!0)},o(n){M(t.$$.fragment,n),l=!1},d(n){E(t,n)}}}function Gt(e){let t=e[10].destination_count+"",l,n;return{c(){l=I(t),n=I(" routes end here")},m(o,a){p(o,l,a),p(o,n,a)},p(o,a){a&1024&&t!==(t=o[10].destination_count+"")&&_e(l,t)},d(o){o&&(y(l),y(n))}}}function Wt(e){let t,l;return t=new We({props:{$$slots:{default:[Gt,({props:n})=>({10:n}),({props:n})=>n?1024:0]},$$scope:{ctx:e}}}),{c(){j(t.$$.fragment)},m(n,o){P(t,n,o),l=!0},p(n,o){const a={};o&3072&&(a.$$scope={dirty:o,ctx:n}),t.$set(a)},i(n){l||(z(t.$$.fragment,n),l=!0)},o(n){M(t.$$.fragment,n),l=!1},d(n){E(t,n)}}}function At(e){let t,l,n,o,a,s,i,r;const c=[{id:"input-layer"},e[0],{filter:["==",["geometry-type"],"LineString"]},{manageHoverState:!0},{hoverCursor:e[2]?"pointer":void 0},{paint:{"line-width":e[3],"line-color":e[4]?e[9]:ot,"line-opacity":it(1,.5)}},{layout:{visibility:e[5]?"visible":"none"}},{beforeId:"Road labels"}];let v={$$slots:{default:[Pt]},$$scope:{ctx:e}};for(let f=0;f",["abs",["get","slope"]],3]]},{minzoom:12},{layout:{"icon-image":"chevron","icon-size":1,"symbol-placement":"line","symbol-spacing":50,"icon-allow-overlap":!0,"icon-rotate":["case",["<",["get","slope"],0],180,0],visibility:e[4]?"visible":"none"}}];let L={};for(let f=0;fl(4,a=b)),$(e,Be,b=>l(5,s=b)),$(e,Ve,b=>l(6,i=b)),$(e,je,b=>l(7,r=b));let{sourceOverride:c={}}=t,{controls:v}=t;function C(b){if(!n)return;let k=b.detail.features[0].properties.way;window.open(`http://openstreetmap.org/way/${k}`,"_blank")}let L=Ct(["abs",["get","slope"]],vt,ht);return e.$$set=b=>{"sourceOverride"in b&&l(0,c=b.sourceOverride),"controls"in b&&l(1,v=b.controls)},e.$$.update=()=>{e.$$.dirty&2&&l(2,n=!v.streetviewOn),e.$$.dirty&2&&l(3,o=Jt(v.maxCount))},[c,v,n,o,a,s,i,r,C,L]}class nn extends me{constructor(t){super(),de(this,t,Kt,At,be,{sourceOverride:0,controls:1})}}const{window:Qt}=zt;function ut(e){let t,l,n,o,a,s,i,r,c,v,C;return c=It(e[6][0]),{c(){t=h("div"),l=h("label"),n=h("input"),o=I(` + Google StreetView`),a=S(),s=h("label"),i=h("input"),r=I(` + Bing Streetside`),V(n,"type","radio"),n.__value="google",x(n,n.__value),V(i,"type","radio"),i.__value="bing",x(i,i.__value),c.p(n,i)},m(L,b){p(L,t,b),d(t,l),d(l,n),n.checked=n.__value===e[1],d(l,o),d(t,a),d(t,s),d(s,i),i.checked=i.__value===e[1],d(s,r),v||(C=[H(n,"change",e[5]),H(i,"change",e[7])],v=!0)},p(L,b){b&2&&(n.checked=n.__value===L[1]),b&2&&(i.checked=i.__value===L[1])},d(L){L&&y(t),c.r(),v=!1,Ae(C)}}}function Xt(e){let t,l,n,o,a,s,i,r=e[0]&&ut(e);return{c(){t=h("label"),l=h("input"),n=I(` + StreetView`),o=S(),r&&r.c(),a=pt(),V(l,"type","checkbox")},m(c,v){p(c,t,v),d(t,l),l.checked=e[0],d(t,n),p(c,o,v),r&&r.m(c,v),p(c,a,v),s||(i=[H(Qt,"keydown",e[2]),H(l,"change",e[4])],s=!0)},p(c,[v]){v&1&&(l.checked=c[0]),c[0]?r?r.p(c,v):(r=ut(c),r.c(),r.m(a.parentNode,a)):r&&(r.d(1),r=null)},i:De,o:De,d(c){c&&(y(t),y(o),y(a)),r&&r.d(c),s=!1,Ae(i)}}}function Zt(e,t,l){let{map:n}=t,{enabled:o=!1}=t,a="google";function s(){n.on("click",r),n.getCanvas().style.cursor="zoom-in"}function i(){n.off("click",r),n.getCanvas().style.cursor="auto"}Tt(i);function r(k){let T=k.lngLat.lng,O=k.lngLat.lat;a=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${O},${T}&cbp=11,0,0,0,0`,"_blank"):a=="bing"&&window.open(`https://www.bing.com/maps?cp=${O}~${T}&style=x`,"_blank")}function c(k){o&&k.key=="Escape"&&l(0,o=!1)}const v=[[]];function C(){o=this.checked,l(0,o)}function L(){a=this.__value,l(1,a)}function b(){a=this.__value,l(1,a)}return e.$$set=k=>{"map"in k&&l(3,n=k.map),"enabled"in k&&l(0,o=k.enabled)},e.$$.update=()=>{e.$$.dirty&1&&(o?s():i())},[o,a,c,n,C,L,v,b]}class Ut extends me{constructor(t){super(),de(this,t,Zt,Xt,be,{map:3,enabled:0})}}function ft(e){let t,l,n,o,a,s;return{c(){t=h("div"),l=h("label"),n=h("input"),o=I(` + Visualize slope`),V(n,"type","checkbox")},m(i,r){p(i,t,r),d(t,l),d(l,n),n.checked=e[6],d(l,o),a||(s=H(n,"change",e[17]),a=!0)},p(i,r){r&64&&(n.checked=i[6])},d(i){i&&y(t),a=!1,s()}}}function Yt(e){let t,l,n,o,a,s;return n=new Mt({props:{rows:[[`${J.lts1}: ${K(e[1].total_meters_lts1)}`,R.lts1],[`${J.lts2}: ${K(e[1].total_meters_lts2)}`,R.lts2],[`${J.lts3}: ${K(e[1].total_meters_lts3)}`,R.lts3],[`${J.lts4}: ${K(e[1].total_meters_lts4)}`,R.lts4],[`${J.lts_not_allowed}: ${K(e[1].total_meters_not_allowed)}`,R.lts_not_allowed]]}}),{c(){t=h("hr"),l=S(),j(n.$$.fragment),o=S(),a=h("p"),a.innerHTML='Note: LTS model from BikeOttawa'},m(i,r){p(i,t,r),p(i,l,r),P(n,i,r),p(i,o,r),p(i,a,r),s=!0},p(i,r){const c={};r&2&&(c.rows=[[`${J.lts1}: ${K(i[1].total_meters_lts1)}`,R.lts1],[`${J.lts2}: ${K(i[1].total_meters_lts2)}`,R.lts2],[`${J.lts3}: ${K(i[1].total_meters_lts3)}`,R.lts3],[`${J.lts4}: ${K(i[1].total_meters_lts4)}`,R.lts4],[`${J.lts_not_allowed}: ${K(i[1].total_meters_not_allowed)}`,R.lts_not_allowed]]),n.$set(c)},i(i){s||(z(n.$$.fragment,i),s=!0)},o(i){M(n.$$.fragment,i),s=!1},d(i){i&&(y(t),y(l),y(o),y(a)),E(n,i)}}}function xt(e){let t,l;return t=new Ot({props:{colorScale:ht,limits:vt}}),{c(){j(t.$$.fragment)},m(n,o){P(t,n,o),l=!0},p:De,i(n){l||(z(t.$$.fragment,n),l=!0)},o(n){M(t.$$.fragment,n),l=!1},d(n){E(t,n)}}}function $t(e){let t,l=e[1].config.requests.description+"",n,o,a,s,i,r,c,v,C,L,b,k,T,O,f,m,N,q,D,w,ne,A,le,Z=e[1].num_origins.toLocaleString()+"",ee,u,Ce,ge,oe,Je,Ke,Qe,Q,Se,he,ue,ie,Xe,se,Ze,ve=e[1].num_destinations.toLocaleString()+"",Te,Ue,ze,pe,ae,Ye,xe,$e,X,Ie,fe,F,W,ce,Me,Oe,U,Re,te,He,et,B=e[1].config.elevation_geotiff&&ft(e);const tt=[xt,Yt],Y=[];function nt(_,g){return _[6]?0:1}F=nt(e),W=Y[F]=tt[F](e);function kt(_){e[18](_)}let lt={map:e[2]};return e[0].streetviewOn!==void 0&&(lt.enabled=e[0].streetviewOn),U=new Ut({props:lt}),Ee.push(()=>Fe(U,"enabled",kt)),{c(){t=h("p"),n=I(l),o=S(),a=h("div"),s=h("button"),s.textContent="See all output details",i=S(),r=h("div"),c=h("label"),v=h("input"),C=I(` + Route network`),L=S(),b=h("div"),k=h("label"),T=I(`Max for line width styling: + `),O=h("br"),f=S(),m=h("input"),N=S(),q=h("div"),D=h("label"),w=h("input"),ne=S(),A=h("span"),le=I("Origins ("),ee=I(Z),u=I(")"),Ce=S(),ge=h("div"),oe=h("label"),Je=I(`Change origin point size: + `),Ke=h("br"),Qe=S(),Q=h("input"),Se=S(),he=h("div"),ue=h("label"),ie=h("input"),Xe=S(),se=h("span"),Ze=I("Destinations ("),Te=I(ve),Ue=I(")"),ze=S(),pe=h("div"),ae=h("label"),Ye=I(`Change destination point size: + `),xe=h("br"),$e=S(),X=h("input"),Ie=S(),B&&B.c(),fe=S(),W.c(),ce=S(),Me=h("hr"),Oe=S(),j(U.$$.fragment),V(v,"type","checkbox"),V(m,"type","number"),V(m,"min",1),V(w,"type","checkbox"),st(A,"color",R.origins),V(Q,"type","number"),V(Q,"min",1),V(ie,"type","checkbox"),st(se,"color",R.destinations),V(X,"type","number"),V(X,"min",1)},m(_,g){p(_,t,g),d(t,n),p(_,o,g),p(_,a,g),d(a,s),p(_,i,g),p(_,r,g),d(r,c),d(c,v),v.checked=e[3],d(c,C),p(_,L,g),p(_,b,g),d(b,k),d(k,T),d(k,O),d(k,f),d(k,m),x(m,e[0].maxCount),p(_,N,g),p(_,q,g),d(q,D),d(D,w),w.checked=e[4],d(D,ne),d(D,A),d(A,le),d(A,ee),d(A,u),p(_,Ce,g),p(_,ge,g),d(ge,oe),d(oe,Je),d(oe,Ke),d(oe,Qe),d(oe,Q),x(Q,e[0].originRadius),p(_,Se,g),p(_,he,g),d(he,ue),d(ue,ie),ie.checked=e[5],d(ue,Xe),d(ue,se),d(se,Ze),d(se,Te),d(se,Ue),p(_,ze,g),p(_,pe,g),d(pe,ae),d(ae,Ye),d(ae,xe),d(ae,$e),d(ae,X),x(X,e[0].destinationRadius),p(_,Ie,g),B&&B.m(_,g),p(_,fe,g),Y[F].m(_,g),p(_,ce,g),p(_,Me,g),p(_,Oe,g),P(U,_,g),te=!0,He||(et=[H(s,"click",e[7]),H(v,"change",e[8]),H(m,"input",e[9]),H(m,"change",e[10]),H(w,"change",e[11]),H(Q,"input",e[12]),H(Q,"change",e[13]),H(ie,"change",e[14]),H(X,"input",e[15]),H(X,"change",e[16])],He=!0)},p(_,[g]){(!te||g&2)&&l!==(l=_[1].config.requests.description+"")&&_e(n,l),g&8&&(v.checked=_[3]),g&1&&re(m.value)!==_[0].maxCount&&x(m,_[0].maxCount),g&16&&(w.checked=_[4]),(!te||g&2)&&Z!==(Z=_[1].num_origins.toLocaleString()+"")&&_e(ee,Z),g&1&&re(Q.value)!==_[0].originRadius&&x(Q,_[0].originRadius),g&32&&(ie.checked=_[5]),(!te||g&2)&&ve!==(ve=_[1].num_destinations.toLocaleString()+"")&&_e(Te,ve),g&1&&re(X.value)!==_[0].destinationRadius&&x(X,_[0].destinationRadius),_[1].config.elevation_geotiff?B?B.p(_,g):(B=ft(_),B.c(),B.m(fe.parentNode,fe)):B&&(B.d(1),B=null);let Ne=F;F=nt(_),F===Ne?Y[F].p(_,g):(yt(),M(Y[Ne],1,1,()=>{Y[Ne]=null}),wt(),W=Y[F],W?W.p(_,g):(W=Y[F]=tt[F](_),W.c()),z(W,1),W.m(ce.parentNode,ce));const qe={};g&4&&(qe.map=_[2]),!Re&&g&1&&(Re=!0,qe.enabled=_[0].streetviewOn,Ge(()=>Re=!1)),U.$set(qe)},i(_){te||(z(W),z(U.$$.fragment,_),te=!0)},o(_){M(W),M(U.$$.fragment,_),te=!1},d(_){_&&(y(t),y(o),y(a),y(i),y(r),y(L),y(b),y(N),y(q),y(Ce),y(ge),y(Se),y(he),y(ze),y(pe),y(Ie),y(fe),y(ce),y(Me),y(Oe)),B&&B.d(_),Y[F].d(_),E(U,_),He=!1,Ae(et)}}}function K(e){return`${(e/1e3).toFixed(1)} km total for all trips (before uptake)`}function en(e,t,l){let n,o,a,s;$(e,Be,w=>l(3,n=w)),$(e,Ve,w=>l(4,o=w)),$(e,je,w=>l(5,a=w)),$(e,Pe,w=>l(6,s=w));let{outputMetadata:i}=t,{map:r}=t,{controls:c}=t;const v=()=>window.alert(JSON.stringify(i,null," "));function C(){n=this.checked,Be.set(n)}function L(){c.maxCount=re(this.value),l(0,c)}const b=()=>l(0,c);function k(){o=this.checked,Ve.set(o)}function T(){c.originRadius=re(this.value),l(0,c)}const O=()=>l(0,c);function f(){a=this.checked,je.set(a)}function m(){c.destinationRadius=re(this.value),l(0,c)}const N=()=>l(0,c);function q(){s=this.checked,Pe.set(s)}function D(w){e.$$.not_equal(c.streetviewOn,w)&&(c.streetviewOn=w,l(0,c))}return e.$$set=w=>{"outputMetadata"in w&&l(1,i=w.outputMetadata),"map"in w&&l(2,r=w.map),"controls"in w&&l(0,c=w.controls)},[c,i,r,n,o,a,s,v,C,L,b,k,T,O,f,m,N,q,D]}class ln extends me{constructor(t){super(),de(this,t,en,$t,be,{outputMetadata:1,map:2,controls:0})}}export{nn as L,ln as S}; diff --git a/assets/index-04d5ac6c.css b/assets/index-04d5ac6c.css new file mode 100644 index 0000000..120ee31 --- /dev/null +++ b/assets/index-04d5ac6c.css @@ -0,0 +1 @@ +.ctrl-btn-center.svelte-1s83zbq{display:grid!important;height:100%;width:100%;place-items:center}.expand-map.svelte-p00lfq{position:absolute;top:0;bottom:0;left:0;right:0} diff --git a/assets/CostFunction-e35500c2.js b/assets/index-34f7e0df.js similarity index 68% rename from assets/CostFunction-e35500c2.js rename to assets/index-34f7e0df.js index a5af426..89178b3 100644 --- a/assets/CostFunction-e35500c2.js +++ b/assets/index-34f7e0df.js @@ -1,7 +1,7 @@ -var Ky=Object.defineProperty;var Zy=(n,t,e)=>t in n?Ky(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var D=(n,t,e)=>(Zy(n,typeof t!="symbol"?t+"":t,e),e);import{aj as up,ak as fp,S as te,i as ee,s as zt,D as Ze,l as N,t as U,r as vn,b as Z,u as xn,v as W,al as Jy,U as Jt,ac as bo,V as $n,am as Ys,E as wt,G as Bi,K as zi,N as Ni,O as Wi,Z as Qy,an as ra,ao as oa,ap as dp,e as z,g as Vt,h as Wt,n as B,ab as rr,a0 as Es,f as vt,z as on,q as Ot,w as wn,aq as t_,ar as e_,R as pc,x as Yn,y as xi,c as Ge,a as qe,A as wi,d as Ke,$ as Pt,as as n_,j as At,k as gp,p as yo,C as pp,I as Fh,W as jn,at as Pi,au as mc,ag as mp}from"./Layout-4cd70fb2.js";function i_(n,t,e,i,s){let r=!1;n.getSource(t)&&(r=!0,n.removeSource(t));const o=()=>{i(t)&&(n.addSource(t,e),s())};if(r){const a=()=>{t&&(n.getSource(t)?setTimeout(a,1):o())};a()}else o()}function s_(n,t,e){up().then(()=>{let i=fp(n);if(!i)return;i.getSource(t)===e&&i.removeSource(t)})}function Bh(n){let t=n[0],e,i,s=zh(n);return{c(){s.c(),e=Ze()},m(r,o){s.m(r,o),N(r,e,o),i=!0},p(r,o){o&1&&zt(t,t=r[0])?(vn(),Z(s,1,1,wt),xn(),s=zh(r),s.c(),U(s,1),s.m(e.parentNode,e)):s.p(r,o)},i(r){i||(U(s),i=!0)},o(r){Z(s),i=!1},d(r){r&&W(e),s.d(r)}}}function zh(n){let t;const e=n[19].default,i=Bi(e,n,n[18],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&262144)&&zi(i,e,s,s[18],t?Wi(e,s[18],r,null):Ni(s[18]),null)},i(s){t||(U(i,s),t=!0)},o(s){Z(i,s),t=!1},d(s){i&&i.d(s)}}}function r_(n){let t,e,i=n[0]&&Bh(n);return{c(){i&&i.c(),t=Ze()},m(s,r){i&&i.m(s,r),N(s,t,r),e=!0},p(s,[r]){s[0]?i?(i.p(s,r),r&1&&U(i,1)):(i=Bh(s),i.c(),U(i,1),i.m(t.parentNode,t)):i&&(vn(),Z(i,1,1,()=>{i=null}),xn())},i(s){e||(U(i),e=!0)},o(s){Z(i),e=!1},d(s){s&&W(t),i&&i.d(s)}}}function o_(n,t,e){let i,s,r,{$$slots:o={},$$scope:a}=t,{id:l=Qy("geojson")}=t,{data:c}=t,{generateId:h=!1}=t,{promoteId:u=void 0}=t,{filter:f=void 0}=t,{lineMetrics:d=void 0}=t,{cluster:g=void 0}=t,{maxzoom:p=void 0}=t,{attribution:y=void 0}=t,{buffer:x=void 0}=t,{tolerance:m=void 0}=t;const{map:v,cluster:b,self:_}=Jy();Jt(n,v,S=>e(17,s=S)),Jt(n,b,S=>e(20,r=S)),Jt(n,_,S=>e(0,i=S));let w,M=!0;return bo(()=>{i&&w&&s&&(s_(v,i,w),$n(_,i=null,i),e(15,w=void 0))}),n.$$set=S=>{"id"in S&&e(4,l=S.id),"data"in S&&e(5,c=S.data),"generateId"in S&&e(6,h=S.generateId),"promoteId"in S&&e(7,u=S.promoteId),"filter"in S&&e(8,f=S.filter),"lineMetrics"in S&&e(9,d=S.lineMetrics),"cluster"in S&&e(10,g=S.cluster),"maxzoom"in S&&e(11,p=S.maxzoom),"attribution"in S&&e(12,y=S.attribution),"buffer"in S&&e(13,x=S.buffer),"tolerance"in S&&e(14,m=S.tolerance),"$$scope"in S&&e(18,a=S.$$scope)},n.$$.update=()=>{n.$$.dirty&1024&&$n(b,r=g,r),n.$$.dirty&196593&&s&&i!==l&&($n(_,i=l,i),i_(s,i,Ys({type:"geojson",data:c,filter:f,lineMetrics:d,generateId:h,promoteId:u,cluster:!!g,clusterMinPoints:g==null?void 0:g.minPoints,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius,clusterProperties:g==null?void 0:g.properties,maxzoom:p,attribution:y,buffer:x,tolerance:m}),S=>s&&S===i,()=>{i&&(e(15,w=s==null?void 0:s.getSource(i)),e(16,M=!0))})),n.$$.dirty&131088&&(s==null||s.on("style.load",()=>{e(15,w=s==null?void 0:s.getSource(l))})),n.$$.dirty&98336&&w&&(M?e(16,M=!1):w.setData(c)),n.$$.dirty&33792&&(w==null||w.setClusterOptions(Ys({cluster:!!g,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius})))},[i,v,b,_,l,c,h,u,f,d,g,p,y,x,m,w,M,s,a,o]}let sR=class extends te{constructor(t){super(),ee(this,t,o_,r_,zt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};var Nh=Object.prototype.toString,bp=function(t){var e=Nh.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Nh.call(t.callee)==="[object Function]"),i},Ma,Wh;function a_(){if(Wh)return Ma;Wh=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,i=bp,s=Object.prototype.propertyIsEnumerable,r=!s.call({toString:null},"toString"),o=s.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var d=f.constructor;return d&&d.prototype===f},c={$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},h=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!c["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),u=function(f){if(typeof window>"u"||!h)return l(f);try{return l(f)}catch{return!1}};n=function(d){var g=d!==null&&typeof d=="object",p=e.call(d)==="[object Function]",y=i(d),x=g&&e.call(d)==="[object String]",m=[];if(!g&&!p&&!y)throw new TypeError("Object.keys called on a non-object");var v=o&&p;if(x&&d.length>0&&!t.call(d,0))for(var b=0;b0)for(var _=0;_"u"||!kt?H:kt(Uint8Array),Xn={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?H:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?H:ArrayBuffer,"%ArrayIteratorPrototype%":oi&&kt?kt([][Symbol.iterator]()):H,"%AsyncFromSyncIteratorPrototype%":H,"%AsyncFunction%":_i,"%AsyncGenerator%":_i,"%AsyncGeneratorFunction%":_i,"%AsyncIteratorPrototype%":_i,"%Atomics%":typeof Atomics>"u"?H:Atomics,"%BigInt%":typeof BigInt>"u"?H:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?H:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?H:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?H:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":O_,"%eval%":eval,"%EvalError%":D_,"%Float32Array%":typeof Float32Array>"u"?H:Float32Array,"%Float64Array%":typeof Float64Array>"u"?H:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?H:FinalizationRegistry,"%Function%":vp,"%GeneratorFunction%":_i,"%Int8Array%":typeof Int8Array>"u"?H:Int8Array,"%Int16Array%":typeof Int16Array>"u"?H:Int16Array,"%Int32Array%":typeof Int32Array>"u"?H:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":oi&&kt?kt(kt([][Symbol.iterator]())):H,"%JSON%":typeof JSON=="object"?JSON:H,"%Map%":typeof Map>"u"?H:Map,"%MapIteratorPrototype%":typeof Map>"u"||!oi||!kt?H:kt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?H:Promise,"%Proxy%":typeof Proxy>"u"?H:Proxy,"%RangeError%":E_,"%ReferenceError%":L_,"%Reflect%":typeof Reflect>"u"?H:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?H:Set,"%SetIteratorPrototype%":typeof Set>"u"||!oi||!kt?H:kt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?H:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":oi&&kt?kt(""[Symbol.iterator]()):H,"%Symbol%":oi?Symbol:H,"%SyntaxError%":Ai,"%ThrowTypeError%":R_,"%TypedArray%":F_,"%TypeError%":Si,"%Uint8Array%":typeof Uint8Array>"u"?H:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?H:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?H:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?H:Uint32Array,"%URIError%":T_,"%WeakMap%":typeof WeakMap>"u"?H:WeakMap,"%WeakRef%":typeof WeakRef>"u"?H:WeakRef,"%WeakSet%":typeof WeakSet>"u"?H:WeakSet};if(kt)try{null.error}catch(n){var B_=kt(kt(n));Xn["%Error.prototype%"]=B_}var z_=function n(t){var e;if(t==="%AsyncFunction%")e=Pa("async function () {}");else if(t==="%GeneratorFunction%")e=Pa("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Pa("async function* () {}");else if(t==="%AsyncGenerator%"){var i=n("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&kt&&(e=kt(s.prototype))}return Xn[t]=e,e},Yh={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},or=_c,_o=_p,N_=or.call(Function.call,Array.prototype.concat),W_=or.call(Function.apply,Array.prototype.splice),Uh=or.call(Function.call,String.prototype.replace),vo=or.call(Function.call,String.prototype.slice),V_=or.call(Function.call,RegExp.prototype.exec),j_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,H_=/\\(\\)?/g,$_=function(t){var e=vo(t,0,1),i=vo(t,-1);if(e==="%"&&i!=="%")throw new Ai("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Ai("invalid intrinsic syntax, expected opening `%`");var s=[];return Uh(t,j_,function(r,o,a,l){s[s.length]=a?Uh(l,H_,"$1"):o||r}),s},Y_=function(t,e){var i=t,s;if(_o(Yh,i)&&(s=Yh[i],i="%"+s[0]+"%"),_o(Xn,i)){var r=Xn[i];if(r===_i&&(r=z_(i)),typeof r>"u"&&!e)throw new Si("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:r}}throw new Ai("intrinsic "+t+" does not exist!")},De=function(t,e){if(typeof t!="string"||t.length===0)throw new Si("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Si('"allowMissing" argument must be a boolean');if(V_(/^%?[^%]*%?$/,t)===null)throw new Ai("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=$_(t),s=i.length>0?i[0]:"",r=Y_("%"+s+"%",e),o=r.name,a=r.value,l=!1,c=r.alias;c&&(s=c[0],W_(i,N_([0,1],c)));for(var h=1,u=!0;h=i.length){var p=Un(a,f);u=!!p,u&&"get"in p&&!("originalValue"in p.get)?a=p.get:a=a[f]}else u=_o(a,f),a=a[f];u&&!l&&(Xn[o]=a)}}return a},Ca,Xh;function vc(){if(Xh)return Ca;Xh=1;var n=De,t=n("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return Ca=t,Ca}var U_=De,io=U_("%Object.getOwnPropertyDescriptor%",!0);if(io)try{io([],"length")}catch{io=null}var xc=io,Gh=vc(),X_=yp,ai=Sn,qh=xc,wc=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new ai("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new ai("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ai("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ai("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ai("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ai("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,r=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!qh&&qh(t,e);if(Gh)Gh(t,e,{configurable:o===null&&l?l.configurable:!o,enumerable:s===null&&l?l.enumerable:!s,value:i,writable:r===null&&l?l.writable:!r});else if(a||!s&&!r&&!o)t[e]=i;else throw new X_("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_l=vc(),xp=function(){return!!_l};xp.hasArrayLengthDefineBug=function(){if(!_l)return null;try{return _l([],"length",{value:1}).length!==1}catch{return!0}};var Sc=xp,G_=bc,q_=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",K_=Object.prototype.toString,Z_=Array.prototype.concat,Kh=wc,J_=function(n){return typeof n=="function"&&K_.call(n)==="[object Function]"},wp=Sc(),Q_=function(n,t,e,i){if(t in n){if(i===!0){if(n[t]===e)return}else if(!J_(i)||!i())return}wp?Kh(n,t,e,!0):Kh(n,t,e)},Sp=function(n,t){var e=arguments.length>2?arguments[2]:{},i=G_(t);q_&&(i=Z_.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s4294967295||n0(e)!==e)throw new Qh("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,r=!0;if("length"in t&&Jh){var o=Jh(t,"length");o&&!o.configurable&&(s=!1),o&&!o.writable&&(r=!1)}return(s||r||!i)&&(e0?Zh(t,"length",e,!0,!0):Zh(t,"length",e)),t};(function(n){var t=_c,e=De,i=i0,s=Sn,r=e("%Function.prototype.apply%"),o=e("%Function.prototype.call%"),a=e("%Reflect.apply%",!0)||t.call(o,r),l=vc(),c=e("%Math.max%");n.exports=function(f){if(typeof f!="function")throw new s("a function is required");var d=a(t,o,arguments);return i(d,1+c(0,f.length-(arguments.length-1)),!0)};var h=function(){return a(t,r,arguments)};l?l(n.exports,"apply",{value:h}):n.exports.apply=h})(Mp);var Vi=Mp.exports,kp=De,Pp=Vi,s0=Pp(kp("String.prototype.indexOf")),fe=function(t,e){var i=kp(t,!!e);return typeof i=="function"&&s0(t,".prototype.")>-1?Pp(i):i},r0=bc,Ap=aa(),Cp=fe,tu=Object,o0=Cp("Array.prototype.push"),eu=Cp("Object.prototype.propertyIsEnumerable"),a0=Ap?Object.getOwnPropertySymbols:null,Op=function(t,e){if(t==null)throw new TypeError("target must be an object");var i=tu(t);if(arguments.length===1)return i;for(var s=1;s2&&!!arguments[2];return(!i||w0)&&(x0?nu(t,"name",e,!0,!0):nu(t,"name",e)),t},k0=M0,P0=Sn,A0=Object,Tp=k0(function(){if(this==null||this!==A0(this))throw new P0("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0),C0=Tp,O0=ni.supportsDescriptors,D0=Object.getOwnPropertyDescriptor,Rp=function(){if(O0&&/a/mig.flags==="gim"){var t=D0(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(i,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return C0},E0=ni.supportsDescriptors,L0=Rp,T0=Object.getOwnPropertyDescriptor,R0=Object.defineProperty,I0=TypeError,iu=Object.getPrototypeOf,F0=/a/,B0=function(){if(!E0||!iu)throw new I0("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=L0(),e=iu(F0),i=T0(e,"flags");return(!i||i.get!==t)&&R0(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},z0=ni,N0=Vi,W0=Tp,Ip=Rp,V0=B0,Fp=N0(Ip());z0(Fp,{getPolyfill:Ip,implementation:W0,shim:V0});var j0=Fp,so={exports:{}},H0=aa,ii=function(){return H0()&&!!Symbol.toStringTag},$0=ii(),Y0=fe,vl=Y0("Object.prototype.toString"),la=function(t){return $0&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:vl(t)==="[object Arguments]"},Bp=function(t){return la(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vl(t)!=="[object Array]"&&vl(t.callee)==="[object Function]"},U0=function(){return la(arguments)}();la.isLegacyArguments=Bp;var zp=U0?la:Bp;const X0={},G0=Object.freeze(Object.defineProperty({__proto__:null,default:X0},Symbol.toStringTag,{value:"Module"})),q0=ra(G0);var Mc=typeof Map=="function"&&Map.prototype,Da=Object.getOwnPropertyDescriptor&&Mc?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,xo=Mc&&Da&&typeof Da.get=="function"?Da.get:null,su=Mc&&Map.prototype.forEach,kc=typeof Set=="function"&&Set.prototype,Ea=Object.getOwnPropertyDescriptor&&kc?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,wo=kc&&Ea&&typeof Ea.get=="function"?Ea.get:null,ru=kc&&Set.prototype.forEach,K0=typeof WeakMap=="function"&&WeakMap.prototype,Ts=K0?WeakMap.prototype.has:null,Z0=typeof WeakSet=="function"&&WeakSet.prototype,Rs=Z0?WeakSet.prototype.has:null,J0=typeof WeakRef=="function"&&WeakRef.prototype,ou=J0?WeakRef.prototype.deref:null,Q0=Boolean.prototype.valueOf,tv=Object.prototype.toString,ev=Function.prototype.toString,nv=String.prototype.match,Pc=String.prototype.slice,an=String.prototype.replace,iv=String.prototype.toUpperCase,au=String.prototype.toLowerCase,Np=RegExp.prototype.test,lu=Array.prototype.concat,Me=Array.prototype.join,sv=Array.prototype.slice,cu=Math.floor,xl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,La=Object.getOwnPropertySymbols,wl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ci=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ft=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ci||"symbol")?Symbol.toStringTag:null,Wp=Object.prototype.propertyIsEnumerable,hu=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function uu(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Np.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var i=n<0?-cu(-n):cu(n);if(i!==n){var s=String(i),r=Pc.call(t,s.length+1);return an.call(s,e,"$&_")+"."+an.call(an.call(r,/([0-9]{3})/g,"$&_"),/_$/,"")}}return an.call(t,e,"$&_")}var Sl=q0,fu=Sl.custom,du=jp(fu)?fu:null,rv=function n(t,e,i,s){var r=e||{};if(sn(r,"quoteStyle")&&r.quoteStyle!=="single"&&r.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(sn(r,"maxStringLength")&&(typeof r.maxStringLength=="number"?r.maxStringLength<0&&r.maxStringLength!==1/0:r.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=sn(r,"customInspect")?r.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(sn(r,"indent")&&r.indent!==null&&r.indent!==" "&&!(parseInt(r.indent,10)===r.indent&&r.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(sn(r,"numericSeparator")&&typeof r.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=r.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return $p(t,r);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?uu(t,l):l}if(typeof t=="bigint"){var c=String(t)+"n";return a?uu(t,c):c}var h=typeof r.depth>"u"?5:r.depth;if(typeof i>"u"&&(i=0),i>=h&&h>0&&typeof t=="object")return Ml(t)?"[Array]":"[Object]";var u=Sv(r,i);if(typeof s>"u")s=[];else if(Hp(s,t)>=0)return"[Circular]";function f(L,R,O){if(R&&(s=sv.call(s),s.push(R)),O){var E={depth:r.depth};return sn(r,"quoteStyle")&&(E.quoteStyle=r.quoteStyle),n(L,E,i+1,s)}return n(L,r,i+1,s)}if(typeof t=="function"&&!gu(t)){var d=gv(t),g=yr(t,f);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(g.length>0?" { "+Me.call(g,", ")+" }":"")}if(jp(t)){var p=Ci?an.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):wl.call(t);return typeof t=="object"&&!Ci?Yi(p):p}if(vv(t)){for(var y="<"+au.call(String(t.nodeName)),x=t.attributes||[],m=0;m",y}if(Ml(t)){if(t.length===0)return"[]";var v=yr(t,f);return u&&!wv(v)?"["+kl(v,u)+"]":"[ "+Me.call(v,", ")+" ]"}if(lv(t)){var b=yr(t,f);return!("cause"in Error.prototype)&&"cause"in t&&!Wp.call(t,"cause")?"{ ["+String(t)+"] "+Me.call(lu.call("[cause]: "+f(t.cause),b),", ")+" }":b.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Me.call(b,", ")+" }"}if(typeof t=="object"&&o){if(du&&typeof t[du]=="function"&&Sl)return Sl(t,{depth:h-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(pv(t)){var _=[];return su&&su.call(t,function(L,R){_.push(f(R,t,!0)+" => "+f(L,t))}),pu("Map",xo.call(t),_,u)}if(yv(t)){var w=[];return ru&&ru.call(t,function(L){w.push(f(L,t))}),pu("Set",wo.call(t),w,u)}if(mv(t))return Ta("WeakMap");if(_v(t))return Ta("WeakSet");if(bv(t))return Ta("WeakRef");if(hv(t))return Yi(f(Number(t)));if(fv(t))return Yi(f(xl.call(t)));if(uv(t))return Yi(Q0.call(t));if(cv(t))return Yi(f(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===oa)return"{ [object globalThis] }";if(!av(t)&&!gu(t)){var M=yr(t,f),S=hu?hu(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",C=!S&&Ft&&Object(t)===t&&Ft in t?Pc.call(Mn(t),8,-1):P?"Object":"",k=S||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",A=k+(C||P?"["+Me.call(lu.call([],C||[],P||[]),": ")+"] ":"");return M.length===0?A+"{}":u?A+"{"+kl(M,u)+"}":A+"{ "+Me.call(M,", ")+" }"}return String(t)};function Vp(n,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+n+i}function ov(n){return an.call(String(n),/"/g,""")}function Ml(n){return Mn(n)==="[object Array]"&&(!Ft||!(typeof n=="object"&&Ft in n))}function av(n){return Mn(n)==="[object Date]"&&(!Ft||!(typeof n=="object"&&Ft in n))}function gu(n){return Mn(n)==="[object RegExp]"&&(!Ft||!(typeof n=="object"&&Ft in n))}function lv(n){return Mn(n)==="[object Error]"&&(!Ft||!(typeof n=="object"&&Ft in n))}function cv(n){return Mn(n)==="[object String]"&&(!Ft||!(typeof n=="object"&&Ft in n))}function hv(n){return Mn(n)==="[object Number]"&&(!Ft||!(typeof n=="object"&&Ft in n))}function uv(n){return Mn(n)==="[object Boolean]"&&(!Ft||!(typeof n=="object"&&Ft in n))}function jp(n){if(Ci)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!wl)return!1;try{return wl.call(n),!0}catch{}return!1}function fv(n){if(!n||typeof n!="object"||!xl)return!1;try{return xl.call(n),!0}catch{}return!1}var dv=Object.prototype.hasOwnProperty||function(n){return n in this};function sn(n,t){return dv.call(n,t)}function Mn(n){return tv.call(n)}function gv(n){if(n.name)return n.name;var t=nv.call(ev.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function Hp(n,t){if(n.indexOf)return n.indexOf(t);for(var e=0,i=n.length;et.maxStringLength){var e=n.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return $p(Pc.call(n,0,t.maxStringLength),t)+i}var s=an.call(an.call(n,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,xv);return Vp(s,"single",t)}function xv(n){var t=n.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+iv.call(t.toString(16))}function Yi(n){return"Object("+n+")"}function Ta(n){return n+" { ? }"}function pu(n,t,e,i){var s=i?kl(e,i):Me.call(e,", ");return n+" ("+t+") {"+s+"}"}function wv(n){for(var t=0;t=0)return!1;return!0}function Sv(n,t){var e;if(n.indent===" ")e=" ";else if(typeof n.indent=="number"&&n.indent>0)e=Me.call(Array(n.indent+1)," ");else return null;return{base:e,prev:Me.call(Array(t+1),e)}}function kl(n,t){if(n.length===0)return"";var e=` +var Ky=Object.defineProperty;var Jy=(n,t,e)=>t in n?Ky(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var D=(n,t,e)=>(Jy(n,typeof t!="symbol"?t+"":t,e),e);import{ak as up,al as fp,S as te,i as ee,s as Wt,D as _n,l as N,t as U,r as vn,b as J,u as xn,v as W,am as Zy,V as Zt,ad as bo,W as $n,an as Ys,E as wt,G as Bi,N as zi,O as Ni,Q as Wi,$ as Qy,e as z,g as Bt,h as Rt,n as B,ac as rr,ao as ra,ap as oa,aq as dp,a1 as Es,f as pt,z as rn,q as kt,w as wn,ar as t_,as as e_,T as pc,x as Yn,y as xi,c as Ge,a as qe,A as wi,d as Ke,a0 as At,j as Ct,k as gp,p as yo,C as pp,I as Fh,X as jn,at as Pi,au as mc,ah as mp}from"./Layout-6a808470.js";function n_(n,t,e,i,s){let r=!1;n.getSource(t)&&(r=!0,n.removeSource(t));const o=()=>{i(t)&&(n.addSource(t,e),s())};if(r){const a=()=>{t&&(n.getSource(t)?setTimeout(a,1):o())};a()}else o()}function i_(n,t,e){up().then(()=>{let i=fp(n);if(!i)return;i.getSource(t)===e&&i.removeSource(t)})}function Bh(n){let t=n[0],e,i,s=zh(n);return{c(){s.c(),e=_n()},m(r,o){s.m(r,o),N(r,e,o),i=!0},p(r,o){o&1&&Wt(t,t=r[0])?(vn(),J(s,1,1,wt),xn(),s=zh(r),s.c(),U(s,1),s.m(e.parentNode,e)):s.p(r,o)},i(r){i||(U(s),i=!0)},o(r){J(s),i=!1},d(r){r&&W(e),s.d(r)}}}function zh(n){let t;const e=n[19].default,i=Bi(e,n,n[18],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&262144)&&zi(i,e,s,s[18],t?Wi(e,s[18],r,null):Ni(s[18]),null)},i(s){t||(U(i,s),t=!0)},o(s){J(i,s),t=!1},d(s){i&&i.d(s)}}}function s_(n){let t,e,i=n[0]&&Bh(n);return{c(){i&&i.c(),t=_n()},m(s,r){i&&i.m(s,r),N(s,t,r),e=!0},p(s,[r]){s[0]?i?(i.p(s,r),r&1&&U(i,1)):(i=Bh(s),i.c(),U(i,1),i.m(t.parentNode,t)):i&&(vn(),J(i,1,1,()=>{i=null}),xn())},i(s){e||(U(i),e=!0)},o(s){J(i),e=!1},d(s){s&&W(t),i&&i.d(s)}}}function r_(n,t,e){let i,s,r,{$$slots:o={},$$scope:a}=t,{id:l=Qy("geojson")}=t,{data:c}=t,{generateId:h=!1}=t,{promoteId:u=void 0}=t,{filter:f=void 0}=t,{lineMetrics:d=void 0}=t,{cluster:g=void 0}=t,{maxzoom:p=void 0}=t,{attribution:y=void 0}=t,{buffer:x=void 0}=t,{tolerance:m=void 0}=t;const{map:v,cluster:b,self:_}=Zy();Zt(n,v,S=>e(17,s=S)),Zt(n,b,S=>e(20,r=S)),Zt(n,_,S=>e(0,i=S));let w,M=!0;return bo(()=>{i&&w&&s&&(i_(v,i,w),$n(_,i=null,i),e(15,w=void 0))}),n.$$set=S=>{"id"in S&&e(4,l=S.id),"data"in S&&e(5,c=S.data),"generateId"in S&&e(6,h=S.generateId),"promoteId"in S&&e(7,u=S.promoteId),"filter"in S&&e(8,f=S.filter),"lineMetrics"in S&&e(9,d=S.lineMetrics),"cluster"in S&&e(10,g=S.cluster),"maxzoom"in S&&e(11,p=S.maxzoom),"attribution"in S&&e(12,y=S.attribution),"buffer"in S&&e(13,x=S.buffer),"tolerance"in S&&e(14,m=S.tolerance),"$$scope"in S&&e(18,a=S.$$scope)},n.$$.update=()=>{n.$$.dirty&1024&&$n(b,r=g,r),n.$$.dirty&196593&&s&&i!==l&&($n(_,i=l,i),n_(s,i,Ys({type:"geojson",data:c,filter:f,lineMetrics:d,generateId:h,promoteId:u,cluster:!!g,clusterMinPoints:g==null?void 0:g.minPoints,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius,clusterProperties:g==null?void 0:g.properties,maxzoom:p,attribution:y,buffer:x,tolerance:m}),S=>s&&S===i,()=>{i&&(e(15,w=s==null?void 0:s.getSource(i)),e(16,M=!0))})),n.$$.dirty&131088&&(s==null||s.on("style.load",()=>{e(15,w=s==null?void 0:s.getSource(l))})),n.$$.dirty&98336&&w&&(M?e(16,M=!1):w.setData(c)),n.$$.dirty&33792&&(w==null||w.setClusterOptions(Ys({cluster:!!g,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius})))},[i,v,b,_,l,c,h,u,f,d,g,p,y,x,m,w,M,s,a,o]}let rR=class extends te{constructor(t){super(),ee(this,t,r_,s_,Wt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function Nh(n){let t,e;return{c(){t=z("div"),e=Bt(n[0]),Rt(t,"class","svelte-1uuov7f")},m(i,s){N(i,t,s),B(t,e)},p(i,s){s&1&&rr(e,i[0])},d(i){i&&W(t)}}}function o_(n){let t,e=n[0]&&Nh(n);return{c(){e&&e.c(),t=_n()},m(i,s){e&&e.m(i,s),N(i,t,s)},p(i,[s]){i[0]?e?e.p(i,s):(e=Nh(i),e.c(),e.m(t.parentNode,t)):e&&(e.d(1),e=null)},i:wt,o:wt,d(i){i&&W(t),e&&e.d(i)}}}function a_(n,t,e){let{loading:i}=t;return n.$$set=s=>{"loading"in s&&e(0,i=s.loading)},[i]}class aR extends te{constructor(t){super(),ee(this,t,a_,o_,Wt,{loading:0})}}function l_(n,t){let e=document.createElement("a");e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),e.setAttribute("download",n),document.body.appendChild(e),e.click(),document.body.removeChild(e)}var Wh=Object.prototype.toString,bp=function(t){var e=Wh.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Wh.call(t.callee)==="[object Function]"),i},Ma,Vh;function c_(){if(Vh)return Ma;Vh=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,i=bp,s=Object.prototype.propertyIsEnumerable,r=!s.call({toString:null},"toString"),o=s.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var d=f.constructor;return d&&d.prototype===f},c={$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},h=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!c["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),u=function(f){if(typeof window>"u"||!h)return l(f);try{return l(f)}catch{return!1}};n=function(d){var g=d!==null&&typeof d=="object",p=e.call(d)==="[object Function]",y=i(d),x=g&&e.call(d)==="[object String]",m=[];if(!g&&!p&&!y)throw new TypeError("Object.keys called on a non-object");var v=o&&p;if(x&&d.length>0&&!t.call(d,0))for(var b=0;b0)for(var _=0;_"u"||!Pt?H:Pt(Uint8Array),Xn={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?H:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?H:ArrayBuffer,"%ArrayIteratorPrototype%":oi&&Pt?Pt([][Symbol.iterator]()):H,"%AsyncFromSyncIteratorPrototype%":H,"%AsyncFunction%":_i,"%AsyncGenerator%":_i,"%AsyncGeneratorFunction%":_i,"%AsyncIteratorPrototype%":_i,"%Atomics%":typeof Atomics>"u"?H:Atomics,"%BigInt%":typeof BigInt>"u"?H:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?H:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?H:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?H:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":E_,"%eval%":eval,"%EvalError%":L_,"%Float32Array%":typeof Float32Array>"u"?H:Float32Array,"%Float64Array%":typeof Float64Array>"u"?H:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?H:FinalizationRegistry,"%Function%":vp,"%GeneratorFunction%":_i,"%Int8Array%":typeof Int8Array>"u"?H:Int8Array,"%Int16Array%":typeof Int16Array>"u"?H:Int16Array,"%Int32Array%":typeof Int32Array>"u"?H:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":oi&&Pt?Pt(Pt([][Symbol.iterator]())):H,"%JSON%":typeof JSON=="object"?JSON:H,"%Map%":typeof Map>"u"?H:Map,"%MapIteratorPrototype%":typeof Map>"u"||!oi||!Pt?H:Pt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?H:Promise,"%Proxy%":typeof Proxy>"u"?H:Proxy,"%RangeError%":T_,"%ReferenceError%":R_,"%Reflect%":typeof Reflect>"u"?H:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?H:Set,"%SetIteratorPrototype%":typeof Set>"u"||!oi||!Pt?H:Pt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?H:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":oi&&Pt?Pt(""[Symbol.iterator]()):H,"%Symbol%":oi?Symbol:H,"%SyntaxError%":Ai,"%ThrowTypeError%":F_,"%TypedArray%":z_,"%TypeError%":Si,"%Uint8Array%":typeof Uint8Array>"u"?H:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?H:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?H:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?H:Uint32Array,"%URIError%":I_,"%WeakMap%":typeof WeakMap>"u"?H:WeakMap,"%WeakRef%":typeof WeakRef>"u"?H:WeakRef,"%WeakSet%":typeof WeakSet>"u"?H:WeakSet};if(Pt)try{null.error}catch(n){var N_=Pt(Pt(n));Xn["%Error.prototype%"]=N_}var W_=function n(t){var e;if(t==="%AsyncFunction%")e=Pa("async function () {}");else if(t==="%GeneratorFunction%")e=Pa("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Pa("async function* () {}");else if(t==="%AsyncGenerator%"){var i=n("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&Pt&&(e=Pt(s.prototype))}return Xn[t]=e,e},Uh={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},or=_c,_o=_p,V_=or.call(Function.call,Array.prototype.concat),j_=or.call(Function.apply,Array.prototype.splice),Xh=or.call(Function.call,String.prototype.replace),vo=or.call(Function.call,String.prototype.slice),H_=or.call(Function.call,RegExp.prototype.exec),$_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Y_=/\\(\\)?/g,U_=function(t){var e=vo(t,0,1),i=vo(t,-1);if(e==="%"&&i!=="%")throw new Ai("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Ai("invalid intrinsic syntax, expected opening `%`");var s=[];return Xh(t,$_,function(r,o,a,l){s[s.length]=a?Xh(l,Y_,"$1"):o||r}),s},X_=function(t,e){var i=t,s;if(_o(Uh,i)&&(s=Uh[i],i="%"+s[0]+"%"),_o(Xn,i)){var r=Xn[i];if(r===_i&&(r=W_(i)),typeof r>"u"&&!e)throw new Si("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:r}}throw new Ai("intrinsic "+t+" does not exist!")},De=function(t,e){if(typeof t!="string"||t.length===0)throw new Si("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Si('"allowMissing" argument must be a boolean');if(H_(/^%?[^%]*%?$/,t)===null)throw new Ai("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=U_(t),s=i.length>0?i[0]:"",r=X_("%"+s+"%",e),o=r.name,a=r.value,l=!1,c=r.alias;c&&(s=c[0],j_(i,V_([0,1],c)));for(var h=1,u=!0;h=i.length){var p=Un(a,f);u=!!p,u&&"get"in p&&!("originalValue"in p.get)?a=p.get:a=a[f]}else u=_o(a,f),a=a[f];u&&!l&&(Xn[o]=a)}}return a},Ca,Gh;function vc(){if(Gh)return Ca;Gh=1;var n=De,t=n("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return Ca=t,Ca}var G_=De,io=G_("%Object.getOwnPropertyDescriptor%",!0);if(io)try{io([],"length")}catch{io=null}var xc=io,qh=vc(),q_=yp,ai=Sn,Kh=xc,wc=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new ai("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new ai("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ai("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ai("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ai("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ai("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,r=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!Kh&&Kh(t,e);if(qh)qh(t,e,{configurable:o===null&&l?l.configurable:!o,enumerable:s===null&&l?l.enumerable:!s,value:i,writable:r===null&&l?l.writable:!r});else if(a||!s&&!r&&!o)t[e]=i;else throw new q_("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_l=vc(),xp=function(){return!!_l};xp.hasArrayLengthDefineBug=function(){if(!_l)return null;try{return _l([],"length",{value:1}).length!==1}catch{return!0}};var Sc=xp,K_=bc,J_=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Z_=Object.prototype.toString,Q_=Array.prototype.concat,Jh=wc,t0=function(n){return typeof n=="function"&&Z_.call(n)==="[object Function]"},wp=Sc(),e0=function(n,t,e,i){if(t in n){if(i===!0){if(n[t]===e)return}else if(!t0(i)||!i())return}wp?Jh(n,t,e,!0):Jh(n,t,e)},Sp=function(n,t){var e=arguments.length>2?arguments[2]:{},i=K_(t);J_&&(i=Q_.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s4294967295||s0(e)!==e)throw new tu("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,r=!0;if("length"in t&&Qh){var o=Qh(t,"length");o&&!o.configurable&&(s=!1),o&&!o.writable&&(r=!1)}return(s||r||!i)&&(i0?Zh(t,"length",e,!0,!0):Zh(t,"length",e)),t};(function(n){var t=_c,e=De,i=r0,s=Sn,r=e("%Function.prototype.apply%"),o=e("%Function.prototype.call%"),a=e("%Reflect.apply%",!0)||t.call(o,r),l=vc(),c=e("%Math.max%");n.exports=function(f){if(typeof f!="function")throw new s("a function is required");var d=a(t,o,arguments);return i(d,1+c(0,f.length-(arguments.length-1)),!0)};var h=function(){return a(t,r,arguments)};l?l(n.exports,"apply",{value:h}):n.exports.apply=h})(Mp);var Vi=Mp.exports,kp=De,Pp=Vi,o0=Pp(kp("String.prototype.indexOf")),fe=function(t,e){var i=kp(t,!!e);return typeof i=="function"&&o0(t,".prototype.")>-1?Pp(i):i},a0=bc,Ap=aa(),Cp=fe,eu=Object,l0=Cp("Array.prototype.push"),nu=Cp("Object.prototype.propertyIsEnumerable"),c0=Ap?Object.getOwnPropertySymbols:null,Op=function(t,e){if(t==null)throw new TypeError("target must be an object");var i=eu(t);if(arguments.length===1)return i;for(var s=1;s2&&!!arguments[2];return(!i||M0)&&(S0?iu(t,"name",e,!0,!0):iu(t,"name",e)),t},A0=P0,C0=Sn,O0=Object,Tp=A0(function(){if(this==null||this!==O0(this))throw new C0("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0),D0=Tp,E0=ni.supportsDescriptors,L0=Object.getOwnPropertyDescriptor,Rp=function(){if(E0&&/a/mig.flags==="gim"){var t=L0(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(i,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return D0},T0=ni.supportsDescriptors,R0=Rp,I0=Object.getOwnPropertyDescriptor,F0=Object.defineProperty,B0=TypeError,su=Object.getPrototypeOf,z0=/a/,N0=function(){if(!T0||!su)throw new B0("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=R0(),e=su(z0),i=I0(e,"flags");return(!i||i.get!==t)&&F0(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},W0=ni,V0=Vi,j0=Tp,Ip=Rp,H0=N0,Fp=V0(Ip());W0(Fp,{getPolyfill:Ip,implementation:j0,shim:H0});var $0=Fp,so={exports:{}},Y0=aa,ii=function(){return Y0()&&!!Symbol.toStringTag},U0=ii(),X0=fe,vl=X0("Object.prototype.toString"),la=function(t){return U0&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:vl(t)==="[object Arguments]"},Bp=function(t){return la(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vl(t)!=="[object Array]"&&vl(t.callee)==="[object Function]"},G0=function(){return la(arguments)}();la.isLegacyArguments=Bp;var zp=G0?la:Bp;const q0={},K0=Object.freeze(Object.defineProperty({__proto__:null,default:q0},Symbol.toStringTag,{value:"Module"})),J0=ra(K0);var Mc=typeof Map=="function"&&Map.prototype,Da=Object.getOwnPropertyDescriptor&&Mc?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,xo=Mc&&Da&&typeof Da.get=="function"?Da.get:null,ru=Mc&&Map.prototype.forEach,kc=typeof Set=="function"&&Set.prototype,Ea=Object.getOwnPropertyDescriptor&&kc?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,wo=kc&&Ea&&typeof Ea.get=="function"?Ea.get:null,ou=kc&&Set.prototype.forEach,Z0=typeof WeakMap=="function"&&WeakMap.prototype,Ts=Z0?WeakMap.prototype.has:null,Q0=typeof WeakSet=="function"&&WeakSet.prototype,Rs=Q0?WeakSet.prototype.has:null,tv=typeof WeakRef=="function"&&WeakRef.prototype,au=tv?WeakRef.prototype.deref:null,ev=Boolean.prototype.valueOf,nv=Object.prototype.toString,iv=Function.prototype.toString,sv=String.prototype.match,Pc=String.prototype.slice,on=String.prototype.replace,rv=String.prototype.toUpperCase,lu=String.prototype.toLowerCase,Np=RegExp.prototype.test,cu=Array.prototype.concat,Me=Array.prototype.join,ov=Array.prototype.slice,hu=Math.floor,xl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,La=Object.getOwnPropertySymbols,wl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ci=typeof Symbol=="function"&&typeof Symbol.iterator=="object",zt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ci||"symbol")?Symbol.toStringTag:null,Wp=Object.prototype.propertyIsEnumerable,uu=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function fu(n,t){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Np.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var i=n<0?-hu(-n):hu(n);if(i!==n){var s=String(i),r=Pc.call(t,s.length+1);return on.call(s,e,"$&_")+"."+on.call(on.call(r,/([0-9]{3})/g,"$&_"),/_$/,"")}}return on.call(t,e,"$&_")}var Sl=J0,du=Sl.custom,gu=jp(du)?du:null,av=function n(t,e,i,s){var r=e||{};if(nn(r,"quoteStyle")&&r.quoteStyle!=="single"&&r.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(nn(r,"maxStringLength")&&(typeof r.maxStringLength=="number"?r.maxStringLength<0&&r.maxStringLength!==1/0:r.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=nn(r,"customInspect")?r.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(nn(r,"indent")&&r.indent!==null&&r.indent!==" "&&!(parseInt(r.indent,10)===r.indent&&r.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(nn(r,"numericSeparator")&&typeof r.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=r.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return $p(t,r);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?fu(t,l):l}if(typeof t=="bigint"){var c=String(t)+"n";return a?fu(t,c):c}var h=typeof r.depth>"u"?5:r.depth;if(typeof i>"u"&&(i=0),i>=h&&h>0&&typeof t=="object")return Ml(t)?"[Array]":"[Object]";var u=kv(r,i);if(typeof s>"u")s=[];else if(Hp(s,t)>=0)return"[Circular]";function f(L,R,O){if(R&&(s=ov.call(s),s.push(R)),O){var E={depth:r.depth};return nn(r,"quoteStyle")&&(E.quoteStyle=r.quoteStyle),n(L,E,i+1,s)}return n(L,r,i+1,s)}if(typeof t=="function"&&!pu(t)){var d=mv(t),g=yr(t,f);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(g.length>0?" { "+Me.call(g,", ")+" }":"")}if(jp(t)){var p=Ci?on.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):wl.call(t);return typeof t=="object"&&!Ci?Yi(p):p}if(wv(t)){for(var y="<"+lu.call(String(t.nodeName)),x=t.attributes||[],m=0;m",y}if(Ml(t)){if(t.length===0)return"[]";var v=yr(t,f);return u&&!Mv(v)?"["+kl(v,u)+"]":"[ "+Me.call(v,", ")+" ]"}if(hv(t)){var b=yr(t,f);return!("cause"in Error.prototype)&&"cause"in t&&!Wp.call(t,"cause")?"{ ["+String(t)+"] "+Me.call(cu.call("[cause]: "+f(t.cause),b),", ")+" }":b.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Me.call(b,", ")+" }"}if(typeof t=="object"&&o){if(gu&&typeof t[gu]=="function"&&Sl)return Sl(t,{depth:h-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(bv(t)){var _=[];return ru&&ru.call(t,function(L,R){_.push(f(R,t,!0)+" => "+f(L,t))}),mu("Map",xo.call(t),_,u)}if(vv(t)){var w=[];return ou&&ou.call(t,function(L){w.push(f(L,t))}),mu("Set",wo.call(t),w,u)}if(yv(t))return Ta("WeakMap");if(xv(t))return Ta("WeakSet");if(_v(t))return Ta("WeakRef");if(fv(t))return Yi(f(Number(t)));if(gv(t))return Yi(f(xl.call(t)));if(dv(t))return Yi(ev.call(t));if(uv(t))return Yi(f(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===oa)return"{ [object globalThis] }";if(!cv(t)&&!pu(t)){var M=yr(t,f),S=uu?uu(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",C=!S&&zt&&Object(t)===t&&zt in t?Pc.call(Mn(t),8,-1):P?"Object":"",k=S||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",A=k+(C||P?"["+Me.call(cu.call([],C||[],P||[]),": ")+"] ":"");return M.length===0?A+"{}":u?A+"{"+kl(M,u)+"}":A+"{ "+Me.call(M,", ")+" }"}return String(t)};function Vp(n,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+n+i}function lv(n){return on.call(String(n),/"/g,""")}function Ml(n){return Mn(n)==="[object Array]"&&(!zt||!(typeof n=="object"&&zt in n))}function cv(n){return Mn(n)==="[object Date]"&&(!zt||!(typeof n=="object"&&zt in n))}function pu(n){return Mn(n)==="[object RegExp]"&&(!zt||!(typeof n=="object"&&zt in n))}function hv(n){return Mn(n)==="[object Error]"&&(!zt||!(typeof n=="object"&&zt in n))}function uv(n){return Mn(n)==="[object String]"&&(!zt||!(typeof n=="object"&&zt in n))}function fv(n){return Mn(n)==="[object Number]"&&(!zt||!(typeof n=="object"&&zt in n))}function dv(n){return Mn(n)==="[object Boolean]"&&(!zt||!(typeof n=="object"&&zt in n))}function jp(n){if(Ci)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!wl)return!1;try{return wl.call(n),!0}catch{}return!1}function gv(n){if(!n||typeof n!="object"||!xl)return!1;try{return xl.call(n),!0}catch{}return!1}var pv=Object.prototype.hasOwnProperty||function(n){return n in this};function nn(n,t){return pv.call(n,t)}function Mn(n){return nv.call(n)}function mv(n){if(n.name)return n.name;var t=sv.call(iv.call(n),/^function\s*([\w$]+)/);return t?t[1]:null}function Hp(n,t){if(n.indexOf)return n.indexOf(t);for(var e=0,i=n.length;et.maxStringLength){var e=n.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return $p(Pc.call(n,0,t.maxStringLength),t)+i}var s=on.call(on.call(n,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Sv);return Vp(s,"single",t)}function Sv(n){var t=n.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+rv.call(t.toString(16))}function Yi(n){return"Object("+n+")"}function Ta(n){return n+" { ? }"}function mu(n,t,e,i){var s=i?kl(e,i):Me.call(e,", ");return n+" ("+t+") {"+s+"}"}function Mv(n){for(var t=0;t=0)return!1;return!0}function kv(n,t){var e;if(n.indent===" ")e=" ";else if(typeof n.indent=="number"&&n.indent>0)e=Me.call(Array(n.indent+1)," ");else return null;return{base:e,prev:Me.call(Array(t+1),e)}}function kl(n,t){if(n.length===0)return"";var e=` `+t.prev+t.base;return e+Me.call(n,","+e)+` -`+t.prev}function yr(n,t){var e=Ml(n),i=[];if(e){i.length=n.length;for(var s=0;s=i)return e+1;var s=Su(t,e);if(s<55296||s>56319)return e+1;var r=Su(t,e+1);return r<56320||r>57343?e+1:e+2},Ia=function(t){var e=0;return{next:function(){var s=e>=t.length,r;return s||(r=t[e],e+=1),{done:s,value:r}}}},Mu=function(t,e){if(Xv(t)||_u(t))return Ia(t);if(Gv(t)){var i=0;return{next:function(){var r=Jv(t,i),o=Zv(t,i,r);return i=r,{done:r>t.length,value:o}}}}if(e&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()};if(!qv&&!Kv)so.exports=function(t){if(t!=null)return Mu(t,!0)};else{var Qv=Kp,tx=Jp,ku=de("Map.prototype.forEach",!0),Pu=de("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Au=de("Map.prototype.iterator",!0),Cu=de("Set.prototype.iterator",!0);var Ou=de("Map.prototype.@@iterator",!0)||de("Map.prototype._es6-shim iterator_",!0),Du=de("Set.prototype.@@iterator",!0)||de("Set.prototype._es6-shim iterator_",!0),ex=function(t){if(Qv(t)){if(Au)return vu(Au(t));if(Ou)return Ou(t);if(ku){var e=[];return ku(t,function(s,r){wu(e,[r,s])}),Ia(e)}}if(tx(t)){if(Cu)return vu(Cu(t));if(Du)return Du(t);if(Pu){var i=[];return Pu(t,function(s){wu(i,s)}),Ia(i)}}};so.exports=function(t){return ex(t)||Mu(t)}}}var nx=so.exports,Eu=function(n){return n!==n},Qp=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Eu(t)&&Eu(e))},ix=Qp,tm=function(){return typeof Object.is=="function"?Object.is:ix},sx=tm,rx=ni,ox=function(){var t=sx();return rx(Object,{is:t},{is:function(){return Object.is!==t}}),t},ax=ni,lx=Vi,cx=Qp,em=tm,hx=ox,nm=lx(em(),Object);ax(nm,{getPolyfill:em,implementation:cx,shim:hx});var ux=nm,fx=Vi,im=fe,dx=De,Pl=dx("%ArrayBuffer%",!0),ro=im("ArrayBuffer.prototype.byteLength",!0),gx=im("Object.prototype.toString"),Lu=!!Pl&&!ro&&new Pl(0).slice,Tu=!!Lu&&fx(Lu),sm=ro||Tu?function(t){if(!t||typeof t!="object")return!1;try{return ro?ro(t):Tu(t,0),!0}catch{return!1}}:Pl?function(t){return gx(t)==="[object ArrayBuffer]"}:function(t){return!1},px=Date.prototype.getDay,mx=function(t){try{return px.call(t),!0}catch{return!1}},bx=Object.prototype.toString,yx="[object Date]",_x=ii(),vx=function(t){return typeof t!="object"||t===null?!1:_x?mx(t):bx.call(t)===yx},Al=fe,rm=ii(),om,am,Cl,Ol;if(rm){om=Al("Object.prototype.hasOwnProperty"),am=Al("RegExp.prototype.exec"),Cl={};var Fa=function(){throw Cl};Ol={toString:Fa,valueOf:Fa},typeof Symbol.toPrimitive=="symbol"&&(Ol[Symbol.toPrimitive]=Fa)}var xx=Al("Object.prototype.toString"),wx=Object.getOwnPropertyDescriptor,Sx="[object RegExp]",Mx=rm?function(t){if(!t||typeof t!="object")return!1;var e=wx(t,"lastIndex"),i=e&&om(e,"value");if(!i)return!1;try{am(t,Ol)}catch(s){return s===Cl}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:xx(t)===Sx},kx=fe,Ru=kx("SharedArrayBuffer.prototype.byteLength",!0),Px=Ru?function(t){if(!t||typeof t!="object")return!1;try{return Ru(t),!0}catch{return!1}}:function(t){return!1},Ax=Number.prototype.toString,Cx=function(t){try{return Ax.call(t),!0}catch{return!1}},Ox=Object.prototype.toString,Dx="[object Number]",Ex=ii(),Lx=function(t){return typeof t=="number"?!0:typeof t!="object"?!1:Ex?Cx(t):Ox.call(t)===Dx},lm=fe,Tx=lm("Boolean.prototype.toString"),Rx=lm("Object.prototype.toString"),Ix=function(t){try{return Tx(t),!0}catch{return!1}},Fx="[object Boolean]",Bx=ii(),zx=function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:Bx&&Symbol.toStringTag in t?Ix(t):Rx(t)===Fx},Dl={exports:{}},Nx=Object.prototype.toString,Wx=yc();if(Wx){var Vx=Symbol.prototype.toString,jx=/^Symbol\(.*\)$/,Hx=function(t){return typeof t.valueOf()!="symbol"?!1:jx.test(Vx.call(t))};Dl.exports=function(t){if(typeof t=="symbol")return!0;if(Nx.call(t)!=="[object Symbol]")return!1;try{return Hx(t)}catch{return!1}}}else Dl.exports=function(t){return!1};var $x=Dl.exports,El={exports:{}},Iu=typeof BigInt<"u"&&BigInt,Yx=function(){return typeof Iu=="function"&&typeof BigInt=="function"&&typeof Iu(42)=="bigint"&&typeof BigInt(42)=="bigint"},Ux=Yx();if(Ux){var Xx=BigInt.prototype.valueOf,Gx=function(t){try{return Xx.call(t),!0}catch{}return!1};El.exports=function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:Gx(t)}}else El.exports=function(t){return!1};var qx=El.exports,Kx=Gp,Zx=Lx,Jx=zx,Qx=$x,t1=qx,e1=function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(Kx(t))return"String";if(Zx(t))return"Number";if(Jx(t))return"Boolean";if(Qx(t))return"Symbol";if(t1(t))return"BigInt"},ko=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Fu=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Po;ko||(Po=function(t){return!1});var Ll=ko?ko.prototype.has:null,Ba=Fu?Fu.prototype.has:null;!Po&&!Ll&&(Po=function(t){return!1});var n1=Po||function(t){if(!t||typeof t!="object")return!1;try{if(Ll.call(t,Ll),Ba)try{Ba.call(t,Ba)}catch{return!0}return t instanceof ko}catch{}return!1},Tl={exports:{}},i1=De,cm=fe,s1=i1("%WeakSet%",!0),za=cm("WeakSet.prototype.has",!0);if(za){var Na=cm("WeakMap.prototype.has",!0);Tl.exports=function(t){if(!t||typeof t!="object")return!1;try{if(za(t,za),Na)try{Na(t,Na)}catch{return!0}return t instanceof s1}catch{}return!1}}else Tl.exports=function(t){return!1};var r1=Tl.exports,o1=Kp,a1=Jp,l1=n1,c1=r1,h1=function(t){if(t&&typeof t=="object"){if(o1(t))return"Map";if(a1(t))return"Set";if(l1(t))return"WeakMap";if(c1(t))return"WeakSet"}return!1},hm=Function.prototype.toString,vi=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Rl,oo;if(typeof vi=="function"&&typeof Object.defineProperty=="function")try{Rl=Object.defineProperty({},"length",{get:function(){throw oo}}),oo={},vi(function(){throw 42},null,Rl)}catch(n){n!==oo&&(vi=null)}else vi=null;var u1=/^\s*class\b/,Il=function(t){try{var e=hm.call(t);return u1.test(e)}catch{return!1}},Wa=function(t){try{return Il(t)?!1:(hm.call(t),!0)}catch{return!1}},ao=Object.prototype.toString,f1="[object Object]",d1="[object Function]",g1="[object GeneratorFunction]",p1="[object HTMLAllCollection]",m1="[object HTML document.all class]",b1="[object HTMLCollection]",y1=typeof Symbol=="function"&&!!Symbol.toStringTag,_1=!(0 in[,]),Fl=function(){return!1};if(typeof document=="object"){var v1=document.all;ao.call(v1)===ao.call(document.all)&&(Fl=function(t){if((_1||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=ao.call(t);return(e===p1||e===m1||e===b1||e===f1)&&t("")==null}catch{}return!1})}var x1=vi?function(t){if(Fl(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{vi(t,null,Rl)}catch(e){if(e!==oo)return!1}return!Il(t)&&Wa(t)}:function(t){if(Fl(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(y1)return Wa(t);if(Il(t))return!1;var e=ao.call(t);return e!==d1&&e!==g1&&!/^\[object HTML/.test(e)?!1:Wa(t)},w1=x1,S1=Object.prototype.toString,um=Object.prototype.hasOwnProperty,M1=function(t,e,i){for(var s=0,r=t.length;s=3&&(s=i),S1.call(t)==="[object Array]"?M1(t,e,s):typeof t=="string"?k1(t,e,s):P1(t,e,s)},C1=A1,O1=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Va=O1,D1=typeof globalThis>"u"?oa:globalThis,E1=function(){for(var t=[],e=0;e"u"?oa:globalThis,Bl=L1(),Lc=Ec("String.prototype.slice"),ja=Object.getPrototypeOf,R1=Ec("Array.prototype.indexOf",!0)||function(t,e){for(var i=0;i-1?e:e!=="Object"?!1:F1(t)}return lo?I1(t):null},z1=fe,Nu=z1("ArrayBuffer.prototype.byteLength",!0),N1=sm,W1=function(t){return N1(t)?Nu?Nu(t):t.byteLength:NaN},dm=y0,Ee=fe,Wu=j0,V1=De,Oi=nx,j1=Up,Vu=ux,ju=zp,Hu=Xp,$u=sm,Yu=vx,Uu=Mx,Xu=Px,Gu=bc,qu=e1,Ku=h1,Zu=B1,Ju=W1,Qu=Ee("SharedArrayBuffer.prototype.byteLength",!0),tf=Ee("Date.prototype.getTime"),Ha=Object.getPrototypeOf,ef=Ee("Object.prototype.toString"),Oo=V1("%Set%",!0),zl=Ee("Map.prototype.has",!0),Do=Ee("Map.prototype.get",!0),nf=Ee("Map.prototype.size",!0),Eo=Ee("Set.prototype.add",!0),gm=Ee("Set.prototype.delete",!0),Lo=Ee("Set.prototype.has",!0),co=Ee("Set.prototype.size",!0);function sf(n,t,e,i){for(var s=Oi(n),r;(r=s.next())&&!r.done;)if(be(t,r.value,e,i))return gm(n,r.value),!0;return!1}function pm(n){if(typeof n>"u")return null;if(typeof n!="object")return typeof n=="symbol"?!1:typeof n=="string"||typeof n=="number"?+n==+n:!0}function H1(n,t,e,i,s,r){var o=pm(e);if(o!=null)return o;var a=Do(t,o),l=dm({},s,{strict:!1});return typeof a>"u"&&!zl(t,o)||!be(i,a,l,r)?!1:!zl(n,o)&&be(i,a,l,r)}function $1(n,t,e){var i=pm(e);return i??(Lo(t,i)&&!Lo(n,i))}function rf(n,t,e,i,s,r){for(var o=Oi(n),a,l;(a=o.next())&&!a.done;)if(l=a.value,be(e,l,s,r)&&be(i,Do(t,l),s,r))return gm(n,l),!0;return!1}function be(n,t,e,i){var s=e||{};if(s.strict?Vu(n,t):n===t)return!0;var r=qu(n),o=qu(t);if(r!==o)return!1;if(!n||!t||typeof n!="object"&&typeof t!="object")return s.strict?Vu(n,t):n==t;var a=i.has(n),l=i.has(t),c;if(a&&l){if(i.get(n)===i.get(t))return!0}else c={};return a||i.set(n,c),l||i.set(t,c),X1(n,t,s,i)}function of(n){return!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number"?!1:!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))}function Y1(n,t,e,i){if(co(n)!==co(t))return!1;for(var s=Oi(n),r=Oi(t),o,a,l;(o=s.next())&&!o.done;)if(o.value&&typeof o.value=="object")l||(l=new Oo),Eo(l,o.value);else if(!Lo(t,o.value)){if(e.strict||!$1(n,t,o.value))return!1;l||(l=new Oo),Eo(l,o.value)}if(l){for(;(a=r.next())&&!a.done;)if(a.value&&typeof a.value=="object"){if(!sf(l,a.value,e.strict,i))return!1}else if(!e.strict&&!Lo(n,a.value)&&!sf(l,a.value,e.strict,i))return!1;return co(l)===0}return!0}function U1(n,t,e,i){if(nf(n)!==nf(t))return!1;for(var s=Oi(n),r=Oi(t),o,a,l,c,h,u;(o=s.next())&&!o.done;)if(c=o.value[0],h=o.value[1],c&&typeof c=="object")l||(l=new Oo),Eo(l,c);else if(u=Do(t,c),typeof u>"u"&&!zl(t,c)||!be(h,u,e,i)){if(e.strict||!H1(n,t,c,h,e,i))return!1;l||(l=new Oo),Eo(l,c)}if(l){for(;(a=r.next())&&!a.done;)if(c=a.value[0],u=a.value[1],c&&typeof c=="object"){if(!rf(l,n,c,u,e,i))return!1}else if(!e.strict&&(!n.has(c)||!be(Do(n,c),u,e,i))&&!rf(l,n,c,u,dm({},e,{strict:!1}),i))return!1;return co(l)===0}return!0}function X1(n,t,e,i){var s,r;if(typeof n!=typeof t||n==null||t==null||ef(n)!==ef(t)||ju(n)!==ju(t))return!1;var o=Hu(n),a=Hu(t);if(o!==a)return!1;var l=n instanceof Error,c=t instanceof Error;if(l!==c||(l||c)&&(n.name!==t.name||n.message!==t.message))return!1;var h=Uu(n),u=Uu(t);if(h!==u||(h||u)&&(n.source!==t.source||Wu(n)!==Wu(t)))return!1;var f=Yu(n),d=Yu(t);if(f!==d||(f||d)&&tf(n)!==tf(t)||e.strict&&Ha&&Ha(n)!==Ha(t))return!1;var g=Zu(n),p=Zu(t);if(g!==p)return!1;if(g||p){if(n.length!==t.length)return!1;for(s=0;s=0;s--)if(w[s]!=M[s])return!1;for(s=w.length-1;s>=0;s--)if(r=w[s],!be(n[r],t[r],e,i))return!1;var S=Ku(n),P=Ku(t);return S!==P?!1:S==="Set"||P==="Set"?Y1(n,t,e,i):S==="Map"?U1(n,t,e,i):!0}var G1=function(t,e,i){return be(t,e,i,j1())};const q1=dp(G1);var K1=Object.defineProperty,it=(n,t)=>K1(n,"name",{value:t,configurable:!0}),Z1=class{constructor(t){this.direction=!1,this.compareProperties=!0;var e,i,s;this.precision=10**-((e=t==null?void 0:t.precision)!=null?e:17),this.direction=(i=t==null?void 0:t.direction)!=null?i:!1,this.compareProperties=(s=t==null?void 0:t.compareProperties)!=null?s:!0}compare(t,e){if(t.type!==e.type||!ys(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates);case"Polygon":return this.comparePolygon(t,e);case"GeometryCollection":return this.compareGeometryCollection(t,e);case"Feature":return this.compareFeature(t,e);case"FeatureCollection":return this.compareFeatureCollection(t,e);default:if(t.type.startsWith("Multi")){const i=Nl(t),s=Nl(e);return i.every(r=>s.some(o=>this.compare(r,o)))}}return!1}compareCoord(t,e){return t.length===e.length&&t.every((i,s)=>Math.abs(i-e[s])=0&&(i=[].concat(t.slice(s,t.length),t.slice(1,s+1))),i}comparePath(t,e){return t.every((i,s)=>this.compareCoord(i,e[s]))}comparePolygon(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){const i=t.coordinates.slice(1,t.coordinates.length),s=e.coordinates.slice(1,e.coordinates.length);return i.every(r=>s.some(o=>this.compareLine(r,o,1,!0)))}return!1}compareGeometryCollection(t,e){return ys(t.geometries,e.geometries)&&this.compareBBox(t,e)&&t.geometries.every((i,s)=>this.compare(i,e.geometries[s]))}compareFeature(t,e){return t.id===e.id&&(this.compareProperties?q1(t.properties,e.properties):!0)&&this.compareBBox(t,e)&&this.compare(t.geometry,e.geometry)}compareFeatureCollection(t,e){return ys(t.features,e.features)&&this.compareBBox(t,e)&&t.features.every((i,s)=>this.compare(i,e.features[s]))}compareBBox(t,e){return!t.bbox&&!e.bbox||(t.bbox&&e.bbox?this.compareCoord(t.bbox,e.bbox):!1)}};it(Z1,"GeojsonEquality");function ys(n,t){return n.coordinates?n.coordinates.length===t.coordinates.length:n.length===t.length}it(ys,"sameLength");function Nl(n){return n.coordinates.map(t=>({type:n.type.replace("Multi",""),coordinates:t}))}it(Nl,"explode");var qt=63710088e-1,mm={centimeters:qt*100,centimetres:qt*100,degrees:360/(2*Math.PI),feet:qt*3.28084,inches:qt*39.37,kilometers:qt/1e3,kilometres:qt/1e3,meters:qt,metres:qt,miles:qt/1609.344,millimeters:qt*1e3,millimetres:qt*1e3,nauticalmiles:qt/1852,radians:1,yards:qt*1.0936},af={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Oe(n,t,e={}){const i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=n,i}it(Oe,"feature");function J1(n,t,e={}){switch(n){case"Point":return Ne(t).geometry;case"LineString":return $e(t).geometry;case"Polygon":return Tc(t).geometry;case"MultiPoint":return ym(t).geometry;case"MultiLineString":return bm(t).geometry;case"MultiPolygon":return _m(t).geometry;default:throw new Error(n+" is invalid")}}it(J1,"geometry");function Ne(n,t,e={}){if(!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!To(n[0])||!To(n[1]))throw new Error("coordinates must contain numbers");return Oe({type:"Point",coordinates:n},t,e)}it(Ne,"point");function Q1(n,t,e={}){return ca(n.map(i=>Ne(i,t)),e)}it(Q1,"points");function Tc(n,t,e={}){for(const s of n){if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(s[s.length-1].length!==s[0].length)throw new Error("First and last Position are not equivalent.");for(let r=0;rTc(i,t)),e)}it(tw,"polygons");function $e(n,t,e={}){if(n.length<2)throw new Error("coordinates must be an array of two or more positions");return Oe({type:"LineString",coordinates:n},t,e)}it($e,"lineString");function ew(n,t,e={}){return ca(n.map(i=>$e(i,t)),e)}it(ew,"lineStrings");function ca(n,t={}){const e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=n,e}it(ca,"featureCollection");function bm(n,t,e={}){return Oe({type:"MultiLineString",coordinates:n},t,e)}it(bm,"multiLineString");function ym(n,t,e={}){return Oe({type:"MultiPoint",coordinates:n},t,e)}it(ym,"multiPoint");function _m(n,t,e={}){return Oe({type:"MultiPolygon",coordinates:n},t,e)}it(_m,"multiPolygon");function nw(n,t,e={}){return Oe({type:"GeometryCollection",geometries:n},t,e)}it(nw,"geometryCollection");function iw(n,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");const e=Math.pow(10,t||0);return Math.round(n*e)/e}it(iw,"round");function vm(n,t="kilometers"){const e=mm[t];if(!e)throw new Error(t+" units is invalid");return n*e}it(vm,"radiansToLength");function Rc(n,t="kilometers"){const e=mm[t];if(!e)throw new Error(t+" units is invalid");return n/e}it(Rc,"lengthToRadians");function sw(n,t){return xm(Rc(n,t))}it(sw,"lengthToDegrees");function rw(n){let t=n%360;return t<0&&(t+=360),t}it(rw,"bearingToAzimuth");function xm(n){return n%(2*Math.PI)*180/Math.PI}it(xm,"radiansToDegrees");function ow(n){return n%360*Math.PI/180}it(ow,"degreesToRadians");function aw(n,t="kilometers",e="kilometers"){if(!(n>=0))throw new Error("length must be a positive number");return vm(Rc(n,t),e)}it(aw,"convertLength");function lw(n,t="meters",e="kilometers"){if(!(n>=0))throw new Error("area must be a positive number");const i=af[t];if(!i)throw new Error("invalid original units");const s=af[e];if(!s)throw new Error("invalid final units");return n/i*s}it(lw,"convertArea");function To(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}it(To,"isNumber");function Ic(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}it(Ic,"isObject");function cw(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(t=>{if(!To(t))throw new Error("bbox must only contain numbers")})}it(cw,"validateBBox");function hw(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}it(hw,"validateId");var uw=Object.defineProperty,Et=(n,t)=>uw(n,"name",{value:t,configurable:!0});function Hi(n,t,e){if(n!==null)for(var i,s,r,o,a,l,c,h=0,u=0,f,d=n.type,g=d==="FeatureCollection",p=d==="Feature",y=g?n.features.length:1,x=0;xl||g>c||p>h){a=u,l=i,c=g,h=p,r=0;return}var y=$e([a,u],e.properties);if(t(y,i,s,p,r)===!1)return!1;r++,a=u})===!1)return!1}}})}Et(Mm,"segmentEach");function yw(n,t,e){var i=e,s=!1;return Mm(n,function(r,o,a,l,c){s===!1&&e===void 0?i=r:i=t(i,r,o,a,l,c),s=!0}),i}Et(yw,"segmentReduce");function km(n,t){if(!n)throw new Error("geojson is required");ha(n,function(e,i,s){if(e.geometry!==null){var r=e.geometry.type,o=e.geometry.coordinates;switch(r){case"LineString":if(t(e,i,s,0,0)===!1)return!1;break;case"Polygon":for(var a=0;aww(n,"name",{value:t,configurable:!0});function Bc(n,t={}){if(n.bbox!=null&&t.recompute!==!0)return n.bbox;const e=[1/0,1/0,-1/0,-1/0];return Hi(n,i=>{e[0]>i[0]&&(e[0]=i[0]),e[1]>i[1]&&(e[1]=i[1]),e[2]{"loading"in s&&e(0,i=s.loading)},[i]}class aR extends te{constructor(t){super(),ee(this,t,Aw,Pw,zt,{loading:0})}}var Lt=63710088e-1,zc={centimeters:Lt*100,centimetres:Lt*100,degrees:Lt/111325,feet:Lt*3.28084,inches:Lt*39.37,kilometers:Lt/1e3,kilometres:Lt/1e3,meters:Lt,metres:Lt,miles:Lt/1609.344,millimeters:Lt*1e3,millimetres:Lt*1e3,nauticalmiles:Lt/1852,radians:1,yards:Lt*1.0936},Cw={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Lt,yards:1.0936133},Wl={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ce(n,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=n,i}function Ow(n,t,e){switch(n){case"Point":return Yt(t).geometry;case"LineString":return ae(t).geometry;case"Polygon":return Nc(t).geometry;case"MultiPoint":return Am(t).geometry;case"MultiLineString":return Pm(t).geometry;case"MultiPolygon":return Cm(t).geometry;default:throw new Error(n+" is invalid")}}function Yt(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ro(n[0])||!Ro(n[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:n};return ce(i,t,e)}function Dw(n,t,e){return e===void 0&&(e={}),Jn(n.map(function(i){return Yt(i,t)}),e)}function Nc(n,t,e){e===void 0&&(e={});for(var i=0,s=n;i=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(n*e)/e}function Wc(n,t){t===void 0&&(t="kilometers");var e=zc[t];if(!e)throw new Error(t+" units is invalid");return n*e}function ua(n,t){t===void 0&&(t="kilometers");var e=zc[t];if(!e)throw new Error(t+" units is invalid");return n/e}function Iw(n,t){return Xs(ua(n,t))}function Fw(n){var t=n%360;return t<0&&(t+=360),t}function Xs(n){var t=n%(2*Math.PI);return t*180/Math.PI}function le(n){var t=n%360;return t*Math.PI/180}function Bw(n,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("length must be a positive number");return Wc(ua(n,t),e)}function zw(n,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("area must be a positive number");var i=Wl[t];if(!i)throw new Error("invalid original units");var s=Wl[e];if(!s)throw new Error("invalid final units");return n/i*s}function Ro(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function Vc(n){return!!n&&n.constructor===Object}function Nw(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(function(t){if(!Ro(t))throw new Error("bbox must only contain numbers")})}function Ww(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}const Vw=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Wl,bearingToAzimuth:Fw,convertArea:zw,convertLength:Bw,degreesToRadians:le,earthRadius:Lt,factors:zc,feature:ce,featureCollection:Jn,geometry:Ow,geometryCollection:Tw,isNumber:Ro,isObject:Vc,lengthToDegrees:Iw,lengthToRadians:ua,lineString:ae,lineStrings:Lw,multiLineString:Pm,multiPoint:Am,multiPolygon:Cm,point:Yt,points:Dw,polygon:Nc,polygons:Ew,radiansToDegrees:Xs,radiansToLength:Wc,round:Rw,unitsFactors:Cw,validateBBox:Nw,validateId:Ww},Symbol.toStringTag,{value:"Module"}));function Gs(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Di(n){if(Array.isArray(n))return n;if(n.type==="Feature"){if(n.geometry!==null)return n.geometry.coordinates}else if(n.coordinates)return n.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Om(n,t,e){if(e===void 0&&(e={}),e.final===!0)return jw(n,t);var i=Gs(n),s=Gs(t),r=le(i[0]),o=le(s[0]),a=le(i[1]),l=le(s[1]),c=Math.sin(o-r)*Math.cos(l),h=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(o-r);return Xs(Math.atan2(c,h))}function jw(n,t){var e=Om(t,n);return e=(e+180)%360,e}function Gi(n,t,e){e===void 0&&(e={});var i=Gs(n),s=Gs(t),r=le(s[1]-i[1]),o=le(s[0]-i[0]),a=le(i[1]),l=le(s[1]),c=Math.pow(Math.sin(r/2),2)+Math.pow(Math.sin(o/2),2)*Math.cos(a)*Math.cos(l);return Wc(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),e.units)}function cf(n,t,e,i){i===void 0&&(i={});var s=Gs(n),r=le(s[0]),o=le(s[1]),a=le(e),l=ua(t,i.units),c=Math.asin(Math.sin(o)*Math.cos(l)+Math.cos(o)*Math.sin(l)*Math.cos(a)),h=r+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(o),Math.cos(l)-Math.sin(o)*Math.sin(c)),u=Xs(h),f=Xs(c);return Yt([u,f],i.properties)}function ar(n,t,e){if(n!==null)for(var i,s,r,o,a,l,c,h=0,u=0,f,d=n.type,g=d==="FeatureCollection",p=d==="Feature",y=g?n.features.length:1,x=0;xl||g>c||p>h){a=u,l=i,c=g,h=p,r=0;return}var y=ae([a,u],e.properties);if(t(y,i,s,p,r)===!1)return!1;r++,a=u})===!1)return!1}}})}function qw(n,t,e){var i=e,s=!1;return Em(n,function(r,o,a,l,c){s===!1&&e===void 0?i=r:i=t(i,r,o,a,l,c),s=!0}),i}function Lm(n,t){if(!n)throw new Error("geojson is required");$i(n,function(e,i,s){if(e.geometry!==null){var r=e.geometry.type,o=e.geometry.coordinates;switch(r){case"LineString":if(t(e,i,s,0,0)===!1)return!1;break;case"Polygon":for(var a=0;as?e:s,c=i>r?i:r;return[o,a,l,c]}var Hc={exports:{}},Tm={exports:{}};(function(n,t){(function(e,i){n.exports=i()})(oa,function(){function e(m,v,b,_,w){(function M(S,P,C,k,A){for(;k>C;){if(k-C>600){var L=k-C+1,R=P-C+1,O=Math.log(L),E=.5*Math.exp(2*O/3),I=.5*Math.sqrt(O*E*(L-E)/L)*(R-L/2<0?-1:1),X=Math.max(C,Math.floor(P-R*E/L+I)),J=Math.min(k,Math.floor(P+(L-R)*E/L+I));M(S,P,X,J,A)}var ht=S[P],St=C,st=k;for(i(S,C,P),A(S[k],ht)>0&&i(S,C,k);St0;)st--}A(S[C],ht)===0?i(S,C,st):i(S,++st,k),st<=P&&(C=st+1),P<=st&&(k=st-1)}})(m,v,b||0,_||m.length-1,w||s)}function i(m,v,b){var _=m[v];m[v]=m[b],m[b]=_}function s(m,v){return mv?1:0}var r=function(m){m===void 0&&(m=9),this._maxEntries=Math.max(4,m),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(m,v,b){if(!b)return v.indexOf(m);for(var _=0;_=m.minX&&v.maxY>=m.minY}function y(m){return{children:m,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function x(m,v,b,_,w){for(var M=[v,b];M.length;)if(!((b=M.pop())-(v=M.pop())<=_)){var S=v+Math.ceil((b-v)/_/2)*_;e(m,S,v,b,w),M.push(v,S,S,b)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(m){var v=this.data,b=[];if(!p(m,v))return b;for(var _=this.toBBox,w=[];v;){for(var M=0;M=0&&w[v].children.length>this._maxEntries;)this._split(w,v),v--;this._adjustParentBBoxes(_,w,v)},r.prototype._split=function(m,v){var b=m[v],_=b.children.length,w=this._minEntries;this._chooseSplitAxis(b,w,_);var M=this._chooseSplitIndex(b,w,_),S=y(b.children.splice(M,b.children.length-M));S.height=b.height,S.leaf=b.leaf,a(b,this.toBBox),a(S,this.toBBox),v?m[v-1].children.push(S):this._splitRoot(b,S)},r.prototype._splitRoot=function(m,v){this.data=y([m,v]),this.data.height=m.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(m,v,b){for(var _,w,M,S,P,C,k,A=1/0,L=1/0,R=v;R<=b-v;R++){var O=l(m,0,R,this.toBBox),E=l(m,R,b,this.toBBox),I=(w=O,M=E,S=void 0,P=void 0,C=void 0,k=void 0,S=Math.max(w.minX,M.minX),P=Math.max(w.minY,M.minY),C=Math.min(w.maxX,M.maxX),k=Math.min(w.maxY,M.maxY),Math.max(0,C-S)*Math.max(0,k-P)),X=f(O)+f(E);I=v;A--){var L=m.children[A];c(S,m.leaf?w(L):L),P+=d(S)}return P},r.prototype._adjustParentBBoxes=function(m,v,b){for(var _=b;_>=0;_--)c(v[_],m)},r.prototype._condense=function(m){for(var v=m.length-1,b=void 0;v>=0;v--)m[v].children.length===0?v>0?(b=m[v-1].children).splice(b.indexOf(m[v]),1):this.clear():a(m[v],this.toBBox)},r})})(Tm);var iS=Tm.exports;const sS=ra(Vw),rS=ra(Qw),oS=ra(kw);var ve=iS,Rm=sS,Im=rS,li=oS.default,aS=Im.featureEach;Im.coordEach;Rm.polygon;var uf=Rm.featureCollection;function Fm(n){var t=new ve(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:li(e),ve.prototype.insert.call(this,e)},t.load=function(e){var i=[];return Array.isArray(e)?e.forEach(function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:li(s),i.push(s)}):aS(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:li(s),i.push(s)}),ve.prototype.load.call(this,i)},t.remove=function(e,i){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:li(e),ve.prototype.remove.call(this,e,i)},t.clear=function(){return ve.prototype.clear.call(this)},t.search=function(e){var i=ve.prototype.search.call(this,this.toBBox(e));return uf(i)},t.collides=function(e){return ve.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=ve.prototype.all.call(this);return uf(e)},t.toJSON=function(){return ve.prototype.toJSON.call(this)},t.fromJSON=function(e){return ve.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var i;if(e.bbox)i=e.bbox;else if(Array.isArray(e)&&e.length===4)i=e;else if(Array.isArray(e)&&e.length===6)i=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")i=li(e);else if(e.type==="FeatureCollection")i=li(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}Hc.exports=Fm;Hc.exports.default=Fm;var lS=Hc.exports;const cS=dp(lS);function hS(n,t){var e={},i=[];if(n.type==="LineString"&&(n=ce(n)),t.type==="LineString"&&(t=ce(t)),n.type==="Feature"&&t.type==="Feature"&&n.geometry!==null&&t.geometry!==null&&n.geometry.type==="LineString"&&t.geometry.type==="LineString"&&n.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var s=ff(n,t);return s&&i.push(s),Jn(i)}var r=cS();return r.load(hf(t)),Io(hf(n),function(o){Io(r.search(o),function(a){var l=ff(o,a);if(l){var c=Di(l).join(",");e[c]||(e[c]=!0,i.push(l))}})}),Jn(i)}function ff(n,t){var e=Di(n),i=Di(t);if(e.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(i.length!==2)throw new Error(" line2 must only contain 2 coordinates");var s=e[0][0],r=e[0][1],o=e[1][0],a=e[1][1],l=i[0][0],c=i[0][1],h=i[1][0],u=i[1][1],f=(u-c)*(o-s)-(h-l)*(a-r),d=(h-l)*(r-c)-(u-c)*(s-l),g=(o-s)*(r-c)-(a-r)*(s-l);if(f===0)return null;var p=d/f,y=g/f;if(p>=0&&p<=1&&y>=0&&y<=1){var x=s+p*(o-s),m=r+p*(a-r);return Yt([x,m])}return null}function uS(n,t,e){e===void 0&&(e={});var i=Yt([1/0,1/0],{dist:1/0}),s=0;return $i(n,function(r){for(var o=Di(r),a=0;a0&&(y=p.features[0],y.properties.dist=Gi(t,y,e),y.properties.location=s+Gi(l,y,e)),l.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let e=this.dragFrom[0]-t.lngLat.lng,i=this.dragFrom[1]-t.lngLat.lat;for(let s of this.points)s[0]-=e,s[1]-=i}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});D(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let e=[];if(df(this.points).forEach((i,s)=>{e.push([s+1,uS(i,this.cursor).properties.dist])}),e.sort((i,s)=>i[1]-s[1]),e.length>0){let i=e[0][0];this.points.splice(i,0,this.cursor.geometry.coordinates),this.hover=i}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(t))});D(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=$a(t.lngLat.toArray()),this.onClick(t),this.finish())});D(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});D(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});D(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});D(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let t=this.polygonFeature();if(t)for(let e of this.eventListenersSuccess)e(t);else for(let e of this.eventListenersFailure)e();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let t={type:"FeatureCollection",features:[]};this.points.forEach((s,r)=>{let o=$a(s);o.properties.hover=this.hover==r,o.properties.idx=r,t.features.push(o)}),t.features=t.features.concat(df(this.points));let e=this.polygonFeature();e&&(e.properties.hover=this.hover=="polygon",t.features.push(e)),zm.set(t);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,Nm.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let e of this.eventListenersUpdated)e(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let e of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(e.geometry.type=="Polygon"){this.hover="polygon";break}else if(e.geometry.type=="Point"&&Object.hasOwn(e.properties,"idx")){this.hover=e.properties.idx;break}this.hover==null&&(this.cursor=$a(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(Bm),e=[JSON.parse(JSON.stringify(t))];return e[0].push(JSON.parse(JSON.stringify(e[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:e},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>pS&&this.previousStates.shift()}}function df(n){let t=[];for(let e=0;e=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[n[n.length-1],n[0]]},properties:{}}),t}function bS(n){let t,e,i;return{c(){t=Vt("Undo ("),e=Vt(n[1]),i=Vt(")")},m(s,r){N(s,t,r),N(s,e,r),N(s,i,r)},p(s,r){r&2&&rr(e,s[1])},d(s){s&&(W(t),W(e),W(i))}}}function yS(n){let t;return{c(){t=Vt("Undo")},m(e,i){N(e,t,i)},p:wt,d(e){e&&W(t)}}}function _S(n){let t,e,i,s,r,o,a,l,c,h,u;function f(p,y){return p[1]==0?yS:bS}let d=f(n),g=d(n);return{c(){t=z("div"),e=z("button"),e.textContent="Finish",i=vt(),s=z("button"),s.textContent="Cancel",r=vt(),o=z("button"),g.c(),l=vt(),c=z("ul"),c.innerHTML=`
  • Click +`+t.prev}function yr(n,t){var e=Ml(n),i=[];if(e){i.length=n.length;for(var s=0;s=i)return e+1;var s=Mu(t,e);if(s<55296||s>56319)return e+1;var r=Mu(t,e+1);return r<56320||r>57343?e+1:e+2},Ia=function(t){var e=0;return{next:function(){var s=e>=t.length,r;return s||(r=t[e],e+=1),{done:s,value:r}}}},ku=function(t,e){if(qv(t)||vu(t))return Ia(t);if(Kv(t)){var i=0;return{next:function(){var r=tx(t,i),o=Qv(t,i,r);return i=r,{done:r>t.length,value:o}}}}if(e&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()};if(!Jv&&!Zv)so.exports=function(t){if(t!=null)return ku(t,!0)};else{var ex=Kp,nx=Zp,Pu=de("Map.prototype.forEach",!0),Au=de("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Cu=de("Map.prototype.iterator",!0),Ou=de("Set.prototype.iterator",!0);var Du=de("Map.prototype.@@iterator",!0)||de("Map.prototype._es6-shim iterator_",!0),Eu=de("Set.prototype.@@iterator",!0)||de("Set.prototype._es6-shim iterator_",!0),ix=function(t){if(ex(t)){if(Cu)return xu(Cu(t));if(Du)return Du(t);if(Pu){var e=[];return Pu(t,function(s,r){Su(e,[r,s])}),Ia(e)}}if(nx(t)){if(Ou)return xu(Ou(t));if(Eu)return Eu(t);if(Au){var i=[];return Au(t,function(s){Su(i,s)}),Ia(i)}}};so.exports=function(t){return ix(t)||ku(t)}}}var sx=so.exports,Lu=function(n){return n!==n},Qp=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Lu(t)&&Lu(e))},rx=Qp,tm=function(){return typeof Object.is=="function"?Object.is:rx},ox=tm,ax=ni,lx=function(){var t=ox();return ax(Object,{is:t},{is:function(){return Object.is!==t}}),t},cx=ni,hx=Vi,ux=Qp,em=tm,fx=lx,nm=hx(em(),Object);cx(nm,{getPolyfill:em,implementation:ux,shim:fx});var dx=nm,gx=Vi,im=fe,px=De,Pl=px("%ArrayBuffer%",!0),ro=im("ArrayBuffer.prototype.byteLength",!0),mx=im("Object.prototype.toString"),Tu=!!Pl&&!ro&&new Pl(0).slice,Ru=!!Tu&&gx(Tu),sm=ro||Ru?function(t){if(!t||typeof t!="object")return!1;try{return ro?ro(t):Ru(t,0),!0}catch{return!1}}:Pl?function(t){return mx(t)==="[object ArrayBuffer]"}:function(t){return!1},bx=Date.prototype.getDay,yx=function(t){try{return bx.call(t),!0}catch{return!1}},_x=Object.prototype.toString,vx="[object Date]",xx=ii(),wx=function(t){return typeof t!="object"||t===null?!1:xx?yx(t):_x.call(t)===vx},Al=fe,rm=ii(),om,am,Cl,Ol;if(rm){om=Al("Object.prototype.hasOwnProperty"),am=Al("RegExp.prototype.exec"),Cl={};var Fa=function(){throw Cl};Ol={toString:Fa,valueOf:Fa},typeof Symbol.toPrimitive=="symbol"&&(Ol[Symbol.toPrimitive]=Fa)}var Sx=Al("Object.prototype.toString"),Mx=Object.getOwnPropertyDescriptor,kx="[object RegExp]",Px=rm?function(t){if(!t||typeof t!="object")return!1;var e=Mx(t,"lastIndex"),i=e&&om(e,"value");if(!i)return!1;try{am(t,Ol)}catch(s){return s===Cl}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:Sx(t)===kx},Ax=fe,Iu=Ax("SharedArrayBuffer.prototype.byteLength",!0),Cx=Iu?function(t){if(!t||typeof t!="object")return!1;try{return Iu(t),!0}catch{return!1}}:function(t){return!1},Ox=Number.prototype.toString,Dx=function(t){try{return Ox.call(t),!0}catch{return!1}},Ex=Object.prototype.toString,Lx="[object Number]",Tx=ii(),Rx=function(t){return typeof t=="number"?!0:typeof t!="object"?!1:Tx?Dx(t):Ex.call(t)===Lx},lm=fe,Ix=lm("Boolean.prototype.toString"),Fx=lm("Object.prototype.toString"),Bx=function(t){try{return Ix(t),!0}catch{return!1}},zx="[object Boolean]",Nx=ii(),Wx=function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:Nx&&Symbol.toStringTag in t?Bx(t):Fx(t)===zx},Dl={exports:{}},Vx=Object.prototype.toString,jx=yc();if(jx){var Hx=Symbol.prototype.toString,$x=/^Symbol\(.*\)$/,Yx=function(t){return typeof t.valueOf()!="symbol"?!1:$x.test(Hx.call(t))};Dl.exports=function(t){if(typeof t=="symbol")return!0;if(Vx.call(t)!=="[object Symbol]")return!1;try{return Yx(t)}catch{return!1}}}else Dl.exports=function(t){return!1};var Ux=Dl.exports,El={exports:{}},Fu=typeof BigInt<"u"&&BigInt,Xx=function(){return typeof Fu=="function"&&typeof BigInt=="function"&&typeof Fu(42)=="bigint"&&typeof BigInt(42)=="bigint"},Gx=Xx();if(Gx){var qx=BigInt.prototype.valueOf,Kx=function(t){try{return qx.call(t),!0}catch{}return!1};El.exports=function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:Kx(t)}}else El.exports=function(t){return!1};var Jx=El.exports,Zx=Gp,Qx=Rx,t1=Wx,e1=Ux,n1=Jx,i1=function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(Zx(t))return"String";if(Qx(t))return"Number";if(t1(t))return"Boolean";if(e1(t))return"Symbol";if(n1(t))return"BigInt"},ko=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Bu=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Po;ko||(Po=function(t){return!1});var Ll=ko?ko.prototype.has:null,Ba=Bu?Bu.prototype.has:null;!Po&&!Ll&&(Po=function(t){return!1});var s1=Po||function(t){if(!t||typeof t!="object")return!1;try{if(Ll.call(t,Ll),Ba)try{Ba.call(t,Ba)}catch{return!0}return t instanceof ko}catch{}return!1},Tl={exports:{}},r1=De,cm=fe,o1=r1("%WeakSet%",!0),za=cm("WeakSet.prototype.has",!0);if(za){var Na=cm("WeakMap.prototype.has",!0);Tl.exports=function(t){if(!t||typeof t!="object")return!1;try{if(za(t,za),Na)try{Na(t,Na)}catch{return!0}return t instanceof o1}catch{}return!1}}else Tl.exports=function(t){return!1};var a1=Tl.exports,l1=Kp,c1=Zp,h1=s1,u1=a1,f1=function(t){if(t&&typeof t=="object"){if(l1(t))return"Map";if(c1(t))return"Set";if(h1(t))return"WeakMap";if(u1(t))return"WeakSet"}return!1},hm=Function.prototype.toString,vi=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Rl,oo;if(typeof vi=="function"&&typeof Object.defineProperty=="function")try{Rl=Object.defineProperty({},"length",{get:function(){throw oo}}),oo={},vi(function(){throw 42},null,Rl)}catch(n){n!==oo&&(vi=null)}else vi=null;var d1=/^\s*class\b/,Il=function(t){try{var e=hm.call(t);return d1.test(e)}catch{return!1}},Wa=function(t){try{return Il(t)?!1:(hm.call(t),!0)}catch{return!1}},ao=Object.prototype.toString,g1="[object Object]",p1="[object Function]",m1="[object GeneratorFunction]",b1="[object HTMLAllCollection]",y1="[object HTML document.all class]",_1="[object HTMLCollection]",v1=typeof Symbol=="function"&&!!Symbol.toStringTag,x1=!(0 in[,]),Fl=function(){return!1};if(typeof document=="object"){var w1=document.all;ao.call(w1)===ao.call(document.all)&&(Fl=function(t){if((x1||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=ao.call(t);return(e===b1||e===y1||e===_1||e===g1)&&t("")==null}catch{}return!1})}var S1=vi?function(t){if(Fl(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{vi(t,null,Rl)}catch(e){if(e!==oo)return!1}return!Il(t)&&Wa(t)}:function(t){if(Fl(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(v1)return Wa(t);if(Il(t))return!1;var e=ao.call(t);return e!==p1&&e!==m1&&!/^\[object HTML/.test(e)?!1:Wa(t)},M1=S1,k1=Object.prototype.toString,um=Object.prototype.hasOwnProperty,P1=function(t,e,i){for(var s=0,r=t.length;s=3&&(s=i),k1.call(t)==="[object Array]"?P1(t,e,s):typeof t=="string"?A1(t,e,s):C1(t,e,s)},D1=O1,E1=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Va=E1,L1=typeof globalThis>"u"?oa:globalThis,T1=function(){for(var t=[],e=0;e"u"?oa:globalThis,Bl=R1(),Lc=Ec("String.prototype.slice"),ja=Object.getPrototypeOf,F1=Ec("Array.prototype.indexOf",!0)||function(t,e){for(var i=0;i-1?e:e!=="Object"?!1:z1(t)}return lo?B1(t):null},W1=fe,Wu=W1("ArrayBuffer.prototype.byteLength",!0),V1=sm,j1=function(t){return V1(t)?Wu?Wu(t):t.byteLength:NaN},dm=v0,Ee=fe,Vu=$0,H1=De,Oi=sx,$1=Up,ju=dx,Hu=zp,$u=Xp,Yu=sm,Uu=wx,Xu=Px,Gu=Cx,qu=bc,Ku=i1,Ju=f1,Zu=N1,Qu=j1,tf=Ee("SharedArrayBuffer.prototype.byteLength",!0),ef=Ee("Date.prototype.getTime"),Ha=Object.getPrototypeOf,nf=Ee("Object.prototype.toString"),Oo=H1("%Set%",!0),zl=Ee("Map.prototype.has",!0),Do=Ee("Map.prototype.get",!0),sf=Ee("Map.prototype.size",!0),Eo=Ee("Set.prototype.add",!0),gm=Ee("Set.prototype.delete",!0),Lo=Ee("Set.prototype.has",!0),co=Ee("Set.prototype.size",!0);function rf(n,t,e,i){for(var s=Oi(n),r;(r=s.next())&&!r.done;)if(be(t,r.value,e,i))return gm(n,r.value),!0;return!1}function pm(n){if(typeof n>"u")return null;if(typeof n!="object")return typeof n=="symbol"?!1:typeof n=="string"||typeof n=="number"?+n==+n:!0}function Y1(n,t,e,i,s,r){var o=pm(e);if(o!=null)return o;var a=Do(t,o),l=dm({},s,{strict:!1});return typeof a>"u"&&!zl(t,o)||!be(i,a,l,r)?!1:!zl(n,o)&&be(i,a,l,r)}function U1(n,t,e){var i=pm(e);return i??(Lo(t,i)&&!Lo(n,i))}function of(n,t,e,i,s,r){for(var o=Oi(n),a,l;(a=o.next())&&!a.done;)if(l=a.value,be(e,l,s,r)&&be(i,Do(t,l),s,r))return gm(n,l),!0;return!1}function be(n,t,e,i){var s=e||{};if(s.strict?ju(n,t):n===t)return!0;var r=Ku(n),o=Ku(t);if(r!==o)return!1;if(!n||!t||typeof n!="object"&&typeof t!="object")return s.strict?ju(n,t):n==t;var a=i.has(n),l=i.has(t),c;if(a&&l){if(i.get(n)===i.get(t))return!0}else c={};return a||i.set(n,c),l||i.set(t,c),q1(n,t,s,i)}function af(n){return!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number"?!1:!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))}function X1(n,t,e,i){if(co(n)!==co(t))return!1;for(var s=Oi(n),r=Oi(t),o,a,l;(o=s.next())&&!o.done;)if(o.value&&typeof o.value=="object")l||(l=new Oo),Eo(l,o.value);else if(!Lo(t,o.value)){if(e.strict||!U1(n,t,o.value))return!1;l||(l=new Oo),Eo(l,o.value)}if(l){for(;(a=r.next())&&!a.done;)if(a.value&&typeof a.value=="object"){if(!rf(l,a.value,e.strict,i))return!1}else if(!e.strict&&!Lo(n,a.value)&&!rf(l,a.value,e.strict,i))return!1;return co(l)===0}return!0}function G1(n,t,e,i){if(sf(n)!==sf(t))return!1;for(var s=Oi(n),r=Oi(t),o,a,l,c,h,u;(o=s.next())&&!o.done;)if(c=o.value[0],h=o.value[1],c&&typeof c=="object")l||(l=new Oo),Eo(l,c);else if(u=Do(t,c),typeof u>"u"&&!zl(t,c)||!be(h,u,e,i)){if(e.strict||!Y1(n,t,c,h,e,i))return!1;l||(l=new Oo),Eo(l,c)}if(l){for(;(a=r.next())&&!a.done;)if(c=a.value[0],u=a.value[1],c&&typeof c=="object"){if(!of(l,n,c,u,e,i))return!1}else if(!e.strict&&(!n.has(c)||!be(Do(n,c),u,e,i))&&!of(l,n,c,u,dm({},e,{strict:!1}),i))return!1;return co(l)===0}return!0}function q1(n,t,e,i){var s,r;if(typeof n!=typeof t||n==null||t==null||nf(n)!==nf(t)||Hu(n)!==Hu(t))return!1;var o=$u(n),a=$u(t);if(o!==a)return!1;var l=n instanceof Error,c=t instanceof Error;if(l!==c||(l||c)&&(n.name!==t.name||n.message!==t.message))return!1;var h=Xu(n),u=Xu(t);if(h!==u||(h||u)&&(n.source!==t.source||Vu(n)!==Vu(t)))return!1;var f=Uu(n),d=Uu(t);if(f!==d||(f||d)&&ef(n)!==ef(t)||e.strict&&Ha&&Ha(n)!==Ha(t))return!1;var g=Zu(n),p=Zu(t);if(g!==p)return!1;if(g||p){if(n.length!==t.length)return!1;for(s=0;s=0;s--)if(w[s]!=M[s])return!1;for(s=w.length-1;s>=0;s--)if(r=w[s],!be(n[r],t[r],e,i))return!1;var S=Ju(n),P=Ju(t);return S!==P?!1:S==="Set"||P==="Set"?X1(n,t,e,i):S==="Map"?G1(n,t,e,i):!0}var K1=function(t,e,i){return be(t,e,i,$1())};const J1=dp(K1);var Z1=Object.defineProperty,it=(n,t)=>Z1(n,"name",{value:t,configurable:!0}),Q1=class{constructor(t){this.direction=!1,this.compareProperties=!0;var e,i,s;this.precision=10**-((e=t==null?void 0:t.precision)!=null?e:17),this.direction=(i=t==null?void 0:t.direction)!=null?i:!1,this.compareProperties=(s=t==null?void 0:t.compareProperties)!=null?s:!0}compare(t,e){if(t.type!==e.type||!ys(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates);case"Polygon":return this.comparePolygon(t,e);case"GeometryCollection":return this.compareGeometryCollection(t,e);case"Feature":return this.compareFeature(t,e);case"FeatureCollection":return this.compareFeatureCollection(t,e);default:if(t.type.startsWith("Multi")){const i=Nl(t),s=Nl(e);return i.every(r=>s.some(o=>this.compare(r,o)))}}return!1}compareCoord(t,e){return t.length===e.length&&t.every((i,s)=>Math.abs(i-e[s])=0&&(i=[].concat(t.slice(s,t.length),t.slice(1,s+1))),i}comparePath(t,e){return t.every((i,s)=>this.compareCoord(i,e[s]))}comparePolygon(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){const i=t.coordinates.slice(1,t.coordinates.length),s=e.coordinates.slice(1,e.coordinates.length);return i.every(r=>s.some(o=>this.compareLine(r,o,1,!0)))}return!1}compareGeometryCollection(t,e){return ys(t.geometries,e.geometries)&&this.compareBBox(t,e)&&t.geometries.every((i,s)=>this.compare(i,e.geometries[s]))}compareFeature(t,e){return t.id===e.id&&(this.compareProperties?J1(t.properties,e.properties):!0)&&this.compareBBox(t,e)&&this.compare(t.geometry,e.geometry)}compareFeatureCollection(t,e){return ys(t.features,e.features)&&this.compareBBox(t,e)&&t.features.every((i,s)=>this.compare(i,e.features[s]))}compareBBox(t,e){return!t.bbox&&!e.bbox||(t.bbox&&e.bbox?this.compareCoord(t.bbox,e.bbox):!1)}};it(Q1,"GeojsonEquality");function ys(n,t){return n.coordinates?n.coordinates.length===t.coordinates.length:n.length===t.length}it(ys,"sameLength");function Nl(n){return n.coordinates.map(t=>({type:n.type.replace("Multi",""),coordinates:t}))}it(Nl,"explode");var qt=63710088e-1,mm={centimeters:qt*100,centimetres:qt*100,degrees:360/(2*Math.PI),feet:qt*3.28084,inches:qt*39.37,kilometers:qt/1e3,kilometres:qt/1e3,meters:qt,metres:qt,miles:qt/1609.344,millimeters:qt*1e3,millimetres:qt*1e3,nauticalmiles:qt/1852,radians:1,yards:qt*1.0936},lf={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Oe(n,t,e={}){const i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=n,i}it(Oe,"feature");function tw(n,t,e={}){switch(n){case"Point":return Ne(t).geometry;case"LineString":return $e(t).geometry;case"Polygon":return Tc(t).geometry;case"MultiPoint":return ym(t).geometry;case"MultiLineString":return bm(t).geometry;case"MultiPolygon":return _m(t).geometry;default:throw new Error(n+" is invalid")}}it(tw,"geometry");function Ne(n,t,e={}){if(!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!To(n[0])||!To(n[1]))throw new Error("coordinates must contain numbers");return Oe({type:"Point",coordinates:n},t,e)}it(Ne,"point");function ew(n,t,e={}){return ca(n.map(i=>Ne(i,t)),e)}it(ew,"points");function Tc(n,t,e={}){for(const s of n){if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(s[s.length-1].length!==s[0].length)throw new Error("First and last Position are not equivalent.");for(let r=0;rTc(i,t)),e)}it(nw,"polygons");function $e(n,t,e={}){if(n.length<2)throw new Error("coordinates must be an array of two or more positions");return Oe({type:"LineString",coordinates:n},t,e)}it($e,"lineString");function iw(n,t,e={}){return ca(n.map(i=>$e(i,t)),e)}it(iw,"lineStrings");function ca(n,t={}){const e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=n,e}it(ca,"featureCollection");function bm(n,t,e={}){return Oe({type:"MultiLineString",coordinates:n},t,e)}it(bm,"multiLineString");function ym(n,t,e={}){return Oe({type:"MultiPoint",coordinates:n},t,e)}it(ym,"multiPoint");function _m(n,t,e={}){return Oe({type:"MultiPolygon",coordinates:n},t,e)}it(_m,"multiPolygon");function sw(n,t,e={}){return Oe({type:"GeometryCollection",geometries:n},t,e)}it(sw,"geometryCollection");function rw(n,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");const e=Math.pow(10,t||0);return Math.round(n*e)/e}it(rw,"round");function vm(n,t="kilometers"){const e=mm[t];if(!e)throw new Error(t+" units is invalid");return n*e}it(vm,"radiansToLength");function Rc(n,t="kilometers"){const e=mm[t];if(!e)throw new Error(t+" units is invalid");return n/e}it(Rc,"lengthToRadians");function ow(n,t){return xm(Rc(n,t))}it(ow,"lengthToDegrees");function aw(n){let t=n%360;return t<0&&(t+=360),t}it(aw,"bearingToAzimuth");function xm(n){return n%(2*Math.PI)*180/Math.PI}it(xm,"radiansToDegrees");function lw(n){return n%360*Math.PI/180}it(lw,"degreesToRadians");function cw(n,t="kilometers",e="kilometers"){if(!(n>=0))throw new Error("length must be a positive number");return vm(Rc(n,t),e)}it(cw,"convertLength");function hw(n,t="meters",e="kilometers"){if(!(n>=0))throw new Error("area must be a positive number");const i=lf[t];if(!i)throw new Error("invalid original units");const s=lf[e];if(!s)throw new Error("invalid final units");return n/i*s}it(hw,"convertArea");function To(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}it(To,"isNumber");function Ic(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}it(Ic,"isObject");function uw(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(t=>{if(!To(t))throw new Error("bbox must only contain numbers")})}it(uw,"validateBBox");function fw(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}it(fw,"validateId");var dw=Object.defineProperty,Et=(n,t)=>dw(n,"name",{value:t,configurable:!0});function Hi(n,t,e){if(n!==null)for(var i,s,r,o,a,l,c,h=0,u=0,f,d=n.type,g=d==="FeatureCollection",p=d==="Feature",y=g?n.features.length:1,x=0;xl||g>c||p>h){a=u,l=i,c=g,h=p,r=0;return}var y=$e([a,u],e.properties);if(t(y,i,s,p,r)===!1)return!1;r++,a=u})===!1)return!1}}})}Et(Mm,"segmentEach");function vw(n,t,e){var i=e,s=!1;return Mm(n,function(r,o,a,l,c){s===!1&&e===void 0?i=r:i=t(i,r,o,a,l,c),s=!0}),i}Et(vw,"segmentReduce");function km(n,t){if(!n)throw new Error("geojson is required");ha(n,function(e,i,s){if(e.geometry!==null){var r=e.geometry.type,o=e.geometry.coordinates;switch(r){case"LineString":if(t(e,i,s,0,0)===!1)return!1;break;case"Polygon":for(var a=0;aMw(n,"name",{value:t,configurable:!0});function Bc(n,t={}){if(n.bbox!=null&&t.recompute!==!0)return n.bbox;const e=[1/0,1/0,-1/0,-1/0];return Hi(n,i=>{e[0]>i[0]&&(e[0]=i[0]),e[1]>i[1]&&(e[1]=i[1]),e[2]=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(n*e)/e}function Wc(n,t){t===void 0&&(t="kilometers");var e=zc[t];if(!e)throw new Error(t+" units is invalid");return n*e}function ua(n,t){t===void 0&&(t="kilometers");var e=zc[t];if(!e)throw new Error(t+" units is invalid");return n/e}function Iw(n,t){return Xs(ua(n,t))}function Fw(n){var t=n%360;return t<0&&(t+=360),t}function Xs(n){var t=n%(2*Math.PI);return t*180/Math.PI}function le(n){var t=n%360;return t*Math.PI/180}function Bw(n,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("length must be a positive number");return Wc(ua(n,t),e)}function zw(n,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("area must be a positive number");var i=Wl[t];if(!i)throw new Error("invalid original units");var s=Wl[e];if(!s)throw new Error("invalid final units");return n/i*s}function Ro(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function Vc(n){return!!n&&n.constructor===Object}function Nw(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(function(t){if(!Ro(t))throw new Error("bbox must only contain numbers")})}function Ww(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}const Vw=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Wl,bearingToAzimuth:Fw,convertArea:zw,convertLength:Bw,degreesToRadians:le,earthRadius:Lt,factors:zc,feature:ce,featureCollection:Zn,geometry:Ow,geometryCollection:Tw,isNumber:Ro,isObject:Vc,lengthToDegrees:Iw,lengthToRadians:ua,lineString:ae,lineStrings:Lw,multiLineString:Pm,multiPoint:Am,multiPolygon:Cm,point:Yt,points:Dw,polygon:Nc,polygons:Ew,radiansToDegrees:Xs,radiansToLength:Wc,round:Rw,unitsFactors:Cw,validateBBox:Nw,validateId:Ww},Symbol.toStringTag,{value:"Module"}));function Gs(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Di(n){if(Array.isArray(n))return n;if(n.type==="Feature"){if(n.geometry!==null)return n.geometry.coordinates}else if(n.coordinates)return n.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Om(n,t,e){if(e===void 0&&(e={}),e.final===!0)return jw(n,t);var i=Gs(n),s=Gs(t),r=le(i[0]),o=le(s[0]),a=le(i[1]),l=le(s[1]),c=Math.sin(o-r)*Math.cos(l),h=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(o-r);return Xs(Math.atan2(c,h))}function jw(n,t){var e=Om(t,n);return e=(e+180)%360,e}function Gi(n,t,e){e===void 0&&(e={});var i=Gs(n),s=Gs(t),r=le(s[1]-i[1]),o=le(s[0]-i[0]),a=le(i[1]),l=le(s[1]),c=Math.pow(Math.sin(r/2),2)+Math.pow(Math.sin(o/2),2)*Math.cos(a)*Math.cos(l);return Wc(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),e.units)}function cf(n,t,e,i){i===void 0&&(i={});var s=Gs(n),r=le(s[0]),o=le(s[1]),a=le(e),l=ua(t,i.units),c=Math.asin(Math.sin(o)*Math.cos(l)+Math.cos(o)*Math.sin(l)*Math.cos(a)),h=r+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(o),Math.cos(l)-Math.sin(o)*Math.sin(c)),u=Xs(h),f=Xs(c);return Yt([u,f],i.properties)}function ar(n,t,e){if(n!==null)for(var i,s,r,o,a,l,c,h=0,u=0,f,d=n.type,g=d==="FeatureCollection",p=d==="Feature",y=g?n.features.length:1,x=0;xl||g>c||p>h){a=u,l=i,c=g,h=p,r=0;return}var y=ae([a,u],e.properties);if(t(y,i,s,p,r)===!1)return!1;r++,a=u})===!1)return!1}}})}function qw(n,t,e){var i=e,s=!1;return Em(n,function(r,o,a,l,c){s===!1&&e===void 0?i=r:i=t(i,r,o,a,l,c),s=!0}),i}function Lm(n,t){if(!n)throw new Error("geojson is required");$i(n,function(e,i,s){if(e.geometry!==null){var r=e.geometry.type,o=e.geometry.coordinates;switch(r){case"LineString":if(t(e,i,s,0,0)===!1)return!1;break;case"Polygon":for(var a=0;as?e:s,c=i>r?i:r;return[o,a,l,c]}var Hc={exports:{}},Tm={exports:{}};(function(n,t){(function(e,i){n.exports=i()})(oa,function(){function e(m,v,b,_,w){(function M(S,P,C,k,A){for(;k>C;){if(k-C>600){var L=k-C+1,R=P-C+1,O=Math.log(L),E=.5*Math.exp(2*O/3),I=.5*Math.sqrt(O*E*(L-E)/L)*(R-L/2<0?-1:1),X=Math.max(C,Math.floor(P-R*E/L+I)),Z=Math.min(k,Math.floor(P+(L-R)*E/L+I));M(S,P,X,Z,A)}var ht=S[P],St=C,st=k;for(i(S,C,P),A(S[k],ht)>0&&i(S,C,k);St0;)st--}A(S[C],ht)===0?i(S,C,st):i(S,++st,k),st<=P&&(C=st+1),P<=st&&(k=st-1)}})(m,v,b||0,_||m.length-1,w||s)}function i(m,v,b){var _=m[v];m[v]=m[b],m[b]=_}function s(m,v){return mv?1:0}var r=function(m){m===void 0&&(m=9),this._maxEntries=Math.max(4,m),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(m,v,b){if(!b)return v.indexOf(m);for(var _=0;_=m.minX&&v.maxY>=m.minY}function y(m){return{children:m,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function x(m,v,b,_,w){for(var M=[v,b];M.length;)if(!((b=M.pop())-(v=M.pop())<=_)){var S=v+Math.ceil((b-v)/_/2)*_;e(m,S,v,b,w),M.push(v,S,S,b)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(m){var v=this.data,b=[];if(!p(m,v))return b;for(var _=this.toBBox,w=[];v;){for(var M=0;M=0&&w[v].children.length>this._maxEntries;)this._split(w,v),v--;this._adjustParentBBoxes(_,w,v)},r.prototype._split=function(m,v){var b=m[v],_=b.children.length,w=this._minEntries;this._chooseSplitAxis(b,w,_);var M=this._chooseSplitIndex(b,w,_),S=y(b.children.splice(M,b.children.length-M));S.height=b.height,S.leaf=b.leaf,a(b,this.toBBox),a(S,this.toBBox),v?m[v-1].children.push(S):this._splitRoot(b,S)},r.prototype._splitRoot=function(m,v){this.data=y([m,v]),this.data.height=m.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(m,v,b){for(var _,w,M,S,P,C,k,A=1/0,L=1/0,R=v;R<=b-v;R++){var O=l(m,0,R,this.toBBox),E=l(m,R,b,this.toBBox),I=(w=O,M=E,S=void 0,P=void 0,C=void 0,k=void 0,S=Math.max(w.minX,M.minX),P=Math.max(w.minY,M.minY),C=Math.min(w.maxX,M.maxX),k=Math.min(w.maxY,M.maxY),Math.max(0,C-S)*Math.max(0,k-P)),X=f(O)+f(E);I=v;A--){var L=m.children[A];c(S,m.leaf?w(L):L),P+=d(S)}return P},r.prototype._adjustParentBBoxes=function(m,v,b){for(var _=b;_>=0;_--)c(v[_],m)},r.prototype._condense=function(m){for(var v=m.length-1,b=void 0;v>=0;v--)m[v].children.length===0?v>0?(b=m[v-1].children).splice(b.indexOf(m[v]),1):this.clear():a(m[v],this.toBBox)},r})})(Tm);var iS=Tm.exports;const sS=ra(Vw),rS=ra(Qw),oS=ra(Aw);var ve=iS,Rm=sS,Im=rS,li=oS.default,aS=Im.featureEach;Im.coordEach;Rm.polygon;var uf=Rm.featureCollection;function Fm(n){var t=new ve(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:li(e),ve.prototype.insert.call(this,e)},t.load=function(e){var i=[];return Array.isArray(e)?e.forEach(function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:li(s),i.push(s)}):aS(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:li(s),i.push(s)}),ve.prototype.load.call(this,i)},t.remove=function(e,i){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:li(e),ve.prototype.remove.call(this,e,i)},t.clear=function(){return ve.prototype.clear.call(this)},t.search=function(e){var i=ve.prototype.search.call(this,this.toBBox(e));return uf(i)},t.collides=function(e){return ve.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=ve.prototype.all.call(this);return uf(e)},t.toJSON=function(){return ve.prototype.toJSON.call(this)},t.fromJSON=function(e){return ve.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var i;if(e.bbox)i=e.bbox;else if(Array.isArray(e)&&e.length===4)i=e;else if(Array.isArray(e)&&e.length===6)i=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")i=li(e);else if(e.type==="FeatureCollection")i=li(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}Hc.exports=Fm;Hc.exports.default=Fm;var lS=Hc.exports;const cS=dp(lS);function hS(n,t){var e={},i=[];if(n.type==="LineString"&&(n=ce(n)),t.type==="LineString"&&(t=ce(t)),n.type==="Feature"&&t.type==="Feature"&&n.geometry!==null&&t.geometry!==null&&n.geometry.type==="LineString"&&t.geometry.type==="LineString"&&n.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var s=ff(n,t);return s&&i.push(s),Zn(i)}var r=cS();return r.load(hf(t)),Io(hf(n),function(o){Io(r.search(o),function(a){var l=ff(o,a);if(l){var c=Di(l).join(",");e[c]||(e[c]=!0,i.push(l))}})}),Zn(i)}function ff(n,t){var e=Di(n),i=Di(t);if(e.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(i.length!==2)throw new Error(" line2 must only contain 2 coordinates");var s=e[0][0],r=e[0][1],o=e[1][0],a=e[1][1],l=i[0][0],c=i[0][1],h=i[1][0],u=i[1][1],f=(u-c)*(o-s)-(h-l)*(a-r),d=(h-l)*(r-c)-(u-c)*(s-l),g=(o-s)*(r-c)-(a-r)*(s-l);if(f===0)return null;var p=d/f,y=g/f;if(p>=0&&p<=1&&y>=0&&y<=1){var x=s+p*(o-s),m=r+p*(a-r);return Yt([x,m])}return null}function uS(n,t,e){e===void 0&&(e={});var i=Yt([1/0,1/0],{dist:1/0}),s=0;return $i(n,function(r){for(var o=Di(r),a=0;a0&&(y=p.features[0],y.properties.dist=Gi(t,y,e),y.properties.location=s+Gi(l,y,e)),l.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let e=this.dragFrom[0]-t.lngLat.lng,i=this.dragFrom[1]-t.lngLat.lat;for(let s of this.points)s[0]-=e,s[1]-=i}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});D(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let e=[];if(df(this.points).forEach((i,s)=>{e.push([s+1,uS(i,this.cursor).properties.dist])}),e.sort((i,s)=>i[1]-s[1]),e.length>0){let i=e[0][0];this.points.splice(i,0,this.cursor.geometry.coordinates),this.hover=i}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(t))});D(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=$a(t.lngLat.toArray()),this.onClick(t),this.finish())});D(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});D(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});D(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});D(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let t=this.polygonFeature();if(t)for(let e of this.eventListenersSuccess)e(t);else for(let e of this.eventListenersFailure)e();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let t={type:"FeatureCollection",features:[]};this.points.forEach((s,r)=>{let o=$a(s);o.properties.hover=this.hover==r,o.properties.idx=r,t.features.push(o)}),t.features=t.features.concat(df(this.points));let e=this.polygonFeature();e&&(e.properties.hover=this.hover=="polygon",t.features.push(e)),zm.set(t);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,Nm.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let e of this.eventListenersUpdated)e(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let e of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(e.geometry.type=="Polygon"){this.hover="polygon";break}else if(e.geometry.type=="Point"&&Object.hasOwn(e.properties,"idx")){this.hover=e.properties.idx;break}this.hover==null&&(this.cursor=$a(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(Bm),e=[JSON.parse(JSON.stringify(t))];return e[0].push(JSON.parse(JSON.stringify(e[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:e},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>pS&&this.previousStates.shift()}}function df(n){let t=[];for(let e=0;e=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[n[n.length-1],n[0]]},properties:{}}),t}function bS(n){let t,e,i;return{c(){t=Bt("Undo ("),e=Bt(n[1]),i=Bt(")")},m(s,r){N(s,t,r),N(s,e,r),N(s,i,r)},p(s,r){r&2&&rr(e,s[1])},d(s){s&&(W(t),W(e),W(i))}}}function yS(n){let t;return{c(){t=Bt("Undo")},m(e,i){N(e,t,i)},p:wt,d(e){e&&W(t)}}}function _S(n){let t,e,i,s,r,o,a,l,c,h,u;function f(p,y){return p[1]==0?yS:bS}let d=f(n),g=d(n);return{c(){t=z("div"),e=z("button"),e.textContent="Finish",i=pt(),s=z("button"),s.textContent="Cancel",r=pt(),o=z("button"),g.c(),l=pt(),c=z("ul"),c.innerHTML=`
  • Click the map to add a vertex
  • Click a vertex to delete it
  • Drag a vertex or the polygon to move it
  • Press Control+Z @@ -9,43 +9,44 @@ var Ky=Object.defineProperty;var Zy=(n,t,e)=>t in n?Ky(n,t,{enumerable:!0,config or double click to finish
  • Press Escape - to cancel
  • `,o.disabled=a=n[1]==0,on(t,"display","flex"),on(t,"justify-content","space-between")},m(p,y){N(p,t,y),B(t,e),B(t,i),B(t,s),B(t,r),B(t,o),g.m(o,null),N(p,l,y),N(p,c,y),h||(u=[Ot(e,"click",n[2]),Ot(s,"click",n[3]),Ot(o,"click",n[4])],h=!0)},p(p,[y]){d===(d=f(p))&&g?g.p(p,y):(g.d(1),g=d(p),g&&(g.c(),g.m(o,null))),y&2&&a!==(a=p[1]==0)&&(o.disabled=a)},i:wt,o:wt,d(p){p&&(W(t),W(l),W(c)),g.d(),h=!1,wn(u)}}}function vS(n,t,e){let i;Jt(n,Nm,l=>e(1,i=l));let{polygonTool:s}=t;const r=()=>s.finish(),o=()=>s.cancel(),a=()=>s.undo();return n.$$set=l=>{"polygonTool"in l&&e(0,s=l.polygonTool)},[s,i,r,o,a]}class xS extends te{constructor(t){super(),ee(this,t,vS,_S,zt,{polygonTool:0})}}let wS=Date.now();function lr(n){return`${n}-${wS++}`}const Wm=Symbol.for("svelte-maplibre");function SS(){return e_(Wm)}function gf(n){return{subscribe:n.subscribe}}function Vm({key:n,setPopupTarget:t=!1,setCluster:e=!1,setMouseEvent:i=!1}){let s=SS(),r=Es(null),o=gf(r),a={...s,[n]:gf(r)};if(t&&(a.popupTarget=o),i){let l=Es(null);a.layerEvent=l,s.layerEvent=l}return e&&(a.cluster=Es()),t_(Wm,a),{...s,self:r}}function MS(){return Vm({key:"source",setCluster:!0})}function kS(n=!0){return Vm({key:"layer",setPopupTarget:n,setMouseEvent:n})}function pf(n){let t;return e=>{if(e)for(let i in e){let s=t==null?void 0:t[i],r=e[i];s!==r&&n(i,r,s)}else if(t)for(let i in t)n(i,void 0,t[i]);t=e}}function PS(n,...t){let e=[n];for(let i of t)if(i)Array.isArray(i)&&i[0]===n?e.push(...i.slice(1)):e.push(i);else continue;if(e.length!==1)return e.length===2?e[1]:e}function AS(n){return n===!0?["has","point_count"]:n===!1?["!",["has","point_count"]]:void 0}function mf(n){let t=n[0],e,i,s=bf(n);return{c(){s.c(),e=Ze()},m(r,o){s.m(r,o),N(r,e,o),i=!0},p(r,o){o[0]&1&&zt(t,t=r[0])?(vn(),Z(s,1,1,wt),xn(),s=bf(r),s.c(),U(s,1),s.m(e.parentNode,e)):s.p(r,o)},i(r){i||(U(s),i=!0)},o(r){Z(s),i=!1},d(r){r&&W(e),s.d(r)}}}function bf(n){let t;const e=n[36].default,i=Bi(e,n,n[35],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r[1]&16)&&zi(i,e,s,s[35],t?Wi(e,s[35],r,null):Ni(s[35]),null)},i(s){t||(U(i,s),t=!0)},o(s){Z(i,s),t=!1},d(s){i&&i.d(s)}}}function CS(n){let t,e,i=n[0]&&mf(n);return{c(){i&&i.c(),t=Ze()},m(s,r){i&&i.m(s,r),N(s,t,r),e=!0},p(s,r){s[0]?i?(i.p(s,r),r[0]&1&&U(i,1)):(i=mf(s),i.c(),U(i,1),i.m(t.parentNode,t)):i&&(vn(),Z(i,1,1,()=>{i=null}),xn())},i(s){e||(U(i),e=!0)},o(s){Z(i),e=!1},d(s){s&&W(t),i&&i.d(s)}}}function OS(n,t,e){let i,s,r,o,a,l,c,h,u,f,d,g,{$$slots:p={},$$scope:y}=t,{id:x=lr("layer")}=t,{source:m=void 0}=t,{sourceLayer:v=void 0}=t,{beforeId:b=void 0}=t,{beforeLayerType:_=void 0}=t,{type:w}=t,{paint:M=void 0}=t,{layout:S=void 0}=t,{filter:P=void 0}=t,{applyToClusters:C=void 0}=t,{minzoom:k=void 0}=t,{maxzoom:A=void 0}=t,{manageHoverState:L=!1}=t,{hovered:R=null}=t,{interactive:O=!0}=t,{hoverCursor:E=void 0}=t,{eventsIfTopMost:I=!1}=t;const X=pc(),{map:J,source:ht,self:St,minzoom:st,maxzoom:jt,eventTopMost:Nt,layerInfo:Gt}=kS();Jt(n,J,T=>e(31,u=T)),Jt(n,ht,T=>e(32,f=T)),Jt(n,St,T=>e(0,h=T)),Jt(n,st,T=>e(34,g=T)),Jt(n,jt,T=>e(33,d=T)),bo(()=>{h&&u&&(Gt.delete(h),u==null||u.removeLayer(h))});let dt;function ri(T){var _e,tn;if(!O||!h||!u||I&&Nt(T)!==h)return;let _t=T.features??[],Cn=(tn=(_e=_t[0])==null?void 0:_e.properties)==null?void 0:tn.cluster_id,Le={event:T,map:u,clusterId:Cn,layer:h,source:a,features:_t};X(T.type,Le)}function Eh(T){var _e,tn;if(!O||!h||!u||I&&Nt(T)!==h)return;E&&(u.getCanvas().style.cursor=E);let _t=T.features??[];e(6,R=_t[0]??null);let Cn=(tn=(_e=_t[0])==null?void 0:_e.properties)==null?void 0:tn.cluster_id;X("mouseenter",{event:T,map:u,clusterId:Cn,layer:h,source:a,features:_t})}function Lh(T){var _e,tn,Ih;if(!O||!u)return;if(I&&Nt(T)!==h){e(6,R=null),L&&dt!==void 0&&(u==null||u.setFeatureState({source:a,sourceLayer:v,id:dt},{hover:!1}),dt=void 0);return}u.getCanvas().style.cursor=E;let _t=T.features??[],Cn=(tn=(_e=_t[0])==null?void 0:_e.properties)==null?void 0:tn.cluster_id,Le=(Ih=_t[0])==null?void 0:Ih.id;Le!==dt&&(L&&(dt!==void 0&&(u==null||u.setFeatureState({source:a,id:dt,sourceLayer:v},{hover:!1})),u==null||u.setFeatureState({source:a,id:Le,sourceLayer:v},{hover:!0})),dt=Le,e(6,R=_t[0]??null)),X("mousemove",{event:T,map:u,clusterId:Cn,layer:h,source:a,features:_t})}function Th(T){if(!(!O||!h||!u)){if(E&&(u.getCanvas().style.cursor=""),e(6,R=null),L&&dt!==void 0){const _t={source:a,id:dt,sourceLayer:v};u==null||u.setFeatureState(_t,{hover:!1}),dt=void 0}X("mouseleave",{map:u,layer:h,source:a})}}let br=!0;function Rh(T){u&&(u.off("click",T,ri),u.off("dblclick",T,ri),u.off("contextmenu",T,ri),u.off("mouseenter",T,Eh),u.off("mousemove",T,Lh),u.off("mouseleave",T,Th))}return bo(()=>{u&&h&&Rh(h)}),n.$$set=T=>{"id"in T&&e(7,x=T.id),"source"in T&&e(8,m=T.source),"sourceLayer"in T&&e(9,v=T.sourceLayer),"beforeId"in T&&e(10,b=T.beforeId),"beforeLayerType"in T&&e(11,_=T.beforeLayerType),"type"in T&&e(12,w=T.type),"paint"in T&&e(13,M=T.paint),"layout"in T&&e(14,S=T.layout),"filter"in T&&e(15,P=T.filter),"applyToClusters"in T&&e(16,C=T.applyToClusters),"minzoom"in T&&e(17,k=T.minzoom),"maxzoom"in T&&e(18,A=T.maxzoom),"manageHoverState"in T&&e(19,L=T.manageHoverState),"hovered"in T&&e(6,R=T.hovered),"interactive"in T&&e(20,O=T.interactive),"hoverCursor"in T&&e(21,E=T.hoverCursor),"eventsIfTopMost"in T&&e(22,I=T.eventsIfTopMost),"$$scope"in T&&e(35,y=T.$$scope)},n.$$.update=()=>{if(n.$$.dirty[0]&65536&&e(30,i=AS(C)),n.$$.dirty[0]&1073774592&&e(24,s=PS("all",i,P)),n.$$.dirty[0]&131072|n.$$.dirty[1]&8&&e(26,r=k??g),n.$$.dirty[0]&262144|n.$$.dirty[1]&4&&e(25,o=A??d),n.$$.dirty[0]&256|n.$$.dirty[1]&2&&e(29,a=m||f),n.$$.dirty[0]&654343809|n.$$.dirty[1]&1&&u&&h!==x&&a){h&&(Rh(h),Gt.delete(h));let T=b;if(!b&&_){let _t=u.getStyle().layers,Cn=typeof _=="function"?_:_e=>_e.type===_,Le=_t==null?void 0:_t.find(Cn);Le&&(T=Le.id)}$n(St,h=x,h),u.addLayer(Ys({id:h,type:w,source:a,"source-layer":v,filter:s,paint:M,layout:S,minzoom:r,maxzoom:o}),T),e(23,br=!0),u.on("click",h,ri),u.on("dblclick",h,ri),u.on("contextmenu",h,ri),u.on("mouseenter",h,Eh),u.on("mousemove",h,Lh),u.on("mouseleave",h,Th)}n.$$.dirty[0]&1048577&&h&&Gt.set(h,{interactive:O}),n.$$.dirty[0]&1|n.$$.dirty[1]&1&&e(28,l=h?pf((T,_t)=>u==null?void 0:u.setPaintProperty(h,T,_t)):void 0),n.$$.dirty[0]&1|n.$$.dirty[1]&1&&e(27,c=h?pf((T,_t)=>u==null?void 0:u.setLayoutProperty(h,T,_t)):void 0),n.$$.dirty[0]&268443648&&(l==null||l(M)),n.$$.dirty[0]&134234112&&(c==null||c(S)),n.$$.dirty[0]&100663297|n.$$.dirty[1]&1&&h&&(u==null||u.setLayerZoomRange(h,r,o)),n.$$.dirty[0]&25165825|n.$$.dirty[1]&1&&h&&(br?e(23,br=!1):u==null||u.setFilter(h,s))},[h,J,ht,St,st,jt,R,x,m,v,b,_,w,M,S,P,C,k,A,L,O,E,I,br,s,o,r,c,l,a,i,u,f,d,g,y,p]}class $c extends te{constructor(t){super(),ee(this,t,OS,CS,zt,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function DS(n){let t;const e=n[16].default,i=Bi(e,n,n[24],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&16777216)&&zi(i,e,s,s[24],t?Wi(e,s[24],r,null):Ni(s[24]),null)},i(s){t||(U(i,s),t=!0)},o(s){Z(i,s),t=!1},d(s){i&&i.d(s)}}}function ES(n){let t,e,i;function s(o){n[17](o)}let r={id:n[1],type:"circle",source:n[2],sourceLayer:n[3],beforeId:n[4],beforeLayerType:n[5],paint:n[6],layout:n[7],filter:n[8],applyToClusters:n[9],minzoom:n[10],maxzoom:n[11],hoverCursor:n[12],manageHoverState:n[13],eventsIfTopMost:n[14],interactive:n[15],$$slots:{default:[DS]},$$scope:{ctx:n}};return n[0]!==void 0&&(r.hovered=n[0]),t=new $c({props:r}),Yn.push(()=>xi(t,"hovered",s)),t.$on("click",n[18]),t.$on("dblclick",n[19]),t.$on("contextmenu",n[20]),t.$on("mouseenter",n[21]),t.$on("mousemove",n[22]),t.$on("mouseleave",n[23]),{c(){Ge(t.$$.fragment)},m(o,a){qe(t,o,a),i=!0},p(o,[a]){const l={};a&2&&(l.id=o[1]),a&4&&(l.source=o[2]),a&8&&(l.sourceLayer=o[3]),a&16&&(l.beforeId=o[4]),a&32&&(l.beforeLayerType=o[5]),a&64&&(l.paint=o[6]),a&128&&(l.layout=o[7]),a&256&&(l.filter=o[8]),a&512&&(l.applyToClusters=o[9]),a&1024&&(l.minzoom=o[10]),a&2048&&(l.maxzoom=o[11]),a&4096&&(l.hoverCursor=o[12]),a&8192&&(l.manageHoverState=o[13]),a&16384&&(l.eventsIfTopMost=o[14]),a&32768&&(l.interactive=o[15]),a&16777216&&(l.$$scope={dirty:a,ctx:o}),!e&&a&1&&(e=!0,l.hovered=o[0],wi(()=>e=!1)),t.$set(l)},i(o){i||(U(t.$$.fragment,o),i=!0)},o(o){Z(t.$$.fragment,o),i=!1},d(o){Ke(t,o)}}}function LS(n,t,e){let{$$slots:i={},$$scope:s}=t,{id:r=lr("circle")}=t,{source:o=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:l=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:h}=t,{layout:u=void 0}=t,{filter:f=void 0}=t,{applyToClusters:d=void 0}=t,{minzoom:g=void 0}=t,{maxzoom:p=void 0}=t,{hoverCursor:y=void 0}=t,{manageHoverState:x=!1}=t,{hovered:m=null}=t,{eventsIfTopMost:v=!1}=t,{interactive:b=!0}=t;function _(A){m=A,e(0,m)}function w(A){Pt.call(this,n,A)}function M(A){Pt.call(this,n,A)}function S(A){Pt.call(this,n,A)}function P(A){Pt.call(this,n,A)}function C(A){Pt.call(this,n,A)}function k(A){Pt.call(this,n,A)}return n.$$set=A=>{"id"in A&&e(1,r=A.id),"source"in A&&e(2,o=A.source),"sourceLayer"in A&&e(3,a=A.sourceLayer),"beforeId"in A&&e(4,l=A.beforeId),"beforeLayerType"in A&&e(5,c=A.beforeLayerType),"paint"in A&&e(6,h=A.paint),"layout"in A&&e(7,u=A.layout),"filter"in A&&e(8,f=A.filter),"applyToClusters"in A&&e(9,d=A.applyToClusters),"minzoom"in A&&e(10,g=A.minzoom),"maxzoom"in A&&e(11,p=A.maxzoom),"hoverCursor"in A&&e(12,y=A.hoverCursor),"manageHoverState"in A&&e(13,x=A.manageHoverState),"hovered"in A&&e(0,m=A.hovered),"eventsIfTopMost"in A&&e(14,v=A.eventsIfTopMost),"interactive"in A&&e(15,b=A.interactive),"$$scope"in A&&e(24,s=A.$$scope)},[m,r,o,a,l,c,h,u,f,d,g,p,y,x,v,b,i,_,w,M,S,P,C,k,s]}class TS extends te{constructor(t){super(),ee(this,t,LS,ES,zt,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function RS(n){let t;const e=n[15].default,i=Bi(e,n,n[23],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&8388608)&&zi(i,e,s,s[23],t?Wi(e,s[23],r,null):Ni(s[23]),null)},i(s){t||(U(i,s),t=!0)},o(s){Z(i,s),t=!1},d(s){i&&i.d(s)}}}function IS(n){let t,e,i;function s(o){n[16](o)}let r={id:n[1],type:"fill",source:n[2],sourceLayer:n[3],beforeId:n[4],beforeLayerType:n[5],paint:n[6],layout:n[7],filter:n[8],minzoom:n[9],maxzoom:n[10],hoverCursor:n[11],manageHoverState:n[12],eventsIfTopMost:n[13],interactive:n[14],$$slots:{default:[RS]},$$scope:{ctx:n}};return n[0]!==void 0&&(r.hovered=n[0]),t=new $c({props:r}),Yn.push(()=>xi(t,"hovered",s)),t.$on("click",n[17]),t.$on("dblclick",n[18]),t.$on("contextmenu",n[19]),t.$on("mouseenter",n[20]),t.$on("mousemove",n[21]),t.$on("mouseleave",n[22]),{c(){Ge(t.$$.fragment)},m(o,a){qe(t,o,a),i=!0},p(o,[a]){const l={};a&2&&(l.id=o[1]),a&4&&(l.source=o[2]),a&8&&(l.sourceLayer=o[3]),a&16&&(l.beforeId=o[4]),a&32&&(l.beforeLayerType=o[5]),a&64&&(l.paint=o[6]),a&128&&(l.layout=o[7]),a&256&&(l.filter=o[8]),a&512&&(l.minzoom=o[9]),a&1024&&(l.maxzoom=o[10]),a&2048&&(l.hoverCursor=o[11]),a&4096&&(l.manageHoverState=o[12]),a&8192&&(l.eventsIfTopMost=o[13]),a&16384&&(l.interactive=o[14]),a&8388608&&(l.$$scope={dirty:a,ctx:o}),!e&&a&1&&(e=!0,l.hovered=o[0],wi(()=>e=!1)),t.$set(l)},i(o){i||(U(t.$$.fragment,o),i=!0)},o(o){Z(t.$$.fragment,o),i=!1},d(o){Ke(t,o)}}}function FS(n,t,e){let{$$slots:i={},$$scope:s}=t,{id:r=lr("fill")}=t,{source:o=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:l=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:h}=t,{layout:u=void 0}=t,{filter:f=void 0}=t,{minzoom:d=void 0}=t,{maxzoom:g=void 0}=t,{hoverCursor:p=void 0}=t,{manageHoverState:y=!1}=t,{hovered:x=null}=t,{eventsIfTopMost:m=!1}=t,{interactive:v=!0}=t;function b(k){x=k,e(0,x)}function _(k){Pt.call(this,n,k)}function w(k){Pt.call(this,n,k)}function M(k){Pt.call(this,n,k)}function S(k){Pt.call(this,n,k)}function P(k){Pt.call(this,n,k)}function C(k){Pt.call(this,n,k)}return n.$$set=k=>{"id"in k&&e(1,r=k.id),"source"in k&&e(2,o=k.source),"sourceLayer"in k&&e(3,a=k.sourceLayer),"beforeId"in k&&e(4,l=k.beforeId),"beforeLayerType"in k&&e(5,c=k.beforeLayerType),"paint"in k&&e(6,h=k.paint),"layout"in k&&e(7,u=k.layout),"filter"in k&&e(8,f=k.filter),"minzoom"in k&&e(9,d=k.minzoom),"maxzoom"in k&&e(10,g=k.maxzoom),"hoverCursor"in k&&e(11,p=k.hoverCursor),"manageHoverState"in k&&e(12,y=k.manageHoverState),"hovered"in k&&e(0,x=k.hovered),"eventsIfTopMost"in k&&e(13,m=k.eventsIfTopMost),"interactive"in k&&e(14,v=k.interactive),"$$scope"in k&&e(23,s=k.$$scope)},[x,r,o,a,l,c,h,u,f,d,g,p,y,m,v,i,b,_,w,M,S,P,C,s]}class BS extends te{constructor(t){super(),ee(this,t,FS,IS,zt,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function zS(n,t,e,i,s){let r=!1;n.getSource(t)&&(r=!0,n.removeSource(t));const o=()=>{i(t)&&(n.addSource(t,e),s())};if(r){const a=()=>{t&&(n.getSource(t)?setTimeout(a,1):o())};a()}else o()}function NS(n,t,e){up().then(()=>{let i=fp(n);if(!i)return;i.getSource(t)===e&&i.removeSource(t)})}function yf(n){let t=n[0],e,i,s=_f(n);return{c(){s.c(),e=Ze()},m(r,o){s.m(r,o),N(r,e,o),i=!0},p(r,o){o&1&&zt(t,t=r[0])?(vn(),Z(s,1,1,wt),xn(),s=_f(r),s.c(),U(s,1),s.m(e.parentNode,e)):s.p(r,o)},i(r){i||(U(s),i=!0)},o(r){Z(s),i=!1},d(r){r&&W(e),s.d(r)}}}function _f(n){let t;const e=n[15].default,i=Bi(e,n,n[14],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&16384)&&zi(i,e,s,s[14],t?Wi(e,s[14],r,null):Ni(s[14]),null)},i(s){t||(U(i,s),t=!0)},o(s){Z(i,s),t=!1},d(s){i&&i.d(s)}}}function WS(n){let t,e,i=n[0]&&yf(n);return{c(){i&&i.c(),t=Ze()},m(s,r){i&&i.m(s,r),N(s,t,r),e=!0},p(s,[r]){s[0]?i?(i.p(s,r),r&1&&U(i,1)):(i=yf(s),i.c(),U(i,1),i.m(t.parentNode,t)):i&&(vn(),Z(i,1,1,()=>{i=null}),xn())},i(s){e||(U(i),e=!0)},o(s){Z(i),e=!1},d(s){s&&W(t),i&&i.d(s)}}}function VS(n,t,e){let i,s,r,{$$slots:o={},$$scope:a}=t,{id:l=lr("geojson")}=t,{data:c}=t,{generateId:h=!1}=t,{promoteId:u=void 0}=t,{filter:f=void 0}=t,{lineMetrics:d=void 0}=t,{cluster:g=void 0}=t;const{map:p,cluster:y,self:x}=MS();Jt(n,p,b=>e(13,s=b)),Jt(n,y,b=>e(16,r=b)),Jt(n,x,b=>e(0,i=b));let m,v=!0;return bo(()=>{i&&m&&s&&(NS(p,i,m),$n(x,i=null,i),e(11,m=void 0))}),n.$$set=b=>{"id"in b&&e(4,l=b.id),"data"in b&&e(5,c=b.data),"generateId"in b&&e(6,h=b.generateId),"promoteId"in b&&e(7,u=b.promoteId),"filter"in b&&e(8,f=b.filter),"lineMetrics"in b&&e(9,d=b.lineMetrics),"cluster"in b&&e(10,g=b.cluster),"$$scope"in b&&e(14,a=b.$$scope)},n.$$.update=()=>{n.$$.dirty&1024&&$n(y,r=g,r),n.$$.dirty&12273&&s&&i!==l&&($n(x,i=l,i),zS(s,i,Ys({type:"geojson",data:c,filter:f,lineMetrics:d,generateId:h,promoteId:u,cluster:!!g,clusterMinPoints:g==null?void 0:g.minPoints,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius,clusterProperties:g==null?void 0:g.properties}),b=>s&&b===i,()=>{i&&(e(11,m=s==null?void 0:s.getSource(i)),e(12,v=!0))})),n.$$.dirty&8208&&(s==null||s.on("style.load",()=>{e(11,m=s==null?void 0:s.getSource(l))})),n.$$.dirty&6176&&m&&(v?e(12,v=!1):m.setData(c)),n.$$.dirty&3072&&(m==null||m.setClusterOptions(Ys({cluster:!!g,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius})))},[i,p,y,x,l,c,h,u,f,d,g,m,v,s,a,o]}class jS extends te{constructor(t){super(),ee(this,t,VS,WS,zt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function HS(n){let t;const e=n[15].default,i=Bi(e,n,n[23],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&8388608)&&zi(i,e,s,s[23],t?Wi(e,s[23],r,null):Ni(s[23]),null)},i(s){t||(U(i,s),t=!0)},o(s){Z(i,s),t=!1},d(s){i&&i.d(s)}}}function $S(n){let t,e,i;function s(o){n[16](o)}let r={id:n[1],type:"line",source:n[2],sourceLayer:n[3],beforeId:n[4],beforeLayerType:n[5],paint:n[6],layout:n[7],filter:n[8],minzoom:n[9],maxzoom:n[10],hoverCursor:n[11],manageHoverState:n[12],eventsIfTopMost:n[13],interactive:n[14],$$slots:{default:[HS]},$$scope:{ctx:n}};return n[0]!==void 0&&(r.hovered=n[0]),t=new $c({props:r}),Yn.push(()=>xi(t,"hovered",s)),t.$on("click",n[17]),t.$on("dblclick",n[18]),t.$on("contextmenu",n[19]),t.$on("mouseenter",n[20]),t.$on("mousemove",n[21]),t.$on("mouseleave",n[22]),{c(){Ge(t.$$.fragment)},m(o,a){qe(t,o,a),i=!0},p(o,[a]){const l={};a&2&&(l.id=o[1]),a&4&&(l.source=o[2]),a&8&&(l.sourceLayer=o[3]),a&16&&(l.beforeId=o[4]),a&32&&(l.beforeLayerType=o[5]),a&64&&(l.paint=o[6]),a&128&&(l.layout=o[7]),a&256&&(l.filter=o[8]),a&512&&(l.minzoom=o[9]),a&1024&&(l.maxzoom=o[10]),a&2048&&(l.hoverCursor=o[11]),a&4096&&(l.manageHoverState=o[12]),a&8192&&(l.eventsIfTopMost=o[13]),a&16384&&(l.interactive=o[14]),a&8388608&&(l.$$scope={dirty:a,ctx:o}),!e&&a&1&&(e=!0,l.hovered=o[0],wi(()=>e=!1)),t.$set(l)},i(o){i||(U(t.$$.fragment,o),i=!0)},o(o){Z(t.$$.fragment,o),i=!1},d(o){Ke(t,o)}}}function YS(n,t,e){let{$$slots:i={},$$scope:s}=t,{id:r=lr("line")}=t,{source:o=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:l=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:h}=t,{layout:u=void 0}=t,{filter:f=void 0}=t,{minzoom:d=void 0}=t,{maxzoom:g=void 0}=t,{hoverCursor:p=void 0}=t,{manageHoverState:y=!1}=t,{hovered:x=null}=t,{eventsIfTopMost:m=!1}=t,{interactive:v=!0}=t;function b(k){x=k,e(0,x)}function _(k){Pt.call(this,n,k)}function w(k){Pt.call(this,n,k)}function M(k){Pt.call(this,n,k)}function S(k){Pt.call(this,n,k)}function P(k){Pt.call(this,n,k)}function C(k){Pt.call(this,n,k)}return n.$$set=k=>{"id"in k&&e(1,r=k.id),"source"in k&&e(2,o=k.source),"sourceLayer"in k&&e(3,a=k.sourceLayer),"beforeId"in k&&e(4,l=k.beforeId),"beforeLayerType"in k&&e(5,c=k.beforeLayerType),"paint"in k&&e(6,h=k.paint),"layout"in k&&e(7,u=k.layout),"filter"in k&&e(8,f=k.filter),"minzoom"in k&&e(9,d=k.minzoom),"maxzoom"in k&&e(10,g=k.maxzoom),"hoverCursor"in k&&e(11,p=k.hoverCursor),"manageHoverState"in k&&e(12,y=k.manageHoverState),"hovered"in k&&e(0,x=k.hovered),"eventsIfTopMost"in k&&e(13,m=k.eventsIfTopMost),"interactive"in k&&e(14,v=k.interactive),"$$scope"in k&&e(23,s=k.$$scope)},[x,r,o,a,l,c,h,u,f,d,g,p,y,m,v,i,b,_,w,M,S,P,C,s]}class US extends te{constructor(t){super(),ee(this,t,YS,$S,zt,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function XS(n){let t,e,i,s,r,o;return t=new BS({props:{id:"edit-polygon-fill",filter:fS,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),i=new US({props:{id:"edit-polygon-lines",filter:dS,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),r=new TS({props:{id:"edit-polygon-vertices",filter:gS,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){Ge(t.$$.fragment),e=vt(),Ge(i.$$.fragment),s=vt(),Ge(r.$$.fragment)},m(a,l){qe(t,a,l),N(a,e,l),qe(i,a,l),N(a,s,l),qe(r,a,l),o=!0},p:wt,i(a){o||(U(t.$$.fragment,a),U(i.$$.fragment,a),U(r.$$.fragment,a),o=!0)},o(a){Z(t.$$.fragment,a),Z(i.$$.fragment,a),Z(r.$$.fragment,a),o=!1},d(a){a&&(W(e),W(s)),Ke(t,a),Ke(i,a),Ke(r,a)}}}function GS(n){let t,e;return t=new jS({props:{data:n[0],$$slots:{default:[XS]},$$scope:{ctx:n}}}),{c(){Ge(t.$$.fragment)},m(i,s){qe(t,i,s),e=!0},p(i,[s]){const r={};s&1&&(r.data=i[0]),s&2&&(r.$$scope={dirty:s,ctx:i}),t.$set(r)},i(i){e||(U(t.$$.fragment,i),e=!0)},o(i){Z(t.$$.fragment,i),e=!1},d(i){Ke(t,i)}}}function qS(n,t,e){let i;return Jt(n,zm,s=>e(0,i=s)),[i]}class lR extends te{constructor(t){super(),ee(this,t,qS,GS,zt,{})}}function KS(n){let t,e,i,s,r,o,a;return{c(){t=z("button"),t.textContent="Import current view",e=vt(),i=z("i"),i.textContent="or...",s=vt(),r=z("button"),r.textContent="Draw an area to import on the map",Wt(t,"type","button"),Wt(r,"type","button")},m(l,c){N(l,t,c),N(l,e,c),N(l,i,c),N(l,s,c),N(l,r,c),o||(a=[Ot(t,"click",n[1]),Ot(r,"click",n[2])],o=!0)},p:wt,i:wt,o:wt,d(l){l&&(W(t),W(e),W(i),W(s),W(r)),o=!1,wn(a)}}}function ZS(n){let t,e;return t=new xS({props:{polygonTool:n[0]}}),{c(){Ge(t.$$.fragment)},m(i,s){qe(t,i,s),e=!0},p(i,s){const r={};s&1&&(r.polygonTool=i[0]),t.$set(r)},i(i){e||(U(t.$$.fragment,i),e=!0)},o(i){Z(t.$$.fragment,i),e=!1},d(i){Ke(t,i)}}}function JS(n){let t,e,i,s;const r=[ZS,KS],o=[];function a(l,c){return l[0]?0:1}return t=a(n),e=o[t]=r[t](n),{c(){e.c(),i=Ze()},m(l,c){o[t].m(l,c),N(l,i,c),s=!0},p(l,[c]){let h=t;t=a(l),t===h?o[t].p(l,c):(vn(),Z(o[h],1,1,()=>{o[h]=null}),xn(),e=o[t],e?e.p(l,c):(e=o[t]=r[t](l),e.c()),U(e,1),e.m(i.parentNode,i))},i(l){s||(U(e),s=!0)},o(l){Z(e),s=!1},d(l){l&&W(i),o[t].d(l)}}}function qi(n){return[n.lng,n.lat]}function QS(n,t,e){let{map:i}=t;const s=pc();let r=null;async function o(h){try{s("loading","Loading from Overpass");let f=await(await fetch(n_(h))).text();s("gotXml",f)}catch(u){s("error",u.toString())}}function a(){let h=i.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[qi(h.getSouthWest()),qi(h.getNorthWest()),qi(h.getNorthEast()),qi(h.getSouthEast()),qi(h.getSouthWest())]],type:"Polygon"}}}async function l(){if(i){if(i.getZoom()<13){s("error","Zoom in more to import");return}await o(a())}}function c(){i&&(e(0,r=new mS(i)),r.startNew(),r.addEventListenerSuccess(async h=>{e(0,r=null),await o(h)}),r.addEventListenerFailure(()=>{e(0,r=null)}))}return n.$$set=h=>{"map"in h&&e(3,i=h.map)},[r,l,c,i]}class cR extends te{constructor(t){super(),ee(this,t,QS,JS,zt,{map:3})}}let j;const He=new Array(128).fill(void 0);He.push(void 0,null,!0,!1);function F(n){return He[n]}let Gn=0,_s=null;function Is(){return(_s===null||_s.byteLength===0)&&(_s=new Uint8Array(j.memory.buffer)),_s}const ho=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},tM=typeof ho.encodeInto=="function"?function(n,t){return ho.encodeInto(n,t)}:function(n,t){const e=ho.encode(n);return t.set(e),{read:n.length,written:e.length}};function Ya(n,t,e){if(e===void 0){const a=ho.encode(n),l=t(a.length,1)>>>0;return Is().subarray(l,l+a.length).set(a),Gn=a.length,l}let i=n.length,s=t(i,1)>>>0;const r=Is();let o=0;for(;o127)break;r[s+o]=a}if(o!==i){o!==0&&(n=n.slice(o)),s=e(s,i,i=o+n.length*3,1)>>>0;const a=Is().subarray(s+o,s+i),l=tM(n,a);o+=l.written,s=e(s,i,o,1)>>>0}return Gn=o,s}function Ki(n){return n==null}let vs=null;function ft(){return(vs===null||vs.byteLength===0)&&(vs=new Int32Array(j.memory.buffer)),vs}let Fs=He.length;function eM(n){n<132||(He[n]=Fs,Fs=n)}function ln(n){const t=F(n);return eM(n),t}const jm=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&jm.decode();function Vn(n,t){return n=n>>>0,jm.decode(Is().subarray(n,n+t))}function Q(n){Fs===He.length&&He.push(He.length+1);const t=Fs;return Fs=He[t],He[t]=n,t}let xs=null;function Hm(){return(xs===null||xs.byteLength===0)&&(xs=new Float64Array(j.memory.buffer)),xs}let ws=null;function nM(){return(ws===null||ws.byteLength===0)&&(ws=new BigInt64Array(j.memory.buffer)),ws}function Vl(n){const t=typeof n;if(t=="number"||t=="boolean"||n==null)return`${n}`;if(t=="string")return`"${n}"`;if(t=="symbol"){const s=n.description;return s==null?"Symbol":`Symbol(${s})`}if(t=="function"){const s=n.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(n)){const s=n.length;let r="[";s>0&&(r+=Vl(n[0]));for(let o=1;o1)i=e[1];else return toString.call(n);if(i=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message} -${n.stack}`:i}function iM(n,t){const e=t(n.length*1,1)>>>0;return Is().set(n,e/1),Gn=n.length,e}function sM(n,t){return n=n>>>0,Hm().subarray(n/8,n/8+t)}function On(n,t){try{return n.apply(this,t)}catch(e){j.__wbindgen_exn_store(Q(e))}}const rM=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>j.__wbg_jsnetwork_free(n>>>0));class hR{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,rM.unregister(this),t}free(){const t=this.__destroy_into_raw();j.__wbg_jsnetwork_free(t)}constructor(t){try{const r=j.__wbindgen_add_to_stack_pointer(-16),o=iM(t,j.__wbindgen_malloc),a=Gn;j.jsnetwork_new(r,o,a);var e=ft()[r/4+0],i=ft()[r/4+1],s=ft()[r/4+2];if(s)throw ln(i);return this.__wbg_ptr=e>>>0,this}finally{j.__wbindgen_add_to_stack_pointer(16)}}recalculate(t){let e,i;try{const h=j.__wbindgen_add_to_stack_pointer(-16);j.jsnetwork_recalculate(h,this.__wbg_ptr,Q(t));var s=ft()[h/4+0],r=ft()[h/4+1],o=ft()[h/4+2],a=ft()[h/4+3],l=s,c=r;if(a)throw l=0,c=0,ln(o);return e=l,i=c,Vn(l,c)}finally{j.__wbindgen_add_to_stack_pointer(16),j.__wbindgen_free(e,i,1)}}updateCostFunction(t){try{const s=j.__wbindgen_add_to_stack_pointer(-16);j.jsnetwork_updateCostFunction(s,this.__wbg_ptr,Q(t));var e=ft()[s/4+0],i=ft()[s/4+1];if(i)throw ln(e)}finally{j.__wbindgen_add_to_stack_pointer(16)}}getBounds(){try{const s=j.__wbindgen_add_to_stack_pointer(-16);j.jsnetwork_getBounds(s,this.__wbg_ptr);var t=ft()[s/4+0],e=ft()[s/4+1],i=sM(t,e).slice();return j.__wbindgen_free(t,e*8,8),i}finally{j.__wbindgen_add_to_stack_pointer(16)}}debugNetwork(){let t,e;try{const c=j.__wbindgen_add_to_stack_pointer(-16);j.jsnetwork_debugNetwork(c,this.__wbg_ptr);var i=ft()[c/4+0],s=ft()[c/4+1],r=ft()[c/4+2],o=ft()[c/4+3],a=i,l=s;if(o)throw a=0,l=0,ln(r);return t=a,e=l,Vn(a,l)}finally{j.__wbindgen_add_to_stack_pointer(16),j.__wbindgen_free(t,e,1)}}}async function oM(n,t){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,t)}catch(i){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}function aM(){const n={};return n.wbg={},n.wbg.__wbindgen_string_get=function(t,e){const i=F(e),s=typeof i=="string"?i:void 0;var r=Ki(s)?0:Ya(s,j.__wbindgen_malloc,j.__wbindgen_realloc),o=Gn;ft()[t/4+1]=o,ft()[t/4+0]=r},n.wbg.__wbindgen_object_drop_ref=function(t){ln(t)},n.wbg.__wbindgen_string_new=function(t,e){const i=Vn(t,e);return Q(i)},n.wbg.__wbindgen_is_bigint=function(t){return typeof F(t)=="bigint"},n.wbg.__wbindgen_bigint_from_u64=function(t){const e=BigInt.asUintN(64,t);return Q(e)},n.wbg.__wbindgen_jsval_eq=function(t,e){return F(t)===F(e)},n.wbg.__wbindgen_error_new=function(t,e){const i=new Error(Vn(t,e));return Q(i)},n.wbg.__wbindgen_number_get=function(t,e){const i=F(e),s=typeof i=="number"?i:void 0;Hm()[t/8+1]=Ki(s)?0:s,ft()[t/4+0]=!Ki(s)},n.wbg.__wbindgen_is_string=function(t){return typeof F(t)=="string"},n.wbg.__wbindgen_is_object=function(t){const e=F(t);return typeof e=="object"&&e!==null},n.wbg.__wbindgen_is_undefined=function(t){return F(t)===void 0},n.wbg.__wbindgen_in=function(t,e){return F(t)in F(e)},n.wbg.__wbindgen_jsval_loose_eq=function(t,e){return F(t)==F(e)},n.wbg.__wbindgen_boolean_get=function(t){const e=F(t);return typeof e=="boolean"?e?1:0:2},n.wbg.__wbindgen_as_number=function(t){return+F(t)},n.wbg.__wbindgen_number_new=function(t){return Q(t)},n.wbg.__wbindgen_object_clone_ref=function(t){const e=F(t);return Q(e)},n.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(t,e){const i=F(t)[F(e)];return Q(i)},n.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Q(t)},n.wbg.__wbg_stack_658279fe44541cf6=function(t,e){const i=F(e).stack,s=Ya(i,j.__wbindgen_malloc,j.__wbindgen_realloc),r=Gn;ft()[t/4+1]=r,ft()[t/4+0]=s},n.wbg.__wbg_error_f851667af71bcfc6=function(t,e){let i,s;try{i=t,s=e,console.error(Vn(t,e))}finally{j.__wbindgen_free(i,s,1)}},n.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(t,e){const i=F(t)[F(e)];return Q(i)},n.wbg.__wbg_set_841ac57cff3d672b=function(t,e,i){F(t)[ln(e)]=ln(i)},n.wbg.__wbg_debug_5fb96680aecf5dc8=function(t){console.debug(F(t))},n.wbg.__wbg_error_8e3928cfb8a43e2b=function(t){console.error(F(t))},n.wbg.__wbg_info_530a29cb2e4e3304=function(t){console.info(F(t))},n.wbg.__wbg_log_5bb5f88f245d7762=function(t){console.log(F(t))},n.wbg.__wbg_warn_63bbae1730aead09=function(t){console.warn(F(t))},n.wbg.__wbg_now_4e659b3d15f470d9=function(t){return F(t).now()},n.wbg.__wbg_get_bd8e338fbd5f5cc8=function(t,e){const i=F(t)[e>>>0];return Q(i)},n.wbg.__wbg_length_cd7af8117672b8b8=function(t){return F(t).length},n.wbg.__wbg_new_16b304a2cfa7ff4a=function(){const t=new Array;return Q(t)},n.wbg.__wbindgen_is_function=function(t){return typeof F(t)=="function"},n.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(t,e){const i=new Function(Vn(t,e));return Q(i)},n.wbg.__wbg_next_40fc327bfc8770e6=function(t){const e=F(t).next;return Q(e)},n.wbg.__wbg_next_196c84450b364254=function(){return On(function(t){const e=F(t).next();return Q(e)},arguments)},n.wbg.__wbg_done_298b57d23c0fc80c=function(t){return F(t).done},n.wbg.__wbg_value_d93c65011f51a456=function(t){const e=F(t).value;return Q(e)},n.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return Q(Symbol.iterator)},n.wbg.__wbg_get_e3c254076557e348=function(){return On(function(t,e){const i=Reflect.get(F(t),F(e));return Q(i)},arguments)},n.wbg.__wbg_call_27c0f87801dedf93=function(){return On(function(t,e){const i=F(t).call(F(e));return Q(i)},arguments)},n.wbg.__wbg_new_72fb9a18b5ae2624=function(){const t=new Object;return Q(t)},n.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return On(function(){const t=self.self;return Q(t)},arguments)},n.wbg.__wbg_window_c6fb939a7f436783=function(){return On(function(){const t=window.window;return Q(t)},arguments)},n.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return On(function(){const t=globalThis.globalThis;return Q(t)},arguments)},n.wbg.__wbg_global_207b558942527489=function(){return On(function(){const t=global.global;return Q(t)},arguments)},n.wbg.__wbg_set_d4638f722068f043=function(t,e,i){F(t)[e>>>0]=ln(i)},n.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(t){let e;try{e=F(t)instanceof ArrayBuffer}catch{e=!1}return e},n.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(t){return Number.isSafeInteger(F(t))},n.wbg.__wbg_entries_95cc2c823b285a09=function(t){const e=Object.entries(F(t));return Q(e)},n.wbg.__wbg_buffer_12d079cc21e14bdb=function(t){const e=F(t).buffer;return Q(e)},n.wbg.__wbg_new_63b92bc8671ed464=function(t){const e=new Uint8Array(F(t));return Q(e)},n.wbg.__wbg_set_a47bac70306a19a7=function(t,e,i){F(t).set(F(e),i>>>0)},n.wbg.__wbg_length_c20a40f15020d68a=function(t){return F(t).length},n.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(t){let e;try{e=F(t)instanceof Uint8Array}catch{e=!1}return e},n.wbg.__wbindgen_bigint_get_as_i64=function(t,e){const i=F(e),s=typeof i=="bigint"?i:void 0;nM()[t/8+1]=Ki(s)?BigInt(0):s,ft()[t/4+0]=!Ki(s)},n.wbg.__wbindgen_debug_string=function(t,e){const i=Vl(F(e)),s=Ya(i,j.__wbindgen_malloc,j.__wbindgen_realloc),r=Gn;ft()[t/4+1]=r,ft()[t/4+0]=s},n.wbg.__wbindgen_throw=function(t,e){throw new Error(Vn(t,e))},n.wbg.__wbindgen_memory=function(){const t=j.memory;return Q(t)},n}function lM(n,t){return j=n.exports,cM.__wbindgen_wasm_module=t,ws=null,xs=null,vs=null,_s=null,j}async function cM(n){if(j!==void 0)return j;typeof n>"u"&&(n="/od2net/assets/wasm_od2net_bg.wasm");const t=aM();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));const{instance:e,module:i}=await oM(await n,t);return lM(e,i)}function hM(n){let t,e,i,s,r,o,a,l,c,h,u,f;return{c(){t=z("div"),e=z("label"),i=Vt(`Or load an example: - `),s=z("select"),r=z("option"),r.textContent="Custom file loaded",o=z("option"),o.textContent="Antwerp",a=z("option"),a.textContent="Berlin",l=z("option"),l.textContent="South London",c=z("option"),c.textContent="Paris",h=z("option"),h.textContent="Seattle",r.__value="",At(r,r.__value),o.__value="antwerp",At(o,o.__value),a.__value="berlin",At(a,a.__value),l.__value="london",At(l,l.__value),c.__value="paris",At(c,c.__value),h.__value="seattle",At(h,h.__value),n[0]===void 0&&gp(()=>n[1].call(s))},m(d,g){N(d,t,g),B(t,e),B(e,i),B(e,s),B(s,r),B(s,o),B(s,a),B(s,l),B(s,c),B(s,h),yo(s,n[0],!0),u||(f=Ot(s,"change",n[1]),u=!0)},p(d,[g]){g&1&&yo(s,d[0])},i:wt,o:wt,d(d){d&&W(t),u=!1,f()}}}function uM(n,t,e){let{example:i}=t;function s(){i=pp(this),e(0,i)}return n.$$set=r=>{"example"in r&&e(0,i=r.example)},[i,s]}class uR extends te{constructor(t){super(),ee(this,t,uM,hM,zt,{example:0})}}/*! + to cancel`,o.disabled=a=n[1]==0,rn(t,"display","flex"),rn(t,"justify-content","space-between")},m(p,y){N(p,t,y),B(t,e),B(t,i),B(t,s),B(t,r),B(t,o),g.m(o,null),N(p,l,y),N(p,c,y),h||(u=[kt(e,"click",n[2]),kt(s,"click",n[3]),kt(o,"click",n[4])],h=!0)},p(p,[y]){d===(d=f(p))&&g?g.p(p,y):(g.d(1),g=d(p),g&&(g.c(),g.m(o,null))),y&2&&a!==(a=p[1]==0)&&(o.disabled=a)},i:wt,o:wt,d(p){p&&(W(t),W(l),W(c)),g.d(),h=!1,wn(u)}}}function vS(n,t,e){let i;Zt(n,Nm,l=>e(1,i=l));let{polygonTool:s}=t;const r=()=>s.finish(),o=()=>s.cancel(),a=()=>s.undo();return n.$$set=l=>{"polygonTool"in l&&e(0,s=l.polygonTool)},[s,i,r,o,a]}class xS extends te{constructor(t){super(),ee(this,t,vS,_S,Wt,{polygonTool:0})}}let wS=Date.now();function lr(n){return`${n}-${wS++}`}const Wm=Symbol.for("svelte-maplibre");function SS(){return e_(Wm)}function gf(n){return{subscribe:n.subscribe}}function Vm({key:n,setPopupTarget:t=!1,setCluster:e=!1,setMouseEvent:i=!1}){let s=SS(),r=Es(null),o=gf(r),a={...s,[n]:gf(r)};if(t&&(a.popupTarget=o),i){let l=Es(null);a.layerEvent=l,s.layerEvent=l}return e&&(a.cluster=Es()),t_(Wm,a),{...s,self:r}}function MS(){return Vm({key:"source",setCluster:!0})}function kS(n=!0){return Vm({key:"layer",setPopupTarget:n,setMouseEvent:n})}function pf(n){let t;return e=>{if(e)for(let i in e){let s=t==null?void 0:t[i],r=e[i];s!==r&&n(i,r,s)}else if(t)for(let i in t)n(i,void 0,t[i]);t=e}}function PS(n,...t){let e=[n];for(let i of t)if(i)Array.isArray(i)&&i[0]===n?e.push(...i.slice(1)):e.push(i);else continue;if(e.length!==1)return e.length===2?e[1]:e}function AS(n){return n===!0?["has","point_count"]:n===!1?["!",["has","point_count"]]:void 0}function mf(n){let t=n[0],e,i,s=bf(n);return{c(){s.c(),e=_n()},m(r,o){s.m(r,o),N(r,e,o),i=!0},p(r,o){o[0]&1&&Wt(t,t=r[0])?(vn(),J(s,1,1,wt),xn(),s=bf(r),s.c(),U(s,1),s.m(e.parentNode,e)):s.p(r,o)},i(r){i||(U(s),i=!0)},o(r){J(s),i=!1},d(r){r&&W(e),s.d(r)}}}function bf(n){let t;const e=n[36].default,i=Bi(e,n,n[35],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r[1]&16)&&zi(i,e,s,s[35],t?Wi(e,s[35],r,null):Ni(s[35]),null)},i(s){t||(U(i,s),t=!0)},o(s){J(i,s),t=!1},d(s){i&&i.d(s)}}}function CS(n){let t,e,i=n[0]&&mf(n);return{c(){i&&i.c(),t=_n()},m(s,r){i&&i.m(s,r),N(s,t,r),e=!0},p(s,r){s[0]?i?(i.p(s,r),r[0]&1&&U(i,1)):(i=mf(s),i.c(),U(i,1),i.m(t.parentNode,t)):i&&(vn(),J(i,1,1,()=>{i=null}),xn())},i(s){e||(U(i),e=!0)},o(s){J(i),e=!1},d(s){s&&W(t),i&&i.d(s)}}}function OS(n,t,e){let i,s,r,o,a,l,c,h,u,f,d,g,{$$slots:p={},$$scope:y}=t,{id:x=lr("layer")}=t,{source:m=void 0}=t,{sourceLayer:v=void 0}=t,{beforeId:b=void 0}=t,{beforeLayerType:_=void 0}=t,{type:w}=t,{paint:M=void 0}=t,{layout:S=void 0}=t,{filter:P=void 0}=t,{applyToClusters:C=void 0}=t,{minzoom:k=void 0}=t,{maxzoom:A=void 0}=t,{manageHoverState:L=!1}=t,{hovered:R=null}=t,{interactive:O=!0}=t,{hoverCursor:E=void 0}=t,{eventsIfTopMost:I=!1}=t;const X=pc(),{map:Z,source:ht,self:St,minzoom:st,maxzoom:jt,eventTopMost:Vt,layerInfo:Gt}=kS();Zt(n,Z,T=>e(31,u=T)),Zt(n,ht,T=>e(32,f=T)),Zt(n,St,T=>e(0,h=T)),Zt(n,st,T=>e(34,g=T)),Zt(n,jt,T=>e(33,d=T)),bo(()=>{h&&u&&(Gt.delete(h),u==null||u.removeLayer(h))});let dt;function ri(T){var _e,Qe;if(!O||!h||!u||I&&Vt(T)!==h)return;let vt=T.features??[],Cn=(Qe=(_e=vt[0])==null?void 0:_e.properties)==null?void 0:Qe.cluster_id,Le={event:T,map:u,clusterId:Cn,layer:h,source:a,features:vt};X(T.type,Le)}function Eh(T){var _e,Qe;if(!O||!h||!u||I&&Vt(T)!==h)return;E&&(u.getCanvas().style.cursor=E);let vt=T.features??[];e(6,R=vt[0]??null);let Cn=(Qe=(_e=vt[0])==null?void 0:_e.properties)==null?void 0:Qe.cluster_id;X("mouseenter",{event:T,map:u,clusterId:Cn,layer:h,source:a,features:vt})}function Lh(T){var _e,Qe,Ih;if(!O||!u)return;if(I&&Vt(T)!==h){e(6,R=null),L&&dt!==void 0&&(u==null||u.setFeatureState({source:a,sourceLayer:v,id:dt},{hover:!1}),dt=void 0);return}u.getCanvas().style.cursor=E;let vt=T.features??[],Cn=(Qe=(_e=vt[0])==null?void 0:_e.properties)==null?void 0:Qe.cluster_id,Le=(Ih=vt[0])==null?void 0:Ih.id;Le!==dt&&(L&&(dt!==void 0&&(u==null||u.setFeatureState({source:a,id:dt,sourceLayer:v},{hover:!1})),u==null||u.setFeatureState({source:a,id:Le,sourceLayer:v},{hover:!0})),dt=Le,e(6,R=vt[0]??null)),X("mousemove",{event:T,map:u,clusterId:Cn,layer:h,source:a,features:vt})}function Th(T){if(!(!O||!h||!u)){if(E&&(u.getCanvas().style.cursor=""),e(6,R=null),L&&dt!==void 0){const vt={source:a,id:dt,sourceLayer:v};u==null||u.setFeatureState(vt,{hover:!1}),dt=void 0}X("mouseleave",{map:u,layer:h,source:a})}}let br=!0;function Rh(T){u&&(u.off("click",T,ri),u.off("dblclick",T,ri),u.off("contextmenu",T,ri),u.off("mouseenter",T,Eh),u.off("mousemove",T,Lh),u.off("mouseleave",T,Th))}return bo(()=>{u&&h&&Rh(h)}),n.$$set=T=>{"id"in T&&e(7,x=T.id),"source"in T&&e(8,m=T.source),"sourceLayer"in T&&e(9,v=T.sourceLayer),"beforeId"in T&&e(10,b=T.beforeId),"beforeLayerType"in T&&e(11,_=T.beforeLayerType),"type"in T&&e(12,w=T.type),"paint"in T&&e(13,M=T.paint),"layout"in T&&e(14,S=T.layout),"filter"in T&&e(15,P=T.filter),"applyToClusters"in T&&e(16,C=T.applyToClusters),"minzoom"in T&&e(17,k=T.minzoom),"maxzoom"in T&&e(18,A=T.maxzoom),"manageHoverState"in T&&e(19,L=T.manageHoverState),"hovered"in T&&e(6,R=T.hovered),"interactive"in T&&e(20,O=T.interactive),"hoverCursor"in T&&e(21,E=T.hoverCursor),"eventsIfTopMost"in T&&e(22,I=T.eventsIfTopMost),"$$scope"in T&&e(35,y=T.$$scope)},n.$$.update=()=>{if(n.$$.dirty[0]&65536&&e(30,i=AS(C)),n.$$.dirty[0]&1073774592&&e(24,s=PS("all",i,P)),n.$$.dirty[0]&131072|n.$$.dirty[1]&8&&e(26,r=k??g),n.$$.dirty[0]&262144|n.$$.dirty[1]&4&&e(25,o=A??d),n.$$.dirty[0]&256|n.$$.dirty[1]&2&&e(29,a=m||f),n.$$.dirty[0]&654343809|n.$$.dirty[1]&1&&u&&h!==x&&a){h&&(Rh(h),Gt.delete(h));let T=b;if(!b&&_){let vt=u.getStyle().layers,Cn=typeof _=="function"?_:_e=>_e.type===_,Le=vt==null?void 0:vt.find(Cn);Le&&(T=Le.id)}$n(St,h=x,h),u.addLayer(Ys({id:h,type:w,source:a,"source-layer":v,filter:s,paint:M,layout:S,minzoom:r,maxzoom:o}),T),e(23,br=!0),u.on("click",h,ri),u.on("dblclick",h,ri),u.on("contextmenu",h,ri),u.on("mouseenter",h,Eh),u.on("mousemove",h,Lh),u.on("mouseleave",h,Th)}n.$$.dirty[0]&1048577&&h&&Gt.set(h,{interactive:O}),n.$$.dirty[0]&1|n.$$.dirty[1]&1&&e(28,l=h?pf((T,vt)=>u==null?void 0:u.setPaintProperty(h,T,vt)):void 0),n.$$.dirty[0]&1|n.$$.dirty[1]&1&&e(27,c=h?pf((T,vt)=>u==null?void 0:u.setLayoutProperty(h,T,vt)):void 0),n.$$.dirty[0]&268443648&&(l==null||l(M)),n.$$.dirty[0]&134234112&&(c==null||c(S)),n.$$.dirty[0]&100663297|n.$$.dirty[1]&1&&h&&(u==null||u.setLayerZoomRange(h,r,o)),n.$$.dirty[0]&25165825|n.$$.dirty[1]&1&&h&&(br?e(23,br=!1):u==null||u.setFilter(h,s))},[h,Z,ht,St,st,jt,R,x,m,v,b,_,w,M,S,P,C,k,A,L,O,E,I,br,s,o,r,c,l,a,i,u,f,d,g,y,p]}class $c extends te{constructor(t){super(),ee(this,t,OS,CS,Wt,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function DS(n){let t;const e=n[16].default,i=Bi(e,n,n[24],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&16777216)&&zi(i,e,s,s[24],t?Wi(e,s[24],r,null):Ni(s[24]),null)},i(s){t||(U(i,s),t=!0)},o(s){J(i,s),t=!1},d(s){i&&i.d(s)}}}function ES(n){let t,e,i;function s(o){n[17](o)}let r={id:n[1],type:"circle",source:n[2],sourceLayer:n[3],beforeId:n[4],beforeLayerType:n[5],paint:n[6],layout:n[7],filter:n[8],applyToClusters:n[9],minzoom:n[10],maxzoom:n[11],hoverCursor:n[12],manageHoverState:n[13],eventsIfTopMost:n[14],interactive:n[15],$$slots:{default:[DS]},$$scope:{ctx:n}};return n[0]!==void 0&&(r.hovered=n[0]),t=new $c({props:r}),Yn.push(()=>xi(t,"hovered",s)),t.$on("click",n[18]),t.$on("dblclick",n[19]),t.$on("contextmenu",n[20]),t.$on("mouseenter",n[21]),t.$on("mousemove",n[22]),t.$on("mouseleave",n[23]),{c(){Ge(t.$$.fragment)},m(o,a){qe(t,o,a),i=!0},p(o,[a]){const l={};a&2&&(l.id=o[1]),a&4&&(l.source=o[2]),a&8&&(l.sourceLayer=o[3]),a&16&&(l.beforeId=o[4]),a&32&&(l.beforeLayerType=o[5]),a&64&&(l.paint=o[6]),a&128&&(l.layout=o[7]),a&256&&(l.filter=o[8]),a&512&&(l.applyToClusters=o[9]),a&1024&&(l.minzoom=o[10]),a&2048&&(l.maxzoom=o[11]),a&4096&&(l.hoverCursor=o[12]),a&8192&&(l.manageHoverState=o[13]),a&16384&&(l.eventsIfTopMost=o[14]),a&32768&&(l.interactive=o[15]),a&16777216&&(l.$$scope={dirty:a,ctx:o}),!e&&a&1&&(e=!0,l.hovered=o[0],wi(()=>e=!1)),t.$set(l)},i(o){i||(U(t.$$.fragment,o),i=!0)},o(o){J(t.$$.fragment,o),i=!1},d(o){Ke(t,o)}}}function LS(n,t,e){let{$$slots:i={},$$scope:s}=t,{id:r=lr("circle")}=t,{source:o=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:l=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:h}=t,{layout:u=void 0}=t,{filter:f=void 0}=t,{applyToClusters:d=void 0}=t,{minzoom:g=void 0}=t,{maxzoom:p=void 0}=t,{hoverCursor:y=void 0}=t,{manageHoverState:x=!1}=t,{hovered:m=null}=t,{eventsIfTopMost:v=!1}=t,{interactive:b=!0}=t;function _(A){m=A,e(0,m)}function w(A){At.call(this,n,A)}function M(A){At.call(this,n,A)}function S(A){At.call(this,n,A)}function P(A){At.call(this,n,A)}function C(A){At.call(this,n,A)}function k(A){At.call(this,n,A)}return n.$$set=A=>{"id"in A&&e(1,r=A.id),"source"in A&&e(2,o=A.source),"sourceLayer"in A&&e(3,a=A.sourceLayer),"beforeId"in A&&e(4,l=A.beforeId),"beforeLayerType"in A&&e(5,c=A.beforeLayerType),"paint"in A&&e(6,h=A.paint),"layout"in A&&e(7,u=A.layout),"filter"in A&&e(8,f=A.filter),"applyToClusters"in A&&e(9,d=A.applyToClusters),"minzoom"in A&&e(10,g=A.minzoom),"maxzoom"in A&&e(11,p=A.maxzoom),"hoverCursor"in A&&e(12,y=A.hoverCursor),"manageHoverState"in A&&e(13,x=A.manageHoverState),"hovered"in A&&e(0,m=A.hovered),"eventsIfTopMost"in A&&e(14,v=A.eventsIfTopMost),"interactive"in A&&e(15,b=A.interactive),"$$scope"in A&&e(24,s=A.$$scope)},[m,r,o,a,l,c,h,u,f,d,g,p,y,x,v,b,i,_,w,M,S,P,C,k,s]}class TS extends te{constructor(t){super(),ee(this,t,LS,ES,Wt,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function RS(n){let t;const e=n[15].default,i=Bi(e,n,n[23],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&8388608)&&zi(i,e,s,s[23],t?Wi(e,s[23],r,null):Ni(s[23]),null)},i(s){t||(U(i,s),t=!0)},o(s){J(i,s),t=!1},d(s){i&&i.d(s)}}}function IS(n){let t,e,i;function s(o){n[16](o)}let r={id:n[1],type:"fill",source:n[2],sourceLayer:n[3],beforeId:n[4],beforeLayerType:n[5],paint:n[6],layout:n[7],filter:n[8],minzoom:n[9],maxzoom:n[10],hoverCursor:n[11],manageHoverState:n[12],eventsIfTopMost:n[13],interactive:n[14],$$slots:{default:[RS]},$$scope:{ctx:n}};return n[0]!==void 0&&(r.hovered=n[0]),t=new $c({props:r}),Yn.push(()=>xi(t,"hovered",s)),t.$on("click",n[17]),t.$on("dblclick",n[18]),t.$on("contextmenu",n[19]),t.$on("mouseenter",n[20]),t.$on("mousemove",n[21]),t.$on("mouseleave",n[22]),{c(){Ge(t.$$.fragment)},m(o,a){qe(t,o,a),i=!0},p(o,[a]){const l={};a&2&&(l.id=o[1]),a&4&&(l.source=o[2]),a&8&&(l.sourceLayer=o[3]),a&16&&(l.beforeId=o[4]),a&32&&(l.beforeLayerType=o[5]),a&64&&(l.paint=o[6]),a&128&&(l.layout=o[7]),a&256&&(l.filter=o[8]),a&512&&(l.minzoom=o[9]),a&1024&&(l.maxzoom=o[10]),a&2048&&(l.hoverCursor=o[11]),a&4096&&(l.manageHoverState=o[12]),a&8192&&(l.eventsIfTopMost=o[13]),a&16384&&(l.interactive=o[14]),a&8388608&&(l.$$scope={dirty:a,ctx:o}),!e&&a&1&&(e=!0,l.hovered=o[0],wi(()=>e=!1)),t.$set(l)},i(o){i||(U(t.$$.fragment,o),i=!0)},o(o){J(t.$$.fragment,o),i=!1},d(o){Ke(t,o)}}}function FS(n,t,e){let{$$slots:i={},$$scope:s}=t,{id:r=lr("fill")}=t,{source:o=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:l=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:h}=t,{layout:u=void 0}=t,{filter:f=void 0}=t,{minzoom:d=void 0}=t,{maxzoom:g=void 0}=t,{hoverCursor:p=void 0}=t,{manageHoverState:y=!1}=t,{hovered:x=null}=t,{eventsIfTopMost:m=!1}=t,{interactive:v=!0}=t;function b(k){x=k,e(0,x)}function _(k){At.call(this,n,k)}function w(k){At.call(this,n,k)}function M(k){At.call(this,n,k)}function S(k){At.call(this,n,k)}function P(k){At.call(this,n,k)}function C(k){At.call(this,n,k)}return n.$$set=k=>{"id"in k&&e(1,r=k.id),"source"in k&&e(2,o=k.source),"sourceLayer"in k&&e(3,a=k.sourceLayer),"beforeId"in k&&e(4,l=k.beforeId),"beforeLayerType"in k&&e(5,c=k.beforeLayerType),"paint"in k&&e(6,h=k.paint),"layout"in k&&e(7,u=k.layout),"filter"in k&&e(8,f=k.filter),"minzoom"in k&&e(9,d=k.minzoom),"maxzoom"in k&&e(10,g=k.maxzoom),"hoverCursor"in k&&e(11,p=k.hoverCursor),"manageHoverState"in k&&e(12,y=k.manageHoverState),"hovered"in k&&e(0,x=k.hovered),"eventsIfTopMost"in k&&e(13,m=k.eventsIfTopMost),"interactive"in k&&e(14,v=k.interactive),"$$scope"in k&&e(23,s=k.$$scope)},[x,r,o,a,l,c,h,u,f,d,g,p,y,m,v,i,b,_,w,M,S,P,C,s]}class BS extends te{constructor(t){super(),ee(this,t,FS,IS,Wt,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function zS(n,t,e,i,s){let r=!1;n.getSource(t)&&(r=!0,n.removeSource(t));const o=()=>{i(t)&&(n.addSource(t,e),s())};if(r){const a=()=>{t&&(n.getSource(t)?setTimeout(a,1):o())};a()}else o()}function NS(n,t,e){up().then(()=>{let i=fp(n);if(!i)return;i.getSource(t)===e&&i.removeSource(t)})}function yf(n){let t=n[0],e,i,s=_f(n);return{c(){s.c(),e=_n()},m(r,o){s.m(r,o),N(r,e,o),i=!0},p(r,o){o&1&&Wt(t,t=r[0])?(vn(),J(s,1,1,wt),xn(),s=_f(r),s.c(),U(s,1),s.m(e.parentNode,e)):s.p(r,o)},i(r){i||(U(s),i=!0)},o(r){J(s),i=!1},d(r){r&&W(e),s.d(r)}}}function _f(n){let t;const e=n[15].default,i=Bi(e,n,n[14],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&16384)&&zi(i,e,s,s[14],t?Wi(e,s[14],r,null):Ni(s[14]),null)},i(s){t||(U(i,s),t=!0)},o(s){J(i,s),t=!1},d(s){i&&i.d(s)}}}function WS(n){let t,e,i=n[0]&&yf(n);return{c(){i&&i.c(),t=_n()},m(s,r){i&&i.m(s,r),N(s,t,r),e=!0},p(s,[r]){s[0]?i?(i.p(s,r),r&1&&U(i,1)):(i=yf(s),i.c(),U(i,1),i.m(t.parentNode,t)):i&&(vn(),J(i,1,1,()=>{i=null}),xn())},i(s){e||(U(i),e=!0)},o(s){J(i),e=!1},d(s){s&&W(t),i&&i.d(s)}}}function VS(n,t,e){let i,s,r,{$$slots:o={},$$scope:a}=t,{id:l=lr("geojson")}=t,{data:c}=t,{generateId:h=!1}=t,{promoteId:u=void 0}=t,{filter:f=void 0}=t,{lineMetrics:d=void 0}=t,{cluster:g=void 0}=t;const{map:p,cluster:y,self:x}=MS();Zt(n,p,b=>e(13,s=b)),Zt(n,y,b=>e(16,r=b)),Zt(n,x,b=>e(0,i=b));let m,v=!0;return bo(()=>{i&&m&&s&&(NS(p,i,m),$n(x,i=null,i),e(11,m=void 0))}),n.$$set=b=>{"id"in b&&e(4,l=b.id),"data"in b&&e(5,c=b.data),"generateId"in b&&e(6,h=b.generateId),"promoteId"in b&&e(7,u=b.promoteId),"filter"in b&&e(8,f=b.filter),"lineMetrics"in b&&e(9,d=b.lineMetrics),"cluster"in b&&e(10,g=b.cluster),"$$scope"in b&&e(14,a=b.$$scope)},n.$$.update=()=>{n.$$.dirty&1024&&$n(y,r=g,r),n.$$.dirty&12273&&s&&i!==l&&($n(x,i=l,i),zS(s,i,Ys({type:"geojson",data:c,filter:f,lineMetrics:d,generateId:h,promoteId:u,cluster:!!g,clusterMinPoints:g==null?void 0:g.minPoints,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius,clusterProperties:g==null?void 0:g.properties}),b=>s&&b===i,()=>{i&&(e(11,m=s==null?void 0:s.getSource(i)),e(12,v=!0))})),n.$$.dirty&8208&&(s==null||s.on("style.load",()=>{e(11,m=s==null?void 0:s.getSource(l))})),n.$$.dirty&6176&&m&&(v?e(12,v=!1):m.setData(c)),n.$$.dirty&3072&&(m==null||m.setClusterOptions(Ys({cluster:!!g,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius})))},[i,p,y,x,l,c,h,u,f,d,g,m,v,s,a,o]}class jS extends te{constructor(t){super(),ee(this,t,VS,WS,Wt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function HS(n){let t;const e=n[15].default,i=Bi(e,n,n[23],null);return{c(){i&&i.c()},m(s,r){i&&i.m(s,r),t=!0},p(s,r){i&&i.p&&(!t||r&8388608)&&zi(i,e,s,s[23],t?Wi(e,s[23],r,null):Ni(s[23]),null)},i(s){t||(U(i,s),t=!0)},o(s){J(i,s),t=!1},d(s){i&&i.d(s)}}}function $S(n){let t,e,i;function s(o){n[16](o)}let r={id:n[1],type:"line",source:n[2],sourceLayer:n[3],beforeId:n[4],beforeLayerType:n[5],paint:n[6],layout:n[7],filter:n[8],minzoom:n[9],maxzoom:n[10],hoverCursor:n[11],manageHoverState:n[12],eventsIfTopMost:n[13],interactive:n[14],$$slots:{default:[HS]},$$scope:{ctx:n}};return n[0]!==void 0&&(r.hovered=n[0]),t=new $c({props:r}),Yn.push(()=>xi(t,"hovered",s)),t.$on("click",n[17]),t.$on("dblclick",n[18]),t.$on("contextmenu",n[19]),t.$on("mouseenter",n[20]),t.$on("mousemove",n[21]),t.$on("mouseleave",n[22]),{c(){Ge(t.$$.fragment)},m(o,a){qe(t,o,a),i=!0},p(o,[a]){const l={};a&2&&(l.id=o[1]),a&4&&(l.source=o[2]),a&8&&(l.sourceLayer=o[3]),a&16&&(l.beforeId=o[4]),a&32&&(l.beforeLayerType=o[5]),a&64&&(l.paint=o[6]),a&128&&(l.layout=o[7]),a&256&&(l.filter=o[8]),a&512&&(l.minzoom=o[9]),a&1024&&(l.maxzoom=o[10]),a&2048&&(l.hoverCursor=o[11]),a&4096&&(l.manageHoverState=o[12]),a&8192&&(l.eventsIfTopMost=o[13]),a&16384&&(l.interactive=o[14]),a&8388608&&(l.$$scope={dirty:a,ctx:o}),!e&&a&1&&(e=!0,l.hovered=o[0],wi(()=>e=!1)),t.$set(l)},i(o){i||(U(t.$$.fragment,o),i=!0)},o(o){J(t.$$.fragment,o),i=!1},d(o){Ke(t,o)}}}function YS(n,t,e){let{$$slots:i={},$$scope:s}=t,{id:r=lr("line")}=t,{source:o=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:l=void 0}=t,{beforeLayerType:c=void 0}=t,{paint:h}=t,{layout:u=void 0}=t,{filter:f=void 0}=t,{minzoom:d=void 0}=t,{maxzoom:g=void 0}=t,{hoverCursor:p=void 0}=t,{manageHoverState:y=!1}=t,{hovered:x=null}=t,{eventsIfTopMost:m=!1}=t,{interactive:v=!0}=t;function b(k){x=k,e(0,x)}function _(k){At.call(this,n,k)}function w(k){At.call(this,n,k)}function M(k){At.call(this,n,k)}function S(k){At.call(this,n,k)}function P(k){At.call(this,n,k)}function C(k){At.call(this,n,k)}return n.$$set=k=>{"id"in k&&e(1,r=k.id),"source"in k&&e(2,o=k.source),"sourceLayer"in k&&e(3,a=k.sourceLayer),"beforeId"in k&&e(4,l=k.beforeId),"beforeLayerType"in k&&e(5,c=k.beforeLayerType),"paint"in k&&e(6,h=k.paint),"layout"in k&&e(7,u=k.layout),"filter"in k&&e(8,f=k.filter),"minzoom"in k&&e(9,d=k.minzoom),"maxzoom"in k&&e(10,g=k.maxzoom),"hoverCursor"in k&&e(11,p=k.hoverCursor),"manageHoverState"in k&&e(12,y=k.manageHoverState),"hovered"in k&&e(0,x=k.hovered),"eventsIfTopMost"in k&&e(13,m=k.eventsIfTopMost),"interactive"in k&&e(14,v=k.interactive),"$$scope"in k&&e(23,s=k.$$scope)},[x,r,o,a,l,c,h,u,f,d,g,p,y,m,v,i,b,_,w,M,S,P,C,s]}class US extends te{constructor(t){super(),ee(this,t,YS,$S,Wt,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function XS(n){let t,e,i,s,r,o;return t=new BS({props:{id:"edit-polygon-fill",filter:fS,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),i=new US({props:{id:"edit-polygon-lines",filter:dS,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),r=new TS({props:{id:"edit-polygon-vertices",filter:gS,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){Ge(t.$$.fragment),e=pt(),Ge(i.$$.fragment),s=pt(),Ge(r.$$.fragment)},m(a,l){qe(t,a,l),N(a,e,l),qe(i,a,l),N(a,s,l),qe(r,a,l),o=!0},p:wt,i(a){o||(U(t.$$.fragment,a),U(i.$$.fragment,a),U(r.$$.fragment,a),o=!0)},o(a){J(t.$$.fragment,a),J(i.$$.fragment,a),J(r.$$.fragment,a),o=!1},d(a){a&&(W(e),W(s)),Ke(t,a),Ke(i,a),Ke(r,a)}}}function GS(n){let t,e;return t=new jS({props:{data:n[0],$$slots:{default:[XS]},$$scope:{ctx:n}}}),{c(){Ge(t.$$.fragment)},m(i,s){qe(t,i,s),e=!0},p(i,[s]){const r={};s&1&&(r.data=i[0]),s&2&&(r.$$scope={dirty:s,ctx:i}),t.$set(r)},i(i){e||(U(t.$$.fragment,i),e=!0)},o(i){J(t.$$.fragment,i),e=!1},d(i){Ke(t,i)}}}function qS(n,t,e){let i;return Zt(n,zm,s=>e(0,i=s)),[i]}class cR extends te{constructor(t){super(),ee(this,t,qS,GS,Wt,{})}}let j;const He=new Array(128).fill(void 0);He.push(void 0,null,!0,!1);function F(n){return He[n]}let Gn=0,_s=null;function Is(){return(_s===null||_s.byteLength===0)&&(_s=new Uint8Array(j.memory.buffer)),_s}const ho=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},KS=typeof ho.encodeInto=="function"?function(n,t){return ho.encodeInto(n,t)}:function(n,t){const e=ho.encode(n);return t.set(e),{read:n.length,written:e.length}};function Ya(n,t,e){if(e===void 0){const a=ho.encode(n),l=t(a.length,1)>>>0;return Is().subarray(l,l+a.length).set(a),Gn=a.length,l}let i=n.length,s=t(i,1)>>>0;const r=Is();let o=0;for(;o127)break;r[s+o]=a}if(o!==i){o!==0&&(n=n.slice(o)),s=e(s,i,i=o+n.length*3,1)>>>0;const a=Is().subarray(s+o,s+i),l=KS(n,a);o+=l.written,s=e(s,i,o,1)>>>0}return Gn=o,s}function qi(n){return n==null}let vs=null;function ft(){return(vs===null||vs.byteLength===0)&&(vs=new Int32Array(j.memory.buffer)),vs}let Fs=He.length;function JS(n){n<132||(He[n]=Fs,Fs=n)}function an(n){const t=F(n);return JS(n),t}const jm=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&jm.decode();function Vn(n,t){return n=n>>>0,jm.decode(Is().subarray(n,n+t))}function Q(n){Fs===He.length&&He.push(He.length+1);const t=Fs;return Fs=He[t],He[t]=n,t}let xs=null;function Hm(){return(xs===null||xs.byteLength===0)&&(xs=new Float64Array(j.memory.buffer)),xs}let ws=null;function ZS(){return(ws===null||ws.byteLength===0)&&(ws=new BigInt64Array(j.memory.buffer)),ws}function Vl(n){const t=typeof n;if(t=="number"||t=="boolean"||n==null)return`${n}`;if(t=="string")return`"${n}"`;if(t=="symbol"){const s=n.description;return s==null?"Symbol":`Symbol(${s})`}if(t=="function"){const s=n.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(n)){const s=n.length;let r="[";s>0&&(r+=Vl(n[0]));for(let o=1;o1)i=e[1];else return toString.call(n);if(i=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message} +${n.stack}`:i}function QS(n,t){const e=t(n.length*1,1)>>>0;return Is().set(n,e/1),Gn=n.length,e}function tM(n,t){return n=n>>>0,Hm().subarray(n/8,n/8+t)}function On(n,t){try{return n.apply(this,t)}catch(e){j.__wbindgen_exn_store(Q(e))}}const eM=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>j.__wbg_jsnetwork_free(n>>>0));class hR{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,eM.unregister(this),t}free(){const t=this.__destroy_into_raw();j.__wbg_jsnetwork_free(t)}constructor(t){try{const r=j.__wbindgen_add_to_stack_pointer(-16),o=QS(t,j.__wbindgen_malloc),a=Gn;j.jsnetwork_new(r,o,a);var e=ft()[r/4+0],i=ft()[r/4+1],s=ft()[r/4+2];if(s)throw an(i);return this.__wbg_ptr=e>>>0,this}finally{j.__wbindgen_add_to_stack_pointer(16)}}recalculate(t){let e,i;try{const h=j.__wbindgen_add_to_stack_pointer(-16);j.jsnetwork_recalculate(h,this.__wbg_ptr,Q(t));var s=ft()[h/4+0],r=ft()[h/4+1],o=ft()[h/4+2],a=ft()[h/4+3],l=s,c=r;if(a)throw l=0,c=0,an(o);return e=l,i=c,Vn(l,c)}finally{j.__wbindgen_add_to_stack_pointer(16),j.__wbindgen_free(e,i,1)}}updateCostFunction(t){try{const s=j.__wbindgen_add_to_stack_pointer(-16);j.jsnetwork_updateCostFunction(s,this.__wbg_ptr,Q(t));var e=ft()[s/4+0],i=ft()[s/4+1];if(i)throw an(e)}finally{j.__wbindgen_add_to_stack_pointer(16)}}getBounds(){try{const s=j.__wbindgen_add_to_stack_pointer(-16);j.jsnetwork_getBounds(s,this.__wbg_ptr);var t=ft()[s/4+0],e=ft()[s/4+1],i=tM(t,e).slice();return j.__wbindgen_free(t,e*8,8),i}finally{j.__wbindgen_add_to_stack_pointer(16)}}debugNetwork(){let t,e;try{const c=j.__wbindgen_add_to_stack_pointer(-16);j.jsnetwork_debugNetwork(c,this.__wbg_ptr);var i=ft()[c/4+0],s=ft()[c/4+1],r=ft()[c/4+2],o=ft()[c/4+3],a=i,l=s;if(o)throw a=0,l=0,an(r);return t=a,e=l,Vn(a,l)}finally{j.__wbindgen_add_to_stack_pointer(16),j.__wbindgen_free(t,e,1)}}}async function nM(n,t){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,t)}catch(i){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}function iM(){const n={};return n.wbg={},n.wbg.__wbindgen_string_get=function(t,e){const i=F(e),s=typeof i=="string"?i:void 0;var r=qi(s)?0:Ya(s,j.__wbindgen_malloc,j.__wbindgen_realloc),o=Gn;ft()[t/4+1]=o,ft()[t/4+0]=r},n.wbg.__wbindgen_object_drop_ref=function(t){an(t)},n.wbg.__wbindgen_string_new=function(t,e){const i=Vn(t,e);return Q(i)},n.wbg.__wbindgen_is_bigint=function(t){return typeof F(t)=="bigint"},n.wbg.__wbindgen_bigint_from_u64=function(t){const e=BigInt.asUintN(64,t);return Q(e)},n.wbg.__wbindgen_jsval_eq=function(t,e){return F(t)===F(e)},n.wbg.__wbindgen_error_new=function(t,e){const i=new Error(Vn(t,e));return Q(i)},n.wbg.__wbindgen_number_get=function(t,e){const i=F(e),s=typeof i=="number"?i:void 0;Hm()[t/8+1]=qi(s)?0:s,ft()[t/4+0]=!qi(s)},n.wbg.__wbindgen_is_string=function(t){return typeof F(t)=="string"},n.wbg.__wbindgen_is_object=function(t){const e=F(t);return typeof e=="object"&&e!==null},n.wbg.__wbindgen_is_undefined=function(t){return F(t)===void 0},n.wbg.__wbindgen_in=function(t,e){return F(t)in F(e)},n.wbg.__wbindgen_jsval_loose_eq=function(t,e){return F(t)==F(e)},n.wbg.__wbindgen_boolean_get=function(t){const e=F(t);return typeof e=="boolean"?e?1:0:2},n.wbg.__wbindgen_as_number=function(t){return+F(t)},n.wbg.__wbindgen_number_new=function(t){return Q(t)},n.wbg.__wbindgen_object_clone_ref=function(t){const e=F(t);return Q(e)},n.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(t,e){const i=F(t)[F(e)];return Q(i)},n.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Q(t)},n.wbg.__wbg_stack_658279fe44541cf6=function(t,e){const i=F(e).stack,s=Ya(i,j.__wbindgen_malloc,j.__wbindgen_realloc),r=Gn;ft()[t/4+1]=r,ft()[t/4+0]=s},n.wbg.__wbg_error_f851667af71bcfc6=function(t,e){let i,s;try{i=t,s=e,console.error(Vn(t,e))}finally{j.__wbindgen_free(i,s,1)}},n.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(t,e){const i=F(t)[F(e)];return Q(i)},n.wbg.__wbg_set_841ac57cff3d672b=function(t,e,i){F(t)[an(e)]=an(i)},n.wbg.__wbg_debug_5fb96680aecf5dc8=function(t){console.debug(F(t))},n.wbg.__wbg_error_8e3928cfb8a43e2b=function(t){console.error(F(t))},n.wbg.__wbg_info_530a29cb2e4e3304=function(t){console.info(F(t))},n.wbg.__wbg_log_5bb5f88f245d7762=function(t){console.log(F(t))},n.wbg.__wbg_warn_63bbae1730aead09=function(t){console.warn(F(t))},n.wbg.__wbg_now_4e659b3d15f470d9=function(t){return F(t).now()},n.wbg.__wbg_get_bd8e338fbd5f5cc8=function(t,e){const i=F(t)[e>>>0];return Q(i)},n.wbg.__wbg_length_cd7af8117672b8b8=function(t){return F(t).length},n.wbg.__wbg_new_16b304a2cfa7ff4a=function(){const t=new Array;return Q(t)},n.wbg.__wbindgen_is_function=function(t){return typeof F(t)=="function"},n.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(t,e){const i=new Function(Vn(t,e));return Q(i)},n.wbg.__wbg_next_40fc327bfc8770e6=function(t){const e=F(t).next;return Q(e)},n.wbg.__wbg_next_196c84450b364254=function(){return On(function(t){const e=F(t).next();return Q(e)},arguments)},n.wbg.__wbg_done_298b57d23c0fc80c=function(t){return F(t).done},n.wbg.__wbg_value_d93c65011f51a456=function(t){const e=F(t).value;return Q(e)},n.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return Q(Symbol.iterator)},n.wbg.__wbg_get_e3c254076557e348=function(){return On(function(t,e){const i=Reflect.get(F(t),F(e));return Q(i)},arguments)},n.wbg.__wbg_call_27c0f87801dedf93=function(){return On(function(t,e){const i=F(t).call(F(e));return Q(i)},arguments)},n.wbg.__wbg_new_72fb9a18b5ae2624=function(){const t=new Object;return Q(t)},n.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return On(function(){const t=self.self;return Q(t)},arguments)},n.wbg.__wbg_window_c6fb939a7f436783=function(){return On(function(){const t=window.window;return Q(t)},arguments)},n.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return On(function(){const t=globalThis.globalThis;return Q(t)},arguments)},n.wbg.__wbg_global_207b558942527489=function(){return On(function(){const t=global.global;return Q(t)},arguments)},n.wbg.__wbg_set_d4638f722068f043=function(t,e,i){F(t)[e>>>0]=an(i)},n.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(t){let e;try{e=F(t)instanceof ArrayBuffer}catch{e=!1}return e},n.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(t){return Number.isSafeInteger(F(t))},n.wbg.__wbg_entries_95cc2c823b285a09=function(t){const e=Object.entries(F(t));return Q(e)},n.wbg.__wbg_buffer_12d079cc21e14bdb=function(t){const e=F(t).buffer;return Q(e)},n.wbg.__wbg_new_63b92bc8671ed464=function(t){const e=new Uint8Array(F(t));return Q(e)},n.wbg.__wbg_set_a47bac70306a19a7=function(t,e,i){F(t).set(F(e),i>>>0)},n.wbg.__wbg_length_c20a40f15020d68a=function(t){return F(t).length},n.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(t){let e;try{e=F(t)instanceof Uint8Array}catch{e=!1}return e},n.wbg.__wbindgen_bigint_get_as_i64=function(t,e){const i=F(e),s=typeof i=="bigint"?i:void 0;ZS()[t/8+1]=qi(s)?BigInt(0):s,ft()[t/4+0]=!qi(s)},n.wbg.__wbindgen_debug_string=function(t,e){const i=Vl(F(e)),s=Ya(i,j.__wbindgen_malloc,j.__wbindgen_realloc),r=Gn;ft()[t/4+1]=r,ft()[t/4+0]=s},n.wbg.__wbindgen_throw=function(t,e){throw new Error(Vn(t,e))},n.wbg.__wbindgen_memory=function(){const t=j.memory;return Q(t)},n}function sM(n,t){return j=n.exports,rM.__wbindgen_wasm_module=t,ws=null,xs=null,vs=null,_s=null,j}async function rM(n){if(j!==void 0)return j;typeof n>"u"&&(n="/od2net/assets/wasm_od2net_bg.wasm");const t=iM();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));const{instance:e,module:i}=await nM(await n,t);return sM(e,i)}function oM(n){let t,e,i,s,r,o,a,l,c,h,u,f;return{c(){t=z("div"),e=z("label"),i=Bt(`Or load an example: + `),s=z("select"),r=z("option"),r.textContent="Custom file loaded",o=z("option"),o.textContent="Antwerp",a=z("option"),a.textContent="Berlin",l=z("option"),l.textContent="South London",c=z("option"),c.textContent="Paris",h=z("option"),h.textContent="Seattle",r.__value="",Ct(r,r.__value),o.__value="antwerp",Ct(o,o.__value),a.__value="berlin",Ct(a,a.__value),l.__value="london",Ct(l,l.__value),c.__value="paris",Ct(c,c.__value),h.__value="seattle",Ct(h,h.__value),n[0]===void 0&&gp(()=>n[1].call(s))},m(d,g){N(d,t,g),B(t,e),B(e,i),B(e,s),B(s,r),B(s,o),B(s,a),B(s,l),B(s,c),B(s,h),yo(s,n[0],!0),u||(f=kt(s,"change",n[1]),u=!0)},p(d,[g]){g&1&&yo(s,d[0])},i:wt,o:wt,d(d){d&&W(t),u=!1,f()}}}function aM(n,t,e){let{example:i}=t;function s(){i=pp(this),e(0,i)}return n.$$set=r=>{"example"in r&&e(0,i=r.example)},[i,s]}class uR extends te{constructor(t){super(),ee(this,t,aM,oM,Wt,{example:0})}}/*! * @kurkle/color v0.3.2 * https://github.com/kurkle/color#readme * (c) 2023 Jukka Kurkela * Released under the MIT License - */function cr(n){return n+.5|0}const cn=(n,t,e)=>Math.max(Math.min(n,e),t);function Ss(n){return cn(cr(n*2.55),0,255)}function gn(n){return cn(cr(n*255),0,255)}function We(n){return cn(cr(n/2.55)/100,0,1)}function vf(n){return cn(cr(n*100),0,100)}const ne={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},jl=[..."0123456789ABCDEF"],fM=n=>jl[n&15],dM=n=>jl[(n&240)>>4]+jl[n&15],xr=n=>(n&240)>>4===(n&15),gM=n=>xr(n.r)&&xr(n.g)&&xr(n.b)&&xr(n.a);function pM(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&ne[n[1]]*17,g:255&ne[n[2]]*17,b:255&ne[n[3]]*17,a:t===5?ne[n[4]]*17:255}:(t===7||t===9)&&(e={r:ne[n[1]]<<4|ne[n[2]],g:ne[n[3]]<<4|ne[n[4]],b:ne[n[5]]<<4|ne[n[6]],a:t===9?ne[n[7]]<<4|ne[n[8]]:255})),e}const mM=(n,t)=>n<255?t(n):"";function bM(n){var t=gM(n)?fM:dM;return n?"#"+t(n.r)+t(n.g)+t(n.b)+mM(n.a,t):void 0}const yM=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function $m(n,t,e){const i=t*Math.min(e,1-e),s=(r,o=(r+n/30)%12)=>e-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function _M(n,t,e){const i=(s,r=(s+n/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function vM(n,t,e){const i=$m(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function xM(n,t,e,i,s){return n===s?(t-e)/i+(t.5?h/(2-r-o):h/(r+o),l=xM(e,i,s,h,r),l=l*60+.5),[l|0,c||0,a]}function Uc(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(gn)}function Xc(n,t,e){return Uc($m,n,t,e)}function wM(n,t,e){return Uc(vM,n,t,e)}function SM(n,t,e){return Uc(_M,n,t,e)}function Ym(n){return(n%360+360)%360}function MM(n){const t=yM.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Ss(+t[5]):gn(+t[5]));const s=Ym(+t[2]),r=+t[3]/100,o=+t[4]/100;return t[1]==="hwb"?i=wM(s,r,o):t[1]==="hsv"?i=SM(s,r,o):i=Xc(s,r,o),{r:i[0],g:i[1],b:i[2],a:e}}function kM(n,t){var e=Yc(n);e[0]=Ym(e[0]+t),e=Xc(e),n.r=e[0],n.g=e[1],n.b=e[2]}function PM(n){if(!n)return;const t=Yc(n),e=t[0],i=vf(t[1]),s=vf(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${We(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const xf={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},wf={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function AM(){const n={},t=Object.keys(wf),e=Object.keys(xf);let i,s,r,o,a;for(i=0;i>16&255,r>>8&255,r&255]}return n}let wr;function CM(n){wr||(wr=AM(),wr.transparent=[0,0,0,0]);const t=wr[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const OM=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function DM(n){const t=OM.exec(n);let e=255,i,s,r;if(t){if(t[7]!==i){const o=+t[7];e=t[8]?Ss(o):cn(o*255,0,255)}return i=+t[1],s=+t[3],r=+t[5],i=255&(t[2]?Ss(i):cn(i,0,255)),s=255&(t[4]?Ss(s):cn(s,0,255)),r=255&(t[6]?Ss(r):cn(r,0,255)),{r:i,g:s,b:r,a:e}}}function EM(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${We(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const Ua=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,ci=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function LM(n,t,e){const i=ci(We(n.r)),s=ci(We(n.g)),r=ci(We(n.b));return{r:gn(Ua(i+e*(ci(We(t.r))-i))),g:gn(Ua(s+e*(ci(We(t.g))-s))),b:gn(Ua(r+e*(ci(We(t.b))-r))),a:n.a+e*(t.a-n.a)}}function Sr(n,t,e){if(n){let i=Yc(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=Xc(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Um(n,t){return n&&Object.assign(t||{},n)}function Sf(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=gn(n[3]))):(t=Um(n,{r:0,g:0,b:0,a:1}),t.a=gn(t.a)),t}function TM(n){return n.charAt(0)==="r"?DM(n):MM(n)}let Xm=class Hl{constructor(t){if(t instanceof Hl)return t;const e=typeof t;let i;e==="object"?i=Sf(t):e==="string"&&(i=pM(t)||CM(t)||TM(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Um(this._rgb);return t&&(t.a=We(t.a)),t}set rgb(t){this._rgb=Sf(t)}rgbString(){return this._valid?EM(this._rgb):void 0}hexString(){return this._valid?bM(this._rgb):void 0}hslString(){return this._valid?PM(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let r;const o=e===r?.5:e,a=2*o-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;r=1-c,i.r=255&c*i.r+r*s.r+.5,i.g=255&c*i.g+r*s.g+.5,i.b=255&c*i.b+r*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=LM(this._rgb,t._rgb,e)),this}clone(){return new Hl(this.rgb)}alpha(t){return this._rgb.a=gn(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=cr(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Sr(this._rgb,2,t),this}darken(t){return Sr(this._rgb,2,-t),this}saturate(t){return Sr(this._rgb,1,t),this}desaturate(t){return Sr(this._rgb,1,-t),this}rotate(t){return kM(this._rgb,t),this}};/*! + */function cr(n){return n+.5|0}const ln=(n,t,e)=>Math.max(Math.min(n,e),t);function Ss(n){return ln(cr(n*2.55),0,255)}function dn(n){return ln(cr(n*255),0,255)}function We(n){return ln(cr(n/2.55)/100,0,1)}function vf(n){return ln(cr(n*100),0,100)}const ne={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},jl=[..."0123456789ABCDEF"],lM=n=>jl[n&15],cM=n=>jl[(n&240)>>4]+jl[n&15],xr=n=>(n&240)>>4===(n&15),hM=n=>xr(n.r)&&xr(n.g)&&xr(n.b)&&xr(n.a);function uM(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&ne[n[1]]*17,g:255&ne[n[2]]*17,b:255&ne[n[3]]*17,a:t===5?ne[n[4]]*17:255}:(t===7||t===9)&&(e={r:ne[n[1]]<<4|ne[n[2]],g:ne[n[3]]<<4|ne[n[4]],b:ne[n[5]]<<4|ne[n[6]],a:t===9?ne[n[7]]<<4|ne[n[8]]:255})),e}const fM=(n,t)=>n<255?t(n):"";function dM(n){var t=hM(n)?lM:cM;return n?"#"+t(n.r)+t(n.g)+t(n.b)+fM(n.a,t):void 0}const gM=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function $m(n,t,e){const i=t*Math.min(e,1-e),s=(r,o=(r+n/30)%12)=>e-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function pM(n,t,e){const i=(s,r=(s+n/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function mM(n,t,e){const i=$m(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function bM(n,t,e,i,s){return n===s?(t-e)/i+(t.5?h/(2-r-o):h/(r+o),l=bM(e,i,s,h,r),l=l*60+.5),[l|0,c||0,a]}function Uc(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(dn)}function Xc(n,t,e){return Uc($m,n,t,e)}function yM(n,t,e){return Uc(mM,n,t,e)}function _M(n,t,e){return Uc(pM,n,t,e)}function Ym(n){return(n%360+360)%360}function vM(n){const t=gM.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Ss(+t[5]):dn(+t[5]));const s=Ym(+t[2]),r=+t[3]/100,o=+t[4]/100;return t[1]==="hwb"?i=yM(s,r,o):t[1]==="hsv"?i=_M(s,r,o):i=Xc(s,r,o),{r:i[0],g:i[1],b:i[2],a:e}}function xM(n,t){var e=Yc(n);e[0]=Ym(e[0]+t),e=Xc(e),n.r=e[0],n.g=e[1],n.b=e[2]}function wM(n){if(!n)return;const t=Yc(n),e=t[0],i=vf(t[1]),s=vf(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${We(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const xf={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},wf={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function SM(){const n={},t=Object.keys(wf),e=Object.keys(xf);let i,s,r,o,a;for(i=0;i>16&255,r>>8&255,r&255]}return n}let wr;function MM(n){wr||(wr=SM(),wr.transparent=[0,0,0,0]);const t=wr[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const kM=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function PM(n){const t=kM.exec(n);let e=255,i,s,r;if(t){if(t[7]!==i){const o=+t[7];e=t[8]?Ss(o):ln(o*255,0,255)}return i=+t[1],s=+t[3],r=+t[5],i=255&(t[2]?Ss(i):ln(i,0,255)),s=255&(t[4]?Ss(s):ln(s,0,255)),r=255&(t[6]?Ss(r):ln(r,0,255)),{r:i,g:s,b:r,a:e}}}function AM(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${We(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const Ua=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,ci=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function CM(n,t,e){const i=ci(We(n.r)),s=ci(We(n.g)),r=ci(We(n.b));return{r:dn(Ua(i+e*(ci(We(t.r))-i))),g:dn(Ua(s+e*(ci(We(t.g))-s))),b:dn(Ua(r+e*(ci(We(t.b))-r))),a:n.a+e*(t.a-n.a)}}function Sr(n,t,e){if(n){let i=Yc(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=Xc(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Um(n,t){return n&&Object.assign(t||{},n)}function Sf(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=dn(n[3]))):(t=Um(n,{r:0,g:0,b:0,a:1}),t.a=dn(t.a)),t}function OM(n){return n.charAt(0)==="r"?PM(n):vM(n)}let Xm=class Hl{constructor(t){if(t instanceof Hl)return t;const e=typeof t;let i;e==="object"?i=Sf(t):e==="string"&&(i=uM(t)||MM(t)||OM(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Um(this._rgb);return t&&(t.a=We(t.a)),t}set rgb(t){this._rgb=Sf(t)}rgbString(){return this._valid?AM(this._rgb):void 0}hexString(){return this._valid?dM(this._rgb):void 0}hslString(){return this._valid?wM(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let r;const o=e===r?.5:e,a=2*o-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;r=1-c,i.r=255&c*i.r+r*s.r+.5,i.g=255&c*i.g+r*s.g+.5,i.b=255&c*i.b+r*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=CM(this._rgb,t._rgb,e)),this}clone(){return new Hl(this.rgb)}alpha(t){return this._rgb.a=dn(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=cr(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Sr(this._rgb,2,t),this}darken(t){return Sr(this._rgb,2,-t),this}saturate(t){return Sr(this._rgb,1,t),this}desaturate(t){return Sr(this._rgb,1,-t),this}rotate(t){return xM(this._rgb,t),this}};/*! * Chart.js v4.4.2 * https://www.chartjs.org * (c) 2024 Chart.js Contributors * Released under the MIT License - */function Re(){}const RM=(()=>{let n=0;return()=>n++})();function q(n){return n===null||typeof n>"u"}function at(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function $(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function pt(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function Kt(n,t){return pt(n)?n:t}function V(n,t){return typeof n>"u"?t:n}const IM=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,Gm=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function ot(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function tt(n,t,e,i){let s,r,o;if(at(n))if(r=n.length,i)for(s=r-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function zM(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function NM(n){const t=zM(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function mn(n,t){return(Mf[t]||(Mf[t]=NM(t)))(n)}function Gc(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Ks=n=>typeof n<"u",bn=n=>typeof n=="function",kf=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function WM(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const ct=Math.PI,lt=2*ct,VM=lt+ct,zo=Number.POSITIVE_INFINITY,jM=ct/180,xt=ct/2,Dn=ct/4,Pf=ct*2/3,hn=Math.log10,Ae=Math.sign;function zs(n,t,e){return Math.abs(n-t)s-r).pop(),t}function Ei(n){return!isNaN(parseFloat(n))&&isFinite(n)}function $M(n,t){const e=Math.round(n);return e-t<=n&&e+t>=n}function Km(n,t,e){let i,s,r;for(i=0,s=n.length;il&&c=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function Kc(n,t,e){e=e||(o=>n[o]1;)r=s+i>>1,e(r)?s=r:i=r;return{lo:s,hi:i}}const Ue=(n,t,e,i)=>Kc(n,e,i?s=>{const r=n[s][t];return rn[s][t]Kc(n,e,i=>n[i][t]>=e);function GM(n,t,e){let i=0,s=n.length;for(;ii&&n[s-1]>e;)s--;return i>0||s{const i="_onData"+Gc(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...r){const o=s.apply(this,r);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...r)}),o}})})}function Of(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Jm.forEach(r=>{delete n[r]}),delete n._chartjs)}function Qm(n){const t=new Set(n);return t.size===n.length?n:Array.from(t)}const tb=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function eb(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,tb.call(window,()=>{i=!1,n.apply(t,e)}))}}function KM(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const Zc=n=>n==="start"?"left":n==="end"?"right":"center",Tt=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,ZM=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function nb(n,t,e){const i=t.length;let s=0,r=i;if(n._sorted){const{iScale:o,_parsed:a}=n,l=o.axis,{min:c,max:h,minDefined:u,maxDefined:f}=o.getUserBounds();u&&(s=Ct(Math.min(Ue(a,l,c).lo,e?i:Ue(t,l,o.getPixelForValue(c)).lo),0,i-1)),f?r=Ct(Math.max(Ue(a,o.axis,h,!0).hi+1,e?0:Ue(t,l,o.getPixelForValue(h),!0).hi+1),s,i)-s:r=i-s}return{start:s,count:r}}function ib(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const r=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),r}const Mr=n=>n===0||n===1,Df=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*lt/e)),Ef=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*lt/e)+1,Ns={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*xt)+1,easeOutSine:n=>Math.sin(n*xt),easeInOutSine:n=>-.5*(Math.cos(ct*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Mr(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Mr(n)?n:Df(n,.075,.3),easeOutElastic:n=>Mr(n)?n:Ef(n,.075,.3),easeInOutElastic(n){return Mr(n)?n:n<.5?.5*Df(n*2,.1125,.45):.5+.5*Ef(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-Ns.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?Ns.easeInBounce(n*2)*.5:Ns.easeOutBounce(n*2-1)*.5+.5};function Jc(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Lf(n){return Jc(n)?n:new Xm(n)}function Xa(n){return Jc(n)?n:new Xm(n).saturate(.5).darken(.1).hexString()}const JM=["x","y","borderWidth","radius","tension"],QM=["color","borderColor","backgroundColor"];function tk(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:QM},numbers:{type:"number",properties:JM}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function ek(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Tf=new Map;function nk(n,t){t=t||{};const e=n+JSON.stringify(t);let i=Tf.get(e);return i||(i=new Intl.NumberFormat(n,t),Tf.set(e,i)),i}function hr(n,t,e){return nk(t,e).format(n)}const sb={values(n){return at(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,r=n;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=ik(n,e)}const o=hn(Math.abs(r)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),hr(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";const i=e[t].significand||n/Math.pow(10,Math.floor(hn(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?sb.numeric.call(this,n,t,e):""}};function ik(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var fa={formatters:sb};function sk(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:fa.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Qn=Object.create(null),Yl=Object.create(null);function Ws(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;ii.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Xa(s.backgroundColor),this.hoverBorderColor=(i,s)=>Xa(s.borderColor),this.hoverColor=(i,s)=>Xa(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Ga(this,t,e)}get(t){return Ws(this,t)}describe(t,e){return Ga(Yl,t,e)}override(t,e){return Ga(Qn,t,e)}route(t,e,i,s){const r=Ws(this,t),o=Ws(this,i),a="_"+e;Object.defineProperties(r,{[a]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=o[s];return $(l)?Object.assign({},c,l):V(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}};var mt=new rk({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[tk,ek,sk]);function ok(n){return!n||q(n.size)||q(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function No(n,t,e,i,s){let r=t[s];return r||(r=t[s]=n.measureText(s).width,e.push(s)),r>i&&(i=r),i}function ak(n,t,e,i){i=i||{};let s=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},r=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let o=0;const a=e.length;let l,c,h,u,f;for(l=0;le.length){for(l=0;l0&&n.stroke()}}function Xe(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.xt.top-e&&n.y0&&r.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,hk(n,r),l=0;l+n||0;function Qc(n,t){const e={},i=$(t),s=i?Object.keys(t):t,r=$(n)?i?o=>V(n[o],n[t[o]]):o=>n[o]:()=>n;for(const o of s)e[o]=mk(r(o));return e}function ob(n){return Qc(n,{top:"y",right:"x",bottom:"y",left:"x"})}function qn(n){return Qc(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Bt(n){const t=ob(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Mt(n,t){n=n||{},t=t||mt.font;let e=V(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=V(n.style,t.style);i&&!(""+i).match(gk)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:V(n.family,t.family),lineHeight:pk(V(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:V(n.weight,t.weight),string:""};return s.string=ok(s),s}function Ms(n,t,e,i){let s=!0,r,o,a;for(r=0,o=n.length;re&&a===0?0:a+l;return{min:o(i,-Math.abs(r)),max:o(s,r)}}function kn(n,t){return Object.assign(Object.create(n),t)}function th(n,t=[""],e,i,s=()=>n[0]){const r=e||n;typeof i>"u"&&(i=hb("_fallback",n));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:r,_fallback:i,_getTarget:s,override:a=>th([a,...n],t,r,i)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete n[0][l],!0},get(a,l){return lb(a,l,()=>kk(l,t,n,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,l){return Ff(a).includes(l)},ownKeys(a){return Ff(a)},set(a,l,c){const h=a._storage||(a._storage=s());return a[l]=h[l]=c,delete a._keys,!0}})}function Li(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:ab(n,i),setContext:r=>Li(n,r,e,i),override:r=>Li(n.override(r),t,e,i)};return new Proxy(s,{deleteProperty(r,o){return delete r[o],delete n[o],!0},get(r,o,a){return lb(r,o,()=>_k(r,o,a))},getOwnPropertyDescriptor(r,o){return r._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(r,o,a){return n[o]=a,delete r[o],!0}})}function ab(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:bn(e)?e:()=>e,isIndexable:bn(i)?i:()=>i}}const yk=(n,t)=>n?n+Gc(t):t,eh=(n,t)=>$(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function lb(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];const i=e();return n[t]=i,i}function _k(n,t,e){const{_proxy:i,_context:s,_subProxy:r,_descriptors:o}=n;let a=i[t];return bn(a)&&o.isScriptable(t)&&(a=vk(t,a,n,e)),at(a)&&a.length&&(a=xk(t,a,n,o.isIndexable)),eh(t,a)&&(a=Li(a,s,r&&r[t],o)),a}function vk(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_stack:a}=e;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);a.add(n);let l=t(r,o||i);return a.delete(n),eh(n,l)&&(l=nh(s._scopes,s,n,l)),l}function xk(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_descriptors:a}=e;if(typeof r.index<"u"&&i(n))return t[r.index%t.length];if($(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=nh(c,s,n,h);t.push(Li(u,r,o&&o[n],a))}}return t}function cb(n,t,e){return bn(n)?n(t,e):n}const wk=(n,t)=>n===!0?t:typeof n=="string"?mn(t,n):void 0;function Sk(n,t,e,i,s){for(const r of t){const o=wk(e,r);if(o){n.add(o);const a=cb(o._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==i)return a}else if(o===!1&&typeof i<"u"&&e!==i)return null}return!1}function nh(n,t,e,i){const s=t._rootScopes,r=cb(t._fallback,e,i),o=[...n,...s],a=new Set;a.add(i);let l=If(a,o,e,r||e,i);return l===null||typeof r<"u"&&r!==e&&(l=If(a,o,r,l,i),l===null)?!1:th(Array.from(a),[""],s,r,()=>Mk(t,e,i))}function If(n,t,e,i,s){for(;e;)e=Sk(n,t,e,i,s);return e}function Mk(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return at(s)&&$(e)?e:s||{}}function kk(n,t,e,i){let s;for(const r of t)if(s=hb(yk(r,n),e),typeof s<"u")return eh(n,s)?nh(e,i,n,s):s}function hb(n,t){for(const e of t){if(!e)continue;const i=e[n];if(typeof i<"u")return i}}function Ff(n){let t=n._keys;return t||(t=n._keys=Pk(n._scopes)),t}function Pk(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function ub(n,t,e,i){const{iScale:s}=n,{key:r="r"}=this._parsing,o=new Array(i);let a,l,c,h;for(a=0,l=i;atn==="x"?"y":"x";function Ck(n,t,e,i){const s=n.skip?t:n,r=t,o=e.skip?t:e,a=$l(r,s),l=$l(o,r);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=i*c,f=i*h;return{previous:{x:r.x-u*(o.x-s.x),y:r.y-u*(o.y-s.y)},next:{x:r.x+f*(o.x-s.x),y:r.y+f*(o.y-s.y)}}}function Ok(n,t,e){const i=n.length;let s,r,o,a,l,c=Ti(n,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")Ek(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,o=n.length;rn.ownerDocument.defaultView.getComputedStyle(n,null);function Rk(n,t){return pa(n).getPropertyValue(t)}const Ik=["top","right","bottom","left"];function Kn(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const r=Ik[s];i[r]=parseFloat(n[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Fk=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function Bk(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:r}=i;let o=!1,a,l;if(Fk(s,r,n.target))a=s,l=r;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function Fn(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=pa(e),r=s.boxSizing==="border-box",o=Kn(s,"padding"),a=Kn(s,"border","width"),{x:l,y:c,box:h}=Bk(n,e),u=o.left+(h&&a.left),f=o.top+(h&&a.top);let{width:d,height:g}=t;return r&&(d-=o.width+a.width,g-=o.height+a.height),{x:Math.round((l-u)/d*e.width/i),y:Math.round((c-f)/g*e.height/i)}}function zk(n,t,e){let i,s;if(t===void 0||e===void 0){const r=sh(n);if(!r)t=n.clientWidth,e=n.clientHeight;else{const o=r.getBoundingClientRect(),a=pa(r),l=Kn(a,"border","width"),c=Kn(a,"padding");t=o.width-c.width-l.width,e=o.height-c.height-l.height,i=Wo(a.maxWidth,r,"clientWidth"),s=Wo(a.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||zo,maxHeight:s||zo}}const Pr=n=>Math.round(n*10)/10;function Nk(n,t,e,i){const s=pa(n),r=Kn(s,"margin"),o=Wo(s.maxWidth,n,"clientWidth")||zo,a=Wo(s.maxHeight,n,"clientHeight")||zo,l=zk(n,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const f=Kn(s,"border","width"),d=Kn(s,"padding");c-=d.width+f.width,h-=d.height+f.height}return c=Math.max(0,c-r.width),h=Math.max(0,i?c/i:h-r.height),c=Pr(Math.min(c,o,l.maxWidth)),h=Pr(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Pr(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&h>l.height&&(h=l.height,c=Pr(Math.floor(h*i))),{width:c,height:h}}function Bf(n,t,e){const i=t||1,s=Math.floor(n.height*i),r=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const o=n.canvas;return o.style&&(e||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==r?(n.currentDevicePixelRatio=i,o.height=s,o.width=r,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Wk=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};ih()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n}();function zf(n,t){const e=Rk(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Bn(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function Vk(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function jk(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},r={x:t.cp1x,y:t.cp1y},o=Bn(n,s,e),a=Bn(s,r,e),l=Bn(r,t,e),c=Bn(o,a,e),h=Bn(a,l,e);return Bn(c,h,e)}const Hk=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},$k=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function Mi(n,t,e){return n?Hk(t,e):$k()}function db(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function gb(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function pb(n){return n==="angle"?{between:Zs,compare:YM,normalize:Zt}:{between:Ye,compare:(t,e)=>t-e,normalize:t=>t}}function Nf({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function Yk(n,t,e){const{property:i,start:s,end:r}=e,{between:o,normalize:a}=pb(i),l=t.length;let{start:c,end:h,loop:u}=n,f,d;if(u){for(c+=l,h+=l,f=0,d=l;fl(s,v,x)&&a(s,v)!==0,_=()=>a(r,x)===0||l(r,v,x),w=()=>p||b(),M=()=>!p||_();for(let S=h,P=h;S<=u;++S)m=t[S%o],!m.skip&&(x=c(m[i]),x!==v&&(p=l(x,s,r),y===null&&w()&&(y=a(x,s)===0?S:P),y!==null&&M()&&(g.push(Nf({start:y,end:S,loop:f,count:o,style:d})),y=null),P=S,v=x));return y!==null&&g.push(Nf({start:y,end:u,loop:f,count:o,style:d})),g}function bb(n,t){const e=[],i=n.segments;for(let s=0;ss&&n[r%t].skip;)r--;return r%=t,{start:s,end:r}}function Xk(n,t,e,i){const s=n.length,r=[];let o=t,a=n[t],l;for(l=t+1;l<=e;++l){const c=n[l%s];c.skip||c.stop?a.skip||(i=!1,r.push({start:t%s,end:(l-1)%s,loop:i}),t=o=c.stop?l:null):(o=l,a.skip&&(t=l)),a=c}return o!==null&&r.push({start:t%s,end:o%s,loop:i}),r}function Gk(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const r=!!n._loop,{start:o,end:a}=Uk(e,s,r,i);if(i===!0)return Wf(n,[{start:o,end:a,loop:r}],e,t);const l=a{let n=0;return()=>n++})();function q(n){return n===null||typeof n>"u"}function at(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function $(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function mt(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function Kt(n,t){return mt(n)?n:t}function V(n,t){return typeof n>"u"?t:n}const EM=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,Gm=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function ot(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function tt(n,t,e,i){let s,r,o;if(at(n))if(r=n.length,i)for(s=r-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function RM(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function IM(n){const t=RM(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function pn(n,t){return(Mf[t]||(Mf[t]=IM(t)))(n)}function Gc(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Ks=n=>typeof n<"u",mn=n=>typeof n=="function",kf=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function FM(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const ct=Math.PI,lt=2*ct,BM=lt+ct,zo=Number.POSITIVE_INFINITY,zM=ct/180,xt=ct/2,Dn=ct/4,Pf=ct*2/3,cn=Math.log10,Ae=Math.sign;function zs(n,t,e){return Math.abs(n-t)s-r).pop(),t}function Ei(n){return!isNaN(parseFloat(n))&&isFinite(n)}function WM(n,t){const e=Math.round(n);return e-t<=n&&e+t>=n}function Km(n,t,e){let i,s,r;for(i=0,s=n.length;il&&c=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function Kc(n,t,e){e=e||(o=>n[o]1;)r=s+i>>1,e(r)?s=r:i=r;return{lo:s,hi:i}}const Ue=(n,t,e,i)=>Kc(n,e,i?s=>{const r=n[s][t];return rn[s][t]Kc(n,e,i=>n[i][t]>=e);function $M(n,t,e){let i=0,s=n.length;for(;ii&&n[s-1]>e;)s--;return i>0||s{const i="_onData"+Gc(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...r){const o=s.apply(this,r);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...r)}),o}})})}function Of(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Zm.forEach(r=>{delete n[r]}),delete n._chartjs)}function Qm(n){const t=new Set(n);return t.size===n.length?n:Array.from(t)}const tb=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function eb(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,tb.call(window,()=>{i=!1,n.apply(t,e)}))}}function UM(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const Jc=n=>n==="start"?"left":n==="end"?"right":"center",Tt=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,XM=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function nb(n,t,e){const i=t.length;let s=0,r=i;if(n._sorted){const{iScale:o,_parsed:a}=n,l=o.axis,{min:c,max:h,minDefined:u,maxDefined:f}=o.getUserBounds();u&&(s=Ot(Math.min(Ue(a,l,c).lo,e?i:Ue(t,l,o.getPixelForValue(c)).lo),0,i-1)),f?r=Ot(Math.max(Ue(a,o.axis,h,!0).hi+1,e?0:Ue(t,l,o.getPixelForValue(h),!0).hi+1),s,i)-s:r=i-s}return{start:s,count:r}}function ib(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const r=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),r}const Mr=n=>n===0||n===1,Df=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*lt/e)),Ef=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*lt/e)+1,Ns={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*xt)+1,easeOutSine:n=>Math.sin(n*xt),easeInOutSine:n=>-.5*(Math.cos(ct*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Mr(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Mr(n)?n:Df(n,.075,.3),easeOutElastic:n=>Mr(n)?n:Ef(n,.075,.3),easeInOutElastic(n){return Mr(n)?n:n<.5?.5*Df(n*2,.1125,.45):.5+.5*Ef(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-Ns.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?Ns.easeInBounce(n*2)*.5:Ns.easeOutBounce(n*2-1)*.5+.5};function Zc(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Lf(n){return Zc(n)?n:new Xm(n)}function Xa(n){return Zc(n)?n:new Xm(n).saturate(.5).darken(.1).hexString()}const GM=["x","y","borderWidth","radius","tension"],qM=["color","borderColor","backgroundColor"];function KM(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:qM},numbers:{type:"number",properties:GM}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function JM(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Tf=new Map;function ZM(n,t){t=t||{};const e=n+JSON.stringify(t);let i=Tf.get(e);return i||(i=new Intl.NumberFormat(n,t),Tf.set(e,i)),i}function hr(n,t,e){return ZM(t,e).format(n)}const sb={values(n){return at(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,r=n;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=QM(n,e)}const o=cn(Math.abs(r)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),hr(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";const i=e[t].significand||n/Math.pow(10,Math.floor(cn(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?sb.numeric.call(this,n,t,e):""}};function QM(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var fa={formatters:sb};function tk(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:fa.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Qn=Object.create(null),Yl=Object.create(null);function Ws(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;ii.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Xa(s.backgroundColor),this.hoverBorderColor=(i,s)=>Xa(s.borderColor),this.hoverColor=(i,s)=>Xa(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Ga(this,t,e)}get(t){return Ws(this,t)}describe(t,e){return Ga(Yl,t,e)}override(t,e){return Ga(Qn,t,e)}route(t,e,i,s){const r=Ws(this,t),o=Ws(this,i),a="_"+e;Object.defineProperties(r,{[a]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=o[s];return $(l)?Object.assign({},c,l):V(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}};var bt=new ek({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[KM,JM,tk]);function nk(n){return!n||q(n.size)||q(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function No(n,t,e,i,s){let r=t[s];return r||(r=t[s]=n.measureText(s).width,e.push(s)),r>i&&(i=r),i}function ik(n,t,e,i){i=i||{};let s=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},r=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let o=0;const a=e.length;let l,c,h,u,f;for(l=0;le.length){for(l=0;l0&&n.stroke()}}function Xe(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.xt.top-e&&n.y0&&r.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,ok(n,r),l=0;l+n||0;function Qc(n,t){const e={},i=$(t),s=i?Object.keys(t):t,r=$(n)?i?o=>V(n[o],n[t[o]]):o=>n[o]:()=>n;for(const o of s)e[o]=fk(r(o));return e}function ob(n){return Qc(n,{top:"y",right:"x",bottom:"y",left:"x"})}function qn(n){return Qc(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Nt(n){const t=ob(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Mt(n,t){n=n||{},t=t||bt.font;let e=V(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=V(n.style,t.style);i&&!(""+i).match(hk)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:V(n.family,t.family),lineHeight:uk(V(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:V(n.weight,t.weight),string:""};return s.string=nk(s),s}function Ms(n,t,e,i){let s=!0,r,o,a;for(r=0,o=n.length;re&&a===0?0:a+l;return{min:o(i,-Math.abs(r)),max:o(s,r)}}function kn(n,t){return Object.assign(Object.create(n),t)}function th(n,t=[""],e,i,s=()=>n[0]){const r=e||n;typeof i>"u"&&(i=hb("_fallback",n));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:r,_fallback:i,_getTarget:s,override:a=>th([a,...n],t,r,i)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete n[0][l],!0},get(a,l){return lb(a,l,()=>xk(l,t,n,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,l){return Ff(a).includes(l)},ownKeys(a){return Ff(a)},set(a,l,c){const h=a._storage||(a._storage=s());return a[l]=h[l]=c,delete a._keys,!0}})}function Li(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:ab(n,i),setContext:r=>Li(n,r,e,i),override:r=>Li(n.override(r),t,e,i)};return new Proxy(s,{deleteProperty(r,o){return delete r[o],delete n[o],!0},get(r,o,a){return lb(r,o,()=>pk(r,o,a))},getOwnPropertyDescriptor(r,o){return r._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(r,o,a){return n[o]=a,delete r[o],!0}})}function ab(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:mn(e)?e:()=>e,isIndexable:mn(i)?i:()=>i}}const gk=(n,t)=>n?n+Gc(t):t,eh=(n,t)=>$(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function lb(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];const i=e();return n[t]=i,i}function pk(n,t,e){const{_proxy:i,_context:s,_subProxy:r,_descriptors:o}=n;let a=i[t];return mn(a)&&o.isScriptable(t)&&(a=mk(t,a,n,e)),at(a)&&a.length&&(a=bk(t,a,n,o.isIndexable)),eh(t,a)&&(a=Li(a,s,r&&r[t],o)),a}function mk(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_stack:a}=e;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);a.add(n);let l=t(r,o||i);return a.delete(n),eh(n,l)&&(l=nh(s._scopes,s,n,l)),l}function bk(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_descriptors:a}=e;if(typeof r.index<"u"&&i(n))return t[r.index%t.length];if($(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=nh(c,s,n,h);t.push(Li(u,r,o&&o[n],a))}}return t}function cb(n,t,e){return mn(n)?n(t,e):n}const yk=(n,t)=>n===!0?t:typeof n=="string"?pn(t,n):void 0;function _k(n,t,e,i,s){for(const r of t){const o=yk(e,r);if(o){n.add(o);const a=cb(o._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==i)return a}else if(o===!1&&typeof i<"u"&&e!==i)return null}return!1}function nh(n,t,e,i){const s=t._rootScopes,r=cb(t._fallback,e,i),o=[...n,...s],a=new Set;a.add(i);let l=If(a,o,e,r||e,i);return l===null||typeof r<"u"&&r!==e&&(l=If(a,o,r,l,i),l===null)?!1:th(Array.from(a),[""],s,r,()=>vk(t,e,i))}function If(n,t,e,i,s){for(;e;)e=_k(n,t,e,i,s);return e}function vk(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return at(s)&&$(e)?e:s||{}}function xk(n,t,e,i){let s;for(const r of t)if(s=hb(gk(r,n),e),typeof s<"u")return eh(n,s)?nh(e,i,n,s):s}function hb(n,t){for(const e of t){if(!e)continue;const i=e[n];if(typeof i<"u")return i}}function Ff(n){let t=n._keys;return t||(t=n._keys=wk(n._scopes)),t}function wk(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function ub(n,t,e,i){const{iScale:s}=n,{key:r="r"}=this._parsing,o=new Array(i);let a,l,c,h;for(a=0,l=i;atn==="x"?"y":"x";function Mk(n,t,e,i){const s=n.skip?t:n,r=t,o=e.skip?t:e,a=$l(r,s),l=$l(o,r);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=i*c,f=i*h;return{previous:{x:r.x-u*(o.x-s.x),y:r.y-u*(o.y-s.y)},next:{x:r.x+f*(o.x-s.x),y:r.y+f*(o.y-s.y)}}}function kk(n,t,e){const i=n.length;let s,r,o,a,l,c=Ti(n,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")Ak(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,o=n.length;rn.ownerDocument.defaultView.getComputedStyle(n,null);function Dk(n,t){return pa(n).getPropertyValue(t)}const Ek=["top","right","bottom","left"];function Kn(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const r=Ek[s];i[r]=parseFloat(n[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Lk=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function Tk(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:r}=i;let o=!1,a,l;if(Lk(s,r,n.target))a=s,l=r;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function Fn(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=pa(e),r=s.boxSizing==="border-box",o=Kn(s,"padding"),a=Kn(s,"border","width"),{x:l,y:c,box:h}=Tk(n,e),u=o.left+(h&&a.left),f=o.top+(h&&a.top);let{width:d,height:g}=t;return r&&(d-=o.width+a.width,g-=o.height+a.height),{x:Math.round((l-u)/d*e.width/i),y:Math.round((c-f)/g*e.height/i)}}function Rk(n,t,e){let i,s;if(t===void 0||e===void 0){const r=sh(n);if(!r)t=n.clientWidth,e=n.clientHeight;else{const o=r.getBoundingClientRect(),a=pa(r),l=Kn(a,"border","width"),c=Kn(a,"padding");t=o.width-c.width-l.width,e=o.height-c.height-l.height,i=Wo(a.maxWidth,r,"clientWidth"),s=Wo(a.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||zo,maxHeight:s||zo}}const Pr=n=>Math.round(n*10)/10;function Ik(n,t,e,i){const s=pa(n),r=Kn(s,"margin"),o=Wo(s.maxWidth,n,"clientWidth")||zo,a=Wo(s.maxHeight,n,"clientHeight")||zo,l=Rk(n,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const f=Kn(s,"border","width"),d=Kn(s,"padding");c-=d.width+f.width,h-=d.height+f.height}return c=Math.max(0,c-r.width),h=Math.max(0,i?c/i:h-r.height),c=Pr(Math.min(c,o,l.maxWidth)),h=Pr(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Pr(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&h>l.height&&(h=l.height,c=Pr(Math.floor(h*i))),{width:c,height:h}}function Bf(n,t,e){const i=t||1,s=Math.floor(n.height*i),r=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const o=n.canvas;return o.style&&(e||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==r?(n.currentDevicePixelRatio=i,o.height=s,o.width=r,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Fk=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};ih()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n}();function zf(n,t){const e=Dk(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Bn(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function Bk(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function zk(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},r={x:t.cp1x,y:t.cp1y},o=Bn(n,s,e),a=Bn(s,r,e),l=Bn(r,t,e),c=Bn(o,a,e),h=Bn(a,l,e);return Bn(c,h,e)}const Nk=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},Wk=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function Mi(n,t,e){return n?Nk(t,e):Wk()}function db(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function gb(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function pb(n){return n==="angle"?{between:Js,compare:VM,normalize:Jt}:{between:Ye,compare:(t,e)=>t-e,normalize:t=>t}}function Nf({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function Vk(n,t,e){const{property:i,start:s,end:r}=e,{between:o,normalize:a}=pb(i),l=t.length;let{start:c,end:h,loop:u}=n,f,d;if(u){for(c+=l,h+=l,f=0,d=l;fl(s,v,x)&&a(s,v)!==0,_=()=>a(r,x)===0||l(r,v,x),w=()=>p||b(),M=()=>!p||_();for(let S=h,P=h;S<=u;++S)m=t[S%o],!m.skip&&(x=c(m[i]),x!==v&&(p=l(x,s,r),y===null&&w()&&(y=a(x,s)===0?S:P),y!==null&&M()&&(g.push(Nf({start:y,end:S,loop:f,count:o,style:d})),y=null),P=S,v=x));return y!==null&&g.push(Nf({start:y,end:u,loop:f,count:o,style:d})),g}function bb(n,t){const e=[],i=n.segments;for(let s=0;ss&&n[r%t].skip;)r--;return r%=t,{start:s,end:r}}function Hk(n,t,e,i){const s=n.length,r=[];let o=t,a=n[t],l;for(l=t+1;l<=e;++l){const c=n[l%s];c.skip||c.stop?a.skip||(i=!1,r.push({start:t%s,end:(l-1)%s,loop:i}),t=o=c.stop?l:null):(o=l,a.skip&&(t=l)),a=c}return o!==null&&r.push({start:t%s,end:o%s,loop:i}),r}function $k(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const r=!!n._loop,{start:o,end:a}=jk(e,s,r,i);if(i===!0)return Wf(n,[{start:o,end:a,loop:r}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=tb.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const r=i.items;let o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(r[o]=r[r.length-1],r.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};var Ie=new Zk;const jf="transparent",Jk={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=Lf(n||jf),s=i.valid&&Lf(t||jf);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};let Qk=class{constructor(t,e,i,s){const r=e[i];s=Ms([t.to,s,r,t.from]);const o=Ms([t.from,r,s]);this._active=!0,this._fn=t.fn||Jk[t.type||typeof o],this._easing=Ns[t.easing]||Ns.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],r=i-this._start,o=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=Ms([t.to,e,s,t.from]),this._from=Ms([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,r=this._from,o=this._loop,a=this._to;let l;if(this._active=r!==a&&(o||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s{const r=t[s];if(!$(r))return;const o={};for(const a of e)o[a]=r[a];(at(r.properties)&&r.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,o)})})}_animateOptions(t,e){const i=e.options,s=eP(t,i);if(!s)return[];const r=this._createAnimations(s,i);return i.$shared&&tP(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,s=[],r=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=r[c];const f=i.get(c);if(u)if(f&&u.active()){u.update(f,h,a);continue}else u.cancel();if(!f||!f.duration){t[c]=h;continue}r[c]=u=new Qk(f,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Ie.add(this._chart,i),!0}};function tP(n,t){const e=[],i=Object.keys(t);for(let s=0;s0||!e&&r<0)return s.index}return null}function Xf(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:r,vScale:o,index:a}=i,l=r.axis,c=o.axis,h=rP(r,o,i),u=t.length;let f;for(let d=0;de[i].axis===t).shift()}function lP(n,t){return kn(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function cP(n,t,e){return kn(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Zi(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const r=s._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e],r[i]._visualValues!==void 0&&r[i]._visualValues[e]!==void 0&&delete r[i]._visualValues[e]}}}const Ka=n=>n==="reset"||n==="none",Gf=(n,t)=>t?n:Object.assign({},n),hP=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:_b(e,!0),values:null};var cs;let Pn=(cs=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Yf(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Zi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(u,f,d,g)=>u==="x"?f:u==="r"?g:d,r=e.xAxisID=V(i.xAxisID,qa(t,"x")),o=e.yAxisID=V(i.yAxisID,qa(t,"y")),a=e.rAxisID=V(i.rAxisID,qa(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,o,a),h=e.vAxisID=s(l,o,r,a);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Of(this._data,this),t._stacked&&Zi(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if($(e))this._data=sP(e);else if(i!==e){if(i){Of(i,this);const s=this._cachedMeta;Zi(s),s._parsed=[]}e&&Object.isExtensible(e)&&qM(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const r=e._stacked;e._stacked=Yf(e.vScale,e),e.stack!==i.stack&&(s=!0,Zi(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&Xf(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:o}=i,a=r.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,u,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{at(s[t])?f=this.parseArrayData(i,s,t,e):$(s[t])?f=this.parseObjectData(i,s,t,e):f=this.parsePrimitiveData(i,s,t,e);const d=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!g()){this.updateRangeFromParsed(c,t,d,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,r,o;for(s=0,r=e.length;s=0&&tthis.getContext(i,s,e),p=c.resolveNamedOptions(f,d,g,u);return p.$shared&&(p.$shared=l,r[o]=Object.freeze(Gf(p,l))),p}_resolveAnimations(t,e,i){const s=this.chart,r=this._cachedDataOpts,o=`animation-${e}`,a=r[o];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(f,this.getContext(t,i,e))}const c=new yb(s,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ka(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(i),o=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:o}}updateElement(t,e,i,s){Ka(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ka(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,r=e.length,o=Math.min(r,s);o&&this.parse(0,o),r>s?this._insertElements(s,r-s,t):r{for(c.length+=e,a=c.length-1;a>=o;a--)c[a]=c[a-e]};for(l(r),a=t;as-r))}return n._cache.$bar}function fP(n){const t=n.iScale,e=uP(t,n.type);let i=t._length,s,r,o,a;const l=()=>{o===32767||o===-32768||(Ks(a)&&(i=Math.min(i,Math.abs(o-a)||i)),a=o)};for(s=0,r=e.length;s0?s[n-1]:null,a=nMath.abs(a)&&(l=a,c=o),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:o,max:a}}function vb(n,t,e,i){return at(n)?pP(n,t,e,i):t[e.axis]=e.parse(n,i),t}function qf(n,t,e,i){const s=n.iScale,r=n.vScale,o=s.getLabels(),a=s===r,l=[];let c,h,u,f;for(c=e,h=e+i;c=e?1:-1)}function bP(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.basel.controller.options.grouped),r=i.options.stacked,o=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(q(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((r===!1||o.indexOf(l.stack)===-1||r===void 0&&l.stack===void 0)&&o.push(l.stack),l.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let r,o;for(r=0,o=e.data.length;r=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:r}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),l=r.getLabelForValue(o.y),c=o._custom;return{label:i[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=o.axis,u=a.axis;for(let f=e;fZs(v,a,l,!0)?1:Math.max(b,b*e,_,_*e),g=(v,b,_)=>Zs(v,a,l,!0)?-1:Math.min(b,b*e,_,_*e),p=d(0,c,u),y=d(xt,h,f),x=g(ct,c,u),m=g(ct+xt,h,f);i=(p-x)/2,s=(y-m)/2,r=-(p+x)/2,o=-(y+m)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:o}}var pi;let rh=(pi=class extends Pn{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let r=l=>+i[l];if($(i[t])){const{key:l="value"}=this._parsing;r=c=>+mn(i[c],l)}let o,a;for(o=t,a=t+e;o0&&!isNaN(t)?lt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=hr(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,r,o,a,l;if(!t){for(s=0,r=i.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),D(pi,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,o)=>{const l=t.getDatasetMeta(0).controller.getStyle(o);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}}),pi);var fs;let MP=(fs=class extends Pn{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:r}=e,o=this.chart._animationsDisabled;let{start:a,count:l}=nb(e,s,o);this._drawStart=a,this._drawCount=l,ib(e)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),f=o.axis,d=a.axis,{spanGaps:g,segment:p}=this.options,y=Ei(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||r||s==="none",m=e+i,v=t.length;let b=e>0&&this.getParsed(e-1);for(let _=0;_=m){M.skip=!0;continue}const S=this.getParsed(_),P=q(S[d]),C=M[f]=o.getPixelForValue(S[f],_),k=M[d]=r||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[d],_);M.skip=isNaN(C)||isNaN(k)||P,M.stop=_>0&&Math.abs(S[f]-b[f])>y,p&&(M.parsed=S,M.raw=c.data[_]),u&&(M.options=h||this.resolveDataElementOptions(_,w.active?"active":s)),x||this.updateElement(w,_,M,s),b=S}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const r=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},D(fs,"id","line"),D(fs,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),D(fs,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}}),fs);var ds;let xb=(ds=class extends Pn{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=hr(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return ub.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(re.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),o=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),a=(r-o)/t.getVisibleDatasetCount();this.outerRadius=r-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){const r=s==="reset",o=this.chart,l=o.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,f=c.getIndexAngle(0)-.5*ct;let d=f,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?pe(this.resolveDataElementOptions(t,e).angle||i):0}},D(ds,"id","polarArea"),D(ds,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),D(ds,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,o)=>{const l=t.getDatasetMeta(0).controller.getStyle(o);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}}),ds);var qr;let kP=(qr=class extends rh{},D(qr,"id","pie"),D(qr,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"}),qr);var gs;let PP=(gs=class extends Pn{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return ub.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){const o=this.resolveDatasetElementOptions(t);this.options.showLine||(o.borderWidth=0);const a={_loop:!0,_fullLoop:r.length===s.length,options:o};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const r=this._cachedMeta.rScale,o=s==="reset";for(let a=e;a0&&this.getParsed(e-1);for(let b=e;b0&&Math.abs(w[d]-v[d])>x,y&&(M.parsed=w,M.raw=c.data[b]),f&&(M.options=u||this.resolveDataElementOptions(b,_.active?"active":s)),m||this.updateElement(_,b,M,s),v=w}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const r=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,o)/2}},D(ps,"id","scatter"),D(ps,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),D(ps,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}}),ps);var CP=Object.freeze({__proto__:null,BarController:xP,BubbleController:wP,DoughnutController:rh,LineController:MP,PieController:kP,PolarAreaController:xb,RadarController:PP,ScatterController:AP});function Ln(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class oh{constructor(t){D(this,"options");this.options=t||{}}static override(t){Object.assign(oh.prototype,t)}init(){}formats(){return Ln()}parse(){return Ln()}format(){return Ln()}add(){return Ln()}diff(){return Ln()}startOf(){return Ln()}endOf(){return Ln()}}var OP={_date:oh};function DP(n,t,e,i){const{controller:s,data:r,_sorted:o}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&o&&r.length){const l=a._reversePixels?XM:Ue;if(i){if(s._sharedOptions){const c=r[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(r,t,e-h),f=l(r,t,e+h);return{lo:u.lo,hi:f.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function ur(n,t,e,i,s){const r=n.getSortedVisibleDatasetMetas(),o=e[t];for(let a=0,l=r.length;a{l[o](t[e],s)&&(r.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:r}var RP={evaluateInteractionItems:ur,modes:{index(n,t,e,i){const s=Fn(t,n),r=e.axis||"x",o=e.includeInvisible||!1,a=e.intersect?Ja(n,s,r,i,o):Qa(n,s,r,!1,i,o),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(n,t,e,i){const s=Fn(t,n),r=e.axis||"xy",o=e.includeInvisible||!1;let a=e.intersect?Ja(n,s,r,i,o):Qa(n,s,r,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function Qf(n,t){return n.filter(e=>wb.indexOf(e.pos)===-1&&e.box.axis===t)}function Qi(n,t){return n.sort((e,i)=>{const s=t?i:e,r=t?e:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function IP(n){const t=[];let e,i,s,r,o,a;for(e=0,i=(n||[]).length;ec.box.fullSize),!0),i=Qi(Ji(t,"left"),!0),s=Qi(Ji(t,"right")),r=Qi(Ji(t,"top"),!0),o=Qi(Ji(t,"bottom")),a=Qf(t,"x"),l=Qf(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(o).concat(a),chartArea:Ji(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(o).concat(a)}}function td(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Sb(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function NP(n,t,e,i){const{pos:s,box:r}=e,o=n.maxPadding;if(!$(s)){e.size&&(n[s]-=e.size);const u=i[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?r.height:r.width),e.size=u.size/u.count,n[s]+=e.size}r.getPadding&&Sb(o,r.getPadding());const a=Math.max(0,t.outerWidth-td(o,n,"left","right")),l=Math.max(0,t.outerHeight-td(o,n,"top","bottom")),c=a!==n.w,h=l!==n.h;return n.w=a,n.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function WP(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function VP(n,t){const e=t.maxPadding;function i(s){const r={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{r[o]=Math.max(t[o],e[o])}),r}return i(n?["left","right"]:["top","bottom"])}function ks(n,t,e,i){const s=[];let r,o,a,l,c,h;for(r=0,o=n.length,c=0;r{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/h,hBoxMaxHeight:o/2}),f=Object.assign({},s);Sb(f,Bt(i));const d=Object.assign({maxPadding:f,w:r,h:o,x:s.left,y:s.top},s),g=BP(l.concat(c),u);ks(a.fullSize,d,u,g),ks(l,d,u,g),ks(c,d,u,g)&&ks(l,d,u,g),WP(d),ed(a.leftAndTop,d,u,g),d.x+=d.w,d.y+=d.h,ed(a.rightAndBottom,d,u,g),n.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},tt(a.chartArea,p=>{const y=p.box;Object.assign(y,n.chartArea),y.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})})}};let Mb=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}},jP=class extends Mb{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}};const uo="$chartjs",HP={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},nd=n=>n===null||n==="";function $P(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[uo]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",nd(s)){const r=zf(n,"width");r!==void 0&&(n.width=r)}if(nd(i))if(n.style.height==="")n.height=n.width/(t||2);else{const r=zf(n,"height");r!==void 0&&(n.height=r)}return n}const kb=Wk?{passive:!0}:!1;function YP(n,t,e){n&&n.addEventListener(t,e,kb)}function UP(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,kb)}function XP(n,t){const e=HP[n.type]||n.type,{x:i,y:s}=Fn(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Vo(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function GP(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Vo(a.addedNodes,i),o=o&&!Vo(a.removedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function qP(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Vo(a.removedNodes,i),o=o&&!Vo(a.addedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Qs=new Map;let id=0;function Pb(){const n=window.devicePixelRatio;n!==id&&(id=n,Qs.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function KP(n,t){Qs.size||window.addEventListener("resize",Pb),Qs.set(n,t)}function ZP(n){Qs.delete(n),Qs.size||window.removeEventListener("resize",Pb)}function JP(n,t,e){const i=n.canvas,s=i&&sh(i);if(!s)return;const r=eb((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||r(c,h)});return o.observe(s),KP(n,r),o}function tl(n,t,e){e&&e.disconnect(),t==="resize"&&ZP(n)}function QP(n,t,e){const i=n.canvas,s=eb(r=>{n.ctx!==null&&e(XP(r,n))},n);return YP(i,t,s),s}let tA=class extends Mb{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?($P(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[uo])return!1;const i=e[uo].initial;["height","width"].forEach(r=>{const o=i[r];q(o)?e.removeAttribute(r):e.setAttribute(r,o)});const s=i.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[uo],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),o={attach:GP,detach:qP,resize:JP}[e]||QP;s[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:tl,detach:tl,resize:tl}[e]||UP)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Nk(t,e,i,s)}isAttached(t){const e=sh(t);return!!(e&&e.isConnected)}};function eA(n){return!ih()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?jP:tA}var Kr;let Je=(Kr=class{constructor(){D(this,"x");D(this,"y");D(this,"active",!1);D(this,"options");D(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Ei(this.x)&&Ei(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(r=>{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}},D(Kr,"defaults",{}),D(Kr,"defaultRoutes"),Kr);function nA(n,t){const e=n.options.ticks,i=iA(n),s=Math.min(e.maxTicksLimit||i,i),r=e.major.enabled?rA(t):[],o=r.length,a=r[0],l=r[o-1],c=[];if(o>s)return oA(t,c,r,o/s),c;const h=sA(r,t,s);if(o>0){let u,f;const d=o>1?Math.round((l-a)/(o-1)):null;for(Cr(t,c,h,q(d)?0:a-d,a),u=0,f=o-1;us)return l}return Math.max(s,1)}function rA(n){const t=[];let e,i;for(e=0,i=n.length;en==="left"?"right":n==="right"?"left":n,sd=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,rd=(n,t)=>Math.min(t||n,n);function od(n,t){const e=[],i=n.length/t,s=n.length;let r=0;for(;ro+a)))return l}function hA(n,t){tt(n,e=>{const i=e.gc,s=i.length/2;let r;if(s>t){for(r=0;ri?i:e,i=s&&e>i?e:i,{min:Kt(e,Kt(i,e)),max:Kt(i,Kt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ot(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=bk(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,f=h.highest.height,d=Ct(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/i:d/(i-1),u+6>a&&(a=d/(i-(t.offset?.5:1)),l=this.maxHeight-ts(t.grid)-e.padding-ad(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),o=qc(Math.min(Math.asin(Ct((h.highest.height+6)/a,-1,1)),Math.asin(Ct(l/c,-1,1))-Math.asin(Ct(f/c,-1,1)))),o=Math.max(s,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){ot(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ot(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=ad(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=ts(r)+l):(t.height=this.maxHeight,t.width=ts(r)+l),i.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:f}=this._getLabelSizes(),d=i.padding*2,g=pe(this.labelRotation),p=Math.cos(g),y=Math.sin(g);if(a){const x=i.mirror?0:y*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+x+d)}else{const x=i.mirror?0:p*u.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+x+d)}this._calculatePadding(c,h,y,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,d=0;l?c?(f=s*t.width,d=i*e.height):(f=i*t.height,d=s*e.width):r==="start"?d=e.width:r==="end"?f=t.width:r!=="inner"&&(f=t.width/2,d=e.width/2),this.paddingLeft=Math.max((f-h+o)*this.width/(this.width-h),0),this.paddingRight=Math.max((d-u+o)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;r==="start"?(h=0,u=t.height):r==="end"&&(h=e.height,u=0),this.paddingTop=h+o,this.paddingBottom=u+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ot(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:o[P]||0,height:a[P]||0});return{first:S(0),last:S(e-1),widest:S(w),highest:S(M),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return UM(this._alignToPixels?En(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:r,position:o,border:a}=s,l=r.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=ts(r),d=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,y=p/2,x=function(E){return En(i,E,p)};let m,v,b,_,w,M,S,P,C,k,A,L;if(o==="top")m=x(this.bottom),M=this.bottom-f,P=m-y,k=x(t.top)+y,L=t.bottom;else if(o==="bottom")m=x(this.top),k=t.top,L=x(t.bottom)-y,M=m+y,P=this.top+f;else if(o==="left")m=x(this.right),w=this.right-f,S=m-y,C=x(t.left)+y,A=t.right;else if(o==="right")m=x(this.left),C=t.left,A=x(t.right)-y,w=m+y,S=this.left+f;else if(e==="x"){if(o==="center")m=x((t.top+t.bottom)/2+.5);else if($(o)){const E=Object.keys(o)[0],I=o[E];m=x(this.chart.scales[E].getPixelForValue(I))}k=t.top,L=t.bottom,M=m+y,P=M+f}else if(e==="y"){if(o==="center")m=x((t.left+t.right)/2);else if($(o)){const E=Object.keys(o)[0],I=o[E];m=x(this.chart.scales[E].getPixelForValue(I))}w=m-y,S=w-f,C=t.left,A=t.right}const R=V(s.ticks.maxTicksLimit,u),O=Math.max(1,Math.ceil(u/R));for(v=0;v0&&(dt-=Nt/2);break}St={left:dt,top:Gt,width:Nt+st.width,height:jt+st.height,color:O.backdropColor}}y.push({label:b,font:P,textOffset:A,options:{rotation:p,color:I,strokeColor:X,strokeWidth:J,textAlign:ht,textBaseline:L,translation:[_,w],backdrop:St}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-pe(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:r}}=this.options,o=this._getLabelSizes(),a=t+r,l=o.widest.width;let c,h;return e==="left"?s?(h=this.right+r,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?s?(h=this.left+r,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:r,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,r,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(r=>r.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,o;const a=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,o=s.length;r{this.draw(r)}}]:[{z:i,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let r,o;for(r=0,o=e.length;r{const i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),o=t[e].split("."),a=o.pop(),l=o.join(".");mt.route(r,s,l,a)})}function bA(n){return"id"in n&&"defaults"in n}let yA=class{constructor(){this.controllers=new Or(Pn,"datasets",!0),this.elements=new Or(Je,"elements"),this.plugins=new Or(Object,"plugins"),this.scales=new Or(fr,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):tt(s,o=>{const a=i||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,e,i){const s=Gc(t);ot(i["before"+s],[],i),e[t](i),ot(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;er.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}};function vA(n){const t={},e=[],i=Object.keys(Se.plugins.items);for(let r=0;r1&&ld(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function cd(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function AA(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return cd(n,"x",e[0])||cd(n,"y",e[0])}return{}}function CA(n,t){const e=Qn[n.type]||{scales:{}},i=t.scales||{},s=Xl(n.type,t),r=Object.create(null);return Object.keys(i).forEach(o=>{const a=i[o];if(!$(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const l=Gl(o,a,AA(o,n),mt.scales[a.type]),c=kA(l,s),h=e.scales||{};r[o]=Bs(Object.create(null),[{axis:l},a,h[l],h[c]])}),n.data.datasets.forEach(o=>{const a=o.type||n.type,l=o.indexAxis||Xl(a,t),h=(Qn[a]||{}).scales||{};Object.keys(h).forEach(u=>{const f=MA(u,l),d=o[f+"AxisID"]||f;r[d]=r[d]||Object.create(null),Bs(r[d],[{axis:f},i[d],h[u]])})}),Object.keys(r).forEach(o=>{const a=r[o];Bs(a,[mt.scales[a.type],mt.scale])}),r}function Cb(n){const t=n.options||(n.options={});t.plugins=V(t.plugins,{}),t.scales=CA(n,t)}function Ob(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function OA(n){return n=n||{},n.data=Ob(n.data),Cb(n),n}const hd=new Map,Db=new Set;function Dr(n,t){let e=hd.get(n);return e||(e=t(),hd.set(n,e),Db.add(e)),e}const es=(n,t,e)=>{const i=mn(t,e);i!==void 0&&n.add(i)};let DA=class{constructor(t){this._config=OA(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ob(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Cb(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Dr(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Dr(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Dr(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return Dr(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:r}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>es(l,t,u))),h.forEach(u=>es(l,s,u)),h.forEach(u=>es(l,Qn[r]||{},u)),h.forEach(u=>es(l,mt,u)),h.forEach(u=>es(l,Yl,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Db.has(e)&&o.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Qn[e]||{},mt.datasets[e]||{},{type:e},mt,Yl]}resolveNamedOptions(t,e,i,s=[""]){const r={$shared:!0},{resolver:o,subPrefixes:a}=ud(this._resolverCache,t,s);let l=o;if(LA(o,e)){r.$shared=!1,i=bn(i)?i():i;const c=this.createResolver(t,i,a);l=Li(o,i,c)}for(const c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){const{resolver:r}=ud(this._resolverCache,t,i);return $(e)?Li(r,e,void 0,s):r}};function ud(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let r=i.get(s);return r||(r={resolver:th(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,r)),r}const EA=n=>$(n)&&Object.getOwnPropertyNames(n).some(t=>bn(n[t]));function LA(n,t){const{isScriptable:e,isIndexable:i}=ab(n);for(const s of t){const r=e(s),o=i(s),a=(o||r)&&n[s];if(r&&(bn(a)||EA(a))||o&&at(a))return!0}return!1}var TA="4.4.2";const RA=["top","bottom","left","right","chartArea"];function fd(n,t){return n==="top"||n==="bottom"||RA.indexOf(n)===-1&&t==="x"}function dd(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function gd(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ot(e&&e.onComplete,[n],t)}function IA(n){const t=n.chart,e=t.options.animation;ot(e&&e.onProgress,[n],t)}function Eb(n){return ih()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const fo={},pd=n=>{const t=Eb(n);return Object.values(fo).filter(e=>e.canvas===t).pop()};function FA(n,t,e){const i=Object.keys(n);for(const s of i){const r=+s;if(r>=t){const o=n[s];delete n[s],(e>0||r>t)&&(n[r+e]=o)}}}function BA(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function Er(n,t,e){return n.options.clip?n[e]:t[e]}function zA(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:Er(e,t,"left"),right:Er(e,t,"right"),top:Er(i,t,"top"),bottom:Er(i,t,"bottom")}:t}var nn;let Ps=(nn=class{static register(...t){Se.add(...t),md()}static unregister(...t){Se.remove(...t),md()}constructor(t,e){const i=this.config=new DA(e),s=Eb(t),r=pd(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||eA(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=RM(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new _A,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=KM(u=>this.update(u),o.resizeDelay||0),this._dataChanges=[],fo[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Ie.listen(this,"complete",gd),Ie.listen(this,"progress",IA),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return q(t)?e&&r?r:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Se}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Bf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Rf(this.canvas,this.ctx),this}stop(){return Ie.stop(this),this}resize(t,e){Ie.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,r),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Bf(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),ot(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};tt(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let r=[];e&&(r=r.concat(Object.keys(e).map(o=>{const a=e[o],l=Gl(o,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),tt(r,o=>{const a=o.options,l=a.id,c=Gl(l,a),h=V(a.type,o.dtype);(a.position===void 0||fd(a.position,c)!==fd(o.dposition))&&(a.position=o.dposition),s[l]=!0;let u=null;if(l in i&&i[l].type===h)u=i[l];else{const f=Se.getScale(h);u=new f({id:l,type:h,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(a,t)}),tt(s,(o,a)=>{o||delete i[a]}),tt(i,o=>{Rt.configure(this,o,o.options),Rt.addBox(this,o)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;se.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(dd("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){tt(this.scales,t=>{Rt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!kf(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:r}of e){const o=i==="_removeElements"?-r:r;FA(t,s,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=r=>new Set(t.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),s=i(0);for(let r=1;rr.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Rt.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],tt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,r=zA(t,this.chartArea),o={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&da(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),s&&ga(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return Xe(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const r=RP.modes[e];return typeof r=="function"?r(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=kn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",r=this.getDatasetMeta(t),o=r.controller._resolveAnimations(void 0,s);Ks(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(r,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Ie.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,r,o),t[r]=o},s=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};tt(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",r),i("detach",o)};o=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){tt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},tt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let r,o,a,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!Fo(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,r=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),o=r(e,t),a=i?t:r(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:r}=this,o=e,a=this._getActiveElements(t,s,i,o),l=WM(t),c=BA(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ot(r.onHover,[t,a,this],this),l&&ot(r.onClick,[t,a,this],this));const h=!Fo(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}},D(nn,"defaults",mt),D(nn,"instances",fo),D(nn,"overrides",Qn),D(nn,"registry",Se),D(nn,"version",TA),D(nn,"getChart",pd),nn);function md(){return tt(Ps.instances,n=>n._plugins.invalidate())}function NA(n,t,e){const{startAngle:i,pixelMargin:s,x:r,y:o,outerRadius:a,innerRadius:l}=t;let c=s/a;n.beginPath(),n.arc(r,o,a,i-c,e+c),l>s?(c=s/l,n.arc(r,o,l,e+c,i-c,!0)):n.arc(r,o,s,e+xt,i-xt),n.closePath(),n.clip()}function WA(n){return Qc(n,["outerStart","outerEnd","innerStart","innerEnd"])}function VA(n,t,e,i){const s=WA(n.options.borderRadius),r=(e-t)/2,o=Math.min(r,i*t/2),a=l=>{const c=(e-Math.min(r,l))*i/2;return Ct(l,0,Math.min(r,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Ct(s.innerStart,0,o),innerEnd:Ct(s.innerEnd,0,o)}}function hi(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function jo(n,t,e,i,s,r){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+i+e-c,0),f=h>0?h+i+e+c:0;let d=0;const g=s-l;if(i){const O=h>0?h-i:0,E=u>0?u-i:0,I=(O+E)/2,X=I!==0?g*I/(I+i):g;d=(g-X)/2}const p=Math.max(.001,g*u-e/ct)/u,y=(g-p)/2,x=l+y+d,m=s-y-d,{outerStart:v,outerEnd:b,innerStart:_,innerEnd:w}=VA(t,f,u,m-x),M=u-v,S=u-b,P=x+v/M,C=m-b/S,k=f+_,A=f+w,L=x+_/k,R=m-w/A;if(n.beginPath(),r){const O=(P+C)/2;if(n.arc(o,a,u,P,O),n.arc(o,a,u,O,C),b>0){const J=hi(S,C,o,a);n.arc(J.x,J.y,b,C,m+xt)}const E=hi(A,m,o,a);if(n.lineTo(E.x,E.y),w>0){const J=hi(A,R,o,a);n.arc(J.x,J.y,w,m+xt,R+Math.PI)}const I=(m-w/f+(x+_/f))/2;if(n.arc(o,a,f,m-w/f,I,!0),n.arc(o,a,f,I,x+_/f,!0),_>0){const J=hi(k,L,o,a);n.arc(J.x,J.y,_,L+Math.PI,x-xt)}const X=hi(M,x,o,a);if(n.lineTo(X.x,X.y),v>0){const J=hi(M,P,o,a);n.arc(J.x,J.y,v,x-xt,P)}}else{n.moveTo(o,a);const O=Math.cos(P)*u+o,E=Math.sin(P)*u+a;n.lineTo(O,E);const I=Math.cos(C)*u+o,X=Math.sin(C)*u+a;n.lineTo(I,X)}n.closePath()}function jA(n,t,e,i,s){const{fullCircles:r,startAngle:o,circumference:a}=t;let l=t.endAngle;if(r){jo(n,t,e,i,l,s);for(let c=0;c=lt||Zs(o,l,c),y=Ye(a,h+d,u+d);return p&&y}getCenterPoint(e){const{x:i,y:s,startAngle:r,endAngle:o,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,u=(r+o)/2,f=(a+l+h+c)/2;return{x:i+Math.cos(u)*f,y:s+Math.sin(u)*f}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:i,circumference:s}=this,r=(i.offset||0)/4,o=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=s>lt?Math.floor(s/lt):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*r,Math.sin(l)*r);const c=1-Math.sin(Math.min(ct,s||0)),h=r*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,jA(e,this,h,o,a),HA(e,this,h,o,a),e.restore()}},D(mi,"id","arc"),D(mi,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),D(mi,"defaultRoutes",{backgroundColor:"backgroundColor"}),D(mi,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"}),mi);function Lb(n,t,e=t){n.lineCap=V(e.borderCapStyle,t.borderCapStyle),n.setLineDash(V(e.borderDash,t.borderDash)),n.lineDashOffset=V(e.borderDashOffset,t.borderDashOffset),n.lineJoin=V(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=V(e.borderWidth,t.borderWidth),n.strokeStyle=V(e.borderColor,t.borderColor)}function YA(n,t,e){n.lineTo(e.x,e.y)}function UA(n){return n.stepped?lk:n.tension||n.cubicInterpolationMode==="monotone"?ck:YA}function Tb(n,t,e={}){const i=n.length,{start:s=0,end:r=i-1}=e,{start:o,end:a}=t,l=Math.max(s,o),c=Math.min(r,a),h=sa&&r>a;return{count:i,start:l,loop:t.loop,ilen:c(o+(c?a-b:b))%r,v=()=>{p!==y&&(n.lineTo(h,y),n.lineTo(h,p),n.lineTo(h,x))};for(l&&(d=s[m(0)],n.moveTo(d.x,d.y)),f=0;f<=a;++f){if(d=s[m(f)],d.skip)continue;const b=d.x,_=d.y,w=b|0;w===g?(_y&&(y=_),h=(u*h+b)/++u):(v(),n.lineTo(b,_),g=w,u=0,p=y=_),x=_}v()}function ql(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?GA:XA}function qA(n){return n.stepped?Vk:n.tension||n.cubicInterpolationMode==="monotone"?jk:Bn}function KA(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),Lb(n,t.options),n.stroke(s)}function ZA(n,t,e,i){const{segments:s,options:r}=t,o=ql(t);for(const a of s)Lb(n,r,a.style),n.beginPath(),o(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const JA=typeof Path2D=="function";function QA(n,t,e,i){JA&&!t.options.segment?KA(n,t,e,i):ZA(n,t,e,i)}var bi;let ma=(bi=class extends Je{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Tk(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Gk(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],r=this.points,o=bb(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],l=qA(i);let c,h;for(c=0,h=o.length;ct!=="borderDash"&&t!=="fill"}),bi);function bd(n,t,e,i){const s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)n.replace("rgb(","rgba(").replace(")",", 0.5)"));function Ib(n){return Kl[n%Kl.length]}function Fb(n){return yd[n%yd.length]}function lC(n,t){return n.borderColor=Ib(t),n.backgroundColor=Fb(t),++t}function cC(n,t){return n.backgroundColor=n.data.map(()=>Ib(t++)),t}function hC(n,t){return n.backgroundColor=n.data.map(()=>Fb(t++)),t}function uC(n){let t=0;return(e,i)=>{const s=n.getDatasetMeta(i).controller;s instanceof rh?t=cC(e,t):s instanceof xb?t=hC(e,t):s&&(t=lC(e,t))}}function _d(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function fC(n){return n&&(n.borderColor||n.backgroundColor)}var dC={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;const{data:{datasets:i},options:s}=n.config,{elements:r}=s;if(!e.forceOverride&&(_d(i)||fC(s)||r&&_d(r)))return;const o=uC(n);i.forEach(o)}};function gC(n,t,e,i,s){const r=s.samples||i;if(r>=e)return n.slice(t,t+e);const o=[],a=(e-2)/(r-2);let l=0;const c=t+e-1;let h=t,u,f,d,g,p;for(o[l++]=n[h],u=0;ud&&(d=g,f=n[m],p=m);o[l++]=f,h=p}return o[l++]=n[c],o}function pC(n,t,e,i){let s=0,r=0,o,a,l,c,h,u,f,d,g,p;const y=[],x=t+e-1,m=n[t].x,b=n[x].x-m;for(o=t;op&&(p=c,f=o),s=(r*s+a.x)/++r;else{const w=o-1;if(!q(u)&&!q(f)){const M=Math.min(u,f),S=Math.max(u,f);M!==d&&M!==w&&y.push({...n[M],x:s}),S!==d&&S!==w&&y.push({...n[S],x:s})}o>0&&w!==d&&y.push(n[w]),y.push(a),h=_,r=0,g=p=c,u=f=d=o}}return y}function Bb(n){if(n._decimated){const t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function vd(n){n.data.datasets.forEach(t=>{Bb(t)})}function mC(n,t){const e=t.length;let i=0,s;const{iScale:r}=n,{min:o,max:a,minDefined:l,maxDefined:c}=r.getUserBounds();return l&&(i=Ct(Ue(t,r.axis,o).lo,0,e-1)),c?s=Ct(Ue(t,r.axis,a).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var bC={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){vd(n);return}const i=n.width;n.data.datasets.forEach((s,r)=>{const{_data:o,indexAxis:a}=s,l=n.getDatasetMeta(r),c=o||s.data;if(Ms([a,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const h=n.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||n.options.parsing)return;let{start:u,count:f}=mC(l,c);const d=e.threshold||4*i;if(f<=d){Bb(s);return}q(o)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(e.algorithm){case"lttb":g=gC(c,u,f,i,e);break;case"min-max":g=pC(c,u,f,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=g})},destroy(n){vd(n)}};function yC(n,t,e){const i=n.segments,s=n.points,r=t.points,o=[];for(const a of i){let{start:l,end:c}=a;c=ah(l,c,s);const h=Zl(e,s[l],s[c],a.loop);if(!t.segments){o.push({source:a,target:h,start:s[l],end:s[c]});continue}const u=bb(t,h);for(const f of u){const d=Zl(e,r[f.start],r[f.end],f.loop),g=mb(a,s,d);for(const p of g)o.push({source:p,target:f,start:{[e]:xd(h,d,"start",Math.max)},end:{[e]:xd(h,d,"end",Math.min)}})}}return o}function Zl(n,t,e,i){if(i)return;let s=t[n],r=e[n];return n==="angle"&&(s=Zt(s),r=Zt(r)),{property:n,start:s,end:r}}function _C(n,t){const{x:e=null,y:i=null}=n||{},s=t.points,r=[];return t.segments.forEach(({start:o,end:a})=>{a=ah(o,a,s);const l=s[o],c=s[a];i!==null?(r.push({x:l.x,y:i}),r.push({x:c.x,y:i})):e!==null&&(r.push({x:e,y:l.y}),r.push({x:e,y:c.y}))}),r}function ah(n,t,e){for(;t>n;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function xd(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function zb(n,t){let e=[],i=!1;return at(n)?(i=!0,e=n):e=_C(n,t),e.length?new ma({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function wd(n){return n&&n.fill!==!1}function vC(n,t,e){let s=n[t].fill;const r=[t];let o;if(!e)return s;for(;s!==!1&&r.indexOf(s)===-1;){if(!pt(s))return s;if(o=n[s],!o)return!1;if(o.visible)return s;r.push(s),s=o.fill}return!1}function xC(n,t,e){const i=kC(n);if($(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return pt(s)&&Math.floor(s)===s?wC(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function wC(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function SC(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:$(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function MC(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:$(n)?i=n.value:i=t.getBaseValue(),i}function kC(n){const t=n.options,e=t.fill;let i=V(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function PC(n){const{scale:t,index:e,line:i}=n,s=[],r=i.segments,o=i.points,a=AC(t,e);a.push(zb({x:null,y:t.bottom},i));for(let l=0;l=0;--o){const a=s[o].$filler;a&&(a.line.updateControlPoints(r,a.axis),i&&a.fill&&il(n.ctx,a,r))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const r=i[s].$filler;wd(r)&&il(n.ctx,r,n.chartArea)}},beforeDatasetDraw(n,t,e){const i=t.meta.$filler;!wd(i)||e.drawTime!=="beforeDatasetDraw"||il(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Pd=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},zC=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class Ad extends Je{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=ot(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=Mt(i.font),r=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Pd(i,r);let c,h;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(o,r,a,l)+10):(h=this.maxHeight,c=this._fitCols(o,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:r,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=s+a;let u=t;r.textAlign="left",r.textBaseline="middle";let f=-1,d=-h;return this.legendItems.forEach((g,p)=>{const y=i+e/2+r.measureText(g.text).width;(p===0||c[c.length-1]+y+2*a>o)&&(u+=h,c[c.length-(p>0?0:1)]=0,d+=h,f++),l[p]={left:0,top:d,row:f,width:y,height:s},c[c.length-1]+=y+a}),u}_fitCols(t,e,i,s){const{ctx:r,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=o-t;let u=a,f=0,d=0,g=0,p=0;return this.legendItems.forEach((y,x)=>{const{itemWidth:m,itemHeight:v}=NC(i,e,r,y,s);x>0&&d+v+2*a>h&&(u+=f+a,c.push({width:f,height:d}),g+=f+a,p++,f=d=0),l[x]={left:g,top:d,col:p,width:m,height:v},f=Math.max(f,m),d+=v+a}),u+=f,c.push({width:f,height:d}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:r}}=this,o=Mi(r,this.left,this.width);if(this.isHorizontal()){let a=0,l=Tt(i,this.left+s,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=Tt(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+s}else{let a=0,l=Tt(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=Tt(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;da(t,this),this._draw(),ga(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:r,labels:o}=t,a=mt.color,l=Mi(t.rtl,this.left,this.width),c=Mt(o.font),{padding:h}=o,u=c.size,f=u/2;let d;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:y}=Pd(o,u),x=function(w,M,S){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const P=V(S.lineWidth,1);if(s.fillStyle=V(S.fillStyle,a),s.lineCap=V(S.lineCap,"butt"),s.lineDashOffset=V(S.lineDashOffset,0),s.lineJoin=V(S.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=V(S.strokeStyle,a),s.setLineDash(V(S.lineDash,[])),o.usePointStyle){const C={radius:p*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:P},k=l.xPlus(w,g/2),A=M+f;rb(s,C,k,A,o.pointStyleWidth&&g)}else{const C=M+Math.max((u-p)/2,0),k=l.leftForLtr(w,g),A=qn(S.borderRadius);s.beginPath(),Object.values(A).some(L=>L!==0)?Js(s,{x:k,y:C,w:g,h:p,radius:A}):s.rect(k,C,g,p),s.fill(),P!==0&&s.stroke()}s.restore()},m=function(w,M,S){ti(s,S.text,w,M+y/2,c,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},v=this.isHorizontal(),b=this._computeTitleHeight();v?d={x:Tt(r,this.left+h,this.right-i[0]),y:this.top+h+b,line:0}:d={x:this.left+h,y:Tt(r,this.top+b+h,this.bottom-e[0].height),line:0},db(this.ctx,t.textDirection);const _=y+h;this.legendItems.forEach((w,M)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const S=s.measureText(w.text).width,P=l.textAlign(w.textAlign||(w.textAlign=o.textAlign)),C=g+f+S;let k=d.x,A=d.y;l.setWidth(this.width),v?M>0&&k+C+h>this.right&&(A=d.y+=_,d.line++,k=d.x=Tt(r,this.left+h,this.right-i[d.line])):M>0&&A+_>this.bottom&&(k=d.x=k+e[d.line].width+h,d.line++,A=d.y=Tt(r,this.top+b+h,this.bottom-e[d.line].height));const L=l.x(k);if(x(L,A,w),k=ZM(P,k+g+f,v?k+C:this.right,t.rtl),m(l.x(k),A,w),v)d.x+=C+h;else if(typeof w.text!="string"){const R=c.lineHeight;d.y+=Wb(w,R)+h}else d.y+=_}),gb(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Mt(e.font),s=Bt(e.padding);if(!e.display)return;const r=Mi(t.rtl,this.left,this.width),o=this.ctx,a=e.position,l=i.size/2,c=s.top+l;let h,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,u=Tt(t.align,u,this.right-f);else{const g=this.columnSizes.reduce((p,y)=>Math.max(p,y.height),0);h=c+Tt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const d=Tt(a,u,u+f);o.textAlign=r.textAlign(Zc(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,ti(o,e.text,d,h,i)}_computeTitleHeight(){const t=this.options.title,e=Mt(t.font),i=Bt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,r;if(Ye(t,this.left,this.right)&&Ye(e,this.top,this.bottom)){for(r=this.legendHitBoxes,i=0;ir.length>o.length?r:o)),t+e.size/2+i.measureText(s).width}function VC(n,t,e){let i=n;return typeof t.text!="string"&&(i=Wb(t,e)),i}function Wb(n,t){const e=n.text?n.text.length:0;return t*e}function jC(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var HC={id:"legend",_element:Ad,start(n,t,e){const i=n.legend=new Ad({ctx:n.ctx,options:e,chart:n});Rt.configure(n,i,e),Rt.addBox(n,i)},stop(n){Rt.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;Rt.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:r,useBorderRadius:o,borderRadius:a}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=Bt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:r,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class lh extends Je{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=at(i.text)?i.text.length:1;this._padding=Bt(i.padding);const r=s*Mt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:s,right:r,options:o}=this,a=o.align;let l=0,c,h,u;return this.isHorizontal()?(h=Tt(a,i,r),u=e+t,c=r-i):(o.position==="left"?(h=i+t,u=Tt(a,s,e),l=ct*-.5):(h=r-t,u=Tt(a,e,s),l=ct*.5),c=s-e),{titleX:h,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Mt(e.font),r=i.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(r);ti(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:Zc(e.align),textBaseline:"middle",translation:[o,a]})}}function $C(n,t){const e=new lh({ctx:n.ctx,options:t,chart:n});Rt.configure(n,e,t),Rt.addBox(n,e),n.titleBlock=e}var YC={id:"title",_element:lh,start(n,t,e){$C(n,e)},stop(n){const t=n.titleBlock;Rt.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){const i=n.titleBlock;Rt.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Lr=new WeakMap;var UC={id:"subtitle",start(n,t,e){const i=new lh({ctx:n.ctx,options:e,chart:n});Rt.configure(n,i,e),Rt.addBox(n,i),Lr.set(n,i)},stop(n){Rt.removeBox(n,Lr.get(n)),Lr.delete(n)},beforeUpdate(n,t,e){const i=Lr.get(n);Rt.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const As={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,r=0;for(t=0,e=n.length;ta+l)/i.size,y:s/r}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,r,o,a;for(r=0,o=n.length;ra({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=tb.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const r=i.items;let o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(r[o]=r[r.length-1],r.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};var Ie=new Xk;const jf="transparent",Gk={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=Lf(n||jf),s=i.valid&&Lf(t||jf);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};let qk=class{constructor(t,e,i,s){const r=e[i];s=Ms([t.to,s,r,t.from]);const o=Ms([t.from,r,s]);this._active=!0,this._fn=t.fn||Gk[t.type||typeof o],this._easing=Ns[t.easing]||Ns.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],r=i-this._start,o=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=Ms([t.to,e,s,t.from]),this._from=Ms([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,r=this._from,o=this._loop,a=this._to;let l;if(this._active=r!==a&&(o||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s{const r=t[s];if(!$(r))return;const o={};for(const a of e)o[a]=r[a];(at(r.properties)&&r.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,o)})})}_animateOptions(t,e){const i=e.options,s=Jk(t,i);if(!s)return[];const r=this._createAnimations(s,i);return i.$shared&&Kk(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,s=[],r=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=r[c];const f=i.get(c);if(u)if(f&&u.active()){u.update(f,h,a);continue}else u.cancel();if(!f||!f.duration){t[c]=h;continue}r[c]=u=new qk(f,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Ie.add(this._chart,i),!0}};function Kk(n,t){const e=[],i=Object.keys(t);for(let s=0;s0||!e&&r<0)return s.index}return null}function Xf(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:r,vScale:o,index:a}=i,l=r.axis,c=o.axis,h=eP(r,o,i),u=t.length;let f;for(let d=0;de[i].axis===t).shift()}function sP(n,t){return kn(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function rP(n,t,e){return kn(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Ki(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const r=s._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e],r[i]._visualValues!==void 0&&r[i]._visualValues[e]!==void 0&&delete r[i]._visualValues[e]}}}const Ka=n=>n==="reset"||n==="none",Gf=(n,t)=>t?n:Object.assign({},n),oP=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:_b(e,!0),values:null};var cs;let Pn=(cs=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Yf(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ki(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(u,f,d,g)=>u==="x"?f:u==="r"?g:d,r=e.xAxisID=V(i.xAxisID,qa(t,"x")),o=e.yAxisID=V(i.yAxisID,qa(t,"y")),a=e.rAxisID=V(i.rAxisID,qa(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,o,a),h=e.vAxisID=s(l,o,r,a);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Of(this._data,this),t._stacked&&Ki(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if($(e))this._data=tP(e);else if(i!==e){if(i){Of(i,this);const s=this._cachedMeta;Ki(s),s._parsed=[]}e&&Object.isExtensible(e)&&YM(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const r=e._stacked;e._stacked=Yf(e.vScale,e),e.stack!==i.stack&&(s=!0,Ki(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&Xf(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:o}=i,a=r.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,u,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{at(s[t])?f=this.parseArrayData(i,s,t,e):$(s[t])?f=this.parseObjectData(i,s,t,e):f=this.parsePrimitiveData(i,s,t,e);const d=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!g()){this.updateRangeFromParsed(c,t,d,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,r,o;for(s=0,r=e.length;s=0&&tthis.getContext(i,s,e),p=c.resolveNamedOptions(f,d,g,u);return p.$shared&&(p.$shared=l,r[o]=Object.freeze(Gf(p,l))),p}_resolveAnimations(t,e,i){const s=this.chart,r=this._cachedDataOpts,o=`animation-${e}`,a=r[o];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(f,this.getContext(t,i,e))}const c=new yb(s,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ka(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(i),o=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:o}}updateElement(t,e,i,s){Ka(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ka(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,r=e.length,o=Math.min(r,s);o&&this.parse(0,o),r>s?this._insertElements(s,r-s,t):r{for(c.length+=e,a=c.length-1;a>=o;a--)c[a]=c[a-e]};for(l(r),a=t;as-r))}return n._cache.$bar}function lP(n){const t=n.iScale,e=aP(t,n.type);let i=t._length,s,r,o,a;const l=()=>{o===32767||o===-32768||(Ks(a)&&(i=Math.min(i,Math.abs(o-a)||i)),a=o)};for(s=0,r=e.length;s0?s[n-1]:null,a=nMath.abs(a)&&(l=a,c=o),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:o,max:a}}function vb(n,t,e,i){return at(n)?uP(n,t,e,i):t[e.axis]=e.parse(n,i),t}function qf(n,t,e,i){const s=n.iScale,r=n.vScale,o=s.getLabels(),a=s===r,l=[];let c,h,u,f;for(c=e,h=e+i;c=e?1:-1)}function dP(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.basel.controller.options.grouped),r=i.options.stacked,o=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(q(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((r===!1||o.indexOf(l.stack)===-1||r===void 0&&l.stack===void 0)&&o.push(l.stack),l.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let r,o;for(r=0,o=e.data.length;r=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:r}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),l=r.getLabelForValue(o.y),c=o._custom;return{label:i[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=o.axis,u=a.axis;for(let f=e;fJs(v,a,l,!0)?1:Math.max(b,b*e,_,_*e),g=(v,b,_)=>Js(v,a,l,!0)?-1:Math.min(b,b*e,_,_*e),p=d(0,c,u),y=d(xt,h,f),x=g(ct,c,u),m=g(ct+xt,h,f);i=(p-x)/2,s=(y-m)/2,r=-(p+x)/2,o=-(y+m)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:o}}var pi;let rh=(pi=class extends Pn{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let r=l=>+i[l];if($(i[t])){const{key:l="value"}=this._parsing;r=c=>+pn(i[c],l)}let o,a;for(o=t,a=t+e;o0&&!isNaN(t)?lt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=hr(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,r,o,a,l;if(!t){for(s=0,r=i.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),D(pi,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,o)=>{const l=t.getDatasetMeta(0).controller.getStyle(o);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}}),pi);var fs;let vP=(fs=class extends Pn{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:r}=e,o=this.chart._animationsDisabled;let{start:a,count:l}=nb(e,s,o);this._drawStart=a,this._drawCount=l,ib(e)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),f=o.axis,d=a.axis,{spanGaps:g,segment:p}=this.options,y=Ei(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||r||s==="none",m=e+i,v=t.length;let b=e>0&&this.getParsed(e-1);for(let _=0;_=m){M.skip=!0;continue}const S=this.getParsed(_),P=q(S[d]),C=M[f]=o.getPixelForValue(S[f],_),k=M[d]=r||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[d],_);M.skip=isNaN(C)||isNaN(k)||P,M.stop=_>0&&Math.abs(S[f]-b[f])>y,p&&(M.parsed=S,M.raw=c.data[_]),u&&(M.options=h||this.resolveDataElementOptions(_,w.active?"active":s)),x||this.updateElement(w,_,M,s),b=S}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const r=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},D(fs,"id","line"),D(fs,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),D(fs,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}}),fs);var ds;let xb=(ds=class extends Pn{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=hr(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return ub.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(re.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),o=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),a=(r-o)/t.getVisibleDatasetCount();this.outerRadius=r-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){const r=s==="reset",o=this.chart,l=o.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,f=c.getIndexAngle(0)-.5*ct;let d=f,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?pe(this.resolveDataElementOptions(t,e).angle||i):0}},D(ds,"id","polarArea"),D(ds,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),D(ds,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,o)=>{const l=t.getDatasetMeta(0).controller.getStyle(o);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}}),ds);var qr;let xP=(qr=class extends rh{},D(qr,"id","pie"),D(qr,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"}),qr);var gs;let wP=(gs=class extends Pn{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return ub.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){const o=this.resolveDatasetElementOptions(t);this.options.showLine||(o.borderWidth=0);const a={_loop:!0,_fullLoop:r.length===s.length,options:o};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const r=this._cachedMeta.rScale,o=s==="reset";for(let a=e;a0&&this.getParsed(e-1);for(let b=e;b0&&Math.abs(w[d]-v[d])>x,y&&(M.parsed=w,M.raw=c.data[b]),f&&(M.options=u||this.resolveDataElementOptions(b,_.active?"active":s)),m||this.updateElement(_,b,M,s),v=w}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const r=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,o)/2}},D(ps,"id","scatter"),D(ps,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),D(ps,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}}),ps);var MP=Object.freeze({__proto__:null,BarController:bP,BubbleController:yP,DoughnutController:rh,LineController:vP,PieController:xP,PolarAreaController:xb,RadarController:wP,ScatterController:SP});function Ln(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class oh{constructor(t){D(this,"options");this.options=t||{}}static override(t){Object.assign(oh.prototype,t)}init(){}formats(){return Ln()}parse(){return Ln()}format(){return Ln()}add(){return Ln()}diff(){return Ln()}startOf(){return Ln()}endOf(){return Ln()}}var kP={_date:oh};function PP(n,t,e,i){const{controller:s,data:r,_sorted:o}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&o&&r.length){const l=a._reversePixels?HM:Ue;if(i){if(s._sharedOptions){const c=r[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(r,t,e-h),f=l(r,t,e+h);return{lo:u.lo,hi:f.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function ur(n,t,e,i,s){const r=n.getSortedVisibleDatasetMetas(),o=e[t];for(let a=0,l=r.length;a{l[o](t[e],s)&&(r.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:r}var DP={evaluateInteractionItems:ur,modes:{index(n,t,e,i){const s=Fn(t,n),r=e.axis||"x",o=e.includeInvisible||!1,a=e.intersect?Za(n,s,r,i,o):Qa(n,s,r,!1,i,o),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(n,t,e,i){const s=Fn(t,n),r=e.axis||"xy",o=e.includeInvisible||!1;let a=e.intersect?Za(n,s,r,i,o):Qa(n,s,r,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function Qf(n,t){return n.filter(e=>wb.indexOf(e.pos)===-1&&e.box.axis===t)}function Zi(n,t){return n.sort((e,i)=>{const s=t?i:e,r=t?e:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function EP(n){const t=[];let e,i,s,r,o,a;for(e=0,i=(n||[]).length;ec.box.fullSize),!0),i=Zi(Ji(t,"left"),!0),s=Zi(Ji(t,"right")),r=Zi(Ji(t,"top"),!0),o=Zi(Ji(t,"bottom")),a=Qf(t,"x"),l=Qf(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(o).concat(a),chartArea:Ji(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(o).concat(a)}}function td(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Sb(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function IP(n,t,e,i){const{pos:s,box:r}=e,o=n.maxPadding;if(!$(s)){e.size&&(n[s]-=e.size);const u=i[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?r.height:r.width),e.size=u.size/u.count,n[s]+=e.size}r.getPadding&&Sb(o,r.getPadding());const a=Math.max(0,t.outerWidth-td(o,n,"left","right")),l=Math.max(0,t.outerHeight-td(o,n,"top","bottom")),c=a!==n.w,h=l!==n.h;return n.w=a,n.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function FP(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function BP(n,t){const e=t.maxPadding;function i(s){const r={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{r[o]=Math.max(t[o],e[o])}),r}return i(n?["left","right"]:["top","bottom"])}function ks(n,t,e,i){const s=[];let r,o,a,l,c,h;for(r=0,o=n.length,c=0;r{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/h,hBoxMaxHeight:o/2}),f=Object.assign({},s);Sb(f,Nt(i));const d=Object.assign({maxPadding:f,w:r,h:o,x:s.left,y:s.top},s),g=TP(l.concat(c),u);ks(a.fullSize,d,u,g),ks(l,d,u,g),ks(c,d,u,g)&&ks(l,d,u,g),FP(d),ed(a.leftAndTop,d,u,g),d.x+=d.w,d.y+=d.h,ed(a.rightAndBottom,d,u,g),n.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},tt(a.chartArea,p=>{const y=p.box;Object.assign(y,n.chartArea),y.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})})}};let Mb=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}},zP=class extends Mb{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}};const uo="$chartjs",NP={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},nd=n=>n===null||n==="";function WP(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[uo]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",nd(s)){const r=zf(n,"width");r!==void 0&&(n.width=r)}if(nd(i))if(n.style.height==="")n.height=n.width/(t||2);else{const r=zf(n,"height");r!==void 0&&(n.height=r)}return n}const kb=Fk?{passive:!0}:!1;function VP(n,t,e){n&&n.addEventListener(t,e,kb)}function jP(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,kb)}function HP(n,t){const e=NP[n.type]||n.type,{x:i,y:s}=Fn(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Vo(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function $P(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Vo(a.addedNodes,i),o=o&&!Vo(a.removedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function YP(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Vo(a.removedNodes,i),o=o&&!Vo(a.addedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Qs=new Map;let id=0;function Pb(){const n=window.devicePixelRatio;n!==id&&(id=n,Qs.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function UP(n,t){Qs.size||window.addEventListener("resize",Pb),Qs.set(n,t)}function XP(n){Qs.delete(n),Qs.size||window.removeEventListener("resize",Pb)}function GP(n,t,e){const i=n.canvas,s=i&&sh(i);if(!s)return;const r=eb((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||r(c,h)});return o.observe(s),UP(n,r),o}function tl(n,t,e){e&&e.disconnect(),t==="resize"&&XP(n)}function qP(n,t,e){const i=n.canvas,s=eb(r=>{n.ctx!==null&&e(HP(r,n))},n);return VP(i,t,s),s}let KP=class extends Mb{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(WP(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[uo])return!1;const i=e[uo].initial;["height","width"].forEach(r=>{const o=i[r];q(o)?e.removeAttribute(r):e.setAttribute(r,o)});const s=i.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[uo],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),o={attach:$P,detach:YP,resize:GP}[e]||qP;s[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:tl,detach:tl,resize:tl}[e]||jP)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Ik(t,e,i,s)}isAttached(t){const e=sh(t);return!!(e&&e.isConnected)}};function JP(n){return!ih()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?zP:KP}var Kr;let Je=(Kr=class{constructor(){D(this,"x");D(this,"y");D(this,"active",!1);D(this,"options");D(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Ei(this.x)&&Ei(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(r=>{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}},D(Kr,"defaults",{}),D(Kr,"defaultRoutes"),Kr);function ZP(n,t){const e=n.options.ticks,i=QP(n),s=Math.min(e.maxTicksLimit||i,i),r=e.major.enabled?eA(t):[],o=r.length,a=r[0],l=r[o-1],c=[];if(o>s)return nA(t,c,r,o/s),c;const h=tA(r,t,s);if(o>0){let u,f;const d=o>1?Math.round((l-a)/(o-1)):null;for(Cr(t,c,h,q(d)?0:a-d,a),u=0,f=o-1;us)return l}return Math.max(s,1)}function eA(n){const t=[];let e,i;for(e=0,i=n.length;en==="left"?"right":n==="right"?"left":n,sd=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,rd=(n,t)=>Math.min(t||n,n);function od(n,t){const e=[],i=n.length/t,s=n.length;let r=0;for(;ro+a)))return l}function oA(n,t){tt(n,e=>{const i=e.gc,s=i.length/2;let r;if(s>t){for(r=0;ri?i:e,i=s&&e>i?e:i,{min:Kt(e,Kt(i,e)),max:Kt(i,Kt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ot(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=dk(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,f=h.highest.height,d=Ot(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/i:d/(i-1),u+6>a&&(a=d/(i-(t.offset?.5:1)),l=this.maxHeight-Qi(t.grid)-e.padding-ad(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),o=qc(Math.min(Math.asin(Ot((h.highest.height+6)/a,-1,1)),Math.asin(Ot(l/c,-1,1))-Math.asin(Ot(f/c,-1,1)))),o=Math.max(s,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){ot(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ot(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=ad(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Qi(r)+l):(t.height=this.maxHeight,t.width=Qi(r)+l),i.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:f}=this._getLabelSizes(),d=i.padding*2,g=pe(this.labelRotation),p=Math.cos(g),y=Math.sin(g);if(a){const x=i.mirror?0:y*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+x+d)}else{const x=i.mirror?0:p*u.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+x+d)}this._calculatePadding(c,h,y,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,d=0;l?c?(f=s*t.width,d=i*e.height):(f=i*t.height,d=s*e.width):r==="start"?d=e.width:r==="end"?f=t.width:r!=="inner"&&(f=t.width/2,d=e.width/2),this.paddingLeft=Math.max((f-h+o)*this.width/(this.width-h),0),this.paddingRight=Math.max((d-u+o)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;r==="start"?(h=0,u=t.height):r==="end"&&(h=e.height,u=0),this.paddingTop=h+o,this.paddingBottom=u+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ot(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:o[P]||0,height:a[P]||0});return{first:S(0),last:S(e-1),widest:S(w),highest:S(M),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return jM(this._alignToPixels?En(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:r,position:o,border:a}=s,l=r.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=Qi(r),d=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,y=p/2,x=function(E){return En(i,E,p)};let m,v,b,_,w,M,S,P,C,k,A,L;if(o==="top")m=x(this.bottom),M=this.bottom-f,P=m-y,k=x(t.top)+y,L=t.bottom;else if(o==="bottom")m=x(this.top),k=t.top,L=x(t.bottom)-y,M=m+y,P=this.top+f;else if(o==="left")m=x(this.right),w=this.right-f,S=m-y,C=x(t.left)+y,A=t.right;else if(o==="right")m=x(this.left),C=t.left,A=x(t.right)-y,w=m+y,S=this.left+f;else if(e==="x"){if(o==="center")m=x((t.top+t.bottom)/2+.5);else if($(o)){const E=Object.keys(o)[0],I=o[E];m=x(this.chart.scales[E].getPixelForValue(I))}k=t.top,L=t.bottom,M=m+y,P=M+f}else if(e==="y"){if(o==="center")m=x((t.left+t.right)/2);else if($(o)){const E=Object.keys(o)[0],I=o[E];m=x(this.chart.scales[E].getPixelForValue(I))}w=m-y,S=w-f,C=t.left,A=t.right}const R=V(s.ticks.maxTicksLimit,u),O=Math.max(1,Math.ceil(u/R));for(v=0;v0&&(dt-=Vt/2);break}St={left:dt,top:Gt,width:Vt+st.width,height:jt+st.height,color:O.backdropColor}}y.push({label:b,font:P,textOffset:A,options:{rotation:p,color:I,strokeColor:X,strokeWidth:Z,textAlign:ht,textBaseline:L,translation:[_,w],backdrop:St}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-pe(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:r}}=this.options,o=this._getLabelSizes(),a=t+r,l=o.widest.width;let c,h;return e==="left"?s?(h=this.right+r,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?s?(h=this.left+r,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:r,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,r,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(r=>r.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,o;const a=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,o=s.length;r{this.draw(r)}}]:[{z:i,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let r,o;for(r=0,o=e.length;r{const i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),o=t[e].split("."),a=o.pop(),l=o.join(".");bt.route(r,s,l,a)})}function dA(n){return"id"in n&&"defaults"in n}let gA=class{constructor(){this.controllers=new Or(Pn,"datasets",!0),this.elements=new Or(Je,"elements"),this.plugins=new Or(Object,"plugins"),this.scales=new Or(fr,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):tt(s,o=>{const a=i||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,e,i){const s=Gc(t);ot(i["before"+s],[],i),e[t](i),ot(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;er.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}};function mA(n){const t={},e=[],i=Object.keys(Se.plugins.items);for(let r=0;r1&&ld(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function cd(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function SA(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return cd(n,"x",e[0])||cd(n,"y",e[0])}return{}}function MA(n,t){const e=Qn[n.type]||{scales:{}},i=t.scales||{},s=Xl(n.type,t),r=Object.create(null);return Object.keys(i).forEach(o=>{const a=i[o];if(!$(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const l=Gl(o,a,SA(o,n),bt.scales[a.type]),c=xA(l,s),h=e.scales||{};r[o]=Bs(Object.create(null),[{axis:l},a,h[l],h[c]])}),n.data.datasets.forEach(o=>{const a=o.type||n.type,l=o.indexAxis||Xl(a,t),h=(Qn[a]||{}).scales||{};Object.keys(h).forEach(u=>{const f=vA(u,l),d=o[f+"AxisID"]||f;r[d]=r[d]||Object.create(null),Bs(r[d],[{axis:f},i[d],h[u]])})}),Object.keys(r).forEach(o=>{const a=r[o];Bs(a,[bt.scales[a.type],bt.scale])}),r}function Cb(n){const t=n.options||(n.options={});t.plugins=V(t.plugins,{}),t.scales=MA(n,t)}function Ob(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function kA(n){return n=n||{},n.data=Ob(n.data),Cb(n),n}const hd=new Map,Db=new Set;function Dr(n,t){let e=hd.get(n);return e||(e=t(),hd.set(n,e),Db.add(e)),e}const ts=(n,t,e)=>{const i=pn(t,e);i!==void 0&&n.add(i)};let PA=class{constructor(t){this._config=kA(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ob(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Cb(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Dr(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Dr(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Dr(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return Dr(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:r}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>ts(l,t,u))),h.forEach(u=>ts(l,s,u)),h.forEach(u=>ts(l,Qn[r]||{},u)),h.forEach(u=>ts(l,bt,u)),h.forEach(u=>ts(l,Yl,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Db.has(e)&&o.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Qn[e]||{},bt.datasets[e]||{},{type:e},bt,Yl]}resolveNamedOptions(t,e,i,s=[""]){const r={$shared:!0},{resolver:o,subPrefixes:a}=ud(this._resolverCache,t,s);let l=o;if(CA(o,e)){r.$shared=!1,i=mn(i)?i():i;const c=this.createResolver(t,i,a);l=Li(o,i,c)}for(const c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){const{resolver:r}=ud(this._resolverCache,t,i);return $(e)?Li(r,e,void 0,s):r}};function ud(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let r=i.get(s);return r||(r={resolver:th(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,r)),r}const AA=n=>$(n)&&Object.getOwnPropertyNames(n).some(t=>mn(n[t]));function CA(n,t){const{isScriptable:e,isIndexable:i}=ab(n);for(const s of t){const r=e(s),o=i(s),a=(o||r)&&n[s];if(r&&(mn(a)||AA(a))||o&&at(a))return!0}return!1}var OA="4.4.2";const DA=["top","bottom","left","right","chartArea"];function fd(n,t){return n==="top"||n==="bottom"||DA.indexOf(n)===-1&&t==="x"}function dd(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function gd(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ot(e&&e.onComplete,[n],t)}function EA(n){const t=n.chart,e=t.options.animation;ot(e&&e.onProgress,[n],t)}function Eb(n){return ih()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const fo={},pd=n=>{const t=Eb(n);return Object.values(fo).filter(e=>e.canvas===t).pop()};function LA(n,t,e){const i=Object.keys(n);for(const s of i){const r=+s;if(r>=t){const o=n[s];delete n[s],(e>0||r>t)&&(n[r+e]=o)}}}function TA(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function Er(n,t,e){return n.options.clip?n[e]:t[e]}function RA(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:Er(e,t,"left"),right:Er(e,t,"right"),top:Er(i,t,"top"),bottom:Er(i,t,"bottom")}:t}var en;let Ps=(en=class{static register(...t){Se.add(...t),md()}static unregister(...t){Se.remove(...t),md()}constructor(t,e){const i=this.config=new PA(e),s=Eb(t),r=pd(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||JP(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=DM(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new pA,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=UM(u=>this.update(u),o.resizeDelay||0),this._dataChanges=[],fo[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Ie.listen(this,"complete",gd),Ie.listen(this,"progress",EA),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return q(t)?e&&r?r:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Se}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Bf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Rf(this.canvas,this.ctx),this}stop(){return Ie.stop(this),this}resize(t,e){Ie.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,r),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Bf(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),ot(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};tt(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let r=[];e&&(r=r.concat(Object.keys(e).map(o=>{const a=e[o],l=Gl(o,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),tt(r,o=>{const a=o.options,l=a.id,c=Gl(l,a),h=V(a.type,o.dtype);(a.position===void 0||fd(a.position,c)!==fd(o.dposition))&&(a.position=o.dposition),s[l]=!0;let u=null;if(l in i&&i[l].type===h)u=i[l];else{const f=Se.getScale(h);u=new f({id:l,type:h,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(a,t)}),tt(s,(o,a)=>{o||delete i[a]}),tt(i,o=>{It.configure(this,o,o.options),It.addBox(this,o)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;se.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(dd("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){tt(this.scales,t=>{It.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!kf(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:r}of e){const o=i==="_removeElements"?-r:r;LA(t,s,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=r=>new Set(t.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),s=i(0);for(let r=1;rr.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;It.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],tt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,r=RA(t,this.chartArea),o={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&da(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),s&&ga(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return Xe(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const r=DP.modes[e];return typeof r=="function"?r(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=kn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",r=this.getDatasetMeta(t),o=r.controller._resolveAnimations(void 0,s);Ks(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(r,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Ie.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,r,o),t[r]=o},s=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};tt(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",r),i("detach",o)};o=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){tt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},tt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let r,o,a,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!Fo(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,r=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),o=r(e,t),a=i?t:r(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:r}=this,o=e,a=this._getActiveElements(t,s,i,o),l=FM(t),c=TA(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ot(r.onHover,[t,a,this],this),l&&ot(r.onClick,[t,a,this],this));const h=!Fo(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}},D(en,"defaults",bt),D(en,"instances",fo),D(en,"overrides",Qn),D(en,"registry",Se),D(en,"version",OA),D(en,"getChart",pd),en);function md(){return tt(Ps.instances,n=>n._plugins.invalidate())}function IA(n,t,e){const{startAngle:i,pixelMargin:s,x:r,y:o,outerRadius:a,innerRadius:l}=t;let c=s/a;n.beginPath(),n.arc(r,o,a,i-c,e+c),l>s?(c=s/l,n.arc(r,o,l,e+c,i-c,!0)):n.arc(r,o,s,e+xt,i-xt),n.closePath(),n.clip()}function FA(n){return Qc(n,["outerStart","outerEnd","innerStart","innerEnd"])}function BA(n,t,e,i){const s=FA(n.options.borderRadius),r=(e-t)/2,o=Math.min(r,i*t/2),a=l=>{const c=(e-Math.min(r,l))*i/2;return Ot(l,0,Math.min(r,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Ot(s.innerStart,0,o),innerEnd:Ot(s.innerEnd,0,o)}}function hi(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function jo(n,t,e,i,s,r){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+i+e-c,0),f=h>0?h+i+e+c:0;let d=0;const g=s-l;if(i){const O=h>0?h-i:0,E=u>0?u-i:0,I=(O+E)/2,X=I!==0?g*I/(I+i):g;d=(g-X)/2}const p=Math.max(.001,g*u-e/ct)/u,y=(g-p)/2,x=l+y+d,m=s-y-d,{outerStart:v,outerEnd:b,innerStart:_,innerEnd:w}=BA(t,f,u,m-x),M=u-v,S=u-b,P=x+v/M,C=m-b/S,k=f+_,A=f+w,L=x+_/k,R=m-w/A;if(n.beginPath(),r){const O=(P+C)/2;if(n.arc(o,a,u,P,O),n.arc(o,a,u,O,C),b>0){const Z=hi(S,C,o,a);n.arc(Z.x,Z.y,b,C,m+xt)}const E=hi(A,m,o,a);if(n.lineTo(E.x,E.y),w>0){const Z=hi(A,R,o,a);n.arc(Z.x,Z.y,w,m+xt,R+Math.PI)}const I=(m-w/f+(x+_/f))/2;if(n.arc(o,a,f,m-w/f,I,!0),n.arc(o,a,f,I,x+_/f,!0),_>0){const Z=hi(k,L,o,a);n.arc(Z.x,Z.y,_,L+Math.PI,x-xt)}const X=hi(M,x,o,a);if(n.lineTo(X.x,X.y),v>0){const Z=hi(M,P,o,a);n.arc(Z.x,Z.y,v,x-xt,P)}}else{n.moveTo(o,a);const O=Math.cos(P)*u+o,E=Math.sin(P)*u+a;n.lineTo(O,E);const I=Math.cos(C)*u+o,X=Math.sin(C)*u+a;n.lineTo(I,X)}n.closePath()}function zA(n,t,e,i,s){const{fullCircles:r,startAngle:o,circumference:a}=t;let l=t.endAngle;if(r){jo(n,t,e,i,l,s);for(let c=0;c=lt||Js(o,l,c),y=Ye(a,h+d,u+d);return p&&y}getCenterPoint(e){const{x:i,y:s,startAngle:r,endAngle:o,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,u=(r+o)/2,f=(a+l+h+c)/2;return{x:i+Math.cos(u)*f,y:s+Math.sin(u)*f}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:i,circumference:s}=this,r=(i.offset||0)/4,o=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=s>lt?Math.floor(s/lt):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*r,Math.sin(l)*r);const c=1-Math.sin(Math.min(ct,s||0)),h=r*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,zA(e,this,h,o,a),NA(e,this,h,o,a),e.restore()}},D(mi,"id","arc"),D(mi,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),D(mi,"defaultRoutes",{backgroundColor:"backgroundColor"}),D(mi,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"}),mi);function Lb(n,t,e=t){n.lineCap=V(e.borderCapStyle,t.borderCapStyle),n.setLineDash(V(e.borderDash,t.borderDash)),n.lineDashOffset=V(e.borderDashOffset,t.borderDashOffset),n.lineJoin=V(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=V(e.borderWidth,t.borderWidth),n.strokeStyle=V(e.borderColor,t.borderColor)}function VA(n,t,e){n.lineTo(e.x,e.y)}function jA(n){return n.stepped?sk:n.tension||n.cubicInterpolationMode==="monotone"?rk:VA}function Tb(n,t,e={}){const i=n.length,{start:s=0,end:r=i-1}=e,{start:o,end:a}=t,l=Math.max(s,o),c=Math.min(r,a),h=sa&&r>a;return{count:i,start:l,loop:t.loop,ilen:c(o+(c?a-b:b))%r,v=()=>{p!==y&&(n.lineTo(h,y),n.lineTo(h,p),n.lineTo(h,x))};for(l&&(d=s[m(0)],n.moveTo(d.x,d.y)),f=0;f<=a;++f){if(d=s[m(f)],d.skip)continue;const b=d.x,_=d.y,w=b|0;w===g?(_y&&(y=_),h=(u*h+b)/++u):(v(),n.lineTo(b,_),g=w,u=0,p=y=_),x=_}v()}function ql(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?$A:HA}function YA(n){return n.stepped?Bk:n.tension||n.cubicInterpolationMode==="monotone"?zk:Bn}function UA(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),Lb(n,t.options),n.stroke(s)}function XA(n,t,e,i){const{segments:s,options:r}=t,o=ql(t);for(const a of s)Lb(n,r,a.style),n.beginPath(),o(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const GA=typeof Path2D=="function";function qA(n,t,e,i){GA&&!t.options.segment?UA(n,t,e,i):XA(n,t,e,i)}var bi;let ma=(bi=class extends Je{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Ok(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=$k(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],r=this.points,o=bb(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],l=YA(i);let c,h;for(c=0,h=o.length;ct!=="borderDash"&&t!=="fill"}),bi);function bd(n,t,e,i){const s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)n.replace("rgb(","rgba(").replace(")",", 0.5)"));function Ib(n){return Kl[n%Kl.length]}function Fb(n){return yd[n%yd.length]}function sC(n,t){return n.borderColor=Ib(t),n.backgroundColor=Fb(t),++t}function rC(n,t){return n.backgroundColor=n.data.map(()=>Ib(t++)),t}function oC(n,t){return n.backgroundColor=n.data.map(()=>Fb(t++)),t}function aC(n){let t=0;return(e,i)=>{const s=n.getDatasetMeta(i).controller;s instanceof rh?t=rC(e,t):s instanceof xb?t=oC(e,t):s&&(t=sC(e,t))}}function _d(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function lC(n){return n&&(n.borderColor||n.backgroundColor)}var cC={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;const{data:{datasets:i},options:s}=n.config,{elements:r}=s;if(!e.forceOverride&&(_d(i)||lC(s)||r&&_d(r)))return;const o=aC(n);i.forEach(o)}};function hC(n,t,e,i,s){const r=s.samples||i;if(r>=e)return n.slice(t,t+e);const o=[],a=(e-2)/(r-2);let l=0;const c=t+e-1;let h=t,u,f,d,g,p;for(o[l++]=n[h],u=0;ud&&(d=g,f=n[m],p=m);o[l++]=f,h=p}return o[l++]=n[c],o}function uC(n,t,e,i){let s=0,r=0,o,a,l,c,h,u,f,d,g,p;const y=[],x=t+e-1,m=n[t].x,b=n[x].x-m;for(o=t;op&&(p=c,f=o),s=(r*s+a.x)/++r;else{const w=o-1;if(!q(u)&&!q(f)){const M=Math.min(u,f),S=Math.max(u,f);M!==d&&M!==w&&y.push({...n[M],x:s}),S!==d&&S!==w&&y.push({...n[S],x:s})}o>0&&w!==d&&y.push(n[w]),y.push(a),h=_,r=0,g=p=c,u=f=d=o}}return y}function Bb(n){if(n._decimated){const t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function vd(n){n.data.datasets.forEach(t=>{Bb(t)})}function fC(n,t){const e=t.length;let i=0,s;const{iScale:r}=n,{min:o,max:a,minDefined:l,maxDefined:c}=r.getUserBounds();return l&&(i=Ot(Ue(t,r.axis,o).lo,0,e-1)),c?s=Ot(Ue(t,r.axis,a).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var dC={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){vd(n);return}const i=n.width;n.data.datasets.forEach((s,r)=>{const{_data:o,indexAxis:a}=s,l=n.getDatasetMeta(r),c=o||s.data;if(Ms([a,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const h=n.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||n.options.parsing)return;let{start:u,count:f}=fC(l,c);const d=e.threshold||4*i;if(f<=d){Bb(s);return}q(o)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(e.algorithm){case"lttb":g=hC(c,u,f,i,e);break;case"min-max":g=uC(c,u,f,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=g})},destroy(n){vd(n)}};function gC(n,t,e){const i=n.segments,s=n.points,r=t.points,o=[];for(const a of i){let{start:l,end:c}=a;c=ah(l,c,s);const h=Jl(e,s[l],s[c],a.loop);if(!t.segments){o.push({source:a,target:h,start:s[l],end:s[c]});continue}const u=bb(t,h);for(const f of u){const d=Jl(e,r[f.start],r[f.end],f.loop),g=mb(a,s,d);for(const p of g)o.push({source:p,target:f,start:{[e]:xd(h,d,"start",Math.max)},end:{[e]:xd(h,d,"end",Math.min)}})}}return o}function Jl(n,t,e,i){if(i)return;let s=t[n],r=e[n];return n==="angle"&&(s=Jt(s),r=Jt(r)),{property:n,start:s,end:r}}function pC(n,t){const{x:e=null,y:i=null}=n||{},s=t.points,r=[];return t.segments.forEach(({start:o,end:a})=>{a=ah(o,a,s);const l=s[o],c=s[a];i!==null?(r.push({x:l.x,y:i}),r.push({x:c.x,y:i})):e!==null&&(r.push({x:e,y:l.y}),r.push({x:e,y:c.y}))}),r}function ah(n,t,e){for(;t>n;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function xd(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function zb(n,t){let e=[],i=!1;return at(n)?(i=!0,e=n):e=pC(n,t),e.length?new ma({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function wd(n){return n&&n.fill!==!1}function mC(n,t,e){let s=n[t].fill;const r=[t];let o;if(!e)return s;for(;s!==!1&&r.indexOf(s)===-1;){if(!mt(s))return s;if(o=n[s],!o)return!1;if(o.visible)return s;r.push(s),s=o.fill}return!1}function bC(n,t,e){const i=xC(n);if($(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return mt(s)&&Math.floor(s)===s?yC(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function yC(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function _C(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:$(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function vC(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:$(n)?i=n.value:i=t.getBaseValue(),i}function xC(n){const t=n.options,e=t.fill;let i=V(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function wC(n){const{scale:t,index:e,line:i}=n,s=[],r=i.segments,o=i.points,a=SC(t,e);a.push(zb({x:null,y:t.bottom},i));for(let l=0;l=0;--o){const a=s[o].$filler;a&&(a.line.updateControlPoints(r,a.axis),i&&a.fill&&il(n.ctx,a,r))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const r=i[s].$filler;wd(r)&&il(n.ctx,r,n.chartArea)}},beforeDatasetDraw(n,t,e){const i=t.meta.$filler;!wd(i)||e.drawTime!=="beforeDatasetDraw"||il(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Pd=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},RC=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class Ad extends Je{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=ot(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=Mt(i.font),r=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Pd(i,r);let c,h;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(o,r,a,l)+10):(h=this.maxHeight,c=this._fitCols(o,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:r,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=s+a;let u=t;r.textAlign="left",r.textBaseline="middle";let f=-1,d=-h;return this.legendItems.forEach((g,p)=>{const y=i+e/2+r.measureText(g.text).width;(p===0||c[c.length-1]+y+2*a>o)&&(u+=h,c[c.length-(p>0?0:1)]=0,d+=h,f++),l[p]={left:0,top:d,row:f,width:y,height:s},c[c.length-1]+=y+a}),u}_fitCols(t,e,i,s){const{ctx:r,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=o-t;let u=a,f=0,d=0,g=0,p=0;return this.legendItems.forEach((y,x)=>{const{itemWidth:m,itemHeight:v}=IC(i,e,r,y,s);x>0&&d+v+2*a>h&&(u+=f+a,c.push({width:f,height:d}),g+=f+a,p++,f=d=0),l[x]={left:g,top:d,col:p,width:m,height:v},f=Math.max(f,m),d+=v+a}),u+=f,c.push({width:f,height:d}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:r}}=this,o=Mi(r,this.left,this.width);if(this.isHorizontal()){let a=0,l=Tt(i,this.left+s,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=Tt(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+s}else{let a=0,l=Tt(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=Tt(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;da(t,this),this._draw(),ga(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:r,labels:o}=t,a=bt.color,l=Mi(t.rtl,this.left,this.width),c=Mt(o.font),{padding:h}=o,u=c.size,f=u/2;let d;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:y}=Pd(o,u),x=function(w,M,S){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const P=V(S.lineWidth,1);if(s.fillStyle=V(S.fillStyle,a),s.lineCap=V(S.lineCap,"butt"),s.lineDashOffset=V(S.lineDashOffset,0),s.lineJoin=V(S.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=V(S.strokeStyle,a),s.setLineDash(V(S.lineDash,[])),o.usePointStyle){const C={radius:p*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:P},k=l.xPlus(w,g/2),A=M+f;rb(s,C,k,A,o.pointStyleWidth&&g)}else{const C=M+Math.max((u-p)/2,0),k=l.leftForLtr(w,g),A=qn(S.borderRadius);s.beginPath(),Object.values(A).some(L=>L!==0)?Zs(s,{x:k,y:C,w:g,h:p,radius:A}):s.rect(k,C,g,p),s.fill(),P!==0&&s.stroke()}s.restore()},m=function(w,M,S){ti(s,S.text,w,M+y/2,c,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},v=this.isHorizontal(),b=this._computeTitleHeight();v?d={x:Tt(r,this.left+h,this.right-i[0]),y:this.top+h+b,line:0}:d={x:this.left+h,y:Tt(r,this.top+b+h,this.bottom-e[0].height),line:0},db(this.ctx,t.textDirection);const _=y+h;this.legendItems.forEach((w,M)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const S=s.measureText(w.text).width,P=l.textAlign(w.textAlign||(w.textAlign=o.textAlign)),C=g+f+S;let k=d.x,A=d.y;l.setWidth(this.width),v?M>0&&k+C+h>this.right&&(A=d.y+=_,d.line++,k=d.x=Tt(r,this.left+h,this.right-i[d.line])):M>0&&A+_>this.bottom&&(k=d.x=k+e[d.line].width+h,d.line++,A=d.y=Tt(r,this.top+b+h,this.bottom-e[d.line].height));const L=l.x(k);if(x(L,A,w),k=XM(P,k+g+f,v?k+C:this.right,t.rtl),m(l.x(k),A,w),v)d.x+=C+h;else if(typeof w.text!="string"){const R=c.lineHeight;d.y+=Wb(w,R)+h}else d.y+=_}),gb(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Mt(e.font),s=Nt(e.padding);if(!e.display)return;const r=Mi(t.rtl,this.left,this.width),o=this.ctx,a=e.position,l=i.size/2,c=s.top+l;let h,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,u=Tt(t.align,u,this.right-f);else{const g=this.columnSizes.reduce((p,y)=>Math.max(p,y.height),0);h=c+Tt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const d=Tt(a,u,u+f);o.textAlign=r.textAlign(Jc(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,ti(o,e.text,d,h,i)}_computeTitleHeight(){const t=this.options.title,e=Mt(t.font),i=Nt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,r;if(Ye(t,this.left,this.right)&&Ye(e,this.top,this.bottom)){for(r=this.legendHitBoxes,i=0;ir.length>o.length?r:o)),t+e.size/2+i.measureText(s).width}function BC(n,t,e){let i=n;return typeof t.text!="string"&&(i=Wb(t,e)),i}function Wb(n,t){const e=n.text?n.text.length:0;return t*e}function zC(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var NC={id:"legend",_element:Ad,start(n,t,e){const i=n.legend=new Ad({ctx:n.ctx,options:e,chart:n});It.configure(n,i,e),It.addBox(n,i)},stop(n){It.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;It.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:r,useBorderRadius:o,borderRadius:a}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=Nt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:r,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class lh extends Je{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=at(i.text)?i.text.length:1;this._padding=Nt(i.padding);const r=s*Mt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:s,right:r,options:o}=this,a=o.align;let l=0,c,h,u;return this.isHorizontal()?(h=Tt(a,i,r),u=e+t,c=r-i):(o.position==="left"?(h=i+t,u=Tt(a,s,e),l=ct*-.5):(h=r-t,u=Tt(a,e,s),l=ct*.5),c=s-e),{titleX:h,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Mt(e.font),r=i.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(r);ti(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:Jc(e.align),textBaseline:"middle",translation:[o,a]})}}function WC(n,t){const e=new lh({ctx:n.ctx,options:t,chart:n});It.configure(n,e,t),It.addBox(n,e),n.titleBlock=e}var VC={id:"title",_element:lh,start(n,t,e){WC(n,e)},stop(n){const t=n.titleBlock;It.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){const i=n.titleBlock;It.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Lr=new WeakMap;var jC={id:"subtitle",start(n,t,e){const i=new lh({ctx:n.ctx,options:e,chart:n});It.configure(n,i,e),It.addBox(n,i),Lr.set(n,i)},stop(n){It.removeBox(n,Lr.get(n)),Lr.delete(n)},beforeUpdate(n,t,e){const i=Lr.get(n);It.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const As={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,r=0;for(t=0,e=n.length;ta+l)/i.size,y:s/r}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,r,o,a;for(r=0,o=n.length;r-1?n.split(` -`):n}function XC(n,t){const{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:n,label:o,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Cd(n,t){const e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:o,boxHeight:a}=t,l=Mt(t.bodyFont),c=Mt(t.titleFont),h=Mt(t.footerFont),u=r.length,f=s.length,d=i.length,g=Bt(t.padding);let p=g.height,y=0,x=i.reduce((b,_)=>b+_.before.length+_.lines.length+_.after.length,0);if(x+=n.beforeBody.length+n.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),x){const b=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=d*b+(x-d)*l.lineHeight+(x-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let m=0;const v=function(b){y=Math.max(y,e.measureText(b).width+m)};return e.save(),e.font=c.string,tt(n.title,v),e.font=l.string,tt(n.beforeBody.concat(n.afterBody),v),m=t.displayColors?o+2+t.boxPadding:0,tt(i,b=>{tt(b.before,v),tt(b.lines,v),tt(b.after,v)}),m=0,e.font=h.string,tt(n.footer,v),e.restore(),y+=g.width,{width:y,height:p}}function GC(n,t){const{y:e,height:i}=t;return en.height-i/2?"bottom":"center"}function qC(n,t,e,i){const{x:s,width:r}=i,o=e.caretSize+e.caretPadding;if(n==="left"&&s+r+o>t.width||n==="right"&&s-r-o<0)return!0}function KC(n,t,e,i){const{x:s,width:r}=e,{width:o,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),qC(c,n,t,e)&&(c="center"),c}function Od(n,t,e){const i=e.yAlign||t.yAlign||GC(n,e);return{xAlign:e.xAlign||t.xAlign||KC(n,t,e,i),yAlign:i}}function ZC(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function JC(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Dd(n,t,e,i){const{caretSize:s,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=e,c=s+r,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:d}=qn(o);let g=ZC(t,a);const p=JC(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,f)+s:a==="right"&&(g+=Math.max(u,d)+s),{x:Ct(g,0,i.width-t.width),y:Ct(p,0,i.height-t.height)}}function Tr(n,t,e){const i=Bt(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Ed(n){return xe([],Fe(n))}function QC(n,t,e){return kn(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ld(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const Vb={beforeTitle:Re,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?Vb[t].call(e,i):s}var yl;let Td=(yl=class extends Je{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new yb(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=QC(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=Ht(i,"beforeTitle",this,t),r=Ht(i,"title",this,t),o=Ht(i,"afterTitle",this,t);let a=[];return a=xe(a,Fe(s)),a=xe(a,Fe(r)),a=xe(a,Fe(o)),a}getBeforeBody(t,e){return Ed(Ht(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return tt(t,r=>{const o={before:[],lines:[],after:[]},a=Ld(i,r);xe(o.before,Fe(Ht(a,"beforeLabel",this,r))),xe(o.lines,Ht(a,"label",this,r)),xe(o.after,Fe(Ht(a,"afterLabel",this,r))),s.push(o)}),s}getAfterBody(t,e){return Ed(Ht(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Ht(i,"beforeFooter",this,t),r=Ht(i,"footer",this,t),o=Ht(i,"afterFooter",this,t);let a=[];return a=xe(a,Fe(s)),a=xe(a,Fe(r)),a=xe(a,Fe(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],r=[],o=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,f,i))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,i))),tt(a,h=>{const u=Ld(t.callbacks,h);s.push(Ht(u,"labelColor",this,h)),r.push(Ht(u,"labelPointStyle",this,h)),o.push(Ht(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let r,o=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const a=As[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=Cd(this,i),c=Object.assign({},a,l),h=Od(this.chart,i,c),u=Dd(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,r={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:r}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=qn(a),{x:f,y:d}=t,{width:g,height:p}=e;let y,x,m,v,b,_;return r==="center"?(b=d+p/2,s==="left"?(y=f,x=y-o,v=b+o,_=b-o):(y=f+g,x=y+o,v=b-o,_=b+o),m=y):(s==="left"?x=f+Math.max(l,h)+o:s==="right"?x=f+g-Math.max(c,u)-o:x=this.caretX,r==="top"?(v=d,b=v-o,y=x-o,m=x+o):(v=d+p,b=v+o,y=x+o,m=x-o),_=v),{x1:y,x2:x,x3:m,y1:v,y2:b,y3:_}}drawTitle(t,e,i){const s=this.title,r=s.length;let o,a,l;if(r){const c=Mi(i.rtl,this.x,this.width);for(t.x=Tr(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",o=Mt(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,l=0;lm!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Js(t,{x:p,y:g,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),Js(t,{x:y,y:g+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=o.backgroundColor,t.fillRect(y,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=i,u=Mt(i.bodyFont);let f=u.lineHeight,d=0;const g=Mi(i.rtl,this.x,this.width),p=function(S){e.fillText(S,g.x(t.x+d),t.y+f/2),t.y+=f+r},y=g.textAlign(o);let x,m,v,b,_,w,M;for(e.textAlign=o,e.textBaseline="middle",e.font=u.string,t.x=Tr(this,y,i),e.fillStyle=i.bodyColor,tt(this.beforeBody,p),d=a&&y!=="right"?o==="center"?c/2+h:c+2+h:0,b=0,w=s.length;b0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const o=As[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Cd(this,t),l=Object.assign({},o,this._size),c=Od(e,t,l),h=Dd(t,l,c,e);(s._to!==h.x||r._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=Bt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),db(t,e.textDirection),r.y+=o.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),gb(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!Fo(i,s),o=this._positionChanged(s,e);(r||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],o=this._getActiveElements(t,r,e,i),a=this._positionChanged(o,t),l=e||!Fo(o,r)||a;return l&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const r=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:r}=this,o=As[r.position].call(this,t,e);return o!==!1&&(i!==o.x||s!==o.y)}},D(yl,"positioners",As),yl);var tO={id:"tooltip",_element:Td,positioners:As,afterInit(n,t,e){e&&(n.tooltip=new Td({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Vb},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},eO=Object.freeze({__proto__:null,Colors:dC,Decimation:bC,Filler:BC,Legend:HC,SubTitle:UC,Title:YC,Tooltip:tO});const nO=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function iO(n,t,e,i){const s=n.indexOf(t);if(s===-1)return nO(n,t,e,i);const r=n.lastIndexOf(t);return s!==r?e:s}const sO=(n,t)=>n===null?null:Ct(Math.round(n),0,t);function Rd(n){const t=this.getLabels();return n>=0&&ne.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},D(Zr,"id","category"),D(Zr,"defaults",{ticks:{callback:Rd}}),Zr);function oO(n,t){const e=[],{bounds:s,step:r,min:o,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:f}=n,d=r||1,g=h-1,{min:p,max:y}=t,x=!q(o),m=!q(a),v=!q(c),b=(y-p)/(u+1);let _=Af((y-p)/g/d)*d,w,M,S,P;if(_<1e-14&&!x&&!m)return[{value:p},{value:y}];P=Math.ceil(y/_)-Math.floor(p/_),P>g&&(_=Af(P*_/g/d)*d),q(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),s==="ticks"?(M=Math.floor(p/_)*_,S=Math.ceil(y/_)*_):(M=p,S=y),x&&m&&r&&$M((a-o)/r,_/1e3)?(P=Math.round(Math.min((a-o)/_,h)),_=(a-o)/P,M=o,S=a):v?(M=x?o:M,S=m?a:S,P=c-1,_=(S-M)/P):(P=(S-M)/_,zs(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const C=Math.max(Cf(_),Cf(M));w=Math.pow(10,q(l)?C:l),M=Math.round(M*w)/w,S=Math.round(S*w)/w;let k=0;for(x&&(f&&M!==o?(e.push({value:o}),Ma)break;e.push({value:A})}return m&&f&&S!==a?e.length&&zs(e[e.length-1].value,a,Id(a,b,n))?e[e.length-1].value=a:e.push({value:a}):(!m||S===a)&&e.push({value:S}),e}function Id(n,t,{horizontal:e,minRotation:i}){const s=pe(i),r=(e?Math.sin(s):Math.cos(s))||.001,o=.75*t*(""+n).length;return Math.min(t/r,o)}let Ho=class extends fr{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return q(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:r}=this;const o=l=>s=e?s:l,a=l=>r=i?r:l;if(t){const l=Ae(s),c=Ae(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(s===r){let l=r===0?1:Math.abs(r*.05);a(r+l),t||o(s-l)}this.min=s,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,o=oO(s,r);return t.bounds==="ticks"&&Km(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return hr(t,this.chart.options.locale,this.options.ticks.format)}};var Jr;let aO=(Jr=class extends Ho{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=pt(t)?t:0,this.max=pt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=pe(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},D(Jr,"id","linear"),D(Jr,"defaults",{ticks:{callback:fa.formatters.numeric}}),Jr);const tr=n=>Math.floor(hn(n)),Tn=(n,t)=>Math.pow(10,tr(n)+t);function Fd(n){return n/Math.pow(10,tr(n))===1}function Bd(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function lO(n,t){const e=t-n;let i=tr(e);for(;Bd(n,t,i)>10;)i++;for(;Bd(n,t,i)<10;)i--;return Math.min(i,tr(n))}function cO(n,{min:t,max:e}){t=Kt(n.min,t);const i=[],s=tr(t);let r=lO(t,e),o=r<0?Math.pow(10,Math.abs(r)):1;const a=Math.pow(10,r),l=s>r?Math.pow(10,s):0,c=Math.round((t-l)*o)/o,h=Math.floor((t-l)/a/10)*a*10;let u=Math.floor((c-h)/Math.pow(10,r)),f=Kt(n.min,Math.round((l+h+u*Math.pow(10,r))*o)/o);for(;f=10?u=u<15?15:20:u++,u>=20&&(r++,u=2,o=r>=0?1:o),f=Math.round((l+h+u*Math.pow(10,r))*o)/o;const d=Kt(n.max,f);return i.push({value:d,major:Fd(d),significand:u}),i}var Qr;let hO=(Qr=class extends fr{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Ho.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return pt(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=pt(t)?Math.max(0,t):null,this.max=pt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!pt(this._userMin)&&(this.min=t===Tn(this.min,0)?Tn(this.min,-1):Tn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const r=a=>i=t?i:a,o=a=>s=e?s:a;i===s&&(i<=0?(r(1),o(10)):(r(Tn(i,-1)),o(Tn(s,1)))),i<=0&&r(Tn(s,-1)),s<=0&&o(Tn(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=cO(e,this);return t.bounds==="ticks"&&Km(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":hr(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=hn(t),this._valueRange=hn(this.max)-hn(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(hn(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}},D(Qr,"id","logarithmic"),D(Qr,"defaults",{ticks:{callback:fa.formatters.logarithmic,major:{enabled:!0}}}),Qr);function Jl(n){const t=n.ticks;if(t.display&&n.display){const e=Bt(t.backdropPadding);return V(t.font&&t.font.size,mt.font.size)+e.height}return 0}function uO(n,t,e){return e=at(e)?e:[e],{w:ak(n,t.string,e),h:e.length*t.lineHeight}}function zd(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:ns?{start:t-e,end:t}:{start:t,end:t+e}}function fO(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,o=n.options.pointLabels,a=o.centerPointLabels?ct/r:0;for(let l=0;lt.r&&(a=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/o,n.b=Math.max(n.b,t.b+l))}function gO(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:r,padding:o,size:a}=e,l=n.getPointPosition(t,i+s+o,r),c=Math.round(qc(Zt(l.angle+xt))),h=_O(l.y,a.h,c),u=bO(c),f=yO(l.x,a.w,u);return{visible:!0,x:l.x,y:h,textAlign:u,left:f,top:h,right:f+a.w,bottom:h+a.h}}function pO(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:r}=n;return!(Xe({x:e,y:i},t)||Xe({x:e,y:r},t)||Xe({x:s,y:i},t)||Xe({x:s,y:r},t))}function mO(n,t,e){const i=[],s=n._pointLabels.length,r=n.options,{centerPointLabels:o,display:a}=r.pointLabels,l={extra:Jl(r)/2,additionalAngle:o?ct/s:0};let c;for(let h=0;h270||e<90)&&(n-=t),n}function vO(n,t,e){const{left:i,top:s,right:r,bottom:o}=e,{backdropColor:a}=t;if(!q(a)){const l=qn(t.borderRadius),c=Bt(t.backdropPadding);n.fillStyle=a;const h=i-c.left,u=s-c.top,f=r-i+c.width,d=o-s+c.height;Object.values(l).some(g=>g!==0)?(n.beginPath(),Js(n,{x:h,y:u,w:f,h:d,radius:l}),n.fill()):n.fillRect(h,u,f,d)}}function xO(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const r=n._pointLabelItems[s];if(!r.visible)continue;const o=i.setContext(n.getPointLabelContext(s));vO(e,o,r);const a=Mt(o.font),{x:l,y:c,textAlign:h}=r;ti(e,n._pointLabels[s],l,c+a.lineHeight/2,a,{color:o.color,textAlign:h,textBaseline:"middle"})}}function jb(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,lt);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let o=1;o{const s=ot(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?fO(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=lt/(this._pointLabels.length||1),i=this.options.startAngle||0;return Zt(t*e+pe(i))}getDistanceFromCenterForValue(t){if(q(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(q(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(u!==0||u===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const f=this.getContext(u),d=s.setContext(f),g=r.setContext(f);wO(this,d,l,o,g)}}),i.display){for(t.save(),a=o-1;a>=0;a--){const h=i.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:f}=h;!f||!u||(t.lineWidth=f,t.strokeStyle=u,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),h=Mt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=Bt(c.backdropPadding);t.fillRect(-o/2-u.left,-r-h.size/2-u.top,o+u.width,h.size+u.height)}ti(t,a.label,0,-r,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}},D(yi,"id","radialLinear"),D(yi,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:fa.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),D(yi,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),D(yi,"descriptors",{angleLines:{_fallback:"grid"}}),yi);const ba={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Ut=Object.keys(ba);function Nd(n,t){return n-t}function Wd(n,t){if(q(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let o=t;return typeof i=="function"&&(o=i(o)),pt(o)||(o=typeof i=="string"?e.parse(o,i):e.parse(o)),o===null?null:(s&&(o=s==="week"&&(Ei(r)||r===!0)?e.startOf(o,"isoWeek",r):e.startOf(o,s)),+o)}function Vd(n,t,e,i){const s=Ut.length;for(let r=Ut.indexOf(n);r=Ut.indexOf(e);r--){const o=Ut[r];if(ba[o].common&&n._adapter.diff(s,i,o)>=t-1)return o}return Ut[e?Ut.indexOf(e):0]}function PO(n){for(let t=Ut.indexOf(n)+1,e=Ut.length;t=t?e[i]:e[s];n[r]=!0}}function AO(n,t,e,i){const s=n._adapter,r=+s.startOf(t[0].value,i),o=t[t.length-1].value;let a,l;for(a=r;a<=o;a=+s.add(a,1,i))l=e[a],l>=0&&(t[l].major=!0);return t}function Hd(n,t,e){const i=[],s={},r=t.length;let o,a;for(o=0;o+t.value))}initOffsets(t=[]){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;e=Ct(e,0,o),i=Ct(i,0,o),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,o=r.unit||Vd(r.minUnit,e,i,this._getLabelCapacity(e)),a=V(s.ticks.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=Ei(l)||l===!0,h={};let u=e,f,d;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,d=0;f+p)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,r=this._unit,o=e||s[r];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,s){const r=this.options,o=r.ticks.callback;if(o)return ot(o,[t,e,i],this);const a=r.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],u=c&&a[c],f=i[e],d=c&&u&&f&&f.major;return this._adapter.format(t,s||(d?u:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ue(n,"pos",t)),{pos:r,time:a}=n[i],{pos:o,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ue(n,"time",t)),{time:r,pos:a}=n[i],{time:o,pos:l}=n[s]);const c=o-r;return c?a+(l-a)*(t-r)/c:a}var eo;let CO=(eo=class extends Ql{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Rr(e,this.min),this._tableRange=Rr(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],r=[];let o,a,l,c,h;for(o=0,a=t.length;o=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;os-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Rr(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Rr(this._table,i*this._tableRange+this._minPos,!0)}},D(eo,"id","timeseries"),D(eo,"defaults",Ql.defaults),eo);var OO=Object.freeze({__proto__:null,CategoryScale:rO,LinearScale:aO,LogarithmicScale:hO,RadialLinearScale:MO,TimeScale:Ql,TimeSeriesScale:CO});const DO=[CP,aC,eO,OO];/*! +`):n}function HC(n,t){const{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:n,label:o,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Cd(n,t){const e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:o,boxHeight:a}=t,l=Mt(t.bodyFont),c=Mt(t.titleFont),h=Mt(t.footerFont),u=r.length,f=s.length,d=i.length,g=Nt(t.padding);let p=g.height,y=0,x=i.reduce((b,_)=>b+_.before.length+_.lines.length+_.after.length,0);if(x+=n.beforeBody.length+n.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),x){const b=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=d*b+(x-d)*l.lineHeight+(x-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let m=0;const v=function(b){y=Math.max(y,e.measureText(b).width+m)};return e.save(),e.font=c.string,tt(n.title,v),e.font=l.string,tt(n.beforeBody.concat(n.afterBody),v),m=t.displayColors?o+2+t.boxPadding:0,tt(i,b=>{tt(b.before,v),tt(b.lines,v),tt(b.after,v)}),m=0,e.font=h.string,tt(n.footer,v),e.restore(),y+=g.width,{width:y,height:p}}function $C(n,t){const{y:e,height:i}=t;return en.height-i/2?"bottom":"center"}function YC(n,t,e,i){const{x:s,width:r}=i,o=e.caretSize+e.caretPadding;if(n==="left"&&s+r+o>t.width||n==="right"&&s-r-o<0)return!0}function UC(n,t,e,i){const{x:s,width:r}=e,{width:o,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),YC(c,n,t,e)&&(c="center"),c}function Od(n,t,e){const i=e.yAlign||t.yAlign||$C(n,e);return{xAlign:e.xAlign||t.xAlign||UC(n,t,e,i),yAlign:i}}function XC(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function GC(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Dd(n,t,e,i){const{caretSize:s,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=e,c=s+r,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:d}=qn(o);let g=XC(t,a);const p=GC(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,f)+s:a==="right"&&(g+=Math.max(u,d)+s),{x:Ot(g,0,i.width-t.width),y:Ot(p,0,i.height-t.height)}}function Tr(n,t,e){const i=Nt(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Ed(n){return xe([],Fe(n))}function qC(n,t,e){return kn(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ld(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const Vb={beforeTitle:Re,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?Vb[t].call(e,i):s}var yl;let Td=(yl=class extends Je{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new yb(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=qC(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=Ht(i,"beforeTitle",this,t),r=Ht(i,"title",this,t),o=Ht(i,"afterTitle",this,t);let a=[];return a=xe(a,Fe(s)),a=xe(a,Fe(r)),a=xe(a,Fe(o)),a}getBeforeBody(t,e){return Ed(Ht(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return tt(t,r=>{const o={before:[],lines:[],after:[]},a=Ld(i,r);xe(o.before,Fe(Ht(a,"beforeLabel",this,r))),xe(o.lines,Ht(a,"label",this,r)),xe(o.after,Fe(Ht(a,"afterLabel",this,r))),s.push(o)}),s}getAfterBody(t,e){return Ed(Ht(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Ht(i,"beforeFooter",this,t),r=Ht(i,"footer",this,t),o=Ht(i,"afterFooter",this,t);let a=[];return a=xe(a,Fe(s)),a=xe(a,Fe(r)),a=xe(a,Fe(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],r=[],o=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,f,i))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,i))),tt(a,h=>{const u=Ld(t.callbacks,h);s.push(Ht(u,"labelColor",this,h)),r.push(Ht(u,"labelPointStyle",this,h)),o.push(Ht(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let r,o=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const a=As[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=Cd(this,i),c=Object.assign({},a,l),h=Od(this.chart,i,c),u=Dd(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,r={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:r}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=qn(a),{x:f,y:d}=t,{width:g,height:p}=e;let y,x,m,v,b,_;return r==="center"?(b=d+p/2,s==="left"?(y=f,x=y-o,v=b+o,_=b-o):(y=f+g,x=y+o,v=b-o,_=b+o),m=y):(s==="left"?x=f+Math.max(l,h)+o:s==="right"?x=f+g-Math.max(c,u)-o:x=this.caretX,r==="top"?(v=d,b=v-o,y=x-o,m=x+o):(v=d+p,b=v+o,y=x+o,m=x-o),_=v),{x1:y,x2:x,x3:m,y1:v,y2:b,y3:_}}drawTitle(t,e,i){const s=this.title,r=s.length;let o,a,l;if(r){const c=Mi(i.rtl,this.x,this.width);for(t.x=Tr(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",o=Mt(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,l=0;lm!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Zs(t,{x:p,y:g,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),Zs(t,{x:y,y:g+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=o.backgroundColor,t.fillRect(y,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=i,u=Mt(i.bodyFont);let f=u.lineHeight,d=0;const g=Mi(i.rtl,this.x,this.width),p=function(S){e.fillText(S,g.x(t.x+d),t.y+f/2),t.y+=f+r},y=g.textAlign(o);let x,m,v,b,_,w,M;for(e.textAlign=o,e.textBaseline="middle",e.font=u.string,t.x=Tr(this,y,i),e.fillStyle=i.bodyColor,tt(this.beforeBody,p),d=a&&y!=="right"?o==="center"?c/2+h:c+2+h:0,b=0,w=s.length;b0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const o=As[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Cd(this,t),l=Object.assign({},o,this._size),c=Od(e,t,l),h=Dd(t,l,c,e);(s._to!==h.x||r._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=Nt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),db(t,e.textDirection),r.y+=o.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),gb(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!Fo(i,s),o=this._positionChanged(s,e);(r||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],o=this._getActiveElements(t,r,e,i),a=this._positionChanged(o,t),l=e||!Fo(o,r)||a;return l&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const r=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:r}=this,o=As[r.position].call(this,t,e);return o!==!1&&(i!==o.x||s!==o.y)}},D(yl,"positioners",As),yl);var KC={id:"tooltip",_element:Td,positioners:As,afterInit(n,t,e){e&&(n.tooltip=new Td({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Vb},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},JC=Object.freeze({__proto__:null,Colors:cC,Decimation:dC,Filler:TC,Legend:NC,SubTitle:jC,Title:VC,Tooltip:KC});const ZC=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function QC(n,t,e,i){const s=n.indexOf(t);if(s===-1)return ZC(n,t,e,i);const r=n.lastIndexOf(t);return s!==r?e:s}const tO=(n,t)=>n===null?null:Ot(Math.round(n),0,t);function Rd(n){const t=this.getLabels();return n>=0&&ne.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},D(Jr,"id","category"),D(Jr,"defaults",{ticks:{callback:Rd}}),Jr);function nO(n,t){const e=[],{bounds:s,step:r,min:o,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:f}=n,d=r||1,g=h-1,{min:p,max:y}=t,x=!q(o),m=!q(a),v=!q(c),b=(y-p)/(u+1);let _=Af((y-p)/g/d)*d,w,M,S,P;if(_<1e-14&&!x&&!m)return[{value:p},{value:y}];P=Math.ceil(y/_)-Math.floor(p/_),P>g&&(_=Af(P*_/g/d)*d),q(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),s==="ticks"?(M=Math.floor(p/_)*_,S=Math.ceil(y/_)*_):(M=p,S=y),x&&m&&r&&WM((a-o)/r,_/1e3)?(P=Math.round(Math.min((a-o)/_,h)),_=(a-o)/P,M=o,S=a):v?(M=x?o:M,S=m?a:S,P=c-1,_=(S-M)/P):(P=(S-M)/_,zs(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const C=Math.max(Cf(_),Cf(M));w=Math.pow(10,q(l)?C:l),M=Math.round(M*w)/w,S=Math.round(S*w)/w;let k=0;for(x&&(f&&M!==o?(e.push({value:o}),Ma)break;e.push({value:A})}return m&&f&&S!==a?e.length&&zs(e[e.length-1].value,a,Id(a,b,n))?e[e.length-1].value=a:e.push({value:a}):(!m||S===a)&&e.push({value:S}),e}function Id(n,t,{horizontal:e,minRotation:i}){const s=pe(i),r=(e?Math.sin(s):Math.cos(s))||.001,o=.75*t*(""+n).length;return Math.min(t/r,o)}let Ho=class extends fr{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return q(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:r}=this;const o=l=>s=e?s:l,a=l=>r=i?r:l;if(t){const l=Ae(s),c=Ae(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(s===r){let l=r===0?1:Math.abs(r*.05);a(r+l),t||o(s-l)}this.min=s,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,o=nO(s,r);return t.bounds==="ticks"&&Km(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return hr(t,this.chart.options.locale,this.options.ticks.format)}};var Zr;let iO=(Zr=class extends Ho{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=mt(t)?t:0,this.max=mt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=pe(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},D(Zr,"id","linear"),D(Zr,"defaults",{ticks:{callback:fa.formatters.numeric}}),Zr);const tr=n=>Math.floor(cn(n)),Tn=(n,t)=>Math.pow(10,tr(n)+t);function Fd(n){return n/Math.pow(10,tr(n))===1}function Bd(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function sO(n,t){const e=t-n;let i=tr(e);for(;Bd(n,t,i)>10;)i++;for(;Bd(n,t,i)<10;)i--;return Math.min(i,tr(n))}function rO(n,{min:t,max:e}){t=Kt(n.min,t);const i=[],s=tr(t);let r=sO(t,e),o=r<0?Math.pow(10,Math.abs(r)):1;const a=Math.pow(10,r),l=s>r?Math.pow(10,s):0,c=Math.round((t-l)*o)/o,h=Math.floor((t-l)/a/10)*a*10;let u=Math.floor((c-h)/Math.pow(10,r)),f=Kt(n.min,Math.round((l+h+u*Math.pow(10,r))*o)/o);for(;f=10?u=u<15?15:20:u++,u>=20&&(r++,u=2,o=r>=0?1:o),f=Math.round((l+h+u*Math.pow(10,r))*o)/o;const d=Kt(n.max,f);return i.push({value:d,major:Fd(d),significand:u}),i}var Qr;let oO=(Qr=class extends fr{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Ho.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return mt(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=mt(t)?Math.max(0,t):null,this.max=mt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!mt(this._userMin)&&(this.min=t===Tn(this.min,0)?Tn(this.min,-1):Tn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const r=a=>i=t?i:a,o=a=>s=e?s:a;i===s&&(i<=0?(r(1),o(10)):(r(Tn(i,-1)),o(Tn(s,1)))),i<=0&&r(Tn(s,-1)),s<=0&&o(Tn(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=rO(e,this);return t.bounds==="ticks"&&Km(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":hr(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=cn(t),this._valueRange=cn(this.max)-cn(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(cn(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}},D(Qr,"id","logarithmic"),D(Qr,"defaults",{ticks:{callback:fa.formatters.logarithmic,major:{enabled:!0}}}),Qr);function Zl(n){const t=n.ticks;if(t.display&&n.display){const e=Nt(t.backdropPadding);return V(t.font&&t.font.size,bt.font.size)+e.height}return 0}function aO(n,t,e){return e=at(e)?e:[e],{w:ik(n,t.string,e),h:e.length*t.lineHeight}}function zd(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:ns?{start:t-e,end:t}:{start:t,end:t+e}}function lO(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,o=n.options.pointLabels,a=o.centerPointLabels?ct/r:0;for(let l=0;lt.r&&(a=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/o,n.b=Math.max(n.b,t.b+l))}function hO(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:r,padding:o,size:a}=e,l=n.getPointPosition(t,i+s+o,r),c=Math.round(qc(Jt(l.angle+xt))),h=pO(l.y,a.h,c),u=dO(c),f=gO(l.x,a.w,u);return{visible:!0,x:l.x,y:h,textAlign:u,left:f,top:h,right:f+a.w,bottom:h+a.h}}function uO(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:r}=n;return!(Xe({x:e,y:i},t)||Xe({x:e,y:r},t)||Xe({x:s,y:i},t)||Xe({x:s,y:r},t))}function fO(n,t,e){const i=[],s=n._pointLabels.length,r=n.options,{centerPointLabels:o,display:a}=r.pointLabels,l={extra:Zl(r)/2,additionalAngle:o?ct/s:0};let c;for(let h=0;h270||e<90)&&(n-=t),n}function mO(n,t,e){const{left:i,top:s,right:r,bottom:o}=e,{backdropColor:a}=t;if(!q(a)){const l=qn(t.borderRadius),c=Nt(t.backdropPadding);n.fillStyle=a;const h=i-c.left,u=s-c.top,f=r-i+c.width,d=o-s+c.height;Object.values(l).some(g=>g!==0)?(n.beginPath(),Zs(n,{x:h,y:u,w:f,h:d,radius:l}),n.fill()):n.fillRect(h,u,f,d)}}function bO(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const r=n._pointLabelItems[s];if(!r.visible)continue;const o=i.setContext(n.getPointLabelContext(s));mO(e,o,r);const a=Mt(o.font),{x:l,y:c,textAlign:h}=r;ti(e,n._pointLabels[s],l,c+a.lineHeight/2,a,{color:o.color,textAlign:h,textBaseline:"middle"})}}function jb(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,lt);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let o=1;o{const s=ot(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?lO(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=lt/(this._pointLabels.length||1),i=this.options.startAngle||0;return Jt(t*e+pe(i))}getDistanceFromCenterForValue(t){if(q(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(q(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(u!==0||u===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const f=this.getContext(u),d=s.setContext(f),g=r.setContext(f);yO(this,d,l,o,g)}}),i.display){for(t.save(),a=o-1;a>=0;a--){const h=i.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:f}=h;!f||!u||(t.lineWidth=f,t.strokeStyle=u,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),h=Mt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=Nt(c.backdropPadding);t.fillRect(-o/2-u.left,-r-h.size/2-u.top,o+u.width,h.size+u.height)}ti(t,a.label,0,-r,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}},D(yi,"id","radialLinear"),D(yi,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:fa.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),D(yi,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),D(yi,"descriptors",{angleLines:{_fallback:"grid"}}),yi);const ba={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Ut=Object.keys(ba);function Nd(n,t){return n-t}function Wd(n,t){if(q(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let o=t;return typeof i=="function"&&(o=i(o)),mt(o)||(o=typeof i=="string"?e.parse(o,i):e.parse(o)),o===null?null:(s&&(o=s==="week"&&(Ei(r)||r===!0)?e.startOf(o,"isoWeek",r):e.startOf(o,s)),+o)}function Vd(n,t,e,i){const s=Ut.length;for(let r=Ut.indexOf(n);r=Ut.indexOf(e);r--){const o=Ut[r];if(ba[o].common&&n._adapter.diff(s,i,o)>=t-1)return o}return Ut[e?Ut.indexOf(e):0]}function wO(n){for(let t=Ut.indexOf(n)+1,e=Ut.length;t=t?e[i]:e[s];n[r]=!0}}function SO(n,t,e,i){const s=n._adapter,r=+s.startOf(t[0].value,i),o=t[t.length-1].value;let a,l;for(a=r;a<=o;a=+s.add(a,1,i))l=e[a],l>=0&&(t[l].major=!0);return t}function Hd(n,t,e){const i=[],s={},r=t.length;let o,a;for(o=0;o+t.value))}initOffsets(t=[]){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;e=Ot(e,0,o),i=Ot(i,0,o),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,o=r.unit||Vd(r.minUnit,e,i,this._getLabelCapacity(e)),a=V(s.ticks.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=Ei(l)||l===!0,h={};let u=e,f,d;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,d=0;f+p)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,r=this._unit,o=e||s[r];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,s){const r=this.options,o=r.ticks.callback;if(o)return ot(o,[t,e,i],this);const a=r.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],u=c&&a[c],f=i[e],d=c&&u&&f&&f.major;return this._adapter.format(t,s||(d?u:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ue(n,"pos",t)),{pos:r,time:a}=n[i],{pos:o,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ue(n,"time",t)),{time:r,pos:a}=n[i],{time:o,pos:l}=n[s]);const c=o-r;return c?a+(l-a)*(t-r)/c:a}var eo;let MO=(eo=class extends Ql{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Rr(e,this.min),this._tableRange=Rr(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],r=[];let o,a,l,c,h;for(o=0,a=t.length;o=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;os-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Rr(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Rr(this._table,i*this._tableRange+this._minPos,!0)}},D(eo,"id","timeseries"),D(eo,"defaults",Ql.defaults),eo);var kO=Object.freeze({__proto__:null,CategoryScale:eO,LinearScale:iO,LogarithmicScale:oO,RadialLinearScale:vO,TimeScale:Ql,TimeSeriesScale:MO});const PO=[MP,iC,JC,kO];/*! * Chart.js v3.9.1 * https://www.chartjs.org * (c) 2022 Chart.js Contributors * Released under the MIT License - */const EO=function(){let n=0;return function(){return n++}}();function nt(n){return n===null||typeof n>"u"}function ut(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function K(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const Dt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function se(n,t){return Dt(n)?n:t}function G(n,t){return typeof n>"u"?t:n}const LO=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/t,Hb=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function gt(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function et(n,t,e,i){let s,r,o;if(ut(n))if(r=n.length,i)for(s=r-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function yn(n,t){return($d[t]||($d[t]=IO(t)))(n)}function IO(n){const t=FO(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function FO(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function ch(n){return n.charAt(0).toUpperCase()+n.slice(1)}const he=n=>typeof n<"u",_n=n=>typeof n=="function",Yd=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function BO(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const yt=Math.PI,rt=2*yt,zO=rt+yt,Uo=Number.POSITIVE_INFINITY,NO=yt/180,bt=yt/2,ns=yt/4,Ud=yt*2/3,oe=Math.log10,Ce=Math.sign;function Xd(n){const t=Math.round(n);n=js(n,t,n/1e3)?t:n;const e=Math.pow(10,Math.floor(oe(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function WO(n){const t=[],e=Math.sqrt(n);let i;for(i=1;is-r).pop(),t}function Ri(n){return!isNaN(parseFloat(n))&&isFinite(n)}function js(n,t,e){return Math.abs(n-t)=n}function Yb(n,t,e){let i,s,r;for(i=0,s=n.length;il&&c=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function uh(n,t,e){e=e||(o=>n[o]1;)r=s+i>>1,e(r)?s=r:i=r;return{lo:s,hi:i}}const Hn=(n,t,e,i)=>uh(n,e,i?s=>n[s][t]<=e:s=>n[s][t]uh(n,e,i=>n[i][t]>=e);function YO(n,t,e){let i=0,s=n.length;for(;ii&&n[s-1]>e;)s--;return i>0||s{const i="_onData"+ch(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...r){const o=s.apply(this,r);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...r)}),o}})})}function qd(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Xb.forEach(r=>{delete n[r]}),delete n._chartjs)}function Gb(n){const t=new Set;let e,i;for(e=0,i=n.length;e"u"?function(n){return n()}:window.requestAnimationFrame}();function Kb(n,t,e){const i=e||(o=>Array.prototype.slice.call(o));let s=!1,r=[];return function(...o){r=i(o),s||(s=!0,qb.call(window,()=>{s=!1,n.apply(t,r)}))}}function XO(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const GO=n=>n==="start"?"left":n==="end"?"right":"center",Kd=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2;function Zb(n,t,e){const i=t.length;let s=0,r=i;if(n._sorted){const{iScale:o,_parsed:a}=n,l=o.axis,{min:c,max:h,minDefined:u,maxDefined:f}=o.getUserBounds();u&&(s=It(Math.min(Hn(a,o.axis,c).lo,e?i:Hn(t,l,o.getPixelForValue(c)).lo),0,i-1)),f?r=It(Math.max(Hn(a,o.axis,h,!0).hi+1,e?0:Hn(t,l,o.getPixelForValue(h),!0).hi+1),s,i)-s:r=i-s}return{start:s,count:r}}function Jb(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const r=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),r}const Ir=n=>n===0||n===1,Zd=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*rt/e)),Jd=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*rt/e)+1,Hs={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*bt)+1,easeOutSine:n=>Math.sin(n*bt),easeInOutSine:n=>-.5*(Math.cos(yt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Ir(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Ir(n)?n:Zd(n,.075,.3),easeOutElastic:n=>Ir(n)?n:Jd(n,.075,.3),easeInOutElastic(n){return Ir(n)?n:n<.5?.5*Zd(n*2,.1125,.45):.5+.5*Jd(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-Hs.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?Hs.easeInBounce(n*2)*.5:Hs.easeOutBounce(n*2-1)*.5+.5};/*! + */const AO=function(){let n=0;return function(){return n++}}();function nt(n){return n===null||typeof n>"u"}function ut(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function K(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const Dt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function se(n,t){return Dt(n)?n:t}function G(n,t){return typeof n>"u"?t:n}const CO=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/t,Hb=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function gt(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function et(n,t,e,i){let s,r,o;if(ut(n))if(r=n.length,i)for(s=r-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function bn(n,t){return($d[t]||($d[t]=EO(t)))(n)}function EO(n){const t=LO(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function LO(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function ch(n){return n.charAt(0).toUpperCase()+n.slice(1)}const he=n=>typeof n<"u",yn=n=>typeof n=="function",Yd=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function TO(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const _t=Math.PI,rt=2*_t,RO=rt+_t,Uo=Number.POSITIVE_INFINITY,IO=_t/180,yt=_t/2,es=_t/4,Ud=_t*2/3,oe=Math.log10,Ce=Math.sign;function Xd(n){const t=Math.round(n);n=js(n,t,n/1e3)?t:n;const e=Math.pow(10,Math.floor(oe(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function FO(n){const t=[],e=Math.sqrt(n);let i;for(i=1;is-r).pop(),t}function Ri(n){return!isNaN(parseFloat(n))&&isFinite(n)}function js(n,t,e){return Math.abs(n-t)=n}function Yb(n,t,e){let i,s,r;for(i=0,s=n.length;il&&c=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function uh(n,t,e){e=e||(o=>n[o]1;)r=s+i>>1,e(r)?s=r:i=r;return{lo:s,hi:i}}const Hn=(n,t,e,i)=>uh(n,e,i?s=>n[s][t]<=e:s=>n[s][t]uh(n,e,i=>n[i][t]>=e);function VO(n,t,e){let i=0,s=n.length;for(;ii&&n[s-1]>e;)s--;return i>0||s{const i="_onData"+ch(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...r){const o=s.apply(this,r);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...r)}),o}})})}function qd(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Xb.forEach(r=>{delete n[r]}),delete n._chartjs)}function Gb(n){const t=new Set;let e,i;for(e=0,i=n.length;e"u"?function(n){return n()}:window.requestAnimationFrame}();function Kb(n,t,e){const i=e||(o=>Array.prototype.slice.call(o));let s=!1,r=[];return function(...o){r=i(o),s||(s=!0,qb.call(window,()=>{s=!1,n.apply(t,r)}))}}function HO(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const $O=n=>n==="start"?"left":n==="end"?"right":"center",Kd=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2;function Jb(n,t,e){const i=t.length;let s=0,r=i;if(n._sorted){const{iScale:o,_parsed:a}=n,l=o.axis,{min:c,max:h,minDefined:u,maxDefined:f}=o.getUserBounds();u&&(s=Ft(Math.min(Hn(a,o.axis,c).lo,e?i:Hn(t,l,o.getPixelForValue(c)).lo),0,i-1)),f?r=Ft(Math.max(Hn(a,o.axis,h,!0).hi+1,e?0:Hn(t,l,o.getPixelForValue(h),!0).hi+1),s,i)-s:r=i-s}return{start:s,count:r}}function Zb(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const r=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),r}const Ir=n=>n===0||n===1,Jd=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*rt/e)),Zd=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*rt/e)+1,Hs={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*yt)+1,easeOutSine:n=>Math.sin(n*yt),easeInOutSine:n=>-.5*(Math.cos(_t*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Ir(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Ir(n)?n:Jd(n,.075,.3),easeOutElastic:n=>Ir(n)?n:Zd(n,.075,.3),easeInOutElastic(n){return Ir(n)?n:n<.5?.5*Jd(n*2,.1125,.45):.5+.5*Zd(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-Hs.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?Hs.easeInBounce(n*2)*.5:Hs.easeOutBounce(n*2-1)*.5+.5};/*! * @kurkle/color v0.2.1 * https://github.com/kurkle/color#readme * (c) 2022 Jukka Kurkela * Released under the MIT License - */function dr(n){return n+.5|0}const fn=(n,t,e)=>Math.max(Math.min(n,e),t);function Cs(n){return fn(dr(n*2.55),0,255)}function pn(n){return fn(dr(n*255),0,255)}function Ve(n){return fn(dr(n/2.55)/100,0,1)}function Qd(n){return fn(dr(n*100),0,100)}const ie={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},ec=[..."0123456789ABCDEF"],qO=n=>ec[n&15],KO=n=>ec[(n&240)>>4]+ec[n&15],Fr=n=>(n&240)>>4===(n&15),ZO=n=>Fr(n.r)&&Fr(n.g)&&Fr(n.b)&&Fr(n.a);function JO(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&ie[n[1]]*17,g:255&ie[n[2]]*17,b:255&ie[n[3]]*17,a:t===5?ie[n[4]]*17:255}:(t===7||t===9)&&(e={r:ie[n[1]]<<4|ie[n[2]],g:ie[n[3]]<<4|ie[n[4]],b:ie[n[5]]<<4|ie[n[6]],a:t===9?ie[n[7]]<<4|ie[n[8]]:255})),e}const QO=(n,t)=>n<255?t(n):"";function t2(n){var t=ZO(n)?qO:KO;return n?"#"+t(n.r)+t(n.g)+t(n.b)+QO(n.a,t):void 0}const e2=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Qb(n,t,e){const i=t*Math.min(e,1-e),s=(r,o=(r+n/30)%12)=>e-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function n2(n,t,e){const i=(s,r=(s+n/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function i2(n,t,e){const i=Qb(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function s2(n,t,e,i,s){return n===s?(t-e)/i+(t.5?h/(2-r-o):h/(r+o),l=s2(e,i,s,h,r),l=l*60+.5),[l|0,c||0,a]}function dh(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(pn)}function gh(n,t,e){return dh(Qb,n,t,e)}function r2(n,t,e){return dh(i2,n,t,e)}function o2(n,t,e){return dh(n2,n,t,e)}function ty(n){return(n%360+360)%360}function a2(n){const t=e2.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Cs(+t[5]):pn(+t[5]));const s=ty(+t[2]),r=+t[3]/100,o=+t[4]/100;return t[1]==="hwb"?i=r2(s,r,o):t[1]==="hsv"?i=o2(s,r,o):i=gh(s,r,o),{r:i[0],g:i[1],b:i[2],a:e}}function l2(n,t){var e=fh(n);e[0]=ty(e[0]+t),e=gh(e),n.r=e[0],n.g=e[1],n.b=e[2]}function c2(n){if(!n)return;const t=fh(n),e=t[0],i=Qd(t[1]),s=Qd(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Ve(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const tg={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},eg={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function h2(){const n={},t=Object.keys(eg),e=Object.keys(tg);let i,s,r,o,a;for(i=0;i>16&255,r>>8&255,r&255]}return n}let Br;function u2(n){Br||(Br=h2(),Br.transparent=[0,0,0,0]);const t=Br[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const f2=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function d2(n){const t=f2.exec(n);let e=255,i,s,r;if(t){if(t[7]!==i){const o=+t[7];e=t[8]?Cs(o):fn(o*255,0,255)}return i=+t[1],s=+t[3],r=+t[5],i=255&(t[2]?Cs(i):fn(i,0,255)),s=255&(t[4]?Cs(s):fn(s,0,255)),r=255&(t[6]?Cs(r):fn(r,0,255)),{r:i,g:s,b:r,a:e}}}function g2(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Ve(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const sl=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,ui=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function p2(n,t,e){const i=ui(Ve(n.r)),s=ui(Ve(n.g)),r=ui(Ve(n.b));return{r:pn(sl(i+e*(ui(Ve(t.r))-i))),g:pn(sl(s+e*(ui(Ve(t.g))-s))),b:pn(sl(r+e*(ui(Ve(t.b))-r))),a:n.a+e*(t.a-n.a)}}function zr(n,t,e){if(n){let i=fh(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=gh(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function ey(n,t){return n&&Object.assign(t||{},n)}function ng(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=pn(n[3]))):(t=ey(n,{r:0,g:0,b:0,a:1}),t.a=pn(t.a)),t}function m2(n){return n.charAt(0)==="r"?d2(n):a2(n)}class Go{constructor(t){if(t instanceof Go)return t;const e=typeof t;let i;e==="object"?i=ng(t):e==="string"&&(i=JO(t)||u2(t)||m2(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=ey(this._rgb);return t&&(t.a=Ve(t.a)),t}set rgb(t){this._rgb=ng(t)}rgbString(){return this._valid?g2(this._rgb):void 0}hexString(){return this._valid?t2(this._rgb):void 0}hslString(){return this._valid?c2(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let r;const o=e===r?.5:e,a=2*o-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;r=1-c,i.r=255&c*i.r+r*s.r+.5,i.g=255&c*i.g+r*s.g+.5,i.b=255&c*i.b+r*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=p2(this._rgb,t._rgb,e)),this}clone(){return new Go(this.rgb)}alpha(t){return this._rgb.a=pn(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=dr(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return zr(this._rgb,2,t),this}darken(t){return zr(this._rgb,2,-t),this}saturate(t){return zr(this._rgb,1,t),this}desaturate(t){return zr(this._rgb,1,-t),this}rotate(t){return l2(this._rgb,t),this}}function ny(n){return new Go(n)}function iy(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ig(n){return iy(n)?n:ny(n)}function rl(n){return iy(n)?n:ny(n).saturate(.5).darken(.1).hexString()}const ei=Object.create(null),nc=Object.create(null);function $s(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;ie.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,i)=>rl(i.backgroundColor),this.hoverBorderColor=(e,i)=>rl(i.borderColor),this.hoverColor=(e,i)=>rl(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return ol(this,t,e)}get(t){return $s(this,t)}describe(t,e){return ol(nc,t,e)}override(t,e){return ol(ei,t,e)}route(t,e,i,s){const r=$s(this,t),o=$s(this,i),a="_"+e;Object.defineProperties(r,{[a]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=o[s];return K(l)?Object.assign({},c,l):G(l,c)},set(l){this[a]=l}}})}}var Y=new b2({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function y2(n){return!n||nt(n.size)||nt(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function qo(n,t,e,i,s){let r=t[s];return r||(r=t[s]=n.measureText(s).width,e.push(s)),r>i&&(i=r),i}function _2(n,t,e,i){i=i||{};let s=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},r=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let o=0;const a=e.length;let l,c,h,u,f;for(l=0;le.length){for(l=0;l0&&n.stroke()}}function ir(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.xt.top-e&&n.y0&&r.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,S2(n,r),l=0;l+n||0;function ph(n,t){const e={},i=K(t),s=i?Object.keys(t):t,r=K(n)?i?o=>G(n[o],n[t[o]]):o=>n[o]:()=>n;for(const o of s)e[o]=C2(r(o));return e}function oy(n){return ph(n,{top:"y",right:"x",bottom:"y",left:"x"})}function ki(n){return ph(n,["topLeft","topRight","bottomLeft","bottomRight"])}function ue(n){const t=oy(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Qt(n,t){n=n||{},t=t||Y.font;let e=G(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=G(n.style,t.style);i&&!(""+i).match(P2)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");const s={family:G(n.family,t.family),lineHeight:A2(G(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:G(n.weight,t.weight),string:""};return s.string=y2(s),s}function Nr(n,t,e,i){let s=!0,r,o,a;for(r=0,o=n.length;re&&a===0?0:a+l;return{min:o(i,-Math.abs(r)),max:o(s,r)}}function An(n,t){return Object.assign(Object.create(n),t)}function mh(n,t=[""],e=n,i,s=()=>n[0]){he(i)||(i=hy("_fallback",n));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:e,_fallback:i,_getTarget:s,override:o=>mh([o,...n],t,e,i)};return new Proxy(r,{deleteProperty(o,a){return delete o[a],delete o._keys,delete n[0][a],!0},get(o,a){return ly(o,a,()=>B2(a,t,n,o))},getOwnPropertyDescriptor(o,a){return Reflect.getOwnPropertyDescriptor(o._scopes[0],a)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(o,a){return og(o).includes(a)},ownKeys(o){return og(o)},set(o,a,l){const c=o._storage||(o._storage=s());return o[a]=c[a]=l,delete o._keys,!0}})}function Ii(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:ay(n,i),setContext:r=>Ii(n,r,e,i),override:r=>Ii(n.override(r),t,e,i)};return new Proxy(s,{deleteProperty(r,o){return delete r[o],delete n[o],!0},get(r,o,a){return ly(r,o,()=>E2(r,o,a))},getOwnPropertyDescriptor(r,o){return r._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(r,o,a){return n[o]=a,delete r[o],!0}})}function ay(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:_n(e)?e:()=>e,isIndexable:_n(i)?i:()=>i}}const D2=(n,t)=>n?n+ch(t):t,bh=(n,t)=>K(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function ly(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];const i=e();return n[t]=i,i}function E2(n,t,e){const{_proxy:i,_context:s,_subProxy:r,_descriptors:o}=n;let a=i[t];return _n(a)&&o.isScriptable(t)&&(a=L2(t,a,n,e)),ut(a)&&a.length&&(a=T2(t,a,n,o.isIndexable)),bh(t,a)&&(a=Ii(a,s,r&&r[t],o)),a}function L2(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_stack:a}=e;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);return a.add(n),t=t(r,o||i),a.delete(n),bh(n,t)&&(t=yh(s._scopes,s,n,t)),t}function T2(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_descriptors:a}=e;if(he(r.index)&&i(n))t=t[r.index%t.length];else if(K(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=yh(c,s,n,h);t.push(Ii(u,r,o&&o[n],a))}}return t}function cy(n,t,e){return _n(n)?n(t,e):n}const R2=(n,t)=>n===!0?t:typeof n=="string"?yn(t,n):void 0;function I2(n,t,e,i,s){for(const r of t){const o=R2(e,r);if(o){n.add(o);const a=cy(o._fallback,e,s);if(he(a)&&a!==e&&a!==i)return a}else if(o===!1&&he(i)&&e!==i)return null}return!1}function yh(n,t,e,i){const s=t._rootScopes,r=cy(t._fallback,e,i),o=[...n,...s],a=new Set;a.add(i);let l=rg(a,o,e,r||e,i);return l===null||he(r)&&r!==e&&(l=rg(a,o,r,l,i),l===null)?!1:mh(Array.from(a),[""],s,r,()=>F2(t,e,i))}function rg(n,t,e,i,s){for(;e;)e=I2(n,t,e,i,s);return e}function F2(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return ut(s)&&K(e)?e:s}function B2(n,t,e,i){let s;for(const r of t)if(s=hy(D2(r,n),e),he(s))return bh(n,s)?yh(e,i,n,s):s}function hy(n,t){for(const e of t){if(!e)continue;const i=e[n];if(he(i))return i}}function og(n){let t=n._keys;return t||(t=n._keys=z2(n._scopes)),t}function z2(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function uy(n,t,e,i){const{iScale:s}=n,{key:r="r"}=this._parsing,o=new Array(i);let a,l,c,h;for(a=0,l=i;atn==="x"?"y":"x";function W2(n,t,e,i){const s=n.skip?t:n,r=t,o=e.skip?t:e,a=tc(r,s),l=tc(o,r);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=i*c,f=i*h;return{previous:{x:r.x-u*(o.x-s.x),y:r.y-u*(o.y-s.y)},next:{x:r.x+f*(o.x-s.x),y:r.y+f*(o.y-s.y)}}}function V2(n,t,e){const i=n.length;let s,r,o,a,l,c=Fi(n,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")H2(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,o=n.length;rwindow.getComputedStyle(n,null);function U2(n,t){return ya(n).getPropertyValue(t)}const X2=["top","right","bottom","left"];function Zn(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const r=X2[s];i[r]=parseFloat(n[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const G2=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function q2(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:r}=i;let o=!1,a,l;if(G2(s,r,n.target))a=s,l=r;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function zn(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=ya(e),r=s.boxSizing==="border-box",o=Zn(s,"padding"),a=Zn(s,"border","width"),{x:l,y:c,box:h}=q2(n,e),u=o.left+(h&&a.left),f=o.top+(h&&a.top);let{width:d,height:g}=t;return r&&(d-=o.width+a.width,g-=o.height+a.height),{x:Math.round((l-u)/d*e.width/i),y:Math.round((c-f)/g*e.height/i)}}function K2(n,t,e){let i,s;if(t===void 0||e===void 0){const r=_h(n);if(!r)t=n.clientWidth,e=n.clientHeight;else{const o=r.getBoundingClientRect(),a=ya(r),l=Zn(a,"border","width"),c=Zn(a,"padding");t=o.width-c.width-l.width,e=o.height-c.height-l.height,i=Jo(a.maxWidth,r,"clientWidth"),s=Jo(a.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||Uo,maxHeight:s||Uo}}const al=n=>Math.round(n*10)/10;function Z2(n,t,e,i){const s=ya(n),r=Zn(s,"margin"),o=Jo(s.maxWidth,n,"clientWidth")||Uo,a=Jo(s.maxHeight,n,"clientHeight")||Uo,l=K2(n,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const u=Zn(s,"border","width"),f=Zn(s,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-r.width),h=Math.max(0,i?Math.floor(c/i):h-r.height),c=al(Math.min(c,o,l.maxWidth)),h=al(Math.min(h,a,l.maxHeight)),c&&!h&&(h=al(c/2)),{width:c,height:h}}function ag(n,t,e){const i=t||1,s=Math.floor(n.height*i),r=Math.floor(n.width*i);n.height=s/i,n.width=r/i;const o=n.canvas;return o.style&&(e||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==r?(n.currentDevicePixelRatio=i,o.height=s,o.width=r,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const J2=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return n}();function lg(n,t){const e=U2(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Nn(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function Q2(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function tD(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},r={x:t.cp1x,y:t.cp1y},o=Nn(n,s,e),a=Nn(s,r,e),l=Nn(r,t,e),c=Nn(o,a,e),h=Nn(a,l,e);return Nn(c,h,e)}const cg=new Map;function eD(n,t){t=t||{};const e=n+JSON.stringify(t);let i=cg.get(e);return i||(i=new Intl.NumberFormat(n,t),cg.set(e,i)),i}function gr(n,t,e){return eD(t,e).format(n)}const nD=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},iD=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function ll(n,t,e){return n?nD(t,e):iD()}function sD(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function rD(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function gy(n){return n==="angle"?{between:nr,compare:jO,normalize:ge}:{between:Xo,compare:(t,e)=>t-e,normalize:t=>t}}function hg({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function oD(n,t,e){const{property:i,start:s,end:r}=e,{between:o,normalize:a}=gy(i),l=t.length;let{start:c,end:h,loop:u}=n,f,d;if(u){for(c+=l,h+=l,f=0,d=l;fl(s,v,x)&&a(s,v)!==0,_=()=>a(r,x)===0||l(r,v,x),w=()=>p||b(),M=()=>!p||_();for(let S=h,P=h;S<=u;++S)m=t[S%o],!m.skip&&(x=c(m[i]),x!==v&&(p=l(x,s,r),y===null&&w()&&(y=a(x,s)===0?S:P),y!==null&&M()&&(g.push(hg({start:y,end:S,loop:f,count:o,style:d})),y=null),P=S,v=x));return y!==null&&g.push(hg({start:y,end:u,loop:f,count:o,style:d})),g}function lD(n,t){const e=[],i=n.segments;for(let s=0;ss&&n[r%t].skip;)r--;return r%=t,{start:s,end:r}}function hD(n,t,e,i){const s=n.length,r=[];let o=t,a=n[t],l;for(l=t+1;l<=e;++l){const c=n[l%s];c.skip||c.stop?a.skip||(i=!1,r.push({start:t%s,end:(l-1)%s,loop:i}),t=o=c.stop?l:null):(o=l,a.skip&&(t=l)),a=c}return o!==null&&r.push({start:t%s,end:o%s,loop:i}),r}function uD(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const r=!!n._loop,{start:o,end:a}=cD(e,s,r,i);if(i===!0)return ug(n,[{start:o,end:a,loop:r}],e,t);const l=aMath.max(Math.min(n,e),t);function Cs(n){return un(dr(n*2.55),0,255)}function gn(n){return un(dr(n*255),0,255)}function Ve(n){return un(dr(n/2.55)/100,0,1)}function Qd(n){return un(dr(n*100),0,100)}const ie={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},ec=[..."0123456789ABCDEF"],YO=n=>ec[n&15],UO=n=>ec[(n&240)>>4]+ec[n&15],Fr=n=>(n&240)>>4===(n&15),XO=n=>Fr(n.r)&&Fr(n.g)&&Fr(n.b)&&Fr(n.a);function GO(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&ie[n[1]]*17,g:255&ie[n[2]]*17,b:255&ie[n[3]]*17,a:t===5?ie[n[4]]*17:255}:(t===7||t===9)&&(e={r:ie[n[1]]<<4|ie[n[2]],g:ie[n[3]]<<4|ie[n[4]],b:ie[n[5]]<<4|ie[n[6]],a:t===9?ie[n[7]]<<4|ie[n[8]]:255})),e}const qO=(n,t)=>n<255?t(n):"";function KO(n){var t=XO(n)?YO:UO;return n?"#"+t(n.r)+t(n.g)+t(n.b)+qO(n.a,t):void 0}const JO=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Qb(n,t,e){const i=t*Math.min(e,1-e),s=(r,o=(r+n/30)%12)=>e-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function ZO(n,t,e){const i=(s,r=(s+n/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function QO(n,t,e){const i=Qb(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function t2(n,t,e,i,s){return n===s?(t-e)/i+(t.5?h/(2-r-o):h/(r+o),l=t2(e,i,s,h,r),l=l*60+.5),[l|0,c||0,a]}function dh(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(gn)}function gh(n,t,e){return dh(Qb,n,t,e)}function e2(n,t,e){return dh(QO,n,t,e)}function n2(n,t,e){return dh(ZO,n,t,e)}function ty(n){return(n%360+360)%360}function i2(n){const t=JO.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Cs(+t[5]):gn(+t[5]));const s=ty(+t[2]),r=+t[3]/100,o=+t[4]/100;return t[1]==="hwb"?i=e2(s,r,o):t[1]==="hsv"?i=n2(s,r,o):i=gh(s,r,o),{r:i[0],g:i[1],b:i[2],a:e}}function s2(n,t){var e=fh(n);e[0]=ty(e[0]+t),e=gh(e),n.r=e[0],n.g=e[1],n.b=e[2]}function r2(n){if(!n)return;const t=fh(n),e=t[0],i=Qd(t[1]),s=Qd(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Ve(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const tg={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},eg={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function o2(){const n={},t=Object.keys(eg),e=Object.keys(tg);let i,s,r,o,a;for(i=0;i>16&255,r>>8&255,r&255]}return n}let Br;function a2(n){Br||(Br=o2(),Br.transparent=[0,0,0,0]);const t=Br[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const l2=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function c2(n){const t=l2.exec(n);let e=255,i,s,r;if(t){if(t[7]!==i){const o=+t[7];e=t[8]?Cs(o):un(o*255,0,255)}return i=+t[1],s=+t[3],r=+t[5],i=255&(t[2]?Cs(i):un(i,0,255)),s=255&(t[4]?Cs(s):un(s,0,255)),r=255&(t[6]?Cs(r):un(r,0,255)),{r:i,g:s,b:r,a:e}}}function h2(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Ve(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const sl=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,ui=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function u2(n,t,e){const i=ui(Ve(n.r)),s=ui(Ve(n.g)),r=ui(Ve(n.b));return{r:gn(sl(i+e*(ui(Ve(t.r))-i))),g:gn(sl(s+e*(ui(Ve(t.g))-s))),b:gn(sl(r+e*(ui(Ve(t.b))-r))),a:n.a+e*(t.a-n.a)}}function zr(n,t,e){if(n){let i=fh(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=gh(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function ey(n,t){return n&&Object.assign(t||{},n)}function ng(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=gn(n[3]))):(t=ey(n,{r:0,g:0,b:0,a:1}),t.a=gn(t.a)),t}function f2(n){return n.charAt(0)==="r"?c2(n):i2(n)}class Go{constructor(t){if(t instanceof Go)return t;const e=typeof t;let i;e==="object"?i=ng(t):e==="string"&&(i=GO(t)||a2(t)||f2(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=ey(this._rgb);return t&&(t.a=Ve(t.a)),t}set rgb(t){this._rgb=ng(t)}rgbString(){return this._valid?h2(this._rgb):void 0}hexString(){return this._valid?KO(this._rgb):void 0}hslString(){return this._valid?r2(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let r;const o=e===r?.5:e,a=2*o-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;r=1-c,i.r=255&c*i.r+r*s.r+.5,i.g=255&c*i.g+r*s.g+.5,i.b=255&c*i.b+r*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=u2(this._rgb,t._rgb,e)),this}clone(){return new Go(this.rgb)}alpha(t){return this._rgb.a=gn(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=dr(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return zr(this._rgb,2,t),this}darken(t){return zr(this._rgb,2,-t),this}saturate(t){return zr(this._rgb,1,t),this}desaturate(t){return zr(this._rgb,1,-t),this}rotate(t){return s2(this._rgb,t),this}}function ny(n){return new Go(n)}function iy(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ig(n){return iy(n)?n:ny(n)}function rl(n){return iy(n)?n:ny(n).saturate(.5).darken(.1).hexString()}const ei=Object.create(null),nc=Object.create(null);function $s(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;ie.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,i)=>rl(i.backgroundColor),this.hoverBorderColor=(e,i)=>rl(i.borderColor),this.hoverColor=(e,i)=>rl(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return ol(this,t,e)}get(t){return $s(this,t)}describe(t,e){return ol(nc,t,e)}override(t,e){return ol(ei,t,e)}route(t,e,i,s){const r=$s(this,t),o=$s(this,i),a="_"+e;Object.defineProperties(r,{[a]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=o[s];return K(l)?Object.assign({},c,l):G(l,c)},set(l){this[a]=l}}})}}var Y=new d2({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function g2(n){return!n||nt(n.size)||nt(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function qo(n,t,e,i,s){let r=t[s];return r||(r=t[s]=n.measureText(s).width,e.push(s)),r>i&&(i=r),i}function p2(n,t,e,i){i=i||{};let s=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},r=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let o=0;const a=e.length;let l,c,h,u,f;for(l=0;le.length){for(l=0;l0&&n.stroke()}}function ir(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.xt.top-e&&n.y0&&r.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,_2(n,r),l=0;l+n||0;function ph(n,t){const e={},i=K(t),s=i?Object.keys(t):t,r=K(n)?i?o=>G(n[o],n[t[o]]):o=>n[o]:()=>n;for(const o of s)e[o]=M2(r(o));return e}function oy(n){return ph(n,{top:"y",right:"x",bottom:"y",left:"x"})}function ki(n){return ph(n,["topLeft","topRight","bottomLeft","bottomRight"])}function ue(n){const t=oy(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Qt(n,t){n=n||{},t=t||Y.font;let e=G(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=G(n.style,t.style);i&&!(""+i).match(w2)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");const s={family:G(n.family,t.family),lineHeight:S2(G(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:G(n.weight,t.weight),string:""};return s.string=g2(s),s}function Nr(n,t,e,i){let s=!0,r,o,a;for(r=0,o=n.length;re&&a===0?0:a+l;return{min:o(i,-Math.abs(r)),max:o(s,r)}}function An(n,t){return Object.assign(Object.create(n),t)}function mh(n,t=[""],e=n,i,s=()=>n[0]){he(i)||(i=hy("_fallback",n));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:e,_fallback:i,_getTarget:s,override:o=>mh([o,...n],t,e,i)};return new Proxy(r,{deleteProperty(o,a){return delete o[a],delete o._keys,delete n[0][a],!0},get(o,a){return ly(o,a,()=>T2(a,t,n,o))},getOwnPropertyDescriptor(o,a){return Reflect.getOwnPropertyDescriptor(o._scopes[0],a)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(o,a){return og(o).includes(a)},ownKeys(o){return og(o)},set(o,a,l){const c=o._storage||(o._storage=s());return o[a]=c[a]=l,delete o._keys,!0}})}function Ii(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:ay(n,i),setContext:r=>Ii(n,r,e,i),override:r=>Ii(n.override(r),t,e,i)};return new Proxy(s,{deleteProperty(r,o){return delete r[o],delete n[o],!0},get(r,o,a){return ly(r,o,()=>A2(r,o,a))},getOwnPropertyDescriptor(r,o){return r._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(r,o,a){return n[o]=a,delete r[o],!0}})}function ay(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:yn(e)?e:()=>e,isIndexable:yn(i)?i:()=>i}}const P2=(n,t)=>n?n+ch(t):t,bh=(n,t)=>K(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function ly(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];const i=e();return n[t]=i,i}function A2(n,t,e){const{_proxy:i,_context:s,_subProxy:r,_descriptors:o}=n;let a=i[t];return yn(a)&&o.isScriptable(t)&&(a=C2(t,a,n,e)),ut(a)&&a.length&&(a=O2(t,a,n,o.isIndexable)),bh(t,a)&&(a=Ii(a,s,r&&r[t],o)),a}function C2(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_stack:a}=e;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);return a.add(n),t=t(r,o||i),a.delete(n),bh(n,t)&&(t=yh(s._scopes,s,n,t)),t}function O2(n,t,e,i){const{_proxy:s,_context:r,_subProxy:o,_descriptors:a}=e;if(he(r.index)&&i(n))t=t[r.index%t.length];else if(K(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=yh(c,s,n,h);t.push(Ii(u,r,o&&o[n],a))}}return t}function cy(n,t,e){return yn(n)?n(t,e):n}const D2=(n,t)=>n===!0?t:typeof n=="string"?bn(t,n):void 0;function E2(n,t,e,i,s){for(const r of t){const o=D2(e,r);if(o){n.add(o);const a=cy(o._fallback,e,s);if(he(a)&&a!==e&&a!==i)return a}else if(o===!1&&he(i)&&e!==i)return null}return!1}function yh(n,t,e,i){const s=t._rootScopes,r=cy(t._fallback,e,i),o=[...n,...s],a=new Set;a.add(i);let l=rg(a,o,e,r||e,i);return l===null||he(r)&&r!==e&&(l=rg(a,o,r,l,i),l===null)?!1:mh(Array.from(a),[""],s,r,()=>L2(t,e,i))}function rg(n,t,e,i,s){for(;e;)e=E2(n,t,e,i,s);return e}function L2(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return ut(s)&&K(e)?e:s}function T2(n,t,e,i){let s;for(const r of t)if(s=hy(P2(r,n),e),he(s))return bh(n,s)?yh(e,i,n,s):s}function hy(n,t){for(const e of t){if(!e)continue;const i=e[n];if(he(i))return i}}function og(n){let t=n._keys;return t||(t=n._keys=R2(n._scopes)),t}function R2(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function uy(n,t,e,i){const{iScale:s}=n,{key:r="r"}=this._parsing,o=new Array(i);let a,l,c,h;for(a=0,l=i;atn==="x"?"y":"x";function F2(n,t,e,i){const s=n.skip?t:n,r=t,o=e.skip?t:e,a=tc(r,s),l=tc(o,r);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=i*c,f=i*h;return{previous:{x:r.x-u*(o.x-s.x),y:r.y-u*(o.y-s.y)},next:{x:r.x+f*(o.x-s.x),y:r.y+f*(o.y-s.y)}}}function B2(n,t,e){const i=n.length;let s,r,o,a,l,c=Fi(n,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")N2(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,o=n.length;rwindow.getComputedStyle(n,null);function j2(n,t){return ya(n).getPropertyValue(t)}const H2=["top","right","bottom","left"];function Jn(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const r=H2[s];i[r]=parseFloat(n[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const $2=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function Y2(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:r}=i;let o=!1,a,l;if($2(s,r,n.target))a=s,l=r;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function zn(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=ya(e),r=s.boxSizing==="border-box",o=Jn(s,"padding"),a=Jn(s,"border","width"),{x:l,y:c,box:h}=Y2(n,e),u=o.left+(h&&a.left),f=o.top+(h&&a.top);let{width:d,height:g}=t;return r&&(d-=o.width+a.width,g-=o.height+a.height),{x:Math.round((l-u)/d*e.width/i),y:Math.round((c-f)/g*e.height/i)}}function U2(n,t,e){let i,s;if(t===void 0||e===void 0){const r=_h(n);if(!r)t=n.clientWidth,e=n.clientHeight;else{const o=r.getBoundingClientRect(),a=ya(r),l=Jn(a,"border","width"),c=Jn(a,"padding");t=o.width-c.width-l.width,e=o.height-c.height-l.height,i=Zo(a.maxWidth,r,"clientWidth"),s=Zo(a.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||Uo,maxHeight:s||Uo}}const al=n=>Math.round(n*10)/10;function X2(n,t,e,i){const s=ya(n),r=Jn(s,"margin"),o=Zo(s.maxWidth,n,"clientWidth")||Uo,a=Zo(s.maxHeight,n,"clientHeight")||Uo,l=U2(n,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const u=Jn(s,"border","width"),f=Jn(s,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-r.width),h=Math.max(0,i?Math.floor(c/i):h-r.height),c=al(Math.min(c,o,l.maxWidth)),h=al(Math.min(h,a,l.maxHeight)),c&&!h&&(h=al(c/2)),{width:c,height:h}}function ag(n,t,e){const i=t||1,s=Math.floor(n.height*i),r=Math.floor(n.width*i);n.height=s/i,n.width=r/i;const o=n.canvas;return o.style&&(e||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==r?(n.currentDevicePixelRatio=i,o.height=s,o.width=r,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const G2=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return n}();function lg(n,t){const e=j2(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Nn(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function q2(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function K2(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},r={x:t.cp1x,y:t.cp1y},o=Nn(n,s,e),a=Nn(s,r,e),l=Nn(r,t,e),c=Nn(o,a,e),h=Nn(a,l,e);return Nn(c,h,e)}const cg=new Map;function J2(n,t){t=t||{};const e=n+JSON.stringify(t);let i=cg.get(e);return i||(i=new Intl.NumberFormat(n,t),cg.set(e,i)),i}function gr(n,t,e){return J2(t,e).format(n)}const Z2=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},Q2=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function ll(n,t,e){return n?Z2(t,e):Q2()}function tD(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function eD(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function gy(n){return n==="angle"?{between:nr,compare:zO,normalize:ge}:{between:Xo,compare:(t,e)=>t-e,normalize:t=>t}}function hg({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function nD(n,t,e){const{property:i,start:s,end:r}=e,{between:o,normalize:a}=gy(i),l=t.length;let{start:c,end:h,loop:u}=n,f,d;if(u){for(c+=l,h+=l,f=0,d=l;fl(s,v,x)&&a(s,v)!==0,_=()=>a(r,x)===0||l(r,v,x),w=()=>p||b(),M=()=>!p||_();for(let S=h,P=h;S<=u;++S)m=t[S%o],!m.skip&&(x=c(m[i]),x!==v&&(p=l(x,s,r),y===null&&w()&&(y=a(x,s)===0?S:P),y!==null&&M()&&(g.push(hg({start:y,end:S,loop:f,count:o,style:d})),y=null),P=S,v=x));return y!==null&&g.push(hg({start:y,end:u,loop:f,count:o,style:d})),g}function sD(n,t){const e=[],i=n.segments;for(let s=0;ss&&n[r%t].skip;)r--;return r%=t,{start:s,end:r}}function oD(n,t,e,i){const s=n.length,r=[];let o=t,a=n[t],l;for(l=t+1;l<=e;++l){const c=n[l%s];c.skip||c.stop?a.skip||(i=!1,r.push({start:t%s,end:(l-1)%s,loop:i}),t=o=c.stop?l:null):(o=l,a.skip&&(t=l)),a=c}return o!==null&&r.push({start:t%s,end:o%s,loop:i}),r}function aD(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const r=!!n._loop,{start:o,end:a}=rD(e,s,r,i);if(i===!0)return ug(n,[{start:o,end:a,loop:r}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=qb.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const r=i.items;let o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(r[o]=r[r.length-1],r.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Be=new gD;const dg="transparent",pD={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=ig(n||dg),s=i.valid&&ig(t||dg);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class mD{constructor(t,e,i,s){const r=e[i];s=Nr([t.to,s,r,t.from]);const o=Nr([t.from,r,s]);this._active=!0,this._fn=t.fn||pD[t.type||typeof o],this._easing=Hs[t.easing]||Hs.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],r=i-this._start,o=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=Nr([t.to,e,s,t.from]),this._from=Nr([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,r=this._from,o=this._loop,a=this._to;let l;if(this._active=r!==a&&(o||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;sn!=="onProgress"&&n!=="onComplete"&&n!=="fn"});Y.set("animations",{colors:{type:"color",properties:yD},numbers:{type:"number",properties:bD}});Y.describe("animations",{_fallback:"animation"});Y.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:n=>n|0}}}});class py{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!K(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const s=t[i];if(!K(s))return;const r={};for(const o of _D)r[o]=s[o];(ut(s.properties)&&s.properties||[i]).forEach(o=>{(o===i||!e.has(o))&&e.set(o,r)})})}_animateOptions(t,e){const i=e.options,s=xD(t,i);if(!s)return[];const r=this._createAnimations(s,i);return i.$shared&&vD(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,s=[],r=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=r[c];const f=i.get(c);if(u)if(f&&u.active()){u.update(f,h,a);continue}else u.cancel();if(!f||!f.duration){t[c]=h;continue}r[c]=u=new mD(f,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Be.add(this._chart,i),!0}}function vD(n,t){const e=[],i=Object.keys(t);for(let s=0;s0||!e&&r<0)return s.index}return null}function yg(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:r,vScale:o,index:a}=i,l=r.axis,c=o.axis,h=kD(r,o,i),u=t.length;let f;for(let d=0;de[i].axis===t).shift()}function CD(n,t){return An(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function OD(n,t,e){return An(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function is(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const r=s._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e]}}}const hl=n=>n==="reset"||n==="none",_g=(n,t)=>t?n:Object.assign({},n),DD=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:my(e,!0),values:null};class ye{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=mg(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&is(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(u,f,d,g)=>u==="x"?f:u==="r"?g:d,r=e.xAxisID=G(i.xAxisID,cl(t,"x")),o=e.yAxisID=G(i.yAxisID,cl(t,"y")),a=e.rAxisID=G(i.rAxisID,cl(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,o,a),h=e.vAxisID=s(l,o,r,a);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&qd(this._data,this),t._stacked&&is(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(K(e))this._data=MD(e);else if(i!==e){if(i){qd(i,this);const s=this._cachedMeta;is(s),s._parsed=[]}e&&Object.isExtensible(e)&&UO(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const r=e._stacked;e._stacked=mg(e.vScale,e),e.stack!==i.stack&&(s=!0,is(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&yg(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:o}=i,a=r.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,u,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{ut(s[t])?f=this.parseArrayData(i,s,t,e):K(s[t])?f=this.parseObjectData(i,s,t,e):f=this.parsePrimitiveData(i,s,t,e);const d=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!g()){this.updateRangeFromParsed(c,t,d,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,r,o;for(s=0,r=e.length;s=0&&tthis.getContext(i,s),p=c.resolveNamedOptions(f,d,g,u);return p.$shared&&(p.$shared=l,r[o]=Object.freeze(_g(p,l))),p}_resolveAnimations(t,e,i){const s=this.chart,r=this._cachedDataOpts,o=`animation-${e}`,a=r[o];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(f,this.getContext(t,i,e))}const c=new py(s,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||hl(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(i),o=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:o}}updateElement(t,e,i,s){hl(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!hl(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,r=e.length,o=Math.min(r,s);o&&this.parse(0,o),r>s?this._insertElements(s,r-s,t):r{for(c.length+=e,a=c.length-1;a>=o;a--)c[a]=c[a-e]};for(l(r),a=t;as-r))}return n._cache.$bar}function LD(n){const t=n.iScale,e=ED(t,n.type);let i=t._length,s,r,o,a;const l=()=>{o===32767||o===-32768||(he(a)&&(i=Math.min(i,Math.abs(o-a)||i)),a=o)};for(s=0,r=e.length;s0?s[n-1]:null,a=nMath.abs(a)&&(l=a,c=o),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:o,max:a}}function by(n,t,e,i){return ut(n)?ID(n,t,e,i):t[e.axis]=e.parse(n,i),t}function vg(n,t,e,i){const s=n.iScale,r=n.vScale,o=s.getLabels(),a=s===r,l=[];let c,h,u,f;for(c=e,h=e+i;c=e?1:-1)}function BD(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.basel.controller.options.grouped),r=i.options.stacked,o=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(nt(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((r===!1||o.indexOf(l.stack)===-1||r===void 0&&l.stack===void 0)&&o.push(l.stack),l.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let r,o;for(r=0,o=e.data.length;r=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:s}=e,r=this.getParsed(t),o=i.getLabelForValue(r.x),a=s.getLabelForValue(r.y),l=r._custom;return{label:e.label,value:"("+o+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=o.axis,u=a.axis;for(let f=e;fnr(v,a,l,!0)?1:Math.max(b,b*e,_,_*e),g=(v,b,_)=>nr(v,a,l,!0)?-1:Math.min(b,b*e,_,_*e),p=d(0,c,u),y=d(bt,h,f),x=g(yt,c,u),m=g(yt+bt,h,f);i=(p-x)/2,s=(y-m)/2,r=-(p+x)/2,o=-(y+m)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:o}}class pr extends ye{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let r=l=>+i[l];if(K(i[t])){const{key:l="value"}=this._parsing;r=c=>+yn(i[c],l)}let o,a;for(o=t,a=t+e;o0&&!isNaN(t)?rt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=gr(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,r,o,a,l;if(!t){for(s=0,r=i.data.datasets.length;sn!=="spacing",_indexable:n=>n!=="spacing"};pr.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const t=n.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=n.legend.options;return t.labels.map((i,s)=>{const o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:e,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){let t=n.label;const e=": "+n.formattedValue;return ut(t)?(t=t.slice(),t[0]+=e):t+=e,t}}}}};class wh extends ye{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:r}=e,o=this.chart._animationsDisabled;let{start:a,count:l}=Zb(e,s,o);this._drawStart=a,this._drawCount=l,Jb(e)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),f=o.axis,d=a.axis,{spanGaps:g,segment:p}=this.options,y=Ri(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||r||s==="none";let m=e>0&&this.getParsed(e-1);for(let v=e;v0&&Math.abs(_[f]-m[f])>y,p&&(w.parsed=_,w.raw=c.data[v]),u&&(w.options=h||this.resolveDataElementOptions(v,b.active?"active":s)),x||this.updateElement(b,v,w,s),m=_}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const r=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}wh.id="line";wh.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};wh.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Sh extends ye{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=gr(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return uy.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(re.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),o=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),a=(r-o)/t.getVisibleDatasetCount();this.outerRadius=r-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){const r=s==="reset",o=this.chart,l=o.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,f=c.getIndexAngle(0)-.5*yt;let d=f,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?me(this.resolveDataElementOptions(t,e).angle||i):0}}Sh.id="polarArea";Sh.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};Sh.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const t=n.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=n.legend.options;return t.labels.map((i,s)=>{const o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:e,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){return n.chart.data.labels[n.dataIndex]+": "+n.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class yy extends pr{}yy.id="pie";yy.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Mh extends ye{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return uy.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){const o=this.resolveDatasetElementOptions(t);this.options.showLine||(o.borderWidth=0);const a={_loop:!0,_fullLoop:r.length===s.length,options:o};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const r=this._cachedMeta.rScale,o=s==="reset";for(let a=e;a{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}}Qe.defaults={};Qe.defaultRoutes=void 0;const _y={values(n){return ut(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,r=n;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=jD(n,e)}const o=oe(Math.abs(r)),a=Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),gr(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";const i=n/Math.pow(10,Math.floor(oe(n)));return i===1||i===2||i===5?_y.numeric.call(this,n,t,e):""}};function jD(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var _a={formatters:_y};Y.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(n,t)=>t.lineWidth,tickColor:(n,t)=>t.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:_a.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});Y.route("scale.ticks","color","","color");Y.route("scale.grid","color","","borderColor");Y.route("scale.grid","borderColor","","borderColor");Y.route("scale.title","color","","color");Y.describe("scale",{_fallback:!1,_scriptable:n=>!n.startsWith("before")&&!n.startsWith("after")&&n!=="callback"&&n!=="parser",_indexable:n=>n!=="borderDash"&&n!=="tickBorderDash"});Y.describe("scales",{_fallback:"scale"});Y.describe("scale.ticks",{_scriptable:n=>n!=="backdropPadding"&&n!=="callback",_indexable:n=>n!=="backdropPadding"});function HD(n,t){const e=n.options.ticks,i=e.maxTicksLimit||$D(n),s=e.major.enabled?UD(t):[],r=s.length,o=s[0],a=s[r-1],l=[];if(r>i)return XD(t,l,s,r/i),l;const c=YD(s,t,i);if(r>0){let h,u;const f=r>1?Math.round((a-o)/(r-1)):null;for(Vr(t,l,c,nt(f)?0:o-f,o),h=0,u=r-1;hs)return l}return Math.max(s,1)}function UD(n){const t=[];let e,i;for(e=0,i=n.length;en==="left"?"right":n==="right"?"left":n,Sg=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e;function Mg(n,t){const e=[],i=n.length/t,s=n.length;let r=0;for(;ro+a)))return l}function ZD(n,t){et(n,e=>{const i=e.gc,s=i.length/2;let r;if(s>t){for(r=0;ri?i:e,i=s&&e>i?e:i,{min:se(e,se(i,e)),max:se(i,se(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){gt(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=O2(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,f=h.highest.height,d=It(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/i:d/(i-1),u+6>a&&(a=d/(i-(t.offset?.5:1)),l=this.maxHeight-ss(t.grid)-e.padding-kg(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),o=hh(Math.min(Math.asin(It((h.highest.height+6)/a,-1,1)),Math.asin(It(l/c,-1,1))-Math.asin(It(f/c,-1,1)))),o=Math.max(s,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){gt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){gt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=kg(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=ss(r)+l):(t.height=this.maxHeight,t.width=ss(r)+l),i.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:f}=this._getLabelSizes(),d=i.padding*2,g=me(this.labelRotation),p=Math.cos(g),y=Math.sin(g);if(a){const x=i.mirror?0:y*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+x+d)}else{const x=i.mirror?0:p*u.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+x+d)}this._calculatePadding(c,h,y,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,d=0;l?c?(f=s*t.width,d=i*e.height):(f=i*t.height,d=s*e.width):r==="start"?d=e.width:r==="end"?f=t.width:r!=="inner"&&(f=t.width/2,d=e.width/2),this.paddingLeft=Math.max((f-h+o)*this.width/(this.width-h),0),this.paddingRight=Math.max((d-u+o)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;r==="start"?(h=0,u=t.height):r==="end"&&(h=e.height,u=0),this.paddingTop=h+o,this.paddingBottom=u+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){gt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:r[M]||0,height:o[M]||0});return{first:w(0),last:w(e-1),widest:w(b),highest:w(_),widths:r,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return HO(this._alignToPixels?Rn(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:r,position:o}=s,a=r.offset,l=this.isHorizontal(),h=this.ticks.length+(a?1:0),u=ss(r),f=[],d=r.setContext(this.getContext()),g=d.drawBorder?d.borderWidth:0,p=g/2,y=function(O){return Rn(i,O,g)};let x,m,v,b,_,w,M,S,P,C,k,A;if(o==="top")x=y(this.bottom),w=this.bottom-u,S=x-p,C=y(t.top)+p,A=t.bottom;else if(o==="bottom")x=y(this.top),C=t.top,A=y(t.bottom)-p,w=x+p,S=this.top+u;else if(o==="left")x=y(this.right),_=this.right-u,M=x-p,P=y(t.left)+p,k=t.right;else if(o==="right")x=y(this.left),P=t.left,k=y(t.right)-p,_=x+p,M=this.left+u;else if(e==="x"){if(o==="center")x=y((t.top+t.bottom)/2+.5);else if(K(o)){const O=Object.keys(o)[0],E=o[O];x=y(this.chart.scales[O].getPixelForValue(E))}C=t.top,A=t.bottom,w=x+p,S=w+u}else if(e==="y"){if(o==="center")x=y((t.left+t.right)/2);else if(K(o)){const O=Object.keys(o)[0],E=o[O];x=y(this.chart.scales[O].getPixelForValue(E))}_=x-p,M=_-u,P=t.left,k=t.right}const L=G(s.ticks.maxTicksLimit,h),R=Math.max(1,Math.ceil(h/L));for(m=0;mr.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,o;const a=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,o=s.length;r{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let r,o;for(r=0,o=e.length;r{const i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),o=t[e].split("."),a=o.pop(),l=o.join(".");Y.route(r,s,l,a)})}function sE(n){return"id"in n&&"defaults"in n}class rE{constructor(){this.controllers=new jr(ye,"datasets",!0),this.elements=new jr(Qe,"elements"),this.plugins=new jr(Object,"plugins"),this.scales=new jr(si,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):et(s,o=>{const a=i||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,e,i){const s=ch(t);gt(i["before"+s],[],i),e[t](i),gt(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e0&&this.getParsed(e-1);for(let b=e;b0&&Math.abs(w[d]-v[d])>x,y&&(M.parsed=w,M.raw=c.data[b]),f&&(M.options=u||this.resolveDataElementOptions(b,_.active?"active":s)),m||this.updateElement(_,b,M,s),v=w}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const r=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,o)/2}}kh.id="scatter";kh.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};kh.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(n){return"("+n.label+", "+n.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};function In(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class sc{constructor(t){this.options=t||{}}init(t){}formats(){return In()}parse(t,e){return In()}format(t,e){return In()}add(t,e,i){return In()}diff(t,e,i){return In()}startOf(t,e,i){return In()}endOf(t,e){return In()}}sc.override=function(n){Object.assign(sc.prototype,n)};var oE={_date:sc};function aE(n,t,e,i){const{controller:s,data:r,_sorted:o}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&o&&r.length){const l=a._reversePixels?$O:Hn;if(i){if(s._sharedOptions){const c=r[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(r,t,e-h),f=l(r,t,e+h);return{lo:u.lo,hi:f.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function mr(n,t,e,i,s){const r=n.getSortedVisibleDatasetMetas(),o=e[t];for(let a=0,l=r.length;a{l[o](t[e],s)&&(r.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:r}var uE={evaluateInteractionItems:mr,modes:{index(n,t,e,i){const s=zn(t,n),r=e.axis||"x",o=e.includeInvisible||!1,a=e.intersect?fl(n,s,r,i,o):dl(n,s,r,!1,i,o),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(n,t,e,i){const s=zn(t,n),r=e.axis||"xy",o=e.includeInvisible||!1;let a=e.intersect?fl(n,s,r,i,o):dl(n,s,r,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function Ag(n,t){return n.filter(e=>vy.indexOf(e.pos)===-1&&e.box.axis===t)}function os(n,t){return n.sort((e,i)=>{const s=t?i:e,r=t?e:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function fE(n){const t=[];let e,i,s,r,o,a;for(e=0,i=(n||[]).length;ec.box.fullSize),!0),i=os(rs(t,"left"),!0),s=os(rs(t,"right")),r=os(rs(t,"top"),!0),o=os(rs(t,"bottom")),a=Ag(t,"x"),l=Ag(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(o).concat(a),chartArea:rs(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(o).concat(a)}}function Cg(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function xy(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function mE(n,t,e,i){const{pos:s,box:r}=e,o=n.maxPadding;if(!K(s)){e.size&&(n[s]-=e.size);const u=i[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?r.height:r.width),e.size=u.size/u.count,n[s]+=e.size}r.getPadding&&xy(o,r.getPadding());const a=Math.max(0,t.outerWidth-Cg(o,n,"left","right")),l=Math.max(0,t.outerHeight-Cg(o,n,"top","bottom")),c=a!==n.w,h=l!==n.h;return n.w=a,n.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function bE(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function yE(n,t){const e=t.maxPadding;function i(s){const r={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{r[o]=Math.max(t[o],e[o])}),r}return i(n?["left","right"]:["top","bottom"])}function Os(n,t,e,i){const s=[];let r,o,a,l,c,h;for(r=0,o=n.length,c=0;r{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/h,hBoxMaxHeight:o/2}),f=Object.assign({},s);xy(f,ue(i));const d=Object.assign({maxPadding:f,w:r,h:o,x:s.left,y:s.top},s),g=gE(l.concat(c),u);Os(a.fullSize,d,u,g),Os(l,d,u,g),Os(c,d,u,g)&&Os(l,d,u,g),bE(d),Og(a.leftAndTop,d,u,g),d.x+=d.w,d.y+=d.h,Og(a.rightAndBottom,d,u,g),n.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},et(a.chartArea,p=>{const y=p.box;Object.assign(y,n.chartArea),y.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})})}};class wy{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class _E extends wy{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const go="$chartjs",vE={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Dg=n=>n===null||n==="";function xE(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[go]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Dg(s)){const r=lg(n,"width");r!==void 0&&(n.width=r)}if(Dg(i))if(n.style.height==="")n.height=n.width/(t||2);else{const r=lg(n,"height");r!==void 0&&(n.height=r)}return n}const Sy=J2?{passive:!0}:!1;function wE(n,t,e){n.addEventListener(t,e,Sy)}function SE(n,t,e){n.canvas.removeEventListener(t,e,Sy)}function ME(n,t){const e=vE[n.type]||n.type,{x:i,y:s}=zn(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Qo(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function kE(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Qo(a.addedNodes,i),o=o&&!Qo(a.removedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function PE(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Qo(a.removedNodes,i),o=o&&!Qo(a.addedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const sr=new Map;let Eg=0;function My(){const n=window.devicePixelRatio;n!==Eg&&(Eg=n,sr.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function AE(n,t){sr.size||window.addEventListener("resize",My),sr.set(n,t)}function CE(n){sr.delete(n),sr.size||window.removeEventListener("resize",My)}function OE(n,t,e){const i=n.canvas,s=i&&_h(i);if(!s)return;const r=Kb((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||r(c,h)});return o.observe(s),AE(n,r),o}function gl(n,t,e){e&&e.disconnect(),t==="resize"&&CE(n)}function DE(n,t,e){const i=n.canvas,s=Kb(r=>{n.ctx!==null&&e(ME(r,n))},n,r=>{const o=r[0];return[o,o.offsetX,o.offsetY]});return wE(i,t,s),s}class EE extends wy{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(xE(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[go])return!1;const i=e[go].initial;["height","width"].forEach(r=>{const o=i[r];nt(o)?e.removeAttribute(r):e.setAttribute(r,o)});const s=i.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[go],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),o={attach:kE,detach:PE,resize:OE}[e]||DE;s[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:gl,detach:gl,resize:gl}[e]||SE)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Z2(t,e,i,s)}isAttached(t){const e=_h(t);return!!(e&&e.isConnected)}}function LE(n){return!dy()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?_E:EE}class TE{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const r=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(r,t,e,i);return e==="afterDestroy"&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,s){s=s||{};for(const r of t){const o=r.plugin,a=o[i],l=[e,s,r.options];if(gt(a,l,o)===!1&&s.cancelable)return!1}return!0}invalidate(){nt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=G(i.options&&i.options.plugins,{}),r=RE(i);return s===!1&&!e?[]:FE(t,r,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(r,o)=>r.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function RE(n){const t={},e=[],i=Object.keys(Pe.plugins.items);for(let r=0;r{const l=i[a];if(!K(l))return console.error(`Invalid scale configuration for scale: ${a}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const c=oc(a,l),h=NE(c,s),u=e.scales||{};r[c]=r[c]||a,o[a]=Vs(Object.create(null),[{axis:c},l,u[c],u[h]])}),n.data.datasets.forEach(a=>{const l=a.type||n.type,c=a.indexAxis||rc(l,t),u=(ei[l]||{}).scales||{};Object.keys(u).forEach(f=>{const d=zE(f,c),g=a[d+"AxisID"]||r[d]||d;o[g]=o[g]||Object.create(null),Vs(o[g],[{axis:d},i[g],u[f]])})}),Object.keys(o).forEach(a=>{const l=o[a];Vs(l,[Y.scales[l.type],Y.scale])}),o}function ky(n){const t=n.options||(n.options={});t.plugins=G(t.plugins,{}),t.scales=VE(n,t)}function Py(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function jE(n){return n=n||{},n.data=Py(n.data),ky(n),n}const Lg=new Map,Ay=new Set;function Yr(n,t){let e=Lg.get(n);return e||(e=t(),Lg.set(n,e),Ay.add(e)),e}const as=(n,t,e)=>{const i=yn(t,e);i!==void 0&&n.add(i)};class HE{constructor(t){this._config=jE(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Py(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),ky(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Yr(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Yr(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Yr(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return Yr(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:r}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>as(l,t,u))),h.forEach(u=>as(l,s,u)),h.forEach(u=>as(l,ei[r]||{},u)),h.forEach(u=>as(l,Y,u)),h.forEach(u=>as(l,nc,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Ay.has(e)&&o.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,ei[e]||{},Y.datasets[e]||{},{type:e},Y,nc]}resolveNamedOptions(t,e,i,s=[""]){const r={$shared:!0},{resolver:o,subPrefixes:a}=Tg(this._resolverCache,t,s);let l=o;if(YE(o,e)){r.$shared=!1,i=_n(i)?i():i;const c=this.createResolver(t,i,a);l=Ii(o,i,c)}for(const c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){const{resolver:r}=Tg(this._resolverCache,t,i);return K(e)?Ii(r,e,void 0,s):r}}function Tg(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let r=i.get(s);return r||(r={resolver:mh(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,r)),r}const $E=n=>K(n)&&Object.getOwnPropertyNames(n).reduce((t,e)=>t||_n(n[e]),!1);function YE(n,t){const{isScriptable:e,isIndexable:i}=ay(n);for(const s of t){const r=e(s),o=i(s),a=(o||r)&&n[s];if(r&&(_n(a)||$E(a))||o&&ut(a))return!0}return!1}var UE="3.9.1";const XE=["top","bottom","left","right","chartArea"];function Rg(n,t){return n==="top"||n==="bottom"||XE.indexOf(n)===-1&&t==="x"}function Ig(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function Fg(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),gt(e&&e.onComplete,[n],t)}function GE(n){const t=n.chart,e=t.options.animation;gt(e&&e.onProgress,[n],t)}function Cy(n){return dy()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const ta={},Oy=n=>{const t=Cy(n);return Object.values(ta).filter(e=>e.canvas===t).pop()};function qE(n,t,e){const i=Object.keys(n);for(const s of i){const r=+s;if(r>=t){const o=n[s];delete n[s],(e>0||r>t)&&(n[r+e]=o)}}}function KE(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}class Ph{constructor(t,e){const i=this.config=new HE(e),s=Cy(t),r=Oy(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||LE(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=EO(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new TE,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=XO(u=>this.update(u),o.resizeDelay||0),this._dataChanges=[],ta[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Be.listen(this,"complete",Fg),Be.listen(this,"progress",GE),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return nt(t)?e&&r?r:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ag(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return sg(this.canvas,this.ctx),this}stop(){return Be.stop(this),this}resize(t,e){Be.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,r),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ag(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),gt(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};et(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let r=[];e&&(r=r.concat(Object.keys(e).map(o=>{const a=e[o],l=oc(o,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),et(r,o=>{const a=o.options,l=a.id,c=oc(l,a),h=G(a.type,o.dtype);(a.position===void 0||Rg(a.position,c)!==Rg(o.dposition))&&(a.position=o.dposition),s[l]=!0;let u=null;if(l in i&&i[l].type===h)u=i[l];else{const f=Pe.getScale(h);u=new f({id:l,type:h,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(a,t)}),et(s,(o,a)=>{o||delete i[a]}),et(i,o=>{$r.configure(this,o,o.options),$r.addBox(this,o)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;se.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ig("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){et(this.scales,t=>{$r.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Yd(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:r}of e){const o=i==="_removeElements"?-r:r;qE(t,s,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=r=>new Set(t.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),s=i(0);for(let r=1;rr.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;$r.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],et(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,r=this.chartArea,o={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&sy(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),s&&ry(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return ir(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const r=uE.modes[e];return typeof r=="function"?r(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=An(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",r=this.getDatasetMeta(t),o=r.controller._resolveAnimations(void 0,s);he(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(r,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Be.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,r,o),t[r]=o},s=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};et(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",r),i("detach",o)};o=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){et(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},et(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let r,o,a,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!$o(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const s=this.options.hover,r=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),o=r(e,t),a=i?t:r(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:r}=this,o=e,a=this._getActiveElements(t,s,i,o),l=BO(t),c=KE(t,this._lastEvent,i,l);i&&(this._lastEvent=null,gt(r.onHover,[t,a,this],this),l&>(r.onClick,[t,a,this],this));const h=!$o(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}}const Bg=()=>et(Ph.instances,n=>n._plugins.invalidate()),en=!0;Object.defineProperties(Ph,{defaults:{enumerable:en,value:Y},instances:{enumerable:en,value:ta},overrides:{enumerable:en,value:ei},registry:{enumerable:en,value:Pe},version:{enumerable:en,value:UE},getChart:{enumerable:en,value:Oy},register:{enumerable:en,value:(...n)=>{Pe.add(...n),Bg()}},unregister:{enumerable:en,value:(...n)=>{Pe.remove(...n),Bg()}}});function Dy(n,t,e){const{startAngle:i,pixelMargin:s,x:r,y:o,outerRadius:a,innerRadius:l}=t;let c=s/a;n.beginPath(),n.arc(r,o,a,i-c,e+c),l>s?(c=s/l,n.arc(r,o,l,e+c,i-c,!0)):n.arc(r,o,s,e+bt,i-bt),n.closePath(),n.clip()}function ZE(n){return ph(n,["outerStart","outerEnd","innerStart","innerEnd"])}function JE(n,t,e,i){const s=ZE(n.options.borderRadius),r=(e-t)/2,o=Math.min(r,i*t/2),a=l=>{const c=(e-Math.min(r,l))*i/2;return It(l,0,Math.min(r,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:It(s.innerStart,0,o),innerEnd:It(s.innerEnd,0,o)}}function fi(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function ac(n,t,e,i,s,r){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+i+e-c,0),f=h>0?h+i+e+c:0;let d=0;const g=s-l;if(i){const O=h>0?h-i:0,E=u>0?u-i:0,I=(O+E)/2,X=I!==0?g*I/(I+i):g;d=(g-X)/2}const p=Math.max(.001,g*u-e/yt)/u,y=(g-p)/2,x=l+y+d,m=s-y-d,{outerStart:v,outerEnd:b,innerStart:_,innerEnd:w}=JE(t,f,u,m-x),M=u-v,S=u-b,P=x+v/M,C=m-b/S,k=f+_,A=f+w,L=x+_/k,R=m-w/A;if(n.beginPath(),r){if(n.arc(o,a,u,P,C),b>0){const I=fi(S,C,o,a);n.arc(I.x,I.y,b,C,m+bt)}const O=fi(A,m,o,a);if(n.lineTo(O.x,O.y),w>0){const I=fi(A,R,o,a);n.arc(I.x,I.y,w,m+bt,R+Math.PI)}if(n.arc(o,a,f,m-w/f,x+_/f,!0),_>0){const I=fi(k,L,o,a);n.arc(I.x,I.y,_,L+Math.PI,x-bt)}const E=fi(M,x,o,a);if(n.lineTo(E.x,E.y),v>0){const I=fi(M,P,o,a);n.arc(I.x,I.y,v,x-bt,P)}}else{n.moveTo(o,a);const O=Math.cos(P)*u+o,E=Math.sin(P)*u+a;n.lineTo(O,E);const I=Math.cos(C)*u+o,X=Math.sin(C)*u+a;n.lineTo(I,X)}n.closePath()}function QE(n,t,e,i,s){const{fullCircles:r,startAngle:o,circumference:a}=t;let l=t.endAngle;if(r){ac(n,t,e,i,o+rt,s);for(let c=0;c=rt||nr(r,a,l),p=Xo(o,c+f,h+f);return g&&p}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:r,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:l,spacing:c}=this.options,h=(s+r)/2,u=(o+a+c+l)/2;return{x:e+Math.cos(h)*u,y:i+Math.sin(h)*u}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/2,r=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>rt?Math.floor(i/rt):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let a=0;if(s){a=s/2;const c=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(c)*a,Math.sin(c)*a),this.circumference>=yt&&(a=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const l=QE(t,this,a,r,o);eL(t,this,a,r,l,o),t.restore()}}Ah.id="arc";Ah.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};Ah.defaultRoutes={backgroundColor:"backgroundColor"};function Ey(n,t,e=t){n.lineCap=G(e.borderCapStyle,t.borderCapStyle),n.setLineDash(G(e.borderDash,t.borderDash)),n.lineDashOffset=G(e.borderDashOffset,t.borderDashOffset),n.lineJoin=G(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=G(e.borderWidth,t.borderWidth),n.strokeStyle=G(e.borderColor,t.borderColor)}function nL(n,t,e){n.lineTo(e.x,e.y)}function iL(n){return n.stepped?x2:n.tension||n.cubicInterpolationMode==="monotone"?w2:nL}function Ly(n,t,e={}){const i=n.length,{start:s=0,end:r=i-1}=e,{start:o,end:a}=t,l=Math.max(s,o),c=Math.min(r,a),h=sa&&r>a;return{count:i,start:l,loop:t.loop,ilen:c(o+(c?a-b:b))%r,v=()=>{p!==y&&(n.lineTo(h,y),n.lineTo(h,p),n.lineTo(h,x))};for(l&&(d=s[m(0)],n.moveTo(d.x,d.y)),f=0;f<=a;++f){if(d=s[m(f)],d.skip)continue;const b=d.x,_=d.y,w=b|0;w===g?(_y&&(y=_),h=(u*h+b)/++u):(v(),n.lineTo(b,_),g=w,u=0,p=y=_),x=_}v()}function lc(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?rL:sL}function oL(n){return n.stepped?Q2:n.tension||n.cubicInterpolationMode==="monotone"?tD:Nn}function aL(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),Ey(n,t.options),n.stroke(s)}function lL(n,t,e,i){const{segments:s,options:r}=t,o=lc(t);for(const a of s)Ey(n,r,a.style),n.beginPath(),o(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const cL=typeof Path2D=="function";function hL(n,t,e,i){cL&&!t.options.segment?aL(n,t,e,i):lL(n,t,e,i)}class va extends Qe{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Y2(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=uD(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],r=this.points,o=lD(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],l=oL(i);let c,h;for(c=0,h=o.length;cn!=="borderDash"&&n!=="fill"};function zg(n,t,e,i){const s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)a({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=qb.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const r=i.items;let o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(r[o]=r[r.length-1],r.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Be=new hD;const dg="transparent",uD={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=ig(n||dg),s=i.valid&&ig(t||dg);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class fD{constructor(t,e,i,s){const r=e[i];s=Nr([t.to,s,r,t.from]);const o=Nr([t.from,r,s]);this._active=!0,this._fn=t.fn||uD[t.type||typeof o],this._easing=Hs[t.easing]||Hs.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],r=i-this._start,o=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=Nr([t.to,e,s,t.from]),this._from=Nr([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,r=this._from,o=this._loop,a=this._to;let l;if(this._active=r!==a&&(o||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;sn!=="onProgress"&&n!=="onComplete"&&n!=="fn"});Y.set("animations",{colors:{type:"color",properties:gD},numbers:{type:"number",properties:dD}});Y.describe("animations",{_fallback:"animation"});Y.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:n=>n|0}}}});class py{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!K(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const s=t[i];if(!K(s))return;const r={};for(const o of pD)r[o]=s[o];(ut(s.properties)&&s.properties||[i]).forEach(o=>{(o===i||!e.has(o))&&e.set(o,r)})})}_animateOptions(t,e){const i=e.options,s=bD(t,i);if(!s)return[];const r=this._createAnimations(s,i);return i.$shared&&mD(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,s=[],r=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=r[c];const f=i.get(c);if(u)if(f&&u.active()){u.update(f,h,a);continue}else u.cancel();if(!f||!f.duration){t[c]=h;continue}r[c]=u=new fD(f,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Be.add(this._chart,i),!0}}function mD(n,t){const e=[],i=Object.keys(t);for(let s=0;s0||!e&&r<0)return s.index}return null}function yg(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:r,vScale:o,index:a}=i,l=r.axis,c=o.axis,h=xD(r,o,i),u=t.length;let f;for(let d=0;de[i].axis===t).shift()}function MD(n,t){return An(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function kD(n,t,e){return An(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function ns(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const r=s._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e]}}}const hl=n=>n==="reset"||n==="none",_g=(n,t)=>t?n:Object.assign({},n),PD=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:my(e,!0),values:null};class ye{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=mg(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&ns(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(u,f,d,g)=>u==="x"?f:u==="r"?g:d,r=e.xAxisID=G(i.xAxisID,cl(t,"x")),o=e.yAxisID=G(i.yAxisID,cl(t,"y")),a=e.rAxisID=G(i.rAxisID,cl(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,o,a),h=e.vAxisID=s(l,o,r,a);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&qd(this._data,this),t._stacked&&ns(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(K(e))this._data=vD(e);else if(i!==e){if(i){qd(i,this);const s=this._cachedMeta;ns(s),s._parsed=[]}e&&Object.isExtensible(e)&&jO(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const r=e._stacked;e._stacked=mg(e.vScale,e),e.stack!==i.stack&&(s=!0,ns(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&yg(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:o}=i,a=r.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,u,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{ut(s[t])?f=this.parseArrayData(i,s,t,e):K(s[t])?f=this.parseObjectData(i,s,t,e):f=this.parsePrimitiveData(i,s,t,e);const d=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!g()){this.updateRangeFromParsed(c,t,d,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,r,o;for(s=0,r=e.length;s=0&&tthis.getContext(i,s),p=c.resolveNamedOptions(f,d,g,u);return p.$shared&&(p.$shared=l,r[o]=Object.freeze(_g(p,l))),p}_resolveAnimations(t,e,i){const s=this.chart,r=this._cachedDataOpts,o=`animation-${e}`,a=r[o];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(f,this.getContext(t,i,e))}const c=new py(s,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||hl(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(i),o=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:o}}updateElement(t,e,i,s){hl(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!hl(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,r=e.length,o=Math.min(r,s);o&&this.parse(0,o),r>s?this._insertElements(s,r-s,t):r{for(c.length+=e,a=c.length-1;a>=o;a--)c[a]=c[a-e]};for(l(r),a=t;as-r))}return n._cache.$bar}function CD(n){const t=n.iScale,e=AD(t,n.type);let i=t._length,s,r,o,a;const l=()=>{o===32767||o===-32768||(he(a)&&(i=Math.min(i,Math.abs(o-a)||i)),a=o)};for(s=0,r=e.length;s0?s[n-1]:null,a=nMath.abs(a)&&(l=a,c=o),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:o,max:a}}function by(n,t,e,i){return ut(n)?ED(n,t,e,i):t[e.axis]=e.parse(n,i),t}function vg(n,t,e,i){const s=n.iScale,r=n.vScale,o=s.getLabels(),a=s===r,l=[];let c,h,u,f;for(c=e,h=e+i;c=e?1:-1)}function TD(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.basel.controller.options.grouped),r=i.options.stacked,o=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(nt(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((r===!1||o.indexOf(l.stack)===-1||r===void 0&&l.stack===void 0)&&o.push(l.stack),l.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let r,o;for(r=0,o=e.data.length;r=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:s}=e,r=this.getParsed(t),o=i.getLabelForValue(r.x),a=s.getLabelForValue(r.y),l=r._custom;return{label:e.label,value:"("+o+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=o.axis,u=a.axis;for(let f=e;fnr(v,a,l,!0)?1:Math.max(b,b*e,_,_*e),g=(v,b,_)=>nr(v,a,l,!0)?-1:Math.min(b,b*e,_,_*e),p=d(0,c,u),y=d(yt,h,f),x=g(_t,c,u),m=g(_t+yt,h,f);i=(p-x)/2,s=(y-m)/2,r=-(p+x)/2,o=-(y+m)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:o}}class pr extends ye{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let r=l=>+i[l];if(K(i[t])){const{key:l="value"}=this._parsing;r=c=>+bn(i[c],l)}let o,a;for(o=t,a=t+e;o0&&!isNaN(t)?rt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=gr(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,r,o,a,l;if(!t){for(s=0,r=i.data.datasets.length;sn!=="spacing",_indexable:n=>n!=="spacing"};pr.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const t=n.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=n.legend.options;return t.labels.map((i,s)=>{const o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:e,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){let t=n.label;const e=": "+n.formattedValue;return ut(t)?(t=t.slice(),t[0]+=e):t+=e,t}}}}};class wh extends ye{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:r}=e,o=this.chart._animationsDisabled;let{start:a,count:l}=Jb(e,s,o);this._drawStart=a,this._drawCount=l,Zb(e)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),f=o.axis,d=a.axis,{spanGaps:g,segment:p}=this.options,y=Ri(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||r||s==="none";let m=e>0&&this.getParsed(e-1);for(let v=e;v0&&Math.abs(_[f]-m[f])>y,p&&(w.parsed=_,w.raw=c.data[v]),u&&(w.options=h||this.resolveDataElementOptions(v,b.active?"active":s)),x||this.updateElement(b,v,w,s),m=_}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const r=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}wh.id="line";wh.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};wh.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Sh extends ye{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=gr(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return uy.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(re.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),o=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),a=(r-o)/t.getVisibleDatasetCount();this.outerRadius=r-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){const r=s==="reset",o=this.chart,l=o.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,f=c.getIndexAngle(0)-.5*_t;let d=f,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?me(this.resolveDataElementOptions(t,e).angle||i):0}}Sh.id="polarArea";Sh.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};Sh.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const t=n.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=n.legend.options;return t.labels.map((i,s)=>{const o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:e,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){return n.chart.data.labels[n.dataIndex]+": "+n.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class yy extends pr{}yy.id="pie";yy.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Mh extends ye{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return uy.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){const o=this.resolveDatasetElementOptions(t);this.options.showLine||(o.borderWidth=0);const a={_loop:!0,_fullLoop:r.length===s.length,options:o};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const r=this._cachedMeta.rScale,o=s==="reset";for(let a=e;a{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}}Ze.defaults={};Ze.defaultRoutes=void 0;const _y={values(n){return ut(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,r=n;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=zD(n,e)}const o=oe(Math.abs(r)),a=Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),gr(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";const i=n/Math.pow(10,Math.floor(oe(n)));return i===1||i===2||i===5?_y.numeric.call(this,n,t,e):""}};function zD(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var _a={formatters:_y};Y.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(n,t)=>t.lineWidth,tickColor:(n,t)=>t.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:_a.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});Y.route("scale.ticks","color","","color");Y.route("scale.grid","color","","borderColor");Y.route("scale.grid","borderColor","","borderColor");Y.route("scale.title","color","","color");Y.describe("scale",{_fallback:!1,_scriptable:n=>!n.startsWith("before")&&!n.startsWith("after")&&n!=="callback"&&n!=="parser",_indexable:n=>n!=="borderDash"&&n!=="tickBorderDash"});Y.describe("scales",{_fallback:"scale"});Y.describe("scale.ticks",{_scriptable:n=>n!=="backdropPadding"&&n!=="callback",_indexable:n=>n!=="backdropPadding"});function ND(n,t){const e=n.options.ticks,i=e.maxTicksLimit||WD(n),s=e.major.enabled?jD(t):[],r=s.length,o=s[0],a=s[r-1],l=[];if(r>i)return HD(t,l,s,r/i),l;const c=VD(s,t,i);if(r>0){let h,u;const f=r>1?Math.round((a-o)/(r-1)):null;for(Vr(t,l,c,nt(f)?0:o-f,o),h=0,u=r-1;hs)return l}return Math.max(s,1)}function jD(n){const t=[];let e,i;for(e=0,i=n.length;en==="left"?"right":n==="right"?"left":n,Sg=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e;function Mg(n,t){const e=[],i=n.length/t,s=n.length;let r=0;for(;ro+a)))return l}function XD(n,t){et(n,e=>{const i=e.gc,s=i.length/2;let r;if(s>t){for(r=0;ri?i:e,i=s&&e>i?e:i,{min:se(e,se(i,e)),max:se(i,se(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){gt(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=k2(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,f=h.highest.height,d=Ft(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/i:d/(i-1),u+6>a&&(a=d/(i-(t.offset?.5:1)),l=this.maxHeight-is(t.grid)-e.padding-kg(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),o=hh(Math.min(Math.asin(Ft((h.highest.height+6)/a,-1,1)),Math.asin(Ft(l/c,-1,1))-Math.asin(Ft(f/c,-1,1)))),o=Math.max(s,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){gt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){gt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=kg(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=is(r)+l):(t.height=this.maxHeight,t.width=is(r)+l),i.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:f}=this._getLabelSizes(),d=i.padding*2,g=me(this.labelRotation),p=Math.cos(g),y=Math.sin(g);if(a){const x=i.mirror?0:y*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+x+d)}else{const x=i.mirror?0:p*u.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+x+d)}this._calculatePadding(c,h,y,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,d=0;l?c?(f=s*t.width,d=i*e.height):(f=i*t.height,d=s*e.width):r==="start"?d=e.width:r==="end"?f=t.width:r!=="inner"&&(f=t.width/2,d=e.width/2),this.paddingLeft=Math.max((f-h+o)*this.width/(this.width-h),0),this.paddingRight=Math.max((d-u+o)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;r==="start"?(h=0,u=t.height):r==="end"&&(h=e.height,u=0),this.paddingTop=h+o,this.paddingBottom=u+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){gt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:r[M]||0,height:o[M]||0});return{first:w(0),last:w(e-1),widest:w(b),highest:w(_),widths:r,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return NO(this._alignToPixels?Rn(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:r,position:o}=s,a=r.offset,l=this.isHorizontal(),h=this.ticks.length+(a?1:0),u=is(r),f=[],d=r.setContext(this.getContext()),g=d.drawBorder?d.borderWidth:0,p=g/2,y=function(O){return Rn(i,O,g)};let x,m,v,b,_,w,M,S,P,C,k,A;if(o==="top")x=y(this.bottom),w=this.bottom-u,S=x-p,C=y(t.top)+p,A=t.bottom;else if(o==="bottom")x=y(this.top),C=t.top,A=y(t.bottom)-p,w=x+p,S=this.top+u;else if(o==="left")x=y(this.right),_=this.right-u,M=x-p,P=y(t.left)+p,k=t.right;else if(o==="right")x=y(this.left),P=t.left,k=y(t.right)-p,_=x+p,M=this.left+u;else if(e==="x"){if(o==="center")x=y((t.top+t.bottom)/2+.5);else if(K(o)){const O=Object.keys(o)[0],E=o[O];x=y(this.chart.scales[O].getPixelForValue(E))}C=t.top,A=t.bottom,w=x+p,S=w+u}else if(e==="y"){if(o==="center")x=y((t.left+t.right)/2);else if(K(o)){const O=Object.keys(o)[0],E=o[O];x=y(this.chart.scales[O].getPixelForValue(E))}_=x-p,M=_-u,P=t.left,k=t.right}const L=G(s.ticks.maxTicksLimit,h),R=Math.max(1,Math.ceil(h/L));for(m=0;mr.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,o;const a=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,o=s.length;r{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let r,o;for(r=0,o=e.length;r{const i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),o=t[e].split("."),a=o.pop(),l=o.join(".");Y.route(r,s,l,a)})}function tE(n){return"id"in n&&"defaults"in n}class eE{constructor(){this.controllers=new jr(ye,"datasets",!0),this.elements=new jr(Ze,"elements"),this.plugins=new jr(Object,"plugins"),this.scales=new jr(si,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):et(s,o=>{const a=i||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,e,i){const s=ch(t);gt(i["before"+s],[],i),e[t](i),gt(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e0&&this.getParsed(e-1);for(let b=e;b0&&Math.abs(w[d]-v[d])>x,y&&(M.parsed=w,M.raw=c.data[b]),f&&(M.options=u||this.resolveDataElementOptions(b,_.active?"active":s)),m||this.updateElement(_,b,M,s),v=w}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const r=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,o)/2}}kh.id="scatter";kh.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};kh.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(n){return"("+n.label+", "+n.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};function In(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class sc{constructor(t){this.options=t||{}}init(t){}formats(){return In()}parse(t,e){return In()}format(t,e){return In()}add(t,e,i){return In()}diff(t,e,i){return In()}startOf(t,e,i){return In()}endOf(t,e){return In()}}sc.override=function(n){Object.assign(sc.prototype,n)};var nE={_date:sc};function iE(n,t,e,i){const{controller:s,data:r,_sorted:o}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&o&&r.length){const l=a._reversePixels?WO:Hn;if(i){if(s._sharedOptions){const c=r[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(r,t,e-h),f=l(r,t,e+h);return{lo:u.lo,hi:f.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function mr(n,t,e,i,s){const r=n.getSortedVisibleDatasetMetas(),o=e[t];for(let a=0,l=r.length;a{l[o](t[e],s)&&(r.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:r}var aE={evaluateInteractionItems:mr,modes:{index(n,t,e,i){const s=zn(t,n),r=e.axis||"x",o=e.includeInvisible||!1,a=e.intersect?fl(n,s,r,i,o):dl(n,s,r,!1,i,o),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(n,t,e,i){const s=zn(t,n),r=e.axis||"xy",o=e.includeInvisible||!1;let a=e.intersect?fl(n,s,r,i,o):dl(n,s,r,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function Ag(n,t){return n.filter(e=>vy.indexOf(e.pos)===-1&&e.box.axis===t)}function rs(n,t){return n.sort((e,i)=>{const s=t?i:e,r=t?e:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function lE(n){const t=[];let e,i,s,r,o,a;for(e=0,i=(n||[]).length;ec.box.fullSize),!0),i=rs(ss(t,"left"),!0),s=rs(ss(t,"right")),r=rs(ss(t,"top"),!0),o=rs(ss(t,"bottom")),a=Ag(t,"x"),l=Ag(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(o).concat(a),chartArea:ss(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(o).concat(a)}}function Cg(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function xy(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function fE(n,t,e,i){const{pos:s,box:r}=e,o=n.maxPadding;if(!K(s)){e.size&&(n[s]-=e.size);const u=i[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?r.height:r.width),e.size=u.size/u.count,n[s]+=e.size}r.getPadding&&xy(o,r.getPadding());const a=Math.max(0,t.outerWidth-Cg(o,n,"left","right")),l=Math.max(0,t.outerHeight-Cg(o,n,"top","bottom")),c=a!==n.w,h=l!==n.h;return n.w=a,n.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function dE(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function gE(n,t){const e=t.maxPadding;function i(s){const r={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{r[o]=Math.max(t[o],e[o])}),r}return i(n?["left","right"]:["top","bottom"])}function Os(n,t,e,i){const s=[];let r,o,a,l,c,h;for(r=0,o=n.length,c=0;r{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/h,hBoxMaxHeight:o/2}),f=Object.assign({},s);xy(f,ue(i));const d=Object.assign({maxPadding:f,w:r,h:o,x:s.left,y:s.top},s),g=hE(l.concat(c),u);Os(a.fullSize,d,u,g),Os(l,d,u,g),Os(c,d,u,g)&&Os(l,d,u,g),dE(d),Og(a.leftAndTop,d,u,g),d.x+=d.w,d.y+=d.h,Og(a.rightAndBottom,d,u,g),n.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},et(a.chartArea,p=>{const y=p.box;Object.assign(y,n.chartArea),y.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})})}};class wy{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class pE extends wy{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const go="$chartjs",mE={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Dg=n=>n===null||n==="";function bE(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[go]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Dg(s)){const r=lg(n,"width");r!==void 0&&(n.width=r)}if(Dg(i))if(n.style.height==="")n.height=n.width/(t||2);else{const r=lg(n,"height");r!==void 0&&(n.height=r)}return n}const Sy=G2?{passive:!0}:!1;function yE(n,t,e){n.addEventListener(t,e,Sy)}function _E(n,t,e){n.canvas.removeEventListener(t,e,Sy)}function vE(n,t){const e=mE[n.type]||n.type,{x:i,y:s}=zn(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Qo(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function xE(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Qo(a.addedNodes,i),o=o&&!Qo(a.removedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function wE(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Qo(a.removedNodes,i),o=o&&!Qo(a.addedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const sr=new Map;let Eg=0;function My(){const n=window.devicePixelRatio;n!==Eg&&(Eg=n,sr.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function SE(n,t){sr.size||window.addEventListener("resize",My),sr.set(n,t)}function ME(n){sr.delete(n),sr.size||window.removeEventListener("resize",My)}function kE(n,t,e){const i=n.canvas,s=i&&_h(i);if(!s)return;const r=Kb((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||r(c,h)});return o.observe(s),SE(n,r),o}function gl(n,t,e){e&&e.disconnect(),t==="resize"&&ME(n)}function PE(n,t,e){const i=n.canvas,s=Kb(r=>{n.ctx!==null&&e(vE(r,n))},n,r=>{const o=r[0];return[o,o.offsetX,o.offsetY]});return yE(i,t,s),s}class AE extends wy{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(bE(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[go])return!1;const i=e[go].initial;["height","width"].forEach(r=>{const o=i[r];nt(o)?e.removeAttribute(r):e.setAttribute(r,o)});const s=i.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[go],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),o={attach:xE,detach:wE,resize:kE}[e]||PE;s[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:gl,detach:gl,resize:gl}[e]||_E)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return X2(t,e,i,s)}isAttached(t){const e=_h(t);return!!(e&&e.isConnected)}}function CE(n){return!dy()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?pE:AE}class OE{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const r=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(r,t,e,i);return e==="afterDestroy"&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,s){s=s||{};for(const r of t){const o=r.plugin,a=o[i],l=[e,s,r.options];if(gt(a,l,o)===!1&&s.cancelable)return!1}return!0}invalidate(){nt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=G(i.options&&i.options.plugins,{}),r=DE(i);return s===!1&&!e?[]:LE(t,r,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(r,o)=>r.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function DE(n){const t={},e=[],i=Object.keys(Pe.plugins.items);for(let r=0;r{const l=i[a];if(!K(l))return console.error(`Invalid scale configuration for scale: ${a}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const c=oc(a,l),h=IE(c,s),u=e.scales||{};r[c]=r[c]||a,o[a]=Vs(Object.create(null),[{axis:c},l,u[c],u[h]])}),n.data.datasets.forEach(a=>{const l=a.type||n.type,c=a.indexAxis||rc(l,t),u=(ei[l]||{}).scales||{};Object.keys(u).forEach(f=>{const d=RE(f,c),g=a[d+"AxisID"]||r[d]||d;o[g]=o[g]||Object.create(null),Vs(o[g],[{axis:d},i[g],u[f]])})}),Object.keys(o).forEach(a=>{const l=o[a];Vs(l,[Y.scales[l.type],Y.scale])}),o}function ky(n){const t=n.options||(n.options={});t.plugins=G(t.plugins,{}),t.scales=BE(n,t)}function Py(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function zE(n){return n=n||{},n.data=Py(n.data),ky(n),n}const Lg=new Map,Ay=new Set;function Yr(n,t){let e=Lg.get(n);return e||(e=t(),Lg.set(n,e),Ay.add(e)),e}const os=(n,t,e)=>{const i=bn(t,e);i!==void 0&&n.add(i)};class NE{constructor(t){this._config=zE(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Py(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),ky(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Yr(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Yr(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Yr(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return Yr(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:r}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>os(l,t,u))),h.forEach(u=>os(l,s,u)),h.forEach(u=>os(l,ei[r]||{},u)),h.forEach(u=>os(l,Y,u)),h.forEach(u=>os(l,nc,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Ay.has(e)&&o.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,ei[e]||{},Y.datasets[e]||{},{type:e},Y,nc]}resolveNamedOptions(t,e,i,s=[""]){const r={$shared:!0},{resolver:o,subPrefixes:a}=Tg(this._resolverCache,t,s);let l=o;if(VE(o,e)){r.$shared=!1,i=yn(i)?i():i;const c=this.createResolver(t,i,a);l=Ii(o,i,c)}for(const c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){const{resolver:r}=Tg(this._resolverCache,t,i);return K(e)?Ii(r,e,void 0,s):r}}function Tg(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let r=i.get(s);return r||(r={resolver:mh(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,r)),r}const WE=n=>K(n)&&Object.getOwnPropertyNames(n).reduce((t,e)=>t||yn(n[e]),!1);function VE(n,t){const{isScriptable:e,isIndexable:i}=ay(n);for(const s of t){const r=e(s),o=i(s),a=(o||r)&&n[s];if(r&&(yn(a)||WE(a))||o&&ut(a))return!0}return!1}var jE="3.9.1";const HE=["top","bottom","left","right","chartArea"];function Rg(n,t){return n==="top"||n==="bottom"||HE.indexOf(n)===-1&&t==="x"}function Ig(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function Fg(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),gt(e&&e.onComplete,[n],t)}function $E(n){const t=n.chart,e=t.options.animation;gt(e&&e.onProgress,[n],t)}function Cy(n){return dy()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const ta={},Oy=n=>{const t=Cy(n);return Object.values(ta).filter(e=>e.canvas===t).pop()};function YE(n,t,e){const i=Object.keys(n);for(const s of i){const r=+s;if(r>=t){const o=n[s];delete n[s],(e>0||r>t)&&(n[r+e]=o)}}}function UE(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}class Ph{constructor(t,e){const i=this.config=new NE(e),s=Cy(t),r=Oy(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||CE(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=AO(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new OE,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=HO(u=>this.update(u),o.resizeDelay||0),this._dataChanges=[],ta[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Be.listen(this,"complete",Fg),Be.listen(this,"progress",$E),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return nt(t)?e&&r?r:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ag(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return sg(this.canvas,this.ctx),this}stop(){return Be.stop(this),this}resize(t,e){Be.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,r),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ag(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),gt(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};et(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let r=[];e&&(r=r.concat(Object.keys(e).map(o=>{const a=e[o],l=oc(o,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),et(r,o=>{const a=o.options,l=a.id,c=oc(l,a),h=G(a.type,o.dtype);(a.position===void 0||Rg(a.position,c)!==Rg(o.dposition))&&(a.position=o.dposition),s[l]=!0;let u=null;if(l in i&&i[l].type===h)u=i[l];else{const f=Pe.getScale(h);u=new f({id:l,type:h,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(a,t)}),et(s,(o,a)=>{o||delete i[a]}),et(i,o=>{$r.configure(this,o,o.options),$r.addBox(this,o)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;se.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ig("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){et(this.scales,t=>{$r.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Yd(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:r}of e){const o=i==="_removeElements"?-r:r;YE(t,s,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=r=>new Set(t.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),s=i(0);for(let r=1;rr.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;$r.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],et(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,r=this.chartArea,o={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&sy(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),s&&ry(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return ir(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const r=aE.modes[e];return typeof r=="function"?r(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=An(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",r=this.getDatasetMeta(t),o=r.controller._resolveAnimations(void 0,s);he(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(r,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Be.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,r,o),t[r]=o},s=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};et(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",r),i("detach",o)};o=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){et(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},et(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let r,o,a,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!$o(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const s=this.options.hover,r=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),o=r(e,t),a=i?t:r(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:r}=this,o=e,a=this._getActiveElements(t,s,i,o),l=TO(t),c=UE(t,this._lastEvent,i,l);i&&(this._lastEvent=null,gt(r.onHover,[t,a,this],this),l&>(r.onClick,[t,a,this],this));const h=!$o(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}}const Bg=()=>et(Ph.instances,n=>n._plugins.invalidate()),tn=!0;Object.defineProperties(Ph,{defaults:{enumerable:tn,value:Y},instances:{enumerable:tn,value:ta},overrides:{enumerable:tn,value:ei},registry:{enumerable:tn,value:Pe},version:{enumerable:tn,value:jE},getChart:{enumerable:tn,value:Oy},register:{enumerable:tn,value:(...n)=>{Pe.add(...n),Bg()}},unregister:{enumerable:tn,value:(...n)=>{Pe.remove(...n),Bg()}}});function Dy(n,t,e){const{startAngle:i,pixelMargin:s,x:r,y:o,outerRadius:a,innerRadius:l}=t;let c=s/a;n.beginPath(),n.arc(r,o,a,i-c,e+c),l>s?(c=s/l,n.arc(r,o,l,e+c,i-c,!0)):n.arc(r,o,s,e+yt,i-yt),n.closePath(),n.clip()}function XE(n){return ph(n,["outerStart","outerEnd","innerStart","innerEnd"])}function GE(n,t,e,i){const s=XE(n.options.borderRadius),r=(e-t)/2,o=Math.min(r,i*t/2),a=l=>{const c=(e-Math.min(r,l))*i/2;return Ft(l,0,Math.min(r,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Ft(s.innerStart,0,o),innerEnd:Ft(s.innerEnd,0,o)}}function fi(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function ac(n,t,e,i,s,r){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+i+e-c,0),f=h>0?h+i+e+c:0;let d=0;const g=s-l;if(i){const O=h>0?h-i:0,E=u>0?u-i:0,I=(O+E)/2,X=I!==0?g*I/(I+i):g;d=(g-X)/2}const p=Math.max(.001,g*u-e/_t)/u,y=(g-p)/2,x=l+y+d,m=s-y-d,{outerStart:v,outerEnd:b,innerStart:_,innerEnd:w}=GE(t,f,u,m-x),M=u-v,S=u-b,P=x+v/M,C=m-b/S,k=f+_,A=f+w,L=x+_/k,R=m-w/A;if(n.beginPath(),r){if(n.arc(o,a,u,P,C),b>0){const I=fi(S,C,o,a);n.arc(I.x,I.y,b,C,m+yt)}const O=fi(A,m,o,a);if(n.lineTo(O.x,O.y),w>0){const I=fi(A,R,o,a);n.arc(I.x,I.y,w,m+yt,R+Math.PI)}if(n.arc(o,a,f,m-w/f,x+_/f,!0),_>0){const I=fi(k,L,o,a);n.arc(I.x,I.y,_,L+Math.PI,x-yt)}const E=fi(M,x,o,a);if(n.lineTo(E.x,E.y),v>0){const I=fi(M,P,o,a);n.arc(I.x,I.y,v,x-yt,P)}}else{n.moveTo(o,a);const O=Math.cos(P)*u+o,E=Math.sin(P)*u+a;n.lineTo(O,E);const I=Math.cos(C)*u+o,X=Math.sin(C)*u+a;n.lineTo(I,X)}n.closePath()}function qE(n,t,e,i,s){const{fullCircles:r,startAngle:o,circumference:a}=t;let l=t.endAngle;if(r){ac(n,t,e,i,o+rt,s);for(let c=0;c=rt||nr(r,a,l),p=Xo(o,c+f,h+f);return g&&p}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:r,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:l,spacing:c}=this.options,h=(s+r)/2,u=(o+a+c+l)/2;return{x:e+Math.cos(h)*u,y:i+Math.sin(h)*u}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/2,r=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>rt?Math.floor(i/rt):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let a=0;if(s){a=s/2;const c=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(c)*a,Math.sin(c)*a),this.circumference>=_t&&(a=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const l=qE(t,this,a,r,o);JE(t,this,a,r,l,o),t.restore()}}Ah.id="arc";Ah.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};Ah.defaultRoutes={backgroundColor:"backgroundColor"};function Ey(n,t,e=t){n.lineCap=G(e.borderCapStyle,t.borderCapStyle),n.setLineDash(G(e.borderDash,t.borderDash)),n.lineDashOffset=G(e.borderDashOffset,t.borderDashOffset),n.lineJoin=G(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=G(e.borderWidth,t.borderWidth),n.strokeStyle=G(e.borderColor,t.borderColor)}function ZE(n,t,e){n.lineTo(e.x,e.y)}function QE(n){return n.stepped?b2:n.tension||n.cubicInterpolationMode==="monotone"?y2:ZE}function Ly(n,t,e={}){const i=n.length,{start:s=0,end:r=i-1}=e,{start:o,end:a}=t,l=Math.max(s,o),c=Math.min(r,a),h=sa&&r>a;return{count:i,start:l,loop:t.loop,ilen:c(o+(c?a-b:b))%r,v=()=>{p!==y&&(n.lineTo(h,y),n.lineTo(h,p),n.lineTo(h,x))};for(l&&(d=s[m(0)],n.moveTo(d.x,d.y)),f=0;f<=a;++f){if(d=s[m(f)],d.skip)continue;const b=d.x,_=d.y,w=b|0;w===g?(_y&&(y=_),h=(u*h+b)/++u):(v(),n.lineTo(b,_),g=w,u=0,p=y=_),x=_}v()}function lc(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?eL:tL}function nL(n){return n.stepped?q2:n.tension||n.cubicInterpolationMode==="monotone"?K2:Nn}function iL(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),Ey(n,t.options),n.stroke(s)}function sL(n,t,e,i){const{segments:s,options:r}=t,o=lc(t);for(const a of s)Ey(n,r,a.style),n.beginPath(),o(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const rL=typeof Path2D=="function";function oL(n,t,e,i){rL&&!t.options.segment?iL(n,t,e,i):sL(n,t,e,i)}class va extends Ze{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;V2(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=aD(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],r=this.points,o=sD(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],l=nL(i);let c,h;for(c=0,h=o.length;cn!=="borderDash"&&n!=="fill"};function zg(n,t,e,i){const s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)-1?n.split(` -`):n}function mL(n,t){const{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:n,label:o,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Ng(n,t){const e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:o,boxHeight:a}=t,l=Qt(t.bodyFont),c=Qt(t.titleFont),h=Qt(t.footerFont),u=r.length,f=s.length,d=i.length,g=ue(t.padding);let p=g.height,y=0,x=i.reduce((b,_)=>b+_.before.length+_.lines.length+_.after.length,0);if(x+=n.beforeBody.length+n.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),x){const b=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=d*b+(x-d)*l.lineHeight+(x-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let m=0;const v=function(b){y=Math.max(y,e.measureText(b).width+m)};return e.save(),e.font=c.string,et(n.title,v),e.font=l.string,et(n.beforeBody.concat(n.afterBody),v),m=t.displayColors?o+2+t.boxPadding:0,et(i,b=>{et(b.before,v),et(b.lines,v),et(b.after,v)}),m=0,e.font=h.string,et(n.footer,v),e.restore(),y+=g.width,{width:y,height:p}}function bL(n,t){const{y:e,height:i}=t;return en.height-i/2?"bottom":"center"}function yL(n,t,e,i){const{x:s,width:r}=i,o=e.caretSize+e.caretPadding;if(n==="left"&&s+r+o>t.width||n==="right"&&s-r-o<0)return!0}function _L(n,t,e,i){const{x:s,width:r}=e,{width:o,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),yL(c,n,t,e)&&(c="center"),c}function Wg(n,t,e){const i=e.yAlign||t.yAlign||bL(n,e);return{xAlign:e.xAlign||t.xAlign||_L(n,t,e,i),yAlign:i}}function vL(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function xL(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Vg(n,t,e,i){const{caretSize:s,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=e,c=s+r,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:d}=ki(o);let g=vL(t,a);const p=xL(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,f)+s:a==="right"&&(g+=Math.max(u,d)+s),{x:It(g,0,i.width-t.width),y:It(p,0,i.height-t.height)}}function Ur(n,t,e){const i=ue(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function jg(n){return we([],ze(n))}function wL(n,t,e){return An(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Hg(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}class SL extends Qe{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new py(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=wL(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),r=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);let a=[];return a=we(a,ze(s)),a=we(a,ze(r)),a=we(a,ze(o)),a}getBeforeBody(t,e){return jg(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,s=[];return et(t,r=>{const o={before:[],lines:[],after:[]},a=Hg(i,r);we(o.before,ze(a.beforeLabel.call(this,r))),we(o.lines,a.label.call(this,r)),we(o.after,ze(a.afterLabel.call(this,r))),s.push(o)}),s}getAfterBody(t,e){return jg(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),r=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);let a=[];return a=we(a,ze(s)),a=we(a,ze(r)),a=we(a,ze(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],r=[],o=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,f,i))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,i))),et(a,h=>{const u=Hg(t.callbacks,h);s.push(u.labelColor.call(this,h)),r.push(u.labelPointStyle.call(this,h)),o.push(u.labelTextColor.call(this,h))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let r,o=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const a=po[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=Ng(this,i),c=Object.assign({},a,l),h=Wg(this.chart,i,c),u=Vg(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,r={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:r}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=ki(a),{x:f,y:d}=t,{width:g,height:p}=e;let y,x,m,v,b,_;return r==="center"?(b=d+p/2,s==="left"?(y=f,x=y-o,v=b+o,_=b-o):(y=f+g,x=y+o,v=b-o,_=b+o),m=y):(s==="left"?x=f+Math.max(l,h)+o:s==="right"?x=f+g-Math.max(c,u)-o:x=this.caretX,r==="top"?(v=d,b=v-o,y=x-o,m=x+o):(v=d+p,b=v+o,y=x+o,m=x-o),_=v),{x1:y,x2:x,x3:m,y1:v,y2:b,y3:_}}drawTitle(t,e,i){const s=this.title,r=s.length;let o,a,l;if(r){const c=ll(i.rtl,this.x,this.width);for(t.x=Ur(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",o=Qt(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,l=0;lv!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Zo(t,{x:y,y:p,w:c,h:l,radius:m}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),Zo(t,{x,y:p+1,w:c-2,h:l-2,radius:m}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(y,p,c,l),t.strokeRect(y,p,c,l),t.fillStyle=o.backgroundColor,t.fillRect(x,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=i,u=Qt(i.bodyFont);let f=u.lineHeight,d=0;const g=ll(i.rtl,this.x,this.width),p=function(S){e.fillText(S,g.x(t.x+d),t.y+f/2),t.y+=f+r},y=g.textAlign(o);let x,m,v,b,_,w,M;for(e.textAlign=o,e.textBaseline="middle",e.font=u.string,t.x=Ur(this,y,i),e.fillStyle=i.bodyColor,et(this.beforeBody,p),d=a&&y!=="right"?o==="center"?c/2+h:c+2+h:0,b=0,w=s.length;b0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const o=po[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Ng(this,t),l=Object.assign({},o,this._size),c=Wg(e,t,l),h=Vg(t,l,c,e);(s._to!==h.x||r._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=ue(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),sD(t,e.textDirection),r.y+=o.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),rD(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!$o(i,s),o=this._positionChanged(s,e);(r||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],o=this._getActiveElements(t,r,e,i),a=this._positionChanged(o,t),l=e||!$o(o,r)||a;return l&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const r=this.options;if(t.type==="mouseout")return[];if(!s)return e;const o=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:r}=this,o=po[r.position].call(this,t,e);return o!==!1&&(i!==o.x||s!==o.y)}}SL.positioners=po;const ML=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function kL(n,t,e,i){const s=n.indexOf(t);if(s===-1)return ML(n,t,e,i);const r=n.lastIndexOf(t);return s!==r?e:s}const PL=(n,t)=>n===null?null:It(Math.round(n),0,t);class cc extends si{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:r}of e)i[s]===r&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(nt(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:kL(i,t,G(e,t),this._addedLabels),PL(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let o=t;o<=e;o++)s.push({value:o});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}cc.id="category";cc.defaults={ticks:{callback:cc.prototype.getLabelForValue}};function AL(n,t){const e=[],{bounds:s,step:r,min:o,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:f}=n,d=r||1,g=h-1,{min:p,max:y}=t,x=!nt(o),m=!nt(a),v=!nt(c),b=(y-p)/(u+1);let _=Xd((y-p)/g/d)*d,w,M,S,P;if(_<1e-14&&!x&&!m)return[{value:p},{value:y}];P=Math.ceil(y/_)-Math.floor(p/_),P>g&&(_=Xd(P*_/g/d)*d),nt(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),s==="ticks"?(M=Math.floor(p/_)*_,S=Math.ceil(y/_)*_):(M=p,S=y),x&&m&&r&&VO((a-o)/r,_/1e3)?(P=Math.round(Math.min((a-o)/_,h)),_=(a-o)/P,M=o,S=a):v?(M=x?o:M,S=m?a:S,P=c-1,_=(S-M)/P):(P=(S-M)/_,js(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const C=Math.max(Gd(_),Gd(M));w=Math.pow(10,nt(l)?C:l),M=Math.round(M*w)/w,S=Math.round(S*w)/w;let k=0;for(x&&(f&&M!==o?(e.push({value:o}),Ms=e?s:l,a=l=>r=i?r:l;if(t){const l=Ce(s),c=Ce(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(s===r){let l=1;(r>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(l=Math.abs(r*.05)),a(r+l),t||o(s-l)}this.min=s,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,o=AL(s,r);return t.bounds==="ticks"&&Yb(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return gr(t,this.chart.options.locale,this.options.ticks.format)}}class Ry extends ea{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Dt(t)?t:0,this.max=Dt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=me(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Ry.id="linear";Ry.defaults={ticks:{callback:_a.formatters.numeric}};function Yg(n){return n/Math.pow(10,Math.floor(oe(n)))===1}function CL(n,t){const e=Math.floor(oe(t.max)),i=Math.ceil(t.max/Math.pow(10,e)),s=[];let r=se(n.min,Math.pow(10,Math.floor(oe(t.min)))),o=Math.floor(oe(r)),a=Math.floor(r/Math.pow(10,o)),l=o<0?Math.pow(10,Math.abs(o)):1;do s.push({value:r,major:Yg(r)}),++a,a===10&&(a=1,++o,l=o>=0?1:l),r=Math.round(a*Math.pow(10,o)*l)/l;while(o0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Dt(t)?Math.max(0,t):null,this.max=Dt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const r=l=>i=t?i:l,o=l=>s=e?s:l,a=(l,c)=>Math.pow(10,Math.floor(oe(l))+c);i===s&&(i<=0?(r(1),o(10)):(r(a(i,-1)),o(a(s,1)))),i<=0&&r(a(s,-1)),s<=0&&o(a(i,1)),this._zero&&this.min!==this._suggestedMin&&i===a(this.min,0)&&r(a(i,-1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=CL(e,this);return t.bounds==="ticks"&&Yb(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":gr(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=oe(t),this._valueRange=oe(this.max)-oe(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(oe(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}Iy.id="logarithmic";Iy.defaults={ticks:{callback:_a.formatters.logarithmic,major:{enabled:!0}}};function hc(n){const t=n.ticks;if(t.display&&n.display){const e=ue(t.backdropPadding);return G(t.font&&t.font.size,Y.font.size)+e.height}return 0}function OL(n,t,e){return e=ut(e)?e:[e],{w:_2(n,t.string,e),h:e.length*t.lineHeight}}function Ug(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:ns?{start:t-e,end:t}:{start:t,end:t+e}}function DL(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,o=n.options.pointLabels,a=o.centerPointLabels?yt/r:0;for(let l=0;lt.r&&(a=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/o,n.b=Math.max(n.b,t.b+l))}function LL(n,t,e){const i=[],s=n._pointLabels.length,r=n.options,o=hc(r)/2,a=n.drawingArea,l=r.pointLabels.centerPointLabels?yt/s:0;for(let c=0;c270||e<90)&&(n-=t),n}function FL(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const r=i.setContext(n.getPointLabelContext(s)),o=Qt(r.font),{x:a,y:l,textAlign:c,left:h,top:u,right:f,bottom:d}=n._pointLabelItems[s],{backdropColor:g}=r;if(!nt(g)){const p=ki(r.borderRadius),y=ue(r.backdropPadding);e.fillStyle=g;const x=h-y.left,m=u-y.top,v=f-h+y.width,b=d-u+y.height;Object.values(p).some(_=>_!==0)?(e.beginPath(),Zo(e,{x,y:m,w:v,h:b,radius:p}),e.fill()):e.fillRect(x,m,v,b)}Ko(e,n._pointLabels[s],a,l+o.lineHeight/2,o,{color:r.color,textAlign:c,textBaseline:"middle"})}}function Fy(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,rt);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let o=1;o{const s=gt(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?DL(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=rt/(this._pointLabels.length||1),i=this.options.startAngle||0;return ge(t*e+me(i))}getDistanceFromCenterForValue(t){if(nt(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(nt(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(h!==0){a=this.getDistanceFromCenterForValue(c.value);const u=s.setContext(this.getContext(h-1));BL(this,u,a,r)}}),i.display){for(t.save(),o=r-1;o>=0;o--){const c=i.setContext(this.getPointLabelContext(o)),{color:h,lineWidth:u}=c;!u||!h||(t.lineWidth=u,t.strokeStyle=h,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(o,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),h=Qt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=ue(c.backdropPadding);t.fillRect(-o/2-u.left,-r-h.size/2-u.top,o+u.width,h.size+u.height)}Ko(t,a.label,0,-r,h,{color:c.color})}),t.restore()}drawTitle(){}}xa.id="radialLinear";xa.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:_a.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(n){return n},padding:5,centerPointLabels:!1}};xa.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};xa.descriptors={angleLines:{_fallback:"grid"}};const wa={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Xt=Object.keys(wa);function NL(n,t){return n-t}function Xg(n,t){if(nt(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let o=t;return typeof i=="function"&&(o=i(o)),Dt(o)||(o=typeof i=="string"?e.parse(o,i):e.parse(o)),o===null?null:(s&&(o=s==="week"&&(Ri(r)||r===!0)?e.startOf(o,"isoWeek",r):e.startOf(o,s)),+o)}function Gg(n,t,e,i){const s=Xt.length;for(let r=Xt.indexOf(n);r=Xt.indexOf(e);r--){const o=Xt[r];if(wa[o].common&&n._adapter.diff(s,i,o)>=t-1)return o}return Xt[e?Xt.indexOf(e):0]}function VL(n){for(let t=Xt.indexOf(n)+1,e=Xt.length;t=t?e[i]:e[s];n[r]=!0}}function jL(n,t,e,i){const s=n._adapter,r=+s.startOf(t[0].value,i),o=t[t.length-1].value;let a,l;for(a=r;a<=o;a=+s.add(a,1,i))l=e[a],l>=0&&(t[l].major=!0);return t}function Kg(n,t,e){const i=[],s={},r=t.length;let o,a;for(o=0;o+t.value))}initOffsets(t){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;e=It(e,0,o),i=It(i,0,o),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,o=r.unit||Gg(r.minUnit,e,i,this._getLabelCapacity(e)),a=G(r.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=Ri(l)||l===!0,h={};let u=e,f,d;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,d=0;fp-y).map(p=>+p)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,s){const r=this.options,o=r.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&o[a],h=l&&o[l],u=i[e],f=l&&h&&u&&u.major,d=this._adapter.format(t,s||(f?h:c)),g=r.ticks.callback;return g?gt(g,[d,e,i],this):d}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Hn(n,"pos",t)),{pos:r,time:a}=n[i],{pos:o,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Hn(n,"time",t)),{time:r,pos:a}=n[i],{time:o,pos:l}=n[s]);const c=o-r;return c?a+(l-a)*(t-r)/c:a}class By extends Sa{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Xr(e,this.min),this._tableRange=Xr(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],r=[];let o,a,l,c,h;for(o=0,a=t.length;o=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o{}};function zy(){for(var n,t=0,e=arguments.length,i={};t=0&&(i=e.slice(s+1),e=e.slice(0,s)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:i}})}function YL(n,t){for(var e,i=0,s=n.length;i0)for(var e,i,s=new Array(e),r=0;r=0&&(t=n.slice(0,e))!=="xmlns"&&(n=n.slice(e+1)),Jg.hasOwnProperty(t)?{space:Jg[t],local:n}:n}function UL(n){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===uc&&t.documentElement.namespaceURI===uc?t.createElement(n):t.createElementNS(e,n)}}function XL(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function Qg(n){var t=Ny(n);return(t.local?XL:UL)(t)}function GL(){}function tp(n){return n==null?GL:function(){return this.querySelector(n)}}function qL(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function KL(){return[]}function ep(n){return function(t){return t.matches(n)}}var ZL=Array.prototype.find;function JL(){return this.firstElementChild}var QL=Array.prototype.filter;function tT(){return Array.from(this.children)}function np(n){return new Array(n.length)}function na(n,t){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=t}function eT(n){return function(){return n}}function nT(n,t,e,i,s,r){for(var o,a=0,l=t.length,c=r.length;at?1:n>=t?0:NaN}function aT(n){return function(){this.removeAttribute(n)}}function lT(n){return function(){this.removeAttributeNS(n.space,n.local)}}function cT(n,t){return function(){this.setAttribute(n,t)}}function hT(n,t){return function(){this.setAttributeNS(n.space,n.local,t)}}function uT(n,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttribute(n):this.setAttribute(n,e)}}function fT(n,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}}function Wy(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function dT(n){return function(){this.style.removeProperty(n)}}function gT(n,t,e){return function(){this.style.setProperty(n,t,e)}}function pT(n,t,e){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(n):this.style.setProperty(n,i,e)}}function mT(n,t){return n.style.getPropertyValue(t)||Wy(n).getComputedStyle(n,null).getPropertyValue(t)}function bT(n){return function(){delete this[n]}}function yT(n,t){return function(){this[n]=t}}function _T(n,t){return function(){var e=t.apply(this,arguments);e==null?delete this[n]:this[n]=e}}function Vy(n){return n.trim().split(/^|\s+/)}function Dh(n){return n.classList||new jy(n)}function jy(n){this._node=n,this._names=Vy(n.getAttribute("class")||"")}function Hy(n,t){for(var e=Dh(n),i=-1,s=t.length;++i=0&&(e=t.slice(i+1),t=t.slice(0,i)),{type:t,name:e}})}function FT(n){return function(){var t=this.__on;if(t){for(var e,i=0,s=-1,r=t.length;i=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};var WT=[null];function re(n,t){this._groups=n,this._parents=t}function Ds(n){return typeof n=="string"?new re([[document.querySelector(n)]],[document.documentElement]):new re([[n]],WT)}function ip(n,t){if(n=function(r){let o;for(;o=r.sourceEvent;)r=o;return r}(n),t===void 0&&(t=n.currentTarget),t){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var i=e.createSVGPoint();return i.x=n.clientX,i.y=n.clientY,[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop]}}return[n.pageX,n.pageY]}re.prototype={constructor:re,select:function(n){typeof n!="function"&&(n=tp(n));for(var t=this._groups,e=t.length,i=new Array(e),s=0;s=_&&(_=b+1);!(v=y[_])&&++_=0;)(i=s[r])&&(o&&4^i.compareDocumentPosition(o)&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(n){function t(u,f){return u&&f?n(u.__data__,f.__data__):!u-!f}n||(n=oT);for(var e=this._groups,i=e.length,s=new Array(i),r=0;r1?this.each((t==null?dT:typeof t=="function"?pT:gT)(n,t,e??"")):mT(this.node(),n)},property:function(n,t){return arguments.length>1?this.each((t==null?bT:typeof t=="function"?_T:yT)(n,t)):this.node()[n]},classed:function(n,t){var e=Vy(n+"");if(arguments.length<2){for(var i=Dh(this.node()),s=-1,r=e.length;++s()=>n;function fc(n,{sourceEvent:t,subject:e,target:i,identifier:s,active:r,x:o,y:a,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function jT(n){return!n.ctrlKey&&!n.button}function HT(){return this.parentNode}function $T(n,t){return t??{x:n.x,y:n.y}}function YT(){return navigator.maxTouchPoints||"ontouchstart"in this}function UT(){var n,t,e,i,s=jT,r=HT,o=$T,a=YT,l={},c=zy("start","drag","end"),h=0,u=0;function f(b){b.on("mousedown.drag",d).filter(a).on("touchstart.drag",y).on("touchmove.drag",x,VT).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(b,_){if(!i&&s.call(this,b,_)){var w=v(this,r.call(this,b,_),b,_,"mouse");w&&(Ds(b.view).on("mousemove.drag",g,ls).on("mouseup.drag",p,ls),function(M){var S=M.document.documentElement,P=Ds(M).on("dragstart.drag",di,ls);"onselectstart"in S?P.on("selectstart.drag",di,ls):(S.__noselect=S.style.MozUserSelect,S.style.MozUserSelect="none")}(b.view),bl(b),e=!1,n=b.clientX,t=b.clientY,w("start",b))}}function g(b){if(di(b),!e){var _=b.clientX-n,w=b.clientY-t;e=_*_+w*w>u}l.mouse("drag",b)}function p(b){Ds(b.view).on("mousemove.drag mouseup.drag",null),function(_,w){var M=_.document.documentElement,S=Ds(_).on("dragstart.drag",null);w&&(S.on("click.drag",di,ls),setTimeout(function(){S.on("click.drag",null)},0)),"onselectstart"in M?S.on("selectstart.drag",null):(M.style.MozUserSelect=M.__noselect,delete M.__noselect)}(b.view,e),di(b),l.mouse("end",b)}function y(b,_){if(s.call(this,b,_)){var w,M,S=b.changedTouches,P=r.call(this,b,_),C=S.length;for(w=0;wt.scales[ke].max?t.scales[ke].max:r,r=rt.scales[je].max?t.scales[je].max:o,o=o{if($t){gi=$t.datasetIndex,Wn=$t.index,dc=!0;let s=t.data.datasets[gi].data[Wn];ia==="radar"||ia==="polarArea"?s=function(r,o){let a,l,c;r.touches?(a=r.touches[0].clientX-o.canvas.getBoundingClientRect().left,l=r.touches[0].clientY-o.canvas.getBoundingClientRect().top):(a=r.clientX-o.canvas.getBoundingClientRect().left,l=r.clientY-o.canvas.getBoundingClientRect().top);let h=o.scales[rn],u=Math.sqrt(Math.pow(a-h.xCenter,2)+Math.pow(l-h.yCenter,2)),f=h.drawingArea/(h.max-h.min);return c=h.options.ticks.reverse?h.max-u/f:h.min+u/f,c=sa(c,o.config.options.plugins.dragData.round),c=c>o.scales[rn].max?o.scales[rn].max:c,c=c((i,s,r)=>{if($t=s.getElementsAtEventForMode(i,"nearest",{intersect:!0},!1)[0],ia=s.config.type,$t){let o=$t.datasetIndex,a=$t.index;sp=function(u){try{return u()}catch{return""}}(()=>s.config.options.plugins.tooltip.animation);const l=s.data.datasets[o],c=s.getDatasetMeta(o);let h=l.data[a];if(ke=c.xAxisID,je=c.yAxisID,rn=c.rAxisID,l.dragData===!1||s.config.options.scales[ke]&&s.config.options.scales[ke].dragData===!1||s.config.options.scales[je]&&s.config.options.scales[je].dragData===!1||s.config.options.scales[rn]&&s.config.options.scales[rn].rAxisID===!1||l.data[$t.index].dragData===!1)return void($t=null);if(ia==="bar"){Uy=s.config.options.scales[ke].stacked;const u=s.data.datasets[0].data[0];Xy=u!==null&&Array.isArray(u)&&u.length==2,Gy=gc(i,s,o,a)-h}(s.config.options.plugins.dragData.showTooltip===void 0||s.config.options.plugins.dragData.showTooltip)&&(s.config.options.plugins.tooltip||(s.config.options.plugins.tooltip={}),s.config.options.plugins.tooltip.animation=!1),typeof r=="function"&&$t&&r(i,o,a,h)===!1&&($t=null)}})(e.sourceEvent,n,t.onDragStart)).on("drag",e=>XT(e.sourceEvent,n,t,t.onDrag)).on("end",e=>((i,s,r)=>{if(Wn=void 0,dc=!1,s.config.options.plugins.tooltip&&(s.config.options.plugins.tooltip.animation=sp,s.update("none")),typeof r=="function"&&$t){const o=$t.datasetIndex,a=$t.index;let l=function(c,h,u){const f=c.config.options.plugins.dragData;if(!f.magnet)return c.data.datasets[h].data[u];{const d=f.magnet;if(d.to&&typeof d.to=="function"){let g=c.data.datasets[h].data[u];return g=d.to(g),c.data.datasets[h].data[u]=g,c.update("none"),g}}}(s,o,a);return r(i,o,a,l)}})(e.sourceEvent,n,t.onDragEnd)))}},beforeEvent:function(n){if(dc)return n.tooltip&&n.tooltip.update(),!1}};Ph.register(qy);function GT(n){let t,e,i,s,r;return{c(){t=z("canvas"),e=vt(),i=z("canvas"),on(t,"width","100%"),on(t,"height","400px"),on(i,"width","100%"),on(i,"height","300px")},m(o,a){N(o,t,a),N(o,e,a),N(o,i,a),s||(r=[Fh(n[0].call(null,t)),Fh(n[1].call(null,i))],s=!0)},p:wt,i:wt,o:wt,d(o){o&&(W(t),W(e),W(i)),s=!1,wn(r)}}}function qT(n,t,e){Ps.register(...DO),Ps.register(qy);let{lts:i}=t,{nearbyAmenities:s}=t,{greenspace:r}=t;const o=pc();let a=null,l=["red","blue","green"];c();function c(){let f=i+s+r;e(2,i=100*i/f),e(3,s=100*s/f),e(4,r=100*r/f),a&&(a.data.datasets[0].data=[i,s,r],a.update())}function h(f){let d={type:"radar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[i,s,r],pointHitRadius:25}]},options:{responsive:!1,onHover(g){const p=g.chart.getElementsAtEventForMode(g,"nearest",{intersect:!0},!1);g.native.target.style.cursor=p.length?"grab":"default"},plugins:{dragData:{round:1,showTooltip:!0,onDragStart(g){g.target.style.cursor="grabbing"},onDragEnd(g,p,y,x){g.target.style.cursor="default",y==0?e(2,i=x):y==1?e(3,s=x):y==2&&e(4,r=x),c(),o("change","")}}},scales:{r:{min:0,max:100,stepSize:1,pointLabels:{color:l,font:{weight:"bold",size:15}},ticks:{display:!1}}}}};new Ps(f.getContext("2d"),d)}function u(f){let d={type:"bar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[i,s,r],backgroundColor:l}]},options:{indexAxis:"y"}};a=new Ps(f.getContext("2d"),d)}return n.$$set=f=>{"lts"in f&&e(2,i=f.lts),"nearbyAmenities"in f&&e(3,s=f.nearbyAmenities),"greenspace"in f&&e(4,r=f.greenspace)},[h,u,i,s,r]}class KT extends te{constructor(t){super(),ee(this,t,qT,GT,zt,{lts:2,nearbyAmenities:3,greenspace:4})}}function rp(n,t,e){const i=n.slice();return i[24]=t[e],i[29]=t,i[30]=e,i}function op(n,t,e){const i=n.slice();return i[24]=t[e],i[27]=t,i[28]=e,i}function ap(n,t,e){const i=n.slice();return i[24]=t[e],i[25]=t,i[26]=e,i}function ZT(n){let t,e,i,s,r,o,a,l,c,h,u,f,d,g;function p(_){n[15](_)}function y(_){n[16](_)}function x(_){n[17](_)}let m={};n[3].tradeoff_lts!==void 0&&(m.lts=n[3].tradeoff_lts),n[3].tradeoff_amenities!==void 0&&(m.nearbyAmenities=n[3].tradeoff_amenities),n[3].tradeoff_greenspace!==void 0&&(m.greenspace=n[3].tradeoff_greenspace),t=new KT({props:m}),Yn.push(()=>xi(t,"lts",p)),Yn.push(()=>xi(t,"nearbyAmenities",y)),Yn.push(()=>xi(t,"greenspace",x)),t.$on("change",n[18]);let v=Pi(n[6]),b=[];for(let _=0;_e=!1)),!i&&w&8&&(i=!0,M.nearbyAmenities=_[3].tradeoff_amenities,wi(()=>i=!1)),!s&&w&8&&(s=!0,M.greenspace=_[3].tradeoff_greenspace,wi(()=>s=!1)),t.$set(M),w&73){v=Pi(_[6]);let S;for(S=0;Sconfig.json - file`,g=vt(),p=z("pre"),y=Vt('"cost": '),m=Vt(x),v=vt(),b=z("button"),b.textContent="See cost function JSON",_=vt(),M&&M.c(),S=Ze(),r.__value="Distance",At(r,r.__value),o.__value="Generalized",At(o,o.__value),a.__value="ByLTS",At(a,a.__value),l.__value="OsmHighwayType",At(l,l.__value),n[1]===void 0&&gp(()=>n[7].call(s))},m(O,E){N(O,t,E),B(t,e),B(e,i),B(e,s),B(s,r),B(s,o),B(s,a),B(s,l),yo(s,n[1],!0),N(O,c,E),N(O,h,E),B(h,u),B(h,f),B(h,d),B(h,g),B(h,p),B(p,y),B(p,m),n[9](h),N(O,v,E),N(O,b,E),N(O,_,E),~w&&L[w].m(O,E),N(O,S,E),P=!0,C||(k=[Ot(s,"change",n[7]),Ot(u,"click",n[8]),Ot(b,"click",n[10])],C=!0)},p(O,[E]){E&2&&yo(s,O[1]),(!P||E&1)&&x!==(x=JSON.stringify(O[0],null,2)+"")&&rr(m,x);let I=w;w=R(O),w===I?~w&&L[w].p(O,E):(M&&(vn(),Z(L[I],1,1,()=>{L[I]=null}),xn()),~w?(M=L[w],M?M.p(O,E):(M=L[w]=A[w](O),M.c()),U(M,1),M.m(S.parentNode,S)):M=null)},i(O){P||(U(M),P=!0)},o(O){Z(M),P=!1},d(O){O&&(W(t),W(c),W(h),W(v),W(b),W(_),W(S)),n[9](null),~w&&L[w].d(O),C=!1,wn(k)}}}function eR(n,t,e){let{cost:i}=t,s,r="Distance",o={tradeoff_lts:50,tradeoff_amenities:30,tradeoff_greenspace:20,lts1:0,lts2:.2,lts3:.6,lts4:1,minimum_amenities:1},a=["lts1","lts2","lts3","lts4"],l={lts1:1,lts2:1,lts3:1,lts4:1},c={};for(let k of["cycleway","footway","living_street","motorway","motorway_link","path","pedestrian","primary","primary_link","residential","secondary","secondary_link","service","steps","tertiary","tertiary_link","track","trunk","trunk_link","unclassified"])c[k]=1;function h(k){k=="OsmHighwayType"?e(0,i={OsmHighwayType:c}):k=="ByLTS"?e(0,i={ByLTS:l}):k=="Generalized"?e(0,i={Generalized:o}):e(0,i=k)}function u(){r=pp(this),e(1,r)}const f=()=>s.close();function d(k){Yn[k?"unshift":"push"](()=>{s=k,e(2,s)})}const g=()=>s.showModal();function p(k){c[k]=jn(this.value),e(5,c)}const y=()=>e(0,i);function x(k){l[k]=jn(this.value),e(4,l)}const m=()=>e(0,i);function v(k){n.$$.not_equal(o.tradeoff_lts,k)&&(o.tradeoff_lts=k,e(3,o))}function b(k){n.$$.not_equal(o.tradeoff_amenities,k)&&(o.tradeoff_amenities=k,e(3,o))}function _(k){n.$$.not_equal(o.tradeoff_greenspace,k)&&(o.tradeoff_greenspace=k,e(3,o))}const w=()=>e(0,i);function M(k){o[k]=jn(this.value),e(3,o)}const S=()=>e(0,i);function P(){o.minimum_amenities=jn(this.value),e(3,o)}const C=()=>e(0,i);return n.$$set=k=>{"cost"in k&&e(0,i=k.cost)},n.$$.update=()=>{n.$$.dirty&2&&h(r)},[i,r,s,o,l,c,a,u,f,d,g,p,y,x,m,v,b,_,w,M,S,P,C]}class UR extends te{constructor(t){super(),ee(this,t,eR,tR,zt,{cost:0})}}export{uR as C,sR as G,hR as J,aR as L,cR as O,lR as P,cM as _,UR as a}; +`):n}function fL(n,t){const{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:n,label:o,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Ng(n,t){const e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:o,boxHeight:a}=t,l=Qt(t.bodyFont),c=Qt(t.titleFont),h=Qt(t.footerFont),u=r.length,f=s.length,d=i.length,g=ue(t.padding);let p=g.height,y=0,x=i.reduce((b,_)=>b+_.before.length+_.lines.length+_.after.length,0);if(x+=n.beforeBody.length+n.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),x){const b=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=d*b+(x-d)*l.lineHeight+(x-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let m=0;const v=function(b){y=Math.max(y,e.measureText(b).width+m)};return e.save(),e.font=c.string,et(n.title,v),e.font=l.string,et(n.beforeBody.concat(n.afterBody),v),m=t.displayColors?o+2+t.boxPadding:0,et(i,b=>{et(b.before,v),et(b.lines,v),et(b.after,v)}),m=0,e.font=h.string,et(n.footer,v),e.restore(),y+=g.width,{width:y,height:p}}function dL(n,t){const{y:e,height:i}=t;return en.height-i/2?"bottom":"center"}function gL(n,t,e,i){const{x:s,width:r}=i,o=e.caretSize+e.caretPadding;if(n==="left"&&s+r+o>t.width||n==="right"&&s-r-o<0)return!0}function pL(n,t,e,i){const{x:s,width:r}=e,{width:o,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),gL(c,n,t,e)&&(c="center"),c}function Wg(n,t,e){const i=e.yAlign||t.yAlign||dL(n,e);return{xAlign:e.xAlign||t.xAlign||pL(n,t,e,i),yAlign:i}}function mL(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function bL(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Vg(n,t,e,i){const{caretSize:s,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=e,c=s+r,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:d}=ki(o);let g=mL(t,a);const p=bL(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,f)+s:a==="right"&&(g+=Math.max(u,d)+s),{x:Ft(g,0,i.width-t.width),y:Ft(p,0,i.height-t.height)}}function Ur(n,t,e){const i=ue(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function jg(n){return we([],ze(n))}function yL(n,t,e){return An(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Hg(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}class _L extends Ze{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new py(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=yL(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),r=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);let a=[];return a=we(a,ze(s)),a=we(a,ze(r)),a=we(a,ze(o)),a}getBeforeBody(t,e){return jg(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,s=[];return et(t,r=>{const o={before:[],lines:[],after:[]},a=Hg(i,r);we(o.before,ze(a.beforeLabel.call(this,r))),we(o.lines,a.label.call(this,r)),we(o.after,ze(a.afterLabel.call(this,r))),s.push(o)}),s}getAfterBody(t,e){return jg(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),r=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);let a=[];return a=we(a,ze(s)),a=we(a,ze(r)),a=we(a,ze(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],r=[],o=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,f,i))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,i))),et(a,h=>{const u=Hg(t.callbacks,h);s.push(u.labelColor.call(this,h)),r.push(u.labelPointStyle.call(this,h)),o.push(u.labelTextColor.call(this,h))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let r,o=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const a=po[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=Ng(this,i),c=Object.assign({},a,l),h=Wg(this.chart,i,c),u=Vg(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,r={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:r}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=ki(a),{x:f,y:d}=t,{width:g,height:p}=e;let y,x,m,v,b,_;return r==="center"?(b=d+p/2,s==="left"?(y=f,x=y-o,v=b+o,_=b-o):(y=f+g,x=y+o,v=b-o,_=b+o),m=y):(s==="left"?x=f+Math.max(l,h)+o:s==="right"?x=f+g-Math.max(c,u)-o:x=this.caretX,r==="top"?(v=d,b=v-o,y=x-o,m=x+o):(v=d+p,b=v+o,y=x+o,m=x-o),_=v),{x1:y,x2:x,x3:m,y1:v,y2:b,y3:_}}drawTitle(t,e,i){const s=this.title,r=s.length;let o,a,l;if(r){const c=ll(i.rtl,this.x,this.width);for(t.x=Ur(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",o=Qt(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,l=0;lv!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Jo(t,{x:y,y:p,w:c,h:l,radius:m}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),Jo(t,{x,y:p+1,w:c-2,h:l-2,radius:m}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(y,p,c,l),t.strokeRect(y,p,c,l),t.fillStyle=o.backgroundColor,t.fillRect(x,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=i,u=Qt(i.bodyFont);let f=u.lineHeight,d=0;const g=ll(i.rtl,this.x,this.width),p=function(S){e.fillText(S,g.x(t.x+d),t.y+f/2),t.y+=f+r},y=g.textAlign(o);let x,m,v,b,_,w,M;for(e.textAlign=o,e.textBaseline="middle",e.font=u.string,t.x=Ur(this,y,i),e.fillStyle=i.bodyColor,et(this.beforeBody,p),d=a&&y!=="right"?o==="center"?c/2+h:c+2+h:0,b=0,w=s.length;b0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const o=po[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Ng(this,t),l=Object.assign({},o,this._size),c=Wg(e,t,l),h=Vg(t,l,c,e);(s._to!==h.x||r._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=ue(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),tD(t,e.textDirection),r.y+=o.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),eD(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!$o(i,s),o=this._positionChanged(s,e);(r||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],o=this._getActiveElements(t,r,e,i),a=this._positionChanged(o,t),l=e||!$o(o,r)||a;return l&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const r=this.options;if(t.type==="mouseout")return[];if(!s)return e;const o=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:r}=this,o=po[r.position].call(this,t,e);return o!==!1&&(i!==o.x||s!==o.y)}}_L.positioners=po;const vL=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function xL(n,t,e,i){const s=n.indexOf(t);if(s===-1)return vL(n,t,e,i);const r=n.lastIndexOf(t);return s!==r?e:s}const wL=(n,t)=>n===null?null:Ft(Math.round(n),0,t);class cc extends si{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:r}of e)i[s]===r&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(nt(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:xL(i,t,G(e,t),this._addedLabels),wL(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let o=t;o<=e;o++)s.push({value:o});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}cc.id="category";cc.defaults={ticks:{callback:cc.prototype.getLabelForValue}};function SL(n,t){const e=[],{bounds:s,step:r,min:o,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:f}=n,d=r||1,g=h-1,{min:p,max:y}=t,x=!nt(o),m=!nt(a),v=!nt(c),b=(y-p)/(u+1);let _=Xd((y-p)/g/d)*d,w,M,S,P;if(_<1e-14&&!x&&!m)return[{value:p},{value:y}];P=Math.ceil(y/_)-Math.floor(p/_),P>g&&(_=Xd(P*_/g/d)*d),nt(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),s==="ticks"?(M=Math.floor(p/_)*_,S=Math.ceil(y/_)*_):(M=p,S=y),x&&m&&r&&BO((a-o)/r,_/1e3)?(P=Math.round(Math.min((a-o)/_,h)),_=(a-o)/P,M=o,S=a):v?(M=x?o:M,S=m?a:S,P=c-1,_=(S-M)/P):(P=(S-M)/_,js(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const C=Math.max(Gd(_),Gd(M));w=Math.pow(10,nt(l)?C:l),M=Math.round(M*w)/w,S=Math.round(S*w)/w;let k=0;for(x&&(f&&M!==o?(e.push({value:o}),Ms=e?s:l,a=l=>r=i?r:l;if(t){const l=Ce(s),c=Ce(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(s===r){let l=1;(r>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(l=Math.abs(r*.05)),a(r+l),t||o(s-l)}this.min=s,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,o=SL(s,r);return t.bounds==="ticks"&&Yb(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return gr(t,this.chart.options.locale,this.options.ticks.format)}}class Ry extends ea{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Dt(t)?t:0,this.max=Dt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=me(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Ry.id="linear";Ry.defaults={ticks:{callback:_a.formatters.numeric}};function Yg(n){return n/Math.pow(10,Math.floor(oe(n)))===1}function ML(n,t){const e=Math.floor(oe(t.max)),i=Math.ceil(t.max/Math.pow(10,e)),s=[];let r=se(n.min,Math.pow(10,Math.floor(oe(t.min)))),o=Math.floor(oe(r)),a=Math.floor(r/Math.pow(10,o)),l=o<0?Math.pow(10,Math.abs(o)):1;do s.push({value:r,major:Yg(r)}),++a,a===10&&(a=1,++o,l=o>=0?1:l),r=Math.round(a*Math.pow(10,o)*l)/l;while(o0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Dt(t)?Math.max(0,t):null,this.max=Dt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const r=l=>i=t?i:l,o=l=>s=e?s:l,a=(l,c)=>Math.pow(10,Math.floor(oe(l))+c);i===s&&(i<=0?(r(1),o(10)):(r(a(i,-1)),o(a(s,1)))),i<=0&&r(a(s,-1)),s<=0&&o(a(i,1)),this._zero&&this.min!==this._suggestedMin&&i===a(this.min,0)&&r(a(i,-1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=ML(e,this);return t.bounds==="ticks"&&Yb(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":gr(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=oe(t),this._valueRange=oe(this.max)-oe(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(oe(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}Iy.id="logarithmic";Iy.defaults={ticks:{callback:_a.formatters.logarithmic,major:{enabled:!0}}};function hc(n){const t=n.ticks;if(t.display&&n.display){const e=ue(t.backdropPadding);return G(t.font&&t.font.size,Y.font.size)+e.height}return 0}function kL(n,t,e){return e=ut(e)?e:[e],{w:p2(n,t.string,e),h:e.length*t.lineHeight}}function Ug(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:ns?{start:t-e,end:t}:{start:t,end:t+e}}function PL(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,o=n.options.pointLabels,a=o.centerPointLabels?_t/r:0;for(let l=0;lt.r&&(a=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/o,n.b=Math.max(n.b,t.b+l))}function CL(n,t,e){const i=[],s=n._pointLabels.length,r=n.options,o=hc(r)/2,a=n.drawingArea,l=r.pointLabels.centerPointLabels?_t/s:0;for(let c=0;c270||e<90)&&(n-=t),n}function LL(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const r=i.setContext(n.getPointLabelContext(s)),o=Qt(r.font),{x:a,y:l,textAlign:c,left:h,top:u,right:f,bottom:d}=n._pointLabelItems[s],{backdropColor:g}=r;if(!nt(g)){const p=ki(r.borderRadius),y=ue(r.backdropPadding);e.fillStyle=g;const x=h-y.left,m=u-y.top,v=f-h+y.width,b=d-u+y.height;Object.values(p).some(_=>_!==0)?(e.beginPath(),Jo(e,{x,y:m,w:v,h:b,radius:p}),e.fill()):e.fillRect(x,m,v,b)}Ko(e,n._pointLabels[s],a,l+o.lineHeight/2,o,{color:r.color,textAlign:c,textBaseline:"middle"})}}function Fy(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,rt);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let o=1;o{const s=gt(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?PL(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=rt/(this._pointLabels.length||1),i=this.options.startAngle||0;return ge(t*e+me(i))}getDistanceFromCenterForValue(t){if(nt(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(nt(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(h!==0){a=this.getDistanceFromCenterForValue(c.value);const u=s.setContext(this.getContext(h-1));TL(this,u,a,r)}}),i.display){for(t.save(),o=r-1;o>=0;o--){const c=i.setContext(this.getPointLabelContext(o)),{color:h,lineWidth:u}=c;!u||!h||(t.lineWidth=u,t.strokeStyle=h,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(o,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),h=Qt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=ue(c.backdropPadding);t.fillRect(-o/2-u.left,-r-h.size/2-u.top,o+u.width,h.size+u.height)}Ko(t,a.label,0,-r,h,{color:c.color})}),t.restore()}drawTitle(){}}xa.id="radialLinear";xa.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:_a.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(n){return n},padding:5,centerPointLabels:!1}};xa.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};xa.descriptors={angleLines:{_fallback:"grid"}};const wa={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Xt=Object.keys(wa);function IL(n,t){return n-t}function Xg(n,t){if(nt(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let o=t;return typeof i=="function"&&(o=i(o)),Dt(o)||(o=typeof i=="string"?e.parse(o,i):e.parse(o)),o===null?null:(s&&(o=s==="week"&&(Ri(r)||r===!0)?e.startOf(o,"isoWeek",r):e.startOf(o,s)),+o)}function Gg(n,t,e,i){const s=Xt.length;for(let r=Xt.indexOf(n);r=Xt.indexOf(e);r--){const o=Xt[r];if(wa[o].common&&n._adapter.diff(s,i,o)>=t-1)return o}return Xt[e?Xt.indexOf(e):0]}function BL(n){for(let t=Xt.indexOf(n)+1,e=Xt.length;t=t?e[i]:e[s];n[r]=!0}}function zL(n,t,e,i){const s=n._adapter,r=+s.startOf(t[0].value,i),o=t[t.length-1].value;let a,l;for(a=r;a<=o;a=+s.add(a,1,i))l=e[a],l>=0&&(t[l].major=!0);return t}function Kg(n,t,e){const i=[],s={},r=t.length;let o,a;for(o=0;o+t.value))}initOffsets(t){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;e=Ft(e,0,o),i=Ft(i,0,o),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,o=r.unit||Gg(r.minUnit,e,i,this._getLabelCapacity(e)),a=G(r.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=Ri(l)||l===!0,h={};let u=e,f,d;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,d=0;fp-y).map(p=>+p)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,s){const r=this.options,o=r.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&o[a],h=l&&o[l],u=i[e],f=l&&h&&u&&u.major,d=this._adapter.format(t,s||(f?h:c)),g=r.ticks.callback;return g?gt(g,[d,e,i],this):d}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Hn(n,"pos",t)),{pos:r,time:a}=n[i],{pos:o,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Hn(n,"time",t)),{time:r,pos:a}=n[i],{time:o,pos:l}=n[s]);const c=o-r;return c?a+(l-a)*(t-r)/c:a}class By extends Sa{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Xr(e,this.min),this._tableRange=Xr(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],r=[];let o,a,l,c,h;for(o=0,a=t.length;o=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o{}};function zy(){for(var n,t=0,e=arguments.length,i={};t=0&&(i=e.slice(s+1),e=e.slice(0,s)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:i}})}function VL(n,t){for(var e,i=0,s=n.length;i0)for(var e,i,s=new Array(e),r=0;r=0&&(t=n.slice(0,e))!=="xmlns"&&(n=n.slice(e+1)),Zg.hasOwnProperty(t)?{space:Zg[t],local:n}:n}function jL(n){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===uc&&t.documentElement.namespaceURI===uc?t.createElement(n):t.createElementNS(e,n)}}function HL(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function Qg(n){var t=Ny(n);return(t.local?HL:jL)(t)}function $L(){}function tp(n){return n==null?$L:function(){return this.querySelector(n)}}function YL(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function UL(){return[]}function ep(n){return function(t){return t.matches(n)}}var XL=Array.prototype.find;function GL(){return this.firstElementChild}var qL=Array.prototype.filter;function KL(){return Array.from(this.children)}function np(n){return new Array(n.length)}function na(n,t){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=t}function JL(n){return function(){return n}}function ZL(n,t,e,i,s,r){for(var o,a=0,l=t.length,c=r.length;at?1:n>=t?0:NaN}function iT(n){return function(){this.removeAttribute(n)}}function sT(n){return function(){this.removeAttributeNS(n.space,n.local)}}function rT(n,t){return function(){this.setAttribute(n,t)}}function oT(n,t){return function(){this.setAttributeNS(n.space,n.local,t)}}function aT(n,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttribute(n):this.setAttribute(n,e)}}function lT(n,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}}function Wy(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function cT(n){return function(){this.style.removeProperty(n)}}function hT(n,t,e){return function(){this.style.setProperty(n,t,e)}}function uT(n,t,e){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(n):this.style.setProperty(n,i,e)}}function fT(n,t){return n.style.getPropertyValue(t)||Wy(n).getComputedStyle(n,null).getPropertyValue(t)}function dT(n){return function(){delete this[n]}}function gT(n,t){return function(){this[n]=t}}function pT(n,t){return function(){var e=t.apply(this,arguments);e==null?delete this[n]:this[n]=e}}function Vy(n){return n.trim().split(/^|\s+/)}function Dh(n){return n.classList||new jy(n)}function jy(n){this._node=n,this._names=Vy(n.getAttribute("class")||"")}function Hy(n,t){for(var e=Dh(n),i=-1,s=t.length;++i=0&&(e=t.slice(i+1),t=t.slice(0,i)),{type:t,name:e}})}function LT(n){return function(){var t=this.__on;if(t){for(var e,i=0,s=-1,r=t.length;i=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};var FT=[null];function re(n,t){this._groups=n,this._parents=t}function Ds(n){return typeof n=="string"?new re([[document.querySelector(n)]],[document.documentElement]):new re([[n]],FT)}function ip(n,t){if(n=function(r){let o;for(;o=r.sourceEvent;)r=o;return r}(n),t===void 0&&(t=n.currentTarget),t){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var i=e.createSVGPoint();return i.x=n.clientX,i.y=n.clientY,[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop]}}return[n.pageX,n.pageY]}re.prototype={constructor:re,select:function(n){typeof n!="function"&&(n=tp(n));for(var t=this._groups,e=t.length,i=new Array(e),s=0;s=_&&(_=b+1);!(v=y[_])&&++_=0;)(i=s[r])&&(o&&4^i.compareDocumentPosition(o)&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(n){function t(u,f){return u&&f?n(u.__data__,f.__data__):!u-!f}n||(n=nT);for(var e=this._groups,i=e.length,s=new Array(i),r=0;r1?this.each((t==null?cT:typeof t=="function"?uT:hT)(n,t,e??"")):fT(this.node(),n)},property:function(n,t){return arguments.length>1?this.each((t==null?dT:typeof t=="function"?pT:gT)(n,t)):this.node()[n]},classed:function(n,t){var e=Vy(n+"");if(arguments.length<2){for(var i=Dh(this.node()),s=-1,r=e.length;++s()=>n;function fc(n,{sourceEvent:t,subject:e,target:i,identifier:s,active:r,x:o,y:a,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function zT(n){return!n.ctrlKey&&!n.button}function NT(){return this.parentNode}function WT(n,t){return t??{x:n.x,y:n.y}}function VT(){return navigator.maxTouchPoints||"ontouchstart"in this}function jT(){var n,t,e,i,s=zT,r=NT,o=WT,a=VT,l={},c=zy("start","drag","end"),h=0,u=0;function f(b){b.on("mousedown.drag",d).filter(a).on("touchstart.drag",y).on("touchmove.drag",x,BT).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(b,_){if(!i&&s.call(this,b,_)){var w=v(this,r.call(this,b,_),b,_,"mouse");w&&(Ds(b.view).on("mousemove.drag",g,as).on("mouseup.drag",p,as),function(M){var S=M.document.documentElement,P=Ds(M).on("dragstart.drag",di,as);"onselectstart"in S?P.on("selectstart.drag",di,as):(S.__noselect=S.style.MozUserSelect,S.style.MozUserSelect="none")}(b.view),bl(b),e=!1,n=b.clientX,t=b.clientY,w("start",b))}}function g(b){if(di(b),!e){var _=b.clientX-n,w=b.clientY-t;e=_*_+w*w>u}l.mouse("drag",b)}function p(b){Ds(b.view).on("mousemove.drag mouseup.drag",null),function(_,w){var M=_.document.documentElement,S=Ds(_).on("dragstart.drag",null);w&&(S.on("click.drag",di,as),setTimeout(function(){S.on("click.drag",null)},0)),"onselectstart"in M?S.on("selectstart.drag",null):(M.style.MozUserSelect=M.__noselect,delete M.__noselect)}(b.view,e),di(b),l.mouse("end",b)}function y(b,_){if(s.call(this,b,_)){var w,M,S=b.changedTouches,P=r.call(this,b,_),C=S.length;for(w=0;wt.scales[ke].max?t.scales[ke].max:r,r=rt.scales[je].max?t.scales[je].max:o,o=o{if($t){gi=$t.datasetIndex,Wn=$t.index,dc=!0;let s=t.data.datasets[gi].data[Wn];ia==="radar"||ia==="polarArea"?s=function(r,o){let a,l,c;r.touches?(a=r.touches[0].clientX-o.canvas.getBoundingClientRect().left,l=r.touches[0].clientY-o.canvas.getBoundingClientRect().top):(a=r.clientX-o.canvas.getBoundingClientRect().left,l=r.clientY-o.canvas.getBoundingClientRect().top);let h=o.scales[sn],u=Math.sqrt(Math.pow(a-h.xCenter,2)+Math.pow(l-h.yCenter,2)),f=h.drawingArea/(h.max-h.min);return c=h.options.ticks.reverse?h.max-u/f:h.min+u/f,c=sa(c,o.config.options.plugins.dragData.round),c=c>o.scales[sn].max?o.scales[sn].max:c,c=c((i,s,r)=>{if($t=s.getElementsAtEventForMode(i,"nearest",{intersect:!0},!1)[0],ia=s.config.type,$t){let o=$t.datasetIndex,a=$t.index;sp=function(u){try{return u()}catch{return""}}(()=>s.config.options.plugins.tooltip.animation);const l=s.data.datasets[o],c=s.getDatasetMeta(o);let h=l.data[a];if(ke=c.xAxisID,je=c.yAxisID,sn=c.rAxisID,l.dragData===!1||s.config.options.scales[ke]&&s.config.options.scales[ke].dragData===!1||s.config.options.scales[je]&&s.config.options.scales[je].dragData===!1||s.config.options.scales[sn]&&s.config.options.scales[sn].rAxisID===!1||l.data[$t.index].dragData===!1)return void($t=null);if(ia==="bar"){Uy=s.config.options.scales[ke].stacked;const u=s.data.datasets[0].data[0];Xy=u!==null&&Array.isArray(u)&&u.length==2,Gy=gc(i,s,o,a)-h}(s.config.options.plugins.dragData.showTooltip===void 0||s.config.options.plugins.dragData.showTooltip)&&(s.config.options.plugins.tooltip||(s.config.options.plugins.tooltip={}),s.config.options.plugins.tooltip.animation=!1),typeof r=="function"&&$t&&r(i,o,a,h)===!1&&($t=null)}})(e.sourceEvent,n,t.onDragStart)).on("drag",e=>HT(e.sourceEvent,n,t,t.onDrag)).on("end",e=>((i,s,r)=>{if(Wn=void 0,dc=!1,s.config.options.plugins.tooltip&&(s.config.options.plugins.tooltip.animation=sp,s.update("none")),typeof r=="function"&&$t){const o=$t.datasetIndex,a=$t.index;let l=function(c,h,u){const f=c.config.options.plugins.dragData;if(!f.magnet)return c.data.datasets[h].data[u];{const d=f.magnet;if(d.to&&typeof d.to=="function"){let g=c.data.datasets[h].data[u];return g=d.to(g),c.data.datasets[h].data[u]=g,c.update("none"),g}}}(s,o,a);return r(i,o,a,l)}})(e.sourceEvent,n,t.onDragEnd)))}},beforeEvent:function(n){if(dc)return n.tooltip&&n.tooltip.update(),!1}};Ph.register(qy);function $T(n){let t,e,i,s,r;return{c(){t=z("canvas"),e=pt(),i=z("canvas"),rn(t,"width","100%"),rn(t,"height","400px"),rn(i,"width","100%"),rn(i,"height","300px")},m(o,a){N(o,t,a),N(o,e,a),N(o,i,a),s||(r=[Fh(n[0].call(null,t)),Fh(n[1].call(null,i))],s=!0)},p:wt,i:wt,o:wt,d(o){o&&(W(t),W(e),W(i)),s=!1,wn(r)}}}function YT(n,t,e){Ps.register(...PO),Ps.register(qy);let{lts:i}=t,{nearbyAmenities:s}=t,{greenspace:r}=t;const o=pc();let a=null,l=["red","blue","green"];c();function c(){let f=i+s+r;e(2,i=100*i/f),e(3,s=100*s/f),e(4,r=100*r/f),a&&(a.data.datasets[0].data=[i,s,r],a.update())}function h(f){let d={type:"radar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[i,s,r],pointHitRadius:25}]},options:{responsive:!1,onHover(g){const p=g.chart.getElementsAtEventForMode(g,"nearest",{intersect:!0},!1);g.native.target.style.cursor=p.length?"grab":"default"},plugins:{dragData:{round:1,showTooltip:!0,onDragStart(g){g.target.style.cursor="grabbing"},onDragEnd(g,p,y,x){g.target.style.cursor="default",y==0?e(2,i=x):y==1?e(3,s=x):y==2&&e(4,r=x),c(),o("change","")}}},scales:{r:{min:0,max:100,stepSize:1,pointLabels:{color:l,font:{weight:"bold",size:15}},ticks:{display:!1}}}}};new Ps(f.getContext("2d"),d)}function u(f){let d={type:"bar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[i,s,r],backgroundColor:l}]},options:{indexAxis:"y"}};a=new Ps(f.getContext("2d"),d)}return n.$$set=f=>{"lts"in f&&e(2,i=f.lts),"nearbyAmenities"in f&&e(3,s=f.nearbyAmenities),"greenspace"in f&&e(4,r=f.greenspace)},[h,u,i,s,r]}class UT extends te{constructor(t){super(),ee(this,t,YT,$T,Wt,{lts:2,nearbyAmenities:3,greenspace:4})}}function rp(n,t,e){const i=n.slice();return i[24]=t[e],i[29]=t,i[30]=e,i}function op(n,t,e){const i=n.slice();return i[24]=t[e],i[27]=t,i[28]=e,i}function ap(n,t,e){const i=n.slice();return i[24]=t[e],i[25]=t,i[26]=e,i}function XT(n){let t,e,i,s,r,o,a,l,c,h,u,f,d,g;function p(_){n[15](_)}function y(_){n[16](_)}function x(_){n[17](_)}let m={};n[3].tradeoff_lts!==void 0&&(m.lts=n[3].tradeoff_lts),n[3].tradeoff_amenities!==void 0&&(m.nearbyAmenities=n[3].tradeoff_amenities),n[3].tradeoff_greenspace!==void 0&&(m.greenspace=n[3].tradeoff_greenspace),t=new UT({props:m}),Yn.push(()=>xi(t,"lts",p)),Yn.push(()=>xi(t,"nearbyAmenities",y)),Yn.push(()=>xi(t,"greenspace",x)),t.$on("change",n[18]);let v=Pi(n[6]),b=[];for(let _=0;_e=!1)),!i&&w&8&&(i=!0,M.nearbyAmenities=_[3].tradeoff_amenities,wi(()=>i=!1)),!s&&w&8&&(s=!0,M.greenspace=_[3].tradeoff_greenspace,wi(()=>s=!1)),t.$set(M),w&73){v=Pi(_[6]);let S;for(S=0;Sconfig.json + file`,g=pt(),p=z("pre"),y=Bt('"cost": '),m=Bt(x),v=pt(),b=z("button"),b.textContent="See cost function JSON",_=pt(),M&&M.c(),S=_n(),r.__value="Distance",Ct(r,r.__value),o.__value="Generalized",Ct(o,o.__value),a.__value="ByLTS",Ct(a,a.__value),l.__value="OsmHighwayType",Ct(l,l.__value),n[1]===void 0&&gp(()=>n[7].call(s))},m(O,E){N(O,t,E),B(t,e),B(e,i),B(e,s),B(s,r),B(s,o),B(s,a),B(s,l),yo(s,n[1],!0),N(O,c,E),N(O,h,E),B(h,u),B(h,f),B(h,d),B(h,g),B(h,p),B(p,y),B(p,m),n[9](h),N(O,v,E),N(O,b,E),N(O,_,E),~w&&L[w].m(O,E),N(O,S,E),P=!0,C||(k=[kt(s,"change",n[7]),kt(u,"click",n[8]),kt(b,"click",n[10])],C=!0)},p(O,[E]){E&2&&yo(s,O[1]),(!P||E&1)&&x!==(x=JSON.stringify(O[0],null,2)+"")&&rr(m,x);let I=w;w=R(O),w===I?~w&&L[w].p(O,E):(M&&(vn(),J(L[I],1,1,()=>{L[I]=null}),xn()),~w?(M=L[w],M?M.p(O,E):(M=L[w]=A[w](O),M.c()),U(M,1),M.m(S.parentNode,S)):M=null)},i(O){P||(U(M),P=!0)},o(O){J(M),P=!1},d(O){O&&(W(t),W(c),W(h),W(v),W(b),W(_),W(S)),n[9](null),~w&&L[w].d(O),C=!1,wn(k)}}}function JT(n,t,e){let{cost:i}=t,s,r="Distance",o={tradeoff_lts:50,tradeoff_amenities:30,tradeoff_greenspace:20,lts1:0,lts2:.2,lts3:.6,lts4:1,minimum_amenities:1},a=["lts1","lts2","lts3","lts4"],l={lts1:1,lts2:1,lts3:1,lts4:1},c={};for(let k of["cycleway","footway","living_street","motorway","motorway_link","path","pedestrian","primary","primary_link","residential","secondary","secondary_link","service","steps","tertiary","tertiary_link","track","trunk","trunk_link","unclassified"])c[k]=1;function h(k){k=="OsmHighwayType"?e(0,i={OsmHighwayType:c}):k=="ByLTS"?e(0,i={ByLTS:l}):k=="Generalized"?e(0,i={Generalized:o}):e(0,i=k)}function u(){r=pp(this),e(1,r)}const f=()=>s.close();function d(k){Yn[k?"unshift":"push"](()=>{s=k,e(2,s)})}const g=()=>s.showModal();function p(k){c[k]=jn(this.value),e(5,c)}const y=()=>e(0,i);function x(k){l[k]=jn(this.value),e(4,l)}const m=()=>e(0,i);function v(k){n.$$.not_equal(o.tradeoff_lts,k)&&(o.tradeoff_lts=k,e(3,o))}function b(k){n.$$.not_equal(o.tradeoff_amenities,k)&&(o.tradeoff_amenities=k,e(3,o))}function _(k){n.$$.not_equal(o.tradeoff_greenspace,k)&&(o.tradeoff_greenspace=k,e(3,o))}const w=()=>e(0,i);function M(k){o[k]=jn(this.value),e(3,o)}const S=()=>e(0,i);function P(){o.minimum_amenities=jn(this.value),e(3,o)}const C=()=>e(0,i);return n.$$set=k=>{"cost"in k&&e(0,i=k.cost)},n.$$.update=()=>{n.$$.dirty&2&&h(r)},[i,r,s,o,l,c,a,u,f,d,g,p,y,x,m,v,b,_,w,M,S,P,C]}class UR extends te{constructor(t){super(),ee(this,t,JT,KT,Wt,{cost:0})}}function ZT(n){let t,e,i,s,r,o,a;return{c(){t=z("button"),t.textContent="Import current view",e=pt(),i=z("i"),i.textContent="or...",s=pt(),r=z("button"),r.textContent="Draw an area to import on the map",Rt(t,"type","button"),Rt(r,"type","button")},m(l,c){N(l,t,c),N(l,e,c),N(l,i,c),N(l,s,c),N(l,r,c),o||(a=[kt(t,"click",n[2]),kt(r,"click",n[3])],o=!0)},p:wt,i:wt,o:wt,d(l){l&&(W(t),W(e),W(i),W(s),W(r)),o=!1,wn(a)}}}function QT(n){let t,e;return t=new xS({props:{polygonTool:n[0]}}),{c(){Ge(t.$$.fragment)},m(i,s){qe(t,i,s),e=!0},p(i,s){const r={};s&1&&(r.polygonTool=i[0]),t.$set(r)},i(i){e||(U(t.$$.fragment,i),e=!0)},o(i){J(t.$$.fragment,i),e=!1},d(i){Ke(t,i)}}}function tR(n){let t,e,i,s,r,o,a,l,c;const h=[QT,ZT],u=[];function f(d,g){return d[0]?0:1}return t=f(n),e=u[t]=h[t](n),{c(){e.c(),i=pt(),s=z("label"),r=z("input"),o=Bt(`Save a copy of the osm.xml + after importing`),Rt(r,"type","checkbox")},m(d,g){u[t].m(d,g),N(d,i,g),N(d,s,g),B(s,r),r.checked=n[1],B(s,o),a=!0,l||(c=kt(r,"change",n[5]),l=!0)},p(d,[g]){let p=t;t=f(d),t===p?u[t].p(d,g):(vn(),J(u[p],1,1,()=>{u[p]=null}),xn(),e=u[t],e?e.p(d,g):(e=u[t]=h[t](d),e.c()),U(e,1),e.m(i.parentNode,i)),g&2&&(r.checked=d[1])},i(d){a||(U(e),a=!0)},o(d){J(e),a=!1},d(d){d&&(W(i),W(s)),u[t].d(d),l=!1,c()}}}function ls(n){return[n.lng,n.lat]}function eR(n,t,e){let{map:i}=t;const s=pc();let r=null,o=!1;async function a(f){try{s("loading","Loading from Overpass");let g=await(await fetch(nR(f))).text();o&&l_("osm.xml",g),s("gotXml",g)}catch(d){s("error",d.toString())}}function l(){let f=i.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[ls(f.getSouthWest()),ls(f.getNorthWest()),ls(f.getNorthEast()),ls(f.getSouthEast()),ls(f.getSouthWest())]],type:"Polygon"}}}async function c(){if(i){if(i.getZoom()<13){s("error","Zoom in more to import");return}await a(l())}}function h(){i&&(e(0,r=new mS(i)),r.startNew(),r.addEventListenerSuccess(async f=>{e(0,r=null),await a(f)}),r.addEventListenerFailure(()=>{e(0,r=null)}))}function u(){o=this.checked,e(1,o)}return n.$$set=f=>{"map"in f&&e(4,i=f.map)},[r,o,c,h,i,u]}class XR extends te{constructor(t){super(),ee(this,t,eR,tR,Wt,{map:4})}}function nR(n){let t='poly:"';for(let[i,s]of n.geometry.coordinates[0])t+=`${s} ${i} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}export{uR as C,rR as G,hR as J,aR as L,XR as O,cR as P,rM as _,UR as a}; diff --git a/assets/main-4709fa84.js b/assets/main-e959e939.js similarity index 98% rename from assets/main-4709fa84.js rename to assets/main-e959e939.js index 3286b30..56c078c 100644 --- a/assets/main-4709fa84.js +++ b/assets/main-e959e939.js @@ -1,4 +1,4 @@ -import{S as le,i as ae,s as G,m as re,P as se,L as ue,c as O,a as D,t as g,b,d as B,o as pe,H as fe,e as d,f as H,g as z,h as F,j as w,k as me,l as C,n as m,p as K,q as X,r as P,u as R,v as S,w as ce,M as _e,x as U,y as J,z as Z,A as T,_ as de,B as W,F as ge,C as be,D as ie,E as he}from"./Layout-4cd70fb2.js";import{S as ve,L as Ae}from"./SidebarControls-547244ee.js";const we="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAm0lEQVRIS+2U0Q2AIAxEYQM30Q3UDXQy3UhHkE0cweuHHxKTXpuQaALJ/cE9eoXGUHjFwv6hAtSEPxFRh2su0Ayd6pWzDUwFO8700AGNVggDaGAqkNYDYQBStBvCAtwQC8AF8QA2kORlJWjQmm4BSB9M5lIyC3CZswC3OQu4PxqVef7TmYikoSs0aQ19GyMMwDp+HvsrQI3v/xFduXoiGbi1DtQAAAAASUVORK5CYII=";let q="pmtilesSource";async function ke(l){let e=await l.getHeader(),o=await l.getMetadata();return{bounds:[e.minLon,e.minLat,e.maxLon,e.maxLat],outputMetadata:JSON.parse(o.description),minZoom:e.minZoom,maxZoom:e.maxZoom}}function ye(l,e,o){let{pmtiles:t}=e,{map:n}=e,{outputMetadata:a=null}=e,i=new se;re.addProtocol("pmtiles",i.tile);async function p(s){r(q),i.add(s);let f=await ke(s);n.addSource(q,{type:"vector",tiles:["pmtiles://"+s.source.getKey()+"/{z}/{x}/{y}"],minzoom:f.minZoom,maxzoom:f.maxZoom,bounds:f.bounds}),n.fitBounds(f.bounds,{padding:100,duration:500}),o(0,a=f.outputMetadata)}function r(s){if(n.getSource(s)){let f=[];for(let u of n.getStyle().layers)"source"in u&&u.source==s&&f.push(u.id);for(let u of f)n.removeLayer(u);n.removeSource(s)}}return l.$$set=s=>{"pmtiles"in s&&o(1,t=s.pmtiles),"map"in s&&o(2,n=s.map),"outputMetadata"in s&&o(0,a=s.outputMetadata)},l.$$.update=()=>{l.$$.dirty&2&&(t?p(t):r(q))},[a,t,n]}class $e extends le{constructor(e){super(),ae(this,e,ye,null,G,{pmtiles:1,map:2,outputMetadata:0})}}function x(l){let e,o,t;return{c(){e=z("Open a "),o=d("i"),o.textContent=".pmtiles",t=z(` +import{S as le,i as ae,s as G,m as re,P as se,L as ue,c as O,a as D,t as g,b,d as B,o as pe,H as fe,e as d,f as H,g as z,h as F,j as w,k as me,l as C,n as m,p as K,q as X,r as P,u as R,v as S,w as ce,M as _e,x as U,y as J,z as Z,A as T,_ as de,B as W,F as ge,C as be,D as ie,E as he}from"./Layout-6a808470.js";import{S as ve,L as Ae}from"./SidebarControls-b43115a7.js";const we="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAm0lEQVRIS+2U0Q2AIAxEYQM30Q3UDXQy3UhHkE0cweuHHxKTXpuQaALJ/cE9eoXGUHjFwv6hAtSEPxFRh2su0Ayd6pWzDUwFO8700AGNVggDaGAqkNYDYQBStBvCAtwQC8AF8QA2kORlJWjQmm4BSB9M5lIyC3CZswC3OQu4PxqVef7TmYikoSs0aQ19GyMMwDp+HvsrQI3v/xFduXoiGbi1DtQAAAAASUVORK5CYII=";let q="pmtilesSource";async function ke(l){let e=await l.getHeader(),o=await l.getMetadata();return{bounds:[e.minLon,e.minLat,e.maxLon,e.maxLat],outputMetadata:JSON.parse(o.description),minZoom:e.minZoom,maxZoom:e.maxZoom}}function ye(l,e,o){let{pmtiles:t}=e,{map:n}=e,{outputMetadata:a=null}=e,i=new se;re.addProtocol("pmtiles",i.tile);async function p(s){r(q),i.add(s);let f=await ke(s);n.addSource(q,{type:"vector",tiles:["pmtiles://"+s.source.getKey()+"/{z}/{x}/{y}"],minzoom:f.minZoom,maxzoom:f.maxZoom,bounds:f.bounds}),n.fitBounds(f.bounds,{padding:100,duration:500}),o(0,a=f.outputMetadata)}function r(s){if(n.getSource(s)){let f=[];for(let u of n.getStyle().layers)"source"in u&&u.source==s&&f.push(u.id);for(let u of f)n.removeLayer(u);n.removeSource(s)}}return l.$$set=s=>{"pmtiles"in s&&o(1,t=s.pmtiles),"map"in s&&o(2,n=s.map),"outputMetadata"in s&&o(0,a=s.outputMetadata)},l.$$.update=()=>{l.$$.dirty&2&&(t?p(t):r(q))},[a,t,n]}class $e extends le{constructor(e){super(),ae(this,e,ye,null,G,{pmtiles:1,map:2,outputMetadata:0})}}function x(l){let e,o,t;return{c(){e=z("Open a "),o=d("i"),o.textContent=".pmtiles",t=z(` file produced by the tool. Note this file stays in your browser; it doesn't get uploaded anywhere.`)},m(n,a){C(n,e,a),C(n,o,a),C(n,t,a)},d(n){n&&(S(e),S(o),S(t))}}}function ee(l){let e,o,t;function n(i){l[12](i)}let a={outputMetadata:l[3],map:l[1]};return l[4]!==void 0&&(a.controls=l[4]),e=new ve({props:a}),U.push(()=>J(e,"controls",n)),{c(){O(e.$$.fragment)},m(i,p){D(e,i,p),t=!0},p(i,p){const r={};p&8&&(r.outputMetadata=i[3]),p&2&&(r.map=i[1]),!o&&p&16&&(o=!0,r.controls=i[4],T(()=>o=!1)),e.$set(r)},i(i){t||(g(e.$$.fragment,i),t=!0)},o(i){b(e.$$.fragment,i),t=!1},d(i){B(e,i)}}}function Me(l){let e,o,t,n,a,i,p,r,s,f,u,k,y,$,M,c,A,L,Q,E,V,N,Y,j;o=new fe({props:{app:"main"}});let h=l[2]==null&&x(),_=l[3]&&ee(l);return{c(){e=d("div"),O(o.$$.fragment),t=H(),n=d("label"),h&&h.c(),a=H(),i=d("input"),p=H(),r=d("div"),s=d("label"),f=z(`Or load an example: `),u=d("select"),k=d("option"),k.textContent="Custom file loaded",y=d("option"),y.textContent="Edinburgh",$=d("option"),$.textContent=`England (2011 home-to-work) diff --git a/assets/x2-96aea9a1.js b/assets/x2-96aea9a1.js deleted file mode 100644 index 86a5da7..0000000 --- a/assets/x2-96aea9a1.js +++ /dev/null @@ -1,9 +0,0 @@ -import{S as ie,i as re,s as fe,G as ge,e as q,h as N,z as U,l as D,I as $,q as J,J as V,K as pe,N as _e,O as be,Q as he,t as w,b as k,v as R,w as we,R as Le,T as ye,U as Y,V as ee,m as ke,L as Ce,c as P,f as I,a as z,d as O,o as ve,H as Me,x as X,y as K,g as x,n as B,A as W,r as te,u as ne,M as Be,_ as Se,W as ue,j as se,D as Ee,E as Pe,X as ze}from"./Layout-4cd70fb2.js";import{L as Oe,C as Ie,O as qe,_ as De,J as Re,a as Te,G as Je,P as Ne}from"./CostFunction-e35500c2.js";import{S as je,L as Ae}from"./SidebarControls-547244ee.js";const Fe=s=>({marker:s&8}),ae=s=>({marker:s[3]});function Xe(s){let e,t,o,n,i,f,c;const l=s[19].default,r=ge(l,s,s[18],ae);return{c(){e=q("div"),r&&r.c(),N(e,"tabindex",t=s[1]?0:void 0),N(e,"role",o=s[1]?"button":void 0),U(e,"z-index",s[2])},m(a,d){D(a,e,d),r&&r.m(e,null),i=!0,f||(c=[$(s[7].call(null,e)),$(n=Ze.call(null,e,s[0])),J(e,"click",V(s[20])),J(e,"dblclick",V(s[21])),J(e,"contextmenu",V(s[22])),J(e,"mouseenter",s[23]),J(e,"mouseleave",s[24]),J(e,"mousemove",s[25]),J(e,"keydown",s[8])],f=!0)},p(a,[d]){r&&r.p&&(!i||d&262152)&&pe(r,l,a,a[18],i?be(l,a[18],d,Fe):_e(a[18]),ae),(!i||d&2&&t!==(t=a[1]?0:void 0))&&N(e,"tabindex",t),(!i||d&2&&o!==(o=a[1]?"button":void 0))&&N(e,"role",o),n&&he(n.update)&&d&1&&n.update.call(null,a[0]),d&4&&U(e,"z-index",a[2])},i(a){i||(w(r,a),i=!0)},o(a){k(r,a),i=!1},d(a){a&&R(e),r&&r.d(a),f=!1,we(c)}}}function Ze(s,e){const t=s.className;function o(n){n?s.className=`${t} ${n}`:s.className=t}return o(e),{update:o}}function Ge(s,e,t){let o,n,i,{$$slots:f={},$$scope:c}=e,{marker:l=void 0}=e,{lngLat:r}=e,{class:a=void 0}=e,{interactive:d=!0}=e,{asButton:y=!1}=e,{draggable:_=!1}=e,{feature:v=null}=e,{offset:g=void 0}=e,{zIndex:L=void 0}=e,{rotation:S=0}=e,{opacity:T=1}=e;const Z=Le(),{map:j,layerEvent:b,self:h}=ye();Y(s,j,u=>t(27,i=u)),Y(s,b,u=>t(26,o=u)),Y(s,h,u=>t(3,n=u));function p(u){ee(h,n=new ke.Marker({element:u,rotation:S,draggable:_,offset:g,opacity:T.toString()}).setLngLat(r).addTo(i),n),t(11,l=n);const F=()=>C("dragstart"),G=()=>{E(),C("drag")},H=()=>{E(),C("dragend")};return _&&(n.on("dragstart",F),n.on("drag",G),n.on("dragend",H)),{destroy(){_&&(n==null||n.off("dragstart",F),n==null||n.off("drag",G),n==null||n.off("dragend",H)),t(11,l=void 0),n==null||n.remove()}}}function E(){let u=n==null?void 0:n.getLngLat();u&&(Array.isArray(r)?t(10,r=[u.lng,u.lat]):r&&"lon"in r?t(10,r={lon:u.lng,lat:u.lat}):t(10,r=u))}function A(u){u.key===" "&&(u.preventDefault(),u.stopPropagation(),C("click"))}function C(u){if(!d)return;let F=n==null?void 0:n.getLngLat();if(!F)return;const G=[F.lng,F.lat];let H={map:i,marker:n,lngLat:G,features:[{type:"Feature",properties:(v==null?void 0:v.properties)??{},geometry:{type:"Point",coordinates:G}}]};ee(b,o={...H,layerType:"marker",type:u},o),Z(u,H)}const Q=()=>C("click"),m=()=>C("dblclick"),M=()=>C("contextmenu"),ce=u=>{C("mouseenter")},de=()=>{C("mouseleave")},me=()=>C("mousemove");return s.$$set=u=>{"marker"in u&&t(11,l=u.marker),"lngLat"in u&&t(10,r=u.lngLat),"class"in u&&t(0,a=u.class),"interactive"in u&&t(12,d=u.interactive),"asButton"in u&&t(1,y=u.asButton),"draggable"in u&&t(13,_=u.draggable),"feature"in u&&t(14,v=u.feature),"offset"in u&&t(15,g=u.offset),"zIndex"in u&&t(2,L=u.zIndex),"rotation"in u&&t(16,S=u.rotation),"opacity"in u&&t(17,T=u.opacity),"$$scope"in u&&t(18,c=u.$$scope)},s.$$.update=()=>{s.$$.dirty&1032&&(n==null||n.setLngLat(r)),s.$$.dirty&32776&&(n==null||n.setOffset(g??[0,0])),s.$$.dirty&65544&&(n==null||n.setRotation(S)),s.$$.dirty&131080&&(n==null||n.setOpacity(T.toString()))},[a,y,L,n,j,b,h,p,A,C,r,l,d,_,v,g,S,T,c,f,Q,m,M,ce,de,me]}class He extends ie{constructor(e){super(),re(this,e,Ge,Xe,fe,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const Ue=` - - - - -`;function oe(s){let e,t,o,n,i,f,c,l,r,a,d,y;function _(g){s[20](g)}let v={};return s[2]!==void 0&&(v.cost=s[2]),l=new Te({props:v}),X.push(()=>K(l,"cost",_)),{c(){e=q("div"),t=q("label"),o=x(`Max requests (limit for faster updates): - `),n=q("br"),i=I(),f=q("input"),c=I(),P(l.$$.fragment),N(f,"type","number"),N(f,"min",1)},m(g,L){D(g,e,L),B(e,t),B(t,o),B(t,n),B(t,i),B(t,f),se(f,s[1]),D(g,c,L),z(l,g,L),a=!0,d||(y=J(f,"input",s[19]),d=!0)},p(g,L){L&2&&ue(f.value)!==g[1]&&se(f,g[1]);const S={};!r&&L&4&&(r=!0,S.cost=g[2],W(()=>r=!1)),l.$set(S)},i(g){a||(w(l.$$.fragment,g),a=!0)},o(g){k(l.$$.fragment,g),a=!1},d(g){g&&(R(e),R(c)),O(l,g),d=!1,y()}}}function le(s){let e,t,o,n,i;function f(l){s[21](l)}let c={outputMetadata:s[6].metadata,map:s[3]};return s[8]!==void 0&&(c.controls=s[8]),o=new je({props:c}),X.push(()=>K(o,"controls",f)),{c(){e=q("hr"),t=I(),P(o.$$.fragment)},m(l,r){D(l,e,r),D(l,t,r),z(o,l,r),i=!0},p(l,r){const a={};r&64&&(a.outputMetadata=l[6].metadata),r&8&&(a.map=l[3]),!n&&r&256&&(n=!0,a.controls=l[8],W(()=>n=!1)),o.$set(a)},i(l){i||(w(o.$$.fragment,l),i=!0)},o(l){k(o.$$.fragment,l),i=!1},d(l){l&&(R(e),R(t)),O(o,l)}}}function Ke(s){let e,t,o,n,i,f,c,l,r,a,d,y,_,v,g,L,S,T;t=new Me({props:{app:"interactive"}});function Z(p){s[16](p)}let j={};s[0]!==void 0&&(j.example=s[0]),a=new Ie({props:j}),X.push(()=>K(a,"example",Z)),_=new qe({props:{map:s[3]}}),_.$on("gotXml",s[12]),_.$on("loading",s[17]),_.$on("error",s[18]);let b=s[4]&&oe(s),h=s[6].metadata&&le(s);return{c(){e=q("div"),P(t.$$.fragment),o=I(),n=q("label"),i=x("Open an "),f=q("i"),f.textContent=".osm.pbf",c=x(` - file - `),l=q("input"),r=I(),P(a.$$.fragment),y=I(),P(_.$$.fragment),v=I(),b&&b.c(),g=I(),h&&h.c(),N(l,"type","file"),N(e,"slot","left")},m(p,E){D(p,e,E),z(t,e,null),B(e,o),B(e,n),B(n,i),B(n,f),B(n,c),B(n,l),s[15](l),B(e,r),z(a,e,null),B(e,y),z(_,e,null),B(e,v),b&&b.m(e,null),B(e,g),h&&h.m(e,null),L=!0,S||(T=J(l,"change",s[10]),S=!0)},p(p,E){const A={};!d&&E&1&&(d=!0,A.example=p[0],W(()=>d=!1)),a.$set(A);const C={};E&8&&(C.map=p[3]),_.$set(C),p[4]?b?(b.p(p,E),E&16&&w(b,1)):(b=oe(p),b.c(),w(b,1),b.m(e,g)):b&&(te(),k(b,1,1,()=>{b=null}),ne()),p[6].metadata?h?(h.p(p,E),E&64&&w(h,1)):(h=le(p),h.c(),w(h,1),h.m(e,null)):h&&(te(),k(h,1,1,()=>{h=null}),ne())},i(p){L||(w(t.$$.fragment,p),w(a.$$.fragment,p),w(_.$$.fragment,p),w(b),w(h),L=!0)},o(p){k(t.$$.fragment,p),k(a.$$.fragment,p),k(_.$$.fragment,p),k(b),k(h),L=!1},d(p){p&&R(e),O(t),s[15](null),O(a),O(_),b&&b.d(),h&&h.d(),S=!1,T()}}}function We(s){let e,t;return{c(){e=new ze(!1),t=Ee(),e.a=t},m(o,n){e.m(Ue,o,n),D(o,t,n)},p:Pe,d(o){o&&(R(t),e.d())}}}function Qe(s){let e,t;return e=new Ae({props:{controls:s[8]}}),{c(){P(e.$$.fragment)},m(o,n){z(e,o,n),t=!0},p(o,n){const i={};n&256&&(i.controls=o[8]),e.$set(i)},i(o){t||(w(e.$$.fragment,o),t=!0)},o(o){k(e.$$.fragment,o),t=!1},d(o){O(e,o)}}}function Ve(s){let e,t,o,n,i,f,c;function l(a){s[13](a)}let r={draggable:!0,$$slots:{default:[We]},$$scope:{ctx:s}};return s[5]!==void 0&&(r.lngLat=s[5]),e=new He({props:r}),X.push(()=>K(e,"lngLat",l)),e.$on("dragend",s[11]),n=new Je({props:{data:s[6],$$slots:{default:[Qe]},$$scope:{ctx:s}}}),f=new Ne({}),{c(){P(e.$$.fragment),o=I(),P(n.$$.fragment),i=I(),P(f.$$.fragment)},m(a,d){z(e,a,d),D(a,o,d),z(n,a,d),D(a,i,d),z(f,a,d),c=!0},p(a,d){const y={};d&33554432&&(y.$$scope={dirty:d,ctx:a}),!t&&d&32&&(t=!0,y.lngLat=a[5],W(()=>t=!1)),e.$set(y);const _={};d&64&&(_.data=a[6]),d&33554688&&(_.$$scope={dirty:d,ctx:a}),n.$set(_)},i(a){c||(w(e.$$.fragment,a),w(n.$$.fragment,a),w(f.$$.fragment,a),c=!0)},o(a){k(e.$$.fragment,a),k(n.$$.fragment,a),k(f.$$.fragment,a),c=!1},d(a){a&&(R(o),R(i)),O(e,a),O(n,a),O(f,a)}}}function Ye(s){let e,t,o,n;function i(c){s[14](c)}let f={style:"https://api.maptiler.com/maps/dataviz/style.json?key=MZEJTanw3WpxRvt7qDfo",standardControls:!0,hash:!0,$$slots:{default:[Ve]},$$scope:{ctx:s}};return s[3]!==void 0&&(f.map=s[3]),t=new Be({props:f}),X.push(()=>K(t,"map",i)),{c(){e=q("div"),P(t.$$.fragment),N(e,"slot","main"),U(e,"position","relative"),U(e,"width","100%"),U(e,"height","100vh")},m(c,l){D(c,e,l),z(t,e,null),n=!0},p(c,l){const r={};l&33554784&&(r.$$scope={dirty:l,ctx:c}),!o&&l&8&&(o=!0,r.map=c[3],W(()=>o=!1)),t.$set(r)},i(c){n||(w(t.$$.fragment,c),n=!0)},o(c){k(t.$$.fragment,c),n=!1},d(c){c&&R(e),O(t)}}}function xe(s){let e,t,o,n;return e=new Ce({props:{$$slots:{main:[Ye],left:[Ke]},$$scope:{ctx:s}}}),o=new Oe({props:{loading:s[7]}}),{c(){P(e.$$.fragment),t=I(),P(o.$$.fragment)},m(i,f){z(e,i,f),D(i,t,f),z(o,i,f),n=!0},p(i,[f]){const c={};f&33555455&&(c.$$scope={dirty:f,ctx:i}),e.$set(c);const l={};f&128&&(l.loading=i[7]),o.$set(l)},i(i){n||(w(e.$$.fragment,i),w(o.$$.fragment,i),n=!0)},o(i){k(e.$$.fragment,i),k(o.$$.fragment,i),n=!1},d(i){i&&R(t),O(e,i),O(o,i)}}}function $e(s,e,t){ve(async()=>{await De(),await Se()});let o,n,i="",f={lng:0,lat:0},c={type:"FeatureCollection",features:[]},l="",r=1e3,a="Distance",d={maxCount:1e3,originRadius:3,destinationRadius:3,streetviewOn:!1},y;async function _(m){t(0,i=""),t(7,l="Loading file"),v(await y.files[0].arrayBuffer())}function v(m){try{t(4,n=new Re(new Uint8Array(m))),t(2,a="Distance");let M=n.getBounds();o.fitBounds([[M[0],M[1]],[M[2],M[3]]],{padding:20,animate:!1}),t(5,f.lng=(M[0]+M[2])/2,f),t(5,f.lat=(M[1]+M[3])/2,f),L()}catch(M){window.alert(`Problem importing osm.pbf file: ${M}`)}t(7,l="")}async function g(m){if(m!=""){t(7,l=`Loading ${m}`);let M=await fetch(`https://assets.od2net.org/pbf_clips/${m}.osm.pbf`);v(await M.arrayBuffer())}}function L(){n&&t(6,c=JSON.parse(n.recalculate({lng:f.lng,lat:f.lat,max_requests:r,cost:a})))}function S(m,M){L()}function T(m){t(7,l="Parsing XML"),v(new TextEncoder().encode(m.detail)),t(7,l="")}function Z(m){f=m,t(5,f)}function j(m){o=m,t(3,o)}function b(m){X[m?"unshift":"push"](()=>{y=m,t(9,y)})}function h(m){i=m,t(0,i)}const p=m=>t(7,l=m.detail),E=m=>t(7,l=m.detail);function A(){r=ue(this.value),t(1,r)}function C(m){a=m,t(2,a)}function Q(m){d=m,t(8,d)}return s.$$.update=()=>{s.$$.dirty&1&&g(i),s.$$.dirty&6&&S()},[i,r,a,o,n,f,c,l,d,y,_,L,T,Z,j,b,h,p,E,A,C,Q]}class et extends ie{constructor(e){super(),re(this,e,$e,xe,fe,{})}}new et({target:document.getElementById("app")}); diff --git a/assets/x2-c87eb6b7.js b/assets/x2-c87eb6b7.js new file mode 100644 index 0000000..b420f3f --- /dev/null +++ b/assets/x2-c87eb6b7.js @@ -0,0 +1,9 @@ +import{S as ie,i as re,s as fe,G as pe,e as q,h as j,z as K,l as D,I as $,q as J,J as V,K as _e,N as be,O as he,Q as we,R as Le,t as w,b as k,v as R,w as ye,T as ke,U as Ce,V as Y,W as ee,m as ve,L as Me,c as P,f as I,a as z,d as O,o as Be,H as Se,x as G,y as W,g as x,n as M,A as Q,r as te,u as ne,M as Ee,_ as Pe,X as ue,j as ae,D as ze,E as Oe,Y as Ie}from"./Layout-6a808470.js";import{L as qe,C as De,O as Re,_ as Te,J as Je,a as je,G as Ae,P as Fe}from"./index-34f7e0df.js";import{S as Ne,L as Xe}from"./SidebarControls-b43115a7.js";const Ze=a=>({marker:a&8}),se=a=>({marker:a[3]});function Ge(a){let e,t,o,n,i,f,c;const l=a[19].default,r=pe(l,a,a[18],se);return{c(){e=q("div"),r&&r.c(),j(e,"tabindex",t=a[1]?0:void 0),j(e,"role",o=a[1]?"button":void 0),K(e,"z-index",a[2])},m(s,d){D(s,e,d),r&&r.m(e,null),i=!0,f||(c=[$(a[7].call(null,e)),$(n=He.call(null,e,a[0])),J(e,"click",V(a[20])),J(e,"dblclick",V(a[21])),J(e,"contextmenu",V(_e(a[22]))),J(e,"mouseenter",a[23]),J(e,"mouseleave",a[24]),J(e,"mousemove",a[25]),J(e,"keydown",a[8])],f=!0)},p(s,[d]){r&&r.p&&(!i||d&262152)&&be(r,l,s,s[18],i?we(l,s[18],d,Ze):he(s[18]),se),(!i||d&2&&t!==(t=s[1]?0:void 0))&&j(e,"tabindex",t),(!i||d&2&&o!==(o=s[1]?"button":void 0))&&j(e,"role",o),n&&Le(n.update)&&d&1&&n.update.call(null,s[0]),d&4&&K(e,"z-index",s[2])},i(s){i||(w(r,s),i=!0)},o(s){k(r,s),i=!1},d(s){s&&R(e),r&&r.d(s),f=!1,ye(c)}}}function He(a,e){const t=a.className;function o(n){n?a.className=`${t} ${n}`:a.className=t}return o(e),{update:o}}function Ue(a,e,t){let o,n,i,{$$slots:f={},$$scope:c}=e,{marker:l=void 0}=e,{lngLat:r}=e,{class:s=void 0}=e,{interactive:d=!0}=e,{asButton:y=!1}=e,{draggable:_=!1}=e,{feature:C=null}=e,{offset:m=void 0}=e,{zIndex:L=void 0}=e,{rotation:B=0}=e,{opacity:T=1}=e;const H=ke(),{map:A,layerEvent:b,self:h,markerClickManager:p}=Ce();Y(a,A,u=>t(27,i=u)),Y(a,b,u=>t(26,o=u)),Y(a,h,u=>t(3,n=u));function E(u){ee(h,n=new ve.Marker({element:u,rotation:B,draggable:_,offset:m,opacity:T.toString()}).setLngLat(r).addTo(i),n),t(11,l=n);const X=()=>S("dragstart"),U=()=>{F(),S("drag")},Z=()=>{F(),S("dragend")};return _&&(n.on("dragstart",X),n.on("drag",U),n.on("dragend",Z)),{destroy(){_&&(n==null||n.off("dragstart",X),n==null||n.off("drag",U),n==null||n.off("dragend",Z)),t(11,l=void 0),n==null||n.remove()}}}function F(){let u=n==null?void 0:n.getLngLat();u&&(Array.isArray(r)?t(10,r=[u.lng,u.lat]):r&&"lon"in r?t(10,r={lon:u.lng,lat:u.lat}):t(10,r=u))}function N(u){u.key===" "&&(u.preventDefault(),u.stopPropagation(),S("click"))}function S(u){if(!d)return;let X=n==null?void 0:n.getLngLat();if(!X)return;const U=[X.lng,X.lat];let Z={map:i,marker:n,lngLat:U,features:[{type:"Feature",properties:(C==null?void 0:C.properties)??{},geometry:{type:"Point",coordinates:U}}]};(u==="click"||u==="contextmenu")&&p.handleClick(Z),ee(b,o={...Z,layerType:"marker",type:u},o),H(u,Z)}const g=()=>S("click"),v=()=>S("dblclick"),ce=()=>{S("contextmenu")},de=()=>{S("mouseenter")},ge=()=>{S("mouseleave")},me=()=>S("mousemove");return a.$$set=u=>{"marker"in u&&t(11,l=u.marker),"lngLat"in u&&t(10,r=u.lngLat),"class"in u&&t(0,s=u.class),"interactive"in u&&t(12,d=u.interactive),"asButton"in u&&t(1,y=u.asButton),"draggable"in u&&t(13,_=u.draggable),"feature"in u&&t(14,C=u.feature),"offset"in u&&t(15,m=u.offset),"zIndex"in u&&t(2,L=u.zIndex),"rotation"in u&&t(16,B=u.rotation),"opacity"in u&&t(17,T=u.opacity),"$$scope"in u&&t(18,c=u.$$scope)},a.$$.update=()=>{a.$$.dirty&1032&&(n==null||n.setLngLat(r)),a.$$.dirty&32776&&(n==null||n.setOffset(m??[0,0])),a.$$.dirty&65544&&(n==null||n.setRotation(B)),a.$$.dirty&131080&&(n==null||n.setOpacity(T.toString()))},[s,y,L,n,A,b,h,E,N,S,r,l,d,_,C,m,B,T,c,f,g,v,ce,de,ge,me]}class Ke extends ie{constructor(e){super(),re(this,e,Ue,Ge,fe,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const We=` + + + + +`;function oe(a){let e,t,o,n,i,f,c,l,r,s,d,y;function _(m){a[20](m)}let C={};return a[2]!==void 0&&(C.cost=a[2]),l=new je({props:C}),G.push(()=>W(l,"cost",_)),{c(){e=q("div"),t=q("label"),o=x(`Max requests (limit for faster updates): + `),n=q("br"),i=I(),f=q("input"),c=I(),P(l.$$.fragment),j(f,"type","number"),j(f,"min",1)},m(m,L){D(m,e,L),M(e,t),M(t,o),M(t,n),M(t,i),M(t,f),ae(f,a[1]),D(m,c,L),z(l,m,L),s=!0,d||(y=J(f,"input",a[19]),d=!0)},p(m,L){L&2&&ue(f.value)!==m[1]&&ae(f,m[1]);const B={};!r&&L&4&&(r=!0,B.cost=m[2],Q(()=>r=!1)),l.$set(B)},i(m){s||(w(l.$$.fragment,m),s=!0)},o(m){k(l.$$.fragment,m),s=!1},d(m){m&&(R(e),R(c)),O(l,m),d=!1,y()}}}function le(a){let e,t,o,n,i;function f(l){a[21](l)}let c={outputMetadata:a[6].metadata,map:a[3]};return a[8]!==void 0&&(c.controls=a[8]),o=new Ne({props:c}),G.push(()=>W(o,"controls",f)),{c(){e=q("hr"),t=I(),P(o.$$.fragment)},m(l,r){D(l,e,r),D(l,t,r),z(o,l,r),i=!0},p(l,r){const s={};r&64&&(s.outputMetadata=l[6].metadata),r&8&&(s.map=l[3]),!n&&r&256&&(n=!0,s.controls=l[8],Q(()=>n=!1)),o.$set(s)},i(l){i||(w(o.$$.fragment,l),i=!0)},o(l){k(o.$$.fragment,l),i=!1},d(l){l&&(R(e),R(t)),O(o,l)}}}function Qe(a){let e,t,o,n,i,f,c,l,r,s,d,y,_,C,m,L,B,T;t=new Se({props:{app:"interactive"}});function H(p){a[16](p)}let A={};a[0]!==void 0&&(A.example=a[0]),s=new De({props:A}),G.push(()=>W(s,"example",H)),_=new Re({props:{map:a[3]}}),_.$on("gotXml",a[12]),_.$on("loading",a[17]),_.$on("error",a[18]);let b=a[4]&&oe(a),h=a[6].metadata&&le(a);return{c(){e=q("div"),P(t.$$.fragment),o=I(),n=q("label"),i=x("Open an "),f=q("i"),f.textContent=".osm.pbf",c=x(` + file + `),l=q("input"),r=I(),P(s.$$.fragment),y=I(),P(_.$$.fragment),C=I(),b&&b.c(),m=I(),h&&h.c(),j(l,"type","file"),j(e,"slot","left")},m(p,E){D(p,e,E),z(t,e,null),M(e,o),M(e,n),M(n,i),M(n,f),M(n,c),M(n,l),a[15](l),M(e,r),z(s,e,null),M(e,y),z(_,e,null),M(e,C),b&&b.m(e,null),M(e,m),h&&h.m(e,null),L=!0,B||(T=J(l,"change",a[10]),B=!0)},p(p,E){const F={};!d&&E&1&&(d=!0,F.example=p[0],Q(()=>d=!1)),s.$set(F);const N={};E&8&&(N.map=p[3]),_.$set(N),p[4]?b?(b.p(p,E),E&16&&w(b,1)):(b=oe(p),b.c(),w(b,1),b.m(e,m)):b&&(te(),k(b,1,1,()=>{b=null}),ne()),p[6].metadata?h?(h.p(p,E),E&64&&w(h,1)):(h=le(p),h.c(),w(h,1),h.m(e,null)):h&&(te(),k(h,1,1,()=>{h=null}),ne())},i(p){L||(w(t.$$.fragment,p),w(s.$$.fragment,p),w(_.$$.fragment,p),w(b),w(h),L=!0)},o(p){k(t.$$.fragment,p),k(s.$$.fragment,p),k(_.$$.fragment,p),k(b),k(h),L=!1},d(p){p&&R(e),O(t),a[15](null),O(s),O(_),b&&b.d(),h&&h.d(),B=!1,T()}}}function Ve(a){let e,t;return{c(){e=new Ie(!1),t=ze(),e.a=t},m(o,n){e.m(We,o,n),D(o,t,n)},p:Oe,d(o){o&&(R(t),e.d())}}}function Ye(a){let e,t;return e=new Xe({props:{controls:a[8]}}),{c(){P(e.$$.fragment)},m(o,n){z(e,o,n),t=!0},p(o,n){const i={};n&256&&(i.controls=o[8]),e.$set(i)},i(o){t||(w(e.$$.fragment,o),t=!0)},o(o){k(e.$$.fragment,o),t=!1},d(o){O(e,o)}}}function xe(a){let e,t,o,n,i,f,c;function l(s){a[13](s)}let r={draggable:!0,$$slots:{default:[Ve]},$$scope:{ctx:a}};return a[5]!==void 0&&(r.lngLat=a[5]),e=new Ke({props:r}),G.push(()=>W(e,"lngLat",l)),e.$on("dragend",a[11]),n=new Ae({props:{data:a[6],$$slots:{default:[Ye]},$$scope:{ctx:a}}}),f=new Fe({}),{c(){P(e.$$.fragment),o=I(),P(n.$$.fragment),i=I(),P(f.$$.fragment)},m(s,d){z(e,s,d),D(s,o,d),z(n,s,d),D(s,i,d),z(f,s,d),c=!0},p(s,d){const y={};d&33554432&&(y.$$scope={dirty:d,ctx:s}),!t&&d&32&&(t=!0,y.lngLat=s[5],Q(()=>t=!1)),e.$set(y);const _={};d&64&&(_.data=s[6]),d&33554688&&(_.$$scope={dirty:d,ctx:s}),n.$set(_)},i(s){c||(w(e.$$.fragment,s),w(n.$$.fragment,s),w(f.$$.fragment,s),c=!0)},o(s){k(e.$$.fragment,s),k(n.$$.fragment,s),k(f.$$.fragment,s),c=!1},d(s){s&&(R(o),R(i)),O(e,s),O(n,s),O(f,s)}}}function $e(a){let e,t,o,n;function i(c){a[14](c)}let f={style:"https://api.maptiler.com/maps/dataviz/style.json?key=MZEJTanw3WpxRvt7qDfo",standardControls:!0,hash:!0,$$slots:{default:[xe]},$$scope:{ctx:a}};return a[3]!==void 0&&(f.map=a[3]),t=new Ee({props:f}),G.push(()=>W(t,"map",i)),{c(){e=q("div"),P(t.$$.fragment),j(e,"slot","main"),K(e,"position","relative"),K(e,"width","100%"),K(e,"height","100vh")},m(c,l){D(c,e,l),z(t,e,null),n=!0},p(c,l){const r={};l&33554784&&(r.$$scope={dirty:l,ctx:c}),!o&&l&8&&(o=!0,r.map=c[3],Q(()=>o=!1)),t.$set(r)},i(c){n||(w(t.$$.fragment,c),n=!0)},o(c){k(t.$$.fragment,c),n=!1},d(c){c&&R(e),O(t)}}}function et(a){let e,t,o,n;return e=new Me({props:{$$slots:{main:[$e],left:[Qe]},$$scope:{ctx:a}}}),o=new qe({props:{loading:a[7]}}),{c(){P(e.$$.fragment),t=I(),P(o.$$.fragment)},m(i,f){z(e,i,f),D(i,t,f),z(o,i,f),n=!0},p(i,[f]){const c={};f&33555455&&(c.$$scope={dirty:f,ctx:i}),e.$set(c);const l={};f&128&&(l.loading=i[7]),o.$set(l)},i(i){n||(w(e.$$.fragment,i),w(o.$$.fragment,i),n=!0)},o(i){k(e.$$.fragment,i),k(o.$$.fragment,i),n=!1},d(i){i&&R(t),O(e,i),O(o,i)}}}function tt(a,e,t){Be(async()=>{await Te(),await Pe()});let o,n,i="",f={lng:0,lat:0},c={type:"FeatureCollection",features:[]},l="",r=1e3,s="Distance",d={maxCount:1e3,originRadius:3,destinationRadius:3,streetviewOn:!1},y;async function _(g){t(0,i=""),t(7,l="Loading file"),C(await y.files[0].arrayBuffer())}function C(g){try{t(4,n=new Je(new Uint8Array(g))),t(2,s="Distance");let v=n.getBounds();o.fitBounds([[v[0],v[1]],[v[2],v[3]]],{padding:20,animate:!1}),t(5,f.lng=(v[0]+v[2])/2,f),t(5,f.lat=(v[1]+v[3])/2,f),L()}catch(v){window.alert(`Problem importing osm.pbf file: ${v}`)}t(7,l="")}async function m(g){if(g!=""){t(7,l=`Loading ${g}`);let v=await fetch(`https://assets.od2net.org/pbf_clips/${g}.osm.pbf`);C(await v.arrayBuffer())}}function L(){n&&t(6,c=JSON.parse(n.recalculate({lng:f.lng,lat:f.lat,max_requests:r,cost:s})))}function B(g,v){L()}function T(g){t(7,l="Parsing XML"),C(new TextEncoder().encode(g.detail)),t(7,l="")}function H(g){f=g,t(5,f)}function A(g){o=g,t(3,o)}function b(g){G[g?"unshift":"push"](()=>{y=g,t(9,y)})}function h(g){i=g,t(0,i)}const p=g=>t(7,l=g.detail),E=g=>t(7,l=g.detail);function F(){r=ue(this.value),t(1,r)}function N(g){s=g,t(2,s)}function S(g){d=g,t(8,d)}return a.$$.update=()=>{a.$$.dirty&1&&m(i),a.$$.dirty&6&&B()},[i,r,s,o,n,f,c,l,d,y,_,L,T,H,A,b,h,p,E,F,N,S]}class nt extends ie{constructor(e){super(),re(this,e,tt,et,fe,{})}}new nt({target:document.getElementById("app")}); diff --git a/assets/x3-b08fba3a.js b/assets/x3-92a919f2.js similarity index 73% rename from assets/x3-b08fba3a.js rename to assets/x3-92a919f2.js index bae7163..2745d24 100644 --- a/assets/x3-b08fba3a.js +++ b/assets/x3-92a919f2.js @@ -1,5 +1,5 @@ -import{S as fe,i as pe,s as ue,L as me,c as F,f as E,a as v,l as k,t as g,b as h,v as L,d as M,o as ce,H as _e,x as Q,y as te,e as y,g as W,h as Z,n as b,q as x,A as ne,r as ae,u as ie,M as de,z as U,_ as $e,a1 as ge,a5 as q,a6 as se,C as be,j as Y,k as he,p as le,w as we,ai as ee,a2 as ye,ah as ke,af as Le,ag as D,a4 as Ce,a9 as Se,aa as Fe}from"./Layout-4cd70fb2.js";import{L as ve,C as Me,O as Ne,_ as Oe,J as Be,a as Ee,G as Pe,P as je}from"./CostFunction-e35500c2.js";function oe(l){let e,n,t,r,s,a,i,u,w,c,d,$,_,N,O,C,G,J,A,m,p,B,T,H,I;const R=[Te,qe],P=[];function X(o,f){return o[5]=="lts"?0:1}d=X(l),$=P[d]=R[d](l);function V(o){l[23](o)}let z={};return l[1]!==void 0&&(z.cost=l[1]),p=new Ee({props:z}),Q.push(()=>te(p,"cost",V)),{c(){e=y("hr"),n=E(),t=y("div"),r=y("label"),s=W(`Color edges by: - `),a=y("select"),i=y("option"),i.textContent="LTS",u=y("option"),u.textContent="Edge cost (relative to length)",w=y("option"),w.textContent="Nearby amenities",c=E(),$.c(),_=E(),N=y("div"),O=y("label"),C=y("input"),G=W(` - Show cyclists not allowed`),J=E(),A=y("hr"),m=E(),F(p.$$.fragment),i.__value="lts",Y(i,i.__value),u.__value="cost",Y(u,u.__value),w.__value="nearby_amenities",Y(w,w.__value),l[5]===void 0&&he(()=>l[21].call(a)),Z(C,"type","checkbox"),U(O,"color",q.lts_not_allowed)},m(o,f){k(o,e,f),k(o,n,f),k(o,t,f),b(t,r),b(r,s),b(r,a),b(a,i),b(a,u),b(a,w),le(a,l[5],!0),k(o,c,f),P[d].m(o,f),k(o,_,f),k(o,N,f),b(N,O),b(O,C),C.checked=l[6],b(O,G),k(o,J,f),k(o,A,f),k(o,m,f),v(p,o,f),T=!0,H||(I=[x(a,"change",l[21]),x(C,"change",l[22])],H=!0)},p(o,f){f&32&&le(a,o[5]);let S=d;d=X(o),d===S?P[d].p(o,f):(ae(),h(P[S],1,1,()=>{P[S]=null}),ie(),$=P[d],$?$.p(o,f):($=P[d]=R[d](o),$.c()),g($,1),$.m(_.parentNode,_)),f&64&&(C.checked=o[6]);const j={};!B&&f&2&&(B=!0,j.cost=o[1],ne(()=>B=!1)),p.$set(j)},i(o){T||(g($),g(p.$$.fragment,o),T=!0)},o(o){h($),h(p.$$.fragment,o),T=!1},d(o){o&&(L(e),L(n),L(t),L(c),L(_),L(N),L(J),L(A),L(m)),P[d].d(o),M(p,o),H=!1,we(I)}}}function qe(l){let e,n;return e=new ke({props:{colorScale:ee,limits:K(l[5],l[9],l[10]),decimalPlaces:1}}),{c(){F(e.$$.fragment)},m(t,r){v(e,t,r),n=!0},p(t,r){const s={};r&1568&&(s.limits=K(t[5],t[9],t[10])),e.$set(s)},i(t){n||(g(e.$$.fragment,t),n=!0)},o(t){h(e.$$.fragment,t),n=!1},d(t){M(e,t)}}}function Te(l){let e,n,t,r;return e=new Le({props:{rows:[[`${D.lts1}: ${l[8][1].toFixed(0)}% of roads by distance`,q.lts1],[`${D.lts2}: ${l[8][2].toFixed(0)}%`,q.lts2],[`${D.lts3}: ${l[8][3].toFixed(0)}%`,q.lts3],[`${D.lts4}: ${l[8][4].toFixed(0)}%`,q.lts4]]}}),{c(){F(e.$$.fragment),n=E(),t=y("p"),t.innerHTML='Note: LTS model from BikeOttawa'},m(s,a){v(e,s,a),k(s,n,a),k(s,t,a),r=!0},p(s,a){const i={};a&256&&(i.rows=[[`${D.lts1}: ${s[8][1].toFixed(0)}% of roads by distance`,q.lts1],[`${D.lts2}: ${s[8][2].toFixed(0)}%`,q.lts2],[`${D.lts3}: ${s[8][3].toFixed(0)}%`,q.lts3],[`${D.lts4}: ${s[8][4].toFixed(0)}%`,q.lts4]]),e.$set(i)},i(s){r||(g(e.$$.fragment,s),r=!0)},o(s){h(e.$$.fragment,s),r=!1},d(s){s&&(L(n),L(t)),M(e,s)}}}function Je(l){let e,n,t,r,s,a,i,u,w,c,d,$,_,N,O,C,G;n=new _e({props:{app:"costs"}});function J(p){l[18](p)}let A={};l[0]!==void 0&&(A.example=l[0]),c=new Me({props:A}),Q.push(()=>te(c,"example",J)),_=new Ne({props:{map:l[2]}}),_.$on("gotXml",l[15]),_.$on("loading",l[19]),_.$on("error",l[20]);let m=l[3]&&oe(l);return{c(){e=y("div"),F(n.$$.fragment),t=E(),r=y("label"),s=W("Open an "),a=y("i"),a.textContent=".osm.pbf",i=W(` +import{S as fe,i as pe,s as ue,L as me,c as F,f as B,a as v,l as k,t as g,b as h,v as L,d as M,o as ce,H as _e,x as Q,y as te,e as y,g as W,h as Z,n as b,q as x,A as ne,r as ae,u as ie,M as de,z as U,_ as $e,a2 as ge,a6 as q,a7 as se,C as be,j as Y,k as he,p as le,w as we,aj as ee,a3 as ye,ai as ke,ag as Le,ah as D,a5 as Ce,aa as Se,ab as Fe}from"./Layout-6a808470.js";import{L as ve,C as Me,O as Ne,_ as Oe,J as je,a as Be,G as Ee,P as Pe}from"./index-34f7e0df.js";function oe(l){let e,n,t,r,s,a,i,u,w,c,d,$,_,N,O,C,G,J,A,m,p,j,T,H,I;const R=[Te,qe],E=[];function X(o,f){return o[5]=="lts"?0:1}d=X(l),$=E[d]=R[d](l);function V(o){l[23](o)}let z={};return l[1]!==void 0&&(z.cost=l[1]),p=new Be({props:z}),Q.push(()=>te(p,"cost",V)),{c(){e=y("hr"),n=B(),t=y("div"),r=y("label"),s=W(`Color edges by: + `),a=y("select"),i=y("option"),i.textContent="LTS",u=y("option"),u.textContent="Edge cost (relative to length)",w=y("option"),w.textContent="Nearby amenities",c=B(),$.c(),_=B(),N=y("div"),O=y("label"),C=y("input"),G=W(` + Show cyclists not allowed`),J=B(),A=y("hr"),m=B(),F(p.$$.fragment),i.__value="lts",Y(i,i.__value),u.__value="cost",Y(u,u.__value),w.__value="nearby_amenities",Y(w,w.__value),l[5]===void 0&&he(()=>l[21].call(a)),Z(C,"type","checkbox"),U(O,"color",q.lts_not_allowed)},m(o,f){k(o,e,f),k(o,n,f),k(o,t,f),b(t,r),b(r,s),b(r,a),b(a,i),b(a,u),b(a,w),le(a,l[5],!0),k(o,c,f),E[d].m(o,f),k(o,_,f),k(o,N,f),b(N,O),b(O,C),C.checked=l[6],b(O,G),k(o,J,f),k(o,A,f),k(o,m,f),v(p,o,f),T=!0,H||(I=[x(a,"change",l[21]),x(C,"change",l[22])],H=!0)},p(o,f){f&32&&le(a,o[5]);let S=d;d=X(o),d===S?E[d].p(o,f):(ae(),h(E[S],1,1,()=>{E[S]=null}),ie(),$=E[d],$?$.p(o,f):($=E[d]=R[d](o),$.c()),g($,1),$.m(_.parentNode,_)),f&64&&(C.checked=o[6]);const P={};!j&&f&2&&(j=!0,P.cost=o[1],ne(()=>j=!1)),p.$set(P)},i(o){T||(g($),g(p.$$.fragment,o),T=!0)},o(o){h($),h(p.$$.fragment,o),T=!1},d(o){o&&(L(e),L(n),L(t),L(c),L(_),L(N),L(J),L(A),L(m)),E[d].d(o),M(p,o),H=!1,we(I)}}}function qe(l){let e,n;return e=new ke({props:{colorScale:ee,limits:K(l[5],l[9],l[10]),decimalPlaces:1}}),{c(){F(e.$$.fragment)},m(t,r){v(e,t,r),n=!0},p(t,r){const s={};r&1568&&(s.limits=K(t[5],t[9],t[10])),e.$set(s)},i(t){n||(g(e.$$.fragment,t),n=!0)},o(t){h(e.$$.fragment,t),n=!1},d(t){M(e,t)}}}function Te(l){let e,n,t,r;return e=new Le({props:{rows:[[`${D.lts1}: ${l[8][1].toFixed(0)}% of roads by distance`,q.lts1],[`${D.lts2}: ${l[8][2].toFixed(0)}%`,q.lts2],[`${D.lts3}: ${l[8][3].toFixed(0)}%`,q.lts3],[`${D.lts4}: ${l[8][4].toFixed(0)}%`,q.lts4]]}}),{c(){F(e.$$.fragment),n=B(),t=y("p"),t.innerHTML='Note: LTS model from BikeOttawa'},m(s,a){v(e,s,a),k(s,n,a),k(s,t,a),r=!0},p(s,a){const i={};a&256&&(i.rows=[[`${D.lts1}: ${s[8][1].toFixed(0)}% of roads by distance`,q.lts1],[`${D.lts2}: ${s[8][2].toFixed(0)}%`,q.lts2],[`${D.lts3}: ${s[8][3].toFixed(0)}%`,q.lts3],[`${D.lts4}: ${s[8][4].toFixed(0)}%`,q.lts4]]),e.$set(i)},i(s){r||(g(e.$$.fragment,s),r=!0)},o(s){h(e.$$.fragment,s),r=!1},d(s){s&&(L(n),L(t)),M(e,s)}}}function Je(l){let e,n,t,r,s,a,i,u,w,c,d,$,_,N,O,C,G;n=new _e({props:{app:"costs"}});function J(p){l[18](p)}let A={};l[0]!==void 0&&(A.example=l[0]),c=new Me({props:A}),Q.push(()=>te(c,"example",J)),_=new Ne({props:{map:l[2]}}),_.$on("gotXml",l[15]),_.$on("loading",l[19]),_.$on("error",l[20]);let m=l[3]&&oe(l);return{c(){e=y("div"),F(n.$$.fragment),t=B(),r=y("label"),s=W("Open an "),a=y("i"),a.textContent=".osm.pbf",i=W(` file - `),u=y("input"),w=E(),F(c.$$.fragment),$=E(),F(_.$$.fragment),N=E(),m&&m.c(),Z(u,"type","file"),Z(e,"slot","left")},m(p,B){k(p,e,B),v(n,e,null),b(e,t),b(e,r),b(r,s),b(r,a),b(r,i),b(r,u),l[17](u),b(e,w),v(c,e,null),b(e,$),v(_,e,null),b(e,N),m&&m.m(e,null),O=!0,C||(G=x(u,"change",l[12]),C=!0)},p(p,B){const T={};!d&&B&1&&(d=!0,T.example=p[0],ne(()=>d=!1)),c.$set(T);const H={};B&4&&(H.map=p[2]),_.$set(H),p[3]?m?(m.p(p,B),B&8&&g(m,1)):(m=oe(p),m.c(),g(m,1),m.m(e,null)):m&&(ae(),h(m,1,1,()=>{m=null}),ie())},i(p){O||(g(n.$$.fragment,p),g(c.$$.fragment,p),g(_.$$.fragment,p),g(m),O=!0)},o(p){h(n.$$.fragment,p),h(c.$$.fragment,p),h(_.$$.fragment,p),h(m),O=!1},d(p){p&&L(e),M(n),l[17](null),M(c),M(_),m&&m.d(),C=!1,G()}}}function Ae(l){let e,n;return e=new Fe({props:{properties:l[28]}}),{c(){F(e.$$.fragment)},m(t,r){v(e,t,r),n=!0},p(t,r){const s={};r&268435456&&(s.properties=t[28]),e.$set(s)},i(t){n||(g(e.$$.fragment,t),n=!0)},o(t){h(e.$$.fragment,t),n=!1},d(t){M(e,t)}}}function He(l){let e,n;return e=new Se({props:{$$slots:{default:[Ae,({props:t})=>({28:t}),({props:t})=>t?268435456:0]},$$scope:{ctx:l}}}),{c(){F(e.$$.fragment)},m(t,r){v(e,t,r),n=!0},p(t,r){const s={};r&805306368&&(s.$$scope={dirty:r,ctx:t}),e.$set(s)},i(t){n||(g(e.$$.fragment,t),n=!0)},o(t){h(e.$$.fragment,t),n=!1},d(t){M(e,t)}}}function De(l){let e,n;return e=new Ce({props:{manageHoverState:!0,hoverCursor:"pointer",paint:{"line-width":5,"line-color":l[13](l[5],l[9],l[10]),"line-opacity":l[14](l[5],l[6])},beforeId:"Road labels",$$slots:{default:[He]},$$scope:{ctx:l}}}),e.$on("click",Xe),{c(){F(e.$$.fragment)},m(t,r){v(e,t,r),n=!0},p(t,r){const s={};r&1632&&(s.paint={"line-width":5,"line-color":t[13](t[5],t[9],t[10]),"line-opacity":t[14](t[5],t[6])}),r&536870912&&(s.$$scope={dirty:r,ctx:t}),e.$set(s)},i(t){n||(g(e.$$.fragment,t),n=!0)},o(t){h(e.$$.fragment,t),n=!1},d(t){M(e,t)}}}function Ge(l){let e,n,t,r;return e=new Pe({props:{data:l[4],$$slots:{default:[De]},$$scope:{ctx:l}}}),t=new je({}),{c(){F(e.$$.fragment),n=E(),F(t.$$.fragment)},m(s,a){v(e,s,a),k(s,n,a),v(t,s,a),r=!0},p(s,a){const i={};a&16&&(i.data=s[4]),a&536872544&&(i.$$scope={dirty:a,ctx:s}),e.$set(i)},i(s){r||(g(e.$$.fragment,s),g(t.$$.fragment,s),r=!0)},o(s){h(e.$$.fragment,s),h(t.$$.fragment,s),r=!1},d(s){s&&L(n),M(e,s),M(t,s)}}}function Ie(l){let e,n,t,r;function s(i){l[16](i)}let a={style:"https://api.maptiler.com/maps/dataviz/style.json?key=MZEJTanw3WpxRvt7qDfo",standardControls:!0,hash:!0,$$slots:{default:[Ge]},$$scope:{ctx:l}};return l[2]!==void 0&&(a.map=l[2]),n=new de({props:a}),Q.push(()=>te(n,"map",s)),{c(){e=y("div"),F(n.$$.fragment),Z(e,"slot","main"),U(e,"position","relative"),U(e,"width","100%"),U(e,"height","100vh")},m(i,u){k(i,e,u),v(n,e,null),r=!0},p(i,u){const w={};u&536872560&&(w.$$scope={dirty:u,ctx:i}),!t&&u&4&&(t=!0,w.map=i[2],ne(()=>t=!1)),n.$set(w)},i(i){r||(g(n.$$.fragment,i),r=!0)},o(i){h(n.$$.fragment,i),r=!1},d(i){i&&L(e),M(n)}}}function Re(l){let e,n,t,r;return e=new me({props:{$$slots:{main:[Ie],left:[Je]},$$scope:{ctx:l}}}),t=new ve({props:{loading:l[7]}}),{c(){F(e.$$.fragment),n=E(),F(t.$$.fragment)},m(s,a){v(e,s,a),k(s,n,a),v(t,s,a),r=!0},p(s,[a]){const i={};a&536875007&&(i.$$scope={dirty:a,ctx:s}),e.$set(i);const u={};a&128&&(u.loading=s[7]),t.$set(u)},i(s){r||(g(e.$$.fragment,s),g(t.$$.fragment,s),r=!0)},o(s){h(e.$$.fragment,s),h(t.$$.fragment,s),r=!1},d(s){s&&L(n),M(e,s),M(t,s)}}}function Xe(l){let e=l.detail.features[0].properties.way;window.open(`http://openstreetmap.org/way/${e}`,"_blank")}function K(l,e,n){if(l=="lts")return[];if(l=="cost")return re(0,e);if(l=="nearby_amenities")return re(0,n);throw new Error("unreachable")}function re(l,e){let n=[],t=(e-l)/5;for(let r=0;r<6;r++)n.push(l+r*t);return n}function ze(l,e,n){ce(async()=>{await Oe(),await $e()});let t,r,s="",a={type:"FeatureCollection",features:[]},i="Distance",u="cost",w=!1,c="",d=[0,0,0,0,0],$=1,_=1,N;async function O(o){n(0,s=""),n(7,c="Loading file"),C(await N.files[0].arrayBuffer())}function C(o){try{n(3,r=new Be(new Uint8Array(o))),n(1,i="Distance");let f=r.getBounds();t.fitBounds([[f[0],f[1]],[f[2],f[3]]],{padding:20,animate:!1}),J()}catch(f){window.alert(`Problem importing osm.pbf file: ${f}`)}n(7,c="")}async function G(o){if(o!=""){n(7,c=`Loading ${o}`);let f=await fetch(`https://assets.od2net.org/pbf_clips/${o}.osm.pbf`);C(await f.arrayBuffer())}}function J(){n(4,a=JSON.parse(r.debugNetwork()));let o=0,f=[0,0,0,0,0];n(9,$=0),n(10,_=0);for(let S of a.features){let j=S.properties;n(10,_=Math.max(_,j.nearby_amenities)),j.length&&(n(9,$=Math.max($,j.forward_cost/j.length)),o+=j.length,f[j.lts]+=j.length)}n(8,d=f.map(S=>S/o*100))}function A(o,f,S){if(o=="lts")return ge;if(o=="cost")return["case",["==",0,["get","lts"]],q.lts_not_allowed,se(["/",["get","forward_cost"],["get","length"]],K(o,f,S),ee)];if(o=="nearby_amenities")return se(["get","nearby_amenities"],K(o,f,S),ee);throw new Error("unreachable")}function m(o,f){let S=ye(1,.5);return o=="nearby_amenities"?["case",["==",0,["get","nearby_amenities"]],0,S]:f?S:["case",["==",0,["get","lts"]],0,S]}function p(o){n(7,c="Parsing XML"),C(new TextEncoder().encode(o.detail)),n(7,c="")}function B(o){r&&(r.updateCostFunction(o),J())}function T(o){t=o,n(2,t)}function H(o){Q[o?"unshift":"push"](()=>{N=o,n(11,N)})}function I(o){s=o,n(0,s)}const R=o=>n(7,c=o.detail),P=o=>n(7,c=o.detail);function X(){u=be(this),n(5,u)}function V(){w=this.checked,n(6,w)}function z(o){i=o,n(1,i)}return l.$$.update=()=>{l.$$.dirty&1&&G(s),l.$$.dirty&2&&B(i)},[s,i,t,r,a,u,w,c,d,$,_,N,O,A,m,p,T,H,I,R,P,X,V,z]}class Ue extends fe{constructor(e){super(),pe(this,e,ze,Re,ue,{})}}new Ue({target:document.getElementById("app")}); + `),u=y("input"),w=B(),F(c.$$.fragment),$=B(),F(_.$$.fragment),N=B(),m&&m.c(),Z(u,"type","file"),Z(e,"slot","left")},m(p,j){k(p,e,j),v(n,e,null),b(e,t),b(e,r),b(r,s),b(r,a),b(r,i),b(r,u),l[17](u),b(e,w),v(c,e,null),b(e,$),v(_,e,null),b(e,N),m&&m.m(e,null),O=!0,C||(G=x(u,"change",l[12]),C=!0)},p(p,j){const T={};!d&&j&1&&(d=!0,T.example=p[0],ne(()=>d=!1)),c.$set(T);const H={};j&4&&(H.map=p[2]),_.$set(H),p[3]?m?(m.p(p,j),j&8&&g(m,1)):(m=oe(p),m.c(),g(m,1),m.m(e,null)):m&&(ae(),h(m,1,1,()=>{m=null}),ie())},i(p){O||(g(n.$$.fragment,p),g(c.$$.fragment,p),g(_.$$.fragment,p),g(m),O=!0)},o(p){h(n.$$.fragment,p),h(c.$$.fragment,p),h(_.$$.fragment,p),h(m),O=!1},d(p){p&&L(e),M(n),l[17](null),M(c),M(_),m&&m.d(),C=!1,G()}}}function Ae(l){let e,n;return e=new Fe({props:{properties:l[28]}}),{c(){F(e.$$.fragment)},m(t,r){v(e,t,r),n=!0},p(t,r){const s={};r&268435456&&(s.properties=t[28]),e.$set(s)},i(t){n||(g(e.$$.fragment,t),n=!0)},o(t){h(e.$$.fragment,t),n=!1},d(t){M(e,t)}}}function He(l){let e,n;return e=new Se({props:{$$slots:{default:[Ae,({props:t})=>({28:t}),({props:t})=>t?268435456:0]},$$scope:{ctx:l}}}),{c(){F(e.$$.fragment)},m(t,r){v(e,t,r),n=!0},p(t,r){const s={};r&805306368&&(s.$$scope={dirty:r,ctx:t}),e.$set(s)},i(t){n||(g(e.$$.fragment,t),n=!0)},o(t){h(e.$$.fragment,t),n=!1},d(t){M(e,t)}}}function De(l){let e,n;return e=new Ce({props:{manageHoverState:!0,hoverCursor:"pointer",paint:{"line-width":5,"line-color":l[13](l[5],l[9],l[10]),"line-opacity":l[14](l[5],l[6])},beforeId:"Road labels",$$slots:{default:[He]},$$scope:{ctx:l}}}),e.$on("click",Xe),{c(){F(e.$$.fragment)},m(t,r){v(e,t,r),n=!0},p(t,r){const s={};r&1632&&(s.paint={"line-width":5,"line-color":t[13](t[5],t[9],t[10]),"line-opacity":t[14](t[5],t[6])}),r&536870912&&(s.$$scope={dirty:r,ctx:t}),e.$set(s)},i(t){n||(g(e.$$.fragment,t),n=!0)},o(t){h(e.$$.fragment,t),n=!1},d(t){M(e,t)}}}function Ge(l){let e,n,t,r;return e=new Ee({props:{data:l[4],$$slots:{default:[De]},$$scope:{ctx:l}}}),t=new Pe({}),{c(){F(e.$$.fragment),n=B(),F(t.$$.fragment)},m(s,a){v(e,s,a),k(s,n,a),v(t,s,a),r=!0},p(s,a){const i={};a&16&&(i.data=s[4]),a&536872544&&(i.$$scope={dirty:a,ctx:s}),e.$set(i)},i(s){r||(g(e.$$.fragment,s),g(t.$$.fragment,s),r=!0)},o(s){h(e.$$.fragment,s),h(t.$$.fragment,s),r=!1},d(s){s&&L(n),M(e,s),M(t,s)}}}function Ie(l){let e,n,t,r;function s(i){l[16](i)}let a={style:"https://api.maptiler.com/maps/dataviz/style.json?key=MZEJTanw3WpxRvt7qDfo",standardControls:!0,hash:!0,$$slots:{default:[Ge]},$$scope:{ctx:l}};return l[2]!==void 0&&(a.map=l[2]),n=new de({props:a}),Q.push(()=>te(n,"map",s)),{c(){e=y("div"),F(n.$$.fragment),Z(e,"slot","main"),U(e,"position","relative"),U(e,"width","100%"),U(e,"height","100vh")},m(i,u){k(i,e,u),v(n,e,null),r=!0},p(i,u){const w={};u&536872560&&(w.$$scope={dirty:u,ctx:i}),!t&&u&4&&(t=!0,w.map=i[2],ne(()=>t=!1)),n.$set(w)},i(i){r||(g(n.$$.fragment,i),r=!0)},o(i){h(n.$$.fragment,i),r=!1},d(i){i&&L(e),M(n)}}}function Re(l){let e,n,t,r;return e=new me({props:{$$slots:{main:[Ie],left:[Je]},$$scope:{ctx:l}}}),t=new ve({props:{loading:l[7]}}),{c(){F(e.$$.fragment),n=B(),F(t.$$.fragment)},m(s,a){v(e,s,a),k(s,n,a),v(t,s,a),r=!0},p(s,[a]){const i={};a&536875007&&(i.$$scope={dirty:a,ctx:s}),e.$set(i);const u={};a&128&&(u.loading=s[7]),t.$set(u)},i(s){r||(g(e.$$.fragment,s),g(t.$$.fragment,s),r=!0)},o(s){h(e.$$.fragment,s),h(t.$$.fragment,s),r=!1},d(s){s&&L(n),M(e,s),M(t,s)}}}function Xe(l){let e=l.detail.features[0].properties.way;window.open(`http://openstreetmap.org/way/${e}`,"_blank")}function K(l,e,n){if(l=="lts")return[];if(l=="cost")return re(0,e);if(l=="nearby_amenities")return re(0,n);throw new Error("unreachable")}function re(l,e){let n=[],t=(e-l)/5;for(let r=0;r<6;r++)n.push(l+r*t);return n}function ze(l,e,n){ce(async()=>{await Oe(),await $e()});let t,r,s="",a={type:"FeatureCollection",features:[]},i="Distance",u="cost",w=!1,c="",d=[0,0,0,0,0],$=1,_=1,N;async function O(o){n(0,s=""),n(7,c="Loading file"),C(await N.files[0].arrayBuffer())}function C(o){try{n(3,r=new je(new Uint8Array(o))),n(1,i="Distance");let f=r.getBounds();t.fitBounds([[f[0],f[1]],[f[2],f[3]]],{padding:20,animate:!1}),J()}catch(f){window.alert(`Problem importing osm.pbf file: ${f}`)}n(7,c="")}async function G(o){if(o!=""){n(7,c=`Loading ${o}`);let f=await fetch(`https://assets.od2net.org/pbf_clips/${o}.osm.pbf`);C(await f.arrayBuffer())}}function J(){n(4,a=JSON.parse(r.debugNetwork()));let o=0,f=[0,0,0,0,0];n(9,$=0),n(10,_=0);for(let S of a.features){let P=S.properties;n(10,_=Math.max(_,P.nearby_amenities)),P.length&&(n(9,$=Math.max($,P.forward_cost/P.length)),o+=P.length,f[P.lts]+=P.length)}n(8,d=f.map(S=>S/o*100))}function A(o,f,S){if(o=="lts")return ge;if(o=="cost")return["case",["==",0,["get","lts"]],q.lts_not_allowed,se(["/",["get","forward_cost"],["get","length"]],K(o,f,S),ee)];if(o=="nearby_amenities")return se(["get","nearby_amenities"],K(o,f,S),ee);throw new Error("unreachable")}function m(o,f){let S=ye(1,.5);return o=="nearby_amenities"?["case",["==",0,["get","nearby_amenities"]],0,S]:f?S:["case",["==",0,["get","lts"]],0,S]}function p(o){n(7,c="Parsing XML"),C(new TextEncoder().encode(o.detail)),n(7,c="")}function j(o){r&&(r.updateCostFunction(o),J())}function T(o){t=o,n(2,t)}function H(o){Q[o?"unshift":"push"](()=>{N=o,n(11,N)})}function I(o){s=o,n(0,s)}const R=o=>n(7,c=o.detail),E=o=>n(7,c=o.detail);function X(){u=be(this),n(5,u)}function V(){w=this.checked,n(6,w)}function z(o){i=o,n(1,i)}return l.$$.update=()=>{l.$$.dirty&1&&G(s),l.$$.dirty&2&&j(i)},[s,i,t,r,a,u,w,c,d,$,_,N,O,A,m,p,T,H,I,R,E,X,V,z]}class Ue extends fe{constructor(e){super(),pe(this,e,ze,Re,ue,{})}}new Ue({target:document.getElementById("app")}); diff --git a/edge_cost.html b/edge_cost.html index 4eed2c5..ecb2955 100644 --- a/edge_cost.html +++ b/edge_cost.html @@ -4,10 +4,11 @@ od2net edge cost mode - - - - + + + + +
    diff --git a/index.html b/index.html index 0e991cc..24fc3d6 100644 --- a/index.html +++ b/index.html @@ -4,10 +4,10 @@ od2net - - - - + + + +
    diff --git a/interactive.html b/interactive.html index 5ff5104..bf49eaa 100644 --- a/interactive.html +++ b/interactive.html @@ -4,11 +4,12 @@ od2net interactive mode - - - - - + + + + + +