Redrawing the legend swallowed the rule that hides a collapsed section's body, leaving only the one that turns its chevron. Zones opened by default again. A region that was used to cut a map or a layer out of a sheet was still drawn on the result, tracing the edge of what the reader is already looking at. Tears of the Kingdom framed every layer in its own outline and each Mojave inset was a map containing exactly one zone: itself. The piece's own region is now dropped once it has done its work. Hover reveals an action on the row under the pointer, and the pointer can stop being over that row without the browser saying so -- scrolling moves the list rather than the cursor, so the row it was last over kept offering an action to a cursor that had left. The reveal is now marked stale on scroll or on leaving the list, until the pointer moves again.
- commit
- 5db5eebc2aedcc627e8f584db867dff7a5d50e56
- parent
- 7bfbcb14060e7aea143944ea0b78dab4294ddd6a
- author
- Dami <dami.etoile@gmail.com>
| M | assets/ | 2 | +- |
| M | assets/ | 10 | +++++----- |
| M | assets/ | 2 | +- |
| M | frontend/ | 13 | +++++++++++-- |
| M | frontend/ | 11 | +++++++++++ |
| M | tools/ | 19 | +++++++++++++++---- |
@@ -1 +1 @@
1-:root,:host{--ol-background-color: white;--ol-accent-background-color: #F5F5F5;--ol-subtle-background-color: rgba(128, 128, 128, .25);--ol-partial-background-color: rgba(255, 255, 255, .75);--ol-foreground-color: #333333;--ol-subtle-foreground-color: #666666;--ol-brand-color: #00AAFF}.ol-box{box-sizing:border-box;border-radius:2px;border:1.5px solid var(--ol-background-color);background-color:var(--ol-partial-background-color)}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:var(--ol-partial-background-color);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid var(--ol-subtle-foreground-color);border-top:none;color:var(--ol-foreground-color);font-size:10px;text-align:center;margin:1px;will-change:contents,width;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-bar-inner{display:flex}.ol-scale-step-marker{width:1px;height:15px;background-color:var(--ol-foreground-color);float:right;z-index:10}.ol-scale-step-text{position:absolute;bottom:-5px;font-size:10px;z-index:11;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-text{position:absolute;font-size:12px;text-align:center;bottom:25px;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-singlebar{position:relative;height:10px;z-index:9;box-sizing:border-box;border:1px solid var(--ol-foreground-color)}.ol-scale-singlebar-even{background-color:var(--ol-subtle-foreground-color)}.ol-scale-singlebar-odd{background-color:var(--ol-background-color)}.ol-unsupported{display:none}.ol-viewport,.ol-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-viewport canvas{all:unset;overflow:hidden}.ol-viewport{touch-action:pan-x pan-y}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{position:absolute;background-color:var(--ol-subtle-background-color);border-radius:4px}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}.ol-control button{display:block;margin:1px;padding:0;color:var(--ol-subtle-foreground-color);font-weight:700;text-decoration:none;font-size:inherit;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:var(--ol-background-color);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:hover,.ol-control button:focus{text-decoration:none;outline:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);display:flex;flex-flow:row-reverse;align-items:center}.ol-attribution a{color:var(--ol-subtle-foreground-color);text-decoration:none}.ol-attribution ul{margin:0;padding:1px .5em;color:var(--ol-foreground-color);text-shadow:0 0 2px var(--ol-background-color);font-size:12px}.ol-attribution li{display:inline;list-style:none}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button{flex-shrink:0}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:var(--ol-partial-background-color)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:block}.ol-overviewmap .ol-overviewmap-map{border:1px solid var(--ol-subtle-foreground-color);height:150px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:0;left:0;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:var(--ol-subtle-background-color)}.ol-overviewmap-box{border:1.5px dotted var(--ol-subtle-foreground-color)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}.ol-overviewmap .ol-viewport:hover{cursor:pointer}:root{color-scheme:dark;--bg: #111310;--panel: #171a16;--panel-raised: #1e211c;--line: rgba(236, 240, 218, .11);--line-strong: rgba(236, 240, 218, .2);--text: #eef0e4;--muted: #93988b;--accent: #d6f36b;--accent-dark: #202a0e;--topbar: 72px;--sidebar: 330px;--pin-overlay-size: 28px;--text-overlay-size: 14px;--zone-overlay-size: 14px;--icon-outset-color: rgba(255, 255, 255, .96);--icon-outset: drop-shadow(1px 0 0 var(--icon-outset-color)) drop-shadow(-1px 0 0 var(--icon-outset-color)) drop-shadow(0 1px 0 var(--icon-outset-color)) drop-shadow(0 -1px 0 var(--icon-outset-color)) drop-shadow(0 2px 2px rgba(0, 0, 0, .9));font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-synthesis:none}*{box-sizing:border-box}html,body{width:100%;height:100%;margin:0;overflow:hidden;background:var(--bg);color:var(--text);-webkit-user-select:none;user-select:none}button,input,select{font:inherit}button{color:inherit}input{-webkit-user-select:text;user-select:text}.app-shell{display:grid;grid-template-columns:var(--sidebar) 1fr;grid-template-rows:var(--topbar) minmax(0,1fr);width:100%;height:100%}.topbar{position:relative;z-index:20;grid-column:1 / -1;display:grid;grid-template-columns:var(--sidebar) minmax(0,1fr) auto;align-items:center;border-bottom:1px solid var(--line);background:#131512f5;box-shadow:0 8px 30px #0000002e}.brand{display:flex;align-items:center;gap:12px;height:100%;padding:0 24px;border-right:1px solid var(--line)}.brand-mark{display:grid;width:35px;height:35px;place-items:center;color:var(--accent)}.brand-mark svg{width:100%;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.7}.brand strong,.brand small{display:block}.brand strong{font-family:Arial Narrow,Roboto Condensed,sans-serif;font-size:16px;letter-spacing:.2em;line-height:1}.brand small{margin-top:5px;color:var(--muted);font-size:10px;letter-spacing:.08em;text-transform:uppercase}.map-pickers{display:flex;align-items:center;gap:7px;min-width:0;padding:0 18px}.map-pickers label{display:flex;min-width:0;align-items:center;gap:7px;color:var(--muted);font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}.map-pickers select{max-width:230px;height:37px;padding:0 32px 0 12px;border:1px solid var(--line);border-radius:8px;outline:none;background:var(--panel-raised);color:var(--text);font-size:13px;font-weight:600;letter-spacing:normal;text-transform:none}.map-pickers select:focus{border-color:#d6f36b99}.map-pickers select:disabled{border-color:transparent;background:#ffffff06;color:#9ca193;cursor:default;opacity:1}#variant-field[hidden]{display:none}.icon-button{display:grid;width:40px;height:40px;padding:10px;place-items:center;border:1px solid var(--line);border-radius:8px;background:var(--panel-raised)}.icon-button svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-width:1.8}.mobile-legend{display:none;margin-right:16px}.app-shell.sidebar-collapsed{grid-template-columns:0 minmax(0,1fr)}.app-shell.sidebar-collapsed .sidebar{display:none}.app-shell.sidebar-collapsed .topbar{grid-template-columns:auto minmax(0,1fr) auto}.sidebar{position:relative;z-index:10;display:flex;grid-column:1;grid-row:2;min-height:0;flex-direction:column;border-right:1px solid var(--line);background:linear-gradient(180deg,rgba(214,243,107,.025),transparent 22%),var(--panel)}.sidebar-heading{padding:25px 22px 18px}.eyebrow{margin:0 0 8px;color:var(--accent);font-size:9px;font-weight:800;letter-spacing:.2em}.sidebar-heading h1{display:-webkit-box;overflow:hidden;margin:0;font-family:Arial Narrow,Roboto Condensed,sans-serif;font-size:27px;font-weight:700;letter-spacing:-.025em;line-height:1.05;-webkit-box-orient:vertical;-webkit-line-clamp:2}.sidebar-heading .map-name{overflow:hidden;margin:8px 0 0;color:#cdd1c3;font-size:14px;font-weight:650;text-overflow:ellipsis;white-space:nowrap}.sidebar-heading #map-meta{margin:5px 0 0;color:var(--muted);font-size:11px}.search-wrap{position:relative;display:flex;align-items:center;margin:0 17px 16px}.search-wrap svg{position:absolute;left:12px;width:16px;fill:none;stroke:var(--muted);stroke-linecap:round;stroke-width:1.7}.search-wrap input{width:100%;height:42px;padding:0 45px 0 37px;border:1px solid var(--line);border-radius:8px;outline:none;background:#11140f;color:var(--text);font-size:13px}.search-wrap input::placeholder{color:#757a6e}.search-wrap input:focus{border-color:#d6f36b80;box-shadow:0 0 0 3px #d6f36b0f}.search-wrap kbd{position:absolute;right:9px;padding:3px 5px;border:1px solid var(--line);border-radius:4px;background:var(--panel-raised);color:var(--muted);font-family:inherit;font-size:9px}.search-results{z-index:5;overflow:auto;max-height:238px;margin:-8px 17px 14px;border:1px solid var(--line);border-radius:8px;background:#11140f;box-shadow:0 15px 35px #00000052}.search-result{display:grid;width:100%;grid-template-columns:22px 1fr;gap:10px;padding:10px 11px;border:0;border-bottom:1px solid var(--line);background:transparent;text-align:left;cursor:pointer}.search-result:last-child{border-bottom:0}.search-result:hover{background:#ffffff0a}.search-result .result-dot{display:grid;width:20px;height:20px;margin-top:1px;place-items:center;border-radius:50%;background:var(--pin-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--pin-color) 18%,transparent);color:#fff;font-size:7px;font-weight:900}.search-result strong,.search-result small{display:block}.search-result strong{overflow:hidden;font-size:12px;text-overflow:ellipsis;white-space:nowrap}.search-result small,.search-empty{margin-top:3px;color:var(--muted);font-size:10px}.search-empty{padding:13px}.legend-toolbar{display:flex;align-items:center;justify-content:space-between;padding:12px 20px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);color:var(--muted);font-size:9px;font-weight:800;letter-spacing:.14em;text-transform:uppercase}.legend-toolbar div{display:flex;gap:5px;align-items:center}.legend-toolbar button{padding:0;border:0;background:none;color:var(--muted);font-size:9px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;cursor:pointer}.legend-toolbar button:hover{color:var(--accent)}.layers{overflow-x:hidden;overflow-y:auto;min-height:0;flex:1;padding-bottom:12px;scrollbar-color:#44483e transparent;scrollbar-width:thin}.layer-section{border-bottom:1px solid var(--line)}.layer-section[hidden]{display:none}.legend .layer-section:last-child{border-bottom:0}.layer-header{display:flex;align-items:center;gap:10px;padding:8px 16px 8px 12px}.layer-title{display:flex;min-width:0;flex:1;align-items:center;gap:7px;padding:4px 0;border:0;background:transparent;color:#c8ccbd;font-size:10px;font-weight:800;letter-spacing:.12em;text-align:left;text-transform:uppercase;cursor:pointer}.layer-title:hover{color:var(--text)}.layer-title>span:nth-child(2){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.layer-chevron{display:grid;width:13px;height:13px;flex:none;place-items:center;color:#6b7163;transform:rotate(90deg);transition:transform .14s ease}.layer-section.is-collapsed .layer-chevron{transform:rotate(0)}.layer-chevron svg{width:12px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2.4}.layer-count{color:var(--muted);font-size:9px;font-weight:600;font-variant-numeric:tabular-nums;letter-spacing:0}.only-button{padding:0;border:0;opacity:0;background:none;color:var(--accent);font-size:9px;font-weight:700;letter-spacing:.1em;text-align:right;text-transform:uppercase;cursor:pointer;transition:opacity .11s ease}.category-row:hover .only-button,.layer-header:hover .only-button,.only-button:focus-visible{opacity:1}.only-button:hover{text-decoration:underline;text-underline-offset:2px}.solo-chip{overflow:hidden;max-width:160px;padding:0;border:0;background:none;color:var(--accent);font-size:9px;font-weight:700;letter-spacing:.06em;text-overflow:ellipsis;text-transform:uppercase;white-space:nowrap;cursor:pointer}.solo-chip[hidden]{display:none}.solo-chip:after{margin-left:6px;content:"\d7";opacity:.8}.solo-chip:hover{text-decoration:underline;text-underline-offset:2px}.layer-switch{position:relative;display:grid;width:15px;height:15px;flex:none;place-items:center;cursor:pointer}.layer-switch input{position:absolute;width:1px;height:1px;opacity:0}.layer-switch>span{width:9px;height:9px;border:1px solid #6b7163;transition:background .14s ease,border-color .14s ease}.layer-switch:hover>span{border-color:var(--accent)}.layer-switch:has(input:checked)>span{border-color:var(--accent);background:var(--accent)}.layer-switch:has(input:focus-visible)>span{outline:1px solid var(--accent);outline-offset:2px}.text-symbol{display:grid;width:22px;height:22px;flex:none;place-items:center;color:var(--pin-color);font-family:Arial Narrow,Roboto Condensed,sans-serif;font-size:11px;font-weight:900;letter-spacing:-.04em}.zone-index-item{--zone-depth: 0;display:grid;width:100%;align-items:center;grid-template-columns:10px minmax(0,1fr);gap:8px;min-height:26px;padding:0 4px 0 calc(4px + var(--zone-depth) * 13px);border:0;border-radius:3px;background:transparent;color:#9aa093;font-size:11px;font-weight:600;text-align:left;cursor:pointer}.zone-index-item:hover,.zone-index-item:focus-visible{outline:none;background:#ffffff0a;color:var(--text)}.zone-index-item.is-current{background:#ffffff0e;color:#f0f2e8}.zone-index-item.is-highlighted{color:#fff}#zone-index.has-highlights .zone-index-item:not(.is-highlighted):not(.is-current){opacity:.5}.zone-index-item>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.zone-index-marker{width:8px;height:8px;border:1px solid color-mix(in srgb,var(--zone-color) 78%,white);border-radius:2px;background:color-mix(in srgb,var(--zone-color) 18%,transparent)}.zone-index-item.is-highlighted .zone-index-marker{border-color:#fff;background:var(--zone-color);box-shadow:0 0 7px color-mix(in srgb,var(--zone-color) 65%,transparent)}.category-toggles{padding:2px 14px 10px}.category-row{display:grid;width:100%;align-items:center;grid-template-columns:22px minmax(0,1fr) 34px 46px;gap:8px;min-height:26px;padding:0 4px;border-radius:3px;color:#7d8275;cursor:pointer;-webkit-user-select:none;user-select:none}.category-row:hover{background:#ffffff0a;color:var(--text)}.category-row:has(input:checked){color:#d8dccf}.category-row input{position:absolute;width:1px;height:1px;opacity:0}.category-row:has(input:focus-visible){outline:1px solid var(--accent);outline-offset:-1px}.category-row:not(:has(input:checked)) .category-icon,.category-row:not(:has(input:checked)) .text-symbol{opacity:.32}.category-icon{display:grid;width:22px;height:22px;flex:none;place-items:center;border:0;background:transparent;color:var(--pin-color);font-size:9px;font-weight:900;text-transform:uppercase}.category-icon.has-source-icon:before,.result-dot.has-source-icon:before,#detail-dot.has-source-icon:before,.pin.has-source-icon:after{display:block;background:var(--pin-icon) center / contain no-repeat;content:"";filter:var(--icon-outset)}.category-icon.has-source-icon:before{width:14px;height:14px;filter:var(--icon-outset)}.result-dot.has-source-icon,#detail-dot.has-source-icon{border-radius:0;background:transparent;box-shadow:none}.result-dot.has-source-icon:before{width:16px;height:16px}.category-name{overflow:hidden;font-size:11px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}.category-count{color:#6f7568;font-size:10px;font-variant-numeric:tabular-nums;text-align:right}.sidebar-footer{display:flex;align-items:center;gap:7px;min-height:44px;padding:0 18px;border-top:1px solid var(--line);color:var(--muted);font-size:9px;letter-spacing:.06em;text-transform:uppercase}.live-dot{width:6px;height:6px;border-radius:50%;background:var(--accent);box-shadow:0 0 7px #d6f36b99}.map-panel{position:relative;grid-column:2;grid-row:2;min-width:0;min-height:0;background:#0c0e0c}.map{position:absolute;inset:0;overflow:hidden;outline:none;background:radial-gradient(circle at 50% 50%,rgba(102,111,86,.13),transparent 56%),#0b0d0b;cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none}.map .ol-viewport{position:absolute;inset:0}.map .ol-layer canvas{display:block}.map .ol-viewport.is-dragging{cursor:grabbing}.map:after{position:absolute;z-index:2;inset:0;background:linear-gradient(90deg,rgba(5,7,5,.36),transparent 7%,transparent 93%,rgba(5,7,5,.25)),linear-gradient(180deg,rgba(5,7,5,.2),transparent 10%,transparent 92%,rgba(5,7,5,.35));content:"";pointer-events:none}.map-loading{position:absolute;z-index:10;top:50%;left:50%;display:grid;min-width:235px;padding:24px;place-items:center;border:1px solid var(--line);border-radius:12px;background:#141713eb;box-shadow:0 20px 60px #0006;text-align:center;transform:translate(-50%,-50%);transition:opacity .18s ease}.map-loading[hidden]{display:none}.map-loading strong{margin-top:12px;font-size:13px}.map-loading small{margin-top:5px;color:var(--muted);font-size:10px}.spinner{width:25px;height:25px;border:2px solid rgba(214,243,107,.18);border-top-color:var(--accent);border-radius:50%;animation:spin .75s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.map-corner{position:absolute;z-index:7;right:17px;bottom:17px;display:flex;flex-direction:column;align-items:flex-end;gap:10px;pointer-events:none}.map-corner>*{pointer-events:auto}.overview{position:relative;overflow:hidden;border:1px solid var(--line-strong);border-radius:8px;background:#161915e6;box-shadow:0 6px 25px #00000047;cursor:crosshair;line-height:0}.overview[hidden]{display:none}.overview canvas{display:block;opacity:.85}.overview-viewport{position:absolute;border:1px solid var(--accent);border-radius:2px;background:#d6f36b24;pointer-events:none}.zoom-controls{position:absolute;z-index:7;top:17px;right:17px;display:grid;overflow:hidden;width:38px;border:1px solid var(--line-strong);border-radius:8px;background:#161915e6;box-shadow:0 6px 25px #00000038}.zoom-controls button{display:grid;width:38px;height:37px;padding:0;place-items:center;border:0;border-bottom:1px solid var(--line);background:transparent;font-size:20px;cursor:pointer}.zoom-controls button:last-child{border-bottom:0}.zoom-controls button:hover{background:#ffffff0f;color:var(--accent)}.grid-navigator{position:absolute;z-index:8;top:17px;right:67px;display:flex;overflow:hidden;align-items:stretch;border:1px solid var(--line-strong);border-radius:8px;background:#161915f0;box-shadow:0 6px 25px #00000038}.grid-navigator[hidden]{display:none}.grid-navigator button{width:36px;padding:0;border:0;border-right:1px solid var(--line);background:transparent;color:var(--muted);font-size:17px;cursor:pointer}.grid-navigator button:hover{color:var(--accent)}.grid-navigator label{display:flex;height:36px;align-items:center;gap:7px;padding:0 9px;color:var(--muted);font-size:8px;font-weight:800;letter-spacing:.12em;text-transform:uppercase}.grid-navigator input{width:74px;padding:4px 6px;border:1px solid #3c4137;border-radius:4px;outline:none;background:#0e110d;color:var(--accent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:lowercase;-webkit-user-select:text;user-select:text}.grid-navigator input:focus{border-color:#d6f36bad}.map-hint{position:relative;display:flex;align-items:center;gap:8px;padding:7px 10px;border:1px solid var(--line);border-radius:6px;background:#0f110ec2;color:#eef0e49e;font-size:9px;letter-spacing:.08em;text-transform:uppercase;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.map-hint i{width:2px;height:2px;border-radius:50%;background:currentColor}.pin-detail{position:absolute;z-index:9;right:68px;bottom:17px;width:min(360px,calc(100% - 100px));max-height:min(500px,calc(100% - 40px));overflow:auto;padding:20px;border:1px solid var(--line-strong);border-radius:11px;background:#151814f5;box-shadow:0 18px 55px #00000073;-webkit-user-select:text;user-select:text;-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}.pin-detail[hidden]{display:none}.detail-close{position:absolute;top:10px;right:11px;width:29px;height:29px;padding:0;border:0;border-radius:6px;background:#ffffff0a;color:var(--muted);font-size:21px;cursor:pointer}.detail-close:hover{color:var(--text)}.detail-category{display:flex;align-items:center;gap:7px;padding-right:30px;color:var(--muted);font-size:9px;font-weight:800;letter-spacing:.12em;text-transform:uppercase}.detail-category #detail-dot{display:grid;width:20px;height:20px;flex:0 0 20px;place-items:center;border-radius:50%;background:var(--pin-color);color:#fff;font-size:7px;letter-spacing:0}#detail-dot.has-source-icon:before{width:16px;height:16px}.pin-detail h2{margin:10px 0 11px;font-family:Arial Narrow,Roboto Condensed,sans-serif;font-size:22px;line-height:1.12}.pin-detail>p{margin:0;color:#b9bdb0;font-size:12px;line-height:1.55;white-space:pre-line}.detail-links{display:flex;flex-wrap:wrap;gap:4px 14px;margin-top:12px}.detail-links[hidden]{display:none}.detail-link{overflow:hidden;max-width:100%;padding:0;border:0;background:none;color:var(--accent);font-size:11px;font-weight:600;text-decoration:underline;text-overflow:ellipsis;text-underline-offset:3px;white-space:nowrap;cursor:pointer}.detail-link:hover{color:var(--text)}.pin-detail dl{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:17px 0 0;padding-top:13px;border-top:1px solid var(--line)}.pin-detail dl div{min-width:0}.pin-detail dt{color:#71766a;font-size:8px;font-weight:800;letter-spacing:.1em;text-transform:uppercase}.pin-detail dd{overflow:hidden;margin:4px 0 0;color:#c6cabd;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9px;text-overflow:ellipsis;white-space:nowrap}.fatal-error{position:fixed;z-index:100;inset:50% auto auto 50%;width:min(460px,calc(100% - 40px));padding:24px;border:1px solid #7e3f3f;border-radius:12px;background:#261919;box-shadow:0 25px 80px #00000080;transform:translate(-50%,-50%);-webkit-user-select:text;user-select:text}.fatal-error[hidden]{display:none}.fatal-error p{margin:8px 0 0;color:#c8aaaa;font-size:13px}@media(max-width:980px){:root{--sidebar: 300px}.map-pickers label>span{display:none}.map-pickers select{max-width:190px}}@media(max-width:760px){:root{--topbar: 64px}.app-shell{grid-template-columns:1fr}.topbar{grid-template-columns:auto minmax(0,1fr) auto}.brand{padding:0 15px;border-right:0}.brand small{display:none}.map-pickers{justify-content:center;padding:0 7px}.map-pickers select{max-width:135px;height:35px;padding-left:8px;font-size:11px}.mobile-legend{display:grid}.sidebar{position:fixed;z-index:30;top:var(--topbar);bottom:0;left:0;width:min(330px,calc(100% - 42px));box-shadow:18px 0 50px #00000073;transform:translate(-102%);transition:transform .18s ease}.sidebar.is-open{transform:translate(0)}.map-panel{grid-column:1}.pin-detail{right:14px;bottom:55px;width:calc(100% - 28px)}}1+:root,:host{--ol-background-color: white;--ol-accent-background-color: #F5F5F5;--ol-subtle-background-color: rgba(128, 128, 128, .25);--ol-partial-background-color: rgba(255, 255, 255, .75);--ol-foreground-color: #333333;--ol-subtle-foreground-color: #666666;--ol-brand-color: #00AAFF}.ol-box{box-sizing:border-box;border-radius:2px;border:1.5px solid var(--ol-background-color);background-color:var(--ol-partial-background-color)}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:var(--ol-partial-background-color);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid var(--ol-subtle-foreground-color);border-top:none;color:var(--ol-foreground-color);font-size:10px;text-align:center;margin:1px;will-change:contents,width;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-bar-inner{display:flex}.ol-scale-step-marker{width:1px;height:15px;background-color:var(--ol-foreground-color);float:right;z-index:10}.ol-scale-step-text{position:absolute;bottom:-5px;font-size:10px;z-index:11;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-text{position:absolute;font-size:12px;text-align:center;bottom:25px;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-singlebar{position:relative;height:10px;z-index:9;box-sizing:border-box;border:1px solid var(--ol-foreground-color)}.ol-scale-singlebar-even{background-color:var(--ol-subtle-foreground-color)}.ol-scale-singlebar-odd{background-color:var(--ol-background-color)}.ol-unsupported{display:none}.ol-viewport,.ol-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-viewport canvas{all:unset;overflow:hidden}.ol-viewport{touch-action:pan-x pan-y}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{position:absolute;background-color:var(--ol-subtle-background-color);border-radius:4px}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}.ol-control button{display:block;margin:1px;padding:0;color:var(--ol-subtle-foreground-color);font-weight:700;text-decoration:none;font-size:inherit;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:var(--ol-background-color);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:hover,.ol-control button:focus{text-decoration:none;outline:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);display:flex;flex-flow:row-reverse;align-items:center}.ol-attribution a{color:var(--ol-subtle-foreground-color);text-decoration:none}.ol-attribution ul{margin:0;padding:1px .5em;color:var(--ol-foreground-color);text-shadow:0 0 2px var(--ol-background-color);font-size:12px}.ol-attribution li{display:inline;list-style:none}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button{flex-shrink:0}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:var(--ol-partial-background-color)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:block}.ol-overviewmap .ol-overviewmap-map{border:1px solid var(--ol-subtle-foreground-color);height:150px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:0;left:0;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:var(--ol-subtle-background-color)}.ol-overviewmap-box{border:1.5px dotted var(--ol-subtle-foreground-color)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}.ol-overviewmap .ol-viewport:hover{cursor:pointer}:root{color-scheme:dark;--bg: #111310;--panel: #171a16;--panel-raised: #1e211c;--line: rgba(236, 240, 218, .11);--line-strong: rgba(236, 240, 218, .2);--text: #eef0e4;--muted: #93988b;--accent: #d6f36b;--accent-dark: #202a0e;--topbar: 72px;--sidebar: 330px;--pin-overlay-size: 28px;--text-overlay-size: 14px;--zone-overlay-size: 14px;--icon-outset-color: rgba(255, 255, 255, .96);--icon-outset: drop-shadow(1px 0 0 var(--icon-outset-color)) drop-shadow(-1px 0 0 var(--icon-outset-color)) drop-shadow(0 1px 0 var(--icon-outset-color)) drop-shadow(0 -1px 0 var(--icon-outset-color)) drop-shadow(0 2px 2px rgba(0, 0, 0, .9));font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-synthesis:none}*{box-sizing:border-box}html,body{width:100%;height:100%;margin:0;overflow:hidden;background:var(--bg);color:var(--text);-webkit-user-select:none;user-select:none}button,input,select{font:inherit}button{color:inherit}input{-webkit-user-select:text;user-select:text}.app-shell{display:grid;grid-template-columns:var(--sidebar) 1fr;grid-template-rows:var(--topbar) minmax(0,1fr);width:100%;height:100%}.topbar{position:relative;z-index:20;grid-column:1 / -1;display:grid;grid-template-columns:var(--sidebar) minmax(0,1fr) auto;align-items:center;border-bottom:1px solid var(--line);background:#131512f5;box-shadow:0 8px 30px #0000002e}.brand{display:flex;align-items:center;gap:12px;height:100%;padding:0 24px;border-right:1px solid var(--line)}.brand-mark{display:grid;width:35px;height:35px;place-items:center;color:var(--accent)}.brand-mark svg{width:100%;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.7}.brand strong,.brand small{display:block}.brand strong{font-family:Arial Narrow,Roboto Condensed,sans-serif;font-size:16px;letter-spacing:.2em;line-height:1}.brand small{margin-top:5px;color:var(--muted);font-size:10px;letter-spacing:.08em;text-transform:uppercase}.map-pickers{display:flex;align-items:center;gap:7px;min-width:0;padding:0 18px}.map-pickers label{display:flex;min-width:0;align-items:center;gap:7px;color:var(--muted);font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}.map-pickers select{max-width:230px;height:37px;padding:0 32px 0 12px;border:1px solid var(--line);border-radius:8px;outline:none;background:var(--panel-raised);color:var(--text);font-size:13px;font-weight:600;letter-spacing:normal;text-transform:none}.map-pickers select:focus{border-color:#d6f36b99}.map-pickers select:disabled{border-color:transparent;background:#ffffff06;color:#9ca193;cursor:default;opacity:1}#variant-field[hidden]{display:none}.icon-button{display:grid;width:40px;height:40px;padding:10px;place-items:center;border:1px solid var(--line);border-radius:8px;background:var(--panel-raised)}.icon-button svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-width:1.8}.mobile-legend{display:none;margin-right:16px}.app-shell.sidebar-collapsed{grid-template-columns:0 minmax(0,1fr)}.app-shell.sidebar-collapsed .sidebar{display:none}.app-shell.sidebar-collapsed .topbar{grid-template-columns:auto minmax(0,1fr) auto}.sidebar{position:relative;z-index:10;display:flex;grid-column:1;grid-row:2;min-height:0;flex-direction:column;border-right:1px solid var(--line);background:linear-gradient(180deg,rgba(214,243,107,.025),transparent 22%),var(--panel)}.sidebar-heading{padding:25px 22px 18px}.eyebrow{margin:0 0 8px;color:var(--accent);font-size:9px;font-weight:800;letter-spacing:.2em}.sidebar-heading h1{display:-webkit-box;overflow:hidden;margin:0;font-family:Arial Narrow,Roboto Condensed,sans-serif;font-size:27px;font-weight:700;letter-spacing:-.025em;line-height:1.05;-webkit-box-orient:vertical;-webkit-line-clamp:2}.sidebar-heading .map-name{overflow:hidden;margin:8px 0 0;color:#cdd1c3;font-size:14px;font-weight:650;text-overflow:ellipsis;white-space:nowrap}.sidebar-heading #map-meta{margin:5px 0 0;color:var(--muted);font-size:11px}.search-wrap{position:relative;display:flex;align-items:center;margin:0 17px 16px}.search-wrap svg{position:absolute;left:12px;width:16px;fill:none;stroke:var(--muted);stroke-linecap:round;stroke-width:1.7}.search-wrap input{width:100%;height:42px;padding:0 45px 0 37px;border:1px solid var(--line);border-radius:8px;outline:none;background:#11140f;color:var(--text);font-size:13px}.search-wrap input::placeholder{color:#757a6e}.search-wrap input:focus{border-color:#d6f36b80;box-shadow:0 0 0 3px #d6f36b0f}.search-wrap kbd{position:absolute;right:9px;padding:3px 5px;border:1px solid var(--line);border-radius:4px;background:var(--panel-raised);color:var(--muted);font-family:inherit;font-size:9px}.search-results{z-index:5;overflow:auto;max-height:238px;margin:-8px 17px 14px;border:1px solid var(--line);border-radius:8px;background:#11140f;box-shadow:0 15px 35px #00000052}.search-result{display:grid;width:100%;grid-template-columns:22px 1fr;gap:10px;padding:10px 11px;border:0;border-bottom:1px solid var(--line);background:transparent;text-align:left;cursor:pointer}.search-result:last-child{border-bottom:0}.search-result:hover{background:#ffffff0a}.search-result .result-dot{display:grid;width:20px;height:20px;margin-top:1px;place-items:center;border-radius:50%;background:var(--pin-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--pin-color) 18%,transparent);color:#fff;font-size:7px;font-weight:900}.search-result strong,.search-result small{display:block}.search-result strong{overflow:hidden;font-size:12px;text-overflow:ellipsis;white-space:nowrap}.search-result small,.search-empty{margin-top:3px;color:var(--muted);font-size:10px}.search-empty{padding:13px}.legend-toolbar{display:flex;align-items:center;justify-content:space-between;padding:12px 20px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);color:var(--muted);font-size:9px;font-weight:800;letter-spacing:.14em;text-transform:uppercase}.legend-toolbar div{display:flex;gap:5px;align-items:center}.legend-toolbar button{padding:0;border:0;background:none;color:var(--muted);font-size:9px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;cursor:pointer}.legend-toolbar button:hover{color:var(--accent)}.layers{overflow-x:hidden;overflow-y:auto;min-height:0;flex:1;padding-bottom:12px;scrollbar-color:#44483e transparent;scrollbar-width:thin}.layer-section{border-bottom:1px solid var(--line)}.layer-section[hidden]{display:none}.legend .layer-section:last-child{border-bottom:0}.layer-header{display:flex;align-items:center;gap:10px;padding:8px 16px 8px 12px}.layer-title{display:flex;min-width:0;flex:1;align-items:center;gap:7px;padding:4px 0;border:0;background:transparent;color:#c8ccbd;font-size:10px;font-weight:800;letter-spacing:.12em;text-align:left;text-transform:uppercase;cursor:pointer}.layer-title:hover{color:var(--text)}.layer-title>span:nth-child(2){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.layer-chevron{display:grid;width:13px;height:13px;flex:none;place-items:center;color:#6b7163;transform:rotate(90deg);transition:transform .14s ease}.layer-section.is-collapsed .layer-chevron{transform:rotate(0)}.layer-chevron svg{width:12px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2.4}.layer-count{color:var(--muted);font-size:9px;font-weight:600;font-variant-numeric:tabular-nums;letter-spacing:0}.only-button{padding:0;border:0;opacity:0;background:none;color:var(--accent);font-size:9px;font-weight:700;letter-spacing:.1em;text-align:right;text-transform:uppercase;cursor:pointer;transition:opacity .11s ease}.layers:not(.hover-stale) .category-row:hover .only-button,.layers:not(.hover-stale) .layer-header:hover .only-button,.only-button:focus-visible{opacity:1}.only-button:hover{text-decoration:underline;text-underline-offset:2px}.solo-chip{overflow:hidden;max-width:160px;padding:0;border:0;background:none;color:var(--accent);font-size:9px;font-weight:700;letter-spacing:.06em;text-overflow:ellipsis;text-transform:uppercase;white-space:nowrap;cursor:pointer}.solo-chip[hidden]{display:none}.solo-chip:after{margin-left:6px;content:"\d7";opacity:.8}.solo-chip:hover{text-decoration:underline;text-underline-offset:2px}.layer-switch{position:relative;display:grid;width:15px;height:15px;flex:none;place-items:center;cursor:pointer}.layer-switch input{position:absolute;width:1px;height:1px;opacity:0}.layer-switch>span{width:9px;height:9px;border:1px solid #6b7163;transition:background .14s ease,border-color .14s ease}.layer-switch:hover>span{border-color:var(--accent)}.layer-switch:has(input:checked)>span{border-color:var(--accent);background:var(--accent)}.layer-switch:has(input:focus-visible)>span{outline:1px solid var(--accent);outline-offset:2px}.layer-section.is-collapsed .category-toggles,.layer-section.is-collapsed .zone-list{display:none}.text-symbol{display:grid;width:22px;height:22px;flex:none;place-items:center;color:var(--pin-color);font-family:Arial Narrow,Roboto Condensed,sans-serif;font-size:11px;font-weight:900;letter-spacing:-.04em}.zone-index-item{--zone-depth: 0;display:grid;width:100%;align-items:center;grid-template-columns:10px minmax(0,1fr);gap:8px;min-height:26px;padding:0 4px 0 calc(4px + var(--zone-depth) * 13px);border:0;border-radius:3px;background:transparent;color:#9aa093;font-size:11px;font-weight:600;text-align:left;cursor:pointer}.zone-index-item:hover,.zone-index-item:focus-visible{outline:none;background:#ffffff0a;color:var(--text)}.zone-index-item.is-current{background:#ffffff0e;color:#f0f2e8}.zone-index-item.is-highlighted{color:#fff}#zone-index.has-highlights .zone-index-item:not(.is-highlighted):not(.is-current){opacity:.5}.zone-index-item>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.zone-index-marker{width:8px;height:8px;border:1px solid color-mix(in srgb,var(--zone-color) 78%,white);border-radius:2px;background:color-mix(in srgb,var(--zone-color) 18%,transparent)}.zone-index-item.is-highlighted .zone-index-marker{border-color:#fff;background:var(--zone-color);box-shadow:0 0 7px color-mix(in srgb,var(--zone-color) 65%,transparent)}.category-toggles{padding:2px 14px 10px}.category-row{display:grid;width:100%;align-items:center;grid-template-columns:22px minmax(0,1fr) 34px 46px;gap:8px;min-height:26px;padding:0 4px;border-radius:3px;color:#7d8275;cursor:pointer;-webkit-user-select:none;user-select:none}.category-row:hover{background:#ffffff0a;color:var(--text)}.category-row:has(input:checked){color:#d8dccf}.category-row input{position:absolute;width:1px;height:1px;opacity:0}.category-row:has(input:focus-visible){outline:1px solid var(--accent);outline-offset:-1px}.category-row:not(:has(input:checked)) .category-icon,.category-row:not(:has(input:checked)) .text-symbol{opacity:.32}.category-icon{display:grid;width:22px;height:22px;flex:none;place-items:center;border:0;background:transparent;color:var(--pin-color);font-size:9px;font-weight:900;text-transform:uppercase}.category-icon.has-source-icon:before,.result-dot.has-source-icon:before,#detail-dot.has-source-icon:before,.pin.has-source-icon:after{display:block;background:var(--pin-icon) center / contain no-repeat;content:"";filter:var(--icon-outset)}.category-icon.has-source-icon:before{width:14px;height:14px;filter:var(--icon-outset)}.result-dot.has-source-icon,#detail-dot.has-source-icon{border-radius:0;background:transparent;box-shadow:none}.result-dot.has-source-icon:before{width:16px;height:16px}.category-name{overflow:hidden;font-size:11px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}.category-count{color:#6f7568;font-size:10px;font-variant-numeric:tabular-nums;text-align:right}.sidebar-footer{display:flex;align-items:center;gap:7px;min-height:44px;padding:0 18px;border-top:1px solid var(--line);color:var(--muted);font-size:9px;letter-spacing:.06em;text-transform:uppercase}.live-dot{width:6px;height:6px;border-radius:50%;background:var(--accent);box-shadow:0 0 7px #d6f36b99}.map-panel{position:relative;grid-column:2;grid-row:2;min-width:0;min-height:0;background:#0c0e0c}.map{position:absolute;inset:0;overflow:hidden;outline:none;background:radial-gradient(circle at 50% 50%,rgba(102,111,86,.13),transparent 56%),#0b0d0b;cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none}.map .ol-viewport{position:absolute;inset:0}.map .ol-layer canvas{display:block}.map .ol-viewport.is-dragging{cursor:grabbing}.map:after{position:absolute;z-index:2;inset:0;background:linear-gradient(90deg,rgba(5,7,5,.36),transparent 7%,transparent 93%,rgba(5,7,5,.25)),linear-gradient(180deg,rgba(5,7,5,.2),transparent 10%,transparent 92%,rgba(5,7,5,.35));content:"";pointer-events:none}.map-loading{position:absolute;z-index:10;top:50%;left:50%;display:grid;min-width:235px;padding:24px;place-items:center;border:1px solid var(--line);border-radius:12px;background:#141713eb;box-shadow:0 20px 60px #0006;text-align:center;transform:translate(-50%,-50%);transition:opacity .18s ease}.map-loading[hidden]{display:none}.map-loading strong{margin-top:12px;font-size:13px}.map-loading small{margin-top:5px;color:var(--muted);font-size:10px}.spinner{width:25px;height:25px;border:2px solid rgba(214,243,107,.18);border-top-color:var(--accent);border-radius:50%;animation:spin .75s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.map-corner{position:absolute;z-index:7;right:17px;bottom:17px;display:flex;flex-direction:column;align-items:flex-end;gap:10px;pointer-events:none}.map-corner>*{pointer-events:auto}.overview{position:relative;overflow:hidden;border:1px solid var(--line-strong);border-radius:8px;background:#161915e6;box-shadow:0 6px 25px #00000047;cursor:crosshair;line-height:0}.overview[hidden]{display:none}.overview canvas{display:block;opacity:.85}.overview-viewport{position:absolute;border:1px solid var(--accent);border-radius:2px;background:#d6f36b24;pointer-events:none}.zoom-controls{position:absolute;z-index:7;top:17px;right:17px;display:grid;overflow:hidden;width:38px;border:1px solid var(--line-strong);border-radius:8px;background:#161915e6;box-shadow:0 6px 25px #00000038}.zoom-controls button{display:grid;width:38px;height:37px;padding:0;place-items:center;border:0;border-bottom:1px solid var(--line);background:transparent;font-size:20px;cursor:pointer}.zoom-controls button:last-child{border-bottom:0}.zoom-controls button:hover{background:#ffffff0f;color:var(--accent)}.grid-navigator{position:absolute;z-index:8;top:17px;right:67px;display:flex;overflow:hidden;align-items:stretch;border:1px solid var(--line-strong);border-radius:8px;background:#161915f0;box-shadow:0 6px 25px #00000038}.grid-navigator[hidden]{display:none}.grid-navigator button{width:36px;padding:0;border:0;border-right:1px solid var(--line);background:transparent;color:var(--muted);font-size:17px;cursor:pointer}.grid-navigator button:hover{color:var(--accent)}.grid-navigator label{display:flex;height:36px;align-items:center;gap:7px;padding:0 9px;color:var(--muted);font-size:8px;font-weight:800;letter-spacing:.12em;text-transform:uppercase}.grid-navigator input{width:74px;padding:4px 6px;border:1px solid #3c4137;border-radius:4px;outline:none;background:#0e110d;color:var(--accent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:lowercase;-webkit-user-select:text;user-select:text}.grid-navigator input:focus{border-color:#d6f36bad}.map-hint{position:relative;display:flex;align-items:center;gap:8px;padding:7px 10px;border:1px solid var(--line);border-radius:6px;background:#0f110ec2;color:#eef0e49e;font-size:9px;letter-spacing:.08em;text-transform:uppercase;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.map-hint i{width:2px;height:2px;border-radius:50%;background:currentColor}.pin-detail{position:absolute;z-index:9;right:68px;bottom:17px;width:min(360px,calc(100% - 100px));max-height:min(500px,calc(100% - 40px));overflow:auto;padding:20px;border:1px solid var(--line-strong);border-radius:11px;background:#151814f5;box-shadow:0 18px 55px #00000073;-webkit-user-select:text;user-select:text;-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}.pin-detail[hidden]{display:none}.detail-close{position:absolute;top:10px;right:11px;width:29px;height:29px;padding:0;border:0;border-radius:6px;background:#ffffff0a;color:var(--muted);font-size:21px;cursor:pointer}.detail-close:hover{color:var(--text)}.detail-category{display:flex;align-items:center;gap:7px;padding-right:30px;color:var(--muted);font-size:9px;font-weight:800;letter-spacing:.12em;text-transform:uppercase}.detail-category #detail-dot{display:grid;width:20px;height:20px;flex:0 0 20px;place-items:center;border-radius:50%;background:var(--pin-color);color:#fff;font-size:7px;letter-spacing:0}#detail-dot.has-source-icon:before{width:16px;height:16px}.pin-detail h2{margin:10px 0 11px;font-family:Arial Narrow,Roboto Condensed,sans-serif;font-size:22px;line-height:1.12}.pin-detail>p{margin:0;color:#b9bdb0;font-size:12px;line-height:1.55;white-space:pre-line}.detail-links{display:flex;flex-wrap:wrap;gap:4px 14px;margin-top:12px}.detail-links[hidden]{display:none}.detail-link{overflow:hidden;max-width:100%;padding:0;border:0;background:none;color:var(--accent);font-size:11px;font-weight:600;text-decoration:underline;text-overflow:ellipsis;text-underline-offset:3px;white-space:nowrap;cursor:pointer}.detail-link:hover{color:var(--text)}.pin-detail dl{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:17px 0 0;padding-top:13px;border-top:1px solid var(--line)}.pin-detail dl div{min-width:0}.pin-detail dt{color:#71766a;font-size:8px;font-weight:800;letter-spacing:.1em;text-transform:uppercase}.pin-detail dd{overflow:hidden;margin:4px 0 0;color:#c6cabd;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9px;text-overflow:ellipsis;white-space:nowrap}.fatal-error{position:fixed;z-index:100;inset:50% auto auto 50%;width:min(460px,calc(100% - 40px));padding:24px;border:1px solid #7e3f3f;border-radius:12px;background:#261919;box-shadow:0 25px 80px #00000080;transform:translate(-50%,-50%);-webkit-user-select:text;user-select:text}.fatal-error[hidden]{display:none}.fatal-error p{margin:8px 0 0;color:#c8aaaa;font-size:13px}@media(max-width:980px){:root{--sidebar: 300px}.map-pickers label>span{display:none}.map-pickers select{max-width:190px}}@media(max-width:760px){:root{--topbar: 64px}.app-shell{grid-template-columns:1fr}.topbar{grid-template-columns:auto minmax(0,1fr) auto}.brand{padding:0 15px;border-right:0}.brand small{display:none}.map-pickers{justify-content:center;padding:0 7px}.map-pickers select{max-width:135px;height:35px;padding-left:8px;font-size:11px}.mobile-legend{display:grid}.sidebar{position:fixed;z-index:30;top:var(--topbar);bottom:0;left:0;width:min(330px,calc(100% - 42px));box-shadow:18px 0 50px #00000073;transform:translate(-102%);transition:transform .18s ease}.sidebar.is-open{transform:translate(0)}.map-panel{grid-column:1}.pin-detail{right:14px;bottom:55px;width:calc(100% - 28px)}}@@ -1,9 +1,9 @@
1-(()=>{var ue={PROPERTYCHANGE:"propertychange"};function Ie(n){for(let t in n)delete n[t]}function de(n){let t;for(t in n)return!1;return!t}function K(n,t,e,i,r){if(r){let o=e;e=function(a){return n.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==n&&(e=e.bind(i));let s={target:n,type:t,listener:e};return n.addEventListener(t,e),s}function mn(n,t,e,i){return K(n,t,e,i,!0)}function J(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),Ie(n))}var P={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var Ko=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},di=Ko;function bh(n,t,e){let i,r;e=e||Zt;let s=0,o=n.length,a=!1;for(;s<o;)i=s+(o-s>>1),r=+e(n[i],t),r<0?s=i+1:(o=i,a=!r);return a?s:~s}function Zt(n,t){return n>t?1:n<t?-1:0}function Rh(n,t){return n<t?1:n>t?-1:0}function _n(n,t,e){if(n[0]<=t)return 0;let i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let r=1;r<i;++r){let s=n[r];if(s===t)return r;if(s<t)return e(t,n[r-1],s)>0?r-1:r}return i-1}if(e>0){for(let r=1;r<i;++r)if(n[r]<t)return r-1;return i-1}if(e<0){for(let r=1;r<i;++r)if(n[r]<=t)return r;return i-1}for(let r=1;r<i;++r){if(n[r]==t)return r;if(n[r]<t)return n[r-1]-t<t-n[r]?r-1:r}return i-1}function Sh(n,t,e){for(;t<e;){let i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function fe(n,t){let e=Array.isArray(t)?t:[t],i=e.length;for(let r=0;r<i;r++)n[n.length]=e[r]}function zt(n,t){let e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function Th(n,t,e){let i=t||Zt;return n.every(function(r,s){if(s===0)return!0;let o=i(n[s-1],r);return!(o>0||e&&o===0)})}function He(){return!0}function qe(){return!1}function $e(){}function rs(n){let t,e,i;return function(){let r=Array.prototype.slice.call(arguments);return(!e||this!==i||!zt(r,e))&&(i=this,e=r,t=n.apply(this,arguments)),t}}function Ih(n){function t(){let e;try{e=n()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}var Zo=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Tt=Zo;var Bo=class extends di{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;let i=this.listeners_||(this.listeners_={}),r=i[t]||(i[t]=[]);r.includes(e)||r.push(e)}dispatchEvent(t){let e=typeof t=="string",i=e?t:t.type,r=this.listeners_&&this.listeners_[i];if(!r)return;let s=e?new Tt(t):t;s.target||(s.target=this.eventTarget_||this);let o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=r.length;h<c;++h)if("handleEvent"in r[h]?l=r[h].handleEvent(s):l=r[h].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,$e);delete o[i]}return l}disposeInternal(){this.listeners_&&Ie(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;let i=this.listeners_[t];if(!i)return;let r=i.indexOf(e);r!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[r]=$e,++this.pendingRemovals_[t]):(i.splice(r,1),i.length===0&&delete this.listeners_[t]))}},fi=Bo;var xn=class extends fi{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(P.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){let i=t.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=K(this,t[s],e);return r}return K(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){let r=t.length;i=new Array(r);for(let s=0;s<r;++s)i[s]=mn(this,t[s],e)}else i=mn(this,t,e);return e.ol_key=i,i}unInternal(t,e){let i=e.ol_key;if(i)Sg(i);else if(Array.isArray(t))for(let r=0,s=t.length;r<s;++r)this.removeEventListener(t[r],e);else this.removeEventListener(t,e)}};xn.prototype.on;xn.prototype.once;xn.prototype.un;function Sg(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)J(n[t]);else J(n)}var ss=xn;function H(){throw new Error("Unimplemented abstract method.")}var Tg=0;function Y(n){return n.ol_uid||(n.ol_uid=String(++Tg))}var os=class extends Tt{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}},Vo=class extends ss{constructor(t){super(),this.on,this.once,this.un,Y(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new os(i,t,e)),i=ue.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new os(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){let r=this.values_||(this.values_={});if(i)r[t]=e;else{let s=r[t];r[t]=e,s!==e&&this.notify(t,s)}}setProperties(t,e){for(let i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){let i=this.values_[t];delete this.values_[t],de(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},xt=Vo;function B(n,t){if(!n)throw new Error(t)}var jo=class n extends xt{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){let e=t;this.setGeometry(e)}else{let e=t;this.setProperties(e)}}clone(){let t=new n,e=this.geometryName_;t.setGeometryName(e);let i=this.getPropertiesInternal();if(i){let s=this.getGeometry();for(let o in i)o===e&&s?t.set(o,s.clone()):t.set(o,i[o],!0)}let r=this.getStyle();return r&&t.setStyle(r),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(J(this.geometryChangeKey_),this.geometryChangeKey_=null);let t=this.getGeometry();t&&(this.geometryChangeKey_=K(t,P.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Ig(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function Ig(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(B(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}var lr=jo;var It={ADD:"add",REMOVE:"remove"};var Lh={LENGTH:"length"},yn=class extends Tt{constructor(t,e,i){super(t),this.element=e,this.index=i}},Ho=class extends xt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let i=1,r=this.array_.length;i<r;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){let e=this.array_;for(let i=0,r=e.length;i<r;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Lh.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new yn(It.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){let e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){let e=this.array_;for(let i=0,r=e.length;i<r;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;let e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new yn(It.REMOVE,e,t)),e}setAt(t,e){let i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);let r=this.array_[t];this.array_[t]=e,this.dispatchEvent(new yn(It.REMOVE,r,t)),this.dispatchEvent(new yn(It.ADD,e,t))}updateLength_(){this.set(Lh.LENGTH,this.array_.length)}assertUnique_(t,e){let i=this.array_;for(let r=0,s=i.length;r<s;++r)if(i[r]===t&&r!==e)throw new Error("Duplicate item added to a unique collection")}},Pt=Ho;var qo=class extends Tt{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}},gi=qo;var $o=class extends gi{constructor(t,e,i,r,s,o){super(t,e,s),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},Le=$o;var at={SINGLECLICK:"singleclick",CLICK:P.CLICK,DBLCLICK:P.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Yi=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Lg=Yi.includes("safari")&&!Yi.includes("chrom"),Vx=Lg&&(Yi.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Yi)),Ah=Yi.includes("webkit")&&!Yi.includes("edge"),Jo=Yi.includes("macintosh"),Mh=typeof devicePixelRatio<"u"?devicePixelRatio:1,bt=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Qo=typeof Image<"u"&&Image.prototype.decode;var as=(function(){let n=!1;try{let t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n})();var cr={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var ta=class extends fi{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;let i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=K(i,cr.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=K(i,cr.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_,as?{passive:!1}:!1)}emulateClick_(t){let e=new Le(at.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Le(at.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let i=new Le(at.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){let e=t,i=e.pointerId;if(e.type==at.POINTERUP||e.type==at.POINTERCANCEL){delete this.trackedTouches_[i];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==e.target){delete this.trackedTouches_[r];break}}else(e.type==at.POINTERDOWN||e.type==at.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);let e=new Le(at.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(J),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);let e=new Le(at.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){let i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(K(i,at.POINTERMOVE,this.handlePointerMove_,this),K(i,at.POINTERUP,this.handlePointerUp_,this),K(this.element_,at.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(K(this.element_.getRootNode(),at.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;let e=new Le(at.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;let e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new Le(at.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){let e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(J(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(J(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(J),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},Ph=ta;var Ae={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Ot={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var k={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};var hr=1/0,ea=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Ie(this.queuedElements_)}dequeue(){let t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));let r=this.keyFunction_(i);return delete this.queuedElements_[r],i}enqueue(t){B(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let e=this.priorityFunction_(t);return e!=hr?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){let e=this.elements_,i=this.priorities_,r=e.length,s=e[t],o=i[t],a=t;for(;t<r>>1;){let l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<r&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=s,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){let i=this.elements_,r=this.priorities_,s=i[e],o=r[e];for(;e>t;){let a=this.getParentIndex_(e);if(r[a]>o)i[e]=i[a],r[e]=r[a],e=a;else break}i[e]=s,r[e]=o}reprioritize(){let t=this.priorityFunction_,e=this.elements_,i=this.priorities_,r=0,s=e.length,o,a,l;for(a=0;a<s;++a)o=e[a],l=t(o),l==hr?delete this.queuedElements_[this.keyFunction_(o)]:(i[r]=l,e[r++]=o);e.length=r,i.length=r,this.heapify_()}},Oh=ea;var ia=class extends Oh{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){let e=super.enqueue(t);return e&&t[0].addEventListener(P.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){let e=t.target,i=e.getState();if(i===k.LOADED||i===k.ERROR||i===k.EMPTY){i!==k.ERROR&&e.removeEventListener(P.CHANGE,this.boundHandleTileChange_);let r=e.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===k.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++i,r.load())}}},kh=ia;function Dh(n,t,e,i,r){if(!n||!(e in n.wantedTiles))return hr;if(!n.wantedTiles[e][t.getKey()])return hr;let s=n.viewState.center,o=i[0]-s[0],a=i[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var Rt={ANIMATING:0,INTERACTING:1};var oe={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function et(n,t,e){return Math.min(Math.max(n,t),e)}function Fh(n,t,e,i,r,s){let o=r-e,a=s-i;if(o!==0||a!==0){let l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=r,i=s):l>0&&(e+=o*l,i+=a*l)}return ge(n,t,e,i)}function ge(n,t,e,i){let r=e-n,s=i-t;return r*r+s*s}function zh(n){let t=n.length;for(let i=0;i<t;i++){let r=i,s=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){let l=Math.abs(n[a][i]);l>s&&(s=l,r=a)}if(s===0)return null;let o=n[r];n[r]=n[i],n[i]=o;for(let a=i+1;a<t;a++){let l=-n[a][i]/n[i][i];for(let h=i;h<t+1;h++)i==h?n[a][h]=0:n[a][h]+=l*n[i][h]}}let e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let r=i-1;r>=0;r--)n[r][t]-=n[r][i]*e[i]}return e}function ls(n){return n*180/Math.PI}function pe(n){return n*Math.PI/180}function Me(n,t){let e=n%t;return e*t<0?e+t:e}function Nt(n,t,e){return n+e*(t-n)}function Ui(n,t){let e=Math.pow(10,t);return Math.round(n*e)/e}function ur(n,t){return Math.floor(Ui(n,t))}function dr(n,t){return Math.ceil(Ui(n,t))}function cs(n,t,e){if(n>=t&&n<e)return n;let i=e-t;return((n-t)%i+i)%i+t}function na(n,t,e){return(function(i,r,s,o,a){if(!i)return;if(!r&&!t)return i;let l=t?0:s[0]*r,h=t?0:s[1]*r,c=a?a[0]:0,u=a?a[1]:0,f=n[0]+l/2+c,g=n[2]-l/2+c,p=n[1]+h/2+u,_=n[3]-h/2+u;f>g&&(f=(g+f)/2,g=f),p>_&&(p=(_+p)/2,_=p);let m=et(i[0],f,g),x=et(i[1],p,_);if(o&&e&&r){let E=30*r;m+=-E*Math.log(1+Math.max(0,f-i[0])/E)+E*Math.log(1+Math.max(0,i[0]-g)/E),x+=-E*Math.log(1+Math.max(0,p-i[1])/E)+E*Math.log(1+Math.max(0,i[1]-_)/E)}return[m,x]})}function Nh(n){return n}var yt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ra(n){let t=ut();for(let e=0,i=n.length;e<i;++e)Bi(t,n[e]);return t}function Ag(n,t,e){let i=Math.min.apply(null,n),r=Math.min.apply(null,t),s=Math.max.apply(null,n),o=Math.max.apply(null,t);return Jt(i,r,s,o,e)}function En(n,t,e){return e?(e[0]=n[0]-t,e[1]=n[1]-t,e[2]=n[2]+t,e[3]=n[3]+t,e):[n[0]-t,n[1]-t,n[2]+t,n[3]+t]}function us(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function pi(n,t,e){let i,r;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?r=n[1]-e:n[3]<e?r=e-n[3]:r=0,i*i+r*r}function me(n,t){return fr(n,t[0],t[1])}function Pe(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function fr(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function hs(n,t){let e=n[0],i=n[1],r=n[2],s=n[3],o=t[0],a=t[1],l=yt.UNKNOWN;return o<e?l=l|yt.LEFT:o>r&&(l=l|yt.RIGHT),a<i?l=l|yt.BELOW:a>s&&(l=l|yt.ABOVE),l===yt.UNKNOWN&&(l=yt.INTERSECTING),l}function ut(){return[1/0,1/0,-1/0,-1/0]}function Jt(n,t,e,i,r){return r?(r[0]=n,r[1]=t,r[2]=e,r[3]=i,r):[n,t,e,i]}function Ki(n){return Jt(1/0,1/0,-1/0,-1/0,n)}function ds(n,t){let e=n[0],i=n[1];return Jt(e,i,e,i,t)}function wn(n,t,e,i,r){let s=Ki(r);return sa(s,n,t,e,i)}function Zi(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function fs(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function Bi(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function sa(n,t,e,i,r){for(;e<i;e+=r)Mg(n,t[e],t[e+1]);return n}function Mg(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function gs(n,t){let e;return e=t(Cn(n)),e||(e=t(vn(n)),e)||(e=t(bn(n)),e)||(e=t(ae(n)),e)?e:!1}function gr(n){let t=0;return ke(n)||(t=j(n)*ct(n)),t}function Cn(n){return[n[0],n[1]]}function vn(n){return[n[2],n[1]]}function Bt(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Gh(n,t){let e;if(t==="bottom-left")e=Cn(n);else if(t==="bottom-right")e=vn(n);else if(t==="top-left")e=ae(n);else if(t==="top-right")e=bn(n);else throw new Error("Invalid corner");return e}function pr(n,t,e,i,r){let[s,o,a,l,h,c,u,f]=oa(n,t,e,i);return Jt(Math.min(s,a,h,u),Math.min(o,l,c,f),Math.max(s,a,h,u),Math.max(o,l,c,f),r)}function oa(n,t,e,i){let r=t*i[0]/2,s=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=r*o,h=r*a,c=s*o,u=s*a,f=n[0],g=n[1];return[f-l+u,g-h-c,f-l-u,g-h+c,f+l-u,g+h+c,f+l+u,g+h-c,f-l+u,g-h-c]}function ct(n){return n[3]-n[1]}function Oe(n,t,e){let i=e||ut();return ht(n,t)?(n[0]>t[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]<t[2]?i[2]=n[2]:i[2]=t[2],n[3]<t[3]?i[3]=n[3]:i[3]=t[3]):Ki(i),i}function aa(n,t){if(!ht(n,t))return[n.slice()];if(Pe(t,n))return[];let[e,i,r,s]=n,o=Math.max(e,t[0]),a=Math.max(i,t[1]),l=Math.min(r,t[2]),h=Math.min(s,t[3]),c=[];return o>e&&c.push([e,i,o,s]),l<r&&c.push([l,i,r,s]),a>i&&c.push([o,i,l,a]),h<s&&c.push([o,h,l,s]),c}function ae(n){return[n[0],n[3]]}function bn(n){return[n[2],n[3]]}function j(n){return n[2]-n[0]}function ht(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function ke(n){return n[2]<n[0]||n[3]<n[1]}function Xh(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function Wh(n,t,e){let i=!1,r=hs(n,t),s=hs(n,e);if(r===yt.INTERSECTING||s===yt.INTERSECTING)i=!0;else{let o=n[0],a=n[1],l=n[2],h=n[3],c=t[0],u=t[1],f=e[0],g=e[1],p=(g-u)/(f-c),_,m;s&yt.ABOVE&&!(r&yt.ABOVE)&&(_=f-(g-h)/p,i=_>=o&&_<=l),!i&&s&yt.RIGHT&&!(r&yt.RIGHT)&&(m=g-(f-l)*p,i=m>=a&&m<=h),!i&&s&yt.BELOW&&!(r&yt.BELOW)&&(_=f-(g-a)/p,i=_>=o&&_<=l),!i&&s&yt.LEFT&&!(r&yt.LEFT)&&(m=g-(f-o)*p,i=m>=a&&m<=h)}return i}function Yh(n,t,e,i){if(ke(n))return Ki(e);let r=[];if(i>1){let a=n[2]-n[0],l=n[3]-n[1];for(let h=0;h<i;++h)r.push(n[0]+a*h/i,n[1],n[2],n[1]+l*h/i,n[2]-a*h/i,n[3],n[0],n[3]-l*h/i)}else r=[n[0],n[1],n[2],n[1],n[2],n[3],n[0],n[3]];t(r,r,2);let s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return Ag(s,o,e)}function la(n,t){let e=t.getExtent(),i=Bt(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){let r=j(e),o=Math.floor((i[0]-e[0])/r)*r;n[0]-=o,n[2]-=o}return n}function ps(n,t,e){if(t.canWrapX()){let i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];la(n,t);let r=j(i);if(j(n)>r&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+r,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-r,n[3]]]}return[n]}function Uh(n,t){let e=[n];for(let i=0,r=t.length;i<r&&e.length>0;++i){let s=[];for(let o=0,a=e.length;o<a;++o)s.push(...aa(e[o],t[i]));e=s}return e}function Kh(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function Vi(n,t){let e=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function Rn(n,t){let e=Math.cos(t),i=Math.sin(t),r=n[0]*e-n[1]*i,s=n[1]*e+n[0]*i;return n[0]=r,n[1]=s,n}function Zh(n,t){return n[0]*=t,n[1]*=t,n}function ms(n,t){if(t.canWrapX()){let e=j(t.getExtent()),i=Bh(n,t,e);i&&(n[0]-=i*e)}return n}function Bh(n,t,e){let i=t.getExtent(),r=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||j(i),r=Math.floor((n[0]-i[0])/e)),r}function Vh(n,t,e){let i=Math.sqrt((t[0]-n[0])*(t[0]-n[0])+(t[1]-n[1])*(t[1]-n[1])),r=[(t[0]-n[0])/i,(t[1]-n[1])/i],s=[-r[1],r[0]],o=Math.sqrt((e[0]-n[0])*(e[0]-n[0])+(e[1]-n[1])*(e[1]-n[1])),a=[(e[0]-n[0])/o,(e[1]-n[1])/o],l=i===0||o===0?0:Math.acos(et(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}function ca(n){return Math.pow(n,3)}function le(n){return 1-ca(1-n)}function jh(n){return 3*n*n-2*n*n*n}function Hh(n){return n}var Pg=63710088e-1;function ha(n,t,e){e=e||Pg;let i=pe(n[1]),r=pe(t[1]),s=(r-i)/2,o=pe(t[0]-n[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(r);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var qh={info:1,warn:2,error:3,none:4},Og=qh.info;function _s(...n){Og>qh.warn||console.warn(...n)}var Je={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var ua=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Je[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},mi=ua;var mr=6378137,Sn=Math.PI*mr,kg=[-Sn,-Sn,Sn,Sn],Dg=[-180,-85,180,85],xs=mr*Math.log(Math.tan(Math.PI/2)),_i=class extends mi{constructor(t){super({code:t,units:"m",extent:kg,global:!0,worldExtent:Dg,getPointResolution:function(e,i){return e/Math.cosh(i[1]/mr)}})}},da=[new _i("EPSG:3857"),new _i("EPSG:102100"),new _i("EPSG:102113"),new _i("EPSG:900913"),new _i("http://www.opengis.net/def/crs/EPSG/0/3857"),new _i("http://www.opengis.net/gml/srs/epsg.xml#3857")];function $h(n,t,e,i){let r=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(r));for(let s=0;s<r;s+=i){t[s]=Sn*n[s]/180;let o=mr*Math.log(Math.tan(Math.PI*(+n[s+1]+90)/360));o>xs?o=xs:o<-xs&&(o=-xs),t[s+1]=o}return t}function Jh(n,t,e,i){let r=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(r));for(let s=0;s<r;s+=i)t[s]=180*n[s]/Sn,t[s+1]=360*Math.atan(Math.exp(n[s+1]/mr))/Math.PI-90;return t}var Fg=6378137,Qh=[-180,-90,180,90],zg=Math.PI*Fg/180,Qe=class extends mi{constructor(t,e){super({code:t,units:"degrees",extent:Qh,axisOrientation:e,global:!0,metersPerUnit:zg,worldExtent:Qh})}},fa=[new Qe("CRS:84"),new Qe("EPSG:4326","neu"),new Qe("urn:ogc:def:crs:OGC:1.3:CRS84"),new Qe("urn:ogc:def:crs:OGC:2:84"),new Qe("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Qe("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Qe("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var ga={};function tu(n){return ga[n]||ga[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function eu(n,t){ga[n]=t}var Tn={};function In(n,t,e){let i=n.getCode(),r=t.getCode();i in Tn||(Tn[i]={}),Tn[i][r]=e}function ys(n,t){return n in Tn&&t in Tn[n]?Tn[n][t]:null}var Es=.9996,ce=.00669438,Cs=ce*ce,vs=Cs*ce,ji=ce/(1-ce),iu=Math.sqrt(1-ce),Ln=(1-iu)/(1+iu),ou=Ln*Ln,pa=ou*Ln,ma=pa*Ln,au=ma*Ln,lu=1-ce/4-3*Cs/64-5*vs/256,Ng=3*ce/8+3*Cs/32+45*vs/1024,Gg=15*Cs/256+45*vs/1024,Xg=35*vs/3072,Wg=3/2*Ln-27/32*pa+269/512*au,Yg=21/16*ou-55/32*ma,Ug=151/96*pa-417/128*au,Kg=1097/512*ma,ws=6378137;function Zg(n,t,e){let i=n-5e5,o=(e.north?t:t-1e7)/Es/(ws*lu),a=o+Wg*Math.sin(2*o)+Yg*Math.sin(4*o)+Ug*Math.sin(6*o)+Kg*Math.sin(8*o),l=Math.sin(a),h=l*l,c=Math.cos(a),u=l/c,f=u*u,g=f*f,p=1-ce*h,_=Math.sqrt(1-ce*h),m=ws/_,x=(1-ce)/p,E=ji*c**2,C=E*E,y=i/(m*Es),w=y*y,R=w*y,A=R*y,b=A*y,S=b*y,I=a-u/x*(w/2-A/24*(5+3*f+10*E-4*C-9*ji))+S/720*(61+90*f+298*E+45*g-252*ji-3*C),z=(y-R/6*(1+2*f+E)+b/120*(5-2*E+28*f-3*C+8*ji+24*g))/c;return z=cs(z+pe(cu(e.number)),-Math.PI,Math.PI),[ls(z),ls(I)]}var nu=-80,ru=84,Bg=-180,Vg=180;function jg(n,t,e){n=cs(n,Bg,Vg),t<nu?t=nu:t>ru&&(t=ru);let i=pe(t),r=Math.sin(i),s=Math.cos(i),o=r/s,a=o*o,l=a*a,h=pe(n),c=cu(e.number),u=pe(c),f=ws/Math.sqrt(1-ce*r**2),g=ji*s**2,p=s*cs(h-u,-Math.PI,Math.PI),_=p*p,m=_*p,x=m*p,E=x*p,C=E*p,y=ws*(lu*i-Ng*Math.sin(2*i)+Gg*Math.sin(4*i)-Xg*Math.sin(6*i)),w=Es*f*(p+m/6*(1-a+g)+E/120*(5-18*a+l+72*g-58*ji))+5e5,R=Es*(y+f*o*(_/2+x/24*(5-a+9*g+4*g**2)+C/720*(61-58*a+l+600*g-330*ji)));return e.north||(R+=1e7),[w,R]}function cu(n){return(n-1)*6-180+3}var Hg=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function hu(n){let t=0;for(let r of Hg){let s=n.match(r);if(s){t=parseInt(s[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function su(n,t){return function(e,i,r,s){let o=e.length;r=r>1?r:2,s=s??r,i||(r>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=s){let l=e[a],h=e[a+1],c=n(l,h,t);i[a]=c[0],i[a+1]=c[1]}return i}}function uu(n){return hu(n)?new mi({code:n,units:"m"}):null}function du(n){let t=hu(n.getCode());return t?{forward:su(jg,t),inverse:su(Zg,t)}:null}var qg=[du],$g=[uu];var xa=!0;function gu(n){xa=!(n===void 0?!0:n)}function Ea(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function ya(n){eu(n.getCode(),n),In(n,n,Ea)}function Jg(n){n.forEach(ya)}function Et(n){if(typeof n!="string")return n;let t=tu(n);if(t)return t;for(let e of $g){let i=e(n);if(i)return i}return null}function wa(n,t,e,i){n=Et(n);let r,s=n.getPointResolutionFunc();if(s){if(r=s(t,e),i&&i!==n.getUnits()){let o=n.getMetersPerUnit();o&&(r=r*o/Je[i])}}else{let o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")r=t;else{let a=Hi(n,Et("EPSG:4326"));if(!a&&o!=="degrees")r=t*n.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);let c=ha(h.slice(0,2),h.slice(2,4)),u=ha(h.slice(4,6),h.slice(6,8));r=(c+u)/2}let l=i?Je[i]:n.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function fu(n){Jg(n),n.forEach(function(t){n.forEach(function(e){t!==e&&In(t,e,Ea)})})}function Qg(n,t,e,i){n.forEach(function(r){t.forEach(function(s){In(r,s,e),In(s,r,i)})})}function bs(n,t){return n?typeof n=="string"?Et(n):n:Et(t)}function pu(n){return(function(t,e,i,r){let s=t.length;i=i!==void 0?i:2,r=r??i,e=e!==void 0?e:new Array(s);for(let o=0;o<s;o+=r){let a=n(t.slice(o,o+i)),l=a.length;for(let h=0,c=r;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e})}function An(n,t){if(n===t)return!0;let e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||Hi(n,t)===Ea)&&e}function Hi(n,t){let e=n.getCode(),i=t.getCode(),r=ys(e,i);if(r)return r;let s=null,o=null;for(let l of qg)s||(s=l(n)),o||(o=l(t));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=_a(s.inverse,o.forward);else{let l=ys(e,a);l&&(r=_a(l,o.forward))}else{let l=ys(a,i);l&&(r=_a(s.inverse,l))}return r&&(ya(n),ya(t),In(n,t,r)),r}function _a(n,t){return function(e,i,r,s){return i=n(e,i,r,s),t(i,i,r,s)}}function qi(n,t){let e=Et(n),i=Et(t);return Hi(e,i)}function Mn(n,t,e){let i=qi(t,e);if(!i){let r=Et(t).getCode(),s=Et(e).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return i(n,void 0,n.length)}function mu(n,t,e,i){let r=qi(t,e);return Yh(n,r,void 0,i)}var _e=null;function $i(){return _e}function _r(n,t){return _e?Mn(n,t,_e):n}function xe(n,t){return _e?Mn(n,_e,t):(xa&&!Vi(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(xa=!1,_s("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n)}function xi(n,t){return _e?mu(n,t,_e):n}function ye(n,t){return _e?mu(n,_e,t):n}function _u(n,t){if(!_e)return n;let e=Et(t).getMetersPerUnit(),i=_e.getMetersPerUnit();return e&&i?n*e/i:n}function tp(){fu(da),fu(fa),Qg(fa,da,$h,Jh)}tp();var ep=[1,0,0,1,0,0],ey=new Array(6);function Lt(){return ep.slice(0)}function xu(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function dt(n,t){let e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function kt(n,t,e,i,r,s,o,a){let l=Math.sin(s),h=Math.cos(s);return n[0]=i*h,n[1]=r*l,n[2]=-i*l,n[3]=r*h,n[4]=o*i*h-a*i*l+t,n[5]=o*r*l+a*r*h+e,n}function Ss(n,t){let e=ip(t);B(e!==0,"Transformation matrix cannot be inverted");let i=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5];return n[0]=o/e,n[1]=-r/e,n[2]=-s/e,n[3]=i/e,n[4]=(s*l-o*a)/e,n[5]=-(i*l-r*a)/e,n}function ip(n){return n[0]*n[3]-n[1]*n[2]}var np=[1e5,1e5,1e5,1e5,2,2];function yu(n){return"matrix("+n.join(", ")+")"}function Rs(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function Eu(n,t){let e=Rs(n),i=Rs(t);for(let r=0;r<6;++r)if(Math.round((e[r]-i[r])*np[r])!==0)return!1;return!0}function Vt(n,t,e,i,r,s,o){s=s||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){let h=n[l],c=n[l+1];s[a++]=r[0]*h+r[2]*c+r[4],s[a++]=r[1]*h+r[3]*c+r[5];for(let u=2;u<o;u++)s[a++]=n[l+u]}return s&&s.length!=a&&(s.length=a),s}function Ts(n,t,e,i,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),h=s[0],c=s[1],u=0;for(let f=t;f<e;f+=i){let g=n[f]-h,p=n[f+1]-c;o[u++]=h+g*a-p*l,o[u++]=c+g*l+p*a;for(let _=f+2;_<f+i;++_)o[u++]=n[_]}return o&&o.length!=u&&(o.length=u),o}function wu(n,t,e,i,r,s,o,a){a=a||[];let l=o[0],h=o[1],c=0;for(let u=t;u<e;u+=i){let f=n[u]-l,g=n[u+1]-h;a[c++]=l+r*f,a[c++]=h+s*g;for(let p=u+2;p<u+i;++p)a[c++]=n[p]}return a&&a.length!=c&&(a.length=c),a}function Cu(n,t,e,i,r,s,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+r,o[a++]=n[l+1]+s;for(let h=l+2;h<l+i;++h)o[a++]=n[h]}return o&&o.length!=a&&(o.length=a),o}var vu=Lt(),rp=[NaN,NaN],Ca=class extends xt{constructor(){super(),this.extent_=ut(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=rs((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);let r=this.clone();return r.applyTransform(i),r.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return H()}closestPointXY(t,e,i,r){return H()}containsXY(t,e){return this.closestPointXY(t,e,rp,Number.MIN_VALUE)===0}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return H()}getExtent(t){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Ki(e),this.extentRevision_=this.getRevision()}return Xh(this.extent_,t)}rotate(t,e){H()}scale(t,e,i){H()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return H()}getType(){return H()}applyTransform(t){H()}intersectsExtent(t){return H()}translate(t,e){H()}transform(t,e){let i=Et(t),r=i.getUnits()=="tile-pixels"?function(s,o,a){let l=i.getExtent(),h=i.getWorldExtent(),c=ct(h)/ct(l);kt(vu,h[0],h[3],c,-c,0,0,0);let u=Vt(s,0,s.length,a,vu,o),f=qi(i,e);return f?f(u,u,a):u}:qi(i,e);return this.applyTransform(r),this}},bu=Ca;var va=class extends bu{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return wn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return H()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Ru(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){H()}setLayout(t,e,i){let r;if(t)r=Ru(t);else{for(let s=0;s<i;++s){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}r=e.length,t=sp(r)}this.layout=t,this.stride=r}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){let i=this.getFlatCoordinates();if(i){let r=this.getStride();Ts(i,0,i.length,r,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=Bt(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();wu(r,0,r.length,s,t,e,i,r),this.changed()}}translate(t,e){let i=this.getFlatCoordinates();if(i){let r=this.getStride();Cu(i,0,i.length,r,t,e,i),this.changed()}}};function sp(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function Ru(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function Su(n,t,e){let i=n.getFlatCoordinates();if(!i)return null;let r=n.getStride();return Vt(i,0,i.length,r,t,e)}var De=va;function ba(n,t,e,i){let r=0,s=n[e-i],o=n[e-i+1],a=0,l=0;for(;t<e;t+=i){let h=n[t]-s,c=n[t+1]-o;r+=l*h-a*c,a=h,l=c}return r/2}function Ra(n,t,e,i){let r=0;for(let s=0,o=e.length;s<o;++s){let a=e[s];r+=ba(n,t,a,i),t=a}return r}function Tu(n,t,e,i){let r=0;for(let s=0,o=e.length;s<o;++s){let a=e[s];r+=Ra(n,t,a,i),t=a[a.length-1]}return r}function Iu(n,t,e,i,r,s,o){let a=n[t],l=n[t+1],h=n[e]-a,c=n[e+1]-l,u;if(h===0&&c===0)u=t;else{let f=((r-a)*h+(s-l)*c)/(h*h+c*c);if(f>1)u=e;else if(f>0){for(let g=0;g<i;++g)o[g]=Nt(n[t+g],n[e+g],f);o.length=i;return}else u=t}for(let f=0;f<i;++f)o[f]=n[u+f];o.length=i}function Sa(n,t,e,i,r){let s=n[t],o=n[t+1];for(t+=i;t<e;t+=i){let a=n[t],l=n[t+1],h=ge(s,o,a,l);h>r&&(r=h),s=a,o=l}return r}function Ta(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];r=Sa(n,t,a,i,r),t=a}return r}function Lu(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];r=Ta(n,t,a,i,r),t=a[a.length-1]}return r}function Ia(n,t,e,i,r,s,o,a,l,h,c){if(t==e)return h;let u,f;if(r===0){if(f=ge(o,a,n[t],n[t+1]),f<h){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,f}return h}c=c||[NaN,NaN];let g=t+i;for(;g<e;)if(Iu(n,g-i,g,i,o,a,c),f=ge(o,a,c[0],c[1]),f<h){for(h=f,u=0;u<i;++u)l[u]=c[u];l.length=i,g+=i}else g+=i*Math.max((Math.sqrt(f)-Math.sqrt(h))/r|0,1);if(s&&(Iu(n,e-i,t,i,o,a,c),f=ge(o,a,c[0],c[1]),f<h)){for(h=f,u=0;u<i;++u)l[u]=c[u];l.length=i}return h}function La(n,t,e,i,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,f=e.length;u<f;++u){let g=e[u];h=Ia(n,t,g,i,r,s,o,a,l,h,c),t=g}return h}function Au(n,t,e,i,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,f=e.length;u<f;++u){let g=e[u];h=La(n,t,g,i,r,s,o,a,l,h,c),t=g[g.length-1]}return h}function Mu(n,t,e,i){for(let r=0,s=e.length;r<s;++r)n[t++]=e[r];return t}function xr(n,t,e,i){for(let r=0,s=e.length;r<s;++r){let o=e[r];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function Aa(n,t,e,i,r){r=r||[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=xr(n,t,e[o],i);r[s++]=l,t=l}return r.length=s,r}function Pu(n,t,e,i,r){r=r||[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=Aa(n,t,e[o],i,r[s]);l.length===0&&(l[0]=t),r[s++]=l,t=l[l.length-1]}return r.length=s,r}function Fe(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=t;o<e;o+=i)r[s++]=n.slice(o,o+i);return r.length=s,r}function Pn(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=e[o];r[s++]=Fe(n,t,l,i,r[s]),t=l}return r.length=s,r}function yr(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=e[o];r[s++]=l.length===1&&l[0]===t?[]:Pn(n,t,l,i,r[s]),t=l[l.length-1]}return r.length=s,r}function Ou(n,t,e,i,r){return!gs(r,function(o){return!yi(n,t,e,i,o[0],o[1])})}function yi(n,t,e,i,r,s){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){let h=n[t],c=n[t+1];l<=s?c>s&&(h-a)*(s-l)-(r-a)*(c-l)>0&&o++:c<=s&&(h-a)*(s-l)-(r-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function Er(n,t,e,i,r,s){if(e.length===0||!yi(n,t,e[0],i,r,s))return!1;for(let o=1,a=e.length;o<a;++o)if(yi(n,e[o-1],e[o],i,r,s))return!1;return!0}function ku(n,t,e,i,r,s){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){let l=e[o];if(Er(n,t,l,i,r,s))return!0;t=l[l.length-1]}return!1}function Du(n,t,e,i,r){let s;for(t+=i;t<e;t+=i)if(s=r(n.slice(t-i,t),n.slice(t,t+i)),s)return s;return!1}function Is(n,t,e,i,r,s){return s=s??sa(ut(),n,t,e,i),ht(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Du(n,t,e,i,function(o,a){return Wh(r,o,a)}):!1}function Ma(n,t,e,i,r){return!!(Is(n,t,e,i,r)||yi(n,t,e,i,r[0],r[1])||yi(n,t,e,i,r[0],r[3])||yi(n,t,e,i,r[2],r[1])||yi(n,t,e,i,r[2],r[3]))}function Pa(n,t,e,i,r){if(!Ma(n,t,e[0],i,r))return!1;if(e.length===1)return!0;for(let s=1,o=e.length;s<o;++s)if(Ou(n,e[s-1],e[s],i,r)&&!Is(n,e[s-1],e[s],i,r))return!1;return!0}function Fu(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];if(Pa(n,t,a,i,r))return!0;t=a[a.length-1]}return!1}function wr(n,t,e,i,r,s,o){let a=(e-t)/i;if(a<3){for(;t<e;t+=i)s[o++]=n[t],s[o++]=n[t+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let h=[t,e-i],c=0;for(;h.length>0;){let u=h.pop(),f=h.pop(),g=0,p=n[f],_=n[f+1],m=n[u],x=n[u+1];for(let E=f+i;E<u;E+=i){let C=n[E],y=n[E+1],w=Fh(C,y,p,_,m,x);w>g&&(c=E,g=w)}g>r&&(l[(c-t)/i]=1,f+i<c&&h.push(f,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(s[o++]=n[t+u*i],s[o++]=n[t+u*i+1]);return o}function zu(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){let c=e[l];o=wr(n,t,c,i,r,s,o),a.push(o),t=c}return o}function Ei(n,t){return t*Math.round(n/t)}function op(n,t,e,i,r,s,o){if(t==e)return o;let a=Ei(n[t],r),l=Ei(n[t+1],r);t+=i,s[o++]=a,s[o++]=l;let h,c;do if(h=Ei(n[t],r),c=Ei(n[t+1],r),t+=i,t==e)return s[o++]=h,s[o++]=c,o;while(h==a&&c==l);for(;t<e;){let u=Ei(n[t],r),f=Ei(n[t+1],r);if(t+=i,u==h&&f==c)continue;let g=h-a,p=c-l,_=u-a,m=f-l;if(g*m==p*_&&(g<0&&_<g||g==_||g>0&&_>g)&&(p<0&&m<p||p==m||p>0&&m>p)){h=u,c=f;continue}s[o++]=h,s[o++]=c,a=h,l=c,h=u,c=f}return s[o++]=h,s[o++]=c,o}function Cr(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){let c=e[l];o=op(n,t,c,i,r,s,o),a.push(o),t=c}return o}function Nu(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){let c=e[l],u=[];o=Cr(n,t,c,i,r,s,o,u),a.push(u),t=c[c.length-1]}return o}var Oa=class n extends De{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new n(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,r){return r<pi(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Sa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ia(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,r))}getArea(){return ba(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Fe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let e=[];return e.length=wr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new n(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return Is(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xr(this.flatCoordinates,0,t,this.stride),this.changed()}},ka=Oa;var Da=class n extends De{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){let t=new n(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,r){let s=this.flatCoordinates,o=ge(t,e,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)i[l]=s[l];return i.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return ds(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return fr(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Mu(this.flatCoordinates,0,t,this.stride),this.changed()}},wi=Da;function vr(n,t,e,i,r,s,o){let a,l,h,c,u,f,g,p=r[s+1],_=[];for(let E=0,C=e.length;E<C;++E){let y=e[E];for(c=n[y-i],f=n[y-i+1],a=t;a<y;a+=i)u=n[a],g=n[a+1],(p<=f&&g<=p||f<=p&&p<=g)&&(h=(p-f)/(g-f)*(u-c)+c,_.push(h)),c=u,f=g}let m=NaN,x=-1/0;for(_.sort(Zt),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];let E=Math.abs(u-c);E>x&&(h=(c+u)/2,Er(n,t,e,i,h,p)&&(m=h,x=E)),c=u}return isNaN(m)&&(m=r[s]),o?(o.push(m,p,x),o):[m,p,x]}function Ls(n,t,e,i,r){let s=[];for(let o=0,a=e.length;o<a;++o){let l=e[o];s=vr(n,t,l,i,r,2*o,s),t=l[l.length-1]}return s}function Gu(n,t,e,i){for(;t<e-i;){for(let r=0;r<i;++r){let s=n[t+r];n[t+r]=n[e-i+r],n[e-i+r]=s}t+=i,e-=i}}function Fa(n,t,e,i){let r=0,s=n[e-i],o=n[e-i+1];for(;t<e;t+=i){let a=n[t],l=n[t+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function za(n,t,e,i,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){let a=e[s],l=Fa(n,t,a,i);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;t=a}return!0}function Xu(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];if(!za(n,t,a,i,r))return!1;a.length&&(t=a[a.length-1])}return!0}function As(n,t,e,i,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){let a=e[s],l=Fa(n,t,a,i);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Gu(n,t,a,i),t=a}return t}function Na(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s)t=As(n,t,e[s],i,r);return t}function Wu(n,t){let e=[],i=0,r=0,s;for(let o=0,a=t.length;o<a;++o){let l=t[o],h=Fa(n,i,l,2);if(s===void 0&&(s=h),h===s)e.push(t.slice(r,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[r])}r=o+1,i=l}return e}var Ms=class n extends De{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?fe(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new n(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,r){return r<pi(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ta(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),La(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,r))}containsXY(t,e){return Er(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Ra(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),As(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Pn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let t=Bt(this.getExtent());this.flatInteriorPoint_=vr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new wi(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new ka(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){let t=this.layout,e=this.flatCoordinates,i=this.ends_,r=[],s=0;for(let o=0,a=i.length;o<a;++o){let l=i[o],h=new ka(e.slice(s,l),t);r.push(h),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;za(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=As(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let e=[],i=[];return e.length=Cr(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new n(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Pa(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);let i=Aa(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}},Ci=Ms;function Ga(n){if(ke(n))throw new Error("Cannot create polygon from empty extent");let t=n[0],e=n[1],i=n[2],r=n[3],s=[t,e,t,r,i,r,i,e,t,e];return new Ms(s,"XY",[s.length])}function Xa(n,t,e,i){let r=j(t)/e[0],s=ct(t)/e[1];return i?Math.min(n,Math.max(r,s)):Math.min(n,Math.min(r,s))}function Wa(n,t,e){let i=Math.min(n,t),r=50;return i*=Math.log(1+r*Math.max(0,n/t-1))/r+1,e&&(i=Math.max(i,e),i/=Math.log(1+r*Math.max(0,e/n-1))/r+1),et(i,e/2,t*2)}function Yu(n,t,e,i){return t=t!==void 0?t:!0,(function(r,s,o,a){if(r!==void 0){let l=n[0],h=n[n.length-1],c=e?Xa(l,e,o,i):l;if(a)return t?Wa(r,c,h):et(r,h,c);let u=Math.min(c,r),f=Math.floor(_n(n,u,s));return n[f]>c&&f<n.length-1?n[f+1]:n[f]}})}function Uu(n,t,e,i,r,s){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,h){if(o!==void 0){let c=r?Xa(t,r,l,s):t;if(h)return i?Wa(o,c,e):et(o,e,c);let u=1e-9,f=Math.ceil(Math.log(t/c)/Math.log(n)-u),g=-a*(.5-u)+.5,p=Math.min(c,o),_=Math.floor(Math.log(t/p)/Math.log(n)+g),m=Math.max(f,_),x=t/Math.pow(n,m);return et(x,e,c)}})}function Ya(n,t,e,i,r){return e=e!==void 0?e:!0,(function(s,o,a,l){if(s!==void 0){let h=i?Xa(n,i,a,r):n;return!e||!l?et(s,t,h):Wa(s,h,t)}})}function On(n){if(n!==void 0)return 0}function Ua(n){if(n!==void 0)return n}function Ku(n){let t=2*Math.PI/n;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function Zu(n){let t=n===void 0?pe(5):n;return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}var Ka=0,Ba=class extends xt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=bs(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&gu(),t.center&&(t.center=xe(t.center,this.projection_)),t.extent&&(t.extent=ye(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){let e=Object.assign({},t);for(let a in oe)delete e[a];this.setProperties(e,!0);let i=lp(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;let r=ap(t),s=i.constraint,o=cp(t);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;let i=this.getCenterInternal();if(i){let r=t||[0,0,0,0];e=e||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-e[3]+e[1]-r[1]),a=s/2*(r[0]-e[0]+e[2]-r[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){let e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let e=new Array(arguments.length);for(let i=0;i<e.length;++i){let r=arguments[i];r.center&&(r=Object.assign({},r),r.center=xe(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=xe(r.anchor,this.getProjection())),e[i]=r}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let r=0;for(;r<e&&!this.isDef();++r){let c=arguments[r];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(r===e){i&&Ps(i,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,h=[];for(;r<e;++r){let c=arguments[r],u={start:s,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||jh,callback:i};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;let f=Me(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+f,l=u.targetRotation}hp(u)?u.complete=!0:s+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(Rt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Rt.ANIMATING]>0}getInteracting(){return this.hints_[Rt.INTERACTING]>0}cancelAnimations(){this.setHint(Rt.ANIMATING,-this.hints_[Rt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){let r=this.animations_[e];if(r[0].callback&&Ps(r[0].callback,!1),!t)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let t=Date.now(),e=!1;for(let i=this.animations_.length-1;i>=0;--i){let r=this.animations_[i],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let h=t-l.start,c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):s=!1;let u=l.easing(c);if(l.sourceCenter){let f=l.sourceCenter[0],g=l.sourceCenter[1],p=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;let m=f+u*(p-f),x=g+u*(_-g);this.targetCenter_=[m,x]}if(l.sourceResolution&&l.targetResolution){let f=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){let g=this.getViewportSize_(this.getRotation()),p=this.constraints_.resolution(f,0,g,!0);this.targetCenter_=this.calculateCenterZoom(p,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=f,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let f=u===1?Me(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){let g=this.constraints_.rotation(f,!0);this.targetCenter_=this.calculateCenterRotate(g,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=f}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(s){this.animations_[i]=null,this.setHint(Rt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&Ps(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i,r=this.getCenterInternal();return r!==void 0&&(i=[r[0]-e[0],r[1]-e[1]],Rn(i,t-this.getRotation()),Kh(i,e)),i}calculateCenterZoom(t,e){let i,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=e[0]-t*(e[0]-r[0])/s,a=e[1]-t*(e[1]-r[1])/s;i=[o,a]}return i}getViewportSize_(t){let e=this.viewportSize_;if(t){let i=e[0],r=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(r*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(r*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let t=this.getCenterInternal();return t&&_r(t,this.getProjection())}getCenterInternal(){return this.get(oe.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){let e=this.calculateExtentInternal(t);return xi(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();let e=this.getCenterInternal();B(e,"The view center is not defined");let i=this.getResolution();B(i!==void 0,"The view resolution is not defined");let r=this.getRotation();return B(r!==void 0,"The view rotation is not defined"),pr(e,i,r,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(oe.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(ye(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();let i=j(t)/e[0],r=ct(t)/e[1];return Math.max(i,r)}getResolutionForValueFunction(t){t=t||2;let e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,r=Math.log(e/i)/Math.log(t);return(function(s){return e/Math.pow(t,s*r)})}getRotation(){return this.get(oe.ROTATION)}getValueForResolutionFunction(t){let e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(i/r)/e;return(function(o){return Math.log(i/o)/e/s})}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t),i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){let t=this.getProjection(),e=this.getResolution(),i=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=Za(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],e,i)}return{center:r.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t,e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,r;if(this.resolutions_){let s=_n(this.resolutions_,t,1);e=s,i=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=i/this.resolutions_[s+1]}else i=this.maxResolution_,r=this.zoomFactor_;return e+Math.log(i/t)/Math.log(r)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let e=et(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,et(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(B(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){B(!ke(t),"Cannot fit empty extent provided as `geometry`");let r=ye(t,this.getProjection());i=Ga(r)}else if(t.getType()==="Circle"){let r=ye(t.getExtent(),this.getProjection());i=Ga(r),i.rotate(this.getRotation(),Bt(r))}else{let r=$i();r?i=t.clone().transform(r,this.getProjection()):i=t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){let e=this.getRotation(),i=Math.cos(e),r=Math.sin(-e),s=t.getFlatCoordinates(),o=t.getStride(),a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,f=s.length;u<f;u+=o){let g=s[u]*i-s[u+1]*r,p=s[u]*r+s[u+1]*i;a=Math.min(a,g),l=Math.min(l,p),h=Math.max(h,g),c=Math.max(c,p)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());let r=e.padding!==void 0?e.padding:[0,0,0,0],s=e.nearest!==void 0?e.nearest:!1,o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;let a=this.rotatedExtentForGeometry(t),l=this.getResolutionForExtentInternal(a,[i[0]-r[1]-r[3],i[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),f=Bt(a);f[0]+=(r[1]-r[3])/2*l,f[1]+=(r[0]-r[2])/2*l;let g=f[0]*u-f[1]*c,p=f[1]*u+f[0]*c,_=this.getConstrainedCenter([g,p],l),m=e.callback?e.callback:$e;e.duration!==void 0?this.animateInternal({resolution:l,center:_,duration:e.duration,easing:e.easing},m):(this.targetResolution_=l,this.targetCenter_=_,this.applyTargetState_(!1,!0),Ps(m,!0))}centerOn(t,e,i){this.centerOnInternal(xe(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Za(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,r){let s,o=this.padding_;if(o&&t){let a=this.getViewportSizeMinusPadding_(-i),l=Za(t,r,[a[0]/2+o[3],a[1]/2+o[0]],e,i);s=[t[0]-l[0],t[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){let e=_r(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){let e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&xe(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){let i=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,r,i);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=xe(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){let i=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(r,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&xe(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){let i=this.getAnimating()||this.getInteracting()||e,r=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,i),a=this.constraints_.center(this.targetCenter_,o,s,i,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(oe.ROTATION)!==r&&this.set(oe.ROTATION,r),this.get(oe.RESOLUTION)!==o&&(this.set(oe.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(oe.CENTER)||!Vi(this.get(oe.CENTER),a))&&this.set(oe.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;let r=e||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!Vi(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:t,easing:le,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Rt.INTERACTING,1)}endInteraction(t,e,i){i=i&&xe(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(Rt.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){let i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){let i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;let i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}};function Ps(n,t){setTimeout(function(){n(t)},0)}function ap(n){if(n.extent!==void 0){let e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return na(n.extent,n.constrainOnlyCenter,e)}let t=bs(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,na(e,!1,!1)}return Nh}function lp(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:Ka,a=n.maxZoom!==void 0?n.maxZoom:28,l=n.zoomFactor!==void 0?n.zoomFactor:2,h=n.multiWorld!==void 0?n.multiWorld:!1,c=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,u=n.showFullExtent!==void 0?n.showFullExtent:!1,f=bs(n.projection,"EPSG:3857"),g=f.getExtent(),p=n.constrainOnlyCenter,_=n.extent;if(!h&&!_&&f.isGlobal()&&(p=!1,_=g),n.resolutions!==void 0){let m=n.resolutions;e=m[o],i=m[a]!==void 0?m[a]:m[m.length-1],n.constrainResolution?t=Yu(m,c,!p&&_,u):t=Ya(e,i,c,!p&&_,u)}else{let x=(g?Math.max(j(g),ct(g)):360*Je.degrees/f.getMetersPerUnit())/256/Math.pow(2,Ka),E=x/Math.pow(2,28-Ka);e=n.maxResolution,e!==void 0?o=0:e=x/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=x/Math.pow(l,a):i=E),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=Uu(l,e,i,c,!p&&_,u):t=Ya(e,i,c,!p&&_,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function cp(n){if(n.enableRotation!==void 0?n.enableRotation:!0){let e=n.constrainRotation;return e===void 0||e===!0?Zu():e===!1?Ua:typeof e=="number"?Ku(e):Ua}return On}function hp(n){return!(n.sourceCenter&&n.targetCenter&&!Vi(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function Za(n,t,e,i,r){let s=Math.cos(-r),o=Math.sin(-r),a=n[0]*s-n[1]*o,l=n[1]*s+n[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;let h=a*s-l*o,c=l*s+a*o;return[h,c]}var Qt=Ba;var br="ol-hidden";var vi="ol-unselectable";var kn="ol-control",Va="ol-collapsed",up=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),Vu=["style","variant","weight","size","lineHeight","family"],Os={normal:400,bold:700},ks=function(n){let t=n.match(up);if(!t)return null;let e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,r=Vu.length;i<r;++i){let s=t[i+1];s!==void 0&&(e[Vu[i]]=typeof s=="string"?s.trim():s)}return isNaN(Number(e.weight))&&e.weight in Os&&(e.weight=Os[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e};function nt(n,t,e,i){let r;return e&&e.length?r=e.shift():bt?r=new class extends OffscreenCanvas{style={}}(n??300,t??150):r=document.createElement("canvas"),n&&(r.width=n),t&&(r.height=t),r.getContext("2d",i)}var ja;function Rr(){return ja||(ja=nt(1,1)),ja}function Ji(n){let t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function Ha(n,t){let e=t.parentNode;e&&e.replaceChild(n,t)}function ju(n){for(;n.lastChild;)n.lastChild.remove()}function Hu(n,t){let e=n.childNodes;for(let i=0;;++i){let r=e[i],s=t[i];if(!r&&!s)break;if(r!==s){if(!r){n.appendChild(s);continue}if(!s){n.removeChild(r),--i;continue}n.insertBefore(s,r)}}}function Ds(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){let e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){let i=this.childNodes.indexOf(e);if(i===-1)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}})}function te(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}var qa=class extends xt{constructor(t){super();let e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,i=this.listenerKeys.length;e<i;++e)J(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){let e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==$e&&this.listenerKeys.push(K(t,Ae.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}},Dn=qa;var $a=class extends Dn{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;let e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",r=t.expandClassName!==void 0?t.expandClassName:e+"-expand",s=t.collapseLabel!==void 0?t.collapseLabel:"\u203A",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(P.CLICK,this.handleClick_.bind(this),!1);let h=e+" "+vi+" "+kn+(this.collapsed_&&this.collapsible_?" "+Va:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){let e=this.getMap().getAllLayers(),i=new Set(e.flatMap(r=>r.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>i.add(r)):i.add(this.attributions_)),!this.overrideCollapsible_){let r=!e.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let e=await Promise.all(this.collectSourceAttributions_(t).map(r=>Ih(()=>r))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!zt(e,this.renderedAttributions_)){ju(this.ulElement_);for(let r=0,s=e.length;r<s;++r){let o=document.createElement("li");o.innerHTML=e[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Va),this.collapsed_?Ha(this.collapseLabel_,this.label_):Ha(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}},qu=$a;var Ja=class extends Dn{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});let e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"\u21E7",r=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(r));let s=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(P.CLICK,this.handleClick_.bind(this),!1);let a=e+" "+vi+" "+kn,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(br)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let e=this.getMap().getView();if(!e)return;let i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:le}):e.setRotation(0))}render(t){let e=t.frameState;if(!e)return;let i=e.viewState.rotation;if(i!=this.rotation_){let r="rotate("+i+"rad)";if(this.autoHide_){let s=this.element.classList.contains(br);!s&&i===0?this.element.classList.add(br):s&&i!==0&&this.element.classList.remove(br)}this.label_.style.transform=r}this.rotation_=i}},$u=Ja;var Qa=class extends Dn{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});let e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,r=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",s=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"\u2013",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=r,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(P.CLICK,this.handleClick_.bind(this,i),!1);let u=document.createElement("button");u.className=s,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(P.CLICK,this.handleClick_.bind(this,-i),!1);let f=e+" "+vi+" "+kn,g=this.element;g.className=f,g.appendChild(c),g.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){let i=this.getMap().getView();if(!i)return;let r=i.getZoom();if(r!==void 0){let s=i.getConstrainedZoom(r+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:s,duration:this.duration_,easing:le})):i.setZoom(s)}}},Ju=Qa;function Fs(n){n=n||{};let t=new Pt;return(n.zoom===void 0||n.zoom)&&t.push(new Ju(n.zoomOptions)),(n.rotate===void 0||n.rotate)&&t.push(new $u(n.rotateOptions)),(n.attribution===void 0||n.attribution)&&t.push(new qu(n.attributionOptions)),t}var tl=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;let t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;let r=this.points_[e+2]-this.points_[i+2];if(r<1e3/60)return!1;let s=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},Qu=tl;var el={ACTIVE:"active"};var il=class extends xt{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(el.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(el.ACTIVE,t)}setMap(t){this.map_=t}};function td(n,t,e){let i=n.getCenterInternal();if(i){let r=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:Hh,center:n.getConstrainedCenter(r)})}}function Fn(n,t,e,i){let r=n.getZoom();if(r===void 0)return;let s=n.getConstrainedZoom(r+t),o=n.getResolutionForZoom(s);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:le})}var ze=il;var nl=class extends ze{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==at.DBLCLICK){let i=t.originalEvent,r=t.map,s=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=r.getView();Fn(a,o,s,this.duration_),i.preventDefault(),e=!0}return!e}},ed=nl;function Sr(n){let t=arguments;return function(e){let i=!0;for(let r=0,s=t.length;r<s&&(i=i&&t[r](e),!!i);++r);return i}}var id=function(n){let t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},dp=function(n){let t=n.map.getTargetElement(),e=t.getRootNode(),i=n.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},zs=function(n){let t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?dp(n):!0},nd=He;var Ns=function(n){let t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(Ah&&Jo&&t.ctrlKey)};var Gs=function(n){let t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey};var rd=function(n){let t=n.originalEvent;return Jo?t.metaKey:t.ctrlKey},sd=function(n){let t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Xs=function(n){let t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},Ws=function(n){let t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"};var od=function(n){let t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};var rl=class extends ze{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==at.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==at.POINTERUP){let i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==at.POINTERDOWN){let i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==at.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}};function zn(n){let t=n.length,e=0,i=0;for(let r=0;r<t;r++)e+=n[r].clientX,i+=n[r].clientY;return{clientX:e/t,clientY:i/t}}var Ne=rl;var sl=class extends Ne{constructor(t){super({stopDown:qe}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let e=t.condition?t.condition:Sr(Gs,od);this.condition_=t.onFocusOnly?Sr(zs,e):e,this.noKinetic_=!1}handleDragEvent(t){let e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());let i=this.targetPointers,r=e.getEventPixel(zn(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=t.map.getView();Zh(s,a.getResolution()),Rn(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){let e=t.map,i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:le})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){let i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},ad=sl;var ol=class extends Ne{constructor(t){t=t||{},super({stopDown:qe}),this.condition_=t.condition?t.condition:id,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!Ws(t))return;let e=t.map,i=e.getView();if(i.getConstraints().rotation===On)return;let r=e.getSize(),s=t.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return Ws(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return Ws(t)&&Ns(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},ld=ol;var al=class extends di{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let t=this.startPixel_,e=this.endPixel_,i="px",r=this.element_.style;r.left=Math.min(t[0],e[0])+i,r.top=Math.min(t[1],e[1])+i,r.width=Math.abs(e[0]-t[0])+i,r.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let t=this.startPixel_,e=this.endPixel_,r=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new Ci([r])}getGeometry(){return this.geometry_}},cd=al;var Nn={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},Qi=class extends Tt{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}},ll=class extends Ne{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new cd(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Ns,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){let r=i[0]-e[0],s=i[1]-e[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Qi(Nn.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;let e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Qi(e?Nn.BOXEND:Nn.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Qi(Nn.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Qi(Nn.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Qi(Nn.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}},hd=ll;var cl=class extends hd{constructor(t){t=t||{};let e=t.condition?t.condition:sd;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){let i=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=i.rotatedExtentForGeometry(r),o=i.getResolutionForExtentInternal(s),a=i.getResolution()/o;r=r.clone(),r.scale(a*a)}i.fitInternal(r,{duration:this.duration_,easing:le})}},ud=cl;var bi={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var hl=class extends ze{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Gs(e)&&Xs(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==P.KEYDOWN){let i=t.originalEvent,r=i.key;if(this.condition_(t)&&(r==bi.DOWN||r==bi.LEFT||r==bi.RIGHT||r==bi.UP)){let o=t.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,h=0;r==bi.DOWN?h=-a:r==bi.LEFT?l=-a:r==bi.RIGHT?l=a:h=a;let c=[l,h];Rn(c,o.getRotation()),td(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}},dd=hl;var ul=class extends ze{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!rd(e)&&Xs(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==P.KEYDOWN||t.type==P.KEYPRESS){let i=t.originalEvent,r=i.key;if(this.condition_(t)&&(r==="+"||r==="-")){let s=t.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();Fn(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},fd=ul;var fp=40,gp=300,pp=3,dl=class extends ze{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;let e=t.condition?t.condition:nd;this.condition_=t.onFocusOnly?Sr(zs,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(t){if(this.ctrlKeyListenerKeys_.forEach(J),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(t),t){let e=t.getOwnerDocument();this.ctrlKeyListenerKeys_.push(K(e,"keydown",i=>{i.key==="Control"&&(this.ctrlKeyPressed_=!0)}),K(e,"keyup",i=>{i.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let t=this.getMap();if(!t)return;let e=t.getView(),i=this.lastDelta_?this.lastDelta_>0?1:-1:0;e.endInteraction(this.constrainResolution_||e.getConstrainResolution()?100:void 0,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==P.WHEEL)return!0;let i=t.map,r=t.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=t.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=fp;break;case WheelEvent.DOM_DELTA_PAGE:o*=gp;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=i.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*pp),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let h=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),h),!1}handleWheelZoom_(t){let e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-et(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Fn(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}},gd=dl;var fl=class extends Ne{constructor(t){t=t||{};let e=t;e.stopDown||(e.stopDown=qe),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0,i=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-i.clientY,r.clientX-i.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=s;let o=t.map,a=o.getView();a.getConstraints().rotation!==On&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(zn(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){let e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},pd=fl;var gl=class extends Ne{constructor(t){t=t||{};let e=t;e.stopDown||(e.stopDown=qe),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1,i=this.targetPointers[0],r=this.targetPointers[1],s=i.clientX-r.clientX,o=i.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;let l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(zn(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){let i=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){let e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},md=gl;function Ys(n){n=n||{};let t=new Pt,e=new Qu(-.005,.05,100);return(n.altShiftDragRotate===void 0||n.altShiftDragRotate)&&t.push(new ld),(n.doubleClickZoom===void 0||n.doubleClickZoom)&&t.push(new ed({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan===void 0||n.dragPan)&&t.push(new ad({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate===void 0||n.pinchRotate)&&t.push(new pd),(n.pinchZoom===void 0||n.pinchZoom)&&t.push(new md({duration:n.zoomDuration})),(n.keyboard===void 0||n.keyboard)&&(t.push(new dd),t.push(new fd({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom===void 0||n.mouseWheelZoom)&&t.push(new gd({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom===void 0||n.shiftDragZoom)&&t.push(new ud({duration:n.zoomDuration})),t}var rt={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var pl=class extends xt{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;let e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[rt.OPACITY]=t.opacity!==void 0?t.opacity:1,B(typeof e[rt.OPACITY]=="number","Layer opacity must be a number"),e[rt.VISIBLE]=t.visible!==void 0?t.visible:!0,e[rt.Z_INDEX]=t.zIndex,e[rt.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[rt.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[rt.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[rt.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){let e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=et(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return H()}getLayerStatesArray(t){return H()}getExtent(){return this.get(rt.EXTENT)}getMaxResolution(){return this.get(rt.MAX_RESOLUTION)}getMinResolution(){return this.get(rt.MIN_RESOLUTION)}getMinZoom(){return this.get(rt.MIN_ZOOM)}getMaxZoom(){return this.get(rt.MAX_ZOOM)}getOpacity(){return this.get(rt.OPACITY)}getSourceState(){return H()}getVisible(){return this.get(rt.VISIBLE)}getZIndex(){return this.get(rt.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(rt.EXTENT,t)}setMaxResolution(t){this.set(rt.MAX_RESOLUTION,t)}setMinResolution(t){this.set(rt.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(rt.MAX_ZOOM,t)}setMinZoom(t){this.set(rt.MIN_ZOOM,t)}setOpacity(t){B(typeof t=="number","Layer opacity must be a number"),this.set(rt.OPACITY,t)}setVisible(t){this.set(rt.VISIBLE,t)}setZIndex(t){this.set(rt.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Us=pl;var Ri={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Ee=class extends Tt{constructor(t,e){super(t),this.layer=e}},ml={LAYERS:"layers"},_l=class n extends Us{constructor(t){t=t||{};let e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ml.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Pt(i.slice(),{unique:!0}):B(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Pt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(J),this.layersListenerKeys_.length=0;let t=this.getLayers();this.layersListenerKeys_.push(K(t,It.ADD,this.handleLayersAdd_,this),K(t,It.REMOVE,this.handleLayersRemove_,this));for(let i in this.listenerKeys_)this.listenerKeys_[i].forEach(J);Ie(this.listenerKeys_);let e=t.getArray();for(let i=0,r=e.length;i<r;i++){let s=e[i];this.registerLayerListeners_(s),this.dispatchEvent(new Ee(Ri.ADDLAYER,s))}this.changed()}registerLayerListeners_(t){let e=[K(t,ue.PROPERTYCHANGE,this.handleLayerChange_,this),K(t,P.CHANGE,this.handleLayerChange_,this)];t instanceof n&&e.push(K(t,Ri.ADDLAYER,this.handleLayerGroupAdd_,this),K(t,Ri.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Y(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Ee(Ri.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Ee(Ri.REMOVELAYER,t.layer))}handleLayersAdd_(t){let e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Ee(Ri.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){let e=t.element,i=Y(e);this.listenerKeys_[i].forEach(J),delete this.listenerKeys_[i],this.dispatchEvent(new Ee(Ri.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(ml.LAYERS)}setLayers(t){let e=this.getLayers();if(e){let i=e.getArray();for(let r=0,s=i.length;r<s;++r)this.dispatchEvent(new Ee(Ri.REMOVELAYER,i[r]))}this.set(ml.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){let e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});let r=this.getLayerState(),s=r.zIndex;!t&&r.zIndex===void 0&&(s=0);for(let o=i,a=e.length;o<a;o++){let l=e[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=Oe(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return e}getSourceState(){return"ready"}},Tr=_l;var Dt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var xl=class extends Us{constructor(t){let e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(rt.SOURCE,this.handleSourcePropertyChange_);let i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(rt.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(J(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let t=this.getSource();t&&(this.sourceChangeKey_=K(t,P.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e,i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof Qt?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let r;if(e.layerStatesArray){if(r=e.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return Ir(r,e.viewState)&&(!s||ht(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e=this.getSource()?.getAttributions();if(!e)return[];let i=t instanceof Qt?t.getViewStateAndExtent():t,r=e(i);return Array.isArray(r)||(r=[r]),r}render(t,e){let i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){let e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(rt.MAP,t)}getMapInternal(){return this.get(rt.MAP)}setMap(t){this.mapPrecomposeKey_&&(J(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(J(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=K(t,Dt.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=K(this,P.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){let e=t.frameState.layerStatesArray,i=this.getLayerState(!1);B(!e.some(r=>r.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(rt.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function Ir(n,t){if(!n.visible)return!1;let e=t.resolution;if(e<n.minResolution||e>=n.maxResolution)return!1;let i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}var tn=xl;function Ks(n,t,e=0,i=n.length-1,r=mp){for(;i>e;){if(i-e>600){let l=i-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),g=Math.max(e,Math.floor(t-h*u/l+f)),p=Math.min(i,Math.floor(t+(l-h)*u/l+f));Ks(n,t,g,p,r)}let s=n[t],o=e,a=i;for(Lr(n,e,t),r(n[i],s)>0&&Lr(n,e,i);o<a;){for(Lr(n,o,a),o++,a--;r(n[o],s)<0;)o++;for(;r(n[a],s)>0;)a--}r(n[e],s)===0?Lr(n,e,a):(a++,Lr(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function Lr(n,t,e){let i=n[t];n[t]=n[e],n[e]=i}function mp(n,t){return n<t?-1:n>t?1:0}var en=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data,i=[];if(!Bs(t,e))return i;let r=this.toBBox,s=[];for(;e;){for(let o=0;o<e.children.length;o++){let a=e.children[o],l=e.leaf?r(a):a;Bs(t,l)&&(e.leaf?i.push(a):El(t,l)?this._all(a,i):s.push(a))}e=s.pop()}return i}collides(t){let e=this.data;if(!Bs(t,e))return!1;let i=[];for(;e;){for(let r=0;r<e.children.length;r++){let s=e.children[r],o=e.leaf?this.toBBox(s):s;if(Bs(t,o)){if(e.leaf||El(t,o))return!0;i.push(s)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){let i=this.data;this.data=e,e=i}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Xn([]),this}remove(t,e){if(!t)return this;let i=this.data,r=this.toBBox(t),s=[],o=[],a,l,h;for(;i||s.length;){if(i||(i=s.pop(),l=s[s.length-1],a=o.pop(),h=!0),i.leaf){let c=_p(t,i.children,e);if(c!==-1)return i.children.splice(c,1),s.push(i),this._condense(s),this}!h&&!i.leaf&&El(i,r)?(s.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],h=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){let i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,r){let s=i-e+1,o=this._maxEntries,a;if(s<=o)return a=Xn(t.slice(e,i+1)),Gn(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Xn([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),h=l*Math.ceil(Math.sqrt(o));_d(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){let u=Math.min(c+h-1,i);_d(t,c,u,l,this.compareMinY);for(let f=c;f<=u;f+=l){let g=Math.min(f+l-1,u);a.children.push(this._build(t,f,g,r-1))}}return Gn(a,this.toBBox),a}_chooseSubtree(t,e,i,r){for(;r.push(e),!(e.leaf||r.length-1===i);){let s=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){let h=e.children[l],c=yl(h),u=Ep(t,h)-c;u<o?(o=u,s=c<s?c:s,a=h):u===o&&c<s&&(s=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,i){let r=i?t:this.toBBox(t),s=[],o=this._chooseSubtree(r,this.data,e,s);for(o.children.push(t),Mr(o,r);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(r,s,e)}_split(t,e){let i=t[e],r=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,r);let o=this._chooseSplitIndex(i,s,r),a=Xn(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,Gn(i,this.toBBox),Gn(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=Xn([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Gn(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let r,s=1/0,o=1/0;for(let a=e;a<=i-e;a++){let l=Ar(t,0,a,this.toBBox),h=Ar(t,a,i,this.toBBox),c=wp(l,h),u=yl(l)+yl(h);c<s?(s=c,r=a,o=u<o?u:o):c===s&&u<o&&(o=u,r=a)}return r||i-e}_chooseSplitAxis(t,e,i){let r=t.leaf?this.compareMinX:xp,s=t.leaf?this.compareMinY:yp,o=this._allDistMargin(t,e,i,r),a=this._allDistMargin(t,e,i,s);o<a&&t.children.sort(r)}_allDistMargin(t,e,i,r){t.children.sort(r);let s=this.toBBox,o=Ar(t,0,e,s),a=Ar(t,i-e,i,s),l=Zs(o)+Zs(a);for(let h=e;h<i-e;h++){let c=t.children[h];Mr(o,t.leaf?s(c):c),l+=Zs(o)}for(let h=i-e-1;h>=e;h--){let c=t.children[h];Mr(a,t.leaf?s(c):c),l+=Zs(a)}return l}_adjustParentBBoxes(t,e,i){for(let r=i;r>=0;r--)Mr(e[r],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():Gn(t[e],this.toBBox)}};function _p(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function Gn(n,t){Ar(n,0,n.children.length,t,n)}function Ar(n,t,e,i,r){r||(r=Xn(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=t;s<e;s++){let o=n.children[s];Mr(r,n.leaf?i(o):o)}return r}function Mr(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function xp(n,t){return n.minX-t.minX}function yp(n,t){return n.minY-t.minY}function yl(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Zs(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Ep(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function wp(n,t){let e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),r=Math.min(n.maxX,t.maxX),s=Math.min(n.maxY,t.maxY);return Math.max(0,r-e)*Math.max(0,s-i)}function El(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Bs(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Xn(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _d(n,t,e,i,r){let s=[t,e];for(;s.length;){if(e=s.pop(),t=s.pop(),e-t<=i)continue;let o=t+Math.ceil((e-t)/i/2)*i;Ks(n,o,t,e,r),s.push(t,o,o,e)}}var js=[NaN,NaN,NaN,0],wl;function Cp(){return wl||(wl=nt(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),wl}var vp=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,bp=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Rp=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Sp=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Vs(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function Or(n){throw new Error('failed to parse "'+n+'" as color')}function xd(n){if(n.toLowerCase().startsWith("rgb")){let s=n.match(bp)||n.match(vp)||n.match(Rp);if(s){let o=s[4],a=100/255;return[et(Vs(s[1],a)+.5|0,0,255),et(Vs(s[2],a)+.5|0,0,255),et(Vs(s[3],a)+.5|0,0,255),o!==void 0?et(Vs(o,100),0,1):1]}Or(n)}if(n.startsWith("#")){if(Sp.test(n)){let s=n.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,h=s.length;l<h;l+=o){let c=parseInt(s.substring(l,l+o),16);o===1&&(c+=c<<4),a[l/o]=c}return a[3]=a[3]/255,a}Or(n)}let t=Cp();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=n,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=n,t.fillStyle===e&&Or(n));let i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return xd(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let r=Array.from(t.getImageData(0,0,1,1).data);return r[3]=Ui(r[3]/255,3),r}function yd(n){return typeof n=="string"?n:Dr(n)}var Tp=1024,Pr={},Cl=0;function Ed(n){if(n.length===4)return n;let t=n.slice();return t[3]=1,t}function vl(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function bl(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function Rl(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function Sl(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function Tl(n){let t=Rl(n[0]),e=Rl(n[1]),i=Rl(n[2]),r=Sl(t*.222488403+e*.716873169+i*.06060791),s=500*(Sl(t*.452247074+e*.399439023+i*.148375274)-r),o=200*(r-Sl(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,n[3]]}function wd(n){let t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,r=bl(t),s=bl(t+e/500*Math.cos(i)),o=bl(t-e/200*Math.sin(i)),a=vl(s*3.021973625-r*1.617392459-o*.404875592),l=vl(s*-.943766287+r*1.916279586+o*.027607165),h=vl(s*.069407491-r*.22898585+o*1.159737864);return[et(a+.5|0,0,255),et(l+.5|0,0,255),et(h+.5|0,0,255),n[3]]}function kr(n){if(n==="none")return js;if(Pr.hasOwnProperty(n))return Pr[n];if(Cl>=Tp){let e=0;for(let i in Pr)(e++&3)===0&&(delete Pr[i],--Cl)}let t=xd(n);t.length!==4&&Or(n);for(let e of t)isNaN(e)&&Or(n);return Pr[n]=t,++Cl,t}function he(n){return Array.isArray(n)?n:kr(n)}function Dr(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];e!=(e|0)&&(e=e+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);let r=n[3]===void 0?1:Math.round(n[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+r+")"}function Il(n){return n[0]>0&&n[1]>0}function Cd(n,t,e){return e===void 0&&(e=[0,0]),e[0]=n[0]*t+.5|0,e[1]=n[1]*t+.5|0,e}function pt(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}var rn=0,qs=0,Gt=1<<rn++,Q=1<<rn++,Xt=1<<rn++,Kt=1<<rn++,ei=1<<rn++,nn=1<<rn++,$s=Math.pow(2,rn)-1,Al={[Gt]:"boolean",[Q]:"number",[Xt]:"string",[Kt]:"color",[ei]:"number[]",[nn]:"size"},Ip=Object.keys(Al).map(Number).sort(Zt);function Lp(n){return n in Al}function ti(n){let t=[];for(let e of Ip)Fr(n,e)&&t.push(Al[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function Fr(n,t){return(n&t)===t}function Hs(n,t){return!!(n&t)}function Si(n,t){return n===t}var ft=class{constructor(t,e){if(!Lp(t))throw new Error(`literal expressions must have a specific type, got ${ti(t)}`);this.type=t,this.value=e}},Js=class{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}};function Qs(n){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:n}}function mt(n,t,e){switch(typeof n){case"boolean":{if(Si(t,Xt))return new ft(Xt,n?"true":"false");if(!Fr(t,Gt))throw new Error(`got a boolean, but expected ${ti(t)}`);return new ft(Gt,n)}case"number":{if(Si(t,nn))return new ft(nn,pt(n));if(Si(t,Gt))return new ft(Gt,!!n);if(Si(t,Xt))return new ft(Xt,n.toString());if(!Fr(t,Q))throw new Error(`got a number, but expected ${ti(t)}`);return new ft(Q,n)}case"string":{if(Si(t,Kt))return new ft(Kt,kr(n));if(Si(t,Gt))return new ft(Gt,!!n);if(!Fr(t,Xt))throw new Error(`got a string, but expected ${ti(t)}`);return new ft(Xt,n)}default:}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return Wp(n,t,e);for(let i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(Si(t,nn)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new ft(nn,n)}if(Si(t,Kt)){if(n.length===3)return new ft(Kt,[...n,1]);if(n.length===4)return new ft(Kt,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!Fr(t,ei))throw new Error(`got an array of numbers, but expected ${ti(t)}`);return new ft(ei,n)}var v={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},Ap={[v.Get]:U(q(1,1/0),vd),[v.Var]:Mp(),[v.Has]:U(q(1,1/0),vd),[v.Id]:U(Pp,Wn),[v.Concat]:U(q(2,1/0),st(Xt)),[v.GeometryType]:U(Op,Wn),[v.LineMetric]:U(kp,Wn),[v.Resolution]:U(Ll,Wn),[v.Zoom]:U(Ll,Wn),[v.Time]:U(Ll,Wn),[v.Any]:U(q(2,1/0),st(Gt)),[v.All]:U(q(2,1/0),st(Gt)),[v.Not]:U(q(1,1),st(Gt)),[v.Equal]:U(q(2,2),Rd()),[v.NotEqual]:U(q(2,2),Rd()),[v.GreaterThan]:U(q(2,2),st(Q)),[v.GreaterThanOrEqualTo]:U(q(2,2),st(Q)),[v.LessThan]:U(q(2,2),st(Q)),[v.LessThanOrEqualTo]:U(q(2,2),st(Q)),[v.Multiply]:U(q(2,1/0),bd),[v.Coalesce]:U(q(2,1/0),bd),[v.Divide]:U(q(2,2),st(Q)),[v.Add]:U(q(2,1/0),st(Q)),[v.Subtract]:U(q(2,2),st(Q)),[v.Clamp]:U(q(3,3),st(Q)),[v.Mod]:U(q(2,2),st(Q)),[v.Pow]:U(q(2,2),st(Q)),[v.Abs]:U(q(1,1),st(Q)),[v.Floor]:U(q(1,1),st(Q)),[v.Ceil]:U(q(1,1),st(Q)),[v.Round]:U(q(1,1),st(Q)),[v.Sin]:U(q(1,1),st(Q)),[v.Cos]:U(q(1,1),st(Q)),[v.Atan]:U(q(1,2),st(Q)),[v.Sqrt]:U(q(1,1),st(Q)),[v.Match]:U(q(4,1/0),Sd,Fp),[v.Between]:U(q(3,3),st(Q)),[v.Interpolate]:U(q(6,1/0),Sd,zp),[v.Case]:U(q(3,1/0),Dp,Np),[v.In]:U(q(2,2),Gp),[v.Number]:U(q(1,1/0),st($s)),[v.String]:U(q(1,1/0),st($s)),[v.Array]:U(q(1,1/0),st(Q)),[v.Color]:U(q(1,4),st(Q)),[v.Band]:U(q(1,3),st(Q)),[v.Palette]:U(q(2,2),Xp),[v.ToString]:U(q(1,1),st(Gt|Q|Xt|Kt))};function vd(n,t,e){let i=n.length-1,r=new Array(i);for(let s=0;s<i;++s){let o=n[s+1];switch(typeof o){case"number":{r[s]=new ft(Q,o);break}case"string":{r[s]=new ft(Xt,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&e.properties.set(String(o),t)}return r}function Mp(){return function(n,t,e){let i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");let r=t,s=e.inputVariables?.[i];if(s!==void 0){let o=mt(s,$s,e);if(!(o instanceof ft))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${i}`);let a=o.type;if(typeof s=="string"&&Hs(r,Kt)&&!Hs(r,Xt)?a=Kt:Array.isArray(s)&&s.length===2&&Hs(r,nn)&&!Hs(r,ei)&&(a=nn),r&=a,r===qs)throw new Error(`the type expected from the var operator (${ti(t)}) did not have any overlap with the type of the corresponding style variables (${ti(a)}), variable name: ${i}`)}if(e.variables.has(i)){let o=e.variables.get(i);if(r&=o,r===qs)throw new Error(`a new type expected from the var operator (${ti(t)}) did not have any overlap with the previous type expected for it (${ti(o)}), variable name: ${i}`)}return e.variables.set(i,r),new Js(r,"var",new ft(Xt,i))}}function Pp(n,t,e){e.featureId=!0}function Op(n,t,e){e.geometryType=!0}function kp(n,t,e){e.mCoordinate=!0}function Ll(n,t,e){e.mapState=!0}function Wn(n,t,e){let i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function q(n,t){return function(e,i,r){let s=e[0],o=e.length-1;if(n===t){if(o!==n){let a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${s}, got ${o}`)}}else if(o<n||o>t){let a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function bd(n,t,e){let i=n.length-1,r=new Array(i);for(let s=0;s<i;++s){let o=mt(n[s+1],t,e);r[s]=o}return r}function st(n){return function(t,e,i){let r=t.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=mt(t[o+1],n,i);s[o]=a}return s}}function Rd(){return function(n,t,e){let i=n[0],r=n.length-1,s=new Array(r),o=$s;for(let a=0;a<r;++a){let l=mt(n[a+1],o,e);o&=l.type}if(o===qs)throw new Error(`no common type was found among the arguments of ${i}`);for(let a=0;a<r;++a){let l=mt(n[a+1],o,e);s[a]=l}return s}}function Dp(n,t,e){let i=n[0],r=n.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${r} instead`)}function Sd(n,t,e){let i=n[0],r=n.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${r} instead`)}function Fp(n,t,e){let i=n.length-1,r=mt(n[n.length-1],t,e),s=Xt|Q|Gt,o=new Array(i-2);for(let l=0;l<i-2;l+=2){try{let h=mt(n[l+2],s,e);s&=h.type}catch(h){throw new Error(`failed to parse argument ${l+1} of match expression: ${h.message}`)}if(s===qs)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<i-2;l+=2){try{let h=mt(n[l+2],s,e);o[l]=h}catch(h){throw new Error(`failed to parse argument ${l+1} of match expression: ${h.message}`)}try{let h=mt(n[l+3],r.type,e);o[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${h.message}`)}}return[mt(n[1],s,e),...o,r]}function zp(n,t,e){let i=n[1],r;switch(i[0]){case"linear":r=1;break;case"exponential":let l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}let s=new ft(Q,r),o;try{o=mt(n[2],Q,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{let h=mt(n[l+3],Q,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{let h=mt(n[l+4],t,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${h.message}`)}}return[s,o,...a]}function Np(n,t,e){let i=mt(n[n.length-1],t,e),r=new Array(n.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=mt(n[s+1],Gt,e);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=mt(n[s+2],i.type,e);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=i,r}function Gp(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let r;if(i[0]==="literal"){if(i=i[1],!Array.isArray(i))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof i[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof i[0]=="string"?r=Xt:r=Q;let s=new Array(i.length);for(let a=0;a<s.length;a++)try{let l=mt(i[a],r,e);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[mt(n[1],r,e),...s]}function Xp(n,t,e){let i;try{i=mt(n[1],Q,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=n[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=mt(r[o],Kt,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof ft))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[i,...s]}function U(...n){return function(t,e,i){let r=t[0],s;for(let o=0;o<n.length;o++){let a=n[o](t,e,i);if(o==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new Js(e,r,...s)}}function Wp(n,t,e){let i=n[0],r=Ap[i];if(!r)throw new Error(`unknown operator: ${i}`);return r(n,t,e)}function to(n){if(!n)return"";let t=n.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return to(n.getGeometries()[0]);default:return""}}function Ml(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Ce(n,t,e){let i=mt(n,t,e);return we(i,e)}function we(n,t){if(n instanceof ft){if(n.type===Kt&&typeof n.value=="string"){let i=kr(n.value);return function(){return i}}return function(){return n.value}}let e=n.operator;switch(e){case v.Number:case v.String:case v.Coalesce:return Yp(n,t);case v.Get:case v.Var:case v.Has:return Up(n,t);case v.Id:return i=>i.featureId;case v.GeometryType:return i=>i.geometryType;case v.Concat:{let i=n.args.map(r=>we(r,t));return r=>"".concat(...i.map(s=>s(r).toString()))}case v.Resolution:return i=>i.resolution;case v.Any:case v.All:case v.Between:case v.In:case v.Not:return Zp(n,t);case v.Equal:case v.NotEqual:case v.LessThan:case v.LessThanOrEqualTo:case v.GreaterThan:case v.GreaterThanOrEqualTo:return Kp(n,t);case v.Multiply:case v.Divide:case v.Add:case v.Subtract:case v.Clamp:case v.Mod:case v.Pow:case v.Abs:case v.Floor:case v.Ceil:case v.Round:case v.Sin:case v.Cos:case v.Atan:case v.Sqrt:return Bp(n,t);case v.Case:return Vp(n,t);case v.Match:return jp(n,t);case v.Interpolate:return Hp(n,t);case v.ToString:return qp(n,t);default:throw new Error(`Unsupported operator ${e}`)}}function Yp(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=we(n.args[s],t);switch(e){case v.Coalesce:return s=>{for(let o=0;o<i;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case v.Number:case v.String:return s=>{for(let o=0;o<i;++o){let a=r[o](s);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function Up(n,t){let i=n.args[0].value;switch(n.operator){case v.Get:return r=>{let s=n.args,o=r.properties[i];for(let a=1,l=s.length;a<l;++a){let c=s[a].value;o=o[c]}return o};case v.Var:return r=>r.variables[i];case v.Has:return r=>{let s=n.args;if(!(i in r.properties))return!1;let o=r.properties[i];for(let a=1,l=s.length;a<l;++a){let c=s[a].value;if(!o||!Object.hasOwn(o,c))return!1;o=o[c]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function Kp(n,t){let e=n.operator,i=we(n.args[0],t),r=we(n.args[1],t);switch(e){case v.Equal:return s=>i(s)===r(s);case v.NotEqual:return s=>i(s)!==r(s);case v.LessThan:return s=>i(s)<r(s);case v.LessThanOrEqualTo:return s=>i(s)<=r(s);case v.GreaterThan:return s=>i(s)>r(s);case v.GreaterThanOrEqualTo:return s=>i(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${e}`)}}function Zp(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=we(n.args[s],t);switch(e){case v.Any:return s=>{for(let o=0;o<i;++o)if(r[o](s))return!0;return!1};case v.All:return s=>{for(let o=0;o<i;++o)if(!r[o](s))return!1;return!0};case v.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case v.In:return s=>{let o=r[0](s);for(let a=1;a<i;++a)if(o===r[a](s))return!0;return!1};case v.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${e}`)}}function Bp(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=we(n.args[s],t);switch(e){case v.Multiply:return s=>{let o=1;for(let a=0;a<i;++a)o*=r[a](s);return o};case v.Divide:return s=>r[0](s)/r[1](s);case v.Add:return s=>{let o=0;for(let a=0;a<i;++a)o+=r[a](s);return o};case v.Subtract:return s=>r[0](s)-r[1](s);case v.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case v.Mod:return s=>r[0](s)%r[1](s);case v.Pow:return s=>Math.pow(r[0](s),r[1](s));case v.Abs:return s=>Math.abs(r[0](s));case v.Floor:return s=>Math.floor(r[0](s));case v.Ceil:return s=>Math.ceil(r[0](s));case v.Round:return s=>Math.round(r[0](s));case v.Sin:return s=>Math.sin(r[0](s));case v.Cos:return s=>Math.cos(r[0](s));case v.Atan:return i===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case v.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${e}`)}}function Vp(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=we(n.args[r],t);return r=>{for(let s=0;s<e-1;s+=2)if(i[s](r))return i[s+1](r);return i[e-1](r)}}function jp(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=we(n.args[r],t);return r=>{let s=i[0](r);for(let o=1;o<e-1;o+=2)if(s===i[o](r))return i[o+1](r);return i[e-1](r)}}function Hp(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=we(n.args[r],t);return r=>{let s=i[0](r),o=i[1](r),a,l;for(let h=2;h<e;h+=2){let c=i[h](r),u=i[h+1](r),f=Array.isArray(u);if(f&&(u=Ed(u)),c>=o)return h===2?u:f?$p(s,o,a,l,c,u):zr(s,o,a,l,c,u);a=c,l=u}return l}}function qp(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=we(n.args[s],t);if(e===v.ToString)return s=>{let o=r[0](s);return n.args[0].type===Kt?Dr(o):o.toString()};throw new Error(`Unsupported convert operator ${e}`)}function zr(n,t,e,i,r,s){let o=r-e;if(o===0)return i;let a=t-e,l=n===1?a/o:(Math.pow(n,a)-1)/(Math.pow(n,o)-1);return i+l*(s-i)}function $p(n,t,e,i,r,s){if(r-e===0)return i;let a=Tl(i),l=Tl(s),h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);let c=[zr(n,t,e,a[0],r,l[0]),zr(n,t,e,a[1],r,l[1]),a[2]+zr(n,t,e,0,r,h),zr(n,t,e,i[3],r,s[3])];return wd(c)}var W={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Td(n,t,e){let i=n,r=!0,s=!1,o=!1,a=[mn(i,P.LOAD,function(){o=!0,s||t()})];return i.src&&Qo?(s=!0,i.decode().then(function(){r&&t()}).catch(function(l){r&&(o?t():e())})):a.push(mn(i,P.ERROR,e)),function(){r=!1,a.forEach(J)}}function Jp(n,t){return new Promise((e,i)=>{function r(){o(),e(n)}function s(){o(),i(new Error("Image load error"))}function o(){n.removeEventListener("load",r),n.removeEventListener("error",s)}n.addEventListener("load",r),n.addEventListener("error",s),t&&(n.src=t)})}function Id(n,t){return t&&(n.src=t),n.src&&Qo?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(r=>n.complete&&n.width?e(n):i(r))):Jp(n)}var Ol=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(let e in this.cache_){let i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){let i=Pl(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){let i=Pl(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,r){let s=Pl(t,e),o=s in this.cache_;this.cache_[s]=i,r&&(i.getImageState()===W.IDLE&&i.load(),i.getImageState()===W.LOADING?i.ready().then(()=>{this.patternCache_[s]=Rr().createPattern(i.getImage(1),"repeat")}):this.patternCache_[s]=Rr().createPattern(i.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};function Pl(n,t){let e=t?he(t):"null";return n+":"+e}var Wt=new Ol;var Nr=null,eo=class extends fi{constructor(t,e,i,r,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?W.IDLE:r,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===W.LOADED){Nr||(Nr=nt(1,1,void 0,{willReadFrequently:!0})),Nr.drawImage(this.image_,0,0);try{Nr.getImageData(0,0,1,1),this.tainted_=!1}catch{Nr=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(P.CHANGE)}handleImageError_(){this.imageState_=W.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=W.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let t=this.size_[0],e=this.size_[1],i=nt(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===W.IDLE){this.image_||this.initializeImage_(),this.imageState_=W.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Id(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==W.LOADED)return;let e=this.image_,i=nt(Math.ceil(e.width*t),Math.ceil(e.height*t)),r=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=yd(this.color_),i.fillRect(0,0,r.width/t,r.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=r}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===W.LOADED||this.imageState_===W.ERROR)t();else{let e=()=>{(this.imageState_===W.LOADED||this.imageState_===W.ERROR)&&(this.removeEventListener(P.CHANGE,e),t())};this.addEventListener(P.CHANGE,e)}})),this.ready_}};function Ti(n,t,e,i,r,s){let o=t===void 0?void 0:Wt.get(t,r);return o||(o=new eo(n,n&&"src"in n?n.src||void 0:t,e,i,r),Wt.set(t,r,o,s)),s&&o&&!Wt.getPattern(t,r)&&Wt.set(t,r,o,s),o}var Ld=eo;function jt(n){return n?Array.isArray(n)?Dr(n):typeof n=="object"&&"src"in n?Qp(n):n:null}function Qp(n){if(!n.offset||!n.size)return Wt.getPattern(n.src,n.color);let t=n.src+":"+n.offset,e=Wt.getPattern(t,n.color);if(e)return e;let i=Wt.get(n.src,null);if(i.getImageState()!==W.LOADED)return null;let r=nt(n.size[0],n.size[1]);return r.drawImage(i.getImage(1),n.offset[0],n.offset[1],n.size[0],n.size[1],0,0,n.size[0],n.size[1]),Ti(r.canvas,t,void 0,W.LOADED,n.color,!0),Wt.getPattern(t,n.color)}var io="10px sans-serif",St="#000",Ge="round",Ht=[],qt=0,Xe="round",ii=10,Md=0,Yt="#000",Ii="center",on="middle",ni=[0,0,0,0],ri=1,sn=new xt,Gr=null,Ad,kl={},tm=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function em(n,t,e){return`${n} ${t} 16px "${e}"`}var Pd=(function(){let t,e;async function i(s){await e.ready;let o=ks(s),a=o.families[0].toLowerCase(),l=o.weight,h=[];return e.forEach(u=>{let f=u.family.replace(/^['"]|['"]$/g,"").toLowerCase(),g=Os[u.weight]||u.weight;f===a&&u.style===o.style&&g==l&&h.push(u)}),h.length===0?!1:(await Promise.all(h.map(u=>u.load().then(()=>!0,()=>!1)))).some(u=>u)}async function r(){await e.ready;let s=!0,o=sn.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let h=a[l],c=o[h];c<100&&(await i(h)?(Ie(kl),sn.set(h,100)):(c+=10,sn.set(h,c,!0),c<100&&(s=!1)))}t=void 0,s||(t=setTimeout(r,100))}return async function(s){e||(e=bt?self.fonts:document.fonts);let o=ks(s);if(!o)return;let a=o.families,l=!1;for(let h of a){if(tm.has(h))continue;let c=em(o.style,o.weight,h);sn.get(c)===void 0&&(sn.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(r,100))}})(),im=(function(){let n;return function(t){let e=kl[t];if(e==null){if(bt){let i=ks(t),r=Od(t,"\u017Dg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=t,document.body.appendChild(n),e=n.offsetHeight,document.body.removeChild(n);kl[t]=e}return e}})();function Od(n,t){return Gr||(Gr=nt(1,1)),n!=Ad&&(Gr.font=n,Ad=Gr.font),Gr.measureText(t)}function kd(n,t){return Od(n,t).width}function Dl(n,t,e){if(t in e)return e[t];let i=t.split(`1+(()=>{var ue={PROPERTYCHANGE:"propertychange"};function Ie(n){for(let t in n)delete n[t]}function de(n){let t;for(t in n)return!1;return!t}function K(n,t,e,i,r){if(r){let o=e;e=function(a){return n.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==n&&(e=e.bind(i));let s={target:n,type:t,listener:e};return n.addEventListener(t,e),s}function mn(n,t,e,i){return K(n,t,e,i,!0)}function J(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),Ie(n))}var P={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var Ko=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},di=Ko;function bh(n,t,e){let i,r;e=e||Zt;let s=0,o=n.length,a=!1;for(;s<o;)i=s+(o-s>>1),r=+e(n[i],t),r<0?s=i+1:(o=i,a=!r);return a?s:~s}function Zt(n,t){return n>t?1:n<t?-1:0}function Rh(n,t){return n<t?1:n>t?-1:0}function _n(n,t,e){if(n[0]<=t)return 0;let i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let r=1;r<i;++r){let s=n[r];if(s===t)return r;if(s<t)return e(t,n[r-1],s)>0?r-1:r}return i-1}if(e>0){for(let r=1;r<i;++r)if(n[r]<t)return r-1;return i-1}if(e<0){for(let r=1;r<i;++r)if(n[r]<=t)return r;return i-1}for(let r=1;r<i;++r){if(n[r]==t)return r;if(n[r]<t)return n[r-1]-t<t-n[r]?r-1:r}return i-1}function Sh(n,t,e){for(;t<e;){let i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function fe(n,t){let e=Array.isArray(t)?t:[t],i=e.length;for(let r=0;r<i;r++)n[n.length]=e[r]}function zt(n,t){let e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function Th(n,t,e){let i=t||Zt;return n.every(function(r,s){if(s===0)return!0;let o=i(n[s-1],r);return!(o>0||e&&o===0)})}function He(){return!0}function qe(){return!1}function $e(){}function rs(n){let t,e,i;return function(){let r=Array.prototype.slice.call(arguments);return(!e||this!==i||!zt(r,e))&&(i=this,e=r,t=n.apply(this,arguments)),t}}function Ih(n){function t(){let e;try{e=n()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}var Zo=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Tt=Zo;var Bo=class extends di{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;let i=this.listeners_||(this.listeners_={}),r=i[t]||(i[t]=[]);r.includes(e)||r.push(e)}dispatchEvent(t){let e=typeof t=="string",i=e?t:t.type,r=this.listeners_&&this.listeners_[i];if(!r)return;let s=e?new Tt(t):t;s.target||(s.target=this.eventTarget_||this);let o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=r.length;h<c;++h)if("handleEvent"in r[h]?l=r[h].handleEvent(s):l=r[h].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,$e);delete o[i]}return l}disposeInternal(){this.listeners_&&Ie(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;let i=this.listeners_[t];if(!i)return;let r=i.indexOf(e);r!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[r]=$e,++this.pendingRemovals_[t]):(i.splice(r,1),i.length===0&&delete this.listeners_[t]))}},fi=Bo;var xn=class extends fi{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(P.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){let i=t.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=K(this,t[s],e);return r}return K(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){let r=t.length;i=new Array(r);for(let s=0;s<r;++s)i[s]=mn(this,t[s],e)}else i=mn(this,t,e);return e.ol_key=i,i}unInternal(t,e){let i=e.ol_key;if(i)Sg(i);else if(Array.isArray(t))for(let r=0,s=t.length;r<s;++r)this.removeEventListener(t[r],e);else this.removeEventListener(t,e)}};xn.prototype.on;xn.prototype.once;xn.prototype.un;function Sg(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)J(n[t]);else J(n)}var ss=xn;function H(){throw new Error("Unimplemented abstract method.")}var Tg=0;function Y(n){return n.ol_uid||(n.ol_uid=String(++Tg))}var os=class extends Tt{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}},Vo=class extends ss{constructor(t){super(),this.on,this.once,this.un,Y(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new os(i,t,e)),i=ue.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new os(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){let r=this.values_||(this.values_={});if(i)r[t]=e;else{let s=r[t];r[t]=e,s!==e&&this.notify(t,s)}}setProperties(t,e){for(let i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){let i=this.values_[t];delete this.values_[t],de(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},xt=Vo;function B(n,t){if(!n)throw new Error(t)}var jo=class n extends xt{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){let e=t;this.setGeometry(e)}else{let e=t;this.setProperties(e)}}clone(){let t=new n,e=this.geometryName_;t.setGeometryName(e);let i=this.getPropertiesInternal();if(i){let s=this.getGeometry();for(let o in i)o===e&&s?t.set(o,s.clone()):t.set(o,i[o],!0)}let r=this.getStyle();return r&&t.setStyle(r),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(J(this.geometryChangeKey_),this.geometryChangeKey_=null);let t=this.getGeometry();t&&(this.geometryChangeKey_=K(t,P.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Ig(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function Ig(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(B(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}var lr=jo;var It={ADD:"add",REMOVE:"remove"};var Lh={LENGTH:"length"},yn=class extends Tt{constructor(t,e,i){super(t),this.element=e,this.index=i}},Ho=class extends xt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let i=1,r=this.array_.length;i<r;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){let e=this.array_;for(let i=0,r=e.length;i<r;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Lh.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new yn(It.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){let e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){let e=this.array_;for(let i=0,r=e.length;i<r;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;let e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new yn(It.REMOVE,e,t)),e}setAt(t,e){let i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);let r=this.array_[t];this.array_[t]=e,this.dispatchEvent(new yn(It.REMOVE,r,t)),this.dispatchEvent(new yn(It.ADD,e,t))}updateLength_(){this.set(Lh.LENGTH,this.array_.length)}assertUnique_(t,e){let i=this.array_;for(let r=0,s=i.length;r<s;++r)if(i[r]===t&&r!==e)throw new Error("Duplicate item added to a unique collection")}},Pt=Ho;var qo=class extends Tt{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}},gi=qo;var $o=class extends gi{constructor(t,e,i,r,s,o){super(t,e,s),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},Le=$o;var at={SINGLECLICK:"singleclick",CLICK:P.CLICK,DBLCLICK:P.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Yi=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Lg=Yi.includes("safari")&&!Yi.includes("chrom"),Vx=Lg&&(Yi.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Yi)),Ah=Yi.includes("webkit")&&!Yi.includes("edge"),Jo=Yi.includes("macintosh"),Mh=typeof devicePixelRatio<"u"?devicePixelRatio:1,bt=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Qo=typeof Image<"u"&&Image.prototype.decode;var as=(function(){let n=!1;try{let t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n})();var cr={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var ta=class extends fi{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;let i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=K(i,cr.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=K(i,cr.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_,as?{passive:!1}:!1)}emulateClick_(t){let e=new Le(at.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Le(at.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let i=new Le(at.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){let e=t,i=e.pointerId;if(e.type==at.POINTERUP||e.type==at.POINTERCANCEL){delete this.trackedTouches_[i];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==e.target){delete this.trackedTouches_[r];break}}else(e.type==at.POINTERDOWN||e.type==at.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);let e=new Le(at.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(J),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);let e=new Le(at.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){let i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(K(i,at.POINTERMOVE,this.handlePointerMove_,this),K(i,at.POINTERUP,this.handlePointerUp_,this),K(this.element_,at.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(K(this.element_.getRootNode(),at.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;let e=new Le(at.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;let e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new Le(at.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){let e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(J(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(J(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(J),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},Ph=ta;var Ae={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Ot={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var k={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};var hr=1/0,ea=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Ie(this.queuedElements_)}dequeue(){let t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));let r=this.keyFunction_(i);return delete this.queuedElements_[r],i}enqueue(t){B(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let e=this.priorityFunction_(t);return e!=hr?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){let e=this.elements_,i=this.priorities_,r=e.length,s=e[t],o=i[t],a=t;for(;t<r>>1;){let l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<r&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=s,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){let i=this.elements_,r=this.priorities_,s=i[e],o=r[e];for(;e>t;){let a=this.getParentIndex_(e);if(r[a]>o)i[e]=i[a],r[e]=r[a],e=a;else break}i[e]=s,r[e]=o}reprioritize(){let t=this.priorityFunction_,e=this.elements_,i=this.priorities_,r=0,s=e.length,o,a,l;for(a=0;a<s;++a)o=e[a],l=t(o),l==hr?delete this.queuedElements_[this.keyFunction_(o)]:(i[r]=l,e[r++]=o);e.length=r,i.length=r,this.heapify_()}},Oh=ea;var ia=class extends Oh{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){let e=super.enqueue(t);return e&&t[0].addEventListener(P.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){let e=t.target,i=e.getState();if(i===k.LOADED||i===k.ERROR||i===k.EMPTY){i!==k.ERROR&&e.removeEventListener(P.CHANGE,this.boundHandleTileChange_);let r=e.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===k.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++i,r.load())}}},kh=ia;function Dh(n,t,e,i,r){if(!n||!(e in n.wantedTiles))return hr;if(!n.wantedTiles[e][t.getKey()])return hr;let s=n.viewState.center,o=i[0]-s[0],a=i[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var Rt={ANIMATING:0,INTERACTING:1};var oe={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function et(n,t,e){return Math.min(Math.max(n,t),e)}function Fh(n,t,e,i,r,s){let o=r-e,a=s-i;if(o!==0||a!==0){let l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=r,i=s):l>0&&(e+=o*l,i+=a*l)}return ge(n,t,e,i)}function ge(n,t,e,i){let r=e-n,s=i-t;return r*r+s*s}function zh(n){let t=n.length;for(let i=0;i<t;i++){let r=i,s=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){let l=Math.abs(n[a][i]);l>s&&(s=l,r=a)}if(s===0)return null;let o=n[r];n[r]=n[i],n[i]=o;for(let a=i+1;a<t;a++){let l=-n[a][i]/n[i][i];for(let h=i;h<t+1;h++)i==h?n[a][h]=0:n[a][h]+=l*n[i][h]}}let e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let r=i-1;r>=0;r--)n[r][t]-=n[r][i]*e[i]}return e}function ls(n){return n*180/Math.PI}function pe(n){return n*Math.PI/180}function Me(n,t){let e=n%t;return e*t<0?e+t:e}function Nt(n,t,e){return n+e*(t-n)}function Ui(n,t){let e=Math.pow(10,t);return Math.round(n*e)/e}function ur(n,t){return Math.floor(Ui(n,t))}function dr(n,t){return Math.ceil(Ui(n,t))}function cs(n,t,e){if(n>=t&&n<e)return n;let i=e-t;return((n-t)%i+i)%i+t}function na(n,t,e){return(function(i,r,s,o,a){if(!i)return;if(!r&&!t)return i;let l=t?0:s[0]*r,h=t?0:s[1]*r,c=a?a[0]:0,u=a?a[1]:0,f=n[0]+l/2+c,g=n[2]-l/2+c,p=n[1]+h/2+u,_=n[3]-h/2+u;f>g&&(f=(g+f)/2,g=f),p>_&&(p=(_+p)/2,_=p);let m=et(i[0],f,g),x=et(i[1],p,_);if(o&&e&&r){let E=30*r;m+=-E*Math.log(1+Math.max(0,f-i[0])/E)+E*Math.log(1+Math.max(0,i[0]-g)/E),x+=-E*Math.log(1+Math.max(0,p-i[1])/E)+E*Math.log(1+Math.max(0,i[1]-_)/E)}return[m,x]})}function Nh(n){return n}var yt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ra(n){let t=ut();for(let e=0,i=n.length;e<i;++e)Bi(t,n[e]);return t}function Ag(n,t,e){let i=Math.min.apply(null,n),r=Math.min.apply(null,t),s=Math.max.apply(null,n),o=Math.max.apply(null,t);return Jt(i,r,s,o,e)}function En(n,t,e){return e?(e[0]=n[0]-t,e[1]=n[1]-t,e[2]=n[2]+t,e[3]=n[3]+t,e):[n[0]-t,n[1]-t,n[2]+t,n[3]+t]}function us(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function pi(n,t,e){let i,r;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?r=n[1]-e:n[3]<e?r=e-n[3]:r=0,i*i+r*r}function me(n,t){return fr(n,t[0],t[1])}function Pe(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function fr(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function hs(n,t){let e=n[0],i=n[1],r=n[2],s=n[3],o=t[0],a=t[1],l=yt.UNKNOWN;return o<e?l=l|yt.LEFT:o>r&&(l=l|yt.RIGHT),a<i?l=l|yt.BELOW:a>s&&(l=l|yt.ABOVE),l===yt.UNKNOWN&&(l=yt.INTERSECTING),l}function ut(){return[1/0,1/0,-1/0,-1/0]}function Jt(n,t,e,i,r){return r?(r[0]=n,r[1]=t,r[2]=e,r[3]=i,r):[n,t,e,i]}function Ki(n){return Jt(1/0,1/0,-1/0,-1/0,n)}function ds(n,t){let e=n[0],i=n[1];return Jt(e,i,e,i,t)}function wn(n,t,e,i,r){let s=Ki(r);return sa(s,n,t,e,i)}function Zi(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function fs(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function Bi(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function sa(n,t,e,i,r){for(;e<i;e+=r)Mg(n,t[e],t[e+1]);return n}function Mg(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function gs(n,t){let e;return e=t(Cn(n)),e||(e=t(vn(n)),e)||(e=t(bn(n)),e)||(e=t(ae(n)),e)?e:!1}function gr(n){let t=0;return ke(n)||(t=j(n)*ct(n)),t}function Cn(n){return[n[0],n[1]]}function vn(n){return[n[2],n[1]]}function Bt(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Gh(n,t){let e;if(t==="bottom-left")e=Cn(n);else if(t==="bottom-right")e=vn(n);else if(t==="top-left")e=ae(n);else if(t==="top-right")e=bn(n);else throw new Error("Invalid corner");return e}function pr(n,t,e,i,r){let[s,o,a,l,h,c,u,f]=oa(n,t,e,i);return Jt(Math.min(s,a,h,u),Math.min(o,l,c,f),Math.max(s,a,h,u),Math.max(o,l,c,f),r)}function oa(n,t,e,i){let r=t*i[0]/2,s=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=r*o,h=r*a,c=s*o,u=s*a,f=n[0],g=n[1];return[f-l+u,g-h-c,f-l-u,g-h+c,f+l-u,g+h+c,f+l+u,g+h-c,f-l+u,g-h-c]}function ct(n){return n[3]-n[1]}function Oe(n,t,e){let i=e||ut();return ht(n,t)?(n[0]>t[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]<t[2]?i[2]=n[2]:i[2]=t[2],n[3]<t[3]?i[3]=n[3]:i[3]=t[3]):Ki(i),i}function aa(n,t){if(!ht(n,t))return[n.slice()];if(Pe(t,n))return[];let[e,i,r,s]=n,o=Math.max(e,t[0]),a=Math.max(i,t[1]),l=Math.min(r,t[2]),h=Math.min(s,t[3]),c=[];return o>e&&c.push([e,i,o,s]),l<r&&c.push([l,i,r,s]),a>i&&c.push([o,i,l,a]),h<s&&c.push([o,h,l,s]),c}function ae(n){return[n[0],n[3]]}function bn(n){return[n[2],n[3]]}function j(n){return n[2]-n[0]}function ht(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function ke(n){return n[2]<n[0]||n[3]<n[1]}function Xh(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function Wh(n,t,e){let i=!1,r=hs(n,t),s=hs(n,e);if(r===yt.INTERSECTING||s===yt.INTERSECTING)i=!0;else{let o=n[0],a=n[1],l=n[2],h=n[3],c=t[0],u=t[1],f=e[0],g=e[1],p=(g-u)/(f-c),_,m;s&yt.ABOVE&&!(r&yt.ABOVE)&&(_=f-(g-h)/p,i=_>=o&&_<=l),!i&&s&yt.RIGHT&&!(r&yt.RIGHT)&&(m=g-(f-l)*p,i=m>=a&&m<=h),!i&&s&yt.BELOW&&!(r&yt.BELOW)&&(_=f-(g-a)/p,i=_>=o&&_<=l),!i&&s&yt.LEFT&&!(r&yt.LEFT)&&(m=g-(f-o)*p,i=m>=a&&m<=h)}return i}function Yh(n,t,e,i){if(ke(n))return Ki(e);let r=[];if(i>1){let a=n[2]-n[0],l=n[3]-n[1];for(let h=0;h<i;++h)r.push(n[0]+a*h/i,n[1],n[2],n[1]+l*h/i,n[2]-a*h/i,n[3],n[0],n[3]-l*h/i)}else r=[n[0],n[1],n[2],n[1],n[2],n[3],n[0],n[3]];t(r,r,2);let s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return Ag(s,o,e)}function la(n,t){let e=t.getExtent(),i=Bt(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){let r=j(e),o=Math.floor((i[0]-e[0])/r)*r;n[0]-=o,n[2]-=o}return n}function ps(n,t,e){if(t.canWrapX()){let i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];la(n,t);let r=j(i);if(j(n)>r&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+r,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-r,n[3]]]}return[n]}function Uh(n,t){let e=[n];for(let i=0,r=t.length;i<r&&e.length>0;++i){let s=[];for(let o=0,a=e.length;o<a;++o)s.push(...aa(e[o],t[i]));e=s}return e}function Kh(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function Vi(n,t){let e=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function Rn(n,t){let e=Math.cos(t),i=Math.sin(t),r=n[0]*e-n[1]*i,s=n[1]*e+n[0]*i;return n[0]=r,n[1]=s,n}function Zh(n,t){return n[0]*=t,n[1]*=t,n}function ms(n,t){if(t.canWrapX()){let e=j(t.getExtent()),i=Bh(n,t,e);i&&(n[0]-=i*e)}return n}function Bh(n,t,e){let i=t.getExtent(),r=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||j(i),r=Math.floor((n[0]-i[0])/e)),r}function Vh(n,t,e){let i=Math.sqrt((t[0]-n[0])*(t[0]-n[0])+(t[1]-n[1])*(t[1]-n[1])),r=[(t[0]-n[0])/i,(t[1]-n[1])/i],s=[-r[1],r[0]],o=Math.sqrt((e[0]-n[0])*(e[0]-n[0])+(e[1]-n[1])*(e[1]-n[1])),a=[(e[0]-n[0])/o,(e[1]-n[1])/o],l=i===0||o===0?0:Math.acos(et(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}function ca(n){return Math.pow(n,3)}function le(n){return 1-ca(1-n)}function jh(n){return 3*n*n-2*n*n*n}function Hh(n){return n}var Pg=63710088e-1;function ha(n,t,e){e=e||Pg;let i=pe(n[1]),r=pe(t[1]),s=(r-i)/2,o=pe(t[0]-n[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(r);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var qh={info:1,warn:2,error:3,none:4},Og=qh.info;function _s(...n){Og>qh.warn||console.warn(...n)}var Je={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var ua=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Je[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},mi=ua;var mr=6378137,Sn=Math.PI*mr,kg=[-Sn,-Sn,Sn,Sn],Dg=[-180,-85,180,85],xs=mr*Math.log(Math.tan(Math.PI/2)),_i=class extends mi{constructor(t){super({code:t,units:"m",extent:kg,global:!0,worldExtent:Dg,getPointResolution:function(e,i){return e/Math.cosh(i[1]/mr)}})}},da=[new _i("EPSG:3857"),new _i("EPSG:102100"),new _i("EPSG:102113"),new _i("EPSG:900913"),new _i("http://www.opengis.net/def/crs/EPSG/0/3857"),new _i("http://www.opengis.net/gml/srs/epsg.xml#3857")];function $h(n,t,e,i){let r=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(r));for(let s=0;s<r;s+=i){t[s]=Sn*n[s]/180;let o=mr*Math.log(Math.tan(Math.PI*(+n[s+1]+90)/360));o>xs?o=xs:o<-xs&&(o=-xs),t[s+1]=o}return t}function Jh(n,t,e,i){let r=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(r));for(let s=0;s<r;s+=i)t[s]=180*n[s]/Sn,t[s+1]=360*Math.atan(Math.exp(n[s+1]/mr))/Math.PI-90;return t}var Fg=6378137,Qh=[-180,-90,180,90],zg=Math.PI*Fg/180,Qe=class extends mi{constructor(t,e){super({code:t,units:"degrees",extent:Qh,axisOrientation:e,global:!0,metersPerUnit:zg,worldExtent:Qh})}},fa=[new Qe("CRS:84"),new Qe("EPSG:4326","neu"),new Qe("urn:ogc:def:crs:OGC:1.3:CRS84"),new Qe("urn:ogc:def:crs:OGC:2:84"),new Qe("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Qe("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Qe("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var ga={};function tu(n){return ga[n]||ga[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function eu(n,t){ga[n]=t}var Tn={};function In(n,t,e){let i=n.getCode(),r=t.getCode();i in Tn||(Tn[i]={}),Tn[i][r]=e}function ys(n,t){return n in Tn&&t in Tn[n]?Tn[n][t]:null}var Es=.9996,ce=.00669438,Cs=ce*ce,vs=Cs*ce,ji=ce/(1-ce),iu=Math.sqrt(1-ce),Ln=(1-iu)/(1+iu),ou=Ln*Ln,pa=ou*Ln,ma=pa*Ln,au=ma*Ln,lu=1-ce/4-3*Cs/64-5*vs/256,Ng=3*ce/8+3*Cs/32+45*vs/1024,Gg=15*Cs/256+45*vs/1024,Xg=35*vs/3072,Wg=3/2*Ln-27/32*pa+269/512*au,Yg=21/16*ou-55/32*ma,Ug=151/96*pa-417/128*au,Kg=1097/512*ma,ws=6378137;function Zg(n,t,e){let i=n-5e5,o=(e.north?t:t-1e7)/Es/(ws*lu),a=o+Wg*Math.sin(2*o)+Yg*Math.sin(4*o)+Ug*Math.sin(6*o)+Kg*Math.sin(8*o),l=Math.sin(a),h=l*l,c=Math.cos(a),u=l/c,f=u*u,g=f*f,p=1-ce*h,_=Math.sqrt(1-ce*h),m=ws/_,x=(1-ce)/p,E=ji*c**2,C=E*E,y=i/(m*Es),w=y*y,S=w*y,A=S*y,R=A*y,T=R*y,I=a-u/x*(w/2-A/24*(5+3*f+10*E-4*C-9*ji))+T/720*(61+90*f+298*E+45*g-252*ji-3*C),z=(y-S/6*(1+2*f+E)+R/120*(5-2*E+28*f-3*C+8*ji+24*g))/c;return z=cs(z+pe(cu(e.number)),-Math.PI,Math.PI),[ls(z),ls(I)]}var nu=-80,ru=84,Bg=-180,Vg=180;function jg(n,t,e){n=cs(n,Bg,Vg),t<nu?t=nu:t>ru&&(t=ru);let i=pe(t),r=Math.sin(i),s=Math.cos(i),o=r/s,a=o*o,l=a*a,h=pe(n),c=cu(e.number),u=pe(c),f=ws/Math.sqrt(1-ce*r**2),g=ji*s**2,p=s*cs(h-u,-Math.PI,Math.PI),_=p*p,m=_*p,x=m*p,E=x*p,C=E*p,y=ws*(lu*i-Ng*Math.sin(2*i)+Gg*Math.sin(4*i)-Xg*Math.sin(6*i)),w=Es*f*(p+m/6*(1-a+g)+E/120*(5-18*a+l+72*g-58*ji))+5e5,S=Es*(y+f*o*(_/2+x/24*(5-a+9*g+4*g**2)+C/720*(61-58*a+l+600*g-330*ji)));return e.north||(S+=1e7),[w,S]}function cu(n){return(n-1)*6-180+3}var Hg=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function hu(n){let t=0;for(let r of Hg){let s=n.match(r);if(s){t=parseInt(s[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function su(n,t){return function(e,i,r,s){let o=e.length;r=r>1?r:2,s=s??r,i||(r>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=s){let l=e[a],h=e[a+1],c=n(l,h,t);i[a]=c[0],i[a+1]=c[1]}return i}}function uu(n){return hu(n)?new mi({code:n,units:"m"}):null}function du(n){let t=hu(n.getCode());return t?{forward:su(jg,t),inverse:su(Zg,t)}:null}var qg=[du],$g=[uu];var xa=!0;function gu(n){xa=!(n===void 0?!0:n)}function Ea(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function ya(n){eu(n.getCode(),n),In(n,n,Ea)}function Jg(n){n.forEach(ya)}function Et(n){if(typeof n!="string")return n;let t=tu(n);if(t)return t;for(let e of $g){let i=e(n);if(i)return i}return null}function wa(n,t,e,i){n=Et(n);let r,s=n.getPointResolutionFunc();if(s){if(r=s(t,e),i&&i!==n.getUnits()){let o=n.getMetersPerUnit();o&&(r=r*o/Je[i])}}else{let o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")r=t;else{let a=Hi(n,Et("EPSG:4326"));if(!a&&o!=="degrees")r=t*n.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);let c=ha(h.slice(0,2),h.slice(2,4)),u=ha(h.slice(4,6),h.slice(6,8));r=(c+u)/2}let l=i?Je[i]:n.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function fu(n){Jg(n),n.forEach(function(t){n.forEach(function(e){t!==e&&In(t,e,Ea)})})}function Qg(n,t,e,i){n.forEach(function(r){t.forEach(function(s){In(r,s,e),In(s,r,i)})})}function bs(n,t){return n?typeof n=="string"?Et(n):n:Et(t)}function pu(n){return(function(t,e,i,r){let s=t.length;i=i!==void 0?i:2,r=r??i,e=e!==void 0?e:new Array(s);for(let o=0;o<s;o+=r){let a=n(t.slice(o,o+i)),l=a.length;for(let h=0,c=r;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e})}function An(n,t){if(n===t)return!0;let e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||Hi(n,t)===Ea)&&e}function Hi(n,t){let e=n.getCode(),i=t.getCode(),r=ys(e,i);if(r)return r;let s=null,o=null;for(let l of qg)s||(s=l(n)),o||(o=l(t));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=_a(s.inverse,o.forward);else{let l=ys(e,a);l&&(r=_a(l,o.forward))}else{let l=ys(a,i);l&&(r=_a(s.inverse,l))}return r&&(ya(n),ya(t),In(n,t,r)),r}function _a(n,t){return function(e,i,r,s){return i=n(e,i,r,s),t(i,i,r,s)}}function qi(n,t){let e=Et(n),i=Et(t);return Hi(e,i)}function Mn(n,t,e){let i=qi(t,e);if(!i){let r=Et(t).getCode(),s=Et(e).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return i(n,void 0,n.length)}function mu(n,t,e,i){let r=qi(t,e);return Yh(n,r,void 0,i)}var _e=null;function $i(){return _e}function _r(n,t){return _e?Mn(n,t,_e):n}function xe(n,t){return _e?Mn(n,_e,t):(xa&&!Vi(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(xa=!1,_s("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n)}function xi(n,t){return _e?mu(n,t,_e):n}function ye(n,t){return _e?mu(n,_e,t):n}function _u(n,t){if(!_e)return n;let e=Et(t).getMetersPerUnit(),i=_e.getMetersPerUnit();return e&&i?n*e/i:n}function tp(){fu(da),fu(fa),Qg(fa,da,$h,Jh)}tp();var ep=[1,0,0,1,0,0],ey=new Array(6);function Lt(){return ep.slice(0)}function xu(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function dt(n,t){let e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function kt(n,t,e,i,r,s,o,a){let l=Math.sin(s),h=Math.cos(s);return n[0]=i*h,n[1]=r*l,n[2]=-i*l,n[3]=r*h,n[4]=o*i*h-a*i*l+t,n[5]=o*r*l+a*r*h+e,n}function Ss(n,t){let e=ip(t);B(e!==0,"Transformation matrix cannot be inverted");let i=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5];return n[0]=o/e,n[1]=-r/e,n[2]=-s/e,n[3]=i/e,n[4]=(s*l-o*a)/e,n[5]=-(i*l-r*a)/e,n}function ip(n){return n[0]*n[3]-n[1]*n[2]}var np=[1e5,1e5,1e5,1e5,2,2];function yu(n){return"matrix("+n.join(", ")+")"}function Rs(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function Eu(n,t){let e=Rs(n),i=Rs(t);for(let r=0;r<6;++r)if(Math.round((e[r]-i[r])*np[r])!==0)return!1;return!0}function Vt(n,t,e,i,r,s,o){s=s||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){let h=n[l],c=n[l+1];s[a++]=r[0]*h+r[2]*c+r[4],s[a++]=r[1]*h+r[3]*c+r[5];for(let u=2;u<o;u++)s[a++]=n[l+u]}return s&&s.length!=a&&(s.length=a),s}function Ts(n,t,e,i,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),h=s[0],c=s[1],u=0;for(let f=t;f<e;f+=i){let g=n[f]-h,p=n[f+1]-c;o[u++]=h+g*a-p*l,o[u++]=c+g*l+p*a;for(let _=f+2;_<f+i;++_)o[u++]=n[_]}return o&&o.length!=u&&(o.length=u),o}function wu(n,t,e,i,r,s,o,a){a=a||[];let l=o[0],h=o[1],c=0;for(let u=t;u<e;u+=i){let f=n[u]-l,g=n[u+1]-h;a[c++]=l+r*f,a[c++]=h+s*g;for(let p=u+2;p<u+i;++p)a[c++]=n[p]}return a&&a.length!=c&&(a.length=c),a}function Cu(n,t,e,i,r,s,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+r,o[a++]=n[l+1]+s;for(let h=l+2;h<l+i;++h)o[a++]=n[h]}return o&&o.length!=a&&(o.length=a),o}var vu=Lt(),rp=[NaN,NaN],Ca=class extends xt{constructor(){super(),this.extent_=ut(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=rs((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);let r=this.clone();return r.applyTransform(i),r.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return H()}closestPointXY(t,e,i,r){return H()}containsXY(t,e){return this.closestPointXY(t,e,rp,Number.MIN_VALUE)===0}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return H()}getExtent(t){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Ki(e),this.extentRevision_=this.getRevision()}return Xh(this.extent_,t)}rotate(t,e){H()}scale(t,e,i){H()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return H()}getType(){return H()}applyTransform(t){H()}intersectsExtent(t){return H()}translate(t,e){H()}transform(t,e){let i=Et(t),r=i.getUnits()=="tile-pixels"?function(s,o,a){let l=i.getExtent(),h=i.getWorldExtent(),c=ct(h)/ct(l);kt(vu,h[0],h[3],c,-c,0,0,0);let u=Vt(s,0,s.length,a,vu,o),f=qi(i,e);return f?f(u,u,a):u}:qi(i,e);return this.applyTransform(r),this}},bu=Ca;var va=class extends bu{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return wn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return H()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Ru(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){H()}setLayout(t,e,i){let r;if(t)r=Ru(t);else{for(let s=0;s<i;++s){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}r=e.length,t=sp(r)}this.layout=t,this.stride=r}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){let i=this.getFlatCoordinates();if(i){let r=this.getStride();Ts(i,0,i.length,r,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=Bt(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();wu(r,0,r.length,s,t,e,i,r),this.changed()}}translate(t,e){let i=this.getFlatCoordinates();if(i){let r=this.getStride();Cu(i,0,i.length,r,t,e,i),this.changed()}}};function sp(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function Ru(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function Su(n,t,e){let i=n.getFlatCoordinates();if(!i)return null;let r=n.getStride();return Vt(i,0,i.length,r,t,e)}var De=va;function ba(n,t,e,i){let r=0,s=n[e-i],o=n[e-i+1],a=0,l=0;for(;t<e;t+=i){let h=n[t]-s,c=n[t+1]-o;r+=l*h-a*c,a=h,l=c}return r/2}function Ra(n,t,e,i){let r=0;for(let s=0,o=e.length;s<o;++s){let a=e[s];r+=ba(n,t,a,i),t=a}return r}function Tu(n,t,e,i){let r=0;for(let s=0,o=e.length;s<o;++s){let a=e[s];r+=Ra(n,t,a,i),t=a[a.length-1]}return r}function Iu(n,t,e,i,r,s,o){let a=n[t],l=n[t+1],h=n[e]-a,c=n[e+1]-l,u;if(h===0&&c===0)u=t;else{let f=((r-a)*h+(s-l)*c)/(h*h+c*c);if(f>1)u=e;else if(f>0){for(let g=0;g<i;++g)o[g]=Nt(n[t+g],n[e+g],f);o.length=i;return}else u=t}for(let f=0;f<i;++f)o[f]=n[u+f];o.length=i}function Sa(n,t,e,i,r){let s=n[t],o=n[t+1];for(t+=i;t<e;t+=i){let a=n[t],l=n[t+1],h=ge(s,o,a,l);h>r&&(r=h),s=a,o=l}return r}function Ta(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];r=Sa(n,t,a,i,r),t=a}return r}function Lu(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];r=Ta(n,t,a,i,r),t=a[a.length-1]}return r}function Ia(n,t,e,i,r,s,o,a,l,h,c){if(t==e)return h;let u,f;if(r===0){if(f=ge(o,a,n[t],n[t+1]),f<h){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,f}return h}c=c||[NaN,NaN];let g=t+i;for(;g<e;)if(Iu(n,g-i,g,i,o,a,c),f=ge(o,a,c[0],c[1]),f<h){for(h=f,u=0;u<i;++u)l[u]=c[u];l.length=i,g+=i}else g+=i*Math.max((Math.sqrt(f)-Math.sqrt(h))/r|0,1);if(s&&(Iu(n,e-i,t,i,o,a,c),f=ge(o,a,c[0],c[1]),f<h)){for(h=f,u=0;u<i;++u)l[u]=c[u];l.length=i}return h}function La(n,t,e,i,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,f=e.length;u<f;++u){let g=e[u];h=Ia(n,t,g,i,r,s,o,a,l,h,c),t=g}return h}function Au(n,t,e,i,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,f=e.length;u<f;++u){let g=e[u];h=La(n,t,g,i,r,s,o,a,l,h,c),t=g[g.length-1]}return h}function Mu(n,t,e,i){for(let r=0,s=e.length;r<s;++r)n[t++]=e[r];return t}function xr(n,t,e,i){for(let r=0,s=e.length;r<s;++r){let o=e[r];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function Aa(n,t,e,i,r){r=r||[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=xr(n,t,e[o],i);r[s++]=l,t=l}return r.length=s,r}function Pu(n,t,e,i,r){r=r||[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=Aa(n,t,e[o],i,r[s]);l.length===0&&(l[0]=t),r[s++]=l,t=l[l.length-1]}return r.length=s,r}function Fe(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=t;o<e;o+=i)r[s++]=n.slice(o,o+i);return r.length=s,r}function Pn(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=e[o];r[s++]=Fe(n,t,l,i,r[s]),t=l}return r.length=s,r}function yr(n,t,e,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=e.length;o<a;++o){let l=e[o];r[s++]=l.length===1&&l[0]===t?[]:Pn(n,t,l,i,r[s]),t=l[l.length-1]}return r.length=s,r}function Ou(n,t,e,i,r){return!gs(r,function(o){return!yi(n,t,e,i,o[0],o[1])})}function yi(n,t,e,i,r,s){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){let h=n[t],c=n[t+1];l<=s?c>s&&(h-a)*(s-l)-(r-a)*(c-l)>0&&o++:c<=s&&(h-a)*(s-l)-(r-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function Er(n,t,e,i,r,s){if(e.length===0||!yi(n,t,e[0],i,r,s))return!1;for(let o=1,a=e.length;o<a;++o)if(yi(n,e[o-1],e[o],i,r,s))return!1;return!0}function ku(n,t,e,i,r,s){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){let l=e[o];if(Er(n,t,l,i,r,s))return!0;t=l[l.length-1]}return!1}function Du(n,t,e,i,r){let s;for(t+=i;t<e;t+=i)if(s=r(n.slice(t-i,t),n.slice(t,t+i)),s)return s;return!1}function Is(n,t,e,i,r,s){return s=s??sa(ut(),n,t,e,i),ht(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Du(n,t,e,i,function(o,a){return Wh(r,o,a)}):!1}function Ma(n,t,e,i,r){return!!(Is(n,t,e,i,r)||yi(n,t,e,i,r[0],r[1])||yi(n,t,e,i,r[0],r[3])||yi(n,t,e,i,r[2],r[1])||yi(n,t,e,i,r[2],r[3]))}function Pa(n,t,e,i,r){if(!Ma(n,t,e[0],i,r))return!1;if(e.length===1)return!0;for(let s=1,o=e.length;s<o;++s)if(Ou(n,e[s-1],e[s],i,r)&&!Is(n,e[s-1],e[s],i,r))return!1;return!0}function Fu(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];if(Pa(n,t,a,i,r))return!0;t=a[a.length-1]}return!1}function wr(n,t,e,i,r,s,o){let a=(e-t)/i;if(a<3){for(;t<e;t+=i)s[o++]=n[t],s[o++]=n[t+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let h=[t,e-i],c=0;for(;h.length>0;){let u=h.pop(),f=h.pop(),g=0,p=n[f],_=n[f+1],m=n[u],x=n[u+1];for(let E=f+i;E<u;E+=i){let C=n[E],y=n[E+1],w=Fh(C,y,p,_,m,x);w>g&&(c=E,g=w)}g>r&&(l[(c-t)/i]=1,f+i<c&&h.push(f,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(s[o++]=n[t+u*i],s[o++]=n[t+u*i+1]);return o}function zu(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){let c=e[l];o=wr(n,t,c,i,r,s,o),a.push(o),t=c}return o}function Ei(n,t){return t*Math.round(n/t)}function op(n,t,e,i,r,s,o){if(t==e)return o;let a=Ei(n[t],r),l=Ei(n[t+1],r);t+=i,s[o++]=a,s[o++]=l;let h,c;do if(h=Ei(n[t],r),c=Ei(n[t+1],r),t+=i,t==e)return s[o++]=h,s[o++]=c,o;while(h==a&&c==l);for(;t<e;){let u=Ei(n[t],r),f=Ei(n[t+1],r);if(t+=i,u==h&&f==c)continue;let g=h-a,p=c-l,_=u-a,m=f-l;if(g*m==p*_&&(g<0&&_<g||g==_||g>0&&_>g)&&(p<0&&m<p||p==m||p>0&&m>p)){h=u,c=f;continue}s[o++]=h,s[o++]=c,a=h,l=c,h=u,c=f}return s[o++]=h,s[o++]=c,o}function Cr(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){let c=e[l];o=op(n,t,c,i,r,s,o),a.push(o),t=c}return o}function Nu(n,t,e,i,r,s,o,a){for(let l=0,h=e.length;l<h;++l){let c=e[l],u=[];o=Cr(n,t,c,i,r,s,o,u),a.push(u),t=c[c.length-1]}return o}var Oa=class n extends De{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new n(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,r){return r<pi(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Sa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ia(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,r))}getArea(){return ba(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Fe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let e=[];return e.length=wr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new n(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return Is(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xr(this.flatCoordinates,0,t,this.stride),this.changed()}},ka=Oa;var Da=class n extends De{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){let t=new n(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,r){let s=this.flatCoordinates,o=ge(t,e,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)i[l]=s[l];return i.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return ds(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return fr(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Mu(this.flatCoordinates,0,t,this.stride),this.changed()}},wi=Da;function vr(n,t,e,i,r,s,o){let a,l,h,c,u,f,g,p=r[s+1],_=[];for(let E=0,C=e.length;E<C;++E){let y=e[E];for(c=n[y-i],f=n[y-i+1],a=t;a<y;a+=i)u=n[a],g=n[a+1],(p<=f&&g<=p||f<=p&&p<=g)&&(h=(p-f)/(g-f)*(u-c)+c,_.push(h)),c=u,f=g}let m=NaN,x=-1/0;for(_.sort(Zt),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];let E=Math.abs(u-c);E>x&&(h=(c+u)/2,Er(n,t,e,i,h,p)&&(m=h,x=E)),c=u}return isNaN(m)&&(m=r[s]),o?(o.push(m,p,x),o):[m,p,x]}function Ls(n,t,e,i,r){let s=[];for(let o=0,a=e.length;o<a;++o){let l=e[o];s=vr(n,t,l,i,r,2*o,s),t=l[l.length-1]}return s}function Gu(n,t,e,i){for(;t<e-i;){for(let r=0;r<i;++r){let s=n[t+r];n[t+r]=n[e-i+r],n[e-i+r]=s}t+=i,e-=i}}function Fa(n,t,e,i){let r=0,s=n[e-i],o=n[e-i+1];for(;t<e;t+=i){let a=n[t],l=n[t+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function za(n,t,e,i,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){let a=e[s],l=Fa(n,t,a,i);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;t=a}return!0}function Xu(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s){let a=e[s];if(!za(n,t,a,i,r))return!1;a.length&&(t=a[a.length-1])}return!0}function As(n,t,e,i,r){r=r!==void 0?r:!1;for(let s=0,o=e.length;s<o;++s){let a=e[s],l=Fa(n,t,a,i);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Gu(n,t,a,i),t=a}return t}function Na(n,t,e,i,r){for(let s=0,o=e.length;s<o;++s)t=As(n,t,e[s],i,r);return t}function Wu(n,t){let e=[],i=0,r=0,s;for(let o=0,a=t.length;o<a;++o){let l=t[o],h=Fa(n,i,l,2);if(s===void 0&&(s=h),h===s)e.push(t.slice(r,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[r])}r=o+1,i=l}return e}var Ms=class n extends De{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?fe(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new n(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,r){return r<pi(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ta(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),La(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,r))}containsXY(t,e){return Er(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Ra(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),As(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Pn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let t=Bt(this.getExtent());this.flatInteriorPoint_=vr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new wi(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new ka(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){let t=this.layout,e=this.flatCoordinates,i=this.ends_,r=[],s=0;for(let o=0,a=i.length;o<a;++o){let l=i[o],h=new ka(e.slice(s,l),t);r.push(h),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;za(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=As(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let e=[],i=[];return e.length=Cr(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new n(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Pa(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);let i=Aa(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}},Ci=Ms;function Ga(n){if(ke(n))throw new Error("Cannot create polygon from empty extent");let t=n[0],e=n[1],i=n[2],r=n[3],s=[t,e,t,r,i,r,i,e,t,e];return new Ms(s,"XY",[s.length])}function Xa(n,t,e,i){let r=j(t)/e[0],s=ct(t)/e[1];return i?Math.min(n,Math.max(r,s)):Math.min(n,Math.min(r,s))}function Wa(n,t,e){let i=Math.min(n,t),r=50;return i*=Math.log(1+r*Math.max(0,n/t-1))/r+1,e&&(i=Math.max(i,e),i/=Math.log(1+r*Math.max(0,e/n-1))/r+1),et(i,e/2,t*2)}function Yu(n,t,e,i){return t=t!==void 0?t:!0,(function(r,s,o,a){if(r!==void 0){let l=n[0],h=n[n.length-1],c=e?Xa(l,e,o,i):l;if(a)return t?Wa(r,c,h):et(r,h,c);let u=Math.min(c,r),f=Math.floor(_n(n,u,s));return n[f]>c&&f<n.length-1?n[f+1]:n[f]}})}function Uu(n,t,e,i,r,s){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,h){if(o!==void 0){let c=r?Xa(t,r,l,s):t;if(h)return i?Wa(o,c,e):et(o,e,c);let u=1e-9,f=Math.ceil(Math.log(t/c)/Math.log(n)-u),g=-a*(.5-u)+.5,p=Math.min(c,o),_=Math.floor(Math.log(t/p)/Math.log(n)+g),m=Math.max(f,_),x=t/Math.pow(n,m);return et(x,e,c)}})}function Ya(n,t,e,i,r){return e=e!==void 0?e:!0,(function(s,o,a,l){if(s!==void 0){let h=i?Xa(n,i,a,r):n;return!e||!l?et(s,t,h):Wa(s,h,t)}})}function On(n){if(n!==void 0)return 0}function Ua(n){if(n!==void 0)return n}function Ku(n){let t=2*Math.PI/n;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function Zu(n){let t=n===void 0?pe(5):n;return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}var Ka=0,Ba=class extends xt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=bs(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&gu(),t.center&&(t.center=xe(t.center,this.projection_)),t.extent&&(t.extent=ye(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){let e=Object.assign({},t);for(let a in oe)delete e[a];this.setProperties(e,!0);let i=lp(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;let r=ap(t),s=i.constraint,o=cp(t);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;let i=this.getCenterInternal();if(i){let r=t||[0,0,0,0];e=e||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-e[3]+e[1]-r[1]),a=s/2*(r[0]-e[0]+e[2]-r[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){let e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let e=new Array(arguments.length);for(let i=0;i<e.length;++i){let r=arguments[i];r.center&&(r=Object.assign({},r),r.center=xe(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=xe(r.anchor,this.getProjection())),e[i]=r}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let r=0;for(;r<e&&!this.isDef();++r){let c=arguments[r];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(r===e){i&&Ps(i,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,h=[];for(;r<e;++r){let c=arguments[r],u={start:s,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||jh,callback:i};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;let f=Me(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+f,l=u.targetRotation}hp(u)?u.complete=!0:s+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(Rt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Rt.ANIMATING]>0}getInteracting(){return this.hints_[Rt.INTERACTING]>0}cancelAnimations(){this.setHint(Rt.ANIMATING,-this.hints_[Rt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){let r=this.animations_[e];if(r[0].callback&&Ps(r[0].callback,!1),!t)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let t=Date.now(),e=!1;for(let i=this.animations_.length-1;i>=0;--i){let r=this.animations_[i],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let h=t-l.start,c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):s=!1;let u=l.easing(c);if(l.sourceCenter){let f=l.sourceCenter[0],g=l.sourceCenter[1],p=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;let m=f+u*(p-f),x=g+u*(_-g);this.targetCenter_=[m,x]}if(l.sourceResolution&&l.targetResolution){let f=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){let g=this.getViewportSize_(this.getRotation()),p=this.constraints_.resolution(f,0,g,!0);this.targetCenter_=this.calculateCenterZoom(p,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=f,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let f=u===1?Me(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){let g=this.constraints_.rotation(f,!0);this.targetCenter_=this.calculateCenterRotate(g,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=f}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(s){this.animations_[i]=null,this.setHint(Rt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&Ps(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i,r=this.getCenterInternal();return r!==void 0&&(i=[r[0]-e[0],r[1]-e[1]],Rn(i,t-this.getRotation()),Kh(i,e)),i}calculateCenterZoom(t,e){let i,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=e[0]-t*(e[0]-r[0])/s,a=e[1]-t*(e[1]-r[1])/s;i=[o,a]}return i}getViewportSize_(t){let e=this.viewportSize_;if(t){let i=e[0],r=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(r*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(r*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let t=this.getCenterInternal();return t&&_r(t,this.getProjection())}getCenterInternal(){return this.get(oe.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){let e=this.calculateExtentInternal(t);return xi(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();let e=this.getCenterInternal();B(e,"The view center is not defined");let i=this.getResolution();B(i!==void 0,"The view resolution is not defined");let r=this.getRotation();return B(r!==void 0,"The view rotation is not defined"),pr(e,i,r,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(oe.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(ye(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();let i=j(t)/e[0],r=ct(t)/e[1];return Math.max(i,r)}getResolutionForValueFunction(t){t=t||2;let e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,r=Math.log(e/i)/Math.log(t);return(function(s){return e/Math.pow(t,s*r)})}getRotation(){return this.get(oe.ROTATION)}getValueForResolutionFunction(t){let e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(i/r)/e;return(function(o){return Math.log(i/o)/e/s})}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t),i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){let t=this.getProjection(),e=this.getResolution(),i=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=Za(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],e,i)}return{center:r.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t,e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,r;if(this.resolutions_){let s=_n(this.resolutions_,t,1);e=s,i=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=i/this.resolutions_[s+1]}else i=this.maxResolution_,r=this.zoomFactor_;return e+Math.log(i/t)/Math.log(r)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let e=et(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,et(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(B(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){B(!ke(t),"Cannot fit empty extent provided as `geometry`");let r=ye(t,this.getProjection());i=Ga(r)}else if(t.getType()==="Circle"){let r=ye(t.getExtent(),this.getProjection());i=Ga(r),i.rotate(this.getRotation(),Bt(r))}else{let r=$i();r?i=t.clone().transform(r,this.getProjection()):i=t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){let e=this.getRotation(),i=Math.cos(e),r=Math.sin(-e),s=t.getFlatCoordinates(),o=t.getStride(),a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,f=s.length;u<f;u+=o){let g=s[u]*i-s[u+1]*r,p=s[u]*r+s[u+1]*i;a=Math.min(a,g),l=Math.min(l,p),h=Math.max(h,g),c=Math.max(c,p)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());let r=e.padding!==void 0?e.padding:[0,0,0,0],s=e.nearest!==void 0?e.nearest:!1,o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;let a=this.rotatedExtentForGeometry(t),l=this.getResolutionForExtentInternal(a,[i[0]-r[1]-r[3],i[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),f=Bt(a);f[0]+=(r[1]-r[3])/2*l,f[1]+=(r[0]-r[2])/2*l;let g=f[0]*u-f[1]*c,p=f[1]*u+f[0]*c,_=this.getConstrainedCenter([g,p],l),m=e.callback?e.callback:$e;e.duration!==void 0?this.animateInternal({resolution:l,center:_,duration:e.duration,easing:e.easing},m):(this.targetResolution_=l,this.targetCenter_=_,this.applyTargetState_(!1,!0),Ps(m,!0))}centerOn(t,e,i){this.centerOnInternal(xe(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Za(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,r){let s,o=this.padding_;if(o&&t){let a=this.getViewportSizeMinusPadding_(-i),l=Za(t,r,[a[0]/2+o[3],a[1]/2+o[0]],e,i);s=[t[0]-l[0],t[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){let e=_r(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){let e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&xe(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){let i=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,r,i);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=xe(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){let i=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(r,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&xe(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){let i=this.getAnimating()||this.getInteracting()||e,r=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,i),a=this.constraints_.center(this.targetCenter_,o,s,i,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(oe.ROTATION)!==r&&this.set(oe.ROTATION,r),this.get(oe.RESOLUTION)!==o&&(this.set(oe.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(oe.CENTER)||!Vi(this.get(oe.CENTER),a))&&this.set(oe.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;let r=e||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!Vi(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:t,easing:le,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Rt.INTERACTING,1)}endInteraction(t,e,i){i=i&&xe(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(Rt.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){let i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){let i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;let i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}};function Ps(n,t){setTimeout(function(){n(t)},0)}function ap(n){if(n.extent!==void 0){let e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return na(n.extent,n.constrainOnlyCenter,e)}let t=bs(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,na(e,!1,!1)}return Nh}function lp(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:Ka,a=n.maxZoom!==void 0?n.maxZoom:28,l=n.zoomFactor!==void 0?n.zoomFactor:2,h=n.multiWorld!==void 0?n.multiWorld:!1,c=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,u=n.showFullExtent!==void 0?n.showFullExtent:!1,f=bs(n.projection,"EPSG:3857"),g=f.getExtent(),p=n.constrainOnlyCenter,_=n.extent;if(!h&&!_&&f.isGlobal()&&(p=!1,_=g),n.resolutions!==void 0){let m=n.resolutions;e=m[o],i=m[a]!==void 0?m[a]:m[m.length-1],n.constrainResolution?t=Yu(m,c,!p&&_,u):t=Ya(e,i,c,!p&&_,u)}else{let x=(g?Math.max(j(g),ct(g)):360*Je.degrees/f.getMetersPerUnit())/256/Math.pow(2,Ka),E=x/Math.pow(2,28-Ka);e=n.maxResolution,e!==void 0?o=0:e=x/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=x/Math.pow(l,a):i=E),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=Uu(l,e,i,c,!p&&_,u):t=Ya(e,i,c,!p&&_,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function cp(n){if(n.enableRotation!==void 0?n.enableRotation:!0){let e=n.constrainRotation;return e===void 0||e===!0?Zu():e===!1?Ua:typeof e=="number"?Ku(e):Ua}return On}function hp(n){return!(n.sourceCenter&&n.targetCenter&&!Vi(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function Za(n,t,e,i,r){let s=Math.cos(-r),o=Math.sin(-r),a=n[0]*s-n[1]*o,l=n[1]*s+n[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;let h=a*s-l*o,c=l*s+a*o;return[h,c]}var Qt=Ba;var br="ol-hidden";var vi="ol-unselectable";var kn="ol-control",Va="ol-collapsed",up=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),Vu=["style","variant","weight","size","lineHeight","family"],Os={normal:400,bold:700},ks=function(n){let t=n.match(up);if(!t)return null;let e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,r=Vu.length;i<r;++i){let s=t[i+1];s!==void 0&&(e[Vu[i]]=typeof s=="string"?s.trim():s)}return isNaN(Number(e.weight))&&e.weight in Os&&(e.weight=Os[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e};function nt(n,t,e,i){let r;return e&&e.length?r=e.shift():bt?r=new class extends OffscreenCanvas{style={}}(n??300,t??150):r=document.createElement("canvas"),n&&(r.width=n),t&&(r.height=t),r.getContext("2d",i)}var ja;function Rr(){return ja||(ja=nt(1,1)),ja}function Ji(n){let t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function Ha(n,t){let e=t.parentNode;e&&e.replaceChild(n,t)}function ju(n){for(;n.lastChild;)n.lastChild.remove()}function Hu(n,t){let e=n.childNodes;for(let i=0;;++i){let r=e[i],s=t[i];if(!r&&!s)break;if(r!==s){if(!r){n.appendChild(s);continue}if(!s){n.removeChild(r),--i;continue}n.insertBefore(s,r)}}}function Ds(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){let e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){let i=this.childNodes.indexOf(e);if(i===-1)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}})}function te(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}var qa=class extends xt{constructor(t){super();let e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,i=this.listenerKeys.length;e<i;++e)J(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){let e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==$e&&this.listenerKeys.push(K(t,Ae.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}},Dn=qa;var $a=class extends Dn{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;let e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",r=t.expandClassName!==void 0?t.expandClassName:e+"-expand",s=t.collapseLabel!==void 0?t.collapseLabel:"\u203A",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(P.CLICK,this.handleClick_.bind(this),!1);let h=e+" "+vi+" "+kn+(this.collapsed_&&this.collapsible_?" "+Va:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){let e=this.getMap().getAllLayers(),i=new Set(e.flatMap(r=>r.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>i.add(r)):i.add(this.attributions_)),!this.overrideCollapsible_){let r=!e.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let e=await Promise.all(this.collectSourceAttributions_(t).map(r=>Ih(()=>r))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!zt(e,this.renderedAttributions_)){ju(this.ulElement_);for(let r=0,s=e.length;r<s;++r){let o=document.createElement("li");o.innerHTML=e[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Va),this.collapsed_?Ha(this.collapseLabel_,this.label_):Ha(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}},qu=$a;var Ja=class extends Dn{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});let e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"\u21E7",r=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(r));let s=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(P.CLICK,this.handleClick_.bind(this),!1);let a=e+" "+vi+" "+kn,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(br)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let e=this.getMap().getView();if(!e)return;let i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:le}):e.setRotation(0))}render(t){let e=t.frameState;if(!e)return;let i=e.viewState.rotation;if(i!=this.rotation_){let r="rotate("+i+"rad)";if(this.autoHide_){let s=this.element.classList.contains(br);!s&&i===0?this.element.classList.add(br):s&&i!==0&&this.element.classList.remove(br)}this.label_.style.transform=r}this.rotation_=i}},$u=Ja;var Qa=class extends Dn{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});let e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,r=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",s=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"\u2013",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=r,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(P.CLICK,this.handleClick_.bind(this,i),!1);let u=document.createElement("button");u.className=s,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(P.CLICK,this.handleClick_.bind(this,-i),!1);let f=e+" "+vi+" "+kn,g=this.element;g.className=f,g.appendChild(c),g.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){let i=this.getMap().getView();if(!i)return;let r=i.getZoom();if(r!==void 0){let s=i.getConstrainedZoom(r+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:s,duration:this.duration_,easing:le})):i.setZoom(s)}}},Ju=Qa;function Fs(n){n=n||{};let t=new Pt;return(n.zoom===void 0||n.zoom)&&t.push(new Ju(n.zoomOptions)),(n.rotate===void 0||n.rotate)&&t.push(new $u(n.rotateOptions)),(n.attribution===void 0||n.attribution)&&t.push(new qu(n.attributionOptions)),t}var tl=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;let t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;let r=this.points_[e+2]-this.points_[i+2];if(r<1e3/60)return!1;let s=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},Qu=tl;var el={ACTIVE:"active"};var il=class extends xt{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(el.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(el.ACTIVE,t)}setMap(t){this.map_=t}};function td(n,t,e){let i=n.getCenterInternal();if(i){let r=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:Hh,center:n.getConstrainedCenter(r)})}}function Fn(n,t,e,i){let r=n.getZoom();if(r===void 0)return;let s=n.getConstrainedZoom(r+t),o=n.getResolutionForZoom(s);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:le})}var ze=il;var nl=class extends ze{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==at.DBLCLICK){let i=t.originalEvent,r=t.map,s=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=r.getView();Fn(a,o,s,this.duration_),i.preventDefault(),e=!0}return!e}},ed=nl;function Sr(n){let t=arguments;return function(e){let i=!0;for(let r=0,s=t.length;r<s&&(i=i&&t[r](e),!!i);++r);return i}}var id=function(n){let t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},dp=function(n){let t=n.map.getTargetElement(),e=t.getRootNode(),i=n.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},zs=function(n){let t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?dp(n):!0},nd=He;var Ns=function(n){let t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(Ah&&Jo&&t.ctrlKey)};var Gs=function(n){let t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey};var rd=function(n){let t=n.originalEvent;return Jo?t.metaKey:t.ctrlKey},sd=function(n){let t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Xs=function(n){let t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},Ws=function(n){let t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"};var od=function(n){let t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};var rl=class extends ze{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==at.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==at.POINTERUP){let i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==at.POINTERDOWN){let i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==at.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}};function zn(n){let t=n.length,e=0,i=0;for(let r=0;r<t;r++)e+=n[r].clientX,i+=n[r].clientY;return{clientX:e/t,clientY:i/t}}var Ne=rl;var sl=class extends Ne{constructor(t){super({stopDown:qe}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let e=t.condition?t.condition:Sr(Gs,od);this.condition_=t.onFocusOnly?Sr(zs,e):e,this.noKinetic_=!1}handleDragEvent(t){let e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());let i=this.targetPointers,r=e.getEventPixel(zn(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=t.map.getView();Zh(s,a.getResolution()),Rn(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){let e=t.map,i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:le})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){let i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},ad=sl;var ol=class extends Ne{constructor(t){t=t||{},super({stopDown:qe}),this.condition_=t.condition?t.condition:id,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!Ws(t))return;let e=t.map,i=e.getView();if(i.getConstraints().rotation===On)return;let r=e.getSize(),s=t.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return Ws(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return Ws(t)&&Ns(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},ld=ol;var al=class extends di{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let t=this.startPixel_,e=this.endPixel_,i="px",r=this.element_.style;r.left=Math.min(t[0],e[0])+i,r.top=Math.min(t[1],e[1])+i,r.width=Math.abs(e[0]-t[0])+i,r.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let t=this.startPixel_,e=this.endPixel_,r=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new Ci([r])}getGeometry(){return this.geometry_}},cd=al;var Nn={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},Qi=class extends Tt{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}},ll=class extends Ne{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new cd(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Ns,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){let r=i[0]-e[0],s=i[1]-e[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Qi(Nn.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;let e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Qi(e?Nn.BOXEND:Nn.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Qi(Nn.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Qi(Nn.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Qi(Nn.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}},hd=ll;var cl=class extends hd{constructor(t){t=t||{};let e=t.condition?t.condition:sd;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){let i=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=i.rotatedExtentForGeometry(r),o=i.getResolutionForExtentInternal(s),a=i.getResolution()/o;r=r.clone(),r.scale(a*a)}i.fitInternal(r,{duration:this.duration_,easing:le})}},ud=cl;var bi={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var hl=class extends ze{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Gs(e)&&Xs(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==P.KEYDOWN){let i=t.originalEvent,r=i.key;if(this.condition_(t)&&(r==bi.DOWN||r==bi.LEFT||r==bi.RIGHT||r==bi.UP)){let o=t.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,h=0;r==bi.DOWN?h=-a:r==bi.LEFT?l=-a:r==bi.RIGHT?l=a:h=a;let c=[l,h];Rn(c,o.getRotation()),td(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}},dd=hl;var ul=class extends ze{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!rd(e)&&Xs(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==P.KEYDOWN||t.type==P.KEYPRESS){let i=t.originalEvent,r=i.key;if(this.condition_(t)&&(r==="+"||r==="-")){let s=t.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();Fn(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},fd=ul;var fp=40,gp=300,pp=3,dl=class extends ze{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;let e=t.condition?t.condition:nd;this.condition_=t.onFocusOnly?Sr(zs,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(t){if(this.ctrlKeyListenerKeys_.forEach(J),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(t),t){let e=t.getOwnerDocument();this.ctrlKeyListenerKeys_.push(K(e,"keydown",i=>{i.key==="Control"&&(this.ctrlKeyPressed_=!0)}),K(e,"keyup",i=>{i.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let t=this.getMap();if(!t)return;let e=t.getView(),i=this.lastDelta_?this.lastDelta_>0?1:-1:0;e.endInteraction(this.constrainResolution_||e.getConstrainResolution()?100:void 0,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==P.WHEEL)return!0;let i=t.map,r=t.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=t.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=fp;break;case WheelEvent.DOM_DELTA_PAGE:o*=gp;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=i.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*pp),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let h=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),h),!1}handleWheelZoom_(t){let e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-et(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Fn(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}},gd=dl;var fl=class extends Ne{constructor(t){t=t||{};let e=t;e.stopDown||(e.stopDown=qe),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0,i=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-i.clientY,r.clientX-i.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=s;let o=t.map,a=o.getView();a.getConstraints().rotation!==On&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(zn(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){let e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},pd=fl;var gl=class extends Ne{constructor(t){t=t||{};let e=t;e.stopDown||(e.stopDown=qe),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1,i=this.targetPointers[0],r=this.targetPointers[1],s=i.clientX-r.clientX,o=i.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;let l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(zn(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){let i=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){let e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},md=gl;function Ys(n){n=n||{};let t=new Pt,e=new Qu(-.005,.05,100);return(n.altShiftDragRotate===void 0||n.altShiftDragRotate)&&t.push(new ld),(n.doubleClickZoom===void 0||n.doubleClickZoom)&&t.push(new ed({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan===void 0||n.dragPan)&&t.push(new ad({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate===void 0||n.pinchRotate)&&t.push(new pd),(n.pinchZoom===void 0||n.pinchZoom)&&t.push(new md({duration:n.zoomDuration})),(n.keyboard===void 0||n.keyboard)&&(t.push(new dd),t.push(new fd({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom===void 0||n.mouseWheelZoom)&&t.push(new gd({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom===void 0||n.shiftDragZoom)&&t.push(new ud({duration:n.zoomDuration})),t}var rt={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var pl=class extends xt{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;let e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[rt.OPACITY]=t.opacity!==void 0?t.opacity:1,B(typeof e[rt.OPACITY]=="number","Layer opacity must be a number"),e[rt.VISIBLE]=t.visible!==void 0?t.visible:!0,e[rt.Z_INDEX]=t.zIndex,e[rt.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[rt.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[rt.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[rt.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){let e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=et(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return H()}getLayerStatesArray(t){return H()}getExtent(){return this.get(rt.EXTENT)}getMaxResolution(){return this.get(rt.MAX_RESOLUTION)}getMinResolution(){return this.get(rt.MIN_RESOLUTION)}getMinZoom(){return this.get(rt.MIN_ZOOM)}getMaxZoom(){return this.get(rt.MAX_ZOOM)}getOpacity(){return this.get(rt.OPACITY)}getSourceState(){return H()}getVisible(){return this.get(rt.VISIBLE)}getZIndex(){return this.get(rt.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(rt.EXTENT,t)}setMaxResolution(t){this.set(rt.MAX_RESOLUTION,t)}setMinResolution(t){this.set(rt.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(rt.MAX_ZOOM,t)}setMinZoom(t){this.set(rt.MIN_ZOOM,t)}setOpacity(t){B(typeof t=="number","Layer opacity must be a number"),this.set(rt.OPACITY,t)}setVisible(t){this.set(rt.VISIBLE,t)}setZIndex(t){this.set(rt.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Us=pl;var Ri={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Ee=class extends Tt{constructor(t,e){super(t),this.layer=e}},ml={LAYERS:"layers"},_l=class n extends Us{constructor(t){t=t||{};let e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ml.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Pt(i.slice(),{unique:!0}):B(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Pt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(J),this.layersListenerKeys_.length=0;let t=this.getLayers();this.layersListenerKeys_.push(K(t,It.ADD,this.handleLayersAdd_,this),K(t,It.REMOVE,this.handleLayersRemove_,this));for(let i in this.listenerKeys_)this.listenerKeys_[i].forEach(J);Ie(this.listenerKeys_);let e=t.getArray();for(let i=0,r=e.length;i<r;i++){let s=e[i];this.registerLayerListeners_(s),this.dispatchEvent(new Ee(Ri.ADDLAYER,s))}this.changed()}registerLayerListeners_(t){let e=[K(t,ue.PROPERTYCHANGE,this.handleLayerChange_,this),K(t,P.CHANGE,this.handleLayerChange_,this)];t instanceof n&&e.push(K(t,Ri.ADDLAYER,this.handleLayerGroupAdd_,this),K(t,Ri.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Y(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Ee(Ri.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Ee(Ri.REMOVELAYER,t.layer))}handleLayersAdd_(t){let e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Ee(Ri.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){let e=t.element,i=Y(e);this.listenerKeys_[i].forEach(J),delete this.listenerKeys_[i],this.dispatchEvent(new Ee(Ri.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(ml.LAYERS)}setLayers(t){let e=this.getLayers();if(e){let i=e.getArray();for(let r=0,s=i.length;r<s;++r)this.dispatchEvent(new Ee(Ri.REMOVELAYER,i[r]))}this.set(ml.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){let e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});let r=this.getLayerState(),s=r.zIndex;!t&&r.zIndex===void 0&&(s=0);for(let o=i,a=e.length;o<a;o++){let l=e[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=Oe(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return e}getSourceState(){return"ready"}},Tr=_l;var Dt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var xl=class extends Us{constructor(t){let e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(rt.SOURCE,this.handleSourcePropertyChange_);let i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(rt.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(J(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let t=this.getSource();t&&(this.sourceChangeKey_=K(t,P.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e,i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof Qt?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let r;if(e.layerStatesArray){if(r=e.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return Ir(r,e.viewState)&&(!s||ht(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e=this.getSource()?.getAttributions();if(!e)return[];let i=t instanceof Qt?t.getViewStateAndExtent():t,r=e(i);return Array.isArray(r)||(r=[r]),r}render(t,e){let i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){let e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(rt.MAP,t)}getMapInternal(){return this.get(rt.MAP)}setMap(t){this.mapPrecomposeKey_&&(J(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(J(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=K(t,Dt.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=K(this,P.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){let e=t.frameState.layerStatesArray,i=this.getLayerState(!1);B(!e.some(r=>r.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(rt.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function Ir(n,t){if(!n.visible)return!1;let e=t.resolution;if(e<n.minResolution||e>=n.maxResolution)return!1;let i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}var tn=xl;function Ks(n,t,e=0,i=n.length-1,r=mp){for(;i>e;){if(i-e>600){let l=i-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),g=Math.max(e,Math.floor(t-h*u/l+f)),p=Math.min(i,Math.floor(t+(l-h)*u/l+f));Ks(n,t,g,p,r)}let s=n[t],o=e,a=i;for(Lr(n,e,t),r(n[i],s)>0&&Lr(n,e,i);o<a;){for(Lr(n,o,a),o++,a--;r(n[o],s)<0;)o++;for(;r(n[a],s)>0;)a--}r(n[e],s)===0?Lr(n,e,a):(a++,Lr(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function Lr(n,t,e){let i=n[t];n[t]=n[e],n[e]=i}function mp(n,t){return n<t?-1:n>t?1:0}var en=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data,i=[];if(!Bs(t,e))return i;let r=this.toBBox,s=[];for(;e;){for(let o=0;o<e.children.length;o++){let a=e.children[o],l=e.leaf?r(a):a;Bs(t,l)&&(e.leaf?i.push(a):El(t,l)?this._all(a,i):s.push(a))}e=s.pop()}return i}collides(t){let e=this.data;if(!Bs(t,e))return!1;let i=[];for(;e;){for(let r=0;r<e.children.length;r++){let s=e.children[r],o=e.leaf?this.toBBox(s):s;if(Bs(t,o)){if(e.leaf||El(t,o))return!0;i.push(s)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){let i=this.data;this.data=e,e=i}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Xn([]),this}remove(t,e){if(!t)return this;let i=this.data,r=this.toBBox(t),s=[],o=[],a,l,h;for(;i||s.length;){if(i||(i=s.pop(),l=s[s.length-1],a=o.pop(),h=!0),i.leaf){let c=_p(t,i.children,e);if(c!==-1)return i.children.splice(c,1),s.push(i),this._condense(s),this}!h&&!i.leaf&&El(i,r)?(s.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],h=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){let i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,r){let s=i-e+1,o=this._maxEntries,a;if(s<=o)return a=Xn(t.slice(e,i+1)),Gn(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Xn([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),h=l*Math.ceil(Math.sqrt(o));_d(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){let u=Math.min(c+h-1,i);_d(t,c,u,l,this.compareMinY);for(let f=c;f<=u;f+=l){let g=Math.min(f+l-1,u);a.children.push(this._build(t,f,g,r-1))}}return Gn(a,this.toBBox),a}_chooseSubtree(t,e,i,r){for(;r.push(e),!(e.leaf||r.length-1===i);){let s=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){let h=e.children[l],c=yl(h),u=Ep(t,h)-c;u<o?(o=u,s=c<s?c:s,a=h):u===o&&c<s&&(s=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,i){let r=i?t:this.toBBox(t),s=[],o=this._chooseSubtree(r,this.data,e,s);for(o.children.push(t),Mr(o,r);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(r,s,e)}_split(t,e){let i=t[e],r=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,r);let o=this._chooseSplitIndex(i,s,r),a=Xn(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,Gn(i,this.toBBox),Gn(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=Xn([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Gn(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let r,s=1/0,o=1/0;for(let a=e;a<=i-e;a++){let l=Ar(t,0,a,this.toBBox),h=Ar(t,a,i,this.toBBox),c=wp(l,h),u=yl(l)+yl(h);c<s?(s=c,r=a,o=u<o?u:o):c===s&&u<o&&(o=u,r=a)}return r||i-e}_chooseSplitAxis(t,e,i){let r=t.leaf?this.compareMinX:xp,s=t.leaf?this.compareMinY:yp,o=this._allDistMargin(t,e,i,r),a=this._allDistMargin(t,e,i,s);o<a&&t.children.sort(r)}_allDistMargin(t,e,i,r){t.children.sort(r);let s=this.toBBox,o=Ar(t,0,e,s),a=Ar(t,i-e,i,s),l=Zs(o)+Zs(a);for(let h=e;h<i-e;h++){let c=t.children[h];Mr(o,t.leaf?s(c):c),l+=Zs(o)}for(let h=i-e-1;h>=e;h--){let c=t.children[h];Mr(a,t.leaf?s(c):c),l+=Zs(a)}return l}_adjustParentBBoxes(t,e,i){for(let r=i;r>=0;r--)Mr(e[r],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():Gn(t[e],this.toBBox)}};function _p(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function Gn(n,t){Ar(n,0,n.children.length,t,n)}function Ar(n,t,e,i,r){r||(r=Xn(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=t;s<e;s++){let o=n.children[s];Mr(r,n.leaf?i(o):o)}return r}function Mr(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function xp(n,t){return n.minX-t.minX}function yp(n,t){return n.minY-t.minY}function yl(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Zs(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Ep(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function wp(n,t){let e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),r=Math.min(n.maxX,t.maxX),s=Math.min(n.maxY,t.maxY);return Math.max(0,r-e)*Math.max(0,s-i)}function El(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Bs(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Xn(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _d(n,t,e,i,r){let s=[t,e];for(;s.length;){if(e=s.pop(),t=s.pop(),e-t<=i)continue;let o=t+Math.ceil((e-t)/i/2)*i;Ks(n,o,t,e,r),s.push(t,o,o,e)}}var js=[NaN,NaN,NaN,0],wl;function Cp(){return wl||(wl=nt(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),wl}var vp=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,bp=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Rp=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Sp=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Vs(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function Or(n){throw new Error('failed to parse "'+n+'" as color')}function xd(n){if(n.toLowerCase().startsWith("rgb")){let s=n.match(bp)||n.match(vp)||n.match(Rp);if(s){let o=s[4],a=100/255;return[et(Vs(s[1],a)+.5|0,0,255),et(Vs(s[2],a)+.5|0,0,255),et(Vs(s[3],a)+.5|0,0,255),o!==void 0?et(Vs(o,100),0,1):1]}Or(n)}if(n.startsWith("#")){if(Sp.test(n)){let s=n.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,h=s.length;l<h;l+=o){let c=parseInt(s.substring(l,l+o),16);o===1&&(c+=c<<4),a[l/o]=c}return a[3]=a[3]/255,a}Or(n)}let t=Cp();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=n,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=n,t.fillStyle===e&&Or(n));let i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return xd(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let r=Array.from(t.getImageData(0,0,1,1).data);return r[3]=Ui(r[3]/255,3),r}function yd(n){return typeof n=="string"?n:Dr(n)}var Tp=1024,Pr={},Cl=0;function Ed(n){if(n.length===4)return n;let t=n.slice();return t[3]=1,t}function vl(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function bl(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function Rl(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function Sl(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function Tl(n){let t=Rl(n[0]),e=Rl(n[1]),i=Rl(n[2]),r=Sl(t*.222488403+e*.716873169+i*.06060791),s=500*(Sl(t*.452247074+e*.399439023+i*.148375274)-r),o=200*(r-Sl(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,n[3]]}function wd(n){let t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,r=bl(t),s=bl(t+e/500*Math.cos(i)),o=bl(t-e/200*Math.sin(i)),a=vl(s*3.021973625-r*1.617392459-o*.404875592),l=vl(s*-.943766287+r*1.916279586+o*.027607165),h=vl(s*.069407491-r*.22898585+o*1.159737864);return[et(a+.5|0,0,255),et(l+.5|0,0,255),et(h+.5|0,0,255),n[3]]}function kr(n){if(n==="none")return js;if(Pr.hasOwnProperty(n))return Pr[n];if(Cl>=Tp){let e=0;for(let i in Pr)(e++&3)===0&&(delete Pr[i],--Cl)}let t=xd(n);t.length!==4&&Or(n);for(let e of t)isNaN(e)&&Or(n);return Pr[n]=t,++Cl,t}function he(n){return Array.isArray(n)?n:kr(n)}function Dr(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];e!=(e|0)&&(e=e+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);let r=n[3]===void 0?1:Math.round(n[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+r+")"}function Il(n){return n[0]>0&&n[1]>0}function Cd(n,t,e){return e===void 0&&(e=[0,0]),e[0]=n[0]*t+.5|0,e[1]=n[1]*t+.5|0,e}function pt(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}var rn=0,qs=0,Gt=1<<rn++,Q=1<<rn++,Xt=1<<rn++,Kt=1<<rn++,ei=1<<rn++,nn=1<<rn++,$s=Math.pow(2,rn)-1,Al={[Gt]:"boolean",[Q]:"number",[Xt]:"string",[Kt]:"color",[ei]:"number[]",[nn]:"size"},Ip=Object.keys(Al).map(Number).sort(Zt);function Lp(n){return n in Al}function ti(n){let t=[];for(let e of Ip)Fr(n,e)&&t.push(Al[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function Fr(n,t){return(n&t)===t}function Hs(n,t){return!!(n&t)}function Si(n,t){return n===t}var ft=class{constructor(t,e){if(!Lp(t))throw new Error(`literal expressions must have a specific type, got ${ti(t)}`);this.type=t,this.value=e}},Js=class{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}};function Qs(n){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:n}}function mt(n,t,e){switch(typeof n){case"boolean":{if(Si(t,Xt))return new ft(Xt,n?"true":"false");if(!Fr(t,Gt))throw new Error(`got a boolean, but expected ${ti(t)}`);return new ft(Gt,n)}case"number":{if(Si(t,nn))return new ft(nn,pt(n));if(Si(t,Gt))return new ft(Gt,!!n);if(Si(t,Xt))return new ft(Xt,n.toString());if(!Fr(t,Q))throw new Error(`got a number, but expected ${ti(t)}`);return new ft(Q,n)}case"string":{if(Si(t,Kt))return new ft(Kt,kr(n));if(Si(t,Gt))return new ft(Gt,!!n);if(!Fr(t,Xt))throw new Error(`got a string, but expected ${ti(t)}`);return new ft(Xt,n)}default:}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return Wp(n,t,e);for(let i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(Si(t,nn)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new ft(nn,n)}if(Si(t,Kt)){if(n.length===3)return new ft(Kt,[...n,1]);if(n.length===4)return new ft(Kt,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!Fr(t,ei))throw new Error(`got an array of numbers, but expected ${ti(t)}`);return new ft(ei,n)}var v={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},Ap={[v.Get]:U(q(1,1/0),vd),[v.Var]:Mp(),[v.Has]:U(q(1,1/0),vd),[v.Id]:U(Pp,Wn),[v.Concat]:U(q(2,1/0),st(Xt)),[v.GeometryType]:U(Op,Wn),[v.LineMetric]:U(kp,Wn),[v.Resolution]:U(Ll,Wn),[v.Zoom]:U(Ll,Wn),[v.Time]:U(Ll,Wn),[v.Any]:U(q(2,1/0),st(Gt)),[v.All]:U(q(2,1/0),st(Gt)),[v.Not]:U(q(1,1),st(Gt)),[v.Equal]:U(q(2,2),Rd()),[v.NotEqual]:U(q(2,2),Rd()),[v.GreaterThan]:U(q(2,2),st(Q)),[v.GreaterThanOrEqualTo]:U(q(2,2),st(Q)),[v.LessThan]:U(q(2,2),st(Q)),[v.LessThanOrEqualTo]:U(q(2,2),st(Q)),[v.Multiply]:U(q(2,1/0),bd),[v.Coalesce]:U(q(2,1/0),bd),[v.Divide]:U(q(2,2),st(Q)),[v.Add]:U(q(2,1/0),st(Q)),[v.Subtract]:U(q(2,2),st(Q)),[v.Clamp]:U(q(3,3),st(Q)),[v.Mod]:U(q(2,2),st(Q)),[v.Pow]:U(q(2,2),st(Q)),[v.Abs]:U(q(1,1),st(Q)),[v.Floor]:U(q(1,1),st(Q)),[v.Ceil]:U(q(1,1),st(Q)),[v.Round]:U(q(1,1),st(Q)),[v.Sin]:U(q(1,1),st(Q)),[v.Cos]:U(q(1,1),st(Q)),[v.Atan]:U(q(1,2),st(Q)),[v.Sqrt]:U(q(1,1),st(Q)),[v.Match]:U(q(4,1/0),Sd,Fp),[v.Between]:U(q(3,3),st(Q)),[v.Interpolate]:U(q(6,1/0),Sd,zp),[v.Case]:U(q(3,1/0),Dp,Np),[v.In]:U(q(2,2),Gp),[v.Number]:U(q(1,1/0),st($s)),[v.String]:U(q(1,1/0),st($s)),[v.Array]:U(q(1,1/0),st(Q)),[v.Color]:U(q(1,4),st(Q)),[v.Band]:U(q(1,3),st(Q)),[v.Palette]:U(q(2,2),Xp),[v.ToString]:U(q(1,1),st(Gt|Q|Xt|Kt))};function vd(n,t,e){let i=n.length-1,r=new Array(i);for(let s=0;s<i;++s){let o=n[s+1];switch(typeof o){case"number":{r[s]=new ft(Q,o);break}case"string":{r[s]=new ft(Xt,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&e.properties.set(String(o),t)}return r}function Mp(){return function(n,t,e){let i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");let r=t,s=e.inputVariables?.[i];if(s!==void 0){let o=mt(s,$s,e);if(!(o instanceof ft))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${i}`);let a=o.type;if(typeof s=="string"&&Hs(r,Kt)&&!Hs(r,Xt)?a=Kt:Array.isArray(s)&&s.length===2&&Hs(r,nn)&&!Hs(r,ei)&&(a=nn),r&=a,r===qs)throw new Error(`the type expected from the var operator (${ti(t)}) did not have any overlap with the type of the corresponding style variables (${ti(a)}), variable name: ${i}`)}if(e.variables.has(i)){let o=e.variables.get(i);if(r&=o,r===qs)throw new Error(`a new type expected from the var operator (${ti(t)}) did not have any overlap with the previous type expected for it (${ti(o)}), variable name: ${i}`)}return e.variables.set(i,r),new Js(r,"var",new ft(Xt,i))}}function Pp(n,t,e){e.featureId=!0}function Op(n,t,e){e.geometryType=!0}function kp(n,t,e){e.mCoordinate=!0}function Ll(n,t,e){e.mapState=!0}function Wn(n,t,e){let i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function q(n,t){return function(e,i,r){let s=e[0],o=e.length-1;if(n===t){if(o!==n){let a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${s}, got ${o}`)}}else if(o<n||o>t){let a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function bd(n,t,e){let i=n.length-1,r=new Array(i);for(let s=0;s<i;++s){let o=mt(n[s+1],t,e);r[s]=o}return r}function st(n){return function(t,e,i){let r=t.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=mt(t[o+1],n,i);s[o]=a}return s}}function Rd(){return function(n,t,e){let i=n[0],r=n.length-1,s=new Array(r),o=$s;for(let a=0;a<r;++a){let l=mt(n[a+1],o,e);o&=l.type}if(o===qs)throw new Error(`no common type was found among the arguments of ${i}`);for(let a=0;a<r;++a){let l=mt(n[a+1],o,e);s[a]=l}return s}}function Dp(n,t,e){let i=n[0],r=n.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${r} instead`)}function Sd(n,t,e){let i=n[0],r=n.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${r} instead`)}function Fp(n,t,e){let i=n.length-1,r=mt(n[n.length-1],t,e),s=Xt|Q|Gt,o=new Array(i-2);for(let l=0;l<i-2;l+=2){try{let h=mt(n[l+2],s,e);s&=h.type}catch(h){throw new Error(`failed to parse argument ${l+1} of match expression: ${h.message}`)}if(s===qs)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<i-2;l+=2){try{let h=mt(n[l+2],s,e);o[l]=h}catch(h){throw new Error(`failed to parse argument ${l+1} of match expression: ${h.message}`)}try{let h=mt(n[l+3],r.type,e);o[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${h.message}`)}}return[mt(n[1],s,e),...o,r]}function zp(n,t,e){let i=n[1],r;switch(i[0]){case"linear":r=1;break;case"exponential":let l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}let s=new ft(Q,r),o;try{o=mt(n[2],Q,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{let h=mt(n[l+3],Q,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{let h=mt(n[l+4],t,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${h.message}`)}}return[s,o,...a]}function Np(n,t,e){let i=mt(n[n.length-1],t,e),r=new Array(n.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=mt(n[s+1],Gt,e);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=mt(n[s+2],i.type,e);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=i,r}function Gp(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let r;if(i[0]==="literal"){if(i=i[1],!Array.isArray(i))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof i[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof i[0]=="string"?r=Xt:r=Q;let s=new Array(i.length);for(let a=0;a<s.length;a++)try{let l=mt(i[a],r,e);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[mt(n[1],r,e),...s]}function Xp(n,t,e){let i;try{i=mt(n[1],Q,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=n[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=mt(r[o],Kt,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof ft))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[i,...s]}function U(...n){return function(t,e,i){let r=t[0],s;for(let o=0;o<n.length;o++){let a=n[o](t,e,i);if(o==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new Js(e,r,...s)}}function Wp(n,t,e){let i=n[0],r=Ap[i];if(!r)throw new Error(`unknown operator: ${i}`);return r(n,t,e)}function to(n){if(!n)return"";let t=n.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return to(n.getGeometries()[0]);default:return""}}function Ml(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Ce(n,t,e){let i=mt(n,t,e);return we(i,e)}function we(n,t){if(n instanceof ft){if(n.type===Kt&&typeof n.value=="string"){let i=kr(n.value);return function(){return i}}return function(){return n.value}}let e=n.operator;switch(e){case v.Number:case v.String:case v.Coalesce:return Yp(n,t);case v.Get:case v.Var:case v.Has:return Up(n,t);case v.Id:return i=>i.featureId;case v.GeometryType:return i=>i.geometryType;case v.Concat:{let i=n.args.map(r=>we(r,t));return r=>"".concat(...i.map(s=>s(r).toString()))}case v.Resolution:return i=>i.resolution;case v.Any:case v.All:case v.Between:case v.In:case v.Not:return Zp(n,t);case v.Equal:case v.NotEqual:case v.LessThan:case v.LessThanOrEqualTo:case v.GreaterThan:case v.GreaterThanOrEqualTo:return Kp(n,t);case v.Multiply:case v.Divide:case v.Add:case v.Subtract:case v.Clamp:case v.Mod:case v.Pow:case v.Abs:case v.Floor:case v.Ceil:case v.Round:case v.Sin:case v.Cos:case v.Atan:case v.Sqrt:return Bp(n,t);case v.Case:return Vp(n,t);case v.Match:return jp(n,t);case v.Interpolate:return Hp(n,t);case v.ToString:return qp(n,t);default:throw new Error(`Unsupported operator ${e}`)}}function Yp(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=we(n.args[s],t);switch(e){case v.Coalesce:return s=>{for(let o=0;o<i;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case v.Number:case v.String:return s=>{for(let o=0;o<i;++o){let a=r[o](s);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function Up(n,t){let i=n.args[0].value;switch(n.operator){case v.Get:return r=>{let s=n.args,o=r.properties[i];for(let a=1,l=s.length;a<l;++a){let c=s[a].value;o=o[c]}return o};case v.Var:return r=>r.variables[i];case v.Has:return r=>{let s=n.args;if(!(i in r.properties))return!1;let o=r.properties[i];for(let a=1,l=s.length;a<l;++a){let c=s[a].value;if(!o||!Object.hasOwn(o,c))return!1;o=o[c]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function Kp(n,t){let e=n.operator,i=we(n.args[0],t),r=we(n.args[1],t);switch(e){case v.Equal:return s=>i(s)===r(s);case v.NotEqual:return s=>i(s)!==r(s);case v.LessThan:return s=>i(s)<r(s);case v.LessThanOrEqualTo:return s=>i(s)<=r(s);case v.GreaterThan:return s=>i(s)>r(s);case v.GreaterThanOrEqualTo:return s=>i(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${e}`)}}function Zp(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=we(n.args[s],t);switch(e){case v.Any:return s=>{for(let o=0;o<i;++o)if(r[o](s))return!0;return!1};case v.All:return s=>{for(let o=0;o<i;++o)if(!r[o](s))return!1;return!0};case v.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case v.In:return s=>{let o=r[0](s);for(let a=1;a<i;++a)if(o===r[a](s))return!0;return!1};case v.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${e}`)}}function Bp(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=we(n.args[s],t);switch(e){case v.Multiply:return s=>{let o=1;for(let a=0;a<i;++a)o*=r[a](s);return o};case v.Divide:return s=>r[0](s)/r[1](s);case v.Add:return s=>{let o=0;for(let a=0;a<i;++a)o+=r[a](s);return o};case v.Subtract:return s=>r[0](s)-r[1](s);case v.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case v.Mod:return s=>r[0](s)%r[1](s);case v.Pow:return s=>Math.pow(r[0](s),r[1](s));case v.Abs:return s=>Math.abs(r[0](s));case v.Floor:return s=>Math.floor(r[0](s));case v.Ceil:return s=>Math.ceil(r[0](s));case v.Round:return s=>Math.round(r[0](s));case v.Sin:return s=>Math.sin(r[0](s));case v.Cos:return s=>Math.cos(r[0](s));case v.Atan:return i===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case v.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${e}`)}}function Vp(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=we(n.args[r],t);return r=>{for(let s=0;s<e-1;s+=2)if(i[s](r))return i[s+1](r);return i[e-1](r)}}function jp(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=we(n.args[r],t);return r=>{let s=i[0](r);for(let o=1;o<e-1;o+=2)if(s===i[o](r))return i[o+1](r);return i[e-1](r)}}function Hp(n,t){let e=n.args.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=we(n.args[r],t);return r=>{let s=i[0](r),o=i[1](r),a,l;for(let h=2;h<e;h+=2){let c=i[h](r),u=i[h+1](r),f=Array.isArray(u);if(f&&(u=Ed(u)),c>=o)return h===2?u:f?$p(s,o,a,l,c,u):zr(s,o,a,l,c,u);a=c,l=u}return l}}function qp(n,t){let e=n.operator,i=n.args.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=we(n.args[s],t);if(e===v.ToString)return s=>{let o=r[0](s);return n.args[0].type===Kt?Dr(o):o.toString()};throw new Error(`Unsupported convert operator ${e}`)}function zr(n,t,e,i,r,s){let o=r-e;if(o===0)return i;let a=t-e,l=n===1?a/o:(Math.pow(n,a)-1)/(Math.pow(n,o)-1);return i+l*(s-i)}function $p(n,t,e,i,r,s){if(r-e===0)return i;let a=Tl(i),l=Tl(s),h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);let c=[zr(n,t,e,a[0],r,l[0]),zr(n,t,e,a[1],r,l[1]),a[2]+zr(n,t,e,0,r,h),zr(n,t,e,i[3],r,s[3])];return wd(c)}var W={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Td(n,t,e){let i=n,r=!0,s=!1,o=!1,a=[mn(i,P.LOAD,function(){o=!0,s||t()})];return i.src&&Qo?(s=!0,i.decode().then(function(){r&&t()}).catch(function(l){r&&(o?t():e())})):a.push(mn(i,P.ERROR,e)),function(){r=!1,a.forEach(J)}}function Jp(n,t){return new Promise((e,i)=>{function r(){o(),e(n)}function s(){o(),i(new Error("Image load error"))}function o(){n.removeEventListener("load",r),n.removeEventListener("error",s)}n.addEventListener("load",r),n.addEventListener("error",s),t&&(n.src=t)})}function Id(n,t){return t&&(n.src=t),n.src&&Qo?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(r=>n.complete&&n.width?e(n):i(r))):Jp(n)}var Ol=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(let e in this.cache_){let i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){let i=Pl(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){let i=Pl(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,r){let s=Pl(t,e),o=s in this.cache_;this.cache_[s]=i,r&&(i.getImageState()===W.IDLE&&i.load(),i.getImageState()===W.LOADING?i.ready().then(()=>{this.patternCache_[s]=Rr().createPattern(i.getImage(1),"repeat")}):this.patternCache_[s]=Rr().createPattern(i.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};function Pl(n,t){let e=t?he(t):"null";return n+":"+e}var Wt=new Ol;var Nr=null,eo=class extends fi{constructor(t,e,i,r,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?W.IDLE:r,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===W.LOADED){Nr||(Nr=nt(1,1,void 0,{willReadFrequently:!0})),Nr.drawImage(this.image_,0,0);try{Nr.getImageData(0,0,1,1),this.tainted_=!1}catch{Nr=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(P.CHANGE)}handleImageError_(){this.imageState_=W.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=W.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let t=this.size_[0],e=this.size_[1],i=nt(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===W.IDLE){this.image_||this.initializeImage_(),this.imageState_=W.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Id(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==W.LOADED)return;let e=this.image_,i=nt(Math.ceil(e.width*t),Math.ceil(e.height*t)),r=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=yd(this.color_),i.fillRect(0,0,r.width/t,r.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=r}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===W.LOADED||this.imageState_===W.ERROR)t();else{let e=()=>{(this.imageState_===W.LOADED||this.imageState_===W.ERROR)&&(this.removeEventListener(P.CHANGE,e),t())};this.addEventListener(P.CHANGE,e)}})),this.ready_}};function Ti(n,t,e,i,r,s){let o=t===void 0?void 0:Wt.get(t,r);return o||(o=new eo(n,n&&"src"in n?n.src||void 0:t,e,i,r),Wt.set(t,r,o,s)),s&&o&&!Wt.getPattern(t,r)&&Wt.set(t,r,o,s),o}var Ld=eo;function jt(n){return n?Array.isArray(n)?Dr(n):typeof n=="object"&&"src"in n?Qp(n):n:null}function Qp(n){if(!n.offset||!n.size)return Wt.getPattern(n.src,n.color);let t=n.src+":"+n.offset,e=Wt.getPattern(t,n.color);if(e)return e;let i=Wt.get(n.src,null);if(i.getImageState()!==W.LOADED)return null;let r=nt(n.size[0],n.size[1]);return r.drawImage(i.getImage(1),n.offset[0],n.offset[1],n.size[0],n.size[1],0,0,n.size[0],n.size[1]),Ti(r.canvas,t,void 0,W.LOADED,n.color,!0),Wt.getPattern(t,n.color)}var io="10px sans-serif",St="#000",Ge="round",Ht=[],qt=0,Xe="round",ii=10,Md=0,Yt="#000",Ii="center",on="middle",ni=[0,0,0,0],ri=1,sn=new xt,Gr=null,Ad,kl={},tm=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function em(n,t,e){return`${n} ${t} 16px "${e}"`}var Pd=(function(){let t,e;async function i(s){await e.ready;let o=ks(s),a=o.families[0].toLowerCase(),l=o.weight,h=[];return e.forEach(u=>{let f=u.family.replace(/^['"]|['"]$/g,"").toLowerCase(),g=Os[u.weight]||u.weight;f===a&&u.style===o.style&&g==l&&h.push(u)}),h.length===0?!1:(await Promise.all(h.map(u=>u.load().then(()=>!0,()=>!1)))).some(u=>u)}async function r(){await e.ready;let s=!0,o=sn.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let h=a[l],c=o[h];c<100&&(await i(h)?(Ie(kl),sn.set(h,100)):(c+=10,sn.set(h,c,!0),c<100&&(s=!1)))}t=void 0,s||(t=setTimeout(r,100))}return async function(s){e||(e=bt?self.fonts:document.fonts);let o=ks(s);if(!o)return;let a=o.families,l=!1;for(let h of a){if(tm.has(h))continue;let c=em(o.style,o.weight,h);sn.get(c)===void 0&&(sn.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(r,100))}})(),im=(function(){let n;return function(t){let e=kl[t];if(e==null){if(bt){let i=ks(t),r=Od(t,"\u017Dg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=t,document.body.appendChild(n),e=n.offsetHeight,document.body.removeChild(n);kl[t]=e}return e}})();function Od(n,t){return Gr||(Gr=nt(1,1)),n!=Ad&&(Gr.font=n,Ad=Gr.font),Gr.measureText(t)}function kd(n,t){return Od(n,t).width}function Dl(n,t,e){if(t in e)return e[t];let i=t.split(`22 `).reduce((r,s)=>Math.max(r,kd(n,s)),0);return e[t]=i,i}function Dd(n,t){let e=[],i=[],r=[],s=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){let u=t[h];if(u===`3-`||h===c){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let f=t[h+1]||n.font,g=kd(f,u);e.push(g),o+=g;let p=im(f);i.push(p),l=Math.max(l,p)}return{width:s,height:a,widths:e,heights:i,lineWidths:r}}function Fd(n,t,e,i,r,s,o,a,l,h,c){n.save(),e!==1&&(n.globalAlpha===void 0?n.globalAlpha=u=>u.globalAlpha*=e:n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,h),n.scale(c[0],c[1]),nm(i,n)):c[0]<0||c[1]<0?(n.translate(l,h),n.scale(c[0],c[1]),n.drawImage(i,r,s,o,a,0,0,o,a)):n.drawImage(i,r,s,o,a,l,h,o*c[0],a*c[1]),n.restore()}function nm(n,t){let e=n.contextInstructions;for(let i=0,r=e.length;i<r;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}var Fl=class n{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=pt(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){let t=this.getScale();return new n({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return H()}getImage(t){return H()}getHitDetectionImage(){return H()}getPixelRatio(t){return 1}getImageState(){return H()}getImageSize(){return H()}getOrigin(){return H()}getSize(){return H()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=pt(t)}listenImageChange(t){H()}load(){H()}unlistenImageChange(t){H()}ready(){return Promise.resolve()}},no=Fl;var zl=class n extends no{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?W.LOADING:W.LOADED,this.imageState_===W.LOADING&&this.ready().then(()=>this.imageState_=W.LOADED),this.render()}clone(){let t=this.getScale(),e=new n({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){let t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(","),r=Wt.get(i,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*t),a=nt(o,o);this.draw_(s,a,t),r=a.canvas;let l=new Ld(r,void 0,null,W.LOADED,null);Wt.set(i,null,l),createImageBitmap(r).then(h=>{l.setImage(h)})}return r}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let R=r;r=s,s=R}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),h=Math.sqrt(s*s-l*l),c=r-h,u=Math.sqrt(l*l+c*c),f=u/l;if(t==="miter"&&f<=i)return f*e;let g=e/2/f,p=e/2*(c/u),m=Math.sqrt((r+g)*(r+g)+p*p)-r;if(this.radius2_===void 0||t==="bevel")return m*2;let x=r*Math.sin(a),E=Math.sqrt(r*r-x*x),C=s-E,w=Math.sqrt(x*x+C*C)/x;if(w<=i){let R=w*e/2-s-r;return 2*Math.max(m,R)}return m*2}createRenderOptions(){let t=Ge,e=Xe,i=0,r=null,s=0,o,a=0;this.stroke_&&(o=jt(this.stroke_.getColor()??Yt),a=this.stroke_.getWidth()??ri,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??Xe,t=this.stroke_.getLineCap()??Ge,i=this.stroke_.getMiterLimit()??ii);let l=this.calculateLineJoinSize_(e,a,i),h=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:r,lineDashOffset:s,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();let t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let r=this.fill_.getColor();r===null&&(r=St),e.fillStyle=jt(r),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),r=0;typeof i=="string"&&(i=he(i)),i===null?r=1:Array.isArray(i)&&(r=i.length===4?i[3]:1),r===0&&(e=nt(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_,i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{let r=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){let l=s+a*o,h=a%2===0?i:r;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=St,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},ro=zl;var Nl=class n extends ro{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){let t=this.getScale(),e=new n({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}},so=Nl;var Gl=class n{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){let t=this.getColor();return new n({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){let e=Ti(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===W.IDLE&&e.load(),e.getImageState()===W.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){let t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?Y(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:he(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},_t=Gl;function zd(n,t,e,i){return e!==void 0&&i!==void 0?[e/n,i/t]:e!==void 0?e/n:i!==void 0?i/t:1}var Xl=class n extends no{constructor(t){t=t||{};let e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,r=t.scale!==void 0?t.scale:1,s=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:r,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;let o=t.img!==void 0?t.img:null,a=t.src;B(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Y(o)),B(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),B(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=W.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?W.LOADED:W.IDLE:l=W.LOADING:l=W.LOADED),this.color_=t.color!==void 0?he(t.color):null,this.iconImage_=Ti(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{let u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;let f=()=>{if(this.unlistenImageChange(f),!this.initialOptions_)return;let g=this.iconImage_.getSize();this.setScale(zd(g[0],g[1],t.width,t.height))};this.listenImageChange(f);return}}h!==void 0&&this.setScale(zd(h,c,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new n({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=r[0]),this.anchorYUnits_=="fraction"&&(t[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+r[1])}this.normalizedAnchor_=t}let e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){let e=t?he(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((o,a)=>o===e[a]))return;this.color_=e;let i=this.getSrc(),r=i!==void 0?null:this.getHitDetectionImage(),s=i!==void 0?W.IDLE:this.iconImage_.getImageState();this.iconImage_=Ti(r,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){let e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Ti(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},W.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==W.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){let t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==W.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(P.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(P.CHANGE,t)}ready(){return this.iconImage_.ready()}},an=Xl;var Wl=class n{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){let t=this.getColor();return new n({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}},At=Wl;var oo=class n{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Nd,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new n({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Nd,this.geometry_=t}setZIndex(t){this.zIndex_=t}};function Gd(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:(B(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}var Yl=null;function Ul(n,t){if(!Yl){let e=new _t({color:"rgba(255,255,255,0.4)"}),i=new At({color:"#3399CC",width:1.25});Yl=[new oo({image:new so({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Yl}function Nd(n){return n.getGeometry()}var Mt=oo;var rm="#333",Kl=class n{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=pt(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new _t({color:rm}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){let t=this.getScale();return new n({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof _t?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=pt(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}},si=Kl;function sm(n){return!0}function om(n,t){t=t??Qs();let e=am(n,t),i=Ml();return function(r,s){if(i.properties=r.getPropertiesInternal(),i.resolution=s,t.featureId){let o=r.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=to(r.getGeometry())),e(i)}}function Xd(n,t){t=t??Qs();let e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=Zl(n[o],t);let r=Ml(),s=new Array(e);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,t.featureId){let h=o.getId();h!==void 0?r.featureId=h:r.featureId=null}t.geometryType&&(r.geometryType=to(o.getGeometry()));let l=0;for(let h=0;h<e;++h){let c=i[h](r);c&&(s[l]=c,l+=1)}return s.length=l,s}}function Kd(n,t){if(t=t??Qs(),!Array.isArray(n))return Xd([n],t);let e=n.length;if("style"in n[0]){let s=new Array(e);for(let o=0;o<e;++o){let a=n[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return om(s,t)}return Xd(n,t)}function am(n,t){let e=n.length,i=new Array(e);for(let r=0;r<e;++r){let s=n[r],o="filter"in s?Ce(s.filter,Gt,t):sm,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=Zl(s.style[h],t)}else a=[Zl(s.style,t)];i[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<e;++a){let l=i[a].filter;if(l(r)&&!(n[a].else&&o)){o=!0;for(let h of i[a].styles){let c=h(r);c&&s.push(c)}}}return s}}function Zl(n,t){let e=Xr(n,"",t),i=Wr(n,"",t),r=lm(n,t),s=cm(n,t),o=Ft(n,"z-index",t);if(!e&&!i&&!r&&!s&&!de(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));let a=new Mt;return function(l){let h=!0;if(e){let c=e(l);c&&(h=!1),a.setFill(c)}if(i){let c=i(l);c&&(h=!1),a.setStroke(c)}if(r){let c=r(l);c&&(h=!1),a.setText(c)}if(s){let c=s(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function Xr(n,t,e){let i;if(t+"fill-pattern-src"in n)i=fm(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return s=>null;i=lo(n,t+"fill-color",e)}if(!i)return null;let r=new _t;return function(s){let o=i(s);return o===js?null:(r.setColor(o),r)}}function Wr(n,t,e){let i=Ft(n,t+"stroke-width",e),r=lo(n,t+"stroke-color",e);if(!i&&!r)return null;let s=oi(n,t+"stroke-line-cap",e),o=oi(n,t+"stroke-line-join",e),a=Zd(n,t+"stroke-line-dash",e),l=Ft(n,t+"stroke-line-dash-offset",e),h=Ft(n,t+"stroke-miter-limit",e),c=Ft(n,t+"stroke-offset",e),u=new At;return function(f){if(r){let g=r(f);if(g===js)return null;u.setColor(g)}if(i&&u.setWidth(i(f)),s){let g=s(f);if(g!=="butt"&&g!=="round"&&g!=="square")throw new Error("Expected butt, round, or square line cap");u.setLineCap(g)}if(o){let g=o(f);if(g!=="bevel"&&g!=="round"&&g!=="miter")throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(g)}return a&&u.setLineDash(a(f)),l&&u.setLineDashOffset(l(f)),h&&u.setMiterLimit(h(f)),c&&u.setOffset(c(f)),u}}function lm(n,t){let e="text-",i=oi(n,e+"value",t);if(!i)return null;let r=Xr(n,e,t),s=Xr(n,e+"background-",t),o=Wr(n,e,t),a=Wr(n,e+"background-",t),l=oi(n,e+"font",t),h=Ft(n,e+"max-angle",t),c=Ft(n,e+"offset-x",t),u=Ft(n,e+"offset-y",t),f=Yn(n,e+"overflow",t),g=oi(n,e+"placement",t),p=Ft(n,e+"repeat",t),_=co(n,e+"scale",t),m=Yn(n,e+"rotate-with-view",t),x=Ft(n,e+"rotation",t),E=oi(n,e+"align",t),C=oi(n,e+"justify",t),y=oi(n,e+"baseline",t),w=Yn(n,e+"keep-upright",t),R=Zd(n,e+"padding",t),A=ho(n,e+"declutter-mode"),b=new si({declutterMode:A});return function(S){if(b.setText(i(S)),r&&b.setFill(r(S)),s&&b.setBackgroundFill(s(S)),o&&b.setStroke(o(S)),a&&b.setBackgroundStroke(a(S)),l&&b.setFont(l(S)),h&&b.setMaxAngle(h(S)),c&&b.setOffsetX(c(S)),u&&b.setOffsetY(u(S)),f&&b.setOverflow(f(S)),g){let I=g(S);if(I!=="point"&&I!=="line")throw new Error("Expected point or line for text-placement");b.setPlacement(I)}if(p&&b.setRepeat(p(S)),_&&b.setScale(_(S)),m&&b.setRotateWithView(m(S)),x&&b.setRotation(x(S)),E){let I=E(S);if(I!=="left"&&I!=="center"&&I!=="right"&&I!=="end"&&I!=="start")throw new Error("Expected left, right, center, start, or end for text-align");b.setTextAlign(I)}if(C){let I=C(S);if(I!=="left"&&I!=="right"&&I!=="center")throw new Error("Expected left, right, or center for text-justify");b.setJustify(I)}if(y){let I=y(S);if(I!=="bottom"&&I!=="top"&&I!=="middle"&&I!=="alphabetic"&&I!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");b.setTextBaseline(I)}return R&&b.setPadding(R(S)),w&&b.setKeepUpright(w(S)),b}}function cm(n,t){return"icon-src"in n?hm(n,t):"shape-points"in n?um(n,t):"circle-radius"in n?dm(n,t):null}function hm(n,t){let e="icon-",i=e+"src",r=Bd(n[i],i),s=ao(n,e+"anchor",t),o=co(n,e+"scale",t),a=Ft(n,e+"opacity",t),l=ao(n,e+"displacement",t),h=Ft(n,e+"rotation",t),c=Yn(n,e+"rotate-with-view",t),u=Yd(n,e+"anchor-origin"),f=Ud(n,e+"anchor-x-units"),g=Ud(n,e+"anchor-y-units"),p=ai(n,e+"color"),_,m=null;p!==void 0&&(Array.isArray(p)&&p.length>0&&typeof p[0]=="string"?m=lo(n,e+"color",t):_=Vd(p,e+"color"));let x=pm(n,e+"cross-origin"),E=mm(n,e+"offset"),C=Yd(n,e+"offset-origin"),y=Bl(n,e+"width"),w=Bl(n,e+"height"),R=gm(n,e+"size"),A=ho(n,e+"declutter-mode"),b={src:r,anchorOrigin:u,anchorXUnits:f,anchorYUnits:g,crossOrigin:x,offset:E,offsetOrigin:C,height:w,width:y,size:R,declutterMode:A},S=null;return function(I){if(S)m&&S.setColor(m(I));else{let z=m?m(I):_;S=new an(z!==void 0?Object.assign({},b,{color:z}):Object.assign({},b))}return a&&S.setOpacity(a(I)),l&&S.setDisplacement(l(I)),h&&S.setRotation(h(I)),c&&S.setRotateWithView(c(I)),o&&S.setScale(o(I)),s&&S.setAnchor(s(I)),S}}function um(n,t){let e="shape-",i=e+"points",r=e+"radius",s=Vl(n[i],i);if(!(r in n))throw new Error(`Expected a number for ${r}`);let o=Ft(n,r,t),a=typeof n[r]=="number"?n[r]:5,l=e+"radius2",h=Ft(n,l,t),c=typeof n[l]=="number"?n[l]:void 0,u=Xr(n,e,t),f=Wr(n,e,t),g=co(n,e+"scale",t),p=ao(n,e+"displacement",t),_=Ft(n,e+"rotation",t),m=Yn(n,e+"rotate-with-view",t),x=Bl(n,e+"angle"),E=ho(n,e+"declutter-mode"),C=new ro({points:s,radius:a,radius2:c,angle:x,declutterMode:E});return function(y){return o&&C.setRadius(o(y)),h&&C.setRadius2(h(y)),u&&C.setFill(u(y)),f&&C.setStroke(f(y)),p&&C.setDisplacement(p(y)),_&&C.setRotation(_(y)),m&&C.setRotateWithView(m(y)),g&&C.setScale(g(y)),C}}function dm(n,t){let e="circle-",i=Xr(n,e,t),r=Wr(n,e,t),s=Ft(n,e+"radius",t),o=co(n,e+"scale",t),a=ao(n,e+"displacement",t),l=Ft(n,e+"rotation",t),h=Yn(n,e+"rotate-with-view",t),c=ho(n,e+"declutter-mode"),u=new so({radius:5,declutterMode:c});return function(f){return s&&u.setRadius(s(f)),i&&u.setFill(i(f)),r&&u.setStroke(r(f)),a&&u.setDisplacement(a(f)),l&&u.setRotation(l(f)),h&&u.setRotateWithView(h(f)),o&&u.setScale(o(f)),u}}function ai(n,t){if(!(t in n))return;let e=n[t];return e===void 0?void 0:e}function Ft(n,t,e){let i=ai(n,t);if(i===void 0)return;let r=Ce(i,Q,e);return function(s){return Vl(r(s),t)}}function oi(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,Xt,e);return function(s){return Bd(r(s),t)}}function fm(n,t,e){let i=oi(n,t+"pattern-src",e),r=Wd(n,t+"pattern-offset",e),s=Wd(n,t+"pattern-size",e),o=lo(n,t+"color",e);return function(a){return{src:i(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Yn(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,Gt,e);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${t}`);return o}}function lo(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,Kt,e);return function(s){return Vd(r(s),t)}}function Zd(n,t,e){let i=ai(n,t);if(i===void 0)return null;if(Array.isArray(i)&&(i.length===0||typeof i[0]!="string")){let s=i.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Ce(o,Q,e);return function(h){return Vl(l(h),`${t}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Ce(i,ei,e);return function(s){return Yr(r(s),t)}}function ao(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,ei,e);return function(s){let o=Yr(r(s),t);if(o.length!==2)throw new Error(`Expected two numbers for ${t}`);return o}}function Wd(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,ei,e);return function(s){return jd(r(s),t)}}function co(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,ei|Q,e);return function(s){return _m(r(s),t)}}function Bl(n,t){let e=n[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function gm(n,t){let e=n[t];if(e!==void 0){if(typeof e=="number")return pt(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function pm(n,t){let e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function Yd(n,t){let e=n[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function Ud(n,t){let e=n[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function mm(n,t){let e=n[t];if(e!==void 0)return Yr(e,t)}function ho(n,t){let e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function Yr(n,t){if(!Array.isArray(n))throw new Error(`Expected an array for ${t}`);let e=n.length;for(let i=0;i<e;++i)if(typeof n[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return n}function Bd(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function Vl(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function Vd(n,t){if(typeof n=="string")return n;let e=Yr(n,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function jd(n,t){let e=Yr(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function _m(n,t){return typeof n=="number"?n:jd(n,t)}var Hd={RENDER_ORDER:"renderOrder"},jl=class extends tn{constructor(t){t=t||{};let e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Hd.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){let i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new en(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Hd.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?Ul:t;let e=xm(t);this.styleFunction_=t===null?void 0:Gd(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}};function xm(n){if(n===void 0)return Ul;if(!n)return null;if(typeof n=="function"||n instanceof Mt)return n;if(Array.isArray(n)&&n.length===0)return[];if(Array.isArray(n)&&n[0]instanceof Mt){let e=n.length,i=new Array(e);for(let r=0;r<e;++r){let s=n[r];if(!(s instanceof Mt))throw new Error("Expected a list of style instances");i[r]=s}return i}return Kd(n)}var uo=jl;var Hl=class extends Tt{constructor(t,e,i,r){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=r}},fo=Hl;var ql=class extends di{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){H()}calculateMatrices2D(t){let e=t.viewState,i=t.coordinateToPixelTransform,r=t.pixelToCoordinateTransform;kt(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Ss(r,i)}forEachFeatureAtCoordinate(t,e,i,r,s,o,a,l){let h,c=e.viewState;function u(y,w,R,A){return s.call(o,w,y?R:null,A)}let f=c.projection,g=ms(t.slice(),f),p=[[0,0]];if(f.canWrapX()&&r){let y=f.getExtent(),w=j(y);p.push([-w,0],[w,0])}let _=e.layerStatesArray,m=_.length,x=[],E=[];for(let y=0;y<p.length;y++)for(let w=m-1;w>=0;--w){let R=_[w],A=R.layer;if(A.hasRenderer()&&Ir(R,c)&&a.call(l,A)){let b=A.getRenderer(),S=A.getSource();if(b&&S){let I=S.getWrapX()?g:t,z=u.bind(null,R.managed);E[0]=I[0]+p[y][0],E[1]=I[1]+p[y][1],h=b.forEachFeatureAtCoordinate(E,e,i,z,x)}if(h)return h}}if(x.length===0)return;let C=1/x.length;return x.forEach((y,w)=>y.distanceSq+=w*C),x.sort((y,w)=>y.distanceSq-w.distanceSq),x.some(y=>h=y.callback(y.feature,y.layer,y.geometry)),h}hasFeatureAtCoordinate(t,e,i,r,s,o){return this.forEachFeatureAtCoordinate(t,e,i,r,He,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(t){H()}scheduleExpireIconCache(t){Wt.canExpireCache()&&t.postRenderFunctions.push(ym)}};function ym(n,t){Wt.expire()}var qd=ql;var $l=class extends qd{constructor(t){super(t),this.fontChangeListenerKey_=K(sn,ue.PROPERTYCHANGE,t.redrawText,t),this.element_=bt?Ds():document.createElement("div");let e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=vi+" ol-layers";let i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){let i=this.getMap();if(i.hasListener(t)){let r=new fo(t,void 0,e);i.dispatchEvent(r)}}disposeInternal(){J(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Dt.PRECOMPOSE,t);let e=t.layerStatesArray.sort((c,u)=>c.zIndex-u.zIndex);e.some(c=>c.layer instanceof uo&&c.layer.getDeclutter())&&(t.declutter={});let r=t.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;te(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],h=a?o:null;for(let c=0,u=e.length;c<u;++c){let f=e[c];t.layerIndex=c;let g=f.layer,p=g.getSourceState();if(!Ir(f,r)||p!="ready"&&p!="undefined"){g.unrender();continue}let _=g.render(t,h);_&&(_!==h&&(this.children_.push(_),h=_),l.push(f))}this.declutter(t,l),Hu(this.element_,this.children_);for(let c of a?this.children_:[]){let u=c.firstElementChild||c,f=c.style.backgroundColor;if(f&&(!te(u)||u.width>0)&&(a.fillStyle=f,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!te(u)||u.width===0)continue;a.save();let g=c.style.opacity||u.style.opacity;a.globalAlpha=g===""?1:Number(g);let p=u.style.transform;if(p)a.transform(...Rs(p));else{let _=parseFloat(u.style.width)/u.width,m=parseFloat(u.style.height)/u.height;a.transform(_,0,0,m,0,0)}a.drawImage(u,0,0),a.restore()}this.dispatchRenderEvent(Dt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){let r=e[i],s=r.layer;s.getDeclutter()&&s.renderDeclutter(t,r)}e.forEach(i=>i.layer.renderDeferred(t))}}},$d=$l;function Jd(n){if(n instanceof tn){n.setMapInternal(null);return}n instanceof Tr&&n.getLayers().forEach(Jd)}function Qd(n,t){if(n instanceof tn){n.setMapInternal(t);return}if(n instanceof Tr){let e=n.getLayers().getArray();for(let i=0,r=e.length;i<r;++i)Qd(e[i],t)}}var Jl=class extends xt{constructor(t){super(),t=t||{},this.on,this.once,this.un;let e=Em(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:Mh,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Lt(),this.pixelToCoordinateTransform_=Lt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,bt||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,bt||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(bt?new Pt:Fs()),this.interactions=e.interactions||(bt?new Pt:Ys({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new kh(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ot.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ot.VIEW,this.handleViewChanged_),this.addChangeListener(Ot.SIZE,this.handleSizeChanged_),this.addChangeListener(Ot.TARGET,this.handleTargetChanged_),this.setProperties(e.values);let i=this;t.view&&!(t.view instanceof Qt)&&t.view.then(function(r){i.setView(new Qt(r))}),this.controls.addEventListener(It.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(It.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(It.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(It.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(It.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(It.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Qd(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){let e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};let s=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:He,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,e,null,o,null)}getFeaturesAtPixel(t,e){let i=[];return this.forEachFeatureAtPixel(t,function(r){i.push(r)},e),i}getAllLayers(){let t=[];function e(i){i.forEach(function(r){r instanceof Tr?e(r.getLayers()):t.push(r)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;let i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};let r=e.layerFilter!==void 0?e.layerFilter:He,s=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,o,r,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){let i=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=i.width/r[0],o=i.height/r[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/s,(a.clientY-i.top)/o]}getTarget(){return this.get(Ot.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return _r(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){let e=this.frameState_;return e?dt(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){let e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Ot.LAYERGROUP)}setLayers(t){let e=this.getLayerGroup();if(t instanceof Pt){e.setLayers(t);return}let i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){let r=t[e];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){let e=xe(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){let e=this.frameState_;return e?dt(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Ot.SIZE)}getView(){return this.get(Ot.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,r){return Dh(this.frameState_,t,e,i,r)}handleBrowserEvent(t,e){e=e||t.type;let i=new Le(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;let e=t.originalEvent,i=e.type;if(i===cr.POINTERDOWN||i===P.WHEEL||i===P.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=e.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){let t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let r=this.maxTilesLoading_,s=r,o=t?t.viewHints:void 0,a=o?o[Rt.ANIMATING]||o[Rt.INTERACTING]:!1;if(a){let l=Date.now()-t.time>8;r=l?0:8,s=l?0:2}e.getTilesLoading()<r&&(a&&e.reprioritize(),e.loadMoreTiles(r,s))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Dt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Dt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new gi(Ae.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new gi(Ae.LOADSTART,this,t))));let i=this.postRenderFunctions_;if(t)for(let r=0,s=i.length;r<s;++r)i[r](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,r=this.targetChangeHandlerKeys_.length;i<r;++i)J(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(P.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(P.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!te(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}let t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(te(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new $d(this)),!te(e)){this.mapBrowserEventHandler_=new Ph(this,this.moveTolerance_);for(let r in at)this.mapBrowserEventHandler_.addEventListener(at[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(P.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(P.WHEEL,this.boundHandleBrowserEvent_,as?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{let r=e.getRootNode();i=r instanceof ShadowRoot?r.host:e}if(this.targetChangeHandlerKeys_=[K(i,P.KEYDOWN,this.handleBrowserEvent,this),K(i,P.KEYPRESS,this.handleBrowserEvent,this)],!te(e)){let r=e.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(e)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(J(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(J(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=K(t,ue.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=K(t,P.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(J),this.layerGroupPropertyListenerKeys_=null);let t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Ee("addlayer",t)),this.layerGroupPropertyListenerKeys_=[K(t,ue.PROPERTYCHANGE,this.render,this),K(t,P.CHANGE,this.render,this),K(t,"addlayer",this.handleLayerAdd_,this),K(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){let r=t[e].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Jd(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){let e=this.getSize(),i=this.getView(),r=this.frameState_,s=null;if(e!==void 0&&Il(e)&&i&&i.isDef()){let o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:pr(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Y(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=pr(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!ke(this.previousExtent_)&&!Zi(s.extent,this.previousExtent_))&&(this.dispatchEvent(new gi(Ae.MOVESTART,this,r)),this.previousExtent_=Ki(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Rt.ANIMATING]&&!s.viewHints[Rt.INTERACTING]&&!Zi(s.extent,this.previousExtent_)&&(this.dispatchEvent(new gi(Ae.MOVEEND,this,s)),us(s.extent,this.previousExtent_))),this.dispatchEvent(new gi(Ae.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Ae.LOADSTART)||this.hasListener(Ae.LOADEND)||this.hasListener(Dt.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){let e=this.getLayerGroup();e&&this.handleLayerRemove_(new Ee("removelayer",e)),this.set(Ot.LAYERGROUP,t)}setSize(t){this.set(Ot.SIZE,t)}setTarget(t){this.set(Ot.TARGET,t)}setView(t){if(!t||t instanceof Qt){this.set(Ot.VIEW,t);return}this.set(Ot.VIEW,new Qt);let e=this;t.then(function(i){e.setView(new Qt(i))})}updateSize(){let t=this.getTargetElement(),e;if(t){let r,s;if(te(t)){let o=t.getContext("2d").getTransform();r=t.width/o.a,s=t.height/o.d}else{let o=getComputedStyle(t);r=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(e=[Math.max(0,r),Math.max(0,s)],!Il(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&_s("No map visible because the map container's width or height are 0."))}let i=this.getSize();e&&(!i||!zt(e,i))&&(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){let e=this.getView();e&&e.setViewportSize(t)}};function Em(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);let e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Tr({layers:n.layers});e[Ot.LAYERGROUP]=i,e[Ot.TARGET]=n.target,e[Ot.VIEW]=n.view instanceof Qt?n.view:new Qt;let r;n.controls!==void 0&&(Array.isArray(n.controls)?r=new Pt(n.controls.slice()):(B(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=n.controls));let s;n.interactions!==void 0&&(Array.isArray(n.interactions)?s=new Pt(n.interactions.slice()):(B(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new Pt(n.overlays.slice()):(B(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new Pt,{controls:r,interactions:s,keyboardEventTarget:t,overlays:o,values:e}}var tf=Jl;var Ql=class n extends De{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){fe(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){let t=new n(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,r){if(r<pi(this.getExtent(),t,e))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let h=ge(t,e,s[a],s[a+1]);if(h<r){r=h;for(let c=0;c<o;++c)i[c]=s[a+c];i.length=o}}return r}getCoordinates(){return Fe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){let e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new wi(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){let t=this.flatCoordinates,e=this.layout,i=this.stride,r=[];for(let s=0,o=t.length;s<o;s+=i){let a=new wi(t.slice(s,s+i),e);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(t){let e=this.flatCoordinates,i=this.stride;for(let r=0,s=e.length;r<s;r+=i){let o=e[r],a=e[r+1];if(fr(t,o,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xr(this.flatCoordinates,0,t,this.stride),this.changed()}},ef=Ql;function go(n,t,e,i){let r=[],s=ut();for(let o=0,a=e.length;o<a;++o){let l=e[o];s=wn(n,t,l[0],i),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),t=l[l.length-1]}return r}var tc=class n extends De{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){let r=t,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let h=r[a],c=s.length,u=h.getEnds();for(let f=0,g=u.length;f<g;++f)u[f]+=c;fe(s,h.getFlatCoordinates()),o.push(u)}e=r.length===0?this.getLayout():r[0].getLayout(),t=s,i=o}e!==void 0&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();else{let i=this.flatCoordinates.length;fe(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let r=0,s=e.length;r<s;++r)e[r]+=i}this.endss_.push(e),this.changed()}clone(){let t=this.endss_.length,e=new Array(t);for(let r=0;r<t;++r)e[r]=this.endss_[r].slice();let i=new n(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,r){return r<pi(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Lu(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Au(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,r))}containsXY(t,e){return ku(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return Tu(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Na(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,yr(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let t=go(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Ls(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new ef(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;Xu(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Na(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let e=[],i=[];return e.length=Nu(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new n(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(t===0)e=0;else{let s=this.endss_[t-1];e=s[s.length-1]}let i=this.endss_[t].slice(),r=i[i.length-1];if(e!==0)for(let s=0,o=i.length;s<o;++s)i[s]-=e;return new Ci(this.flatCoordinates.slice(e,r),this.layout,i)}getPolygons(){let t=this.layout,e=this.flatCoordinates,i=this.endss_,r=[],s=0;for(let o=0,a=i.length;o<a;++o){let l=i[o].slice(),h=l[l.length-1];if(s!==0)for(let u=0,f=l.length;u<f;++u)l[u]-=s;let c=new Ci(e.slice(s,h),t,l);r.push(c),s=h}return r}getType(){return"MultiPolygon"}intersectsExtent(t){return Fu(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);let i=Pu(this.flatCoordinates,0,t,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{let r=i[i.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},nf=tc;var ec=class extends fi{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(P.CHANGE)}release(){this.setState(k.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==k.EMPTY){if(this.state!==k.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){H()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;let r=e-i+1e3/60;return r>=this.transition_?1:ca(r/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},Un=ec;function po(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}var wm=new Error("disposed");var Cm=[256,256],ic=class extends Un{constructor(t){let e=k.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;let t=po(this.data_);return t?[t.width,t.height]:Cm}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==k.IDLE&&this.state!==k.ERROR)return;this.state=k.LOADING,this.changed();let t=this;this.loader_().then(function(e){t.data_=e,t.state=k.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=k.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(wm),this.controller_=null),super.disposeInternal()}},nc=ic;var rc=class extends Un{constructor(t,e,i,r,s,o){super(t,e,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=i,this.key=i,this.image_,bt?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=k.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=k.ERROR,this.unlistenImage_(),this.image_=vm(),this.changed()}handleImageLoad_(){if(bt)this.state=k.LOADED;else{let t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=k.LOADED:this.state=k.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==k.ERROR&&(this.state=k.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==k.IDLE&&(this.state=k.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Td(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function vm(){let n=nt(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}var mo=rc;var _o=class{constructor(t,e,i,r){this.minX=t,this.maxX=e,this.minY=i,this.maxY=r}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}};function ln(n,t,e,i,r){return r!==void 0?(r.minX=n,r.maxX=t,r.minY=e,r.maxY=i,r):new _o(n,t,e,i)}var xo=_o;var sc,cn=[];function rf(n,t,e,i,r){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,r),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,r)),n.restore()}function oc(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function bm(){if(sc===void 0){let n=nt(6,6,cn);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",rf(n,4,5,4,0),rf(n,4,5,0,5);let t=n.getImageData(0,0,3,3).data;sc=oc(t,0)||oc(t,4)||oc(t,8),Ji(n),cn.push(n.canvas)}return sc}function sf(n,t,e,i){let r=Mn(e,t,n),s=wa(t,i,e),o=t.getMetersPerUnit();o!==void 0&&(s*=o);let a=n.getMetersPerUnit();a!==void 0&&(s/=a);let l=n.getExtent();if(!l||me(l,r)){let h=wa(n,s,r)/s;isFinite(h)&&h>0&&(s/=h)}return s}function of(n,t,e,i){let r=Bt(e),s=sf(n,t,r,i);return(!isFinite(s)||s<=0)&&gs(e,function(o){return s=sf(n,t,o,i),isFinite(s)&&s>0}),s}function af(n,t,e,i,r,s,o,a,l,h,c,u,f,g){let p=nt(Math.round(e*n),Math.round(e*t),cn);if(u||(p.imageSmoothingEnabled=!1),l.length===0)return p.canvas;p.scale(e,e);function _(w){return Math.round(w*e)/e}p.globalCompositeOperation="lighter";let m=ut();l.forEach(function(w,R,A){fs(m,w.extent)});let x,E=e/i,C=(u?1:1+Math.pow(2,-24))/E;if(!f||l.length!==1||h!==0){if(x=nt(Math.round(j(m)*E),Math.round(ct(m)*E),cn),u||(x.imageSmoothingEnabled=!1),r&&g){let w=(r[0]-m[0])*E,R=-(r[3]-m[3])*E,A=j(r)*E,b=ct(r)*E;x.rect(w,R,A,b),x.clip()}l.forEach(function(w,R,A){if(w.image.width>0&&w.image.height>0){if(w.clipExtent){x.save();let G=(w.clipExtent[0]-m[0])*E,F=-(w.clipExtent[3]-m[3])*E,V=j(w.clipExtent)*E,lt=ct(w.clipExtent)*E;x.rect(u?G:Math.round(G),u?F:Math.round(F),u?V:Math.round(G+V)-Math.round(G),u?lt:Math.round(F+lt)-Math.round(F)),x.clip()}let b=(w.extent[0]-m[0])*E,S=-(w.extent[3]-m[3])*E,I=j(w.extent)*E,z=ct(w.extent)*E;x.drawImage(w.image,h,h,w.image.width-2*h,w.image.height-2*h,u?b:Math.round(b),u?S:Math.round(S),u?I:Math.round(b+I)-Math.round(b),u?z:Math.round(S+z)-Math.round(S)),w.clipExtent&&x.restore()}})}let y=ae(o);return a.getTriangles().forEach(function(w,R,A){let b=w.source,S=w.target,I=b[0][0],z=b[0][1],G=b[1][0],F=b[1][1],V=b[2][0],lt=b[2][1],M=_((S[0][0]-y[0])/s),X=_(-(S[0][1]-y[1])/s),O=_((S[1][0]-y[0])/s),$=_(-(S[1][1]-y[1])/s),N=_((S[2][0]-y[0])/s),tt=_(-(S[2][1]-y[1])/s),it=I,wt=z;I=0,z=0,G-=it,F-=wt,V-=it,lt-=wt;let L=[[G,F,0,0,O-M],[V,lt,0,0,N-M],[0,0,G,F,$-X],[0,0,V,lt,tt-X]],$t=zh(L);if(!$t)return;if(p.save(),p.beginPath(),bm()||!u){p.moveTo(O,$);let ot=4,Re=M-O,Ni=X-$;for(let ne=0;ne<ot;ne++)p.lineTo(O+_((ne+1)*Re/ot),$+_(ne*Ni/(ot-1))),ne!=ot-1&&p.lineTo(O+_((ne+1)*Re/ot),$+_((ne+1)*Ni/(ot-1)));p.lineTo(N,tt)}else p.moveTo(O,$),p.lineTo(M,X),p.lineTo(N,tt);p.clip(),p.transform($t[0],$t[2],$t[1],$t[3],M,X),p.translate(m[0]-it,m[3]-wt);let Ct;if(x)Ct=x.canvas,p.scale(C,-C);else{let ot=l[0],Re=ot.extent;Ct=ot.image,p.scale(j(Re)/Ct.width,-ct(Re)/Ct.height)}p.drawImage(Ct,0,0),p.restore()}),x&&(Ji(x),cn.push(x.canvas)),c&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach(function(w,R,A){let b=w.target,S=(b[0][0]-y[0])/s,I=-(b[0][1]-y[1])/s,z=(b[1][0]-y[0])/s,G=-(b[1][1]-y[1])/s,F=(b[2][0]-y[0])/s,V=-(b[2][1]-y[1])/s;p.beginPath(),p.moveTo(z,G),p.lineTo(S,I),p.lineTo(F,V),p.closePath(),p.stroke()}),p.restore()),p.canvas}var Rm=10,lf=.25,ac=class{constructor(t,e,i,r,s,o,a){this.sourceProj_=t,this.targetProj_=e;let l={},h=a?pu(C=>dt(a,Mn(C,this.targetProj_,this.sourceProj_))):qi(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){let y=C[0]+"/"+C[1];return l[y]||(l[y]=h(C)),l[y]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&j(r)>=j(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?j(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?j(this.targetProj_.getExtent()):null;let c=ae(i),u=bn(i),f=vn(i),g=Cn(i),p=this.transformInv_(c),_=this.transformInv_(u),m=this.transformInv_(f),x=this.transformInv_(g),E=Rm+(o?Math.max(0,Math.ceil(Math.log2(gr(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,f,g,p,_,m,x,E),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(y,w,R){C=Math.min(C,y.source[0][0],y.source[1][0],y.source[2][0])}),this.triangles_.forEach(y=>{if(Math.max(y.source[0][0],y.source[1][0],y.source[2][0])-C>this.sourceWorldWidth_/2){let w=[[y.source[0][0],y.source[0][1]],[y.source[1][0],y.source[1][1]],[y.source[2][0],y.source[2][1]]];w[0][0]-C>this.sourceWorldWidth_/2&&(w[0][0]-=this.sourceWorldWidth_),w[1][0]-C>this.sourceWorldWidth_/2&&(w[1][0]-=this.sourceWorldWidth_),w[2][0]-C>this.sourceWorldWidth_/2&&(w[2][0]-=this.sourceWorldWidth_);let R=Math.min(w[0][0],w[1][0],w[2][0]);Math.max(w[0][0],w[1][0],w[2][0])-R<this.sourceWorldWidth_/2&&(y.source=w)}})}l={}}addTriangle_(t,e,i,r,s,o){this.triangles_.push({source:[r,s,o],target:[t,e,i]})}addQuad_(t,e,i,r,s,o,a,l,h){let c=ra([s,o,a,l]),u=this.sourceWorldWidth_?j(c)/this.sourceWorldWidth_:null,f=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&u>.5&&u<1,p=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let m=ra([t,e,i,r]);p=j(m)/this.targetWorldWidth_>lf||p}!g&&this.sourceProj_.isGlobal()&&u&&(p=u>lf||p)}if(!p&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!ht(c,this.maxSourceExtent_))return;let _=0;if(!p&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)p=!0;else if(_=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(h>0){if(!p){let m=[(t[0]+i[0])/2,(t[1]+i[1])/2],x=this.transformInv_(m),E;g?E=(Me(s[0],f)+Me(a[0],f))/2-Me(x[0],f):E=(s[0]+a[0])/2-x[0];let C=(s[1]+a[1])/2-x[1];p=E*E+C*C>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){let m=[(e[0]+i[0])/2,(e[1]+i[1])/2],x=this.transformInv_(m),E=[(r[0]+t[0])/2,(r[1]+t[1])/2],C=this.transformInv_(E);this.addQuad_(t,e,m,E,s,o,x,C,h-1),this.addQuad_(E,m,i,r,C,x,a,l,h-1)}else{let m=[(t[0]+e[0])/2,(t[1]+e[1])/2],x=this.transformInv_(m),E=[(i[0]+r[0])/2,(i[1]+r[1])/2],C=this.transformInv_(E);this.addQuad_(t,m,E,r,s,x,C,l,h-1),this.addQuad_(m,e,i,E,x,o,a,C,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(t,i,r,s,a,l),(_&14)==0&&this.addTriangle_(t,i,e,s,a,o),_&&((_&13)==0&&this.addTriangle_(e,r,t,o,l,s),(_&7)==0&&this.addTriangle_(e,r,i,o,l,a))}calculateSourceExtent(){let t=ut();return this.triangles_.forEach(function(e,i,r){let s=e.source;Bi(t,s[0]),Bi(t,s[1]),Bi(t,s[2])}),t}getTriangles(){return this.triangles_}},cf=ac;var lc=class extends Un{constructor(t,e,i,r,s,o,a,l,h,c,u,f){super(s,k.IDLE,f),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;let g=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent(),_=this.sourceTileGrid_.getExtent(),m=p?Oe(g,p):g;if(gr(m)===0){this.state=k.EMPTY;return}let x=t.getExtent();x&&(_?_=Oe(_,x):_=x);let E=r.getResolution(this.wrappedTileCoord_[0]),C=of(t,i,m,E);if(!isFinite(C)||C<=0){this.state=k.EMPTY;return}let y=c!==void 0?c:.5;if(this.triangulation_=new cf(t,i,m,_,C*y,E),this.triangulation_.getTriangles().length===0){this.state=k.EMPTY;return}this.sourceZ_=e.getZForResolution(C);let w=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(w[1]=et(w[1],_[1],_[3]),w[3]=et(w[3],_[1],_[3])):w=Oe(w,_)),!gr(w))this.state=k.EMPTY;else{let R=0,A=0;t.canWrapX()&&(R=j(x),A=Math.floor((w[0]-x[0])/R)),ps(w.slice(),t,!0).forEach(S=>{let I=e.getTileRangeForExtentAndZ(S,this.sourceZ_);for(let z=I.minX;z<=I.maxX;z++)for(let G=I.minY;G<=I.maxY;G++){let F=A*R;this.sourceTiles_.push({getTile:()=>h(this.sourceZ_,z,G,a),offset:F})}++A}),this.sourceTiles_.length===0&&(this.state=k.EMPTY)}}getImage(){return this.canvas_}reproject_(){let t=[];if(this.sourceTiles_.forEach(e=>{let i=e.tile;if(i&&i.getState()==k.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);r[0]+=e.offset,r[2]+=e.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=e.offset,s[2]+=e.offset),t.push({extent:r,clipExtent:s,image:i.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=k.ERROR;else{let e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),r=typeof i=="number"?i:i[0],s=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=af(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=k.LOADED}this.changed()}load(){for(let t of this.sourceTiles_)t.tile=t.getTile();if(this.state==k.IDLE){this.state=k.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{let i=e.getState();if(i==k.IDLE||i==k.LOADING){t++;let r=K(e,P.CHANGE,s=>{let o=e.getState();(o==k.LOADED||o==k.ERROR||o==k.EMPTY)&&(J(r),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},i,r){e.getState()==k.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(J),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Ji(this.canvas_.getContext("2d")),cn.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},yo=lc;var cc=class{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let t=this.pop();t instanceof di&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){let i=this.entries_[t];return B(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){let e=this.entries_[t];return B(e!==void 0,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){let t=new Array(this.count_),e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){let t=new Array(this.count_),e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){let t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){B(!(t in this.entries_),"Tried to set a value for a key that is used already");let i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}},hc=cc;function Kn(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function Sm(n,t,e){return n+"/"+t+"/"+e}function Zn(n,t,e,i,r){return`${Y(n)},${t},${Sm(e,i,r)}`}function hf(n){return Tm(n[0],n[1],n[2])}function Tm(n,t,e){return(t<<n)+e}function uf(n,t){let e=n[0],i=n[1],r=n[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;let s=t.getFullTileRange(e);return s?s.containsXY(i,r):!0}var uc=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Rr(),{get:(t,e)=>{if(typeof t[e]=="function")return this.pendingMethod_=e,this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){let e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>{this.push_(this.pendingMethod_,t)};pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,r=e.length;i<r;++i){let s=e[i];if(typeof s=="function"){s(t);continue}let o=e[++i];typeof t[s]=="function"?t[s](...o):typeof o=="function"?t[s]=o(t):t[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},Eo=uc;var Im=5,dc=class extends ss{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=Im,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(t){this.renderedSourceKey_?this.renderedSourceKey_!==t&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=t):this.renderedSourceKey_=t}getFeatures(t){return H()}getData(t){return null}prepareFrame(t){return H()}renderFrame(t,e){return H()}forEachFeatureAtCoordinate(t,e,i,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){let e=t.target;(e.getState()===W.LOADED||e.getState()===W.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=W.LOADED&&e!=W.ERROR&&t.addEventListener(P.CHANGE,this.boundHandleImageChange_),e==W.IDLE&&(t.load(),e=t.getState()),e==W.LOADED}renderIfReadyAndVisible(){let t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},df=dc;var gc=[],Bn=null;function Lm(){Bn=nt(1,1,void 0,{willReadFrequently:!0})}var fc=class extends df{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Lt(),this.pixelTransform=Lt(),this.inversePixelTransform=Lt(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){Bn||Lm(),Bn.clearRect(0,0,1,1);let r;try{Bn.drawImage(t,e,i,1,1,0,0,1,1),r=Bn.getImageData(0,0,1,1).data}catch{return Bn=null,null}return r}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i,r,s){if(te(t)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&t.width===r&&t.height===s){let h=t,c=h.getContext("2d");if(c){this.container=t,this.context=c,this.containerReused=!0,i&&(c.fillStyle=i,c.fillRect(0,0,h.width,h.height));return}}let o=this.getLayer().getClassName(),a,l;if(t&&t.className===o&&(!i||t&&t.style.backgroundColor&&zt(he(t.style.backgroundColor),he(i)))){let h=t.firstElementChild;te(h)&&(l=h.getContext("2d"))}if(l&&Eu(l.canvas.style.transform,e)?(this.container=t,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=bt?Ds():document.createElement("div"),a.className=o;let h=a.style;h.position="absolute",h.width="100%",h.height="100%",l=nt();let c=l.canvas;a.appendChild(c),h=c.style,h.position="absolute",h.left="0",h.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){let r=ae(i),s=bn(i),o=vn(i),a=Cn(i);dt(e.coordinateToPixelTransform,r),dt(e.coordinateToPixelTransform,s),dt(e.coordinateToPixelTransform,o),dt(e.coordinateToPixelTransform,a);let l=this.inversePixelTransform;dt(l,r),dt(l,s),dt(l,o),dt(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){let i=t.extent,r=t.viewState.resolution,s=t.viewState.rotation,o=t.pixelRatio,a=Math.round(j(i)/r*o),l=Math.round(ct(i)/r*o);kt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,s,-a/2,-l/2),Ss(this.inversePixelTransform,this.pixelTransform);let h=yu(this.pixelTransform),c=this.getBackground(t);if(this.useContainer(e,h,c,a,l),!this.containerReused){let u=this.context.canvas;u.width!=a||u.height!=l?(u.width=a,u.height=l):this.context.clearRect(0,0,a,l),h!==u.style.transform&&(u.style.transform=h)}}dispatchRenderEvent_(t,e,i){let r=this.getLayer();if(r.hasListener(t)){let s=new fo(t,this.inversePixelTransform,i,e);r.dispatchEvent(s)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Dt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Dt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Eo),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Dt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Dt.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,r,s,o,a){let l=s/2,h=o/2,c=r/e,u=-c,f=-t[0]+a,g=-t[1];return kt(this.tempTransform,l,h,c,u,-i,f,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}},wo=fc;function pc(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;let i=n[e],r=i.has(t);return r||i.add(t),!r}function Am(n,t,e){let i=n[e];return i?i.delete(t):!1}function ff(n,t){let e=n.layerStatesArray[n.layerIndex];e.extent&&(t=Oe(t,ye(e.extent,n.viewState.projection)));let i=e.layer.getRenderSource();if(!i.getWrapX()){let r=i.getTileGridForProjection(n.viewState.projection).getExtent();r&&(t=Oe(t,r))}return t}var mc=class extends wo{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=ut(),this.tempTileRange_=new xo(0,0,0,0),this.tempTileCoord_=Kn(0,0,0);let i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new hc(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new hc(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=Zn(a,a.getKey(),t,e,i),h;if(s.containsKey(l))h=s.get(l);else{let c=r.viewState.projection,u=a.getProjection();if(h=a.getTile(t,e,i,r.pixelRatio,c,!u||An(u,c)?void 0:this.getSourceTileCache()),!h)return null;s.set(l,h)}return h}getTile(t,e,i,r){let s=this.getOrCreateTile(t,e,i,r);return s||null}getData(t){let e=this.frameState;if(!e)return null;let i=this.getLayer(),r=dt(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!me(s,r))return null;let o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){let u=l.getTileCoordForCoordAndZ(r,c),f=this.getTile(c,u[1],u[2],e);if(!f||f.getState()!==k.LOADED)continue;let g=l.getOrigin(c),p=pt(l.getTileSize(c)),_=l.getResolution(c),m;if(f instanceof mo||f instanceof yo)m=f.getImage();else if(f instanceof nc){if(m=po(f.getData()),!m)continue}else continue;let x=Math.floor(h*((r[0]-g[0])/_-u[1]*p[0])),E=Math.floor(h*((g[1]-r[1])/_-u[2]*p[1])),C=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(m,x+C,E+C)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;let e=this.getLayer().getSource();if(!e)return!1;let i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,r,s){let o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=Y(l);c in t.wantedTiles||(t.wantedTiles[c]={});let u=t.wantedTiles[c],f=a.getMapInternal(),g=Math.max(i-s,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),f?f.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),p=o.rotation,_=p?oa(o.center,o.resolution,p,t.size):void 0;for(let m=i;m>=g;--m){let x=h.getTileRangeForExtentAndZ(e,m,this.tempTileRange_),E=h.getResolution(m);for(let C=x.minX;C<=x.maxX;++C)for(let y=x.minY;y<=x.maxY;++y){if(p&&!h.tileCoordIntersectsViewport([m,C,y],_))continue;let w=this.getTile(m,C,y,t);if(!w||!pc(r,w,m))continue;let A=w.getKey();if(u[A]=!0,w.getState()===k.IDLE&&!t.tileQueue.isKeyQueued(A)){let b=Kn(m,C,y,this.tempTileCoord_);t.tileQueue.enqueue([w,c,h.getTileCoordCenter(b),E])}}}}findStaleTile_(t,e){let i=this.tileCache_,r=t[0],s=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let h=Zn(this.getLayer().getSource(),a[l],r,s,o);if(i.containsKey(h)){let c=i.peek(h);if(c.getState()===k.LOADED)return c.endTransition(Y(this)),pc(e,c,r),!0}}return!1}findAltTiles_(t,e,i,r){let s=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),h=l.getKey();for(let c=s.minX;c<=s.maxX;++c)for(let u=s.minY;u<=s.maxY;++u){let f=Zn(l,h,i,c,u),g=!1;if(a.containsKey(f)){let p=a.peek(f);p.getState()===k.LOADED&&(pc(r,p,i),g=!0)}g||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;let i=t.layerStatesArray[t.layerIndex],r=t.viewState,s=r.projection,o=r.resolution,a=r.center,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),u=c.getTileGridForProjection(s),f=u.getZForResolution(o,c.zDirection),g=u.getResolution(f);this.updateStaleKeys(c.getKey());let p=t.extent,_=c.getTilePixelRatio(l);this.prepareContainer(t,e);let m=this.context.canvas.width,x=this.context.canvas.height;this.layerExtent=i.extent?ye(i.extent,s):null,this.layerExtent&&(p=Oe(p,this.layerExtent));let E=g*m/2/_,C=g*x/2/_,y=[a[0]-E,a[1]-C,a[0]+E,a[1]+C],w={};this.renderedTiles.length=0;let R=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){let M=u.getZForResolution(r.nextResolution,c.zDirection),X=ff(t,t.nextExtent);this.enqueueTiles(t,X,M,w,R)}let A=ff(t,p);if(this.enqueueTiles(t,A,f,w,0),R>0&&setTimeout(()=>{this.enqueueTiles(t,A,f-1,w,R-1)},0),!(f in w))return this.container;let b=Y(this),S=t.time;for(let M of w[f]){let X=M.getState();if(X===k.EMPTY)continue;let O=M.tileCoord;if(X===k.LOADED&&M.getAlpha(b,S)===1){M.endTransition(b);continue}if(X!==k.ERROR&&(this.renderComplete=!1),this.findStaleTile_(O,w)){Am(w,M,f),t.animate=!0;continue}if(this.findAltTiles_(u,O,f+1,w))continue;let tt=u.getMinZoom();for(let it=f-1;it>=tt&&!this.findAltTiles_(u,O,it,w);--it);}let I=g/o*l/_,z=this.getRenderContext(t);kt(this.tempTransform,m/2,x/2,I,I,0,-m/2,-x/2),this.layerExtent&&this.clipUnrotated(z,t,this.layerExtent),c.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,t);let G=Object.keys(w).map(Number);G.sort(Zt);let F=[],V=[],lt=[];for(let M=G.length-1;M>=0;--M){let X=G[M],O=c.getTilePixelSize(X,l,s),N=u.getResolution(X)/g,tt=O[0]*N*I,it=O[1]*N*I,wt=u.getTileCoordForCoordAndZ(ae(y),X),L=u.getTileCoordExtent(wt),$t=dt(this.tempTransform,[_*(L[0]-y[0])/g,_*(y[3]-L[3])/g]),Ct=_*c.getGutterForProjection(s);for(let ot of w[X]){if(ot.getState()!==k.LOADED)continue;let Re=ot.tileCoord,Ni=wt[1]-Re[1],ne=Math.round($t[0]-(Ni-1)*tt),Qn=wt[2]-Re[2],Jr=Math.round($t[1]-(Qn-1)*it),Gi=Math.round($t[0]-Ni*tt),Xi=Math.round($t[1]-Qn*it),gn=ne-Gi,Ze=Jr-Xi,pn=X===f;if(pn&&ot.inTransition(b)){lt.push({tile:ot,x:Gi,y:Xi,w:gn,h:Ze,gutter:Ct}),this.renderedTiles.unshift(ot),this.updateUsedTiles(t.usedTiles,c,ot);continue}let tr=[Gi,Xi,Gi+gn,Xi+Ze],er=[];for(let ui=0,ir=F.length;ui<ir;++ui)X<V[ui]&&ht(tr,F[ui])&&er.push(F[ui]);let Qr;er.length>0&&(Qr=Uh(tr,er)),F.push(tr),V.push(X),this.drawTile(ot,t,Gi,Xi,gn,Ze,Ct,pn,Qr),this.renderedTiles.unshift(ot),this.updateUsedTiles(t.usedTiles,c,ot)}}for(let M=0,X=lt.length;M<X;++M){let{tile:O,x:$,y:N,w:tt,h:it,gutter:wt}=lt[M];this.drawTile(O,t,$,N,tt,it,wt,!0,void 0)}if(this.renderedResolution=g,this.extentChanged=!this.renderedExtent_||!Zi(this.renderedExtent_,y),this.renderedExtent_=y,this.renderedPixelRatio=l,this.postRender(this.context,t),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let M=(X,O)=>{let $=Y(c),N=O.wantedTiles[$],tt=N?Object.keys(N).length:0;this.updateCacheSize(tt),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(M)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,i,r,s,o,a,l,h){let c;if(t instanceof nc){if(c=po(t.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(t);if(!c)return;let u=this.getRenderContext(e),f=Y(this),g=e.layerStatesArray[e.layerIndex],p=g.opacity*(l?t.getAlpha(f,e.time):1),_=p!==u.globalAlpha;_&&(u.save(),u.globalAlpha=p);let m=c.width-2*a,x=c.height-2*a;if(h){let E=m/s,C=x/o;for(let y=0,w=h.length;y<w;++y){let R=h[y],A=R[0],b=R[1],S=R[2]-R[0],I=R[3]-R[1];u.drawImage(c,a+(A-i)*E,a+(b-r)*C,S*E,I*C,A,b,S,I)}}else u.drawImage(c,a,a,m,x,i,r,s,o);_&&u.restore(),p!==g.opacity?e.animate=!0:l&&t.endTransition(f)}getImage(){let t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){let r=Y(e);r in t||(t[r]={}),t[r][i.getKey()]=!0}},gf=mc;var Ur={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var _c=class extends tn{constructor(t){t=t||{};let e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Ur.PRELOAD)}setPreload(t){this.set(Ur.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Ur.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Ur.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}},pf=_c;var xc=class extends pf{constructor(t){super(t)}createRenderer(){return new gf(this,{cacheSize:this.getCacheSize()})}},yc=xc;var Ec=class{drawCustom(t,e,i,r,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},Co=Ec;var Kr={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Zr=[Kr.FILL],We=[Kr.STROKE],li=[Kr.BEGIN_PATH],wc=[Kr.CLOSE_PATH],D=Kr;var Cc=class extends Co{constructor(t,e,i,r){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){let e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){let i=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=t.length;a<l;a+=e)r[0]=t[a],r[1]=t[a+1],me(i,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(t,e,i,r,s,o){let a=this.coordinates,l=a.length,h=this.getBufferedMaxExtent();o&&(e+=r);let c=t[e],u=t[e+1],f=this.tmpCoordinate_,g=!0,p,_,m;for(p=e+r;p<i;p+=r)f[0]=t[p],f[1]=t[p+1],m=hs(h,f),m!==_?(g&&(a[l++]=c,a[l++]=u,g=!1),a[l++]=f[0],a[l++]=f[1]):m===yt.INTERSECTING?(a[l++]=f[0],a[l++]=f[1],g=!1):g=!0,c=f[0],u=f[1],_=m;return(s&&g||p===e+r)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,r,s){for(let o=0,a=i.length;o<a;++o){let l=i[o],h=this.appendFlatLineCoordinates(t,e,l,r,!1,!1);s.push(h),e=l}return e}drawCustom(t,e,i,r,s){this.beginGeometry(t,e,s);let o=t.getType(),a=t.getStride(),l=this.coordinates.length,h,c,u,f,g;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),f=[];let p=t.getEndss();g=0;for(let _=0,m=p.length;_<m;++_){let x=[];g=this.drawCustomCoordinates_(h,g,p[_],a,x),f.push(x)}this.instructions.push([D.CUSTOM,l,f,t,i,yr,s]),this.hitDetectionInstructions.push([D.CUSTOM,l,f,t,r||i,yr,s]);break;case"Polygon":case"MultiLineString":u=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),g=this.drawCustomCoordinates_(h,0,t.getEnds(),a,u),this.instructions.push([D.CUSTOM,l,u,t,i,Pn,s]),this.hitDetectionInstructions.push([D.CUSTOM,l,u,t,r||i,Pn,s]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([D.CUSTOM,l,c,t,i,Fe,s]),this.hitDetectionInstructions.push([D.CUSTOM,l,c,t,r||i,Fe,s]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([D.CUSTOM,l,c,t,i,Fe,s]),this.hitDetectionInstructions.push([D.CUSTOM,l,c,t,r||i,Fe,s]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([D.CUSTOM,l,c,t,i,void 0,s]),this.hitDetectionInstructions.push([D.CUSTOM,l,c,t,r||i,void 0,s]);break;default:}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[D.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[D.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let t=this.hitDetectionInstructions;t.reverse();let e,i=t.length,r,s,o=-1;for(e=0;e<i;++e)r=t[e],s=r[0],s==D.END_GEOMETRY?o=e:s==D.BEGIN_GEOMETRY&&(r[2]=e,Sh(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){let i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=jt(i||St)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){let i=t.getColor();e.strokeStyle=jt(i||Yt);let r=t.getLineCap();e.lineCap=r!==void 0?r:Ge;let s=t.getLineDash();e.lineDash=s?s.slice():Ht;let o=t.getLineDashOffset();e.lineDashOffset=o||qt;let a=t.getLineJoin();e.lineJoin=a!==void 0?a:Xe;let l=t.getWidth();e.lineWidth=l!==void 0?l:ri;let h=t.getMiterLimit();e.miterLimit=h!==void 0?h:ii;let c=t.getOffset();e.strokeOffset=c??Md,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){let i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){let e=t.fillStyle,i=[D.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[D.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){let i=t.fillStyle;(i!==void 0&&typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){let i=t.strokeStyle,r=t.lineCap,s=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit,c=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=r||s!=t.currentLineDash&&!zt(t.currentLineDash,s)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h||t.currentStrokeOffset!=c)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=r,t.currentLineDash=s,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h,t.currentStrokeOffset=c)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let e=[D.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=us(this.maxExtent),this.maxLineWidth>0)){let t=this.resolution*(this.maxLineWidth+1)/2;En(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Ye=Cc;var vc=class extends Ye{constructor(t,e,i,r){super(t,e,i,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!me(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);let r=t.getFlatCoordinates(),s=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([D.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([D.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);let r=t.getFlatCoordinates(),s=[];for(let l=0,h=r.length;l<h;l+=t.getStride())(!this.maxExtent||me(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([D.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([D.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){let i=t.getAnchor(),r=t.getSize(),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=r[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},mf=vc;var bc=class extends Ye{constructor(t,e,i,r){super(t,e,i,r)}drawFlatCoordinates_(t,e,i,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,i,r,!1,!1);return this.instructions.push([D.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([D.MOVE_TO_LINE_TO,o,a,s]),i}drawLineString(t,e,i){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([D.SET_STROKE_STYLE,Yt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ht,qt],li);let l=t.getFlatCoordinates(),h=t.getStride();this.drawFlatCoordinates_(l,0,l.length,h,a),this.hitDetectionInstructions.push(We),this.endGeometry(e)}drawMultiLineString(t,e,i){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([D.SET_STROKE_STYLE,Yt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ht,qt],li);let l=t.getEnds(),h=t.getFlatCoordinates(),c=t.getStride(),u=0;for(let f=0,g=l.length;f<g;++f)u=this.drawFlatCoordinates_(h,u,l[f],c,a);this.hitDetectionInstructions.push(We),this.endGeometry(e)}finish(){let t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(We),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(We),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(li)}},_f=bc;var Rc=class extends Ye{constructor(t,e,i,r){super(t,e,i,r)}drawFlatCoordinatess_(t,e,i,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,h=i.length;this.instructions.push(li),this.hitDetectionInstructions.push(li);for(let c=0;c<h;++c){let u=i[c],f=this.coordinates.length,g=this.appendFlatLineCoordinates(t,e,u,r,!0,!l);this.instructions.push([D.MOVE_TO_LINE_TO,f,g,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([D.MOVE_TO_LINE_TO,f,g,s,!0]),l&&(this.instructions.push(wc),this.hitDetectionInstructions.push(wc)),e=u}return a&&(this.instructions.push(Zr),this.hitDetectionInstructions.push(Zr)),l&&(this.instructions.push(We),this.hitDetectionInstructions.push(We)),e}drawCircle(t,e,i){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_FILL_STYLE,St]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_STROKE_STYLE,Yt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ht,qt]);let l=t.getFlatCoordinates(),h=t.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,h,!1,!1);let u=[D.CIRCLE,c,a];this.instructions.push(li,u),this.hitDetectionInstructions.push(li,u),r.fillStyle!==void 0&&(this.instructions.push(Zr),this.hitDetectionInstructions.push(Zr)),r.strokeStyle!==void 0&&(this.instructions.push(We),this.hitDetectionInstructions.push(We)),this.endGeometry(e)}drawPolygon(t,e,i){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_FILL_STYLE,St]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_STROKE_STYLE,Yt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ht,qt]);let l=t.getEnds(),h=t.getOrientedFlatCoordinates(),c=t.getStride();this.drawFlatCoordinatess_(h,0,l,c,a),this.endGeometry(e)}drawMultiPolygon(t,e,i){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_FILL_STYLE,St]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_STROKE_STYLE,Yt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ht,qt]);let l=t.getEndss(),h=t.getOrientedFlatCoordinates(),c=t.getStride(),u=0;for(let f=0,g=l.length;f<g;++f)u=this.drawFlatCoordinatess_(h,u,l[f],c,a);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let t=this.tolerance;if(t!==0){let e=this.coordinates;for(let i=0,r=e.length;i<r;++i)e[i]=Ei(e[i],t)}return super.finish()}setFillStrokeStyles_(){let t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){let e=this.state,i=e.fillStyle,r=e.strokeStyle,s=e.strokeOffset;return Math.abs(s)>0&&i!==void 0&&r!==void 0?(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=r,e.strokeOffset=s,t(),e.fillStyle=i,!0):!1}},Sc=Rc;var Tc=0,Ic=1;function Mm(n,t,e,i,r,s,o,a){let l=o-r,h=a-s,c=0,u=1;if(l===0){if(r<n||r>e)return!1}else{let f=(n-r)/l,g=(e-r)/l;if(f>g){let p=f;f=g,g=p}if(f>c&&(c=f),g<u&&(u=g),c>u)return!1}if(h===0){if(s<t||s>i)return!1}else{let f=(t-s)/h,g=(i-s)/h;if(f>g){let p=f;f=g,g=p}if(f>c&&(c=f),g<u&&(u=g),c>u)return!1}return Tc=c,Ic=u,!0}function xf(n,t,e,i){let r=i[0],s=i[1],o=i[2],a=i[3],l=[],h=[],c=!1,u,f,g=0;for(let p=0,_=t.length;p<_;++p){let m=t[p],x=n[g],E=n[g+1],C=!1;for(let y=g+e;y<m;y+=e){let w=n[y],R=n[y+1];if(Mm(r,s,o,a,x,E,w,R)){let A=w-x,b=R-E,S=x+Tc*A,I=E+Tc*b,z=x+Ic*A,G=E+Ic*b;c&&C&&S===u&&I===f?l.push(z,G):(c&&h.push(l.length),l.push(S,I,z,G),c=!0),u=z,f=G,C=!0}x=w,E=R}g=m}return c&&h.push(l.length),{flatCoordinates:l,ends:h}}function yf(n,t,e,i,r){let s=[],o=e,a=0,l=t.slice(e,2);for(;a<n&&o+r<i;){let[h,c]=l.slice(-2),u=t[o+r],f=t[o+r+1],g=Math.sqrt((u-h)*(u-h)+(f-c)*(f-c));if(a+=g,a>=n){let p=(n-a+g)/g,_=Nt(h,u,p),m=Nt(c,f,p);l.push(_,m),s.push(l),l=[_,m],a==n&&(o+=r),a=0}else if(a<n)l.push(t[o+r],t[o+r+1]),o+=r;else{let p=g-a,_=Nt(h,u,p/g),m=Nt(c,f,p/g);l.push(_,m),s.push(l),l=[_,m],a=0,o+=r}}return a>0&&s.push(l),s}function Ef(n,t,e,i,r){let s=e,o=e,a=0,l=0,h=e,c,u,f,g,p,_,m,x,E,C;for(u=e;u<i;u+=r){let y=t[u],w=t[u+1];p!==void 0&&(E=y-p,C=w-_,g=Math.sqrt(E*E+C*C),m!==void 0&&(l+=f,c=Math.acos((m*E+x*C)/(f*g)),c>n&&(l>a&&(a=l,s=h,o=u),l=0,h=u-r)),f=g,m=E,x=C),p=y,_=w}return l+=g,l>a?[h,u]:[s,o]}var Br={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Lc=class extends Ye{constructor(t,e,i,r){super(t,e,i,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[St]={fillStyle:St},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,h=t.getType(),c=null,u=t.getStride();if(o.placement==="line"&&(h=="LineString"||h=="MultiLineString"||h=="Polygon"||h=="MultiPolygon")){let f=t.getExtent();if(!ht(this.maxExtent,f))return;let g;if(c=t.getFlatCoordinates(),h=="LineString")g=[c.length];else if(h=="MultiLineString")g=t.getEnds();else if(h=="Polygon")g=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){let x=t.getEndss();g=[];for(let E=0,C=x.length;E<C;++E)g.push(x[E][0])}if((h=="LineString"||h=="MultiLineString")&&!Pe(this.getBufferedMaxExtent(),f)){let x=xf(c,g,u,this.getBufferedMaxExtent());if(c=x.flatCoordinates,g=x.ends,u=2,g.length===0)return}this.beginGeometry(t,e,i);let p=o.repeat,_=p?void 0:o.textAlign,m=0;for(let x=0,E=g.length;x<E;++x){let C;p?C=yf(p*this.resolution,c,m,g[x],u):C=[c.slice(m,g[x])];for(let y=0,w=C.length;y<w;++y){let R=C[y],A=0,b=R.length;if(_==null){let I=Ef(o.maxAngle,R,0,R.length,2);A=I[0],b=I[1]}for(let I=A;I<b;I+=u)a.push(R[I],R[I+1]);let S=a.length;m=g[x],this.drawChars_(l,S),l=S}}this.endGeometry(e)}else{let f=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||f.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":let y=t.getFlatInteriorPoints();c=[];for(let w=0,R=y.length;w<R;w+=3)o.overflow||f.push(y[w+2]/this.resolution),c.push(y[w],y[w+1]);if(c.length===0)return;u=2;break;default:}let g=this.appendFlatPointCoordinates(c,u);if(g===l)return;if(f&&(g-l)/2!==c.length/u){let y=l/2;f=f.filter((w,R)=>{let A=a[(y+R)*2]===c[R*u]&&a[(y+R)*2+1]===c[R*u+1];return A||--y,A})}this.saveTextStates_();let p=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,_=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let m=o.padding;if(m!=ni&&(o.scale[0]<0||o.scale[1]<0)){let y=o.padding[0],w=o.padding[1],R=o.padding[2],A=o.padding[3];o.scale[0]<0&&(w=-w,A=-A),o.scale[1]<0&&(y=-y,R=-R),m=[y,w,R,A]}let x=this.pixelRatio;this.instructions.push([D.DRAW_IMAGE,l,g,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,m==ni?ni:m.map(function(y){return y*x}),p,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,f]);let E=1/x,C=p?p.slice(0):null;C&&(C[1]=St),this.hitDetectionInstructions.push([D.DRAW_IMAGE,l,g,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[E,E],NaN,this.declutterMode_,this.declutterImageWithText_,m,C,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?St:this.fillKey_,this.textOffsetX_,this.textOffsetY_,f]),this.endGeometry(e)}}saveTextStates_(){let t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,r=this.strokeKey_;t&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||Ii,justify:e.justify,textBaseline:e.textBaseline||on,scale:e.scale});let o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){let i=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,h=Br[r.textBaseline],c=this.textOffsetX_*l,u=this.textOffsetY_*l,f=this.text_,g=i?i.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([D.DRAW_CHARS,t,e,h,r.overflow,a,r.maxAngle,l,u,s,g*l,f,o,1,this.declutterMode_,this.textKeepUpright_,c]),this.hitDetectionInstructions.push([D.DRAW_CHARS,t,e,h,r.overflow,a&&St,r.maxAngle,l,u,s,g*l,f,o,1/l,this.declutterMode_,this.textKeepUpright_,c])}setTextStyle(t,e){let i,r,s;if(!t)this.text_="";else{let o=t.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=jt(o.getColor()||St)):(r=null,this.textFillState_=r);let a=t.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let _=a.getLineDash(),m=a.getLineDashOffset(),x=a.getWidth(),E=a.getMiterLimit();s.lineCap=a.getLineCap()||Ge,s.lineDash=_?_.slice():Ht,s.lineDashOffset=m===void 0?qt:m,s.lineJoin=a.getLineJoin()||Xe,s.lineWidth=x===void 0?ri:x,s.miterLimit=E===void 0?ii:E,s.strokeStyle=jt(a.getColor()||Yt)}i=this.textState_;let l=t.getFont()||io;Pd(l);let h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||on,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||ni,i.scale=h===void 0?[1,1]:h;let c=t.getOffsetX(),u=t.getOffsetY(),f=t.getRotateWithView(),g=t.getKeepUpright(),p=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=f===void 0?!1:f,this.textKeepUpright_=g===void 0?!0:g,this.textRotation_=p===void 0?0:p,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Y(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Y(r.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},wf=Lc;var Pm={Circle:Sc,Default:Ye,Image:mf,LineString:_f,Polygon:Sc,Text:wf},Ac=class{constructor(t,e,i,r){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=r,this.resolution_=i,this.buildersByZIndex_={}}finish(){let t={};for(let e in this.buildersByZIndex_){t[e]=t[e]||{};let i=this.buildersByZIndex_[e];for(let r in i){let s=i[r].finish();t[e][r]=s}}return t}getBuilder(t,e){let i=t!==void 0?t.toString():"0",r=this.buildersByZIndex_[i];r===void 0&&(r={},this.buildersByZIndex_[i]=r);let s=r[e];if(s===void 0){let o=Pm[e];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[e]=s}return s}},Cf=Ac;function vf(n,t,e,i){let r=n[t],s=n[t+1],o=0;for(let a=t+i;a<e;a+=i){let l=n[a],h=n[a+1];o+=Math.sqrt((l-r)*(l-r)+(h-s)*(h-s)),r=l,s=h}return o}function vo(n,t,e,i,r,s,o,a){o=o??[],a=a??i;let l=n[t+i],h=n[t+i+1],c=n[e-2*i],u=n[e-2*i+1],f,g,p,_,m,x,E,C,y=0;for(let w=t;w<e;w+=i){p=f,_=g,m=void 0,x=void 0,w+i<e&&(m=n[w+i],x=n[w+i+1]),s&&w===t&&(p=c,_=u),s&&w===e-i&&(m=l,x=h),f=n[w],g=n[w+1],[E,C]=Om(f,g,p,_,m,x,r),o[y++]=E,o[y++]=C;for(let R=2;R<a;R++)o[y++]=n[w+R]}return o.length!=y&&(o.length=y),o}function Om(n,t,e,i,r,s,o){let a,l;e!==void 0&&i!==void 0?(a=n-e,l=t-i):r!==void 0&&s!==void 0?(a=r-n,l=s-t):(a=1,l=0);let h=Math.hypot(a,l),c=a/h,u=l/h;if(a=-u,l=c,e===void 0||i===void 0)return[n+a*o,t+l*o];if(r===void 0||s===void 0)return[n+a*o,t+l*o];let f=Vh([n,t],[e,i],[r,s]);if(Math.cos(f)>.998)return[n+c*o,t+u*o];let g=Math.cos(f/2),p=Math.sin(f/2),_=p*a+g*l,m=-g*a+p*l,x=_*(1/p),E=m*(1/p);return[n+x*o,t+E*o]}function bo(n,t,e=!1){for(let i=0,r=n.length-2;i<r;i+=t){let s=e&&i===0?n.length-3*t:n.length-2*t;for(let o=s;o>i+t;o-=t){let a=n[i],l=n[i+1],h=n[i+t],c=n[i+t+1],u=n[o],f=n[o+1],g=n[o+t],p=n[o+t+1],_=(p-f)*(h-a)-(g-u)*(c-l);if(_===0)continue;let m=((g-u)*(l-f)-(p-f)*(a-u))/_,x=((h-a)*(l-f)-(c-l)*(a-u))/_;if(m>0&&m<1&&x>0&&x<1){let E=a+m*(h-a),C=l+m*(c-l);n[i+t]=E,n[i+t+1]=C,n.splice(i+2*t,o-i-t);break}}}return n}var Mc;function km(){return Mc||(Mc=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Mc}function bf(n,t,e,i,r,s,o,a,l,h,c,u,f=!0){let g=n[t],p=n[t+1],_=0,m=0,x=0,E=0;function C(){_=g,m=p,t+=i,g=n[t],p=n[t+1],E+=x,x=Math.sqrt((g-_)*(g-_)+(p-m)*(p-m))}do C();while(t<e-i&&E+x<s);let y=x===0?0:(s-E)/x,w=Nt(_,g,y),R=Nt(m,p,y),A=t-i,b=E,S=s+a*l(h,r,c);for(;t<e-i&&E+x<S;)C();y=x===0?0:(S-E)/x;let I=Nt(_,g,y),z=Nt(m,p,y),G=!1;if(f)if(u){let O=[w,R,I,z];Ts(O,0,4,2,u,O,O),G=O[0]>O[2]}else G=w>I;let F=Math.PI,V=[],lt=A+i===t;t=A,x=0,E=b,g=n[t],p=n[t+1];let M;if(lt){C(),M=Math.atan2(p-m,g-_),G&&(M+=M>0?-F:F);let O=(I+w)/2,$=(z+R)/2;return V[0]=[O,$,(S-s)/2,M,r],V}r=r.replace(/\n/g," ");let X=Array.from(km().segment(r),O=>O.segment);for(let O=0,$=X.length;O<$;){C();let N=Math.atan2(p-m,g-_);if(G&&(N+=N>0?-F:F),M!==void 0){let Ct=N-M;if(Ct+=Ct>F?-2*F:Ct<-F?2*F:0,Math.abs(Ct)>o)return null}M=N;let tt=O,it=0;for(;O<$;++O){let Ct=G?$-O-1:O,ot=a*l(h,X[Ct],c);if(t+i<e&&E+x<s+it+ot/2)break;it+=ot}if(O===tt)continue;let wt=(G?X.slice($-O,$-tt):X.slice(tt,O)).join("");y=x===0?0:(s+it/2-E)/x;let L=Nt(_,g,y),$t=Nt(m,p,y);V.push([L,$t,it/2,N,wt]),s+=it}return V}var Vn=ut(),Li=[],ci=[],hi=[],Ai=[];function Rf(n){return n[3].declutterBox}var Sf=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function Pc(n,t){return t==="start"?t=Sf.test(n)?"right":"left":t==="end"&&(t=Sf.test(n)?"left":"right"),Br[t]}function Dm(n,t,e){return e>0&&n.push(`3+`||h===c){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let f=t[h+1]||n.font,g=kd(f,u);e.push(g),o+=g;let p=im(f);i.push(p),l=Math.max(l,p)}return{width:s,height:a,widths:e,heights:i,lineWidths:r}}function Fd(n,t,e,i,r,s,o,a,l,h,c){n.save(),e!==1&&(n.globalAlpha===void 0?n.globalAlpha=u=>u.globalAlpha*=e:n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,h),n.scale(c[0],c[1]),nm(i,n)):c[0]<0||c[1]<0?(n.translate(l,h),n.scale(c[0],c[1]),n.drawImage(i,r,s,o,a,0,0,o,a)):n.drawImage(i,r,s,o,a,l,h,o*c[0],a*c[1]),n.restore()}function nm(n,t){let e=n.contextInstructions;for(let i=0,r=e.length;i<r;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}var Fl=class n{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=pt(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){let t=this.getScale();return new n({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return H()}getImage(t){return H()}getHitDetectionImage(){return H()}getPixelRatio(t){return 1}getImageState(){return H()}getImageSize(){return H()}getOrigin(){return H()}getSize(){return H()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=pt(t)}listenImageChange(t){H()}load(){H()}unlistenImageChange(t){H()}ready(){return Promise.resolve()}},no=Fl;var zl=class n extends no{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?W.LOADING:W.LOADED,this.imageState_===W.LOADING&&this.ready().then(()=>this.imageState_=W.LOADED),this.render()}clone(){let t=this.getScale(),e=new n({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){let t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(","),r=Wt.get(i,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*t),a=nt(o,o);this.draw_(s,a,t),r=a.canvas;let l=new Ld(r,void 0,null,W.LOADED,null);Wt.set(i,null,l),createImageBitmap(r).then(h=>{l.setImage(h)})}return r}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let S=r;r=s,s=S}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),h=Math.sqrt(s*s-l*l),c=r-h,u=Math.sqrt(l*l+c*c),f=u/l;if(t==="miter"&&f<=i)return f*e;let g=e/2/f,p=e/2*(c/u),m=Math.sqrt((r+g)*(r+g)+p*p)-r;if(this.radius2_===void 0||t==="bevel")return m*2;let x=r*Math.sin(a),E=Math.sqrt(r*r-x*x),C=s-E,w=Math.sqrt(x*x+C*C)/x;if(w<=i){let S=w*e/2-s-r;return 2*Math.max(m,S)}return m*2}createRenderOptions(){let t=Ge,e=Xe,i=0,r=null,s=0,o,a=0;this.stroke_&&(o=jt(this.stroke_.getColor()??Yt),a=this.stroke_.getWidth()??ri,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??Xe,t=this.stroke_.getLineCap()??Ge,i=this.stroke_.getMiterLimit()??ii);let l=this.calculateLineJoinSize_(e,a,i),h=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:r,lineDashOffset:s,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();let t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let r=this.fill_.getColor();r===null&&(r=St),e.fillStyle=jt(r),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),r=0;typeof i=="string"&&(i=he(i)),i===null?r=1:Array.isArray(i)&&(r=i.length===4?i[3]:1),r===0&&(e=nt(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_,i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{let r=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){let l=s+a*o,h=a%2===0?i:r;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=St,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},ro=zl;var Nl=class n extends ro{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){let t=this.getScale(),e=new n({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}},so=Nl;var Gl=class n{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){let t=this.getColor();return new n({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){let e=Ti(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===W.IDLE&&e.load(),e.getImageState()===W.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){let t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?Y(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:he(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},_t=Gl;function zd(n,t,e,i){return e!==void 0&&i!==void 0?[e/n,i/t]:e!==void 0?e/n:i!==void 0?i/t:1}var Xl=class n extends no{constructor(t){t=t||{};let e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,r=t.scale!==void 0?t.scale:1,s=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:r,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;let o=t.img!==void 0?t.img:null,a=t.src;B(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Y(o)),B(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),B(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=W.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?W.LOADED:W.IDLE:l=W.LOADING:l=W.LOADED),this.color_=t.color!==void 0?he(t.color):null,this.iconImage_=Ti(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{let u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;let f=()=>{if(this.unlistenImageChange(f),!this.initialOptions_)return;let g=this.iconImage_.getSize();this.setScale(zd(g[0],g[1],t.width,t.height))};this.listenImageChange(f);return}}h!==void 0&&this.setScale(zd(h,c,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new n({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=r[0]),this.anchorYUnits_=="fraction"&&(t[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+r[1])}this.normalizedAnchor_=t}let e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){let e=t?he(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((o,a)=>o===e[a]))return;this.color_=e;let i=this.getSrc(),r=i!==void 0?null:this.getHitDetectionImage(),s=i!==void 0?W.IDLE:this.iconImage_.getImageState();this.iconImage_=Ti(r,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){let e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Ti(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},W.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==W.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){let t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==W.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(P.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(P.CHANGE,t)}ready(){return this.iconImage_.ready()}},an=Xl;var Wl=class n{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){let t=this.getColor();return new n({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}},At=Wl;var oo=class n{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Nd,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new n({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Nd,this.geometry_=t}setZIndex(t){this.zIndex_=t}};function Gd(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:(B(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}var Yl=null;function Ul(n,t){if(!Yl){let e=new _t({color:"rgba(255,255,255,0.4)"}),i=new At({color:"#3399CC",width:1.25});Yl=[new oo({image:new so({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Yl}function Nd(n){return n.getGeometry()}var Mt=oo;var rm="#333",Kl=class n{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=pt(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new _t({color:rm}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){let t=this.getScale();return new n({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof _t?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=pt(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}},si=Kl;function sm(n){return!0}function om(n,t){t=t??Qs();let e=am(n,t),i=Ml();return function(r,s){if(i.properties=r.getPropertiesInternal(),i.resolution=s,t.featureId){let o=r.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=to(r.getGeometry())),e(i)}}function Xd(n,t){t=t??Qs();let e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=Zl(n[o],t);let r=Ml(),s=new Array(e);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,t.featureId){let h=o.getId();h!==void 0?r.featureId=h:r.featureId=null}t.geometryType&&(r.geometryType=to(o.getGeometry()));let l=0;for(let h=0;h<e;++h){let c=i[h](r);c&&(s[l]=c,l+=1)}return s.length=l,s}}function Kd(n,t){if(t=t??Qs(),!Array.isArray(n))return Xd([n],t);let e=n.length;if("style"in n[0]){let s=new Array(e);for(let o=0;o<e;++o){let a=n[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return om(s,t)}return Xd(n,t)}function am(n,t){let e=n.length,i=new Array(e);for(let r=0;r<e;++r){let s=n[r],o="filter"in s?Ce(s.filter,Gt,t):sm,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=Zl(s.style[h],t)}else a=[Zl(s.style,t)];i[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<e;++a){let l=i[a].filter;if(l(r)&&!(n[a].else&&o)){o=!0;for(let h of i[a].styles){let c=h(r);c&&s.push(c)}}}return s}}function Zl(n,t){let e=Xr(n,"",t),i=Wr(n,"",t),r=lm(n,t),s=cm(n,t),o=Ft(n,"z-index",t);if(!e&&!i&&!r&&!s&&!de(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));let a=new Mt;return function(l){let h=!0;if(e){let c=e(l);c&&(h=!1),a.setFill(c)}if(i){let c=i(l);c&&(h=!1),a.setStroke(c)}if(r){let c=r(l);c&&(h=!1),a.setText(c)}if(s){let c=s(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function Xr(n,t,e){let i;if(t+"fill-pattern-src"in n)i=fm(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return s=>null;i=lo(n,t+"fill-color",e)}if(!i)return null;let r=new _t;return function(s){let o=i(s);return o===js?null:(r.setColor(o),r)}}function Wr(n,t,e){let i=Ft(n,t+"stroke-width",e),r=lo(n,t+"stroke-color",e);if(!i&&!r)return null;let s=oi(n,t+"stroke-line-cap",e),o=oi(n,t+"stroke-line-join",e),a=Zd(n,t+"stroke-line-dash",e),l=Ft(n,t+"stroke-line-dash-offset",e),h=Ft(n,t+"stroke-miter-limit",e),c=Ft(n,t+"stroke-offset",e),u=new At;return function(f){if(r){let g=r(f);if(g===js)return null;u.setColor(g)}if(i&&u.setWidth(i(f)),s){let g=s(f);if(g!=="butt"&&g!=="round"&&g!=="square")throw new Error("Expected butt, round, or square line cap");u.setLineCap(g)}if(o){let g=o(f);if(g!=="bevel"&&g!=="round"&&g!=="miter")throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(g)}return a&&u.setLineDash(a(f)),l&&u.setLineDashOffset(l(f)),h&&u.setMiterLimit(h(f)),c&&u.setOffset(c(f)),u}}function lm(n,t){let e="text-",i=oi(n,e+"value",t);if(!i)return null;let r=Xr(n,e,t),s=Xr(n,e+"background-",t),o=Wr(n,e,t),a=Wr(n,e+"background-",t),l=oi(n,e+"font",t),h=Ft(n,e+"max-angle",t),c=Ft(n,e+"offset-x",t),u=Ft(n,e+"offset-y",t),f=Yn(n,e+"overflow",t),g=oi(n,e+"placement",t),p=Ft(n,e+"repeat",t),_=co(n,e+"scale",t),m=Yn(n,e+"rotate-with-view",t),x=Ft(n,e+"rotation",t),E=oi(n,e+"align",t),C=oi(n,e+"justify",t),y=oi(n,e+"baseline",t),w=Yn(n,e+"keep-upright",t),S=Zd(n,e+"padding",t),A=ho(n,e+"declutter-mode"),R=new si({declutterMode:A});return function(T){if(R.setText(i(T)),r&&R.setFill(r(T)),s&&R.setBackgroundFill(s(T)),o&&R.setStroke(o(T)),a&&R.setBackgroundStroke(a(T)),l&&R.setFont(l(T)),h&&R.setMaxAngle(h(T)),c&&R.setOffsetX(c(T)),u&&R.setOffsetY(u(T)),f&&R.setOverflow(f(T)),g){let I=g(T);if(I!=="point"&&I!=="line")throw new Error("Expected point or line for text-placement");R.setPlacement(I)}if(p&&R.setRepeat(p(T)),_&&R.setScale(_(T)),m&&R.setRotateWithView(m(T)),x&&R.setRotation(x(T)),E){let I=E(T);if(I!=="left"&&I!=="center"&&I!=="right"&&I!=="end"&&I!=="start")throw new Error("Expected left, right, center, start, or end for text-align");R.setTextAlign(I)}if(C){let I=C(T);if(I!=="left"&&I!=="right"&&I!=="center")throw new Error("Expected left, right, or center for text-justify");R.setJustify(I)}if(y){let I=y(T);if(I!=="bottom"&&I!=="top"&&I!=="middle"&&I!=="alphabetic"&&I!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");R.setTextBaseline(I)}return S&&R.setPadding(S(T)),w&&R.setKeepUpright(w(T)),R}}function cm(n,t){return"icon-src"in n?hm(n,t):"shape-points"in n?um(n,t):"circle-radius"in n?dm(n,t):null}function hm(n,t){let e="icon-",i=e+"src",r=Bd(n[i],i),s=ao(n,e+"anchor",t),o=co(n,e+"scale",t),a=Ft(n,e+"opacity",t),l=ao(n,e+"displacement",t),h=Ft(n,e+"rotation",t),c=Yn(n,e+"rotate-with-view",t),u=Yd(n,e+"anchor-origin"),f=Ud(n,e+"anchor-x-units"),g=Ud(n,e+"anchor-y-units"),p=ai(n,e+"color"),_,m=null;p!==void 0&&(Array.isArray(p)&&p.length>0&&typeof p[0]=="string"?m=lo(n,e+"color",t):_=Vd(p,e+"color"));let x=pm(n,e+"cross-origin"),E=mm(n,e+"offset"),C=Yd(n,e+"offset-origin"),y=Bl(n,e+"width"),w=Bl(n,e+"height"),S=gm(n,e+"size"),A=ho(n,e+"declutter-mode"),R={src:r,anchorOrigin:u,anchorXUnits:f,anchorYUnits:g,crossOrigin:x,offset:E,offsetOrigin:C,height:w,width:y,size:S,declutterMode:A},T=null;return function(I){if(T)m&&T.setColor(m(I));else{let z=m?m(I):_;T=new an(z!==void 0?Object.assign({},R,{color:z}):Object.assign({},R))}return a&&T.setOpacity(a(I)),l&&T.setDisplacement(l(I)),h&&T.setRotation(h(I)),c&&T.setRotateWithView(c(I)),o&&T.setScale(o(I)),s&&T.setAnchor(s(I)),T}}function um(n,t){let e="shape-",i=e+"points",r=e+"radius",s=Vl(n[i],i);if(!(r in n))throw new Error(`Expected a number for ${r}`);let o=Ft(n,r,t),a=typeof n[r]=="number"?n[r]:5,l=e+"radius2",h=Ft(n,l,t),c=typeof n[l]=="number"?n[l]:void 0,u=Xr(n,e,t),f=Wr(n,e,t),g=co(n,e+"scale",t),p=ao(n,e+"displacement",t),_=Ft(n,e+"rotation",t),m=Yn(n,e+"rotate-with-view",t),x=Bl(n,e+"angle"),E=ho(n,e+"declutter-mode"),C=new ro({points:s,radius:a,radius2:c,angle:x,declutterMode:E});return function(y){return o&&C.setRadius(o(y)),h&&C.setRadius2(h(y)),u&&C.setFill(u(y)),f&&C.setStroke(f(y)),p&&C.setDisplacement(p(y)),_&&C.setRotation(_(y)),m&&C.setRotateWithView(m(y)),g&&C.setScale(g(y)),C}}function dm(n,t){let e="circle-",i=Xr(n,e,t),r=Wr(n,e,t),s=Ft(n,e+"radius",t),o=co(n,e+"scale",t),a=ao(n,e+"displacement",t),l=Ft(n,e+"rotation",t),h=Yn(n,e+"rotate-with-view",t),c=ho(n,e+"declutter-mode"),u=new so({radius:5,declutterMode:c});return function(f){return s&&u.setRadius(s(f)),i&&u.setFill(i(f)),r&&u.setStroke(r(f)),a&&u.setDisplacement(a(f)),l&&u.setRotation(l(f)),h&&u.setRotateWithView(h(f)),o&&u.setScale(o(f)),u}}function ai(n,t){if(!(t in n))return;let e=n[t];return e===void 0?void 0:e}function Ft(n,t,e){let i=ai(n,t);if(i===void 0)return;let r=Ce(i,Q,e);return function(s){return Vl(r(s),t)}}function oi(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,Xt,e);return function(s){return Bd(r(s),t)}}function fm(n,t,e){let i=oi(n,t+"pattern-src",e),r=Wd(n,t+"pattern-offset",e),s=Wd(n,t+"pattern-size",e),o=lo(n,t+"color",e);return function(a){return{src:i(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Yn(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,Gt,e);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${t}`);return o}}function lo(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,Kt,e);return function(s){return Vd(r(s),t)}}function Zd(n,t,e){let i=ai(n,t);if(i===void 0)return null;if(Array.isArray(i)&&(i.length===0||typeof i[0]!="string")){let s=i.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Ce(o,Q,e);return function(h){return Vl(l(h),`${t}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Ce(i,ei,e);return function(s){return Yr(r(s),t)}}function ao(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,ei,e);return function(s){let o=Yr(r(s),t);if(o.length!==2)throw new Error(`Expected two numbers for ${t}`);return o}}function Wd(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,ei,e);return function(s){return jd(r(s),t)}}function co(n,t,e){let i=ai(n,t);if(i===void 0)return null;let r=Ce(i,ei|Q,e);return function(s){return _m(r(s),t)}}function Bl(n,t){let e=n[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function gm(n,t){let e=n[t];if(e!==void 0){if(typeof e=="number")return pt(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function pm(n,t){let e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function Yd(n,t){let e=n[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function Ud(n,t){let e=n[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function mm(n,t){let e=n[t];if(e!==void 0)return Yr(e,t)}function ho(n,t){let e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function Yr(n,t){if(!Array.isArray(n))throw new Error(`Expected an array for ${t}`);let e=n.length;for(let i=0;i<e;++i)if(typeof n[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return n}function Bd(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function Vl(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function Vd(n,t){if(typeof n=="string")return n;let e=Yr(n,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function jd(n,t){let e=Yr(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function _m(n,t){return typeof n=="number"?n:jd(n,t)}var Hd={RENDER_ORDER:"renderOrder"},jl=class extends tn{constructor(t){t=t||{};let e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Hd.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){let i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new en(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Hd.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?Ul:t;let e=xm(t);this.styleFunction_=t===null?void 0:Gd(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}};function xm(n){if(n===void 0)return Ul;if(!n)return null;if(typeof n=="function"||n instanceof Mt)return n;if(Array.isArray(n)&&n.length===0)return[];if(Array.isArray(n)&&n[0]instanceof Mt){let e=n.length,i=new Array(e);for(let r=0;r<e;++r){let s=n[r];if(!(s instanceof Mt))throw new Error("Expected a list of style instances");i[r]=s}return i}return Kd(n)}var uo=jl;var Hl=class extends Tt{constructor(t,e,i,r){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=r}},fo=Hl;var ql=class extends di{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){H()}calculateMatrices2D(t){let e=t.viewState,i=t.coordinateToPixelTransform,r=t.pixelToCoordinateTransform;kt(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Ss(r,i)}forEachFeatureAtCoordinate(t,e,i,r,s,o,a,l){let h,c=e.viewState;function u(y,w,S,A){return s.call(o,w,y?S:null,A)}let f=c.projection,g=ms(t.slice(),f),p=[[0,0]];if(f.canWrapX()&&r){let y=f.getExtent(),w=j(y);p.push([-w,0],[w,0])}let _=e.layerStatesArray,m=_.length,x=[],E=[];for(let y=0;y<p.length;y++)for(let w=m-1;w>=0;--w){let S=_[w],A=S.layer;if(A.hasRenderer()&&Ir(S,c)&&a.call(l,A)){let R=A.getRenderer(),T=A.getSource();if(R&&T){let I=T.getWrapX()?g:t,z=u.bind(null,S.managed);E[0]=I[0]+p[y][0],E[1]=I[1]+p[y][1],h=R.forEachFeatureAtCoordinate(E,e,i,z,x)}if(h)return h}}if(x.length===0)return;let C=1/x.length;return x.forEach((y,w)=>y.distanceSq+=w*C),x.sort((y,w)=>y.distanceSq-w.distanceSq),x.some(y=>h=y.callback(y.feature,y.layer,y.geometry)),h}hasFeatureAtCoordinate(t,e,i,r,s,o){return this.forEachFeatureAtCoordinate(t,e,i,r,He,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(t){H()}scheduleExpireIconCache(t){Wt.canExpireCache()&&t.postRenderFunctions.push(ym)}};function ym(n,t){Wt.expire()}var qd=ql;var $l=class extends qd{constructor(t){super(t),this.fontChangeListenerKey_=K(sn,ue.PROPERTYCHANGE,t.redrawText,t),this.element_=bt?Ds():document.createElement("div");let e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=vi+" ol-layers";let i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){let i=this.getMap();if(i.hasListener(t)){let r=new fo(t,void 0,e);i.dispatchEvent(r)}}disposeInternal(){J(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Dt.PRECOMPOSE,t);let e=t.layerStatesArray.sort((c,u)=>c.zIndex-u.zIndex);e.some(c=>c.layer instanceof uo&&c.layer.getDeclutter())&&(t.declutter={});let r=t.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;te(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],h=a?o:null;for(let c=0,u=e.length;c<u;++c){let f=e[c];t.layerIndex=c;let g=f.layer,p=g.getSourceState();if(!Ir(f,r)||p!="ready"&&p!="undefined"){g.unrender();continue}let _=g.render(t,h);_&&(_!==h&&(this.children_.push(_),h=_),l.push(f))}this.declutter(t,l),Hu(this.element_,this.children_);for(let c of a?this.children_:[]){let u=c.firstElementChild||c,f=c.style.backgroundColor;if(f&&(!te(u)||u.width>0)&&(a.fillStyle=f,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!te(u)||u.width===0)continue;a.save();let g=c.style.opacity||u.style.opacity;a.globalAlpha=g===""?1:Number(g);let p=u.style.transform;if(p)a.transform(...Rs(p));else{let _=parseFloat(u.style.width)/u.width,m=parseFloat(u.style.height)/u.height;a.transform(_,0,0,m,0,0)}a.drawImage(u,0,0),a.restore()}this.dispatchRenderEvent(Dt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){let r=e[i],s=r.layer;s.getDeclutter()&&s.renderDeclutter(t,r)}e.forEach(i=>i.layer.renderDeferred(t))}}},$d=$l;function Jd(n){if(n instanceof tn){n.setMapInternal(null);return}n instanceof Tr&&n.getLayers().forEach(Jd)}function Qd(n,t){if(n instanceof tn){n.setMapInternal(t);return}if(n instanceof Tr){let e=n.getLayers().getArray();for(let i=0,r=e.length;i<r;++i)Qd(e[i],t)}}var Jl=class extends xt{constructor(t){super(),t=t||{},this.on,this.once,this.un;let e=Em(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:Mh,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Lt(),this.pixelToCoordinateTransform_=Lt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,bt||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,bt||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(bt?new Pt:Fs()),this.interactions=e.interactions||(bt?new Pt:Ys({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new kh(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ot.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ot.VIEW,this.handleViewChanged_),this.addChangeListener(Ot.SIZE,this.handleSizeChanged_),this.addChangeListener(Ot.TARGET,this.handleTargetChanged_),this.setProperties(e.values);let i=this;t.view&&!(t.view instanceof Qt)&&t.view.then(function(r){i.setView(new Qt(r))}),this.controls.addEventListener(It.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(It.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(It.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(It.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(It.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(It.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Qd(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){let e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};let s=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:He,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,e,null,o,null)}getFeaturesAtPixel(t,e){let i=[];return this.forEachFeatureAtPixel(t,function(r){i.push(r)},e),i}getAllLayers(){let t=[];function e(i){i.forEach(function(r){r instanceof Tr?e(r.getLayers()):t.push(r)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;let i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};let r=e.layerFilter!==void 0?e.layerFilter:He,s=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,o,r,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){let i=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=i.width/r[0],o=i.height/r[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/s,(a.clientY-i.top)/o]}getTarget(){return this.get(Ot.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return _r(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){let e=this.frameState_;return e?dt(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){let e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Ot.LAYERGROUP)}setLayers(t){let e=this.getLayerGroup();if(t instanceof Pt){e.setLayers(t);return}let i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){let r=t[e];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){let e=xe(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){let e=this.frameState_;return e?dt(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Ot.SIZE)}getView(){return this.get(Ot.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,r){return Dh(this.frameState_,t,e,i,r)}handleBrowserEvent(t,e){e=e||t.type;let i=new Le(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;let e=t.originalEvent,i=e.type;if(i===cr.POINTERDOWN||i===P.WHEEL||i===P.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=e.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){let t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let r=this.maxTilesLoading_,s=r,o=t?t.viewHints:void 0,a=o?o[Rt.ANIMATING]||o[Rt.INTERACTING]:!1;if(a){let l=Date.now()-t.time>8;r=l?0:8,s=l?0:2}e.getTilesLoading()<r&&(a&&e.reprioritize(),e.loadMoreTiles(r,s))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Dt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Dt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new gi(Ae.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new gi(Ae.LOADSTART,this,t))));let i=this.postRenderFunctions_;if(t)for(let r=0,s=i.length;r<s;++r)i[r](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,r=this.targetChangeHandlerKeys_.length;i<r;++i)J(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(P.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(P.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!te(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}let t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(te(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new $d(this)),!te(e)){this.mapBrowserEventHandler_=new Ph(this,this.moveTolerance_);for(let r in at)this.mapBrowserEventHandler_.addEventListener(at[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(P.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(P.WHEEL,this.boundHandleBrowserEvent_,as?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{let r=e.getRootNode();i=r instanceof ShadowRoot?r.host:e}if(this.targetChangeHandlerKeys_=[K(i,P.KEYDOWN,this.handleBrowserEvent,this),K(i,P.KEYPRESS,this.handleBrowserEvent,this)],!te(e)){let r=e.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(e)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(J(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(J(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=K(t,ue.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=K(t,P.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(J),this.layerGroupPropertyListenerKeys_=null);let t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Ee("addlayer",t)),this.layerGroupPropertyListenerKeys_=[K(t,ue.PROPERTYCHANGE,this.render,this),K(t,P.CHANGE,this.render,this),K(t,"addlayer",this.handleLayerAdd_,this),K(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){let r=t[e].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Jd(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){let e=this.getSize(),i=this.getView(),r=this.frameState_,s=null;if(e!==void 0&&Il(e)&&i&&i.isDef()){let o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:pr(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Y(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=pr(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!ke(this.previousExtent_)&&!Zi(s.extent,this.previousExtent_))&&(this.dispatchEvent(new gi(Ae.MOVESTART,this,r)),this.previousExtent_=Ki(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Rt.ANIMATING]&&!s.viewHints[Rt.INTERACTING]&&!Zi(s.extent,this.previousExtent_)&&(this.dispatchEvent(new gi(Ae.MOVEEND,this,s)),us(s.extent,this.previousExtent_))),this.dispatchEvent(new gi(Ae.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Ae.LOADSTART)||this.hasListener(Ae.LOADEND)||this.hasListener(Dt.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){let e=this.getLayerGroup();e&&this.handleLayerRemove_(new Ee("removelayer",e)),this.set(Ot.LAYERGROUP,t)}setSize(t){this.set(Ot.SIZE,t)}setTarget(t){this.set(Ot.TARGET,t)}setView(t){if(!t||t instanceof Qt){this.set(Ot.VIEW,t);return}this.set(Ot.VIEW,new Qt);let e=this;t.then(function(i){e.setView(new Qt(i))})}updateSize(){let t=this.getTargetElement(),e;if(t){let r,s;if(te(t)){let o=t.getContext("2d").getTransform();r=t.width/o.a,s=t.height/o.d}else{let o=getComputedStyle(t);r=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(e=[Math.max(0,r),Math.max(0,s)],!Il(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&_s("No map visible because the map container's width or height are 0."))}let i=this.getSize();e&&(!i||!zt(e,i))&&(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){let e=this.getView();e&&e.setViewportSize(t)}};function Em(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);let e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Tr({layers:n.layers});e[Ot.LAYERGROUP]=i,e[Ot.TARGET]=n.target,e[Ot.VIEW]=n.view instanceof Qt?n.view:new Qt;let r;n.controls!==void 0&&(Array.isArray(n.controls)?r=new Pt(n.controls.slice()):(B(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=n.controls));let s;n.interactions!==void 0&&(Array.isArray(n.interactions)?s=new Pt(n.interactions.slice()):(B(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new Pt(n.overlays.slice()):(B(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new Pt,{controls:r,interactions:s,keyboardEventTarget:t,overlays:o,values:e}}var tf=Jl;var Ql=class n extends De{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){fe(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){let t=new n(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,r){if(r<pi(this.getExtent(),t,e))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let h=ge(t,e,s[a],s[a+1]);if(h<r){r=h;for(let c=0;c<o;++c)i[c]=s[a+c];i.length=o}}return r}getCoordinates(){return Fe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){let e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new wi(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){let t=this.flatCoordinates,e=this.layout,i=this.stride,r=[];for(let s=0,o=t.length;s<o;s+=i){let a=new wi(t.slice(s,s+i),e);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(t){let e=this.flatCoordinates,i=this.stride;for(let r=0,s=e.length;r<s;r+=i){let o=e[r],a=e[r+1];if(fr(t,o,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xr(this.flatCoordinates,0,t,this.stride),this.changed()}},ef=Ql;function go(n,t,e,i){let r=[],s=ut();for(let o=0,a=e.length;o<a;++o){let l=e[o];s=wn(n,t,l[0],i),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),t=l[l.length-1]}return r}var tc=class n extends De{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){let r=t,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let h=r[a],c=s.length,u=h.getEnds();for(let f=0,g=u.length;f<g;++f)u[f]+=c;fe(s,h.getFlatCoordinates()),o.push(u)}e=r.length===0?this.getLayout():r[0].getLayout(),t=s,i=o}e!==void 0&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();else{let i=this.flatCoordinates.length;fe(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let r=0,s=e.length;r<s;++r)e[r]+=i}this.endss_.push(e),this.changed()}clone(){let t=this.endss_.length,e=new Array(t);for(let r=0;r<t;++r)e[r]=this.endss_[r].slice();let i=new n(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,r){return r<pi(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Lu(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Au(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,r))}containsXY(t,e){return ku(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return Tu(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Na(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,yr(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let t=go(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Ls(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new ef(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;Xu(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Na(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let e=[],i=[];return e.length=Nu(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new n(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(t===0)e=0;else{let s=this.endss_[t-1];e=s[s.length-1]}let i=this.endss_[t].slice(),r=i[i.length-1];if(e!==0)for(let s=0,o=i.length;s<o;++s)i[s]-=e;return new Ci(this.flatCoordinates.slice(e,r),this.layout,i)}getPolygons(){let t=this.layout,e=this.flatCoordinates,i=this.endss_,r=[],s=0;for(let o=0,a=i.length;o<a;++o){let l=i[o].slice(),h=l[l.length-1];if(s!==0)for(let u=0,f=l.length;u<f;++u)l[u]-=s;let c=new Ci(e.slice(s,h),t,l);r.push(c),s=h}return r}getType(){return"MultiPolygon"}intersectsExtent(t){return Fu(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);let i=Pu(this.flatCoordinates,0,t,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{let r=i[i.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},nf=tc;var ec=class extends fi{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(P.CHANGE)}release(){this.setState(k.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==k.EMPTY){if(this.state!==k.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){H()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;let r=e-i+1e3/60;return r>=this.transition_?1:ca(r/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},Un=ec;function po(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}var wm=new Error("disposed");var Cm=[256,256],ic=class extends Un{constructor(t){let e=k.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;let t=po(this.data_);return t?[t.width,t.height]:Cm}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==k.IDLE&&this.state!==k.ERROR)return;this.state=k.LOADING,this.changed();let t=this;this.loader_().then(function(e){t.data_=e,t.state=k.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=k.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(wm),this.controller_=null),super.disposeInternal()}},nc=ic;var rc=class extends Un{constructor(t,e,i,r,s,o){super(t,e,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=i,this.key=i,this.image_,bt?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=k.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=k.ERROR,this.unlistenImage_(),this.image_=vm(),this.changed()}handleImageLoad_(){if(bt)this.state=k.LOADED;else{let t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=k.LOADED:this.state=k.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==k.ERROR&&(this.state=k.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==k.IDLE&&(this.state=k.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Td(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function vm(){let n=nt(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}var mo=rc;var _o=class{constructor(t,e,i,r){this.minX=t,this.maxX=e,this.minY=i,this.maxY=r}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}};function ln(n,t,e,i,r){return r!==void 0?(r.minX=n,r.maxX=t,r.minY=e,r.maxY=i,r):new _o(n,t,e,i)}var xo=_o;var sc,cn=[];function rf(n,t,e,i,r){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,r),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,r)),n.restore()}function oc(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function bm(){if(sc===void 0){let n=nt(6,6,cn);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",rf(n,4,5,4,0),rf(n,4,5,0,5);let t=n.getImageData(0,0,3,3).data;sc=oc(t,0)||oc(t,4)||oc(t,8),Ji(n),cn.push(n.canvas)}return sc}function sf(n,t,e,i){let r=Mn(e,t,n),s=wa(t,i,e),o=t.getMetersPerUnit();o!==void 0&&(s*=o);let a=n.getMetersPerUnit();a!==void 0&&(s/=a);let l=n.getExtent();if(!l||me(l,r)){let h=wa(n,s,r)/s;isFinite(h)&&h>0&&(s/=h)}return s}function of(n,t,e,i){let r=Bt(e),s=sf(n,t,r,i);return(!isFinite(s)||s<=0)&&gs(e,function(o){return s=sf(n,t,o,i),isFinite(s)&&s>0}),s}function af(n,t,e,i,r,s,o,a,l,h,c,u,f,g){let p=nt(Math.round(e*n),Math.round(e*t),cn);if(u||(p.imageSmoothingEnabled=!1),l.length===0)return p.canvas;p.scale(e,e);function _(w){return Math.round(w*e)/e}p.globalCompositeOperation="lighter";let m=ut();l.forEach(function(w,S,A){fs(m,w.extent)});let x,E=e/i,C=(u?1:1+Math.pow(2,-24))/E;if(!f||l.length!==1||h!==0){if(x=nt(Math.round(j(m)*E),Math.round(ct(m)*E),cn),u||(x.imageSmoothingEnabled=!1),r&&g){let w=(r[0]-m[0])*E,S=-(r[3]-m[3])*E,A=j(r)*E,R=ct(r)*E;x.rect(w,S,A,R),x.clip()}l.forEach(function(w,S,A){if(w.image.width>0&&w.image.height>0){if(w.clipExtent){x.save();let G=(w.clipExtent[0]-m[0])*E,F=-(w.clipExtent[3]-m[3])*E,V=j(w.clipExtent)*E,lt=ct(w.clipExtent)*E;x.rect(u?G:Math.round(G),u?F:Math.round(F),u?V:Math.round(G+V)-Math.round(G),u?lt:Math.round(F+lt)-Math.round(F)),x.clip()}let R=(w.extent[0]-m[0])*E,T=-(w.extent[3]-m[3])*E,I=j(w.extent)*E,z=ct(w.extent)*E;x.drawImage(w.image,h,h,w.image.width-2*h,w.image.height-2*h,u?R:Math.round(R),u?T:Math.round(T),u?I:Math.round(R+I)-Math.round(R),u?z:Math.round(T+z)-Math.round(T)),w.clipExtent&&x.restore()}})}let y=ae(o);return a.getTriangles().forEach(function(w,S,A){let R=w.source,T=w.target,I=R[0][0],z=R[0][1],G=R[1][0],F=R[1][1],V=R[2][0],lt=R[2][1],M=_((T[0][0]-y[0])/s),X=_(-(T[0][1]-y[1])/s),O=_((T[1][0]-y[0])/s),$=_(-(T[1][1]-y[1])/s),N=_((T[2][0]-y[0])/s),tt=_(-(T[2][1]-y[1])/s),it=I,wt=z;I=0,z=0,G-=it,F-=wt,V-=it,lt-=wt;let L=[[G,F,0,0,O-M],[V,lt,0,0,N-M],[0,0,G,F,$-X],[0,0,V,lt,tt-X]],$t=zh(L);if(!$t)return;if(p.save(),p.beginPath(),bm()||!u){p.moveTo(O,$);let ot=4,Re=M-O,Ni=X-$;for(let ne=0;ne<ot;ne++)p.lineTo(O+_((ne+1)*Re/ot),$+_(ne*Ni/(ot-1))),ne!=ot-1&&p.lineTo(O+_((ne+1)*Re/ot),$+_((ne+1)*Ni/(ot-1)));p.lineTo(N,tt)}else p.moveTo(O,$),p.lineTo(M,X),p.lineTo(N,tt);p.clip(),p.transform($t[0],$t[2],$t[1],$t[3],M,X),p.translate(m[0]-it,m[3]-wt);let Ct;if(x)Ct=x.canvas,p.scale(C,-C);else{let ot=l[0],Re=ot.extent;Ct=ot.image,p.scale(j(Re)/Ct.width,-ct(Re)/Ct.height)}p.drawImage(Ct,0,0),p.restore()}),x&&(Ji(x),cn.push(x.canvas)),c&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach(function(w,S,A){let R=w.target,T=(R[0][0]-y[0])/s,I=-(R[0][1]-y[1])/s,z=(R[1][0]-y[0])/s,G=-(R[1][1]-y[1])/s,F=(R[2][0]-y[0])/s,V=-(R[2][1]-y[1])/s;p.beginPath(),p.moveTo(z,G),p.lineTo(T,I),p.lineTo(F,V),p.closePath(),p.stroke()}),p.restore()),p.canvas}var Rm=10,lf=.25,ac=class{constructor(t,e,i,r,s,o,a){this.sourceProj_=t,this.targetProj_=e;let l={},h=a?pu(C=>dt(a,Mn(C,this.targetProj_,this.sourceProj_))):qi(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){let y=C[0]+"/"+C[1];return l[y]||(l[y]=h(C)),l[y]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&j(r)>=j(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?j(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?j(this.targetProj_.getExtent()):null;let c=ae(i),u=bn(i),f=vn(i),g=Cn(i),p=this.transformInv_(c),_=this.transformInv_(u),m=this.transformInv_(f),x=this.transformInv_(g),E=Rm+(o?Math.max(0,Math.ceil(Math.log2(gr(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,f,g,p,_,m,x,E),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(y,w,S){C=Math.min(C,y.source[0][0],y.source[1][0],y.source[2][0])}),this.triangles_.forEach(y=>{if(Math.max(y.source[0][0],y.source[1][0],y.source[2][0])-C>this.sourceWorldWidth_/2){let w=[[y.source[0][0],y.source[0][1]],[y.source[1][0],y.source[1][1]],[y.source[2][0],y.source[2][1]]];w[0][0]-C>this.sourceWorldWidth_/2&&(w[0][0]-=this.sourceWorldWidth_),w[1][0]-C>this.sourceWorldWidth_/2&&(w[1][0]-=this.sourceWorldWidth_),w[2][0]-C>this.sourceWorldWidth_/2&&(w[2][0]-=this.sourceWorldWidth_);let S=Math.min(w[0][0],w[1][0],w[2][0]);Math.max(w[0][0],w[1][0],w[2][0])-S<this.sourceWorldWidth_/2&&(y.source=w)}})}l={}}addTriangle_(t,e,i,r,s,o){this.triangles_.push({source:[r,s,o],target:[t,e,i]})}addQuad_(t,e,i,r,s,o,a,l,h){let c=ra([s,o,a,l]),u=this.sourceWorldWidth_?j(c)/this.sourceWorldWidth_:null,f=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&u>.5&&u<1,p=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let m=ra([t,e,i,r]);p=j(m)/this.targetWorldWidth_>lf||p}!g&&this.sourceProj_.isGlobal()&&u&&(p=u>lf||p)}if(!p&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!ht(c,this.maxSourceExtent_))return;let _=0;if(!p&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)p=!0;else if(_=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(h>0){if(!p){let m=[(t[0]+i[0])/2,(t[1]+i[1])/2],x=this.transformInv_(m),E;g?E=(Me(s[0],f)+Me(a[0],f))/2-Me(x[0],f):E=(s[0]+a[0])/2-x[0];let C=(s[1]+a[1])/2-x[1];p=E*E+C*C>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){let m=[(e[0]+i[0])/2,(e[1]+i[1])/2],x=this.transformInv_(m),E=[(r[0]+t[0])/2,(r[1]+t[1])/2],C=this.transformInv_(E);this.addQuad_(t,e,m,E,s,o,x,C,h-1),this.addQuad_(E,m,i,r,C,x,a,l,h-1)}else{let m=[(t[0]+e[0])/2,(t[1]+e[1])/2],x=this.transformInv_(m),E=[(i[0]+r[0])/2,(i[1]+r[1])/2],C=this.transformInv_(E);this.addQuad_(t,m,E,r,s,x,C,l,h-1),this.addQuad_(m,e,i,E,x,o,a,C,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(t,i,r,s,a,l),(_&14)==0&&this.addTriangle_(t,i,e,s,a,o),_&&((_&13)==0&&this.addTriangle_(e,r,t,o,l,s),(_&7)==0&&this.addTriangle_(e,r,i,o,l,a))}calculateSourceExtent(){let t=ut();return this.triangles_.forEach(function(e,i,r){let s=e.source;Bi(t,s[0]),Bi(t,s[1]),Bi(t,s[2])}),t}getTriangles(){return this.triangles_}},cf=ac;var lc=class extends Un{constructor(t,e,i,r,s,o,a,l,h,c,u,f){super(s,k.IDLE,f),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;let g=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent(),_=this.sourceTileGrid_.getExtent(),m=p?Oe(g,p):g;if(gr(m)===0){this.state=k.EMPTY;return}let x=t.getExtent();x&&(_?_=Oe(_,x):_=x);let E=r.getResolution(this.wrappedTileCoord_[0]),C=of(t,i,m,E);if(!isFinite(C)||C<=0){this.state=k.EMPTY;return}let y=c!==void 0?c:.5;if(this.triangulation_=new cf(t,i,m,_,C*y,E),this.triangulation_.getTriangles().length===0){this.state=k.EMPTY;return}this.sourceZ_=e.getZForResolution(C);let w=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(w[1]=et(w[1],_[1],_[3]),w[3]=et(w[3],_[1],_[3])):w=Oe(w,_)),!gr(w))this.state=k.EMPTY;else{let S=0,A=0;t.canWrapX()&&(S=j(x),A=Math.floor((w[0]-x[0])/S)),ps(w.slice(),t,!0).forEach(T=>{let I=e.getTileRangeForExtentAndZ(T,this.sourceZ_);for(let z=I.minX;z<=I.maxX;z++)for(let G=I.minY;G<=I.maxY;G++){let F=A*S;this.sourceTiles_.push({getTile:()=>h(this.sourceZ_,z,G,a),offset:F})}++A}),this.sourceTiles_.length===0&&(this.state=k.EMPTY)}}getImage(){return this.canvas_}reproject_(){let t=[];if(this.sourceTiles_.forEach(e=>{let i=e.tile;if(i&&i.getState()==k.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);r[0]+=e.offset,r[2]+=e.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=e.offset,s[2]+=e.offset),t.push({extent:r,clipExtent:s,image:i.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=k.ERROR;else{let e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),r=typeof i=="number"?i:i[0],s=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=af(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=k.LOADED}this.changed()}load(){for(let t of this.sourceTiles_)t.tile=t.getTile();if(this.state==k.IDLE){this.state=k.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{let i=e.getState();if(i==k.IDLE||i==k.LOADING){t++;let r=K(e,P.CHANGE,s=>{let o=e.getState();(o==k.LOADED||o==k.ERROR||o==k.EMPTY)&&(J(r),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},i,r){e.getState()==k.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(J),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Ji(this.canvas_.getContext("2d")),cn.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},yo=lc;var cc=class{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let t=this.pop();t instanceof di&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){let i=this.entries_[t];return B(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){let e=this.entries_[t];return B(e!==void 0,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){let t=new Array(this.count_),e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){let t=new Array(this.count_),e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){let t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){B(!(t in this.entries_),"Tried to set a value for a key that is used already");let i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}},hc=cc;function Kn(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function Sm(n,t,e){return n+"/"+t+"/"+e}function Zn(n,t,e,i,r){return`${Y(n)},${t},${Sm(e,i,r)}`}function hf(n){return Tm(n[0],n[1],n[2])}function Tm(n,t,e){return(t<<n)+e}function uf(n,t){let e=n[0],i=n[1],r=n[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;let s=t.getFullTileRange(e);return s?s.containsXY(i,r):!0}var uc=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Rr(),{get:(t,e)=>{if(typeof t[e]=="function")return this.pendingMethod_=e,this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){let e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>{this.push_(this.pendingMethod_,t)};pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,r=e.length;i<r;++i){let s=e[i];if(typeof s=="function"){s(t);continue}let o=e[++i];typeof t[s]=="function"?t[s](...o):typeof o=="function"?t[s]=o(t):t[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},Eo=uc;var Im=5,dc=class extends ss{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=Im,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(t){this.renderedSourceKey_?this.renderedSourceKey_!==t&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=t):this.renderedSourceKey_=t}getFeatures(t){return H()}getData(t){return null}prepareFrame(t){return H()}renderFrame(t,e){return H()}forEachFeatureAtCoordinate(t,e,i,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){let e=t.target;(e.getState()===W.LOADED||e.getState()===W.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=W.LOADED&&e!=W.ERROR&&t.addEventListener(P.CHANGE,this.boundHandleImageChange_),e==W.IDLE&&(t.load(),e=t.getState()),e==W.LOADED}renderIfReadyAndVisible(){let t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},df=dc;var gc=[],Bn=null;function Lm(){Bn=nt(1,1,void 0,{willReadFrequently:!0})}var fc=class extends df{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Lt(),this.pixelTransform=Lt(),this.inversePixelTransform=Lt(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){Bn||Lm(),Bn.clearRect(0,0,1,1);let r;try{Bn.drawImage(t,e,i,1,1,0,0,1,1),r=Bn.getImageData(0,0,1,1).data}catch{return Bn=null,null}return r}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i,r,s){if(te(t)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&t.width===r&&t.height===s){let h=t,c=h.getContext("2d");if(c){this.container=t,this.context=c,this.containerReused=!0,i&&(c.fillStyle=i,c.fillRect(0,0,h.width,h.height));return}}let o=this.getLayer().getClassName(),a,l;if(t&&t.className===o&&(!i||t&&t.style.backgroundColor&&zt(he(t.style.backgroundColor),he(i)))){let h=t.firstElementChild;te(h)&&(l=h.getContext("2d"))}if(l&&Eu(l.canvas.style.transform,e)?(this.container=t,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=bt?Ds():document.createElement("div"),a.className=o;let h=a.style;h.position="absolute",h.width="100%",h.height="100%",l=nt();let c=l.canvas;a.appendChild(c),h=c.style,h.position="absolute",h.left="0",h.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){let r=ae(i),s=bn(i),o=vn(i),a=Cn(i);dt(e.coordinateToPixelTransform,r),dt(e.coordinateToPixelTransform,s),dt(e.coordinateToPixelTransform,o),dt(e.coordinateToPixelTransform,a);let l=this.inversePixelTransform;dt(l,r),dt(l,s),dt(l,o),dt(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){let i=t.extent,r=t.viewState.resolution,s=t.viewState.rotation,o=t.pixelRatio,a=Math.round(j(i)/r*o),l=Math.round(ct(i)/r*o);kt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,s,-a/2,-l/2),Ss(this.inversePixelTransform,this.pixelTransform);let h=yu(this.pixelTransform),c=this.getBackground(t);if(this.useContainer(e,h,c,a,l),!this.containerReused){let u=this.context.canvas;u.width!=a||u.height!=l?(u.width=a,u.height=l):this.context.clearRect(0,0,a,l),h!==u.style.transform&&(u.style.transform=h)}}dispatchRenderEvent_(t,e,i){let r=this.getLayer();if(r.hasListener(t)){let s=new fo(t,this.inversePixelTransform,i,e);r.dispatchEvent(s)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Dt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Dt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Eo),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Dt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Dt.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,r,s,o,a){let l=s/2,h=o/2,c=r/e,u=-c,f=-t[0]+a,g=-t[1];return kt(this.tempTransform,l,h,c,u,-i,f,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}},wo=fc;function pc(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;let i=n[e],r=i.has(t);return r||i.add(t),!r}function Am(n,t,e){let i=n[e];return i?i.delete(t):!1}function ff(n,t){let e=n.layerStatesArray[n.layerIndex];e.extent&&(t=Oe(t,ye(e.extent,n.viewState.projection)));let i=e.layer.getRenderSource();if(!i.getWrapX()){let r=i.getTileGridForProjection(n.viewState.projection).getExtent();r&&(t=Oe(t,r))}return t}var mc=class extends wo{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=ut(),this.tempTileRange_=new xo(0,0,0,0),this.tempTileCoord_=Kn(0,0,0);let i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new hc(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new hc(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=Zn(a,a.getKey(),t,e,i),h;if(s.containsKey(l))h=s.get(l);else{let c=r.viewState.projection,u=a.getProjection();if(h=a.getTile(t,e,i,r.pixelRatio,c,!u||An(u,c)?void 0:this.getSourceTileCache()),!h)return null;s.set(l,h)}return h}getTile(t,e,i,r){let s=this.getOrCreateTile(t,e,i,r);return s||null}getData(t){let e=this.frameState;if(!e)return null;let i=this.getLayer(),r=dt(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!me(s,r))return null;let o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){let u=l.getTileCoordForCoordAndZ(r,c),f=this.getTile(c,u[1],u[2],e);if(!f||f.getState()!==k.LOADED)continue;let g=l.getOrigin(c),p=pt(l.getTileSize(c)),_=l.getResolution(c),m;if(f instanceof mo||f instanceof yo)m=f.getImage();else if(f instanceof nc){if(m=po(f.getData()),!m)continue}else continue;let x=Math.floor(h*((r[0]-g[0])/_-u[1]*p[0])),E=Math.floor(h*((g[1]-r[1])/_-u[2]*p[1])),C=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(m,x+C,E+C)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;let e=this.getLayer().getSource();if(!e)return!1;let i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,r,s){let o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=Y(l);c in t.wantedTiles||(t.wantedTiles[c]={});let u=t.wantedTiles[c],f=a.getMapInternal(),g=Math.max(i-s,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),f?f.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),p=o.rotation,_=p?oa(o.center,o.resolution,p,t.size):void 0;for(let m=i;m>=g;--m){let x=h.getTileRangeForExtentAndZ(e,m,this.tempTileRange_),E=h.getResolution(m);for(let C=x.minX;C<=x.maxX;++C)for(let y=x.minY;y<=x.maxY;++y){if(p&&!h.tileCoordIntersectsViewport([m,C,y],_))continue;let w=this.getTile(m,C,y,t);if(!w||!pc(r,w,m))continue;let A=w.getKey();if(u[A]=!0,w.getState()===k.IDLE&&!t.tileQueue.isKeyQueued(A)){let R=Kn(m,C,y,this.tempTileCoord_);t.tileQueue.enqueue([w,c,h.getTileCoordCenter(R),E])}}}}findStaleTile_(t,e){let i=this.tileCache_,r=t[0],s=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let h=Zn(this.getLayer().getSource(),a[l],r,s,o);if(i.containsKey(h)){let c=i.peek(h);if(c.getState()===k.LOADED)return c.endTransition(Y(this)),pc(e,c,r),!0}}return!1}findAltTiles_(t,e,i,r){let s=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),h=l.getKey();for(let c=s.minX;c<=s.maxX;++c)for(let u=s.minY;u<=s.maxY;++u){let f=Zn(l,h,i,c,u),g=!1;if(a.containsKey(f)){let p=a.peek(f);p.getState()===k.LOADED&&(pc(r,p,i),g=!0)}g||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;let i=t.layerStatesArray[t.layerIndex],r=t.viewState,s=r.projection,o=r.resolution,a=r.center,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),u=c.getTileGridForProjection(s),f=u.getZForResolution(o,c.zDirection),g=u.getResolution(f);this.updateStaleKeys(c.getKey());let p=t.extent,_=c.getTilePixelRatio(l);this.prepareContainer(t,e);let m=this.context.canvas.width,x=this.context.canvas.height;this.layerExtent=i.extent?ye(i.extent,s):null,this.layerExtent&&(p=Oe(p,this.layerExtent));let E=g*m/2/_,C=g*x/2/_,y=[a[0]-E,a[1]-C,a[0]+E,a[1]+C],w={};this.renderedTiles.length=0;let S=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){let M=u.getZForResolution(r.nextResolution,c.zDirection),X=ff(t,t.nextExtent);this.enqueueTiles(t,X,M,w,S)}let A=ff(t,p);if(this.enqueueTiles(t,A,f,w,0),S>0&&setTimeout(()=>{this.enqueueTiles(t,A,f-1,w,S-1)},0),!(f in w))return this.container;let R=Y(this),T=t.time;for(let M of w[f]){let X=M.getState();if(X===k.EMPTY)continue;let O=M.tileCoord;if(X===k.LOADED&&M.getAlpha(R,T)===1){M.endTransition(R);continue}if(X!==k.ERROR&&(this.renderComplete=!1),this.findStaleTile_(O,w)){Am(w,M,f),t.animate=!0;continue}if(this.findAltTiles_(u,O,f+1,w))continue;let tt=u.getMinZoom();for(let it=f-1;it>=tt&&!this.findAltTiles_(u,O,it,w);--it);}let I=g/o*l/_,z=this.getRenderContext(t);kt(this.tempTransform,m/2,x/2,I,I,0,-m/2,-x/2),this.layerExtent&&this.clipUnrotated(z,t,this.layerExtent),c.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,t);let G=Object.keys(w).map(Number);G.sort(Zt);let F=[],V=[],lt=[];for(let M=G.length-1;M>=0;--M){let X=G[M],O=c.getTilePixelSize(X,l,s),N=u.getResolution(X)/g,tt=O[0]*N*I,it=O[1]*N*I,wt=u.getTileCoordForCoordAndZ(ae(y),X),L=u.getTileCoordExtent(wt),$t=dt(this.tempTransform,[_*(L[0]-y[0])/g,_*(y[3]-L[3])/g]),Ct=_*c.getGutterForProjection(s);for(let ot of w[X]){if(ot.getState()!==k.LOADED)continue;let Re=ot.tileCoord,Ni=wt[1]-Re[1],ne=Math.round($t[0]-(Ni-1)*tt),Qn=wt[2]-Re[2],Jr=Math.round($t[1]-(Qn-1)*it),Gi=Math.round($t[0]-Ni*tt),Xi=Math.round($t[1]-Qn*it),gn=ne-Gi,Ze=Jr-Xi,pn=X===f;if(pn&&ot.inTransition(R)){lt.push({tile:ot,x:Gi,y:Xi,w:gn,h:Ze,gutter:Ct}),this.renderedTiles.unshift(ot),this.updateUsedTiles(t.usedTiles,c,ot);continue}let tr=[Gi,Xi,Gi+gn,Xi+Ze],er=[];for(let ui=0,ir=F.length;ui<ir;++ui)X<V[ui]&&ht(tr,F[ui])&&er.push(F[ui]);let Qr;er.length>0&&(Qr=Uh(tr,er)),F.push(tr),V.push(X),this.drawTile(ot,t,Gi,Xi,gn,Ze,Ct,pn,Qr),this.renderedTiles.unshift(ot),this.updateUsedTiles(t.usedTiles,c,ot)}}for(let M=0,X=lt.length;M<X;++M){let{tile:O,x:$,y:N,w:tt,h:it,gutter:wt}=lt[M];this.drawTile(O,t,$,N,tt,it,wt,!0,void 0)}if(this.renderedResolution=g,this.extentChanged=!this.renderedExtent_||!Zi(this.renderedExtent_,y),this.renderedExtent_=y,this.renderedPixelRatio=l,this.postRender(this.context,t),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let M=(X,O)=>{let $=Y(c),N=O.wantedTiles[$],tt=N?Object.keys(N).length:0;this.updateCacheSize(tt),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(M)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,i,r,s,o,a,l,h){let c;if(t instanceof nc){if(c=po(t.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(t);if(!c)return;let u=this.getRenderContext(e),f=Y(this),g=e.layerStatesArray[e.layerIndex],p=g.opacity*(l?t.getAlpha(f,e.time):1),_=p!==u.globalAlpha;_&&(u.save(),u.globalAlpha=p);let m=c.width-2*a,x=c.height-2*a;if(h){let E=m/s,C=x/o;for(let y=0,w=h.length;y<w;++y){let S=h[y],A=S[0],R=S[1],T=S[2]-S[0],I=S[3]-S[1];u.drawImage(c,a+(A-i)*E,a+(R-r)*C,T*E,I*C,A,R,T,I)}}else u.drawImage(c,a,a,m,x,i,r,s,o);_&&u.restore(),p!==g.opacity?e.animate=!0:l&&t.endTransition(f)}getImage(){let t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){let r=Y(e);r in t||(t[r]={}),t[r][i.getKey()]=!0}},gf=mc;var Ur={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var _c=class extends tn{constructor(t){t=t||{};let e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Ur.PRELOAD)}setPreload(t){this.set(Ur.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Ur.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Ur.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}},pf=_c;var xc=class extends pf{constructor(t){super(t)}createRenderer(){return new gf(this,{cacheSize:this.getCacheSize()})}},yc=xc;var Ec=class{drawCustom(t,e,i,r,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},Co=Ec;var Kr={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Zr=[Kr.FILL],We=[Kr.STROKE],li=[Kr.BEGIN_PATH],wc=[Kr.CLOSE_PATH],D=Kr;var Cc=class extends Co{constructor(t,e,i,r){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){let e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){let i=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=t.length;a<l;a+=e)r[0]=t[a],r[1]=t[a+1],me(i,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(t,e,i,r,s,o){let a=this.coordinates,l=a.length,h=this.getBufferedMaxExtent();o&&(e+=r);let c=t[e],u=t[e+1],f=this.tmpCoordinate_,g=!0,p,_,m;for(p=e+r;p<i;p+=r)f[0]=t[p],f[1]=t[p+1],m=hs(h,f),m!==_?(g&&(a[l++]=c,a[l++]=u,g=!1),a[l++]=f[0],a[l++]=f[1]):m===yt.INTERSECTING?(a[l++]=f[0],a[l++]=f[1],g=!1):g=!0,c=f[0],u=f[1],_=m;return(s&&g||p===e+r)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,r,s){for(let o=0,a=i.length;o<a;++o){let l=i[o],h=this.appendFlatLineCoordinates(t,e,l,r,!1,!1);s.push(h),e=l}return e}drawCustom(t,e,i,r,s){this.beginGeometry(t,e,s);let o=t.getType(),a=t.getStride(),l=this.coordinates.length,h,c,u,f,g;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),f=[];let p=t.getEndss();g=0;for(let _=0,m=p.length;_<m;++_){let x=[];g=this.drawCustomCoordinates_(h,g,p[_],a,x),f.push(x)}this.instructions.push([D.CUSTOM,l,f,t,i,yr,s]),this.hitDetectionInstructions.push([D.CUSTOM,l,f,t,r||i,yr,s]);break;case"Polygon":case"MultiLineString":u=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),g=this.drawCustomCoordinates_(h,0,t.getEnds(),a,u),this.instructions.push([D.CUSTOM,l,u,t,i,Pn,s]),this.hitDetectionInstructions.push([D.CUSTOM,l,u,t,r||i,Pn,s]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([D.CUSTOM,l,c,t,i,Fe,s]),this.hitDetectionInstructions.push([D.CUSTOM,l,c,t,r||i,Fe,s]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([D.CUSTOM,l,c,t,i,Fe,s]),this.hitDetectionInstructions.push([D.CUSTOM,l,c,t,r||i,Fe,s]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([D.CUSTOM,l,c,t,i,void 0,s]),this.hitDetectionInstructions.push([D.CUSTOM,l,c,t,r||i,void 0,s]);break;default:}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[D.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[D.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let t=this.hitDetectionInstructions;t.reverse();let e,i=t.length,r,s,o=-1;for(e=0;e<i;++e)r=t[e],s=r[0],s==D.END_GEOMETRY?o=e:s==D.BEGIN_GEOMETRY&&(r[2]=e,Sh(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){let i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=jt(i||St)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){let i=t.getColor();e.strokeStyle=jt(i||Yt);let r=t.getLineCap();e.lineCap=r!==void 0?r:Ge;let s=t.getLineDash();e.lineDash=s?s.slice():Ht;let o=t.getLineDashOffset();e.lineDashOffset=o||qt;let a=t.getLineJoin();e.lineJoin=a!==void 0?a:Xe;let l=t.getWidth();e.lineWidth=l!==void 0?l:ri;let h=t.getMiterLimit();e.miterLimit=h!==void 0?h:ii;let c=t.getOffset();e.strokeOffset=c??Md,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){let i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){let e=t.fillStyle,i=[D.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[D.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){let i=t.fillStyle;(i!==void 0&&typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){let i=t.strokeStyle,r=t.lineCap,s=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit,c=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=r||s!=t.currentLineDash&&!zt(t.currentLineDash,s)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h||t.currentStrokeOffset!=c)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=r,t.currentLineDash=s,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h,t.currentStrokeOffset=c)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let e=[D.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=us(this.maxExtent),this.maxLineWidth>0)){let t=this.resolution*(this.maxLineWidth+1)/2;En(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Ye=Cc;var vc=class extends Ye{constructor(t,e,i,r){super(t,e,i,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!me(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);let r=t.getFlatCoordinates(),s=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([D.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([D.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);let r=t.getFlatCoordinates(),s=[];for(let l=0,h=r.length;l<h;l+=t.getStride())(!this.maxExtent||me(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([D.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([D.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){let i=t.getAnchor(),r=t.getSize(),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=r[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},mf=vc;var bc=class extends Ye{constructor(t,e,i,r){super(t,e,i,r)}drawFlatCoordinates_(t,e,i,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,i,r,!1,!1);return this.instructions.push([D.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([D.MOVE_TO_LINE_TO,o,a,s]),i}drawLineString(t,e,i){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([D.SET_STROKE_STYLE,Yt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ht,qt],li);let l=t.getFlatCoordinates(),h=t.getStride();this.drawFlatCoordinates_(l,0,l.length,h,a),this.hitDetectionInstructions.push(We),this.endGeometry(e)}drawMultiLineString(t,e,i){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([D.SET_STROKE_STYLE,Yt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ht,qt],li);let l=t.getEnds(),h=t.getFlatCoordinates(),c=t.getStride(),u=0;for(let f=0,g=l.length;f<g;++f)u=this.drawFlatCoordinates_(h,u,l[f],c,a);this.hitDetectionInstructions.push(We),this.endGeometry(e)}finish(){let t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(We),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(We),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(li)}},_f=bc;var Rc=class extends Ye{constructor(t,e,i,r){super(t,e,i,r)}drawFlatCoordinatess_(t,e,i,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,h=i.length;this.instructions.push(li),this.hitDetectionInstructions.push(li);for(let c=0;c<h;++c){let u=i[c],f=this.coordinates.length,g=this.appendFlatLineCoordinates(t,e,u,r,!0,!l);this.instructions.push([D.MOVE_TO_LINE_TO,f,g,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([D.MOVE_TO_LINE_TO,f,g,s,!0]),l&&(this.instructions.push(wc),this.hitDetectionInstructions.push(wc)),e=u}return a&&(this.instructions.push(Zr),this.hitDetectionInstructions.push(Zr)),l&&(this.instructions.push(We),this.hitDetectionInstructions.push(We)),e}drawCircle(t,e,i){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_FILL_STYLE,St]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_STROKE_STYLE,Yt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ht,qt]);let l=t.getFlatCoordinates(),h=t.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,h,!1,!1);let u=[D.CIRCLE,c,a];this.instructions.push(li,u),this.hitDetectionInstructions.push(li,u),r.fillStyle!==void 0&&(this.instructions.push(Zr),this.hitDetectionInstructions.push(Zr)),r.strokeStyle!==void 0&&(this.instructions.push(We),this.hitDetectionInstructions.push(We)),this.endGeometry(e)}drawPolygon(t,e,i){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_FILL_STYLE,St]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_STROKE_STYLE,Yt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ht,qt]);let l=t.getEnds(),h=t.getOrientedFlatCoordinates(),c=t.getStride();this.drawFlatCoordinatess_(h,0,l,c,a),this.endGeometry(e)}drawMultiPolygon(t,e,i){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_FILL_STYLE,St]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([D.SET_STROKE_STYLE,Yt,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ht,qt]);let l=t.getEndss(),h=t.getOrientedFlatCoordinates(),c=t.getStride(),u=0;for(let f=0,g=l.length;f<g;++f)u=this.drawFlatCoordinatess_(h,u,l[f],c,a);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let t=this.tolerance;if(t!==0){let e=this.coordinates;for(let i=0,r=e.length;i<r;++i)e[i]=Ei(e[i],t)}return super.finish()}setFillStrokeStyles_(){let t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){let e=this.state,i=e.fillStyle,r=e.strokeStyle,s=e.strokeOffset;return Math.abs(s)>0&&i!==void 0&&r!==void 0?(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=r,e.strokeOffset=s,t(),e.fillStyle=i,!0):!1}},Sc=Rc;var Tc=0,Ic=1;function Mm(n,t,e,i,r,s,o,a){let l=o-r,h=a-s,c=0,u=1;if(l===0){if(r<n||r>e)return!1}else{let f=(n-r)/l,g=(e-r)/l;if(f>g){let p=f;f=g,g=p}if(f>c&&(c=f),g<u&&(u=g),c>u)return!1}if(h===0){if(s<t||s>i)return!1}else{let f=(t-s)/h,g=(i-s)/h;if(f>g){let p=f;f=g,g=p}if(f>c&&(c=f),g<u&&(u=g),c>u)return!1}return Tc=c,Ic=u,!0}function xf(n,t,e,i){let r=i[0],s=i[1],o=i[2],a=i[3],l=[],h=[],c=!1,u,f,g=0;for(let p=0,_=t.length;p<_;++p){let m=t[p],x=n[g],E=n[g+1],C=!1;for(let y=g+e;y<m;y+=e){let w=n[y],S=n[y+1];if(Mm(r,s,o,a,x,E,w,S)){let A=w-x,R=S-E,T=x+Tc*A,I=E+Tc*R,z=x+Ic*A,G=E+Ic*R;c&&C&&T===u&&I===f?l.push(z,G):(c&&h.push(l.length),l.push(T,I,z,G),c=!0),u=z,f=G,C=!0}x=w,E=S}g=m}return c&&h.push(l.length),{flatCoordinates:l,ends:h}}function yf(n,t,e,i,r){let s=[],o=e,a=0,l=t.slice(e,2);for(;a<n&&o+r<i;){let[h,c]=l.slice(-2),u=t[o+r],f=t[o+r+1],g=Math.sqrt((u-h)*(u-h)+(f-c)*(f-c));if(a+=g,a>=n){let p=(n-a+g)/g,_=Nt(h,u,p),m=Nt(c,f,p);l.push(_,m),s.push(l),l=[_,m],a==n&&(o+=r),a=0}else if(a<n)l.push(t[o+r],t[o+r+1]),o+=r;else{let p=g-a,_=Nt(h,u,p/g),m=Nt(c,f,p/g);l.push(_,m),s.push(l),l=[_,m],a=0,o+=r}}return a>0&&s.push(l),s}function Ef(n,t,e,i,r){let s=e,o=e,a=0,l=0,h=e,c,u,f,g,p,_,m,x,E,C;for(u=e;u<i;u+=r){let y=t[u],w=t[u+1];p!==void 0&&(E=y-p,C=w-_,g=Math.sqrt(E*E+C*C),m!==void 0&&(l+=f,c=Math.acos((m*E+x*C)/(f*g)),c>n&&(l>a&&(a=l,s=h,o=u),l=0,h=u-r)),f=g,m=E,x=C),p=y,_=w}return l+=g,l>a?[h,u]:[s,o]}var Br={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Lc=class extends Ye{constructor(t,e,i,r){super(t,e,i,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[St]={fillStyle:St},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,h=t.getType(),c=null,u=t.getStride();if(o.placement==="line"&&(h=="LineString"||h=="MultiLineString"||h=="Polygon"||h=="MultiPolygon")){let f=t.getExtent();if(!ht(this.maxExtent,f))return;let g;if(c=t.getFlatCoordinates(),h=="LineString")g=[c.length];else if(h=="MultiLineString")g=t.getEnds();else if(h=="Polygon")g=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){let x=t.getEndss();g=[];for(let E=0,C=x.length;E<C;++E)g.push(x[E][0])}if((h=="LineString"||h=="MultiLineString")&&!Pe(this.getBufferedMaxExtent(),f)){let x=xf(c,g,u,this.getBufferedMaxExtent());if(c=x.flatCoordinates,g=x.ends,u=2,g.length===0)return}this.beginGeometry(t,e,i);let p=o.repeat,_=p?void 0:o.textAlign,m=0;for(let x=0,E=g.length;x<E;++x){let C;p?C=yf(p*this.resolution,c,m,g[x],u):C=[c.slice(m,g[x])];for(let y=0,w=C.length;y<w;++y){let S=C[y],A=0,R=S.length;if(_==null){let I=Ef(o.maxAngle,S,0,S.length,2);A=I[0],R=I[1]}for(let I=A;I<R;I+=u)a.push(S[I],S[I+1]);let T=a.length;m=g[x],this.drawChars_(l,T),l=T}}this.endGeometry(e)}else{let f=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||f.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":let y=t.getFlatInteriorPoints();c=[];for(let w=0,S=y.length;w<S;w+=3)o.overflow||f.push(y[w+2]/this.resolution),c.push(y[w],y[w+1]);if(c.length===0)return;u=2;break;default:}let g=this.appendFlatPointCoordinates(c,u);if(g===l)return;if(f&&(g-l)/2!==c.length/u){let y=l/2;f=f.filter((w,S)=>{let A=a[(y+S)*2]===c[S*u]&&a[(y+S)*2+1]===c[S*u+1];return A||--y,A})}this.saveTextStates_();let p=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,_=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let m=o.padding;if(m!=ni&&(o.scale[0]<0||o.scale[1]<0)){let y=o.padding[0],w=o.padding[1],S=o.padding[2],A=o.padding[3];o.scale[0]<0&&(w=-w,A=-A),o.scale[1]<0&&(y=-y,S=-S),m=[y,w,S,A]}let x=this.pixelRatio;this.instructions.push([D.DRAW_IMAGE,l,g,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,m==ni?ni:m.map(function(y){return y*x}),p,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,f]);let E=1/x,C=p?p.slice(0):null;C&&(C[1]=St),this.hitDetectionInstructions.push([D.DRAW_IMAGE,l,g,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[E,E],NaN,this.declutterMode_,this.declutterImageWithText_,m,C,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?St:this.fillKey_,this.textOffsetX_,this.textOffsetY_,f]),this.endGeometry(e)}}saveTextStates_(){let t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,r=this.strokeKey_;t&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||Ii,justify:e.justify,textBaseline:e.textBaseline||on,scale:e.scale});let o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){let i=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,h=Br[r.textBaseline],c=this.textOffsetX_*l,u=this.textOffsetY_*l,f=this.text_,g=i?i.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([D.DRAW_CHARS,t,e,h,r.overflow,a,r.maxAngle,l,u,s,g*l,f,o,1,this.declutterMode_,this.textKeepUpright_,c]),this.hitDetectionInstructions.push([D.DRAW_CHARS,t,e,h,r.overflow,a&&St,r.maxAngle,l,u,s,g*l,f,o,1/l,this.declutterMode_,this.textKeepUpright_,c])}setTextStyle(t,e){let i,r,s;if(!t)this.text_="";else{let o=t.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=jt(o.getColor()||St)):(r=null,this.textFillState_=r);let a=t.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let _=a.getLineDash(),m=a.getLineDashOffset(),x=a.getWidth(),E=a.getMiterLimit();s.lineCap=a.getLineCap()||Ge,s.lineDash=_?_.slice():Ht,s.lineDashOffset=m===void 0?qt:m,s.lineJoin=a.getLineJoin()||Xe,s.lineWidth=x===void 0?ri:x,s.miterLimit=E===void 0?ii:E,s.strokeStyle=jt(a.getColor()||Yt)}i=this.textState_;let l=t.getFont()||io;Pd(l);let h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||on,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||ni,i.scale=h===void 0?[1,1]:h;let c=t.getOffsetX(),u=t.getOffsetY(),f=t.getRotateWithView(),g=t.getKeepUpright(),p=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=f===void 0?!1:f,this.textKeepUpright_=g===void 0?!0:g,this.textRotation_=p===void 0?0:p,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Y(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Y(r.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},wf=Lc;var Pm={Circle:Sc,Default:Ye,Image:mf,LineString:_f,Polygon:Sc,Text:wf},Ac=class{constructor(t,e,i,r){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=r,this.resolution_=i,this.buildersByZIndex_={}}finish(){let t={};for(let e in this.buildersByZIndex_){t[e]=t[e]||{};let i=this.buildersByZIndex_[e];for(let r in i){let s=i[r].finish();t[e][r]=s}}return t}getBuilder(t,e){let i=t!==void 0?t.toString():"0",r=this.buildersByZIndex_[i];r===void 0&&(r={},this.buildersByZIndex_[i]=r);let s=r[e];if(s===void 0){let o=Pm[e];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[e]=s}return s}},Cf=Ac;function vf(n,t,e,i){let r=n[t],s=n[t+1],o=0;for(let a=t+i;a<e;a+=i){let l=n[a],h=n[a+1];o+=Math.sqrt((l-r)*(l-r)+(h-s)*(h-s)),r=l,s=h}return o}function vo(n,t,e,i,r,s,o,a){o=o??[],a=a??i;let l=n[t+i],h=n[t+i+1],c=n[e-2*i],u=n[e-2*i+1],f,g,p,_,m,x,E,C,y=0;for(let w=t;w<e;w+=i){p=f,_=g,m=void 0,x=void 0,w+i<e&&(m=n[w+i],x=n[w+i+1]),s&&w===t&&(p=c,_=u),s&&w===e-i&&(m=l,x=h),f=n[w],g=n[w+1],[E,C]=Om(f,g,p,_,m,x,r),o[y++]=E,o[y++]=C;for(let S=2;S<a;S++)o[y++]=n[w+S]}return o.length!=y&&(o.length=y),o}function Om(n,t,e,i,r,s,o){let a,l;e!==void 0&&i!==void 0?(a=n-e,l=t-i):r!==void 0&&s!==void 0?(a=r-n,l=s-t):(a=1,l=0);let h=Math.hypot(a,l),c=a/h,u=l/h;if(a=-u,l=c,e===void 0||i===void 0)return[n+a*o,t+l*o];if(r===void 0||s===void 0)return[n+a*o,t+l*o];let f=Vh([n,t],[e,i],[r,s]);if(Math.cos(f)>.998)return[n+c*o,t+u*o];let g=Math.cos(f/2),p=Math.sin(f/2),_=p*a+g*l,m=-g*a+p*l,x=_*(1/p),E=m*(1/p);return[n+x*o,t+E*o]}function bo(n,t,e=!1){for(let i=0,r=n.length-2;i<r;i+=t){let s=e&&i===0?n.length-3*t:n.length-2*t;for(let o=s;o>i+t;o-=t){let a=n[i],l=n[i+1],h=n[i+t],c=n[i+t+1],u=n[o],f=n[o+1],g=n[o+t],p=n[o+t+1],_=(p-f)*(h-a)-(g-u)*(c-l);if(_===0)continue;let m=((g-u)*(l-f)-(p-f)*(a-u))/_,x=((h-a)*(l-f)-(c-l)*(a-u))/_;if(m>0&&m<1&&x>0&&x<1){let E=a+m*(h-a),C=l+m*(c-l);n[i+t]=E,n[i+t+1]=C,n.splice(i+2*t,o-i-t);break}}}return n}var Mc;function km(){return Mc||(Mc=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Mc}function bf(n,t,e,i,r,s,o,a,l,h,c,u,f=!0){let g=n[t],p=n[t+1],_=0,m=0,x=0,E=0;function C(){_=g,m=p,t+=i,g=n[t],p=n[t+1],E+=x,x=Math.sqrt((g-_)*(g-_)+(p-m)*(p-m))}do C();while(t<e-i&&E+x<s);let y=x===0?0:(s-E)/x,w=Nt(_,g,y),S=Nt(m,p,y),A=t-i,R=E,T=s+a*l(h,r,c);for(;t<e-i&&E+x<T;)C();y=x===0?0:(T-E)/x;let I=Nt(_,g,y),z=Nt(m,p,y),G=!1;if(f)if(u){let O=[w,S,I,z];Ts(O,0,4,2,u,O,O),G=O[0]>O[2]}else G=w>I;let F=Math.PI,V=[],lt=A+i===t;t=A,x=0,E=R,g=n[t],p=n[t+1];let M;if(lt){C(),M=Math.atan2(p-m,g-_),G&&(M+=M>0?-F:F);let O=(I+w)/2,$=(z+S)/2;return V[0]=[O,$,(T-s)/2,M,r],V}r=r.replace(/\n/g," ");let X=Array.from(km().segment(r),O=>O.segment);for(let O=0,$=X.length;O<$;){C();let N=Math.atan2(p-m,g-_);if(G&&(N+=N>0?-F:F),M!==void 0){let Ct=N-M;if(Ct+=Ct>F?-2*F:Ct<-F?2*F:0,Math.abs(Ct)>o)return null}M=N;let tt=O,it=0;for(;O<$;++O){let Ct=G?$-O-1:O,ot=a*l(h,X[Ct],c);if(t+i<e&&E+x<s+it+ot/2)break;it+=ot}if(O===tt)continue;let wt=(G?X.slice($-O,$-tt):X.slice(tt,O)).join("");y=x===0?0:(s+it/2-E)/x;let L=Nt(_,g,y),$t=Nt(m,p,y);V.push([L,$t,it/2,N,wt]),s+=it}return V}var Vn=ut(),Li=[],ci=[],hi=[],Ai=[];function Rf(n){return n[3].declutterBox}var Sf=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function Pc(n,t){return t==="start"?t=Sf.test(n)?"right":"left":t==="end"&&(t=Sf.test(n)?"left":"right"),Br[t]}function Dm(n,t,e){return e>0&&n.push(`44 `,""),n.push(t,""),n}function Fm(n,t,e){return e%2===0&&(n+=t),n}var Oc=class{constructor(t,e,i,r,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=Lt(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new Eo:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,r){let s=t+e+i+r;if(this.labels_[s])return this.labels_[s];let o=r?this.strokeStates[r]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?Br[l.justify]:Pc(Array.isArray(t)?t[0]:t,l.textAlign||Ii),f=r&&o.lineWidth?o.lineWidth:0,g=Array.isArray(t)?t:String(t).split(`5-`).reduce(Dm,[]),{width:p,height:_,widths:m,heights:x,lineWidths:E}=Dd(l,g),C=p+f,y=[],w=(C+2)*c[0],R=(_+f)*c[1],A={width:w<0?Math.floor(w):Math.ceil(w),height:R<0?Math.floor(R):Math.ceil(R),contextInstructions:y};(c[0]!=1||c[1]!=1)&&y.push("scale",c),r&&(y.push("strokeStyle",o.strokeStyle),y.push("lineWidth",f),y.push("lineCap",o.lineCap),y.push("lineJoin",o.lineJoin),y.push("miterLimit",o.miterLimit),y.push("setLineDash",[o.lineDash]),y.push("lineDashOffset",o.lineDashOffset)),i&&y.push("fillStyle",a.fillStyle),y.push("textBaseline","middle"),y.push("textAlign","center");let b=.5-u,S=u*C+b*f,I=[],z=[],G=0,F=0,V=0,lt=0,M;for(let X=0,O=g.length;X<O;X+=2){let $=g[X];if($===`6-`){F+=G,G=0,S=u*C+b*f,++lt;continue}let N=g[X+1]||l.font;N!==M&&(r&&I.push("font",N),i&&z.push("font",N),M=N),G=Math.max(G,x[V]);let tt=[$,S+b*m[V]+u*(m[V]-E[lt]),.5*(f+G)+F];S+=m[V],r&&I.push("strokeText",tt),i&&z.push("fillText",tt),++V}return Array.prototype.push.apply(y,I),Array.prototype.push.apply(y,z),this.labels_[s]=A,A}replayTextBackground_(t,e,i,r,s,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,r),t.lineTo.apply(t,s),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,r,s,o,a,l,h,c,u,f,g,p,_,m){a*=f[0],l*=f[1];let x=i-a,E=r-l,C=s+h>t?t-h:s,y=o+c>e?e-c:o,w=p[3]+C*f[0]+p[1],R=p[0]+y*f[1]+p[2],A=x-p[3],b=E-p[0];(_||u!==0)&&(Li[0]=A,Ai[0]=A,Li[1]=b,ci[1]=b,ci[0]=A+w,hi[0]=ci[0],hi[1]=b+R,Ai[1]=hi[1]);let S;return u!==0?(S=kt(Lt(),i,r,1,1,u,-i,-r),dt(S,Li),dt(S,ci),dt(S,hi),dt(S,Ai),Jt(Math.min(Li[0],ci[0],hi[0],Ai[0]),Math.min(Li[1],ci[1],hi[1],Ai[1]),Math.max(Li[0],ci[0],hi[0],Ai[0]),Math.max(Li[1],ci[1],hi[1],Ai[1]),Vn)):Jt(Math.min(A,A+w),Math.min(b,b+R),Math.max(A,A+w),Math.max(b,b+R),Vn),g&&(x=Math.round(x),E=Math.round(E)),{drawImageX:x,drawImageY:E,drawImageW:C,drawImageH:y,originX:h,originY:c,declutterBox:{minX:Vn[0],minY:Vn[1],maxX:Vn[2],maxY:Vn[3],value:m},canvasTransform:S,scale:f}}replayImageOrLabel_(t,e,i,r,s,o,a){let l=!!(o||a),h=r.declutterBox,c=a?a[2]*r.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,Li,ci,hi,Ai,o,a),Fd(t,r.canvasTransform,s,i,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(t){let e=this.alignAndScaleFill_;if(e){let i=dt(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(i[0]%r,i[1]%r),e!==1&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,r){let s=this.textStates[e],o=this.createLabel(t,e,r,i),a=this.strokeStates[i],l=this.pixelRatio,h=Pc(Array.isArray(t)?t[0]:t,s.textAlign||Ii),c=Br[s.textBaseline||on],u=a&&a.lineWidth?a.lineWidth:0,f=o.width/l-2*s.scale[0],g=h*f+2*(.5-h)*u,p=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:g,anchorY:p}}execute_(t,e,i,r,s,o,a,l){let h=this.zIndexContext_,c;this.pixelCoordinates_&&zt(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=Vt(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),xu(this.renderedTransform_,i));let u=0,f=r.length,g=0,p,_=[],m,x,E,C,y,w,R,A,b,S,I,z,G,F=0,V=0,lt=this.coordinateCache_,M=this.viewRotation_,X=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,O={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:M},$=this.instructions!=r||this.overlaps?0:200,N,tt,it,wt;for(;u<f;){let L=r[u];switch(L[0]){case D.BEGIN_GEOMETRY:N=L[1],wt=L[3],N.getGeometry()?a!==void 0&&!ht(a,wt.getExtent())?u=L[2]+1:++u:u=L[2],h&&(h.zIndex=L[4]);break;case D.BEGIN_PATH:F>$&&(this.fill_(t),F=0),V>$&&(t.stroke(),V=0),!F&&!V&&(t.beginPath(),y=NaN,w=NaN),++u;break;case D.CIRCLE:g=L[1],E=L[2]??0;let Ct=c[g],ot=c[g+1],Re=c[g+2]-E,Ni=c[g+3]-E,ne=Re-Ct,Qn=Ni-ot,Jr=Math.sqrt(ne*ne+Qn*Qn);t.moveTo(Ct+Jr,ot),t.arc(Ct,ot,Jr,0,2*Math.PI,!0),++u;break;case D.CLOSE_PATH:t.closePath(),++u;break;case D.CUSTOM:g=L[1],p=L[2];let Gi=L[3],Xi=L[4],gn=L[5];O.geometry=Gi,O.feature=N,u in lt||(lt[u]=[]);let Ze=lt[u];gn?gn(c,g,p,2,Ze):(Ze[0]=c[g],Ze[1]=c[g+1],Ze.length=2),h&&(h.zIndex=L[6]),Xi(Ze,O),++u;break;case D.DRAW_IMAGE:g=L[1],p=L[2],b=L[3],m=L[4],x=L[5];let pn=L[6],tr=L[7],er=L[8],Qr=L[9],ui=L[10],ir=L[11],Eg=L[12],ts=L[13];C=L[14]||"declutter";let nr=L[15];if(!b&&L.length>=20){S=L[19],I=L[20],z=L[21],G=L[22];let vt=this.drawLabelWithPointPlacement_(S,I,z,G);b=vt.label,L[3]=b;let Se=L[23];m=(vt.anchorX-Se)*this.pixelRatio,L[4]=m;let re=L[24];x=(vt.anchorY-re)*this.pixelRatio,L[5]=x,pn=b.height,L[6]=pn,ts=b.width,L[13]=ts}let Go;L.length>25&&(Go=L[25]);let Xo,es,is;L.length>17?(Xo=L[16],es=L[17],is=L[18]):(Xo=ni,es=null,is=null),ui&&X?ir+=M:!ui&&!X&&(ir-=M);let wg=0;for(;g<p;g+=2){if(Go&&Go[wg++]<ts/this.pixelRatio)continue;let vt=this.calculateImageOrLabelDimensions_(b.width,b.height,c[g],c[g+1],ts,pn,m,x,er,Qr,ir,Eg,s,Xo,!!es||!!is,N),Se=[t,e,b,vt,tr,es,is];if(l){let re,Te,se;if(nr){let gt=p-g;if(!nr[gt]){nr[gt]={args:Se,declutterMode:C};continue}let Ut=nr[gt];re=Ut.args,Te=Ut.declutterMode,delete nr[gt],se=Rf(re)}let Be,Ve;if(re&&(Te!=="declutter"||!l.collides(se))&&(Be=!0),(C!=="declutter"||!l.collides(vt.declutterBox))&&(Ve=!0),Te==="declutter"&&C==="declutter"){let gt=Be&&Ve;Be=gt,Ve=gt}Be&&(Te!=="none"&&l.insert(se),this.replayImageOrLabel_.apply(this,re)),Ve&&(C!=="none"&&l.insert(vt.declutterBox),this.replayImageOrLabel_.apply(this,Se))}else this.replayImageOrLabel_.apply(this,Se)}++u;break;case D.DRAW_CHARS:let mh=L[1],_h=L[2],Wo=L[3],Cg=L[4];G=L[5];let vg=L[6],xh=L[7],yh=L[8];z=L[9];let Yo=L[10];S=L[11],Array.isArray(S)&&(S=S.reduce(Fm,"")),I=L[12];let Eh=[L[13],L[13]];C=L[14]||"declutter";let bg=L[15],wh=L[16],Uo=this.textStates[I],rr=Uo.font,sr=[Uo.scale[0]*xh,Uo.scale[1]*xh],or;rr in this.widths_?or=this.widths_[rr]:(or={},this.widths_[rr]=or);let Ch=vf(c,mh,_h,2),vh=Math.abs(sr[0])*Dl(rr,S,or);if(Cg||vh<=Ch){let vt=this.textStates[I].textAlign,Se=(Ch-vh)*Pc(S,vt),re=bf(c,mh,_h,2,S,Se,vg,Math.abs(sr[0]),Dl,rr,or,X?0:this.viewRotation_,bg);t:if(re){let Te=[],se,Be,Ve,gt,Ut;if(z)for(se=0,Be=re.length;se<Be;++se){Ut=re[se],Ve=Ut[4],gt=this.createLabel(Ve,I,"",z),m=Ut[2]+(sr[0]<0?-Yo:Yo)-wh,x=Wo*gt.height+(.5-Wo)*2*Yo*sr[1]/sr[0]-yh;let je=this.calculateImageOrLabelDimensions_(gt.width,gt.height,Ut[0],Ut[1],gt.width,gt.height,m,x,0,0,Ut[3],Eh,!1,ni,!1,N);if(l&&C==="declutter"&&l.collides(je.declutterBox))break t;Te.push([t,e,gt,je,1,null,null])}if(G)for(se=0,Be=re.length;se<Be;++se){Ut=re[se],Ve=Ut[4],gt=this.createLabel(Ve,I,G,""),m=Ut[2]-wh,x=Wo*gt.height-yh;let je=this.calculateImageOrLabelDimensions_(gt.width,gt.height,Ut[0],Ut[1],gt.width,gt.height,m,x,0,0,Ut[3],Eh,!1,ni,!1,N);if(l&&C==="declutter"&&l.collides(je.declutterBox))break t;Te.push([t,e,gt,je,1,null,null])}l&&C!=="none"&&l.load(Te.map(Rf));for(let je=0,Rg=Te.length;je<Rg;++je)this.replayImageOrLabel_.apply(this,Te[je])}}++u;break;case D.END_GEOMETRY:if(o!==void 0){N=L[1];let vt=o(N,wt,C);if(vt)return vt}++u;break;case D.FILL:$?F++:this.fill_(t),++u;break;case D.MOVE_TO_LINE_TO:g=L[1],p=L[2],E=L[3];let Wi,ar,ns;if(E){let Se=(L[4]??!1)||Math.abs(c[g]-c[p-2])<1e-6&&Math.abs(c[g+1]-c[p-1])<1e-6;vo(c,g,p,2,E,Se,_),bo(_,2,Se),Wi=_,ar=0,ns=Wi.length}else Wi=c,ar=g,ns=p;tt=Wi[ar],it=Wi[ar+1],t.moveTo(tt,it),y=tt+.5|0,w=it+.5|0;for(let vt=ar+2;vt<ns;vt+=2)tt=Wi[vt],it=Wi[vt+1],R=tt+.5|0,A=it+.5|0,(vt==ns-2||R!==y||A!==w)&&(t.lineTo(tt,it),y=R,w=A);++u;break;case D.SET_FILL_STYLE:this.alignAndScaleFill_=L[2],F?(this.fill_(t),F=0,V&&(t.stroke(),V=0)):V&&L[1]&&(t.stroke(),V=0),t.fillStyle=L[1],++u;break;case D.SET_STROKE_STYLE:F&&L[1]&&(this.fill_(t),F=0),V&&(t.stroke(),V=0),this.setStrokeStyle_(t,L),++u;break;case D.STROKE:$?V++:t.stroke(),++u;break;default:++u;break}}F&&this.fill_(t),V&&t.stroke()}execute(t,e,i,r,s,o){this.viewRotation_=r,this.execute_(t,e,i,this.instructions,s,void 0,void 0,o)}executeHitDetection(t,e,i,r,s){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,r,s)}},Tf=Oc;var Mi=["Polygon","Circle","LineString","Image","Text","Default"],Fc=["Image","Text"],If=Mi.filter(n=>!Fc.includes(n)),Lf=!1,Af=!1;function zm(){let n=0,t=i=>{let r=nt(1,1,null,{willReadFrequently:i}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return n=s>n?s:n,s};Lf={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[n],Af=!0}var Dc=class{constructor(t,e,i,r,s,o,a){this.maxExtent_=t,this.overlaps_=r,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Lt(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(t,e){let i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(let i in t){let r=this.executorsByZIndex_[i];r===void 0&&(r={},this.executorsByZIndex_[i]=r);let s=t[i];for(let o in s){let a=s[o];r[o]=new Tf(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(let e in this.executorsByZIndex_){let i=this.executorsByZIndex_[e];for(let r=0,s=t.length;r<s;++r)if(t[r]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,r,s,o){Af===!1&&zm(),r=Math.round(r);let a=r*2+1,l=kt(this.hitDetectionTransform_,r+.5,r+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=nt(a,a,null,{willReadFrequently:Lf}));let c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=ut(),Bi(u,t),En(u,e*(this.renderBuffer_+r),u));let f=Nm(r),g;function p(w,R,A){let b=c.getImageData(0,0,a,a).data;for(let S=0,I=f.length;S<I;S++)if(b[f[S]]>0){if(!o||A==="none"||g!=="Image"&&g!=="Text"||o.includes(w)){let z=(f[S]-3)/4,G=r-z%a,F=r-(z/a|0),V=s(w,R,G*G+F*F);if(V)return V}c.clearRect(0,0,a,a);break}}let _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(Zt);let m,x,E,C,y;for(m=_.length-1;m>=0;--m){let w=_[m].toString();for(E=this.executorsByZIndex_[w],x=Mi.length-1;x>=0;--x)if(g=Mi[x],C=E[g],C!==void 0&&(y=C.executeHitDetection(c,l,i,p,u),y))return y}}getClipCoords(t){let e=this.maxExtent_;if(!e)return null;let i=e[0],r=e[1],s=e[2],o=e[3],a=[i,r,i,o,s,o,s,r];return Vt(a,0,8,2,t,a),a}isEmpty(){return de(this.executorsByZIndex_)}execute(t,e,i,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Rh:Zt),o=o||Mi;let h=Mi.length;for(let c=0,u=l.length;c<u;++c){let f=l[c].toString(),g=this.executorsByZIndex_[f];for(let p=0,_=o.length;p<_;++p){let m=o[p],x=g[m];if(x!==void 0){let E=a===null?void 0:x.getZIndexContext(),C=E?E.getContext():t,y=this.maxExtent_&&m!=="Image"&&m!=="Text";if(y&&(C.save(),this.clip(C,i)),!E||m==="Text"||m==="Image"?x.execute(C,e,i,r,s,a):E.pushFunction(w=>x.execute(w,e,i,r,s,a)),y&&C.restore(),E){E.offset();let w=l[c]*h+Mi.indexOf(m);this.deferredZIndexContexts_[w]||(this.deferredZIndexContexts_[w]=[]),this.deferredZIndexContexts_[w].push(E)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Zt);for(let i=0,r=e.length;i<r;++i)t[e[i]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),t[e[i]].length=0}},kc={};function Nm(n){if(kc[n]!==void 0)return kc[n];let t=n*2+1,e=n*n,i=new Array(e+1);for(let s=0;s<=n;++s)for(let o=0;o<=n;++o){let a=s*s+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+s)*t+(n+o))*4+3),s>0&&l.push(((n-s)*t+(n+o))*4+3),o>0&&(l.push(((n+s)*t+(n-o))*4+3),s>0&&l.push(((n-s)*t+(n-o))*4+3))}let r=[];for(let s=0,o=i.length;s<o;++s)i[s]&&r.push(...i[s]);return kc[n]=r,r}var Mf=Dc;var zc=class extends Co{constructor(t,e,i,r,s,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=r,this.transformRotation_=r?Ui(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Lt()}drawImages_(t,e,i,r){if(!this.image_)return;let s=Vt(t,e,i,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=s.length;c<u;c+=2){let f=s[c]-this.imageAnchorX_,g=s[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let p=f+this.imageAnchorX_,_=g+this.imageAnchorY_;kt(a,p,_,1,1,h,-p,-_),o.save(),o.transform.apply(o,a),o.translate(p,_),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,f,g,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=Vt(t,e,i,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=r){let l=s[e]+this.textOffsetX_,h=s[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,i,r,s,o){let a=this.context_,l=Vt(t,e,i,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let c=l.length,u=s||Math.abs(l[0]-l[c-2])<1e-6&&Math.abs(l[1]-l[c-1])<1e-6;l=vo(l,0,c,2,o,u,l),bo(l,2,u)}a.moveTo(l[0],l[1]);let h=l.length;s&&(h-=2);for(let c=2;c<h;c+=2)a.lineTo(l[c],l[c+1]);return s&&a.closePath(),i}drawRings_(t,e,i,r,s){for(let o=0,a=i.length;o<a;++o)e=this.moveToLineTo_(t,e,i[o],r,!0,s);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let e=Su(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],r=e[3]-e[1],s=Math.sqrt(i*i+r*r),o=this.context_;o.beginPath(),o.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break;default:}}drawFeature(t,e){let i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){let e=t.getGeometriesArray();for(let i=0,r=e.length;i<r;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(this.text_!==""){let e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let e=t.getExtent();if(ht(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let i=this.context_,r=t.getFlatCoordinates(),s=0,o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);i.stroke()}if(this.text_!==""){let i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){let e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let e=this.context_,i=t.getOrientedFlatCoordinates(),r=0,s=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=s.length;a<l;++a){let h=s[a];r=this.drawRings_(i,r,h,o,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){let e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){let e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){let e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),zt(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){let e=this.context_,i=this.contextTextState_,r=t.textAlign?t.textAlign:Ii;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=r&&(i.textAlign=r,e.textAlign=r),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=r,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:r,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{let i=t.getColor();this.fillState_={fillStyle:jt(i||St)}}if(!e)this.strokeState_=null;else{let i=e.getColor(),r=e.getLineCap(),s=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=s||Ht,u=e.getOffset();this.strokeState_={lineCap:r!==void 0?r:Ge,lineDash:this.pixelRatio_===1?c:c.map(f=>f*this.pixelRatio_),lineDashOffset:(o||qt)*this.pixelRatio_,lineJoin:a!==void 0?a:Xe,lineWidth:(l!==void 0?l:ri)*this.pixelRatio_,miterLimit:h!==void 0?h:ii,strokeStyle:jt(i||Yt),strokeOffset:(u??0)*this.pixelRatio_}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}let i=t.getPixelRatio(this.pixelRatio_),r=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*i,this.imageAnchorY_=r[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();let o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{let e=t.getFill();if(!e)this.textFillState_=null;else{let g=e.getColor();this.textFillState_={fillStyle:jt(g||St)}}let i=t.getStroke();if(!i)this.textStrokeState_=null;else{let g=i.getColor(),p=i.getLineCap(),_=i.getLineDash(),m=i.getLineDashOffset(),x=i.getLineJoin(),E=i.getWidth(),C=i.getMiterLimit();this.textStrokeState_={lineCap:p!==void 0?p:Ge,lineDash:_||Ht,lineDashOffset:m||qt,lineJoin:x!==void 0?x:Xe,lineWidth:E!==void 0?E:ri,miterLimit:C!==void 0?C:ii,strokeStyle:jt(g||Yt)}}let r=t.getFont(),s=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),f=t.getTextBaseline();this.textState_={font:r!==void 0?r:io,textAlign:u!==void 0?u:Ii,textBaseline:f!==void 0?f:on},this.text_=c!==void 0?Array.isArray(c)?c.reduce((g,p,_)=>g+=_%2?" ":p,""):c:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}},Pf=zc;var ve=.5;function Of(n,t,e,i,r,s,o,a,l){let h=l?xi(r,l):r,c=n[0]*ve,u=n[1]*ve,f=nt(c,u);f.imageSmoothingEnabled=!1;let g=f.canvas,p=new Pf(f,ve,r,null,o,a,l?Hi($i(),l):null),_=e.length,m=Math.floor((256*256*256-1)/_),x={};for(let C=1;C<=_;++C){let y=e[C-1],w=y.getStyleFunction()||i;if(!w)continue;let R=w(y,s);if(!R)continue;Array.isArray(R)||(R=[R]);let b=(C*m).toString(16).padStart(7,"#00000");for(let S=0,I=R.length;S<I;++S){let z=R[S],G=z.getGeometryFunction()(y);if(!G||!ht(h,G.getExtent()))continue;let F=z.clone(),V=F.getFill();V&&V.setColor(b);let lt=F.getStroke();lt&&(lt.setColor(b),lt.setLineDash(null)),F.setText(void 0);let M=z.getImage();if(M){let N=M.getImageSize();if(!N)continue;let tt=nt(N[0],N[1],void 0,{alpha:!1}),it=tt.canvas;tt.fillStyle=b,tt.fillRect(0,0,it.width,it.height),F.setImage(new an({img:it,anchor:M.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:M.getOrigin(),opacity:1,size:M.getSize(),scale:M.getScale(),rotation:M.getRotation(),rotateWithView:M.getRotateWithView()}))}let X=F.getZIndex()||0,O=x[X];O||(O={},x[X]=O,O.Polygon=[],O.Circle=[],O.LineString=[],O.Point=[]);let $=G.getType();if($==="GeometryCollection"){let N=G.getGeometriesArrayRecursive();for(let tt=0,it=N.length;tt<it;++tt){let wt=N[tt];O[wt.getType().replace("Multi","")].push(wt,F)}}else O[$.replace("Multi","")].push(G,F)}}let E=Object.keys(x).map(Number).sort(Zt);for(let C=0,y=E.length;C<y;++C){let w=x[E[C]];for(let R in w){let A=w[R];for(let b=0,S=A.length;b<S;b+=2){p.setStyle(A[b+1]);for(let I=0,z=t.length;I<z;++I)p.setTransform(t[I]),p.drawGeometry(A[b])}}}return f.getImageData(0,0,g.width,g.height)}function kf(n,t,e){let i=[];if(e){let r=Math.floor(Math.round(n[0])*ve),s=Math.floor(Math.round(n[1])*ve),o=(et(r,0,e.width-1)+et(s,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],c=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);c&&c%u===0&&i.push(t[c/u-1])}return i}var Gm=.5,Df={Point:Bm,LineString:Um,Polygon:jm,MultiPoint:Vm,MultiLineString:Km,MultiPolygon:Zm,GeometryCollection:Ym,Circle:Xm};function Ff(n,t){return parseInt(Y(n),10)-parseInt(Y(t),10)}function Nc(n,t){let e=Gc(n,t);return e*e}function Gc(n,t){return Gm*n/t}function Xm(n,t,e,i,r){let s=e.getFill(),o=e.getStroke();if(s||o){let l=n.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(t,i,r)}let a=e.getText();if(a&&a.getText()){let l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,r)}}function Xc(n,t,e,i,r,s,o,a){let l=[],h=e.getImage();if(h){let f=!0,g=h.getImageState();g==W.LOADED||g==W.ERROR?f=!1:g==W.IDLE&&h.load(),f&&l.push(h.ready())}let c=e.getFill();c&&c.loading()&&l.push(c.ready());let u=l.length>0;return u&&Promise.all(l).then(()=>r(null)),Wm(n,t,e,i,s,o,a),u}function Wm(n,t,e,i,r,s,o){let a=e.getGeometryFunction()(t);if(!a)return;let l=a.simplifyTransformed(i,r);if(e.getRenderer())zf(n,l,e,t,o);else{let c=Df[l.getType()];c(n,l,e,t,o,s)}}function zf(n,t,e,i,r){if(t.getType()=="GeometryCollection"){let o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)zf(n,o[a],e,i,r);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),r)}function Ym(n,t,e,i,r,s){let o=t.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let h=Df[o[a].getType()];h(n,o[a],e,i,r,s)}}function Um(n,t,e,i,r){let s=e.getStroke();if(s){let a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(t,i,r)}let o=e.getText();if(o&&o.getText()){let a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,r)}}function Km(n,t,e,i,r){let s=e.getStroke();if(s){let a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(t,i,r)}let o=e.getText();if(o&&o.getText()){let a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,r)}}function Zm(n,t,e,i,r){let s=e.getFill(),o=e.getStroke();if(o||s){let l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(t,i,r)}let a=e.getText();if(a&&a.getText()){let l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,r)}}function Bm(n,t,e,i,r,s){let o=e.getImage(),a=e.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=W.LOADED)return;let c=n.getBuilder(e.getZIndex(),"Image");c.setImageStyle(o,h),c.drawPoint(t,i,r)}if(l){let c=n.getBuilder(e.getZIndex(),"Text");c.setTextStyle(a,h),c.drawText(t,i,r)}}function Vm(n,t,e,i,r,s){let o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),h=l&&l.getText(),c=s&&a&&h?{}:void 0;if(a){if(o.getImageState()!=W.LOADED)return;let u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,c),u.drawMultiPoint(t,i,r)}if(h){let u=n.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,c),u.drawText(t,i,r)}}function jm(n,t,e,i,r){let s=e.getFill(),o=e.getStroke();if(s||o){let l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(t,i,r)}let a=e.getText();if(a&&a.getText()){let l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,r)}}var Wc=class extends wo{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=ut(),this.wrappedRenderedExtent_=ut(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){let r=e.extent,s=e.viewState,o=s.center,a=s.resolution,l=s.projection,h=s.rotation,c=l.getExtent(),u=this.getLayer().getSource(),f=this.getLayer().getDeclutter(),g=e.pixelRatio,p=e.viewHints,_=!(p[Rt.ANIMATING]||p[Rt.INTERACTING]),m=this.context,x=Math.round(j(r)/a*g),E=Math.round(ct(r)/a*g),C=u.getWrapX()&&l.canWrapX(),y=C?j(c):null,w=C?Math.ceil((r[2]-c[2])/y)+(this.extendX_?2:1):1,R=C?Math.floor((r[0]-c[0])/y)-(this.extendX_?1:0):0;do{let A=this.getRenderTransform(o,a,0,g,x,E,R*y);e.declutter&&(A=A.slice(0)),t.execute(m,[m.canvas.width,m.canvas.height],A,h,_,i===void 0?Mi:i?Fc:If,i?f&&e.declutter[f]:void 0)}while(++R<w)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=nt(this.context.canvas.width,this.context.canvas.height,gc))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,Ji(this.context),gc.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){let i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;let r=t.viewState;this.prepareContainer(t,e);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Dt.PRERENDER)||this.getLayer().hasListener(Dt.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,t);let l=r.projection;this.clipExtent_=null;let h=!1;if(a&&i.extent&&this.clipping){let c=ye(i.extent,l);a=ht(c,t.extent),a&&!Pe(c,t.extent)&&(t.declutter?this.clipExtent_=c:(this.clipUnrotated(s,t,c),h=!0))}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),h&&s.restore(),this.postRender(s,t),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let i=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*ve,f=i[1]*ve;c.push(this.getRenderTransform(r,s,o,ve,u,f,0).slice());let g=h.getSource(),p=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!Pe(p,l)){let m=l[0],x=j(p),E=0,C;for(;m<p[0];)--E,C=x*E,c.push(this.getRenderTransform(r,s,o,ve,u,f,C).slice()),m+=x;for(E=0,m=l[2];m>p[2];)++E,C=x*E,c.push(this.getRenderTransform(r,s,o,ve,u,f,C).slice()),m-=x}let _=$i();this.hitDetectionImageData_=Of(i,c,this.renderedFeatures_,h.getStyleFunction(),l,s,o,Nc(s,this.renderedPixelRatio_),_?a:null)}e(kf(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,r,s){if(!this.replayGroup_)return;let o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(f,g,p){let _=Y(f),m=h[_];if(m){if(m!==!0&&p<m.distanceSq){if(p===0)return h[_]=!0,s.splice(s.lastIndexOf(m),1),r(f,l,g);m.geometry=g,m.distanceSq=p}}else{if(p===0)return h[_]=!0,r(f,l,g);s.push(h[_]={feature:f,layer:l,geometry:g,distanceSq:p,callback:r})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,c,u?e.declutter?.[u]?.all().map(f=>f.value):null)}handleFontsChanged(){let t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){let e=this.getLayer(),i=e.getSource();if(!i)return!1;let r=t.viewHints[Rt.ANIMATING],s=t.viewHints[Rt.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,f=t.pixelRatio,g=e.getRevision(),p=e.getRenderBuffer(),_=e.getRenderOrder();_===void 0&&(_=Ff);let m=h.center.slice(),x=En(l,p*u),E=x.slice(),C=[x.slice()],y=c.getExtent(),w=i.getWrapX()&&c.canWrapX();if(this.extendX_=!1,w){let M=i.getExtent();M&&!ke(M)&&(this.extendX_=M[0]<y[0]||M[2]>y[2])}if(w&&(!Pe(y,t.extent)||this.extendX_)){let M=j(y),X=Math.max(j(x)/2,M),O=y[0],$=y[2];this.extendX_&&(O-=M,$+=M),x[0]=O-X,x[2]=$+X,ms(m,c);let N=la(C[0],c);N[0]<y[0]&&N[2]<y[2]?C.push([N[0]+M,N[1],N[2]+M,N[3]]):N[0]>y[0]&&N[2]>y[2]&&C.push([N[0]-M,N[1],N[2]-M,N[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===f&&this.renderedRevision_==g&&this.renderedRenderOrder_==_&&this.renderedFrameDeclutter_===!!t.declutter&&Pe(this.wrappedRenderedExtent_,x))return zt(this.renderedExtent_,E)||(this.hitDetectionImageData_=null,this.renderedExtent_=E),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let R=new Cf(Gc(u,f),x,u,f),A=$i(),b;if(A){for(let M=0,X=C.length;M<X;++M){let O=C[M],$=xi(O,c);i.loadFeatures($,_u(u,c),A)}b=Hi(A,c)}else for(let M=0,X=C.length;M<X;++M)i.loadFeatures(C[M],u,c);let S=Nc(u,f),I=!0,z=(M,X)=>{let O,$=M.getStyleFunction()||e.getStyleFunction();if($&&(O=$(M,u)),O){let N=this.renderFeature(M,S,O,R,b,this.getLayer().getDeclutter(),X);I=I&&!N}},G=xi(x,c),F=i.getFeaturesInExtent(G);_&&F.sort(_);for(let M=0,X=F.length;M<X;++M)z(F[M],M);this.renderedFeatures_=F,this.ready=I;let V=R.finish(),lt=new Mf(x,u,f,i.getOverlaps(),V,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=g,this.renderedRenderOrder_=_,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=E,this.wrappedRenderedExtent_=x,this.renderedCenter_=m,this.renderedProjection_=c,this.renderedPixelRatio_=f,this.replayGroup_=lt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,r,s,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let h=0,c=i.length;h<c;++h)l=Xc(r,t,i[h],e,this.boundHandleStyleImageChange_,s,o,a)||l;else l=Xc(r,t,i,e,this.boundHandleStyleImageChange_,s,o,a);return l}},Nf=Wc;var Yc=class extends uo{constructor(t){super(t)}createRenderer(){return new Nf(this)}},ee=Yc;var Hm=!1;function qm(n,t,e,i,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(e,i,r):n,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Hm,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let h=t.getType();try{let c;h=="text"||h=="json"?c=a.responseText:h=="xml"?c=a.responseXML||a.responseText:h=="arraybuffer"&&(c=a.response),c?s(t.readFeatures(c,{extent:e,featureProjection:r}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Uc(n,t){return function(e,i,r,s,o){qm(n,t,e,i,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function Gf(n,t){return[[-1/0,-1/0,1/0,1/0]]}function Kc(n,t,e,i,r,s,o){let a,l,h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=r;else if(h!==0){let c=n[t],u=n[t+1],f=0,g=[0];for(let m=t+i;m<e;m+=i){let x=n[m],E=n[m+1];f+=Math.sqrt((x-c)*(x-c)+(E-u)*(E-u)),g.push(f),c=x,u=E}let p=r*f,_=bh(g,p);_<0?(l=(p-g[-_-2])/(g[-_-1]-g[-_-2]),a=t+(-_-2)*i):a=t+_*i}o=o>1?o:2,s=s||new Array(o);for(let c=0;c<o;++c)s[c]=a===void 0?NaN:l===void 0?n[a+c]:Nt(n[a+c],n[a+i+c],l);return s}var Xf=Lt(),Vr=class n{constructor(t,e,i,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?ds(this.flatCoordinates_):wn(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let t=Bt(this.getExtent());this.flatInteriorPoints_=vr(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let t=Wu(this.flatCoordinates_,this.ends_),e=go(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=Ls(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Kc(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let t=this.flatCoordinates_,e=0,i=this.ends_;for(let r=0,s=i.length;r<s;++r){let o=i[r],a=Kc(t,e,o,this.stride_,.5);fe(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=Et(t);let e=t.getExtent(),i=t.getWorldExtent();if(e&&i){let r=ct(i)/ct(e);kt(Xf,i[0],i[3],r,-r,0,0,0),Vt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Xf,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new n(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=rs((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);let i=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":i.length=wr(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),r=[i.length];break;case"MultiLineString":r=[],i.length=zu(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,r);break;case"Polygon":r=[],i.length=Cr(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,r);break;default:}return r&&(this.simplifiedGeometry_=new n(this.type_,i,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};Vr.prototype.getFlatCoordinates=Vr.prototype.getOrientedFlatCoordinates;var hn=Vr;var Zc=class{constructor(t){this.rbush_=new en(t),this.items_={}}insert(t,e){let i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[Y(e)]=i}load(t,e){let i=new Array(e.length);for(let r=0,s=e.length;r<s;r++){let o=t[r],a=e[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[r]=l,this.items_[Y(a)]=l}this.rbush_.load(i)}remove(t){let e=Y(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){let i=this.items_[Y(e)],r=[i.minX,i.minY,i.maxX,i.maxY];Zi(r,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){let e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(r){return r.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let r=0,s=t.length;r<s;r++)if(i=e(t[r]),i)return i;return i}isEmpty(){return de(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){let e=this.rbush_.toJSON();return Jt(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(let e in t.items_)this.items_[e]=t.items_[e]}},Bc=Zc;var Vc=class extends xt{constructor(t){super(),this.projection=Et(t.projection),this.attributions_=Wf(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;let e=this;this.viewPromise_=new Promise(function(i,r){e.viewResolver=i,e.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}ready(){let t=this.getState();return t==="ready"?Promise.resolve():t==="error"?Promise.reject(new Error("Source failed to load")):new Promise((e,i)=>{let r=()=>{let s=this.getState();s==="ready"?(this.un("change",r),e()):s==="error"&&(this.un("change",r),i(new Error("Source failed to load")))};this.on("change",r)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=Wf(t),this.changed()}setState(t){this.state_=t,this.changed()}};function Wf(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}var Ro=Vc;var ie={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Ue=class extends Tt{constructor(t,e,i){super(t),this.feature=e,this.features=i}},jc=class extends Ro{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=$e,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(B(this.format_,"`format` must be set when `url` is set"),this.loader_=Uc(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Gf;let e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Bc:null,this.loadedExtentsRtree_=new Bc,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,r;Array.isArray(t.features)?r=t.features:t.features&&(i=t.features,r=i.getArray()),!e&&i===void 0&&(i=new Pt(r)),r!==void 0&&this.addFeaturesInternal(r),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){let e=Y(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);let i=t.getGeometry();if(i){let r=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Ue(ie.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof hn||(this.featureChangeKeys_[t]=[K(e,P.CHANGE,this.handleFeatureChange_,this),K(e,ue.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){let r=String(e.getId());if(!(r in this.idIndex_))this.idIndex_[r]=e;else if(e instanceof hn){let s=this.idIndex_[r];s instanceof hn?Array.isArray(s)?s.push(e):this.idIndex_[r]=[s,e]:i=!1}else i=!1}return i&&(B(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){let e=[],i=[],r=[];for(let s=0,o=t.length;s<o;s++){let a=t[s],l=Y(a);this.addToIndex_(l,a)&&i.push(a)}for(let s=0,o=i.length;s<o;s++){let a=i[s],l=Y(a);this.setupChangeEvents_(l,a);let h=a.getGeometry();if(h){let c=h.getExtent();e.push(c),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,r),this.hasListener(ie.ADDFEATURE))for(let s=0,o=i.length;s<o;s++)this.dispatchEvent(new Ue(ie.ADDFEATURE,i[s]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(ie.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(ie.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(It.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(It.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(let i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(J);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(i=>{this.removeFeatureInternal(i)});for(let i in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let e=new Ue(ie.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){let i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(r){let s=r.getGeometry();if(s instanceof hn||s.intersectsCoordinate(t))return e(r)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){let r=i.getGeometry();if(r instanceof hn||r.intersectsExtent(t)){let s=e(i);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),de(this.nullGeometryFeatures_)||fe(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){let e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);let r=ps(t,e);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){let i=t[0],r=t[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return e=e||He,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){let c=h.getGeometry(),u=a;if(a=c instanceof hn?0:c.closestPointXY(i,r,o,a),a<u){s=h;let f=Math.sqrt(a);l[0]=i-f,l[1]=r-f,l[2]=i+f,l[3]=r+f}}}),s}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){let e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){let e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){let e=t.target,i=Y(e),r=e.getGeometry();if(!r)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{let o=r.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}let s=e.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Ue(ie.CHANGEFEATURE,e))}hasFeature(t){let e=t.getId();if(e!==void 0){let i=this.idIndex_[String(e)];return Array.isArray(i)?i.includes(t):i===t}return Y(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&de(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){let r=this.loadedExtentsRtree_,s=this.strategy_(t,e,i);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(c){return Pe(c.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Ue(ie.FEATURESLOADSTART));let c=p=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Ue(ie.FEATURESLOADEND,void 0,p))},u=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Ue(ie.FEATURESLOADERROR))},f=!1,g=this.loader_.call(this,l,e,i,p=>f||c(p),()=>f||u());g instanceof Promise?(f=!0,g.then(p=>{this.addFeatures(p),c(p)}).catch(u)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){let e=this.loadedExtentsRtree_,i=[];e.forEachInExtent(t,function(r){i.push(r)}),i.forEach(r=>{e.remove(r);let s=aa(r.extent,t);for(let o of s)e.insert(o,{extent:o})})}removeFeatures(t){let e=!1;for(let i=0,r=t.length;i<r;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){let e=Y(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[e]?.forEach(J),delete this.featureChangeKeys_[e];let r=t.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===t?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[e],this.hasListener(ie.REMOVEFEATURE)&&this.dispatchEvent(new Ue(ie.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(let e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){B(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Uc(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}},Pi=jc;var jn=[0,0,0],Oi=5,Hc=class{constructor(t){let e=t.minZoom,i=t.resolutions;e===void 0&&i&&(e=i.findIndex(o=>o!==void 0)),this.minZoom=e!==void 0?e:0,this.resolutions_=i,B(Th(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!t.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,B(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=t.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=ae(s)),B(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,B(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:256,B(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.tileRanges!==void 0?this.fullTileRanges_=t.tileRanges:t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((o,a)=>{let l=new xo(Math.min(0,o[0]),Math.max(o[0]-1,-1),Math.min(0,o[1]),Math.max(o[1]-1,-1));if(s){let h=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(h.minX,l.minX),l.maxX=Math.min(h.maxX,l.maxX),l.minY=Math.max(h.minY,l.minY),l.maxY=Math.min(h.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(t,e,i){let r=this.getTileRangeForExtentAndZ(t,e);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)i([e,s,a])}forEachTileCoordParentTileRange(t,e,i,r){let s,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,r);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=ln(o,o,a,a,i)):s=this.getTileRangeForExtentAndZ(l,h,i),e(h,s))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){let s=t[1]*2,o=t[2]*2;return ln(s,s+1,o,o+1,e)}let r=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;let r=t[0],s=t[1],o=t[2];if(e===r)return ln(s,o,s,o,i);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,e-r),h=Math.floor(s*l),c=Math.floor(o*l);if(e<r)return ln(h,h,c,c,i);let u=Math.floor(l*(s+1))-1,f=Math.floor(l*(o+1))-1;return ln(h,u,c,f,i)}let a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,jn);let r=jn[1],s=jn[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,jn);let o=jn[1],a=jn[2];return ln(r,o,s,a,i)}getTileCoordCenter(t){let e=this.getOrigin(t[0]),i=this.getResolution(t[0]),r=pt(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*r[0]*i,e[1]-(t[2]+.5)*r[1]*i]}getTileCoordExtent(t,e){let i=this.getOrigin(t[0]),r=this.getResolution(t[0]),s=pt(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*s[0]*r,a=i[1]-(t[2]+1)*s[1]*r,l=o+s[0]*r,h=a+s[1]*r;return Jt(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,r,s){let o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=pt(this.getTileSize(o),this.tmpSize_),c=a*(t-l[0])/i/h[0],u=a*(l[1]-e)/i/h[1];return r?(c=dr(c,Oi)-1,u=dr(u,Oi)-1):(c=ur(c,Oi),u=ur(u,Oi)),Kn(o,c,u,s)}getTileCoordForXYAndZ_(t,e,i,r,s){let o=this.getOrigin(i),a=this.getResolution(i),l=pt(this.getTileSize(i),this.tmpSize_),h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return r?(h=dr(h,Oi)-1,c=dr(c,Oi)-1):(h=ur(h,Oi),c=ur(c,Oi)),Kn(i,h,c,s)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){let i=_n(this.resolutions_,t,e||0);return et(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Ma(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){let e=this.resolutions_.length,i=new Array(e);for(let r=this.minZoom;r<e;++r)i[r]=this.getTileRangeForExtentAndZ(t,r);this.fullTileRanges_=i}},jr=Hc;function So(n){let t=n.getDefaultTileGrid();return t||(t=Jm(n),n.setDefaultTileGrid(t)),t}function Yf(n,t,e){let i=t[0],r=n.getTileCoordCenter(t),s=To(e);if(!me(s,r)){let o=j(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,n.getTileCoordForCoordAndZ(r,i)}return t}function $m(n,t,e,i){i=i!==void 0?i:"top-left";let r=Kf(n,t,e);return new jr({extent:n,origin:Gh(n,i),resolutions:r,tileSize:e})}function Uf(n){let t=n||{},e=t.extent||Et("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Kf(e,t.maxZoom,t.tileSize,t.maxResolution)};return new jr(i)}function Kf(n,t,e,i){t=t!==void 0?t:42,e=pt(e!==void 0?e:256);let r=ct(n),s=j(n);i=i>0?i:Math.max(s/e[0],r/e[1]);let o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function Jm(n,t,e,i){let r=To(n);return $m(r,t,e,i)}function To(n){n=Et(n);let t=n.getExtent();if(!t){let e=180*Je.degrees/n.getMetersPerUnit();t=Jt(-e,-e,e,e)}return t}var Qm=/\{z\}/g,t_=/\{x\}/g,e_=/\{y\}/g,i_=/\{-y\}/g;function Zf(n,t,e,i,r){return n.replace(Qm,t.toString()).replace(t_,e.toString()).replace(e_,i.toString()).replace(i_,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-i).toString()})}function Bf(n){let t=[],e=/\{([a-z])-([a-z])\}/.exec(n);if(e){let i=e[1].charCodeAt(0),r=e[2].charCodeAt(0),s;for(s=i;s<=r;++s)t.push(n.replace(e[0],String.fromCharCode(s)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(n),e){let i=parseInt(e[2],10);for(let r=parseInt(e[1],10);r<=i;r++)t.push(n.replace(e[0],r.toString()));return t}return t.push(n),t}function n_(n,t){return(function(e,i,r){if(!e)return;let s,o=e[0];if(t){let a=t.getFullTileRange(o);a&&(s=a.getHeight()-1)}return Zf(n,o,e[1],e[2],s)})}function Vf(n,t){let e=n.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=n_(n[r],t);return r_(i)}function r_(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;let r=hf(t),s=Me(r,n.length);return n[s](t,e,i)})}var qc=class extends Ro{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;let e=[256,256];this.tileGrid&&pt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||Y(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){let e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,r,s,o){return H()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:So(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){let r=this.getTileGridForProjection(i),s=this.getTilePixelRatio(e),o=pt(r.getTileSize(t),this.tmpSize);return s==1?o:Cd(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){let i=e!==void 0?e:this.getProjection(),r=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=Yf(r,t,i)),uf(t,r)?t:null}clear(){}refresh(){this.clear(),super.refresh()}},Io=class extends Tt{constructor(t,e){super(t),this.tile=e}},jf=qc;var Lo={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var $c=class n extends jf{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===n.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){let e=t.target,i=Y(e),r=e.getState(),s;r==k.LOADING?(this.tileLoadingKeys_[i]=!0,s=Lo.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=r==k.ERROR?Lo.TILELOADERROR:r==k.LOADED?Lo.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Io(s,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){let e=Bf(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;let e=t.join(`7-`);this.generateTileUrlFunction_?this.setTileUrlFunction(Vf(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}},Hf=$c;var Jc=class extends Hf{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:s_,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=t.tileClass!==void 0?t.tileClass:mo,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!An(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){let e=this.getProjection();if(this.tileGrid&&(!e||An(e,t)))return this.tileGrid;let i=Y(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=So(t)),this.tileGridForProjection[i]}createTile_(t,e,i,r,s,o){let a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,s),h=l?this.tileUrlFunction(l,r,s):void 0,c=new this.tileClass(a,h!==void 0?k.IDLE:k.EMPTY,h!==void 0?h:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(P.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,r,s,o){let a=this.getProjection();if(!a||!s||An(a,s))return this.getTileInternal(t,e,i,r,a||s);let l=[t,e,i],h=this.getKey(),c=this.getTileGridForProjection(a),u=this.getTileGridForProjection(s),f=this.getTileCoordForTileUrlFunction(l,s),g=new yo(a,c,s,u,l,f,this.getTilePixelRatio(r),this.getGutter(),(p,_,m,x)=>this.getTileInternal(p,_,m,x,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return g.key=h,g}getTileInternal(t,e,i,r,s,o){let a=this.getKey(),l=Zn(this,a,t,e,i);if(o&&o.containsKey(l))return o.get(l);let h=this.createTile_(t,e,i,r,s,a);return o?.set(l,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){let i=Et(t);if(i){let r=Y(i);r in this.tileGridForProjection||(this.tileGridForProjection[r]=e)}}};function s_(n,t){if(bt){let e=n.getCrossOrigin(),i="same-origin",r="same-origin";e==="anonymous"||e===""?(i="cors",r="omit"):e==="use-credentials"&&(i="cors",r="include");let s={mode:i,credentials:r,referrerPolicy:n.getReferrerPolicy()};fetch(t,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{let a=n.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}var qf=Jc;var Qc=class extends qf{constructor(t){t=t||{};let e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:Uf({extent:To(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}},$f=Qc;var Z=n=>document.querySelector(n),T={game:Z("#game-select"),map:Z("#map-select"),variant:Z("#variant-select"),variantField:Z("#variant-field"),gameTitle:Z("#game-title"),title:Z("#map-title"),meta:Z("#map-meta"),legend:Z("#legend"),search:Z("#pin-search"),searchResults:Z("#search-results"),visibleCount:Z("#visible-count"),viewport:Z("#map"),layers:Z("#layers"),zoneToggle:Z("#zone-toggle"),zoneCount:Z("#zone-count"),zoneIndex:Z("#zone-index"),zoneList:Z("#zone-list"),loading:Z("#map-loading"),labelsHint:Z("#labels-hint"),gridHint:Z("#grid-hint"),soloChip:Z("#solo-chip"),overview:Z("#overview"),overviewCanvas:Z("#overview-canvas"),overviewViewport:Z("#overview-viewport"),gridNavigator:Z("#grid-navigator"),gridInput:Z("#grid-input"),gridBack:Z("#grid-back"),detail:Z("#pin-detail"),detailTitle:Z("#detail-title"),detailCategory:Z("#detail-category"),detailDescription:Z("#detail-description"),detailID:Z("#detail-id"),detailCoordinates:Z("#detail-coordinates"),detailLinks:Z("#detail-links"),detailDot:Z("#detail-dot"),sidebar:Z("#sidebar"),mobileLegend:Z("#mobile-legend"),fatal:Z("#fatal-error"),fatalMessage:Z("#fatal-message")},Oo=["#d6f36b","#72d5f4","#ff9e64","#df83ff","#62e6ae","#ff6f91","#f4d35e","#8aa9ff","#e7a56d","#83d483"],Fi="0123456789bcdefghjkmnpqrstuvwxyz",o_=3,a_=2,d={catalog:null,game:null,map:null,variant:null,engine:null,projection:null,layers:null,sources:null,hiddenCategories:new Set,collapsedSections:new Set,pins:[],pinByID:new Map,selectedPin:null,hoveredPin:null,pinLabelsVisible:!1,gridEnabled:!1,gridPrefix:"",zonesVisible:!0,zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,search:"",fitZoom:0,zoneTitleCount:0,eligibleLocations:0,tileRun:0,tileStats:{requested:0,loaded:0,errors:0,peakPending:0},overviewRun:0,overviewKey:"",renderedShard:0,styleCache:new Map,markerIcons:new Map};async function l_(){h_();try{let n=await fetch("/static/catalog.json");if(!n.ok)throw new Error(`catalog request returned ${n.status}`);if(d.catalog=await n.json(),!d.catalog.games.length)throw new Error("the embedded catalog contains no maps");c_(),lh(T.game,d.catalog.games,"title");let t=ig();th(t.game||d.catalog.games[0].slug,t.map),Q_(),requestAnimationFrame(()=>T.viewport.focus({preventScroll:!0}))}catch(n){T.loading.hidden=!0,T.fatalMessage.textContent=n instanceof Error?n.message:String(n),T.fatal.hidden=!1}}function c_(){let n=d.catalog.tileGrid.size,t=[0,-n,n,0];d.projection=new mi({code:"ATLAS:PIXELS",units:"pixels",extent:t}),d.sources={grid:new Pi({wrapX:!1}),gridContext:new Pi({wrapX:!1}),zones:new Pi({wrapX:!1}),zoneTitles:new Pi({wrapX:!1}),text:new Pi({wrapX:!1}),pins:new Pi({wrapX:!1}),priority:new Pi({wrapX:!1})},d.layers={raster:new yc({zIndex:0}),rasterDetail:new yc({zIndex:1}),grid:new ee({source:d.sources.grid,style:Qf,renderOrder:be,renderBuffer:40,zIndex:5}),zones:new ee({source:d.sources.zones,style:K_,renderBuffer:32,zIndex:10}),zoneTitles:new ee({source:d.sources.zoneTitles,style:Z_,renderOrder:be,renderBuffer:160,zIndex:20}),zoneTitleDetail:new ee({source:d.sources.zoneTitles,style:B_,renderOrder:be,renderBuffer:160,zIndex:44}),text:new ee({source:d.sources.text,style:G_,renderOrder:be,renderBuffer:220,zIndex:30}),textDetail:new ee({source:d.sources.text,style:X_,renderOrder:be,renderBuffer:220,zIndex:45}),zoneText:new ee({source:d.sources.text,style:W_,renderOrder:be,renderBuffer:220,zIndex:41}),pins:new ee({source:d.sources.pins,style:F_,renderOrder:be,renderBuffer:48,zIndex:40}),zonePins:new ee({source:d.sources.pins,style:z_,renderOrder:be,renderBuffer:48,zIndex:42}),pinLabels:new ee({source:d.sources.pins,style:N_,renderOrder:be,renderBuffer:180,zIndex:45}),gridContext:new ee({source:d.sources.gridContext,style:Qf,renderOrder:be,renderBuffer:40,zIndex:48}),priority:new ee({source:d.sources.priority,style:Y_,renderOrder:be,renderBuffer:220,zIndex:50})},d.engine=new tf({target:T.viewport,layers:Object.values(d.layers),controls:Fs({attribution:!1,rotate:!1,zoom:!1}),interactions:Ys({onFocusOnly:!1}),view:eg(5)}),d.engine.on("movestart",()=>{d.engine.getViewport().classList.add("is-dragging")}),d.engine.on("moveend",()=>{d.engine.getViewport().classList.remove("is-dragging"),Hr()}),d.engine.on("postrender",nh),T.viewport.addEventListener("wheel",()=>{document.activeElement!==T.viewport&&T.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),d.engine.on("singleclick",e=>{if(d.gridEnabled){let r=d.engine.forEachFeatureAtPixel(e.pixel,s=>s.get("gridCell")||null,{hitTolerance:1,layerFilter:s=>s===d.layers.grid||s===d.layers.gridContext});if(r&&r.role!=="leaf"){rh(r.hash);return}}let i=d.engine.forEachFeatureAtPixel(e.pixel,(r,s)=>s!==d.layers.pins&&s!==d.layers.pinLabels&&s!==d.layers.text&&s!==d.layers.textDetail&&s!==d.layers.priority?null:r.get("pin")||null,{hitTolerance:5});i&&fg(i)}),d.engine.on("pointermove",e=>{if(e.dragging){Mo(null);return}let i=d.engine.forEachFeatureAtPixel(e.pixel,(o,a)=>a!==d.layers.pins&&a!==d.layers.pinLabels&&a!==d.layers.text&&a!==d.layers.textDetail&&a!==d.layers.priority?null:o.get("pin")||null,{hitTolerance:4,layerFilter:o=>o===d.layers.pins||o===d.layers.pinLabels||o===d.layers.text||o===d.layers.textDetail||o===d.layers.priority}),r=i?.category.displayType==="text"?null:i;Mo(r||null);let s=d.gridEnabled&&d.engine.hasFeatureAtPixel(e.pixel,{layerFilter:o=>o===d.layers.grid||o===d.layers.gridContext});d.engine.getTargetElement().style.cursor=i||s?"pointer":""}),d.engine.getViewport().addEventListener("pointerleave",()=>Mo(null))}function eg(n){let t=d.catalog.tileGrid.size;return new Qt({projection:d.projection,center:[t/2,-t/2],resolutions:sg(n),minZoom:0,maxZoom:n,extent:[0,-t,t,0],constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function h_(){T.game.addEventListener("change",()=>th(T.game.value)),T.map.addEventListener("change",()=>ng(Number(T.map.value))),T.variant.addEventListener("change",()=>rg(Number(T.variant.value))),T.legend.addEventListener("change",n=>{let t=n.target;if(t.dataset.group){A_(Number(t.dataset.group));return}if(!t.dataset.category)return;let e=Number(t.dataset.category);t.checked?d.hiddenCategories.delete(e):d.hiddenCategories.add(e),zi(),Jn()}),T.layers.addEventListener("click",n=>{let t=n.target.closest("[data-only-category], [data-only-group]");if(t){n.preventDefault(),n.stopPropagation(),M_(t.dataset.onlyCategory?{category:Number(t.dataset.onlyCategory)}:{group:Number(t.dataset.onlyGroup)});return}let e=n.target.closest("[data-section]");if(!e)return;let i=e.dataset.section;d.collapsedSections.has(i)?d.collapsedSections.delete(i):d.collapsedSections.add(i),lg()}),T.soloChip.addEventListener("click",()=>Po(!0)),Z("#show-all").addEventListener("click",()=>Po(!0)),Z("#hide-all").addEventListener("click",()=>Po(!1)),T.zoneToggle.addEventListener("change",()=>{ch(T.zoneToggle.checked)}),T.zoneIndex.addEventListener("click",n=>{let t=n.target.closest("[data-zone]");t&&S_(Number(t.dataset.zone))}),T.zoneIndex.addEventListener("contextmenu",n=>{let t=n.target.closest("[data-zone]");t&&(n.preventDefault(),T_(Number(t.dataset.zone)))}),T.search.addEventListener("input",()=>{d.search=T.search.value.trim().toLocaleLowerCase(),zi(),uh()}),T.searchResults.addEventListener("click",n=>{let t=n.target.closest("[data-location]");if(!t)return;let e=d.pinByID.get(Number(t.dataset.location));e&&Jf(e)}),T.detailLinks.addEventListener("click",n=>{let t=n.target.closest("[data-location]");if(!t)return;let e=d.pinByID.get(Number(t.dataset.location));e&&Jf(e)}),Z("#close-detail").addEventListener("click",Hn),Z("#zoom-in").addEventListener("click",()=>Ao(1)),Z("#zoom-out").addEventListener("click",()=>Ao(-1)),T.gridBack.addEventListener("click",ag),T.gridInput.addEventListener("input",()=>{let n=Do(),t=[...T.gridInput.value.toLocaleLowerCase()].filter(e=>Fi.includes(e)).slice(0,n).join("");T.gridInput.value=t,rh(t)}),T.viewport.addEventListener("keydown",n=>{if(!tg(n.target)){if(n.key==="+"||n.key==="=")Ao(1);else if(n.key==="-")Ao(-1);else if(n.key==="Escape")Hn();else return;n.preventDefault()}}),window.addEventListener("keydown",n=>{if(!tg(n.target)){if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),T.search.focus(),T.search.select();return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),__();return}x_(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),d.pinLabelsVisible=!d.pinLabelsVisible,T.labelsHint.textContent=`Z \xB7 labels ${d.pinLabelsVisible?"on":"off"}`,d.layers.pinLabels.changed())}}),window.addEventListener("hashchange",()=>{let n=ig();n.game===d.game?.slug&&n.map===d.map?.slug||th(n.game||d.catalog.games[0].slug,n.map)}),window.addEventListener("resize",()=>{d.engine?.updateSize(),nh()}),T.overview.addEventListener("pointerdown",n=>{n.preventDefault(),p_(n)}),T.mobileLegend.addEventListener("click",()=>{let n=T.sidebar.classList.toggle("is-open");T.mobileLegend.setAttribute("aria-expanded",String(n))})}function th(n,t){d.game=d.catalog.games.find(i=>i.slug===n)||d.catalog.games[0],T.game.value=d.game.slug,lh(T.map,d.game.maps,"title","id"),T.map.disabled=d.game.maps.length===1,T.map.title=T.map.disabled?"This game has one map":"Choose a map";let e=t&&d.game.maps.find(i=>i.slug===t);ng((e||d.game.maps[0]).id)}function ig(){let[n,t]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(e=>e.trim());return{game:n,map:t}}function u_(){if(!d.game||!d.map)return;let n=`#${d.game.slug}/${d.map.slug}`;location.hash!==n&&history.replaceState(null,"",n)}function ng(n){d.map=d.game.maps.find(t=>t.id===n)||d.game.maps[0],document.documentElement.style.setProperty("--icon-outset-color",fh()),T.map.value=String(d.map.id),lh(T.variant,d.map.variants,"name"),T.variantField.hidden=d.map.variants.length<2,d.styleCache.clear(),Mo(null),d.gridPrefix="",d.hiddenCategories.clear(),d.collapsedSections.clear(),d.collapsedSections.add("zones");for(let t of d.map.groups)for(let e of t.categories)e.visible||d.hiddenCategories.add(e.id);d.search="",T.search.value="",T.searchResults.hidden=!0,Hn(),E_(),cg(),v_(),rg(0,!0),T.gameTitle.textContent=d.game.title,T.title.textContent=d.map.title,T.meta.textContent=`${dn(d.map.pinCount)} locations \xB7 ${dn(d.map.zones?.length||0)} regions`,T.sidebar.classList.remove("is-open"),T.mobileLegend.setAttribute("aria-expanded","false"),u_()}function rg(n,t=!1){let e=d.variant;d.variant=d.map.variants[n]||d.map.variants[0];let i=d.variant,r=t?null:m_(e,i),s=$n(i);T.variant.value=String(d.map.variants.indexOf(d.variant)),t?d.engine.setView(eg(s)):(d.engine.getView().setMinZoom(i.minZoom),d.engine.getView().setMaxZoom(s));let o=++d.tileRun,a=0;d.tileStats={requested:0,loaded:0,errors:0,peakPending:0},T.loading.hidden=!1;let l=p=>{p.on("tileloadstart",()=>{d.tileRun===o&&(a++,d.tileStats.requested++,d.tileStats.peakPending=Math.max(d.tileStats.peakPending,a))});let _=m=>{d.tileRun===o&&(a=Math.max(0,a-1),m?d.tileStats.errors++:d.tileStats.loaded++,a===0&&d.tileStats.loaded>0&&(T.loading.hidden=!0))};return p.on("tileloadend",()=>_(!1)),p.on("tileloaderror",()=>_(!0)),p},h=(p,_)=>l(new $f({projection:d.projection,tileGrid:new jr({extent:[0,-d.catalog.tileGrid.size,d.catalog.tileGrid.size,0],origin:[0,0],resolutions:sg(p),tileSize:d.catalog.tileGrid.tileSize}),cacheSize:64,interpolate:i.interpolate,transition:0,wrapX:!1,tileUrlFunction:([m,x,E])=>{let C=i.formats[m];if(!(!C||x<0||E<0||!_(m,x,E)))return`/static/tiles/${encodeURIComponent(i.tiles)}/${m}/${x}/${E}.${C}`}})),c=i.fullZoom??i.maxZoom,u=h(c,(p,_,m)=>eh(i,p,_,m)),f=d.layers.raster.getSource();d.layers.raster.setSource(u),d.layers.raster.setExtent(un()),d.layers.raster.setBackground(i.background||void 0),f?.clear();let g=d.layers.rasterDetail.getSource();i.maxZoom>c?(d.layers.rasterDetail.setSource(h(i.maxZoom,(p,_,m)=>p>c&&eh(i,p,_,m))),d.layers.rasterDetail.setExtent(un()),d.layers.rasterDetail.setVisible(!0)):d.layers.rasterDetail.setVisible(!1),g?.clear(),sh(),d.gridEnabled&&(fn(),d.layers.pins.changed(),d.layers.text.changed(),d.layers.priority.changed()),d.overviewKey="",g_(),d.renderedShard!==(i.shard||0)&&(cg(),zi()),t?requestAnimationFrame(D_):(r&&d.engine.getView().animate({center:r,duration:200}),Hr())}function eh(n,t,e,i){let r=n.coverage?.[t];if(!r)return!0;let s=e-r.x,o=i-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=d_(n,t,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function d_(n,t,e){if(!e.decoded){let i=atob(e.bits),r=new Uint8Array(i.length);for(let s=0;s<i.length;s++)r[s]=i.charCodeAt(s);e.decoded=r}return e.decoded}function sg(n){let t=d.catalog.tileGrid.size/d.catalog.tileGrid.tileSize;return Array.from({length:n+1},(e,i)=>t/2**i)}function $n(n){return n.maxZoom+a_}var f_=168;function g_(){let n=d.variant,t=T.overviewCanvas,e=t.getContext("2d"),i=un(),r=d.catalog.tileGrid.size,s=d.catalog.tileGrid.tileSize,o=i[2]-i[0],a=i[3]-i[1],l=0;for(;l<n.fullZoom&&Math.max(o,a)/r*s*2**l<f_;)l++;let h=s*2**l/r;t.width=Math.max(1,Math.round(o*h)),t.height=Math.max(1,Math.round(a*h)),e.clearRect(0,0,t.width,t.height),n.background&&(e.fillStyle=n.background,e.fillRect(0,0,t.width,t.height));let c=++d.overviewRun,u=n.formats[l],f=Math.floor(i[0]/r*2**l),g=Math.ceil(i[2]/r*2**l),p=Math.floor(-i[3]/r*2**l),_=Math.ceil(-i[1]/r*2**l);for(let m=p;m<_;m++)for(let x=f;x<g;x++){if(!u||!eh(n,l,x,m))continue;let E=new Image;E.onload=()=>{d.overviewRun===c&&e.drawImage(E,x*s-i[0]*h,m*s+i[3]*h,s,s)},E.src=`/static/tiles/${encodeURIComponent(n.tiles)}/${l}/${x}/${m}.${u}`}nh()}function nh(){let n=d.engine?.getView();if(!n||!d.variant)return;let t=un(),e=n.calculateExtent(d.engine.getSize()),i=t[2]-t[0],r=t[3]-t[1],s=(n.getResolution()||0)*4,o=e[0]<=t[0]+s&&e[1]<=t[1]+s&&e[2]>=t[2]-s&&e[3]>=t[3]-s,a=o?"hidden":e.map(Math.round).join(",");if(a===d.overviewKey||(d.overviewKey=a,T.overview.hidden=o,o))return;let l=T.overviewCanvas,h=Di((e[0]-t[0])/i,0,1),c=Di((e[2]-t[0])/i,0,1),u=Di((t[3]-e[3])/r,0,1),f=Di((t[3]-e[1])/r,0,1),g=T.overviewViewport.style;g.left=`${h*l.width}px`,g.top=`${u*l.height}px`,g.width=`${Math.max(8,(c-h)*l.width)}px`,g.height=`${Math.max(8,(f-u)*l.height)}px`}function p_(n){let t=d.engine?.getView();if(!t||!d.variant)return;let e=T.overviewCanvas.getBoundingClientRect(),i=un(),r=(s,o,a)=>Di((s-o)/(a-o),0,1);t.animate({center:[i[0]+r(n.clientX,e.left,e.right)*(i[2]-i[0]),i[3]-r(n.clientY,e.top,e.bottom)*(i[3]-i[1])],duration:180})}function m_(n,t){if(!n||!t||!n.shard||!t.shard||n.shard===t.shard||!n.bounds||!t.bounds)return null;let i=d.engine?.getView()?.getCenter();if(!i)return null;let r=(i[0]-n.bounds.x)/n.bounds.width,s=(-i[1]-n.bounds.y)/n.bounds.height;return[t.bounds.x+Di(r,0,1)*t.bounds.width,-(t.bounds.y+Di(s,0,1)*t.bounds.height)]}function __(){let t=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");T.mobileLegend.setAttribute("aria-expanded",String(!t)),requestAnimationFrame(()=>d.engine?.updateSize())}function un(){let n=d.catalog.tileGrid.size,t=d.variant?.bounds||{x:0,y:0,width:n,height:n};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}function x_(n){return n.key.toLocaleLowerCase()==="g"?(n.preventDefault(),og(),!0):n.key==="Escape"&&d.gridEnabled?(n.preventDefault(),ag(),!0):!1}function og(n=!d.gridEnabled){d.gridEnabled=n,sh(),fn(),d.layers.pins.changed(),d.layers.text.changed(),d.layers.priority.changed()}function rh(n){let t=Do(),e=[...n.toLocaleLowerCase()].filter(r=>Fi.includes(r)).slice(0,t).join(""),i=e!==d.gridPrefix;d.gridPrefix=e,d.gridEnabled||(d.gridEnabled=!0),sh(),fn(),d.layers.pins.changed(),d.layers.text.changed(),d.layers.priority.changed(),i&&(Hn(),d.engine.getView().fit(ko(),{size:d.engine.getSize(),padding:[52,52,52,52],maxZoom:$n(d.variant),duration:180}))}function ag(){if(d.gridEnabled){if(!d.gridPrefix){og(!1);return}rh(d.gridPrefix.slice(0,-1))}}function sh(){if(!d.sources||(d.sources.grid.clear(),d.sources.gridContext.clear(),T.gridNavigator.hidden=!d.gridEnabled,T.gridHint.textContent=d.gridEnabled?`G \xB7 ${d.gridPrefix||"root"}`:"G \xB7 grid off",!d.gridEnabled||!d.variant))return;let n=Do();if(T.gridInput.maxLength=n,T.gridInput.value=d.gridPrefix,T.gridBack.title=d.gridPrefix?"Back one geohash level":"Close geohash grid",y_(),d.gridPrefix.length>=n){ih(d.gridPrefix,ko(),"leaf");return}for(let t of Fi){let e=d.gridPrefix+t;ih(e,oh(e),"child")}}function y_(){for(let n=0;n<d.gridPrefix.length;n++){let t=d.gridPrefix.slice(0,n),e=d.gridPrefix.slice(0,n+1);for(let i of Fi){let r=t+i;r!==e&&ih(r,oh(r),"neighbor",d.gridPrefix.length-n)}}}function ih(n,t,e,i=0){let[r,s,o,a]=t,l=d.pins.filter(u=>{if(u.filteredHidden)return!1;let[f,g]=u.coordinate;return f>=r&&f<=o&&g>=s&&g<=a}).length,h=new lr({geometry:new Ci([[[r,s],[r,a],[o,a],[o,s],[r,s]]]),gridCell:{hash:n,extent:t,role:e,count:l,contextDistance:i},priority:e==="neighbor"?-i*100+Fi.indexOf(n[n.length-1]):Fi.indexOf(n[n.length-1])});(e==="neighbor"?d.sources.gridContext:d.sources.grid).addFeature(h)}function ko(){return oh(d.gridPrefix)}function oh(n){let t=[...un()],e=!0;for(let i of n){let r=Fi.indexOf(i);if(!(r<0))for(let s of[16,8,4,2,1]){if(e){let o=(t[0]+t[2])/2;r&s?t[0]=o:t[2]=o}else{let o=(t[1]+t[3])/2;r&s?t[1]=o:t[3]=o}e=!e}}return t}function Do(){return o_}function ah(n){if(!d.gridEnabled||!d.gridPrefix)return!1;let t=ko(),[e,i]=n.coordinate;return e>=t[0]&&e<=t[2]&&i>=t[1]&&i<=t[3]}function lh(n,t,e,i){n.replaceChildren(),t.forEach((r,s)=>{let o=document.createElement("option");o.value=i?String(r[i]):r.slug||String(s),o.textContent=r[e],n.append(o)})}function E_(){let n=document.createDocumentFragment();for(let t of d.map.groups){if(!t.categories.length)continue;let e=document.createElement("section");e.className="layer-section",e.dataset.groupSection=String(t.id);let i=t.categories.reduce((s,o)=>s+o.locations.length,0);e.append(w_(`group-${t.id}`,t.title,i,t.id));let r=document.createElement("div");r.className="category-toggles";for(let s of t.categories)r.append(C_(s));e.append(r),n.append(e)}T.legend.replaceChildren(n),lg(),Jn()}function w_(n,t,e,i){let r=document.createElement("div");r.className="layer-header";let s=document.createElement("button");s.type="button",s.className="layer-title",s.dataset.section=n;let o=document.createElement("span");o.className="layer-chevron",o.setAttribute("aria-hidden","true"),o.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let a=document.createElement("span");a.textContent=t;let l=document.createElement("span");l.className="layer-count",l.textContent=dn(e),s.append(o,a,l);let h=document.createElement("button");h.type="button",h.className="only-button only-group",h.dataset.onlyGroup=String(i),h.textContent="only",h.title=`Show only ${t}`;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.group=String(i),u.setAttribute("aria-label",`Show ${t}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),r.append(s,h,c),r}function C_(n){let t=n.displayType==="text",e=document.createElement("label");e.className="category-row",gh(e,n);let i=document.createElement("input");i.type="checkbox",i.dataset.category=String(n.id),i.checked=!d.hiddenCategories.has(n.id);let r=document.createElement("span");t?(r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label"):(r.className="category-icon",ph(r,n,No(n.title)),r.title=n.icon||n.title);let s=document.createElement("span");s.className="category-name",s.textContent=n.title;let o=document.createElement("span");o.className="category-count",o.textContent=dn(n.locations.length);let a=document.createElement("button");return a.type="button",a.className="only-button",a.dataset.onlyCategory=String(n.id),a.textContent="only",a.title=`Show only ${n.title}`,e.append(i,r,s,a,o),e}function lg(){for(let n of T.layers.querySelectorAll("[data-section]")){let t=d.collapsedSections.has(n.dataset.section);n.setAttribute("aria-expanded",String(!t)),n.closest(".layer-section").classList.toggle("is-collapsed",t)}}function v_(){d.sources.pins.clear(),d.sources.text.clear(),d.sources.priority.clear(),d.pins=[],d.pinByID.clear();for(let n of d.map.groups)for(let t of n.categories){t.displayType!=="text"&&U_(t);for(let e of t.locations){let i={location:e,category:t,group:n,coordinate:hh(e.lat,e.lng),filteredHidden:!1,priority:H_(t,e),feature:null};i.feature=new lr({geometry:new wi(i.coordinate),pin:i,priority:i.priority}),d.pins.push(i),d.pinByID.set(e.id,i),t.displayType==="text"?d.sources.text.addFeature(i.feature):d.sources.pins.addFeature(i.feature)}}zi()}function cg(){let n=(d.map.zones||[]).filter(xg);d.renderedShard=d.variant?.shard||0,d.sources.zones.clear(),d.sources.zoneTitles.clear(),d.zoneRecords.clear(),d.highlightedZones.clear(),d.focusedZoneID=null,d.zoneTitleCount=0,ch(!0),T.zoneIndex.hidden=n.length===0,T.zoneCount.textContent=dn(n.length);for(let t of n){let e=ut(),i=[],r=!1;for(let l of t.features||[]){let h=I_(l);h&&(r=!0,i.push(h),fs(e,h.getExtent()),d.sources.zones.addFeature(new lr({geometry:h,zone:t,color:qn(t.id),child:t.parentRegionId!=null})))}if(!r)continue;let s=qn(t.id),o=t.center?hh(t.center.lat,t.center.lng):Bt(e),a=Math.max(e[2]-e[0],e[3]-e[1]);d.sources.zoneTitles.addFeature(new lr({geometry:new wi(o),zone:t,color:s,child:t.parentRegionId!=null,span:a,priority:(t.parentRegionId==null?2e6:1e6)+Math.round(a)})),d.zoneRecords.set(t.id,{zone:t,extent:e.slice(),geometries:i,color:s})}d.zoneTitleCount=d.sources.zoneTitles.getFeatures().length,b_()}function b_(){let n=document.createDocumentFragment();for(let{zone:t,depth:e}of R_()){let i=d.zoneRecords.get(t.id);if(!i)continue;let r=document.createElement("button");r.type="button",r.className="zone-index-item",r.dataset.zone=String(t.id),r.style.setProperty("--zone-color",i.color),r.style.setProperty("--zone-depth",String(e)),r.setAttribute("aria-pressed","false"),r.title=`${t.title}: click to jump; right-click to toggle highlight`;let s=document.createElement("span");s.className="zone-index-marker",s.setAttribute("aria-hidden","true");let o=document.createElement("span");o.textContent=t.title,r.append(s,o),n.append(r)}T.zoneList.replaceChildren(n),T.zoneIndex.hidden=d.zoneRecords.size===0}function R_(){let n=[...d.zoneRecords.values()].map(o=>o.zone),t=new Set(n.map(o=>o.id)),e=new Map;for(let o of n){let a=t.has(o.parentRegionId)?o.parentRegionId:null;e.has(a)||e.set(a,[]),e.get(a).push(o)}for(let o of e.values())o.sort((a,l)=>a.title.localeCompare(l.title,void 0,{numeric:!0,sensitivity:"base"}));let i=[],r=new Set,s=(o,a)=>{if(!r.has(o.id)){r.add(o.id),i.push({zone:o,depth:a});for(let l of e.get(o.id)||[])s(l,a+1)}};for(let o of e.get(null)||[])s(o,0);for(let o of n)s(o,0);return i}function ch(n){d.zonesVisible=n,T.zoneToggle.checked=n,d.layers.zones.setVisible(n),d.layers.zoneTitles.setVisible(n),d.layers.zoneTitleDetail.setVisible(n)}function S_(n){let t=d.zoneRecords.get(n);t&&(d.focusedZoneID=n,hg(),Hn(),d.engine.getView().fit(t.extent,{size:d.engine.getSize(),padding:[54,54,54,54],maxZoom:$n(d.variant),duration:220}),T.sidebar.classList.remove("is-open"),T.mobileLegend.setAttribute("aria-expanded","false"))}function T_(n){d.zoneRecords.has(n)&&(d.highlightedZones.has(n)?d.highlightedZones.delete(n):(d.highlightedZones.add(n),ch(!0)),d.hoveredPin=null,ug(),dg(),hg(),d.layers.zones.changed(),d.layers.zoneTitles.changed(),d.layers.zoneTitleDetail.changed())}function hg(){T.zoneIndex.classList.toggle("has-highlights",d.highlightedZones.size>0);for(let n of T.zoneList.querySelectorAll("[data-zone]")){let t=Number(n.dataset.zone),e=d.highlightedZones.has(t);n.classList.toggle("is-highlighted",e),n.classList.toggle("is-current",d.focusedZoneID===t),n.setAttribute("aria-pressed",String(e))}}function I_(n){if(!n?.coordinates)return null;let t=([e,i])=>hh(i,e);return n.type==="Polygon"?new Ci(n.coordinates.map(e=>e.map(t))):n.type==="MultiPolygon"?new nf(n.coordinates.map(e=>e.map(i=>i.map(t)))):null}function hh(n,t){let e=d.catalog.tileGrid,i=2**e.sourceZoom,r=(t+180)/360*i,s=n*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*i;return[(r-e.firstTile)*e.tileSize,-(o-e.firstTile)*e.tileSize]}function zi(){for(let n of d.pins){let t=d.hiddenCategories.has(n.category.id),e=d.search&&!n.location.title.toLocaleLowerCase().includes(d.search);n.filteredHidden=!!(t||e)}ug(),dg(),d.selectedPin?.filteredHidden&&Hn()}function ug(){if(!d.highlightedZones.size){for(let t of d.pins)t.insideHighlightedZone=!1;return}let n=[...d.highlightedZones].map(t=>d.zoneRecords.get(t)).filter(Boolean);for(let t of d.pins)t.insideHighlightedZone=n.some(e=>e.geometries.some(i=>L_(i,t.coordinate)))}function L_(n,t){if(n.intersectsCoordinate(t))return!0;let e=n.getClosestPoint(t),i=e[0]-t[0],r=e[1]-t[1];return i*i+r*r<=1}function dg(){d.eligibleLocations=d.pins.filter(n=>!Ke(n)).length,fn(),d.layers.pins.changed(),d.layers.zonePins.changed(),d.layers.pinLabels.changed(),d.layers.text.changed(),d.layers.zoneText.changed(),d.layers.textDetail.changed(),d.layers.priority.changed(),Hr()}function fn(){d.sources.priority.clear();for(let n of d.pins){if(Ke(n))continue;let t=!!d.search&&n.location.title.toLocaleLowerCase().includes(d.search);(n===d.selectedPin||n===d.hoveredPin||t||ah(n))&&d.sources.priority.addFeature(n.feature)}}function Mo(n){d.hoveredPin!==n&&(d.hoveredPin=n,d.sources&&(fn(),d.layers.pins.changed(),d.layers.priority.changed()))}function uh(){if(!d.search){T.searchResults.hidden=!0,T.searchResults.replaceChildren();return}let n=d.pins.filter(e=>!d.hiddenCategories.has(e.category.id)&&e.location.title.toLocaleLowerCase().includes(d.search)).sort((e,i)=>e.location.title.localeCompare(i.location.title)).slice(0,20),t=document.createDocumentFragment();if(!n.length){let e=document.createElement("p");e.className="search-empty",e.textContent="No visible locations match.",t.append(e)}for(let e of n){let i=document.createElement("button");i.type="button",i.className="search-result",i.dataset.location=String(e.location.id),gh(i,e.category);let r=document.createElement("span");r.className="result-dot",ph(r,e.category,No(e.category.title));let s=document.createElement("span"),o=document.createElement("strong");o.textContent=e.location.title;let a=document.createElement("small");a.textContent=`${e.category.title} \xB7 ${e.group.title}`,s.append(o,a),i.append(r,s),t.append(i)}T.searchResults.replaceChildren(t),T.searchResults.hidden=!1}function Po(n){if(d.hiddenCategories.clear(),!n)for(let t of d.map.groups)for(let e of t.categories)d.hiddenCategories.add(e.id);Fo(),zi(),uh(),Jn()}function Fo(){for(let n of document.querySelectorAll("[data-category]"))n.checked=!d.hiddenCategories.has(Number(n.dataset.category))}function A_(n){let t=d.map.groups.find(i=>i.id===n);if(!t)return;let e=t.categories.some(i=>!d.hiddenCategories.has(i.id));for(let i of t.categories)e?d.hiddenCategories.add(i.id):d.hiddenCategories.delete(i.id);Fo(),zi(),Jn()}function M_(n){if(d.map){if(P_(n)){Po(!0);return}d.hiddenCategories.clear();for(let t of d.map.groups){let e=n.group===t.id;for(let i of t.categories)!e&&n.category!==i.id&&d.hiddenCategories.add(i.id)}Fo(),zi(),uh(),Jn()}}function P_(n){for(let t of d.map.groups)for(let e of t.categories)if((n.group===t.id||n.category===e.id)===d.hiddenCategories.has(e.id))return!1;return!0}function O_(){let n=T.soloChip;if(!d.map){n.hidden=!0;return}let t=null,e=0,i=null,r=0;for(let o of d.map.groups){let a=0;for(let l of o.categories)d.hiddenCategories.has(l.id)||(a++,e++,t=l);a>0&&(r++,i=a===o.categories.length?o:null)}let s="";e===1&&t?s=t.title:r===1&&i&&(s=i.title),n.hidden=!s,n.textContent=s?`only: ${s}`:"",n.title=s?`Showing only ${s} \u2014 click to show everything`:""}function Jn(){if(d.map){for(let n of d.map.groups){let t=T.legend.querySelector(`input[data-group="${n.id}"]`);t&&(t.checked=n.categories.some(e=>!d.hiddenCategories.has(e.id)))}O_()}}function Jf(n){d.hiddenCategories.delete(n.category.id),d.search="",T.search.value="",T.searchResults.hidden=!0,Fo(),zi(),Jn(),fg(n,!0)}function fg(n,t=!1){if(d.selectedPin=n,fn(),d.layers.pins.changed(),d.layers.pinLabels.changed(),d.layers.text.changed(),d.layers.textDetail.changed(),d.layers.priority.changed(),T.detailTitle.textContent=n.location.title,T.detailCategory.textContent=`${n.group.title} / ${n.category.title}`,T.detailDescription.textContent=J_(n.location.description)||"No description is included in the archive.",T.detailID.textContent=String(n.location.id),T.detailCoordinates.textContent=`${n.location.lat.toFixed(6)}, ${n.location.lng.toFixed(6)}`,k_(n),gh(T.detailDot,n.category),ph(T.detailDot,n.category,No(n.category.title)),T.detail.hidden=!1,t){let e=d.engine.getView();e.animate({center:n.coordinate,zoom:Math.min($n(d.variant),Math.max(e.getZoom()||0,4)),duration:220})}}function k_(n){let t=(n.location.links||[]).filter(i=>d.pinByID.has(i.locationId));if(T.detailLinks.hidden=t.length===0,!t.length){T.detailLinks.replaceChildren();return}let e=document.createDocumentFragment();for(let i of t){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(i.locationId),r.textContent=i.title,e.append(r)}T.detailLinks.replaceChildren(e)}function Hn(){d.selectedPin=null,d.sources&&(fn(),d.layers.pins.changed(),d.layers.pinLabels.changed(),d.layers.text.changed(),d.layers.textDetail.changed(),d.layers.priority.changed()),T.detail.hidden=!0}function D_(){if(!d.engine||!d.variant)return;let n=d.engine.getView();n.fit(un(),{size:d.engine.getSize(),padding:[36,36,36,36],maxZoom:d.variant.maxZoom,duration:0}),d.fitZoom=n.getZoom()||0,Hr()}function Ao(n){let t=d.engine.getView(),e=t.getZoom()||0;t.animate({zoom:Di(e+n,d.variant.minZoom,$n(d.variant)),duration:140})}function Hr(){let n=d.engine?.getView().getZoom();if(T.viewport.dataset.zoom=Number.isFinite(n)?n.toFixed(3):"",!d.engine||!d.pins.length){T.visibleCount.textContent="0 locations visible";return}let t=d.engine.getView().calculateExtent(d.engine.getSize()),e=0;for(let i of d.pins){if(Ke(i))continue;let[r,s]=i.coordinate;r>=t[0]&&r<=t[2]&&s>=t[1]&&s<=t[3]&&e++}T.visibleCount.textContent=`${dn(d.eligibleLocations)} enabled \xB7 ${dn(e)} in view`}function be(n,t){return(n.get("priority")||0)-(t.get("priority")||0)}function F_(n){let t=n.get("pin");return!t||Ke(t)||t.insideHighlightedZone||qr(t)?null:dh(t,!1)}function z_(n){let t=n.get("pin");return!t||!d.highlightedZones.size||!t.insideHighlightedZone||Ke(t)||qr(t)?null:dh(t,!1)}function N_(n){let t=n.get("pin");return!t||Ke(t)||!d.pinLabelsVisible||!$r()?null:gg(t)}function G_(n){let t=n.get("pin");if(!t||Ke(t)||t.insideHighlightedZone||qr(t)||$r())return null;let e=d.fitZoom+Math.log2(q_(t.category));return(d.engine.getView().getZoom()||0)<e?null:zo(t,!1)}function X_(n){let t=n.get("pin");return!t||Ke(t)||t.insideHighlightedZone||qr(t)||!$r()?null:zo(t,!1)}function W_(n){let t=n.get("pin");return!t||!d.highlightedZones.size||!t.insideHighlightedZone||Ke(t)||qr(t)?null:zo(t,!1)}function Y_(n){let t=n.get("pin");if(!t||Ke(t))return null;if(t.category.displayType==="text")return zo(t,t===d.selectedPin);let e=dh(t,t===d.selectedPin);return t===d.hoveredPin||t===d.selectedPin?[e,gg(t)]:e}function dh(n,t){let e=`marker:${n.category.id}:${t?1:0}`;if(d.styleCache.has(e))return d.styleCache.get(e);let i=n.category.color||qn(n.category.id),r=t?2e7:n.priority,s=d.markerIcons.get(pg(n.category)),o;return s?o=new Mt({image:new an({src:s,width:t?36:31,height:t?36:31}),zIndex:r}):o=new Mt({text:new si({text:No(n.category.title),font:`900 ${t?15:13}px Inter, sans-serif`,fill:new _t({color:i}),stroke:new At({color:fh(),width:t?4:3})}),zIndex:r}),d.styleCache.set(e,o),o}function gg(n){let t=`marker-label:${n.location.id}`;if(d.styleCache.has(t))return d.styleCache.get(t);let e=new Mt({text:new si({text:n.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new _t({color:"#f4f6ed"}),stroke:new At({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new _t({color:"rgba(10,13,9,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:n.priority});return d.styleCache.set(t,e),e}function U_(n){if(!n.iconAsset)return;let t=pg(n);if(d.markerIcons.has(t))return;d.markerIcons.set(t,null);let e=new Image;e.onload=()=>{let i=document.createElement("canvas");i.width=64,i.height=64;let r=i.getContext("2d"),s=n.color||qn(n.id),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!n.iconPicture,a.drawImage(e,6,6,52,52),n.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let h=l.getContext("2d");h.drawImage(e,6,6,52,52),h.globalCompositeOperation="source-in",h.fillStyle=fh(),h.fillRect(0,0,64,64);for(let c=-3;c<=3;c++)for(let u=-3;u<=3;u++)u*u+c*c<=10&&r.drawImage(l,u,c);r.drawImage(o,0,0),d.markerIcons.set(t,i.toDataURL("image/png")),d.styleCache.delete(`marker:${n.id}:0`),d.styleCache.delete(`marker:${n.id}:1`),d.layers.pins.changed(),d.layers.zonePins.changed(),d.layers.priority.changed()},e.onerror=()=>d.markerIcons.set(t,!1),e.src=yg(n.iconAsset)}function pg(n){return`${n.iconAsset||""}:${n.color||qn(n.id)}:${d.map?.iconOutset||"light"}`}function fh(){return d.map?.iconOutset==="dark"?"rgba(7, 9, 7, 0.98)":"rgba(255, 255, 255, 0.96)"}function zo(n,t){let e=`text:${n.location.id}:${t?1:0}`;if(d.styleCache.has(e))return d.styleCache.get(e);let r=[new Mt({text:new si({text:n.location.title,font:`${t?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new _t({color:t?"#d6f36b":"#f3f5e9"}),stroke:new At({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new _t({color:t?"rgba(17,21,14,0.9)":"rgba(10,13,9,0.58)"}),backgroundStroke:t?new At({color:"#d6f36b",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:t?2e7:n.priority+3e6})];return d.styleCache.set(e,r),r}function Qf(n){let t=n.get("gridCell");if(!t)return null;let e=`grid:${t.hash}:${t.role}:${t.contextDistance}`;if(d.styleCache.has(e))return d.styleCache.get(e);let i=Oo[Math.max(0,Fi.indexOf(t.hash[t.hash.length-1]))%Oo.length],r=t.role==="leaf",s=t.role==="neighbor",o=new Mt({fill:new _t({color:s?`rgba(3, 5, 3, ${Math.min(.52,.3+t.contextDistance*.06)})`:ki(i,r?.14:.055)}),stroke:new At({color:r?"#ffffff":ki(i,s?.44:.82),width:r?2.5:s?1:1.4}),text:new si({text:t.hash,font:`${r?"900 17px":s?"750 11px":"800 13px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new _t({color:r?"#ffffff":s?ki(i,.72):i}),stroke:new At({color:"rgba(0,0,0,0.96)",width:4}),backgroundFill:new _t({color:s?"rgba(4,6,4,0.88)":"rgba(9,12,8,0.76)"}),padding:s?[2,4,2,4]:[3,5,3,5],overflow:!0}),zIndex:r?100:n.get("priority")});return d.styleCache.set(e,o),o}function K_(n){if(!d.zonesVisible)return null;let t=n.get("zone"),e=n.get("child"),i=d.highlightedZones.has(t.id),r=_g(t.id),s=`zone:${t.id}:${e?1:0}:${i?1:r?2:0}`;if(d.styleCache.has(s))return d.styleCache.get(s);let o=n.get("color");if(r){let h=new Mt({fill:new _t({color:`rgba(3, 5, 3, ${e?.38:.32})`}),stroke:new At({color:ki(o,e?.24:.32),width:e?1:1.3,lineDash:e?[3,4]:[7,5]}),zIndex:e?101:100});return d.styleCache.set(s,h),h}let a=new Mt({fill:new _t({color:ki(o,e?.035:.07)}),stroke:new At({color:ki(o,e?.5:.72),width:e?1.2:1.8,lineDash:e?[3,4]:[7,5]})});if(!i)return d.styleCache.set(s,a),a;let l=[new Mt({stroke:new At({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Mt({fill:new _t({color:ki(o,.22)}),stroke:new At({color:o,width:2.6}),zIndex:9001})];return d.styleCache.set(s,l),l}function Z_(n){if(!d.zonesVisible||$r())return null;let t=n.get("child"),e=d.highlightedZones.has(n.get("zone").id),i=d.engine.getView().getZoom()||0;if(!e&&t&&i<d.fitZoom+3)return null;let r=n.get("span")/d.engine.getView().getResolution();return!e&&d.zoneTitleCount>40&&r<52?null:mg(n)}function B_(n){return!d.zonesVisible||!$r()?null:mg(n)}function mg(n){let t=n.get("child"),e=n.get("zone"),i=d.highlightedZones.has(e.id),r=_g(e.id),s=`zone-title:${e.id}:${t?1:0}:${i?1:r?2:0}`;if(d.styleCache.has(s))return d.styleCache.get(s);let o=n.get("color"),a=new Mt({text:new si({text:e.title.toLocaleUpperCase(),font:`${t?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new _t({color:i?"#11140f":r?"rgba(185,192,177,0.56)":t?"#c7ccbd":"#f1f4e7"}),stroke:new At({color:i?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:i?2:r?3:4}),backgroundFill:new _t({color:i?o:r?"rgba(4,6,4,0.84)":"rgba(11,14,10,0.72)"}),backgroundStroke:new At({color:i?"#ffffff":ki(o,r?.24:.55),width:i?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:i?91e5:n.get("priority")});return d.styleCache.set(s,a),a}function _g(n){if(!d.highlightedZones.size||d.highlightedZones.has(n))return!1;for(let t of d.highlightedZones)if(V_(n,t))return!1;return!0}function V_(n,t){let e=new Set,i=d.zoneRecords.get(t)?.zone.parentRegionId;for(;i!=null&&!e.has(i);){if(i===n)return!0;e.add(i),i=d.zoneRecords.get(i)?.zone.parentRegionId}return!1}function qr(n){return n===d.selectedPin||n===d.hoveredPin||ah(n)||!!d.search&&n.location.title.toLocaleLowerCase().includes(d.search)}function Ke(n){return n.filteredHidden||j_(n)||!xg(n.location)}function xg(n){let t=d.variant?.shard;return!t||!n.shard||n.shard===t}function j_(n){return!d.highlightedZones.size||n.insideHighlightedZone||n===d.selectedPin?!1:!(d.search&&n.location.title.toLocaleLowerCase().includes(d.search))}function H_(n,t){return Math.max(0,1e6-Math.min(n.locations.length,999)*1e3)+$_(t.id)%1e3}function q_(n){return n.locations.length>200?4:n.locations.length>75?2.5:1}function $r(){return(d.engine?.getView().getZoom()||0)>=(d.variant?.maxZoom||0)-.05}function $_(n){return Math.imul(Number(n)||0,2654435761)>>>0}function qn(n){let t=Math.abs(Number(n)||0);return Oo[(Math.imul(t,2654435761)>>>0)%Oo.length]}function ki(n,t){let e=String(n||"#ffffff").replace("#",""),i=e.length===3?e.split("").map(s=>s+s).join(""):e.slice(0,6).padEnd(6,"f"),r=Number.parseInt(i,16);return`rgba(${r>>16&255}, ${r>>8&255}, ${r&255}, ${t})`}function gh(n,t){n.style.setProperty("--pin-color",t.color||qn(t.id))}function ph(n,t,e){if(n.classList.remove("has-source-icon"),n.style.removeProperty("--pin-icon"),n.textContent="",!t.iconAsset){n.textContent=e;return}n.style.setProperty("--pin-icon",`url("${yg(t.iconAsset)}")`),n.classList.add("has-source-icon")}function yg(n){return`/static/icons/${n.split("/").map(e=>encodeURIComponent(e)).join("/")}`}function No(n){return n.split(/\s+/).slice(0,2).map(t=>t[0]||"").join("")}function J_(n){return String(n||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`5+`).reduce(Dm,[]),{width:p,height:_,widths:m,heights:x,lineWidths:E}=Dd(l,g),C=p+f,y=[],w=(C+2)*c[0],S=(_+f)*c[1],A={width:w<0?Math.floor(w):Math.ceil(w),height:S<0?Math.floor(S):Math.ceil(S),contextInstructions:y};(c[0]!=1||c[1]!=1)&&y.push("scale",c),r&&(y.push("strokeStyle",o.strokeStyle),y.push("lineWidth",f),y.push("lineCap",o.lineCap),y.push("lineJoin",o.lineJoin),y.push("miterLimit",o.miterLimit),y.push("setLineDash",[o.lineDash]),y.push("lineDashOffset",o.lineDashOffset)),i&&y.push("fillStyle",a.fillStyle),y.push("textBaseline","middle"),y.push("textAlign","center");let R=.5-u,T=u*C+R*f,I=[],z=[],G=0,F=0,V=0,lt=0,M;for(let X=0,O=g.length;X<O;X+=2){let $=g[X];if($===`6+`){F+=G,G=0,T=u*C+R*f,++lt;continue}let N=g[X+1]||l.font;N!==M&&(r&&I.push("font",N),i&&z.push("font",N),M=N),G=Math.max(G,x[V]);let tt=[$,T+R*m[V]+u*(m[V]-E[lt]),.5*(f+G)+F];T+=m[V],r&&I.push("strokeText",tt),i&&z.push("fillText",tt),++V}return Array.prototype.push.apply(y,I),Array.prototype.push.apply(y,z),this.labels_[s]=A,A}replayTextBackground_(t,e,i,r,s,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,r),t.lineTo.apply(t,s),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,r,s,o,a,l,h,c,u,f,g,p,_,m){a*=f[0],l*=f[1];let x=i-a,E=r-l,C=s+h>t?t-h:s,y=o+c>e?e-c:o,w=p[3]+C*f[0]+p[1],S=p[0]+y*f[1]+p[2],A=x-p[3],R=E-p[0];(_||u!==0)&&(Li[0]=A,Ai[0]=A,Li[1]=R,ci[1]=R,ci[0]=A+w,hi[0]=ci[0],hi[1]=R+S,Ai[1]=hi[1]);let T;return u!==0?(T=kt(Lt(),i,r,1,1,u,-i,-r),dt(T,Li),dt(T,ci),dt(T,hi),dt(T,Ai),Jt(Math.min(Li[0],ci[0],hi[0],Ai[0]),Math.min(Li[1],ci[1],hi[1],Ai[1]),Math.max(Li[0],ci[0],hi[0],Ai[0]),Math.max(Li[1],ci[1],hi[1],Ai[1]),Vn)):Jt(Math.min(A,A+w),Math.min(R,R+S),Math.max(A,A+w),Math.max(R,R+S),Vn),g&&(x=Math.round(x),E=Math.round(E)),{drawImageX:x,drawImageY:E,drawImageW:C,drawImageH:y,originX:h,originY:c,declutterBox:{minX:Vn[0],minY:Vn[1],maxX:Vn[2],maxY:Vn[3],value:m},canvasTransform:T,scale:f}}replayImageOrLabel_(t,e,i,r,s,o,a){let l=!!(o||a),h=r.declutterBox,c=a?a[2]*r.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,Li,ci,hi,Ai,o,a),Fd(t,r.canvasTransform,s,i,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(t){let e=this.alignAndScaleFill_;if(e){let i=dt(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(i[0]%r,i[1]%r),e!==1&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,r){let s=this.textStates[e],o=this.createLabel(t,e,r,i),a=this.strokeStates[i],l=this.pixelRatio,h=Pc(Array.isArray(t)?t[0]:t,s.textAlign||Ii),c=Br[s.textBaseline||on],u=a&&a.lineWidth?a.lineWidth:0,f=o.width/l-2*s.scale[0],g=h*f+2*(.5-h)*u,p=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:g,anchorY:p}}execute_(t,e,i,r,s,o,a,l){let h=this.zIndexContext_,c;this.pixelCoordinates_&&zt(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=Vt(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),xu(this.renderedTransform_,i));let u=0,f=r.length,g=0,p,_=[],m,x,E,C,y,w,S,A,R,T,I,z,G,F=0,V=0,lt=this.coordinateCache_,M=this.viewRotation_,X=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,O={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:M},$=this.instructions!=r||this.overlaps?0:200,N,tt,it,wt;for(;u<f;){let L=r[u];switch(L[0]){case D.BEGIN_GEOMETRY:N=L[1],wt=L[3],N.getGeometry()?a!==void 0&&!ht(a,wt.getExtent())?u=L[2]+1:++u:u=L[2],h&&(h.zIndex=L[4]);break;case D.BEGIN_PATH:F>$&&(this.fill_(t),F=0),V>$&&(t.stroke(),V=0),!F&&!V&&(t.beginPath(),y=NaN,w=NaN),++u;break;case D.CIRCLE:g=L[1],E=L[2]??0;let Ct=c[g],ot=c[g+1],Re=c[g+2]-E,Ni=c[g+3]-E,ne=Re-Ct,Qn=Ni-ot,Jr=Math.sqrt(ne*ne+Qn*Qn);t.moveTo(Ct+Jr,ot),t.arc(Ct,ot,Jr,0,2*Math.PI,!0),++u;break;case D.CLOSE_PATH:t.closePath(),++u;break;case D.CUSTOM:g=L[1],p=L[2];let Gi=L[3],Xi=L[4],gn=L[5];O.geometry=Gi,O.feature=N,u in lt||(lt[u]=[]);let Ze=lt[u];gn?gn(c,g,p,2,Ze):(Ze[0]=c[g],Ze[1]=c[g+1],Ze.length=2),h&&(h.zIndex=L[6]),Xi(Ze,O),++u;break;case D.DRAW_IMAGE:g=L[1],p=L[2],R=L[3],m=L[4],x=L[5];let pn=L[6],tr=L[7],er=L[8],Qr=L[9],ui=L[10],ir=L[11],Eg=L[12],ts=L[13];C=L[14]||"declutter";let nr=L[15];if(!R&&L.length>=20){T=L[19],I=L[20],z=L[21],G=L[22];let vt=this.drawLabelWithPointPlacement_(T,I,z,G);R=vt.label,L[3]=R;let Se=L[23];m=(vt.anchorX-Se)*this.pixelRatio,L[4]=m;let re=L[24];x=(vt.anchorY-re)*this.pixelRatio,L[5]=x,pn=R.height,L[6]=pn,ts=R.width,L[13]=ts}let Go;L.length>25&&(Go=L[25]);let Xo,es,is;L.length>17?(Xo=L[16],es=L[17],is=L[18]):(Xo=ni,es=null,is=null),ui&&X?ir+=M:!ui&&!X&&(ir-=M);let wg=0;for(;g<p;g+=2){if(Go&&Go[wg++]<ts/this.pixelRatio)continue;let vt=this.calculateImageOrLabelDimensions_(R.width,R.height,c[g],c[g+1],ts,pn,m,x,er,Qr,ir,Eg,s,Xo,!!es||!!is,N),Se=[t,e,R,vt,tr,es,is];if(l){let re,Te,se;if(nr){let gt=p-g;if(!nr[gt]){nr[gt]={args:Se,declutterMode:C};continue}let Ut=nr[gt];re=Ut.args,Te=Ut.declutterMode,delete nr[gt],se=Rf(re)}let Be,Ve;if(re&&(Te!=="declutter"||!l.collides(se))&&(Be=!0),(C!=="declutter"||!l.collides(vt.declutterBox))&&(Ve=!0),Te==="declutter"&&C==="declutter"){let gt=Be&&Ve;Be=gt,Ve=gt}Be&&(Te!=="none"&&l.insert(se),this.replayImageOrLabel_.apply(this,re)),Ve&&(C!=="none"&&l.insert(vt.declutterBox),this.replayImageOrLabel_.apply(this,Se))}else this.replayImageOrLabel_.apply(this,Se)}++u;break;case D.DRAW_CHARS:let mh=L[1],_h=L[2],Wo=L[3],Cg=L[4];G=L[5];let vg=L[6],xh=L[7],yh=L[8];z=L[9];let Yo=L[10];T=L[11],Array.isArray(T)&&(T=T.reduce(Fm,"")),I=L[12];let Eh=[L[13],L[13]];C=L[14]||"declutter";let bg=L[15],wh=L[16],Uo=this.textStates[I],rr=Uo.font,sr=[Uo.scale[0]*xh,Uo.scale[1]*xh],or;rr in this.widths_?or=this.widths_[rr]:(or={},this.widths_[rr]=or);let Ch=vf(c,mh,_h,2),vh=Math.abs(sr[0])*Dl(rr,T,or);if(Cg||vh<=Ch){let vt=this.textStates[I].textAlign,Se=(Ch-vh)*Pc(T,vt),re=bf(c,mh,_h,2,T,Se,vg,Math.abs(sr[0]),Dl,rr,or,X?0:this.viewRotation_,bg);t:if(re){let Te=[],se,Be,Ve,gt,Ut;if(z)for(se=0,Be=re.length;se<Be;++se){Ut=re[se],Ve=Ut[4],gt=this.createLabel(Ve,I,"",z),m=Ut[2]+(sr[0]<0?-Yo:Yo)-wh,x=Wo*gt.height+(.5-Wo)*2*Yo*sr[1]/sr[0]-yh;let je=this.calculateImageOrLabelDimensions_(gt.width,gt.height,Ut[0],Ut[1],gt.width,gt.height,m,x,0,0,Ut[3],Eh,!1,ni,!1,N);if(l&&C==="declutter"&&l.collides(je.declutterBox))break t;Te.push([t,e,gt,je,1,null,null])}if(G)for(se=0,Be=re.length;se<Be;++se){Ut=re[se],Ve=Ut[4],gt=this.createLabel(Ve,I,G,""),m=Ut[2]-wh,x=Wo*gt.height-yh;let je=this.calculateImageOrLabelDimensions_(gt.width,gt.height,Ut[0],Ut[1],gt.width,gt.height,m,x,0,0,Ut[3],Eh,!1,ni,!1,N);if(l&&C==="declutter"&&l.collides(je.declutterBox))break t;Te.push([t,e,gt,je,1,null,null])}l&&C!=="none"&&l.load(Te.map(Rf));for(let je=0,Rg=Te.length;je<Rg;++je)this.replayImageOrLabel_.apply(this,Te[je])}}++u;break;case D.END_GEOMETRY:if(o!==void 0){N=L[1];let vt=o(N,wt,C);if(vt)return vt}++u;break;case D.FILL:$?F++:this.fill_(t),++u;break;case D.MOVE_TO_LINE_TO:g=L[1],p=L[2],E=L[3];let Wi,ar,ns;if(E){let Se=(L[4]??!1)||Math.abs(c[g]-c[p-2])<1e-6&&Math.abs(c[g+1]-c[p-1])<1e-6;vo(c,g,p,2,E,Se,_),bo(_,2,Se),Wi=_,ar=0,ns=Wi.length}else Wi=c,ar=g,ns=p;tt=Wi[ar],it=Wi[ar+1],t.moveTo(tt,it),y=tt+.5|0,w=it+.5|0;for(let vt=ar+2;vt<ns;vt+=2)tt=Wi[vt],it=Wi[vt+1],S=tt+.5|0,A=it+.5|0,(vt==ns-2||S!==y||A!==w)&&(t.lineTo(tt,it),y=S,w=A);++u;break;case D.SET_FILL_STYLE:this.alignAndScaleFill_=L[2],F?(this.fill_(t),F=0,V&&(t.stroke(),V=0)):V&&L[1]&&(t.stroke(),V=0),t.fillStyle=L[1],++u;break;case D.SET_STROKE_STYLE:F&&L[1]&&(this.fill_(t),F=0),V&&(t.stroke(),V=0),this.setStrokeStyle_(t,L),++u;break;case D.STROKE:$?V++:t.stroke(),++u;break;default:++u;break}}F&&this.fill_(t),V&&t.stroke()}execute(t,e,i,r,s,o){this.viewRotation_=r,this.execute_(t,e,i,this.instructions,s,void 0,void 0,o)}executeHitDetection(t,e,i,r,s){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,r,s)}},Tf=Oc;var Mi=["Polygon","Circle","LineString","Image","Text","Default"],Fc=["Image","Text"],If=Mi.filter(n=>!Fc.includes(n)),Lf=!1,Af=!1;function zm(){let n=0,t=i=>{let r=nt(1,1,null,{willReadFrequently:i}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return n=s>n?s:n,s};Lf={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[n],Af=!0}var Dc=class{constructor(t,e,i,r,s,o,a){this.maxExtent_=t,this.overlaps_=r,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Lt(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(t,e){let i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(let i in t){let r=this.executorsByZIndex_[i];r===void 0&&(r={},this.executorsByZIndex_[i]=r);let s=t[i];for(let o in s){let a=s[o];r[o]=new Tf(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(let e in this.executorsByZIndex_){let i=this.executorsByZIndex_[e];for(let r=0,s=t.length;r<s;++r)if(t[r]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,r,s,o){Af===!1&&zm(),r=Math.round(r);let a=r*2+1,l=kt(this.hitDetectionTransform_,r+.5,r+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=nt(a,a,null,{willReadFrequently:Lf}));let c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=ut(),Bi(u,t),En(u,e*(this.renderBuffer_+r),u));let f=Nm(r),g;function p(w,S,A){let R=c.getImageData(0,0,a,a).data;for(let T=0,I=f.length;T<I;T++)if(R[f[T]]>0){if(!o||A==="none"||g!=="Image"&&g!=="Text"||o.includes(w)){let z=(f[T]-3)/4,G=r-z%a,F=r-(z/a|0),V=s(w,S,G*G+F*F);if(V)return V}c.clearRect(0,0,a,a);break}}let _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(Zt);let m,x,E,C,y;for(m=_.length-1;m>=0;--m){let w=_[m].toString();for(E=this.executorsByZIndex_[w],x=Mi.length-1;x>=0;--x)if(g=Mi[x],C=E[g],C!==void 0&&(y=C.executeHitDetection(c,l,i,p,u),y))return y}}getClipCoords(t){let e=this.maxExtent_;if(!e)return null;let i=e[0],r=e[1],s=e[2],o=e[3],a=[i,r,i,o,s,o,s,r];return Vt(a,0,8,2,t,a),a}isEmpty(){return de(this.executorsByZIndex_)}execute(t,e,i,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Rh:Zt),o=o||Mi;let h=Mi.length;for(let c=0,u=l.length;c<u;++c){let f=l[c].toString(),g=this.executorsByZIndex_[f];for(let p=0,_=o.length;p<_;++p){let m=o[p],x=g[m];if(x!==void 0){let E=a===null?void 0:x.getZIndexContext(),C=E?E.getContext():t,y=this.maxExtent_&&m!=="Image"&&m!=="Text";if(y&&(C.save(),this.clip(C,i)),!E||m==="Text"||m==="Image"?x.execute(C,e,i,r,s,a):E.pushFunction(w=>x.execute(w,e,i,r,s,a)),y&&C.restore(),E){E.offset();let w=l[c]*h+Mi.indexOf(m);this.deferredZIndexContexts_[w]||(this.deferredZIndexContexts_[w]=[]),this.deferredZIndexContexts_[w].push(E)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Zt);for(let i=0,r=e.length;i<r;++i)t[e[i]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),t[e[i]].length=0}},kc={};function Nm(n){if(kc[n]!==void 0)return kc[n];let t=n*2+1,e=n*n,i=new Array(e+1);for(let s=0;s<=n;++s)for(let o=0;o<=n;++o){let a=s*s+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+s)*t+(n+o))*4+3),s>0&&l.push(((n-s)*t+(n+o))*4+3),o>0&&(l.push(((n+s)*t+(n-o))*4+3),s>0&&l.push(((n-s)*t+(n-o))*4+3))}let r=[];for(let s=0,o=i.length;s<o;++s)i[s]&&r.push(...i[s]);return kc[n]=r,r}var Mf=Dc;var zc=class extends Co{constructor(t,e,i,r,s,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=r,this.transformRotation_=r?Ui(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Lt()}drawImages_(t,e,i,r){if(!this.image_)return;let s=Vt(t,e,i,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=s.length;c<u;c+=2){let f=s[c]-this.imageAnchorX_,g=s[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let p=f+this.imageAnchorX_,_=g+this.imageAnchorY_;kt(a,p,_,1,1,h,-p,-_),o.save(),o.transform.apply(o,a),o.translate(p,_),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,f,g,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=Vt(t,e,i,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=r){let l=s[e]+this.textOffsetX_,h=s[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,i,r,s,o){let a=this.context_,l=Vt(t,e,i,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let c=l.length,u=s||Math.abs(l[0]-l[c-2])<1e-6&&Math.abs(l[1]-l[c-1])<1e-6;l=vo(l,0,c,2,o,u,l),bo(l,2,u)}a.moveTo(l[0],l[1]);let h=l.length;s&&(h-=2);for(let c=2;c<h;c+=2)a.lineTo(l[c],l[c+1]);return s&&a.closePath(),i}drawRings_(t,e,i,r,s){for(let o=0,a=i.length;o<a;++o)e=this.moveToLineTo_(t,e,i[o],r,!0,s);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let e=Su(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],r=e[3]-e[1],s=Math.sqrt(i*i+r*r),o=this.context_;o.beginPath(),o.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break;default:}}drawFeature(t,e){let i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){let e=t.getGeometriesArray();for(let i=0,r=e.length;i<r;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(this.text_!==""){let e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let e=t.getExtent();if(ht(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let i=this.context_,r=t.getFlatCoordinates(),s=0,o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);i.stroke()}if(this.text_!==""){let i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){let e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let e=this.context_,i=t.getOrientedFlatCoordinates(),r=0,s=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=s.length;a<l;++a){let h=s[a];r=this.drawRings_(i,r,h,o,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){let e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){let e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){let e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),zt(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){let e=this.context_,i=this.contextTextState_,r=t.textAlign?t.textAlign:Ii;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=r&&(i.textAlign=r,e.textAlign=r),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=r,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:r,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{let i=t.getColor();this.fillState_={fillStyle:jt(i||St)}}if(!e)this.strokeState_=null;else{let i=e.getColor(),r=e.getLineCap(),s=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=s||Ht,u=e.getOffset();this.strokeState_={lineCap:r!==void 0?r:Ge,lineDash:this.pixelRatio_===1?c:c.map(f=>f*this.pixelRatio_),lineDashOffset:(o||qt)*this.pixelRatio_,lineJoin:a!==void 0?a:Xe,lineWidth:(l!==void 0?l:ri)*this.pixelRatio_,miterLimit:h!==void 0?h:ii,strokeStyle:jt(i||Yt),strokeOffset:(u??0)*this.pixelRatio_}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}let i=t.getPixelRatio(this.pixelRatio_),r=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*i,this.imageAnchorY_=r[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();let o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{let e=t.getFill();if(!e)this.textFillState_=null;else{let g=e.getColor();this.textFillState_={fillStyle:jt(g||St)}}let i=t.getStroke();if(!i)this.textStrokeState_=null;else{let g=i.getColor(),p=i.getLineCap(),_=i.getLineDash(),m=i.getLineDashOffset(),x=i.getLineJoin(),E=i.getWidth(),C=i.getMiterLimit();this.textStrokeState_={lineCap:p!==void 0?p:Ge,lineDash:_||Ht,lineDashOffset:m||qt,lineJoin:x!==void 0?x:Xe,lineWidth:E!==void 0?E:ri,miterLimit:C!==void 0?C:ii,strokeStyle:jt(g||Yt)}}let r=t.getFont(),s=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),f=t.getTextBaseline();this.textState_={font:r!==void 0?r:io,textAlign:u!==void 0?u:Ii,textBaseline:f!==void 0?f:on},this.text_=c!==void 0?Array.isArray(c)?c.reduce((g,p,_)=>g+=_%2?" ":p,""):c:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}},Pf=zc;var ve=.5;function Of(n,t,e,i,r,s,o,a,l){let h=l?xi(r,l):r,c=n[0]*ve,u=n[1]*ve,f=nt(c,u);f.imageSmoothingEnabled=!1;let g=f.canvas,p=new Pf(f,ve,r,null,o,a,l?Hi($i(),l):null),_=e.length,m=Math.floor((256*256*256-1)/_),x={};for(let C=1;C<=_;++C){let y=e[C-1],w=y.getStyleFunction()||i;if(!w)continue;let S=w(y,s);if(!S)continue;Array.isArray(S)||(S=[S]);let R=(C*m).toString(16).padStart(7,"#00000");for(let T=0,I=S.length;T<I;++T){let z=S[T],G=z.getGeometryFunction()(y);if(!G||!ht(h,G.getExtent()))continue;let F=z.clone(),V=F.getFill();V&&V.setColor(R);let lt=F.getStroke();lt&&(lt.setColor(R),lt.setLineDash(null)),F.setText(void 0);let M=z.getImage();if(M){let N=M.getImageSize();if(!N)continue;let tt=nt(N[0],N[1],void 0,{alpha:!1}),it=tt.canvas;tt.fillStyle=R,tt.fillRect(0,0,it.width,it.height),F.setImage(new an({img:it,anchor:M.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:M.getOrigin(),opacity:1,size:M.getSize(),scale:M.getScale(),rotation:M.getRotation(),rotateWithView:M.getRotateWithView()}))}let X=F.getZIndex()||0,O=x[X];O||(O={},x[X]=O,O.Polygon=[],O.Circle=[],O.LineString=[],O.Point=[]);let $=G.getType();if($==="GeometryCollection"){let N=G.getGeometriesArrayRecursive();for(let tt=0,it=N.length;tt<it;++tt){let wt=N[tt];O[wt.getType().replace("Multi","")].push(wt,F)}}else O[$.replace("Multi","")].push(G,F)}}let E=Object.keys(x).map(Number).sort(Zt);for(let C=0,y=E.length;C<y;++C){let w=x[E[C]];for(let S in w){let A=w[S];for(let R=0,T=A.length;R<T;R+=2){p.setStyle(A[R+1]);for(let I=0,z=t.length;I<z;++I)p.setTransform(t[I]),p.drawGeometry(A[R])}}}return f.getImageData(0,0,g.width,g.height)}function kf(n,t,e){let i=[];if(e){let r=Math.floor(Math.round(n[0])*ve),s=Math.floor(Math.round(n[1])*ve),o=(et(r,0,e.width-1)+et(s,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],c=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);c&&c%u===0&&i.push(t[c/u-1])}return i}var Gm=.5,Df={Point:Bm,LineString:Um,Polygon:jm,MultiPoint:Vm,MultiLineString:Km,MultiPolygon:Zm,GeometryCollection:Ym,Circle:Xm};function Ff(n,t){return parseInt(Y(n),10)-parseInt(Y(t),10)}function Nc(n,t){let e=Gc(n,t);return e*e}function Gc(n,t){return Gm*n/t}function Xm(n,t,e,i,r){let s=e.getFill(),o=e.getStroke();if(s||o){let l=n.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(t,i,r)}let a=e.getText();if(a&&a.getText()){let l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,r)}}function Xc(n,t,e,i,r,s,o,a){let l=[],h=e.getImage();if(h){let f=!0,g=h.getImageState();g==W.LOADED||g==W.ERROR?f=!1:g==W.IDLE&&h.load(),f&&l.push(h.ready())}let c=e.getFill();c&&c.loading()&&l.push(c.ready());let u=l.length>0;return u&&Promise.all(l).then(()=>r(null)),Wm(n,t,e,i,s,o,a),u}function Wm(n,t,e,i,r,s,o){let a=e.getGeometryFunction()(t);if(!a)return;let l=a.simplifyTransformed(i,r);if(e.getRenderer())zf(n,l,e,t,o);else{let c=Df[l.getType()];c(n,l,e,t,o,s)}}function zf(n,t,e,i,r){if(t.getType()=="GeometryCollection"){let o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)zf(n,o[a],e,i,r);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),r)}function Ym(n,t,e,i,r,s){let o=t.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let h=Df[o[a].getType()];h(n,o[a],e,i,r,s)}}function Um(n,t,e,i,r){let s=e.getStroke();if(s){let a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(t,i,r)}let o=e.getText();if(o&&o.getText()){let a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,r)}}function Km(n,t,e,i,r){let s=e.getStroke();if(s){let a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(t,i,r)}let o=e.getText();if(o&&o.getText()){let a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,r)}}function Zm(n,t,e,i,r){let s=e.getFill(),o=e.getStroke();if(o||s){let l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(t,i,r)}let a=e.getText();if(a&&a.getText()){let l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,r)}}function Bm(n,t,e,i,r,s){let o=e.getImage(),a=e.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=W.LOADED)return;let c=n.getBuilder(e.getZIndex(),"Image");c.setImageStyle(o,h),c.drawPoint(t,i,r)}if(l){let c=n.getBuilder(e.getZIndex(),"Text");c.setTextStyle(a,h),c.drawText(t,i,r)}}function Vm(n,t,e,i,r,s){let o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),h=l&&l.getText(),c=s&&a&&h?{}:void 0;if(a){if(o.getImageState()!=W.LOADED)return;let u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,c),u.drawMultiPoint(t,i,r)}if(h){let u=n.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,c),u.drawText(t,i,r)}}function jm(n,t,e,i,r){let s=e.getFill(),o=e.getStroke();if(s||o){let l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(t,i,r)}let a=e.getText();if(a&&a.getText()){let l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,r)}}var Wc=class extends wo{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=ut(),this.wrappedRenderedExtent_=ut(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){let r=e.extent,s=e.viewState,o=s.center,a=s.resolution,l=s.projection,h=s.rotation,c=l.getExtent(),u=this.getLayer().getSource(),f=this.getLayer().getDeclutter(),g=e.pixelRatio,p=e.viewHints,_=!(p[Rt.ANIMATING]||p[Rt.INTERACTING]),m=this.context,x=Math.round(j(r)/a*g),E=Math.round(ct(r)/a*g),C=u.getWrapX()&&l.canWrapX(),y=C?j(c):null,w=C?Math.ceil((r[2]-c[2])/y)+(this.extendX_?2:1):1,S=C?Math.floor((r[0]-c[0])/y)-(this.extendX_?1:0):0;do{let A=this.getRenderTransform(o,a,0,g,x,E,S*y);e.declutter&&(A=A.slice(0)),t.execute(m,[m.canvas.width,m.canvas.height],A,h,_,i===void 0?Mi:i?Fc:If,i?f&&e.declutter[f]:void 0)}while(++S<w)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=nt(this.context.canvas.width,this.context.canvas.height,gc))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,Ji(this.context),gc.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){let i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;let r=t.viewState;this.prepareContainer(t,e);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Dt.PRERENDER)||this.getLayer().hasListener(Dt.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,t);let l=r.projection;this.clipExtent_=null;let h=!1;if(a&&i.extent&&this.clipping){let c=ye(i.extent,l);a=ht(c,t.extent),a&&!Pe(c,t.extent)&&(t.declutter?this.clipExtent_=c:(this.clipUnrotated(s,t,c),h=!0))}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),h&&s.restore(),this.postRender(s,t),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let i=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*ve,f=i[1]*ve;c.push(this.getRenderTransform(r,s,o,ve,u,f,0).slice());let g=h.getSource(),p=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!Pe(p,l)){let m=l[0],x=j(p),E=0,C;for(;m<p[0];)--E,C=x*E,c.push(this.getRenderTransform(r,s,o,ve,u,f,C).slice()),m+=x;for(E=0,m=l[2];m>p[2];)++E,C=x*E,c.push(this.getRenderTransform(r,s,o,ve,u,f,C).slice()),m-=x}let _=$i();this.hitDetectionImageData_=Of(i,c,this.renderedFeatures_,h.getStyleFunction(),l,s,o,Nc(s,this.renderedPixelRatio_),_?a:null)}e(kf(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,r,s){if(!this.replayGroup_)return;let o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(f,g,p){let _=Y(f),m=h[_];if(m){if(m!==!0&&p<m.distanceSq){if(p===0)return h[_]=!0,s.splice(s.lastIndexOf(m),1),r(f,l,g);m.geometry=g,m.distanceSq=p}}else{if(p===0)return h[_]=!0,r(f,l,g);s.push(h[_]={feature:f,layer:l,geometry:g,distanceSq:p,callback:r})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,c,u?e.declutter?.[u]?.all().map(f=>f.value):null)}handleFontsChanged(){let t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){let e=this.getLayer(),i=e.getSource();if(!i)return!1;let r=t.viewHints[Rt.ANIMATING],s=t.viewHints[Rt.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,f=t.pixelRatio,g=e.getRevision(),p=e.getRenderBuffer(),_=e.getRenderOrder();_===void 0&&(_=Ff);let m=h.center.slice(),x=En(l,p*u),E=x.slice(),C=[x.slice()],y=c.getExtent(),w=i.getWrapX()&&c.canWrapX();if(this.extendX_=!1,w){let M=i.getExtent();M&&!ke(M)&&(this.extendX_=M[0]<y[0]||M[2]>y[2])}if(w&&(!Pe(y,t.extent)||this.extendX_)){let M=j(y),X=Math.max(j(x)/2,M),O=y[0],$=y[2];this.extendX_&&(O-=M,$+=M),x[0]=O-X,x[2]=$+X,ms(m,c);let N=la(C[0],c);N[0]<y[0]&&N[2]<y[2]?C.push([N[0]+M,N[1],N[2]+M,N[3]]):N[0]>y[0]&&N[2]>y[2]&&C.push([N[0]-M,N[1],N[2]-M,N[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===f&&this.renderedRevision_==g&&this.renderedRenderOrder_==_&&this.renderedFrameDeclutter_===!!t.declutter&&Pe(this.wrappedRenderedExtent_,x))return zt(this.renderedExtent_,E)||(this.hitDetectionImageData_=null,this.renderedExtent_=E),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let S=new Cf(Gc(u,f),x,u,f),A=$i(),R;if(A){for(let M=0,X=C.length;M<X;++M){let O=C[M],$=xi(O,c);i.loadFeatures($,_u(u,c),A)}R=Hi(A,c)}else for(let M=0,X=C.length;M<X;++M)i.loadFeatures(C[M],u,c);let T=Nc(u,f),I=!0,z=(M,X)=>{let O,$=M.getStyleFunction()||e.getStyleFunction();if($&&(O=$(M,u)),O){let N=this.renderFeature(M,T,O,S,R,this.getLayer().getDeclutter(),X);I=I&&!N}},G=xi(x,c),F=i.getFeaturesInExtent(G);_&&F.sort(_);for(let M=0,X=F.length;M<X;++M)z(F[M],M);this.renderedFeatures_=F,this.ready=I;let V=S.finish(),lt=new Mf(x,u,f,i.getOverlaps(),V,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=g,this.renderedRenderOrder_=_,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=E,this.wrappedRenderedExtent_=x,this.renderedCenter_=m,this.renderedProjection_=c,this.renderedPixelRatio_=f,this.replayGroup_=lt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,r,s,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let h=0,c=i.length;h<c;++h)l=Xc(r,t,i[h],e,this.boundHandleStyleImageChange_,s,o,a)||l;else l=Xc(r,t,i,e,this.boundHandleStyleImageChange_,s,o,a);return l}},Nf=Wc;var Yc=class extends uo{constructor(t){super(t)}createRenderer(){return new Nf(this)}},ee=Yc;var Hm=!1;function qm(n,t,e,i,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(e,i,r):n,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Hm,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let h=t.getType();try{let c;h=="text"||h=="json"?c=a.responseText:h=="xml"?c=a.responseXML||a.responseText:h=="arraybuffer"&&(c=a.response),c?s(t.readFeatures(c,{extent:e,featureProjection:r}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Uc(n,t){return function(e,i,r,s,o){qm(n,t,e,i,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function Gf(n,t){return[[-1/0,-1/0,1/0,1/0]]}function Kc(n,t,e,i,r,s,o){let a,l,h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=r;else if(h!==0){let c=n[t],u=n[t+1],f=0,g=[0];for(let m=t+i;m<e;m+=i){let x=n[m],E=n[m+1];f+=Math.sqrt((x-c)*(x-c)+(E-u)*(E-u)),g.push(f),c=x,u=E}let p=r*f,_=bh(g,p);_<0?(l=(p-g[-_-2])/(g[-_-1]-g[-_-2]),a=t+(-_-2)*i):a=t+_*i}o=o>1?o:2,s=s||new Array(o);for(let c=0;c<o;++c)s[c]=a===void 0?NaN:l===void 0?n[a+c]:Nt(n[a+c],n[a+i+c],l);return s}var Xf=Lt(),Vr=class n{constructor(t,e,i,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?ds(this.flatCoordinates_):wn(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let t=Bt(this.getExtent());this.flatInteriorPoints_=vr(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let t=Wu(this.flatCoordinates_,this.ends_),e=go(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=Ls(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Kc(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let t=this.flatCoordinates_,e=0,i=this.ends_;for(let r=0,s=i.length;r<s;++r){let o=i[r],a=Kc(t,e,o,this.stride_,.5);fe(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=Et(t);let e=t.getExtent(),i=t.getWorldExtent();if(e&&i){let r=ct(i)/ct(e);kt(Xf,i[0],i[3],r,-r,0,0,0),Vt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Xf,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new n(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=rs((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);let i=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":i.length=wr(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),r=[i.length];break;case"MultiLineString":r=[],i.length=zu(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,r);break;case"Polygon":r=[],i.length=Cr(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,r);break;default:}return r&&(this.simplifiedGeometry_=new n(this.type_,i,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};Vr.prototype.getFlatCoordinates=Vr.prototype.getOrientedFlatCoordinates;var hn=Vr;var Zc=class{constructor(t){this.rbush_=new en(t),this.items_={}}insert(t,e){let i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[Y(e)]=i}load(t,e){let i=new Array(e.length);for(let r=0,s=e.length;r<s;r++){let o=t[r],a=e[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[r]=l,this.items_[Y(a)]=l}this.rbush_.load(i)}remove(t){let e=Y(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){let i=this.items_[Y(e)],r=[i.minX,i.minY,i.maxX,i.maxY];Zi(r,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){let e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(r){return r.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let r=0,s=t.length;r<s;r++)if(i=e(t[r]),i)return i;return i}isEmpty(){return de(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){let e=this.rbush_.toJSON();return Jt(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(let e in t.items_)this.items_[e]=t.items_[e]}},Bc=Zc;var Vc=class extends xt{constructor(t){super(),this.projection=Et(t.projection),this.attributions_=Wf(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;let e=this;this.viewPromise_=new Promise(function(i,r){e.viewResolver=i,e.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}ready(){let t=this.getState();return t==="ready"?Promise.resolve():t==="error"?Promise.reject(new Error("Source failed to load")):new Promise((e,i)=>{let r=()=>{let s=this.getState();s==="ready"?(this.un("change",r),e()):s==="error"&&(this.un("change",r),i(new Error("Source failed to load")))};this.on("change",r)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=Wf(t),this.changed()}setState(t){this.state_=t,this.changed()}};function Wf(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}var Ro=Vc;var ie={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Ue=class extends Tt{constructor(t,e,i){super(t),this.feature=e,this.features=i}},jc=class extends Ro{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=$e,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(B(this.format_,"`format` must be set when `url` is set"),this.loader_=Uc(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Gf;let e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Bc:null,this.loadedExtentsRtree_=new Bc,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,r;Array.isArray(t.features)?r=t.features:t.features&&(i=t.features,r=i.getArray()),!e&&i===void 0&&(i=new Pt(r)),r!==void 0&&this.addFeaturesInternal(r),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){let e=Y(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);let i=t.getGeometry();if(i){let r=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Ue(ie.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof hn||(this.featureChangeKeys_[t]=[K(e,P.CHANGE,this.handleFeatureChange_,this),K(e,ue.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){let r=String(e.getId());if(!(r in this.idIndex_))this.idIndex_[r]=e;else if(e instanceof hn){let s=this.idIndex_[r];s instanceof hn?Array.isArray(s)?s.push(e):this.idIndex_[r]=[s,e]:i=!1}else i=!1}return i&&(B(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){let e=[],i=[],r=[];for(let s=0,o=t.length;s<o;s++){let a=t[s],l=Y(a);this.addToIndex_(l,a)&&i.push(a)}for(let s=0,o=i.length;s<o;s++){let a=i[s],l=Y(a);this.setupChangeEvents_(l,a);let h=a.getGeometry();if(h){let c=h.getExtent();e.push(c),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,r),this.hasListener(ie.ADDFEATURE))for(let s=0,o=i.length;s<o;s++)this.dispatchEvent(new Ue(ie.ADDFEATURE,i[s]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(ie.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(ie.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(It.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(It.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(let i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(J);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(i=>{this.removeFeatureInternal(i)});for(let i in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let e=new Ue(ie.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){let i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(r){let s=r.getGeometry();if(s instanceof hn||s.intersectsCoordinate(t))return e(r)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){let r=i.getGeometry();if(r instanceof hn||r.intersectsExtent(t)){let s=e(i);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),de(this.nullGeometryFeatures_)||fe(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){let e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);let r=ps(t,e);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){let i=t[0],r=t[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return e=e||He,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){let c=h.getGeometry(),u=a;if(a=c instanceof hn?0:c.closestPointXY(i,r,o,a),a<u){s=h;let f=Math.sqrt(a);l[0]=i-f,l[1]=r-f,l[2]=i+f,l[3]=r+f}}}),s}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){let e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){let e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){let e=t.target,i=Y(e),r=e.getGeometry();if(!r)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{let o=r.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}let s=e.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Ue(ie.CHANGEFEATURE,e))}hasFeature(t){let e=t.getId();if(e!==void 0){let i=this.idIndex_[String(e)];return Array.isArray(i)?i.includes(t):i===t}return Y(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&de(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){let r=this.loadedExtentsRtree_,s=this.strategy_(t,e,i);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(c){return Pe(c.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Ue(ie.FEATURESLOADSTART));let c=p=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Ue(ie.FEATURESLOADEND,void 0,p))},u=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Ue(ie.FEATURESLOADERROR))},f=!1,g=this.loader_.call(this,l,e,i,p=>f||c(p),()=>f||u());g instanceof Promise?(f=!0,g.then(p=>{this.addFeatures(p),c(p)}).catch(u)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){let e=this.loadedExtentsRtree_,i=[];e.forEachInExtent(t,function(r){i.push(r)}),i.forEach(r=>{e.remove(r);let s=aa(r.extent,t);for(let o of s)e.insert(o,{extent:o})})}removeFeatures(t){let e=!1;for(let i=0,r=t.length;i<r;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){let e=Y(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[e]?.forEach(J),delete this.featureChangeKeys_[e];let r=t.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===t?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[e],this.hasListener(ie.REMOVEFEATURE)&&this.dispatchEvent(new Ue(ie.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(let e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){B(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Uc(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}},Pi=jc;var jn=[0,0,0],Oi=5,Hc=class{constructor(t){let e=t.minZoom,i=t.resolutions;e===void 0&&i&&(e=i.findIndex(o=>o!==void 0)),this.minZoom=e!==void 0?e:0,this.resolutions_=i,B(Th(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!t.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,B(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=t.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=ae(s)),B(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,B(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:256,B(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.tileRanges!==void 0?this.fullTileRanges_=t.tileRanges:t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((o,a)=>{let l=new xo(Math.min(0,o[0]),Math.max(o[0]-1,-1),Math.min(0,o[1]),Math.max(o[1]-1,-1));if(s){let h=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(h.minX,l.minX),l.maxX=Math.min(h.maxX,l.maxX),l.minY=Math.max(h.minY,l.minY),l.maxY=Math.min(h.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(t,e,i){let r=this.getTileRangeForExtentAndZ(t,e);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)i([e,s,a])}forEachTileCoordParentTileRange(t,e,i,r){let s,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,r);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=ln(o,o,a,a,i)):s=this.getTileRangeForExtentAndZ(l,h,i),e(h,s))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){let s=t[1]*2,o=t[2]*2;return ln(s,s+1,o,o+1,e)}let r=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;let r=t[0],s=t[1],o=t[2];if(e===r)return ln(s,o,s,o,i);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,e-r),h=Math.floor(s*l),c=Math.floor(o*l);if(e<r)return ln(h,h,c,c,i);let u=Math.floor(l*(s+1))-1,f=Math.floor(l*(o+1))-1;return ln(h,u,c,f,i)}let a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,jn);let r=jn[1],s=jn[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,jn);let o=jn[1],a=jn[2];return ln(r,o,s,a,i)}getTileCoordCenter(t){let e=this.getOrigin(t[0]),i=this.getResolution(t[0]),r=pt(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*r[0]*i,e[1]-(t[2]+.5)*r[1]*i]}getTileCoordExtent(t,e){let i=this.getOrigin(t[0]),r=this.getResolution(t[0]),s=pt(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*s[0]*r,a=i[1]-(t[2]+1)*s[1]*r,l=o+s[0]*r,h=a+s[1]*r;return Jt(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,r,s){let o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=pt(this.getTileSize(o),this.tmpSize_),c=a*(t-l[0])/i/h[0],u=a*(l[1]-e)/i/h[1];return r?(c=dr(c,Oi)-1,u=dr(u,Oi)-1):(c=ur(c,Oi),u=ur(u,Oi)),Kn(o,c,u,s)}getTileCoordForXYAndZ_(t,e,i,r,s){let o=this.getOrigin(i),a=this.getResolution(i),l=pt(this.getTileSize(i),this.tmpSize_),h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return r?(h=dr(h,Oi)-1,c=dr(c,Oi)-1):(h=ur(h,Oi),c=ur(c,Oi)),Kn(i,h,c,s)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){let i=_n(this.resolutions_,t,e||0);return et(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Ma(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){let e=this.resolutions_.length,i=new Array(e);for(let r=this.minZoom;r<e;++r)i[r]=this.getTileRangeForExtentAndZ(t,r);this.fullTileRanges_=i}},jr=Hc;function So(n){let t=n.getDefaultTileGrid();return t||(t=Jm(n),n.setDefaultTileGrid(t)),t}function Yf(n,t,e){let i=t[0],r=n.getTileCoordCenter(t),s=To(e);if(!me(s,r)){let o=j(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,n.getTileCoordForCoordAndZ(r,i)}return t}function $m(n,t,e,i){i=i!==void 0?i:"top-left";let r=Kf(n,t,e);return new jr({extent:n,origin:Gh(n,i),resolutions:r,tileSize:e})}function Uf(n){let t=n||{},e=t.extent||Et("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Kf(e,t.maxZoom,t.tileSize,t.maxResolution)};return new jr(i)}function Kf(n,t,e,i){t=t!==void 0?t:42,e=pt(e!==void 0?e:256);let r=ct(n),s=j(n);i=i>0?i:Math.max(s/e[0],r/e[1]);let o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function Jm(n,t,e,i){let r=To(n);return $m(r,t,e,i)}function To(n){n=Et(n);let t=n.getExtent();if(!t){let e=180*Je.degrees/n.getMetersPerUnit();t=Jt(-e,-e,e,e)}return t}var Qm=/\{z\}/g,t_=/\{x\}/g,e_=/\{y\}/g,i_=/\{-y\}/g;function Zf(n,t,e,i,r){return n.replace(Qm,t.toString()).replace(t_,e.toString()).replace(e_,i.toString()).replace(i_,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-i).toString()})}function Bf(n){let t=[],e=/\{([a-z])-([a-z])\}/.exec(n);if(e){let i=e[1].charCodeAt(0),r=e[2].charCodeAt(0),s;for(s=i;s<=r;++s)t.push(n.replace(e[0],String.fromCharCode(s)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(n),e){let i=parseInt(e[2],10);for(let r=parseInt(e[1],10);r<=i;r++)t.push(n.replace(e[0],r.toString()));return t}return t.push(n),t}function n_(n,t){return(function(e,i,r){if(!e)return;let s,o=e[0];if(t){let a=t.getFullTileRange(o);a&&(s=a.getHeight()-1)}return Zf(n,o,e[1],e[2],s)})}function Vf(n,t){let e=n.length,i=new Array(e);for(let r=0;r<e;++r)i[r]=n_(n[r],t);return r_(i)}function r_(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;let r=hf(t),s=Me(r,n.length);return n[s](t,e,i)})}var qc=class extends Ro{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;let e=[256,256];this.tileGrid&&pt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||Y(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){let e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,r,s,o){return H()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:So(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){let r=this.getTileGridForProjection(i),s=this.getTilePixelRatio(e),o=pt(r.getTileSize(t),this.tmpSize);return s==1?o:Cd(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){let i=e!==void 0?e:this.getProjection(),r=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=Yf(r,t,i)),uf(t,r)?t:null}clear(){}refresh(){this.clear(),super.refresh()}},Io=class extends Tt{constructor(t,e){super(t),this.tile=e}},jf=qc;var Lo={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var $c=class n extends jf{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===n.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){let e=t.target,i=Y(e),r=e.getState(),s;r==k.LOADING?(this.tileLoadingKeys_[i]=!0,s=Lo.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=r==k.ERROR?Lo.TILELOADERROR:r==k.LOADED?Lo.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Io(s,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){let e=Bf(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;let e=t.join(`7+`);this.generateTileUrlFunction_?this.setTileUrlFunction(Vf(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}},Hf=$c;var Jc=class extends Hf{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:s_,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=t.tileClass!==void 0?t.tileClass:mo,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!An(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){let e=this.getProjection();if(this.tileGrid&&(!e||An(e,t)))return this.tileGrid;let i=Y(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=So(t)),this.tileGridForProjection[i]}createTile_(t,e,i,r,s,o){let a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,s),h=l?this.tileUrlFunction(l,r,s):void 0,c=new this.tileClass(a,h!==void 0?k.IDLE:k.EMPTY,h!==void 0?h:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(P.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,r,s,o){let a=this.getProjection();if(!a||!s||An(a,s))return this.getTileInternal(t,e,i,r,a||s);let l=[t,e,i],h=this.getKey(),c=this.getTileGridForProjection(a),u=this.getTileGridForProjection(s),f=this.getTileCoordForTileUrlFunction(l,s),g=new yo(a,c,s,u,l,f,this.getTilePixelRatio(r),this.getGutter(),(p,_,m,x)=>this.getTileInternal(p,_,m,x,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return g.key=h,g}getTileInternal(t,e,i,r,s,o){let a=this.getKey(),l=Zn(this,a,t,e,i);if(o&&o.containsKey(l))return o.get(l);let h=this.createTile_(t,e,i,r,s,a);return o?.set(l,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){let i=Et(t);if(i){let r=Y(i);r in this.tileGridForProjection||(this.tileGridForProjection[r]=e)}}};function s_(n,t){if(bt){let e=n.getCrossOrigin(),i="same-origin",r="same-origin";e==="anonymous"||e===""?(i="cors",r="omit"):e==="use-credentials"&&(i="cors",r="include");let s={mode:i,credentials:r,referrerPolicy:n.getReferrerPolicy()};fetch(t,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{let a=n.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}var qf=Jc;var Qc=class extends qf{constructor(t){t=t||{};let e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:Uf({extent:To(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}},$f=Qc;var Z=n=>document.querySelector(n),b={game:Z("#game-select"),map:Z("#map-select"),variant:Z("#variant-select"),variantField:Z("#variant-field"),gameTitle:Z("#game-title"),title:Z("#map-title"),meta:Z("#map-meta"),legend:Z("#legend"),search:Z("#pin-search"),searchResults:Z("#search-results"),visibleCount:Z("#visible-count"),viewport:Z("#map"),layers:Z("#layers"),zoneToggle:Z("#zone-toggle"),zoneCount:Z("#zone-count"),zoneIndex:Z("#zone-index"),zoneList:Z("#zone-list"),loading:Z("#map-loading"),labelsHint:Z("#labels-hint"),gridHint:Z("#grid-hint"),soloChip:Z("#solo-chip"),overview:Z("#overview"),overviewCanvas:Z("#overview-canvas"),overviewViewport:Z("#overview-viewport"),gridNavigator:Z("#grid-navigator"),gridInput:Z("#grid-input"),gridBack:Z("#grid-back"),detail:Z("#pin-detail"),detailTitle:Z("#detail-title"),detailCategory:Z("#detail-category"),detailDescription:Z("#detail-description"),detailID:Z("#detail-id"),detailCoordinates:Z("#detail-coordinates"),detailLinks:Z("#detail-links"),detailDot:Z("#detail-dot"),sidebar:Z("#sidebar"),mobileLegend:Z("#mobile-legend"),fatal:Z("#fatal-error"),fatalMessage:Z("#fatal-message")},Oo=["#d6f36b","#72d5f4","#ff9e64","#df83ff","#62e6ae","#ff6f91","#f4d35e","#8aa9ff","#e7a56d","#83d483"],Fi="0123456789bcdefghjkmnpqrstuvwxyz",o_=3,a_=2,d={catalog:null,game:null,map:null,variant:null,engine:null,projection:null,layers:null,sources:null,hiddenCategories:new Set,collapsedSections:new Set,pins:[],pinByID:new Map,selectedPin:null,hoveredPin:null,pinLabelsVisible:!1,gridEnabled:!1,gridPrefix:"",zonesVisible:!0,zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,search:"",fitZoom:0,zoneTitleCount:0,eligibleLocations:0,tileRun:0,tileStats:{requested:0,loaded:0,errors:0,peakPending:0},overviewRun:0,overviewKey:"",renderedShard:0,styleCache:new Map,markerIcons:new Map};async function l_(){h_();try{let n=await fetch("/static/catalog.json");if(!n.ok)throw new Error(`catalog request returned ${n.status}`);if(d.catalog=await n.json(),!d.catalog.games.length)throw new Error("the embedded catalog contains no maps");c_(),lh(b.game,d.catalog.games,"title");let t=ig();th(t.game||d.catalog.games[0].slug,t.map),Q_(),requestAnimationFrame(()=>b.viewport.focus({preventScroll:!0}))}catch(n){b.loading.hidden=!0,b.fatalMessage.textContent=n instanceof Error?n.message:String(n),b.fatal.hidden=!1}}function c_(){let n=d.catalog.tileGrid.size,t=[0,-n,n,0];d.projection=new mi({code:"ATLAS:PIXELS",units:"pixels",extent:t}),d.sources={grid:new Pi({wrapX:!1}),gridContext:new Pi({wrapX:!1}),zones:new Pi({wrapX:!1}),zoneTitles:new Pi({wrapX:!1}),text:new Pi({wrapX:!1}),pins:new Pi({wrapX:!1}),priority:new Pi({wrapX:!1})},d.layers={raster:new yc({zIndex:0}),rasterDetail:new yc({zIndex:1}),grid:new ee({source:d.sources.grid,style:Qf,renderOrder:be,renderBuffer:40,zIndex:5}),zones:new ee({source:d.sources.zones,style:K_,renderBuffer:32,zIndex:10}),zoneTitles:new ee({source:d.sources.zoneTitles,style:Z_,renderOrder:be,renderBuffer:160,zIndex:20}),zoneTitleDetail:new ee({source:d.sources.zoneTitles,style:B_,renderOrder:be,renderBuffer:160,zIndex:44}),text:new ee({source:d.sources.text,style:G_,renderOrder:be,renderBuffer:220,zIndex:30}),textDetail:new ee({source:d.sources.text,style:X_,renderOrder:be,renderBuffer:220,zIndex:45}),zoneText:new ee({source:d.sources.text,style:W_,renderOrder:be,renderBuffer:220,zIndex:41}),pins:new ee({source:d.sources.pins,style:F_,renderOrder:be,renderBuffer:48,zIndex:40}),zonePins:new ee({source:d.sources.pins,style:z_,renderOrder:be,renderBuffer:48,zIndex:42}),pinLabels:new ee({source:d.sources.pins,style:N_,renderOrder:be,renderBuffer:180,zIndex:45}),gridContext:new ee({source:d.sources.gridContext,style:Qf,renderOrder:be,renderBuffer:40,zIndex:48}),priority:new ee({source:d.sources.priority,style:Y_,renderOrder:be,renderBuffer:220,zIndex:50})},d.engine=new tf({target:b.viewport,layers:Object.values(d.layers),controls:Fs({attribution:!1,rotate:!1,zoom:!1}),interactions:Ys({onFocusOnly:!1}),view:eg(5)}),d.engine.on("movestart",()=>{d.engine.getViewport().classList.add("is-dragging")}),d.engine.on("moveend",()=>{d.engine.getViewport().classList.remove("is-dragging"),Hr()}),d.engine.on("postrender",nh),b.viewport.addEventListener("wheel",()=>{document.activeElement!==b.viewport&&b.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),d.engine.on("singleclick",e=>{if(d.gridEnabled){let r=d.engine.forEachFeatureAtPixel(e.pixel,s=>s.get("gridCell")||null,{hitTolerance:1,layerFilter:s=>s===d.layers.grid||s===d.layers.gridContext});if(r&&r.role!=="leaf"){rh(r.hash);return}}let i=d.engine.forEachFeatureAtPixel(e.pixel,(r,s)=>s!==d.layers.pins&&s!==d.layers.pinLabels&&s!==d.layers.text&&s!==d.layers.textDetail&&s!==d.layers.priority?null:r.get("pin")||null,{hitTolerance:5});i&&fg(i)}),d.engine.on("pointermove",e=>{if(e.dragging){Mo(null);return}let i=d.engine.forEachFeatureAtPixel(e.pixel,(o,a)=>a!==d.layers.pins&&a!==d.layers.pinLabels&&a!==d.layers.text&&a!==d.layers.textDetail&&a!==d.layers.priority?null:o.get("pin")||null,{hitTolerance:4,layerFilter:o=>o===d.layers.pins||o===d.layers.pinLabels||o===d.layers.text||o===d.layers.textDetail||o===d.layers.priority}),r=i?.category.displayType==="text"?null:i;Mo(r||null);let s=d.gridEnabled&&d.engine.hasFeatureAtPixel(e.pixel,{layerFilter:o=>o===d.layers.grid||o===d.layers.gridContext});d.engine.getTargetElement().style.cursor=i||s?"pointer":""}),d.engine.getViewport().addEventListener("pointerleave",()=>Mo(null))}function eg(n){let t=d.catalog.tileGrid.size;return new Qt({projection:d.projection,center:[t/2,-t/2],resolutions:sg(n),minZoom:0,maxZoom:n,extent:[0,-t,t,0],constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function h_(){b.game.addEventListener("change",()=>th(b.game.value)),b.map.addEventListener("change",()=>ng(Number(b.map.value))),b.variant.addEventListener("change",()=>rg(Number(b.variant.value))),b.legend.addEventListener("change",t=>{let e=t.target;if(e.dataset.group){A_(Number(e.dataset.group));return}if(!e.dataset.category)return;let i=Number(e.dataset.category);e.checked?d.hiddenCategories.delete(i):d.hiddenCategories.add(i),zi(),Jn()});let n=()=>b.layers.classList.add("hover-stale");b.layers.addEventListener("scroll",n,{passive:!0}),b.layers.addEventListener("pointerleave",n),b.layers.addEventListener("pointermove",()=>{b.layers.classList.remove("hover-stale")},{passive:!0}),b.layers.addEventListener("click",t=>{let e=t.target.closest("[data-only-category], [data-only-group]");if(e){t.preventDefault(),t.stopPropagation(),M_(e.dataset.onlyCategory?{category:Number(e.dataset.onlyCategory)}:{group:Number(e.dataset.onlyGroup)});return}let i=t.target.closest("[data-section]");if(!i)return;let r=i.dataset.section;d.collapsedSections.has(r)?d.collapsedSections.delete(r):d.collapsedSections.add(r),lg()}),b.soloChip.addEventListener("click",()=>Po(!0)),Z("#show-all").addEventListener("click",()=>Po(!0)),Z("#hide-all").addEventListener("click",()=>Po(!1)),b.zoneToggle.addEventListener("change",()=>{ch(b.zoneToggle.checked)}),b.zoneIndex.addEventListener("click",t=>{let e=t.target.closest("[data-zone]");e&&S_(Number(e.dataset.zone))}),b.zoneIndex.addEventListener("contextmenu",t=>{let e=t.target.closest("[data-zone]");e&&(t.preventDefault(),T_(Number(e.dataset.zone)))}),b.search.addEventListener("input",()=>{d.search=b.search.value.trim().toLocaleLowerCase(),zi(),uh()}),b.searchResults.addEventListener("click",t=>{let e=t.target.closest("[data-location]");if(!e)return;let i=d.pinByID.get(Number(e.dataset.location));i&&Jf(i)}),b.detailLinks.addEventListener("click",t=>{let e=t.target.closest("[data-location]");if(!e)return;let i=d.pinByID.get(Number(e.dataset.location));i&&Jf(i)}),Z("#close-detail").addEventListener("click",Hn),Z("#zoom-in").addEventListener("click",()=>Ao(1)),Z("#zoom-out").addEventListener("click",()=>Ao(-1)),b.gridBack.addEventListener("click",ag),b.gridInput.addEventListener("input",()=>{let t=Do(),e=[...b.gridInput.value.toLocaleLowerCase()].filter(i=>Fi.includes(i)).slice(0,t).join("");b.gridInput.value=e,rh(e)}),b.viewport.addEventListener("keydown",t=>{if(!tg(t.target)){if(t.key==="+"||t.key==="=")Ao(1);else if(t.key==="-")Ao(-1);else if(t.key==="Escape")Hn();else return;t.preventDefault()}}),window.addEventListener("keydown",t=>{if(!tg(t.target)){if((t.metaKey||t.ctrlKey)&&t.key.toLocaleLowerCase()==="k"){t.preventDefault(),b.search.focus(),b.search.select();return}if((t.metaKey||t.ctrlKey)&&t.key.toLocaleLowerCase()==="b"){t.preventDefault(),__();return}x_(t)||t.key.toLocaleLowerCase()==="z"&&(t.preventDefault(),d.pinLabelsVisible=!d.pinLabelsVisible,b.labelsHint.textContent=`Z \xB7 labels ${d.pinLabelsVisible?"on":"off"}`,d.layers.pinLabels.changed())}}),window.addEventListener("hashchange",()=>{let t=ig();t.game===d.game?.slug&&t.map===d.map?.slug||th(t.game||d.catalog.games[0].slug,t.map)}),window.addEventListener("resize",()=>{d.engine?.updateSize(),nh()}),b.overview.addEventListener("pointerdown",t=>{t.preventDefault(),p_(t)}),b.mobileLegend.addEventListener("click",()=>{let t=b.sidebar.classList.toggle("is-open");b.mobileLegend.setAttribute("aria-expanded",String(t))})}function th(n,t){d.game=d.catalog.games.find(i=>i.slug===n)||d.catalog.games[0],b.game.value=d.game.slug,lh(b.map,d.game.maps,"title","id"),b.map.disabled=d.game.maps.length===1,b.map.title=b.map.disabled?"This game has one map":"Choose a map";let e=t&&d.game.maps.find(i=>i.slug===t);ng((e||d.game.maps[0]).id)}function ig(){let[n,t]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(e=>e.trim());return{game:n,map:t}}function u_(){if(!d.game||!d.map)return;let n=`#${d.game.slug}/${d.map.slug}`;location.hash!==n&&history.replaceState(null,"",n)}function ng(n){d.map=d.game.maps.find(t=>t.id===n)||d.game.maps[0],document.documentElement.style.setProperty("--icon-outset-color",fh()),b.map.value=String(d.map.id),lh(b.variant,d.map.variants,"name"),b.variantField.hidden=d.map.variants.length<2,d.styleCache.clear(),Mo(null),d.gridPrefix="",d.hiddenCategories.clear(),d.collapsedSections.clear(),d.collapsedSections.add("zones");for(let t of d.map.groups)for(let e of t.categories)e.visible||d.hiddenCategories.add(e.id);d.search="",b.search.value="",b.searchResults.hidden=!0,Hn(),E_(),cg(),v_(),rg(0,!0),b.gameTitle.textContent=d.game.title,b.title.textContent=d.map.title,b.meta.textContent=`${dn(d.map.pinCount)} locations \xB7 ${dn(d.map.zones?.length||0)} regions`,b.sidebar.classList.remove("is-open"),b.mobileLegend.setAttribute("aria-expanded","false"),u_()}function rg(n,t=!1){let e=d.variant;d.variant=d.map.variants[n]||d.map.variants[0];let i=d.variant,r=t?null:m_(e,i),s=$n(i);b.variant.value=String(d.map.variants.indexOf(d.variant)),t?d.engine.setView(eg(s)):(d.engine.getView().setMinZoom(i.minZoom),d.engine.getView().setMaxZoom(s));let o=++d.tileRun,a=0;d.tileStats={requested:0,loaded:0,errors:0,peakPending:0},b.loading.hidden=!1;let l=p=>{p.on("tileloadstart",()=>{d.tileRun===o&&(a++,d.tileStats.requested++,d.tileStats.peakPending=Math.max(d.tileStats.peakPending,a))});let _=m=>{d.tileRun===o&&(a=Math.max(0,a-1),m?d.tileStats.errors++:d.tileStats.loaded++,a===0&&d.tileStats.loaded>0&&(b.loading.hidden=!0))};return p.on("tileloadend",()=>_(!1)),p.on("tileloaderror",()=>_(!0)),p},h=(p,_)=>l(new $f({projection:d.projection,tileGrid:new jr({extent:[0,-d.catalog.tileGrid.size,d.catalog.tileGrid.size,0],origin:[0,0],resolutions:sg(p),tileSize:d.catalog.tileGrid.tileSize}),cacheSize:64,interpolate:i.interpolate,transition:0,wrapX:!1,tileUrlFunction:([m,x,E])=>{let C=i.formats[m];if(!(!C||x<0||E<0||!_(m,x,E)))return`/static/tiles/${encodeURIComponent(i.tiles)}/${m}/${x}/${E}.${C}`}})),c=i.fullZoom??i.maxZoom,u=h(c,(p,_,m)=>eh(i,p,_,m)),f=d.layers.raster.getSource();d.layers.raster.setSource(u),d.layers.raster.setExtent(un()),d.layers.raster.setBackground(i.background||void 0),f?.clear();let g=d.layers.rasterDetail.getSource();i.maxZoom>c?(d.layers.rasterDetail.setSource(h(i.maxZoom,(p,_,m)=>p>c&&eh(i,p,_,m))),d.layers.rasterDetail.setExtent(un()),d.layers.rasterDetail.setVisible(!0)):d.layers.rasterDetail.setVisible(!1),g?.clear(),sh(),d.gridEnabled&&(fn(),d.layers.pins.changed(),d.layers.text.changed(),d.layers.priority.changed()),d.overviewKey="",g_(),d.renderedShard!==(i.shard||0)&&(cg(),zi()),t?requestAnimationFrame(D_):(r&&d.engine.getView().animate({center:r,duration:200}),Hr())}function eh(n,t,e,i){let r=n.coverage?.[t];if(!r)return!0;let s=e-r.x,o=i-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=d_(n,t,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function d_(n,t,e){if(!e.decoded){let i=atob(e.bits),r=new Uint8Array(i.length);for(let s=0;s<i.length;s++)r[s]=i.charCodeAt(s);e.decoded=r}return e.decoded}function sg(n){let t=d.catalog.tileGrid.size/d.catalog.tileGrid.tileSize;return Array.from({length:n+1},(e,i)=>t/2**i)}function $n(n){return n.maxZoom+a_}var f_=168;function g_(){let n=d.variant,t=b.overviewCanvas,e=t.getContext("2d"),i=un(),r=d.catalog.tileGrid.size,s=d.catalog.tileGrid.tileSize,o=i[2]-i[0],a=i[3]-i[1],l=0;for(;l<n.fullZoom&&Math.max(o,a)/r*s*2**l<f_;)l++;let h=s*2**l/r;t.width=Math.max(1,Math.round(o*h)),t.height=Math.max(1,Math.round(a*h)),e.clearRect(0,0,t.width,t.height),n.background&&(e.fillStyle=n.background,e.fillRect(0,0,t.width,t.height));let c=++d.overviewRun,u=n.formats[l],f=Math.floor(i[0]/r*2**l),g=Math.ceil(i[2]/r*2**l),p=Math.floor(-i[3]/r*2**l),_=Math.ceil(-i[1]/r*2**l);for(let m=p;m<_;m++)for(let x=f;x<g;x++){if(!u||!eh(n,l,x,m))continue;let E=new Image;E.onload=()=>{d.overviewRun===c&&e.drawImage(E,x*s-i[0]*h,m*s+i[3]*h,s,s)},E.src=`/static/tiles/${encodeURIComponent(n.tiles)}/${l}/${x}/${m}.${u}`}nh()}function nh(){let n=d.engine?.getView();if(!n||!d.variant)return;let t=un(),e=n.calculateExtent(d.engine.getSize()),i=t[2]-t[0],r=t[3]-t[1],s=(n.getResolution()||0)*4,o=e[0]<=t[0]+s&&e[1]<=t[1]+s&&e[2]>=t[2]-s&&e[3]>=t[3]-s,a=o?"hidden":e.map(Math.round).join(",");if(a===d.overviewKey||(d.overviewKey=a,b.overview.hidden=o,o))return;let l=b.overviewCanvas,h=Di((e[0]-t[0])/i,0,1),c=Di((e[2]-t[0])/i,0,1),u=Di((t[3]-e[3])/r,0,1),f=Di((t[3]-e[1])/r,0,1),g=b.overviewViewport.style;g.left=`${h*l.width}px`,g.top=`${u*l.height}px`,g.width=`${Math.max(8,(c-h)*l.width)}px`,g.height=`${Math.max(8,(f-u)*l.height)}px`}function p_(n){let t=d.engine?.getView();if(!t||!d.variant)return;let e=b.overviewCanvas.getBoundingClientRect(),i=un(),r=(s,o,a)=>Di((s-o)/(a-o),0,1);t.animate({center:[i[0]+r(n.clientX,e.left,e.right)*(i[2]-i[0]),i[3]-r(n.clientY,e.top,e.bottom)*(i[3]-i[1])],duration:180})}function m_(n,t){if(!n||!t||!n.shard||!t.shard||n.shard===t.shard||!n.bounds||!t.bounds)return null;let i=d.engine?.getView()?.getCenter();if(!i)return null;let r=(i[0]-n.bounds.x)/n.bounds.width,s=(-i[1]-n.bounds.y)/n.bounds.height;return[t.bounds.x+Di(r,0,1)*t.bounds.width,-(t.bounds.y+Di(s,0,1)*t.bounds.height)]}function __(){let t=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");b.mobileLegend.setAttribute("aria-expanded",String(!t)),requestAnimationFrame(()=>d.engine?.updateSize())}function un(){let n=d.catalog.tileGrid.size,t=d.variant?.bounds||{x:0,y:0,width:n,height:n};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}function x_(n){return n.key.toLocaleLowerCase()==="g"?(n.preventDefault(),og(),!0):n.key==="Escape"&&d.gridEnabled?(n.preventDefault(),ag(),!0):!1}function og(n=!d.gridEnabled){d.gridEnabled=n,sh(),fn(),d.layers.pins.changed(),d.layers.text.changed(),d.layers.priority.changed()}function rh(n){let t=Do(),e=[...n.toLocaleLowerCase()].filter(r=>Fi.includes(r)).slice(0,t).join(""),i=e!==d.gridPrefix;d.gridPrefix=e,d.gridEnabled||(d.gridEnabled=!0),sh(),fn(),d.layers.pins.changed(),d.layers.text.changed(),d.layers.priority.changed(),i&&(Hn(),d.engine.getView().fit(ko(),{size:d.engine.getSize(),padding:[52,52,52,52],maxZoom:$n(d.variant),duration:180}))}function ag(){if(d.gridEnabled){if(!d.gridPrefix){og(!1);return}rh(d.gridPrefix.slice(0,-1))}}function sh(){if(!d.sources||(d.sources.grid.clear(),d.sources.gridContext.clear(),b.gridNavigator.hidden=!d.gridEnabled,b.gridHint.textContent=d.gridEnabled?`G \xB7 ${d.gridPrefix||"root"}`:"G \xB7 grid off",!d.gridEnabled||!d.variant))return;let n=Do();if(b.gridInput.maxLength=n,b.gridInput.value=d.gridPrefix,b.gridBack.title=d.gridPrefix?"Back one geohash level":"Close geohash grid",y_(),d.gridPrefix.length>=n){ih(d.gridPrefix,ko(),"leaf");return}for(let t of Fi){let e=d.gridPrefix+t;ih(e,oh(e),"child")}}function y_(){for(let n=0;n<d.gridPrefix.length;n++){let t=d.gridPrefix.slice(0,n),e=d.gridPrefix.slice(0,n+1);for(let i of Fi){let r=t+i;r!==e&&ih(r,oh(r),"neighbor",d.gridPrefix.length-n)}}}function ih(n,t,e,i=0){let[r,s,o,a]=t,l=d.pins.filter(u=>{if(u.filteredHidden)return!1;let[f,g]=u.coordinate;return f>=r&&f<=o&&g>=s&&g<=a}).length,h=new lr({geometry:new Ci([[[r,s],[r,a],[o,a],[o,s],[r,s]]]),gridCell:{hash:n,extent:t,role:e,count:l,contextDistance:i},priority:e==="neighbor"?-i*100+Fi.indexOf(n[n.length-1]):Fi.indexOf(n[n.length-1])});(e==="neighbor"?d.sources.gridContext:d.sources.grid).addFeature(h)}function ko(){return oh(d.gridPrefix)}function oh(n){let t=[...un()],e=!0;for(let i of n){let r=Fi.indexOf(i);if(!(r<0))for(let s of[16,8,4,2,1]){if(e){let o=(t[0]+t[2])/2;r&s?t[0]=o:t[2]=o}else{let o=(t[1]+t[3])/2;r&s?t[1]=o:t[3]=o}e=!e}}return t}function Do(){return o_}function ah(n){if(!d.gridEnabled||!d.gridPrefix)return!1;let t=ko(),[e,i]=n.coordinate;return e>=t[0]&&e<=t[2]&&i>=t[1]&&i<=t[3]}function lh(n,t,e,i){n.replaceChildren(),t.forEach((r,s)=>{let o=document.createElement("option");o.value=i?String(r[i]):r.slug||String(s),o.textContent=r[e],n.append(o)})}function E_(){let n=document.createDocumentFragment();for(let t of d.map.groups){if(!t.categories.length)continue;let e=document.createElement("section");e.className="layer-section",e.dataset.groupSection=String(t.id);let i=t.categories.reduce((s,o)=>s+o.locations.length,0);e.append(w_(`group-${t.id}`,t.title,i,t.id));let r=document.createElement("div");r.className="category-toggles";for(let s of t.categories)r.append(C_(s));e.append(r),n.append(e)}b.legend.replaceChildren(n),lg(),Jn()}function w_(n,t,e,i){let r=document.createElement("div");r.className="layer-header";let s=document.createElement("button");s.type="button",s.className="layer-title",s.dataset.section=n;let o=document.createElement("span");o.className="layer-chevron",o.setAttribute("aria-hidden","true"),o.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let a=document.createElement("span");a.textContent=t;let l=document.createElement("span");l.className="layer-count",l.textContent=dn(e),s.append(o,a,l);let h=document.createElement("button");h.type="button",h.className="only-button only-group",h.dataset.onlyGroup=String(i),h.textContent="only",h.title=`Show only ${t}`;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.group=String(i),u.setAttribute("aria-label",`Show ${t}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),r.append(s,h,c),r}function C_(n){let t=n.displayType==="text",e=document.createElement("label");e.className="category-row",gh(e,n);let i=document.createElement("input");i.type="checkbox",i.dataset.category=String(n.id),i.checked=!d.hiddenCategories.has(n.id);let r=document.createElement("span");t?(r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label"):(r.className="category-icon",ph(r,n,No(n.title)),r.title=n.icon||n.title);let s=document.createElement("span");s.className="category-name",s.textContent=n.title;let o=document.createElement("span");o.className="category-count",o.textContent=dn(n.locations.length);let a=document.createElement("button");return a.type="button",a.className="only-button",a.dataset.onlyCategory=String(n.id),a.textContent="only",a.title=`Show only ${n.title}`,e.append(i,r,s,a,o),e}function lg(){for(let n of b.layers.querySelectorAll("[data-section]")){let t=d.collapsedSections.has(n.dataset.section);n.setAttribute("aria-expanded",String(!t)),n.closest(".layer-section").classList.toggle("is-collapsed",t)}}function v_(){d.sources.pins.clear(),d.sources.text.clear(),d.sources.priority.clear(),d.pins=[],d.pinByID.clear();for(let n of d.map.groups)for(let t of n.categories){t.displayType!=="text"&&U_(t);for(let e of t.locations){let i={location:e,category:t,group:n,coordinate:hh(e.lat,e.lng),filteredHidden:!1,priority:H_(t,e),feature:null};i.feature=new lr({geometry:new wi(i.coordinate),pin:i,priority:i.priority}),d.pins.push(i),d.pinByID.set(e.id,i),t.displayType==="text"?d.sources.text.addFeature(i.feature):d.sources.pins.addFeature(i.feature)}}zi()}function cg(){let n=(d.map.zones||[]).filter(xg);d.renderedShard=d.variant?.shard||0,d.sources.zones.clear(),d.sources.zoneTitles.clear(),d.zoneRecords.clear(),d.highlightedZones.clear(),d.focusedZoneID=null,d.zoneTitleCount=0,ch(!0),b.zoneIndex.hidden=n.length===0,b.zoneCount.textContent=dn(n.length);for(let t of n){let e=ut(),i=[],r=!1;for(let l of t.features||[]){let h=I_(l);h&&(r=!0,i.push(h),fs(e,h.getExtent()),d.sources.zones.addFeature(new lr({geometry:h,zone:t,color:qn(t.id),child:t.parentRegionId!=null})))}if(!r)continue;let s=qn(t.id),o=t.center?hh(t.center.lat,t.center.lng):Bt(e),a=Math.max(e[2]-e[0],e[3]-e[1]);d.sources.zoneTitles.addFeature(new lr({geometry:new wi(o),zone:t,color:s,child:t.parentRegionId!=null,span:a,priority:(t.parentRegionId==null?2e6:1e6)+Math.round(a)})),d.zoneRecords.set(t.id,{zone:t,extent:e.slice(),geometries:i,color:s})}d.zoneTitleCount=d.sources.zoneTitles.getFeatures().length,b_()}function b_(){let n=document.createDocumentFragment();for(let{zone:t,depth:e}of R_()){let i=d.zoneRecords.get(t.id);if(!i)continue;let r=document.createElement("button");r.type="button",r.className="zone-index-item",r.dataset.zone=String(t.id),r.style.setProperty("--zone-color",i.color),r.style.setProperty("--zone-depth",String(e)),r.setAttribute("aria-pressed","false"),r.title=`${t.title}: click to jump; right-click to toggle highlight`;let s=document.createElement("span");s.className="zone-index-marker",s.setAttribute("aria-hidden","true");let o=document.createElement("span");o.textContent=t.title,r.append(s,o),n.append(r)}b.zoneList.replaceChildren(n),b.zoneIndex.hidden=d.zoneRecords.size===0}function R_(){let n=[...d.zoneRecords.values()].map(o=>o.zone),t=new Set(n.map(o=>o.id)),e=new Map;for(let o of n){let a=t.has(o.parentRegionId)?o.parentRegionId:null;e.has(a)||e.set(a,[]),e.get(a).push(o)}for(let o of e.values())o.sort((a,l)=>a.title.localeCompare(l.title,void 0,{numeric:!0,sensitivity:"base"}));let i=[],r=new Set,s=(o,a)=>{if(!r.has(o.id)){r.add(o.id),i.push({zone:o,depth:a});for(let l of e.get(o.id)||[])s(l,a+1)}};for(let o of e.get(null)||[])s(o,0);for(let o of n)s(o,0);return i}function ch(n){d.zonesVisible=n,b.zoneToggle.checked=n,d.layers.zones.setVisible(n),d.layers.zoneTitles.setVisible(n),d.layers.zoneTitleDetail.setVisible(n)}function S_(n){let t=d.zoneRecords.get(n);t&&(d.focusedZoneID=n,hg(),Hn(),d.engine.getView().fit(t.extent,{size:d.engine.getSize(),padding:[54,54,54,54],maxZoom:$n(d.variant),duration:220}),b.sidebar.classList.remove("is-open"),b.mobileLegend.setAttribute("aria-expanded","false"))}function T_(n){d.zoneRecords.has(n)&&(d.highlightedZones.has(n)?d.highlightedZones.delete(n):(d.highlightedZones.add(n),ch(!0)),d.hoveredPin=null,ug(),dg(),hg(),d.layers.zones.changed(),d.layers.zoneTitles.changed(),d.layers.zoneTitleDetail.changed())}function hg(){b.zoneIndex.classList.toggle("has-highlights",d.highlightedZones.size>0);for(let n of b.zoneList.querySelectorAll("[data-zone]")){let t=Number(n.dataset.zone),e=d.highlightedZones.has(t);n.classList.toggle("is-highlighted",e),n.classList.toggle("is-current",d.focusedZoneID===t),n.setAttribute("aria-pressed",String(e))}}function I_(n){if(!n?.coordinates)return null;let t=([e,i])=>hh(i,e);return n.type==="Polygon"?new Ci(n.coordinates.map(e=>e.map(t))):n.type==="MultiPolygon"?new nf(n.coordinates.map(e=>e.map(i=>i.map(t)))):null}function hh(n,t){let e=d.catalog.tileGrid,i=2**e.sourceZoom,r=(t+180)/360*i,s=n*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*i;return[(r-e.firstTile)*e.tileSize,-(o-e.firstTile)*e.tileSize]}function zi(){for(let n of d.pins){let t=d.hiddenCategories.has(n.category.id),e=d.search&&!n.location.title.toLocaleLowerCase().includes(d.search);n.filteredHidden=!!(t||e)}ug(),dg(),d.selectedPin?.filteredHidden&&Hn()}function ug(){if(!d.highlightedZones.size){for(let t of d.pins)t.insideHighlightedZone=!1;return}let n=[...d.highlightedZones].map(t=>d.zoneRecords.get(t)).filter(Boolean);for(let t of d.pins)t.insideHighlightedZone=n.some(e=>e.geometries.some(i=>L_(i,t.coordinate)))}function L_(n,t){if(n.intersectsCoordinate(t))return!0;let e=n.getClosestPoint(t),i=e[0]-t[0],r=e[1]-t[1];return i*i+r*r<=1}function dg(){d.eligibleLocations=d.pins.filter(n=>!Ke(n)).length,fn(),d.layers.pins.changed(),d.layers.zonePins.changed(),d.layers.pinLabels.changed(),d.layers.text.changed(),d.layers.zoneText.changed(),d.layers.textDetail.changed(),d.layers.priority.changed(),Hr()}function fn(){d.sources.priority.clear();for(let n of d.pins){if(Ke(n))continue;let t=!!d.search&&n.location.title.toLocaleLowerCase().includes(d.search);(n===d.selectedPin||n===d.hoveredPin||t||ah(n))&&d.sources.priority.addFeature(n.feature)}}function Mo(n){d.hoveredPin!==n&&(d.hoveredPin=n,d.sources&&(fn(),d.layers.pins.changed(),d.layers.priority.changed()))}function uh(){if(!d.search){b.searchResults.hidden=!0,b.searchResults.replaceChildren();return}let n=d.pins.filter(e=>!d.hiddenCategories.has(e.category.id)&&e.location.title.toLocaleLowerCase().includes(d.search)).sort((e,i)=>e.location.title.localeCompare(i.location.title)).slice(0,20),t=document.createDocumentFragment();if(!n.length){let e=document.createElement("p");e.className="search-empty",e.textContent="No visible locations match.",t.append(e)}for(let e of n){let i=document.createElement("button");i.type="button",i.className="search-result",i.dataset.location=String(e.location.id),gh(i,e.category);let r=document.createElement("span");r.className="result-dot",ph(r,e.category,No(e.category.title));let s=document.createElement("span"),o=document.createElement("strong");o.textContent=e.location.title;let a=document.createElement("small");a.textContent=`${e.category.title} \xB7 ${e.group.title}`,s.append(o,a),i.append(r,s),t.append(i)}b.searchResults.replaceChildren(t),b.searchResults.hidden=!1}function Po(n){if(d.hiddenCategories.clear(),!n)for(let t of d.map.groups)for(let e of t.categories)d.hiddenCategories.add(e.id);Fo(),zi(),uh(),Jn()}function Fo(){for(let n of document.querySelectorAll("[data-category]"))n.checked=!d.hiddenCategories.has(Number(n.dataset.category))}function A_(n){let t=d.map.groups.find(i=>i.id===n);if(!t)return;let e=t.categories.some(i=>!d.hiddenCategories.has(i.id));for(let i of t.categories)e?d.hiddenCategories.add(i.id):d.hiddenCategories.delete(i.id);Fo(),zi(),Jn()}function M_(n){if(d.map){if(P_(n)){Po(!0);return}d.hiddenCategories.clear();for(let t of d.map.groups){let e=n.group===t.id;for(let i of t.categories)!e&&n.category!==i.id&&d.hiddenCategories.add(i.id)}Fo(),zi(),uh(),Jn()}}function P_(n){for(let t of d.map.groups)for(let e of t.categories)if((n.group===t.id||n.category===e.id)===d.hiddenCategories.has(e.id))return!1;return!0}function O_(){let n=b.soloChip;if(!d.map){n.hidden=!0;return}let t=null,e=0,i=null,r=0;for(let o of d.map.groups){let a=0;for(let l of o.categories)d.hiddenCategories.has(l.id)||(a++,e++,t=l);a>0&&(r++,i=a===o.categories.length?o:null)}let s="";e===1&&t?s=t.title:r===1&&i&&(s=i.title),n.hidden=!s,n.textContent=s?`only: ${s}`:"",n.title=s?`Showing only ${s} \u2014 click to show everything`:""}function Jn(){if(d.map){for(let n of d.map.groups){let t=b.legend.querySelector(`input[data-group="${n.id}"]`);t&&(t.checked=n.categories.some(e=>!d.hiddenCategories.has(e.id)))}O_()}}function Jf(n){d.hiddenCategories.delete(n.category.id),d.search="",b.search.value="",b.searchResults.hidden=!0,Fo(),zi(),Jn(),fg(n,!0)}function fg(n,t=!1){if(d.selectedPin=n,fn(),d.layers.pins.changed(),d.layers.pinLabels.changed(),d.layers.text.changed(),d.layers.textDetail.changed(),d.layers.priority.changed(),b.detailTitle.textContent=n.location.title,b.detailCategory.textContent=`${n.group.title} / ${n.category.title}`,b.detailDescription.textContent=J_(n.location.description)||"No description is included in the archive.",b.detailID.textContent=String(n.location.id),b.detailCoordinates.textContent=`${n.location.lat.toFixed(6)}, ${n.location.lng.toFixed(6)}`,k_(n),gh(b.detailDot,n.category),ph(b.detailDot,n.category,No(n.category.title)),b.detail.hidden=!1,t){let e=d.engine.getView();e.animate({center:n.coordinate,zoom:Math.min($n(d.variant),Math.max(e.getZoom()||0,4)),duration:220})}}function k_(n){let t=(n.location.links||[]).filter(i=>d.pinByID.has(i.locationId));if(b.detailLinks.hidden=t.length===0,!t.length){b.detailLinks.replaceChildren();return}let e=document.createDocumentFragment();for(let i of t){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(i.locationId),r.textContent=i.title,e.append(r)}b.detailLinks.replaceChildren(e)}function Hn(){d.selectedPin=null,d.sources&&(fn(),d.layers.pins.changed(),d.layers.pinLabels.changed(),d.layers.text.changed(),d.layers.textDetail.changed(),d.layers.priority.changed()),b.detail.hidden=!0}function D_(){if(!d.engine||!d.variant)return;let n=d.engine.getView();n.fit(un(),{size:d.engine.getSize(),padding:[36,36,36,36],maxZoom:d.variant.maxZoom,duration:0}),d.fitZoom=n.getZoom()||0,Hr()}function Ao(n){let t=d.engine.getView(),e=t.getZoom()||0;t.animate({zoom:Di(e+n,d.variant.minZoom,$n(d.variant)),duration:140})}function Hr(){let n=d.engine?.getView().getZoom();if(b.viewport.dataset.zoom=Number.isFinite(n)?n.toFixed(3):"",!d.engine||!d.pins.length){b.visibleCount.textContent="0 locations visible";return}let t=d.engine.getView().calculateExtent(d.engine.getSize()),e=0;for(let i of d.pins){if(Ke(i))continue;let[r,s]=i.coordinate;r>=t[0]&&r<=t[2]&&s>=t[1]&&s<=t[3]&&e++}b.visibleCount.textContent=`${dn(d.eligibleLocations)} enabled \xB7 ${dn(e)} in view`}function be(n,t){return(n.get("priority")||0)-(t.get("priority")||0)}function F_(n){let t=n.get("pin");return!t||Ke(t)||t.insideHighlightedZone||qr(t)?null:dh(t,!1)}function z_(n){let t=n.get("pin");return!t||!d.highlightedZones.size||!t.insideHighlightedZone||Ke(t)||qr(t)?null:dh(t,!1)}function N_(n){let t=n.get("pin");return!t||Ke(t)||!d.pinLabelsVisible||!$r()?null:gg(t)}function G_(n){let t=n.get("pin");if(!t||Ke(t)||t.insideHighlightedZone||qr(t)||$r())return null;let e=d.fitZoom+Math.log2(q_(t.category));return(d.engine.getView().getZoom()||0)<e?null:zo(t,!1)}function X_(n){let t=n.get("pin");return!t||Ke(t)||t.insideHighlightedZone||qr(t)||!$r()?null:zo(t,!1)}function W_(n){let t=n.get("pin");return!t||!d.highlightedZones.size||!t.insideHighlightedZone||Ke(t)||qr(t)?null:zo(t,!1)}function Y_(n){let t=n.get("pin");if(!t||Ke(t))return null;if(t.category.displayType==="text")return zo(t,t===d.selectedPin);let e=dh(t,t===d.selectedPin);return t===d.hoveredPin||t===d.selectedPin?[e,gg(t)]:e}function dh(n,t){let e=`marker:${n.category.id}:${t?1:0}`;if(d.styleCache.has(e))return d.styleCache.get(e);let i=n.category.color||qn(n.category.id),r=t?2e7:n.priority,s=d.markerIcons.get(pg(n.category)),o;return s?o=new Mt({image:new an({src:s,width:t?36:31,height:t?36:31}),zIndex:r}):o=new Mt({text:new si({text:No(n.category.title),font:`900 ${t?15:13}px Inter, sans-serif`,fill:new _t({color:i}),stroke:new At({color:fh(),width:t?4:3})}),zIndex:r}),d.styleCache.set(e,o),o}function gg(n){let t=`marker-label:${n.location.id}`;if(d.styleCache.has(t))return d.styleCache.get(t);let e=new Mt({text:new si({text:n.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new _t({color:"#f4f6ed"}),stroke:new At({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new _t({color:"rgba(10,13,9,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:n.priority});return d.styleCache.set(t,e),e}function U_(n){if(!n.iconAsset)return;let t=pg(n);if(d.markerIcons.has(t))return;d.markerIcons.set(t,null);let e=new Image;e.onload=()=>{let i=document.createElement("canvas");i.width=64,i.height=64;let r=i.getContext("2d"),s=n.color||qn(n.id),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!n.iconPicture,a.drawImage(e,6,6,52,52),n.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let h=l.getContext("2d");h.drawImage(e,6,6,52,52),h.globalCompositeOperation="source-in",h.fillStyle=fh(),h.fillRect(0,0,64,64);for(let c=-3;c<=3;c++)for(let u=-3;u<=3;u++)u*u+c*c<=10&&r.drawImage(l,u,c);r.drawImage(o,0,0),d.markerIcons.set(t,i.toDataURL("image/png")),d.styleCache.delete(`marker:${n.id}:0`),d.styleCache.delete(`marker:${n.id}:1`),d.layers.pins.changed(),d.layers.zonePins.changed(),d.layers.priority.changed()},e.onerror=()=>d.markerIcons.set(t,!1),e.src=yg(n.iconAsset)}function pg(n){return`${n.iconAsset||""}:${n.color||qn(n.id)}:${d.map?.iconOutset||"light"}`}function fh(){return d.map?.iconOutset==="dark"?"rgba(7, 9, 7, 0.98)":"rgba(255, 255, 255, 0.96)"}function zo(n,t){let e=`text:${n.location.id}:${t?1:0}`;if(d.styleCache.has(e))return d.styleCache.get(e);let r=[new Mt({text:new si({text:n.location.title,font:`${t?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new _t({color:t?"#d6f36b":"#f3f5e9"}),stroke:new At({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new _t({color:t?"rgba(17,21,14,0.9)":"rgba(10,13,9,0.58)"}),backgroundStroke:t?new At({color:"#d6f36b",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:t?2e7:n.priority+3e6})];return d.styleCache.set(e,r),r}function Qf(n){let t=n.get("gridCell");if(!t)return null;let e=`grid:${t.hash}:${t.role}:${t.contextDistance}`;if(d.styleCache.has(e))return d.styleCache.get(e);let i=Oo[Math.max(0,Fi.indexOf(t.hash[t.hash.length-1]))%Oo.length],r=t.role==="leaf",s=t.role==="neighbor",o=new Mt({fill:new _t({color:s?`rgba(3, 5, 3, ${Math.min(.52,.3+t.contextDistance*.06)})`:ki(i,r?.14:.055)}),stroke:new At({color:r?"#ffffff":ki(i,s?.44:.82),width:r?2.5:s?1:1.4}),text:new si({text:t.hash,font:`${r?"900 17px":s?"750 11px":"800 13px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new _t({color:r?"#ffffff":s?ki(i,.72):i}),stroke:new At({color:"rgba(0,0,0,0.96)",width:4}),backgroundFill:new _t({color:s?"rgba(4,6,4,0.88)":"rgba(9,12,8,0.76)"}),padding:s?[2,4,2,4]:[3,5,3,5],overflow:!0}),zIndex:r?100:n.get("priority")});return d.styleCache.set(e,o),o}function K_(n){if(!d.zonesVisible)return null;let t=n.get("zone"),e=n.get("child"),i=d.highlightedZones.has(t.id),r=_g(t.id),s=`zone:${t.id}:${e?1:0}:${i?1:r?2:0}`;if(d.styleCache.has(s))return d.styleCache.get(s);let o=n.get("color");if(r){let h=new Mt({fill:new _t({color:`rgba(3, 5, 3, ${e?.38:.32})`}),stroke:new At({color:ki(o,e?.24:.32),width:e?1:1.3,lineDash:e?[3,4]:[7,5]}),zIndex:e?101:100});return d.styleCache.set(s,h),h}let a=new Mt({fill:new _t({color:ki(o,e?.035:.07)}),stroke:new At({color:ki(o,e?.5:.72),width:e?1.2:1.8,lineDash:e?[3,4]:[7,5]})});if(!i)return d.styleCache.set(s,a),a;let l=[new Mt({stroke:new At({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Mt({fill:new _t({color:ki(o,.22)}),stroke:new At({color:o,width:2.6}),zIndex:9001})];return d.styleCache.set(s,l),l}function Z_(n){if(!d.zonesVisible||$r())return null;let t=n.get("child"),e=d.highlightedZones.has(n.get("zone").id),i=d.engine.getView().getZoom()||0;if(!e&&t&&i<d.fitZoom+3)return null;let r=n.get("span")/d.engine.getView().getResolution();return!e&&d.zoneTitleCount>40&&r<52?null:mg(n)}function B_(n){return!d.zonesVisible||!$r()?null:mg(n)}function mg(n){let t=n.get("child"),e=n.get("zone"),i=d.highlightedZones.has(e.id),r=_g(e.id),s=`zone-title:${e.id}:${t?1:0}:${i?1:r?2:0}`;if(d.styleCache.has(s))return d.styleCache.get(s);let o=n.get("color"),a=new Mt({text:new si({text:e.title.toLocaleUpperCase(),font:`${t?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new _t({color:i?"#11140f":r?"rgba(185,192,177,0.56)":t?"#c7ccbd":"#f1f4e7"}),stroke:new At({color:i?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:i?2:r?3:4}),backgroundFill:new _t({color:i?o:r?"rgba(4,6,4,0.84)":"rgba(11,14,10,0.72)"}),backgroundStroke:new At({color:i?"#ffffff":ki(o,r?.24:.55),width:i?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:i?91e5:n.get("priority")});return d.styleCache.set(s,a),a}function _g(n){if(!d.highlightedZones.size||d.highlightedZones.has(n))return!1;for(let t of d.highlightedZones)if(V_(n,t))return!1;return!0}function V_(n,t){let e=new Set,i=d.zoneRecords.get(t)?.zone.parentRegionId;for(;i!=null&&!e.has(i);){if(i===n)return!0;e.add(i),i=d.zoneRecords.get(i)?.zone.parentRegionId}return!1}function qr(n){return n===d.selectedPin||n===d.hoveredPin||ah(n)||!!d.search&&n.location.title.toLocaleLowerCase().includes(d.search)}function Ke(n){return n.filteredHidden||j_(n)||!xg(n.location)}function xg(n){let t=d.variant?.shard;return!t||!n.shard||n.shard===t}function j_(n){return!d.highlightedZones.size||n.insideHighlightedZone||n===d.selectedPin?!1:!(d.search&&n.location.title.toLocaleLowerCase().includes(d.search))}function H_(n,t){return Math.max(0,1e6-Math.min(n.locations.length,999)*1e3)+$_(t.id)%1e3}function q_(n){return n.locations.length>200?4:n.locations.length>75?2.5:1}function $r(){return(d.engine?.getView().getZoom()||0)>=(d.variant?.maxZoom||0)-.05}function $_(n){return Math.imul(Number(n)||0,2654435761)>>>0}function qn(n){let t=Math.abs(Number(n)||0);return Oo[(Math.imul(t,2654435761)>>>0)%Oo.length]}function ki(n,t){let e=String(n||"#ffffff").replace("#",""),i=e.length===3?e.split("").map(s=>s+s).join(""):e.slice(0,6).padEnd(6,"f"),r=Number.parseInt(i,16);return`rgba(${r>>16&255}, ${r>>8&255}, ${r&255}, ${t})`}function gh(n,t){n.style.setProperty("--pin-color",t.color||qn(t.id))}function ph(n,t,e){if(n.classList.remove("has-source-icon"),n.style.removeProperty("--pin-icon"),n.textContent="",!t.iconAsset){n.textContent=e;return}n.style.setProperty("--pin-icon",`url("${yg(t.iconAsset)}")`),n.classList.add("has-source-icon")}function yg(n){return`/static/icons/${n.split("/").map(e=>encodeURIComponent(e)).join("/")}`}function No(n){return n.split(/\s+/).slice(0,2).map(t=>t[0]||"").join("")}function J_(n){return String(n||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`88 99 `).trim()}function dn(n){return new Intl.NumberFormat().format(n)}function Di(n,t,e){return Math.min(e,Math.max(t,n))}function tg(n){return n instanceof HTMLElement&&(n.matches("input, textarea, select")||n.isContentEditable)}function Q_(){let n=()=>({game:d.game?.title,map:d.map?.title,variant:d.variant?.name,zoom:d.engine?.getView().getZoom(),center:d.engine?.getView().getCenter(),resolution:d.engine?.getView().getResolution(),nativeMaxZoom:d.variant?.maxZoom,maxZoom:d.variant?$n(d.variant):null,interpolate:d.variant?.interpolate,tileStats:{...d.tileStats},pins:d.pins.length,eligibleLocations:d.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,pinLabelsVisible:d.pinLabelsVisible,hoveredPin:d.hoveredPin?.location.title||null,zones:{visible:d.zonesVisible,count:d.zoneRecords.size,focused:d.zoneRecords.get(d.focusedZoneID)?.zone.title||null,highlighted:[...d.highlightedZones].map(t=>d.zoneRecords.get(t)?.zone.title).filter(Boolean),focusedPins:d.pins.filter(t=>!t.filteredHidden&&t.insideHighlightedZone).length},grid:{enabled:d.gridEnabled,prefix:d.gridPrefix,maximumDepth:Do(),extent:d.gridEnabled?ko():null,cells:[...d.sources.grid.getFeatures(),...d.sources.gridContext.getFeatures()].map(t=>t.get("gridCell")),priorityPins:d.gridPrefix?d.pins.filter(t=>!t.filteredHidden&&ah(t)).length:0}});window.__atlasDebug={snapshot:n,setLayerVisible:(t,e)=>d.layers[t]?.setVisible(e)},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...n()}),window.advanceTime=()=>d.engine?.renderSync()}l_();})();